Hello Martin Roth, Marc Jones, Johnny Lin, Angel Pons,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/45769
to review the following change.
Change subject: [RFC] Introduce mainboard_get_option() ......................................................................
[RFC] Introduce mainboard_get_option()
Add a cmos_get_option() equivalent that queries mainboard-specific code for option values. CMOS option values take precedence over mainboard options.
Change-Id: I3ff055875c50b8bf097acd58eeb001d5b91a5dcd Signed-off-by: Nico Huber nico.h@gmx.de --- M src/Kconfig M src/include/option.h 2 files changed, 16 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/45769/1
diff --git a/src/Kconfig b/src/Kconfig index e46a6e6..40310bb 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -135,6 +135,13 @@ every boot. Use this if you want the NVRAM configuration to never be modified from its default values.
+config USE_MAINBOARD_OPTIONS + bool + help + Allows mainboard code to implement a mainboard_get_option() for + querying configuration values. CMOS option values take precedence + over mainboard options. + config COMPRESS_RAMSTAGE bool "Compress ramstage with LZMA" depends on HAVE_RAMSTAGE diff --git a/src/include/option.h b/src/include/option.h index 6b4e6a9..86c8ff1 100644 --- a/src/include/option.h +++ b/src/include/option.h @@ -10,6 +10,8 @@ enum cb_err cmos_set_option(const char *name, void *val); enum cb_err cmos_get_option(void *dest, const char *name);
+enum cb_err mainboard_get_option(void *dest, const char *name); + static inline enum cb_err set_option(const char *name, void *val) { if (CONFIG(USE_OPTION_TABLE)) @@ -20,10 +22,14 @@
static inline enum cb_err get_option(void *dest, const char *name) { - if (CONFIG(USE_OPTION_TABLE)) - return cmos_get_option(dest, name); + enum cb_err ret = CB_CMOS_OTABLE_DISABLED;
- return CB_CMOS_OTABLE_DISABLED; + if (CONFIG(USE_OPTION_TABLE)) + ret = cmos_get_option(dest, name); + if (CONFIG(USE_MAINBOARD_OPTIONS) && ret != CB_SUCCESS) + ret = mainboard_get_option(dest, name); + + return ret; }
#endif /* _OPTION_H_ */