diff options
author | Angel Pons <th3fanbus@gmail.com> | 2020-11-02 22:49:51 +0100 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-04-21 09:06:30 +0000 |
commit | f8a5eb2e4afc190214ba5f1766998a1812f69a40 (patch) | |
tree | aa8b375900a20bd721ceb113fe335110e47684de /src/mainboard | |
parent | 0b7813fe97121eb7cb9c0b8ac59e604e9f613679 (diff) |
mainboard: Use read_int_option()
Change-Id: I9273b90b6a21b8f52fa42d9ff03a9b56eec9fcbf
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47137
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/mainboard')
-rw-r--r-- | src/mainboard/dell/optiplex_9010/sch5545_ec.c | 7 | ||||
-rw-r--r-- | src/mainboard/kontron/986lcd-m/mainboard.c | 3 | ||||
-rw-r--r-- | src/mainboard/kontron/bsl6/romstage.c | 3 | ||||
-rw-r--r-- | src/mainboard/kontron/bsl6/variants/boxer26/romstage.c | 3 | ||||
-rw-r--r-- | src/mainboard/kontron/ktqm77/mainboard.c | 9 | ||||
-rw-r--r-- | src/mainboard/lenovo/t430s/variants/t430s/romstage.c | 4 | ||||
-rw-r--r-- | src/mainboard/lenovo/t440p/romstage.c | 4 | ||||
-rw-r--r-- | src/mainboard/siemens/chili/romstage.c | 6 | ||||
-rw-r--r-- | src/mainboard/siemens/chili/variants/chili/romstage.c | 3 | ||||
-rw-r--r-- | src/mainboard/supermicro/x10slm-f/mainboard.c | 4 |
10 files changed, 20 insertions, 26 deletions
diff --git a/src/mainboard/dell/optiplex_9010/sch5545_ec.c b/src/mainboard/dell/optiplex_9010/sch5545_ec.c index 8110963c52..db13495aad 100644 --- a/src/mainboard/dell/optiplex_9010/sch5545_ec.c +++ b/src/mainboard/dell/optiplex_9010/sch5545_ec.c @@ -603,7 +603,7 @@ static void prepare_for_hwm_ec_sequence(uint8_t write_only, uint8_t *value) void sch5545_ec_hwm_init(void *unused) { - uint8_t val = 0, val_2fc, chassis_type, fan_speed_full = 0; + uint8_t val = 0, val_2fc, chassis_type; printk(BIOS_DEBUG, "%s\n", __func__); sch5545_emi_init(0x2e); @@ -656,9 +656,12 @@ void sch5545_ec_hwm_init(void *unused) ec_read_write_reg(EC_HWM_LDN, 0x02fc, &val_2fc, WRITE_OP); - if (get_option(&fan_speed_full, "fan_full_speed") != CB_SUCCESS) + int fan_speed_full = get_int_option("fan_full_speed", -1); + if (fan_speed_full < 0) { + fan_speed_full = 0; printk(BIOS_INFO, "fan_full_speed CMOS option not found. " "Fans will be set up for automatic control\n"); + } if (fan_speed_full) { ec_read_write_reg(EC_HWM_LDN, 0x0080, &val, READ_OP); diff --git a/src/mainboard/kontron/986lcd-m/mainboard.c b/src/mainboard/kontron/986lcd-m/mainboard.c index 9aed0cdf2f..f13731bcf2 100644 --- a/src/mainboard/kontron/986lcd-m/mainboard.c +++ b/src/mainboard/kontron/986lcd-m/mainboard.c @@ -136,11 +136,10 @@ static void mainboard_init(void *chip_info) struct device *dev; for (i = 1; i <= 3; i++) { - int ethernet_disable = 0; char cmos_option_name[] = "ethernetx"; snprintf(cmos_option_name, sizeof(cmos_option_name), "ethernet%01d", i); - get_option(ðernet_disable, cmos_option_name); + int ethernet_disable = get_int_option(cmos_option_name, 0); if (!ethernet_disable) continue; printk(BIOS_DEBUG, "Disabling Ethernet NIC #%d\n", i); diff --git a/src/mainboard/kontron/bsl6/romstage.c b/src/mainboard/kontron/bsl6/romstage.c index 0cb7b06375..c5cba4d02c 100644 --- a/src/mainboard/kontron/bsl6/romstage.c +++ b/src/mainboard/kontron/bsl6/romstage.c @@ -38,7 +38,8 @@ void mainboard_memory_init_params(FSPM_UPD *mupd) memory_params->DqPinsInterleaved = true; - get_option(&memory_params->HyperThreading, "hyper_threading"); + const uint8_t ht = get_int_option("hyper_threading", memory_params->HyperThreading); + memory_params->HyperThreading = ht; variant_memory_init_params(mupd); } diff --git a/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c b/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c index f1409e0b42..d352522e90 100644 --- a/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c +++ b/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c @@ -13,9 +13,8 @@ void variant_memory_init_params(FSPM_UPD *const mupd) unsigned int i; for (i = 0; i < 3; ++i) { - u8 eth_enable = 1; nvram_var[sizeof(nvram_var) - 2] = '1' + i; - get_option(ð_enable, nvram_var); + u8 eth_enable = get_int_option(nvram_var, 1); if (!eth_enable) { printk(BIOS_INFO, "Disabling ethernet%u.\n", 1 + i); mupd->FspmConfig.PcieRpEnableMask &= ~(1 << (i + 8)); diff --git a/src/mainboard/kontron/ktqm77/mainboard.c b/src/mainboard/kontron/ktqm77/mainboard.c index 95e639adcd..2d5063a694 100644 --- a/src/mainboard/kontron/ktqm77/mainboard.c +++ b/src/mainboard/kontron/ktqm77/mainboard.c @@ -149,17 +149,16 @@ static void mainboard_enable(struct device *dev) /* Install custom int15 handler for VGA OPROM */ mainboard_interrupt_handlers(0x15, &int15_handler); #endif - - unsigned int disable = 0; - if ((get_option(&disable, "ethernet1") == CB_SUCCESS) && disable) { + unsigned int disable = get_int_option("ethernet1", 0); + if (disable) { struct device *nic = pcidev_on_root(0x1c, 2); if (nic) { printk(BIOS_DEBUG, "DISABLE FIRST NIC!\n"); nic->enabled = 0; } } - disable = 0; - if ((get_option(&disable, "ethernet2") == CB_SUCCESS) && disable) { + disable = get_int_option("ethernet2", 0); + if (disable) { struct device *nic = pcidev_on_root(0x1c, 3); if (nic) { printk(BIOS_DEBUG, "DISABLE SECOND NIC!\n"); diff --git a/src/mainboard/lenovo/t430s/variants/t430s/romstage.c b/src/mainboard/lenovo/t430s/variants/t430s/romstage.c index 349d71e52b..ff041e7d49 100644 --- a/src/mainboard/lenovo/t430s/variants/t430s/romstage.c +++ b/src/mainboard/lenovo/t430s/variants/t430s/romstage.c @@ -33,9 +33,7 @@ void mainboard_get_spd(spd_raw_data *spd, bool id_only) void mainboard_early_init(int s3resume) { - u8 enable_peg; - if (get_option(&enable_peg, "enable_dual_graphics") != CB_SUCCESS) - enable_peg = 0; + u8 enable_peg = get_int_option("enable_dual_graphics", 0); bool power_en = pmh7_dgpu_power_state(); diff --git a/src/mainboard/lenovo/t440p/romstage.c b/src/mainboard/lenovo/t440p/romstage.c index 27908c1d98..817797f67e 100644 --- a/src/mainboard/lenovo/t440p/romstage.c +++ b/src/mainboard/lenovo/t440p/romstage.c @@ -22,9 +22,7 @@ void mainboard_config_rcba(void) void mb_late_romstage_setup(void) { - u8 enable_peg; - if (get_option(&enable_peg, "enable_dual_graphics") != CB_SUCCESS) - enable_peg = 0; + u8 enable_peg = get_int_option("enable_dual_graphics", 0); bool power_en = pmh7_dgpu_power_state(); diff --git a/src/mainboard/siemens/chili/romstage.c b/src/mainboard/siemens/chili/romstage.c index 06927b0eff..330d8afdc2 100644 --- a/src/mainboard/siemens/chili/romstage.c +++ b/src/mainboard/siemens/chili/romstage.c @@ -9,7 +9,6 @@ void mainboard_memory_init_params(FSPM_UPD *memupd) { - uint8_t vtd = 1; const struct cnl_mb_cfg cfg = { .spd = { [0] = { READ_SMBUS, { 0x50 << 1 } }, @@ -25,9 +24,10 @@ void mainboard_memory_init_params(FSPM_UPD *memupd) memupd->FspmConfig.EccSupport = 1; memupd->FspmConfig.UserBd = BOARD_TYPE_MOBILE; - get_option(&vtd, "vtd"); + const uint8_t vtd = get_int_option("vtd", 1); memupd->FspmTestConfig.VtdDisable = !vtd; - get_option(&memupd->FspmConfig.HyperThreading, "hyper_threading"); + const uint8_t ht = get_int_option("hyper_threading", memupd->FspmConfig.HyperThreading); + memupd->FspmConfig.HyperThreading = ht; variant_romstage_params(memupd); diff --git a/src/mainboard/siemens/chili/variants/chili/romstage.c b/src/mainboard/siemens/chili/variants/chili/romstage.c index 3a838240ef..fadd2b77b5 100644 --- a/src/mainboard/siemens/chili/variants/chili/romstage.c +++ b/src/mainboard/siemens/chili/variants/chili/romstage.c @@ -7,9 +7,8 @@ void variant_romstage_params(FSPM_UPD *const mupd) { - uint8_t eth_enable = 1; + const uint8_t eth_enable = get_int_option("ethernet1", 1); - get_option(ð_enable, "ethernet1"); if (!eth_enable) { printk(BIOS_DEBUG, "Disabling ethernet1.\n"); mupd->FspmConfig.PcieRpEnableMask &= ~(1 << 5); diff --git a/src/mainboard/supermicro/x10slm-f/mainboard.c b/src/mainboard/supermicro/x10slm-f/mainboard.c index 2f206060b7..b584e9bd73 100644 --- a/src/mainboard/supermicro/x10slm-f/mainboard.c +++ b/src/mainboard/supermicro/x10slm-f/mainboard.c @@ -30,9 +30,7 @@ static void hide_ast2400(void) static void mainboard_enable(struct device *dev) { - u8 hide = 0; - - if (get_option(&hide, "hide_ast2400") == CB_SUCCESS && hide) + if (get_int_option("hide_ast2400", false)) hide_ast2400(); } |