Attention is currently required from: Alexander Couzens, Patrick Rudolph. Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/52512 )
Change subject: src: Replace remaining {get,set}_option() instances ......................................................................
src: Replace remaining {get,set}_option() instances
With this change, the type-unsafe {get,set}_option() API functions are no longer used directly. Remove these old functions to prevent any new uses from creeping in.
Change-Id: Id3f3e172c850d50a7d2f348b1c3736969c73837d Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/console/init.c M src/cpu/intel/hyperthreading/intel_sibling.c M src/drivers/lenovo/hybrid_graphics/hybrid_graphics.c M src/drivers/lenovo/hybrid_graphics/romstage.c M src/include/option.h M src/mainboard/lenovo/x60/smihandler.c 6 files changed, 18 insertions(+), 30 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/12/52512/1
diff --git a/src/console/init.c b/src/console/init.c index c598077..fdc1467 100644 --- a/src/console/init.c +++ b/src/console/init.c @@ -26,7 +26,7 @@ console_loglevel = get_console_loglevel();
if (!FIRST_CONSOLE) - get_option(&console_loglevel, "debug_level"); + console_loglevel = get_int_option("debug_level", console_loglevel); }
int console_log_level(int msg_level) diff --git a/src/cpu/intel/hyperthreading/intel_sibling.c b/src/cpu/intel/hyperthreading/intel_sibling.c index ef3367d..888a2fd 100644 --- a/src/cpu/intel/hyperthreading/intel_sibling.c +++ b/src/cpu/intel/hyperthreading/intel_sibling.c @@ -21,7 +21,7 @@ /* On the bootstrap processor see if I want sibling cpus enabled */ if (first_time) { first_time = 0; - get_option(&disable_siblings, "hyper_threading"); + disable_siblings = get_int_option("hyper_threading", disable_siblings); } result = cpuid(1); /* Is hyperthreading supported */ diff --git a/src/drivers/lenovo/hybrid_graphics/hybrid_graphics.c b/src/drivers/lenovo/hybrid_graphics/hybrid_graphics.c index 8f0e7bd..bae8a54 100644 --- a/src/drivers/lenovo/hybrid_graphics/hybrid_graphics.c +++ b/src/drivers/lenovo/hybrid_graphics/hybrid_graphics.c @@ -14,7 +14,7 @@ static void lenovo_hybrid_graphics_enable(struct device *dev) { const struct drivers_lenovo_hybrid_graphics_config *config; - enum hybrid_graphics_req mode = HYBRID_GRAPHICS_DEFAULT_GPU; + enum hybrid_graphics_req mode;
/* Don't confuse anyone else and disable the fake device */ dev->enabled = 0; @@ -25,7 +25,7 @@ return; }
- get_option(&mode, "hybrid_graphics_mode"); + mode = get_int_option("hybrid_graphics_mode", HYBRID_GRAPHICS_DEFAULT_GPU);
if (mode == HYBRID_GRAPHICS_DISCRETE) { printk(BIOS_DEBUG, "Hybrid graphics:" diff --git a/src/drivers/lenovo/hybrid_graphics/romstage.c b/src/drivers/lenovo/hybrid_graphics/romstage.c index 3d14646..747c9b7 100644 --- a/src/drivers/lenovo/hybrid_graphics/romstage.c +++ b/src/drivers/lenovo/hybrid_graphics/romstage.c @@ -18,7 +18,7 @@ { const struct drivers_lenovo_hybrid_graphics_config *config; const struct device *dev; - enum hybrid_graphics_req mode = HYBRID_GRAPHICS_DEFAULT_GPU; + enum hybrid_graphics_req mode;
/* TODO: Use generic device instead of dummy PNP device */ dev = dev_find_slot_pnp(HYBRID_GRAPHICS_PORT, HYBRID_GRAPHICS_DEVICE); @@ -39,7 +39,7 @@ return; }
- get_option(&mode, "hybrid_graphics_mode"); + mode = get_int_option("hybrid_graphics_mode", HYBRID_GRAPHICS_DEFAULT_GPU);
if (mode == HYBRID_GRAPHICS_DISCRETE) { printk(BIOS_DEBUG, "Hybrid graphics:" diff --git a/src/include/option.h b/src/include/option.h index afbff1d..c9c8f99 100644 --- a/src/include/option.h +++ b/src/include/option.h @@ -8,31 +8,22 @@ enum cb_err cmos_set_option(const char *name, void *val); enum cb_err cmos_get_option(void *dest, const char *name);
-static inline enum cb_err set_option(const char *name, void *val) -{ - if (CONFIG(USE_OPTION_TABLE)) - return cmos_set_option(name, val); - - return CB_CMOS_OTABLE_DISABLED; -} - -static inline enum cb_err get_option(void *dest, const char *name) -{ - if (CONFIG(USE_OPTION_TABLE)) - return cmos_get_option(dest, name); - - return CB_CMOS_OTABLE_DISABLED; -} - static inline enum cb_err set_int_option(const char *name, const int value) { - return set_option(name, &value); + if (CONFIG(USE_OPTION_TABLE)) + return cmos_set_option(name, &value); + + return CB_CMOS_OTABLE_DISABLED; }
static inline int get_int_option(const char *name, const int fallback) { - int value = 0; - return get_option(&value, name) == CB_SUCCESS ? value : fallback; + if (CONFIG(USE_OPTION_TABLE)) { + int value = 0; + if (cmos_get_option(&value, name) == CB_SUCCESS) + return value; + } + return fallback; }
#endif /* _OPTION_H_ */ diff --git a/src/mainboard/lenovo/x60/smihandler.c b/src/mainboard/lenovo/x60/smihandler.c index ab8a1e8..20ca060 100644 --- a/src/mainboard/lenovo/x60/smihandler.c +++ b/src/mainboard/lenovo/x60/smihandler.c @@ -17,16 +17,13 @@
static void mainboard_smi_save_cmos(void) { - u8 val; u8 tmp70, tmp72;
tmp70 = inb(0x70); tmp72 = inb(0x72);
- val = pci_read_config8(PCI_DEV(0, 2, 1), 0xf4); - set_option("tft_brightness", &val); - val = ec_read(H8_VOLUME_CONTROL); - set_option("volume", &val); + set_int_option("tft_brightness", pci_read_config8(PCI_DEV(0, 2, 1), 0xf4)); + set_int_option("volume", ec_read(H8_VOLUME_CONTROL));
outb(tmp70, 0x70); outb(tmp72, 0x72);