Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/47137 )
Change subject: mainboard: Use `read_option_X` helpers ......................................................................
mainboard: Use `read_option_X` helpers
Change-Id: I9273b90b6a21b8f52fa42d9ff03a9b56eec9fcbf Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/mainboard/kontron/bsl6/variants/boxer26/romstage.c M src/mainboard/lenovo/t430s/variants/t430s/romstage.c M src/mainboard/lenovo/t440p/romstage.c M src/mainboard/siemens/chili/romstage.c M src/mainboard/siemens/chili/variants/chili/romstage.c M src/mainboard/supermicro/x10slm-f/mainboard.c 6 files changed, 6 insertions(+), 15 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/47137/1
diff --git a/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c b/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c index 9c14d84..20f9126 100644 --- a/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c +++ b/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c @@ -14,9 +14,8 @@ 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 = read_option_u8(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/lenovo/t430s/variants/t430s/romstage.c b/src/mainboard/lenovo/t430s/variants/t430s/romstage.c index 349d71e..05bd441 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_early_init(int s3resume) { - u8 enable_peg; - if (get_option(&enable_peg, "enable_dual_graphics") != CB_SUCCESS) - enable_peg = 0; + u8 enable_peg = read_option_u8("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 3e5cc0d..3c87a3c 100644 --- a/src/mainboard/lenovo/t440p/romstage.c +++ b/src/mainboard/lenovo/t440p/romstage.c @@ -22,9 +22,7 @@
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 = read_option_u8("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 c1ec7e4..c940521 100644 --- a/src/mainboard/siemens/chili/romstage.c +++ b/src/mainboard/siemens/chili/romstage.c @@ -18,7 +18,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 } }, @@ -34,7 +33,7 @@ memupd->FspmConfig.EccSupport = 1; memupd->FspmConfig.UserBd = BOARD_TYPE_MOBILE;
- get_option(&vtd, "vtd"); + const uint8_t vtd = read_option_u8("vtd", 1); memupd->FspmTestConfig.VtdDisable = !vtd; get_option(&memupd->FspmConfig.HyperThreading, "hyper_threading");
diff --git a/src/mainboard/siemens/chili/variants/chili/romstage.c b/src/mainboard/siemens/chili/variants/chili/romstage.c index ebffc8d3..ae863cc 100644 --- a/src/mainboard/siemens/chili/variants/chili/romstage.c +++ b/src/mainboard/siemens/chili/variants/chili/romstage.c @@ -8,9 +8,8 @@
void variant_romstage_params(FSPM_UPD *const mupd) { - uint8_t eth_enable = 1; + const uint8_t eth_enable = read_option_u8("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 2f20606..428f61a 100644 --- a/src/mainboard/supermicro/x10slm-f/mainboard.c +++ b/src/mainboard/supermicro/x10slm-f/mainboard.c @@ -30,9 +30,7 @@
static void mainboard_enable(struct device *dev) { - u8 hide = 0; - - if (get_option(&hide, "hide_ast2400") == CB_SUCCESS && hide) + if (read_option_u8("hide_ast2400", false)) hide_ast2400(); }
Attention is currently required from: Felix Singer, Nico Huber. Hello build bot (Jenkins), Tristan Corrick, Alexander Couzens, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/47137
to look at the new patch set (#4).
Change subject: mainboard: Use read_int_option() ......................................................................
mainboard: Use read_int_option()
Change-Id: I9273b90b6a21b8f52fa42d9ff03a9b56eec9fcbf Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/mainboard/dell/optiplex_9010/sch5545_ec.c M src/mainboard/kontron/986lcd-m/mainboard.c M src/mainboard/kontron/bsl6/romstage.c M src/mainboard/kontron/bsl6/variants/boxer26/romstage.c M src/mainboard/kontron/ktqm77/mainboard.c M src/mainboard/lenovo/t430s/variants/t430s/romstage.c M src/mainboard/lenovo/t440p/romstage.c M src/mainboard/siemens/chili/romstage.c M src/mainboard/siemens/chili/variants/chili/romstage.c M src/mainboard/supermicro/x10slm-f/mainboard.c 10 files changed, 20 insertions(+), 26 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/47137/4
Attention is currently required from: Felix Singer, Nico Huber, Arthur Heymans, Patrick Rudolph. Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/47137 )
Change subject: mainboard: Use read_int_option() ......................................................................
Patch Set 6: Code-Review+2
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/47137 )
Change subject: mainboard: Use read_int_option() ......................................................................
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 --- M src/mainboard/dell/optiplex_9010/sch5545_ec.c M src/mainboard/kontron/986lcd-m/mainboard.c M src/mainboard/kontron/bsl6/romstage.c M src/mainboard/kontron/bsl6/variants/boxer26/romstage.c M src/mainboard/kontron/ktqm77/mainboard.c M src/mainboard/lenovo/t430s/variants/t430s/romstage.c M src/mainboard/lenovo/t440p/romstage.c M src/mainboard/siemens/chili/romstage.c M src/mainboard/siemens/chili/variants/chili/romstage.c M src/mainboard/supermicro/x10slm-f/mainboard.c 10 files changed, 20 insertions(+), 26 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/src/mainboard/dell/optiplex_9010/sch5545_ec.c b/src/mainboard/dell/optiplex_9010/sch5545_ec.c index 8110963..db13495 100644 --- a/src/mainboard/dell/optiplex_9010/sch5545_ec.c +++ b/src/mainboard/dell/optiplex_9010/sch5545_ec.c @@ -603,7 +603,7 @@
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 @@
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 9aed0cd..f13731b 100644 --- a/src/mainboard/kontron/986lcd-m/mainboard.c +++ b/src/mainboard/kontron/986lcd-m/mainboard.c @@ -136,11 +136,10 @@ 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 0cb7b06..c5cba4d 100644 --- a/src/mainboard/kontron/bsl6/romstage.c +++ b/src/mainboard/kontron/bsl6/romstage.c @@ -38,7 +38,8 @@
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 f1409e0..d352522 100644 --- a/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c +++ b/src/mainboard/kontron/bsl6/variants/boxer26/romstage.c @@ -13,9 +13,8 @@ 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 95e639a..2d5063a 100644 --- a/src/mainboard/kontron/ktqm77/mainboard.c +++ b/src/mainboard/kontron/ktqm77/mainboard.c @@ -149,17 +149,16 @@ /* 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 349d71e..ff041e7 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_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 27908c1..817797f 100644 --- a/src/mainboard/lenovo/t440p/romstage.c +++ b/src/mainboard/lenovo/t440p/romstage.c @@ -22,9 +22,7 @@
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 06927b0..330d8afd 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 @@ 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 3a83824..fadd2b7 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 2f20606..b584e9b 100644 --- a/src/mainboard/supermicro/x10slm-f/mainboard.c +++ b/src/mainboard/supermicro/x10slm-f/mainboard.c @@ -30,9 +30,7 @@
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(); }