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>
This commit is contained in:
Angel Pons 2020-11-02 22:49:51 +01:00 committed by Patrick Georgi
parent 0b7813fe97
commit f8a5eb2e4a
10 changed files with 20 additions and 26 deletions

View File

@ -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);

View File

@ -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(&ethernet_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);

View File

@ -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);
}

View File

@ -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(&eth_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));

View File

@ -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");

View File

@ -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();

View File

@ -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();

View File

@ -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);

View File

@ -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(&eth_enable, "ethernet1");
if (!eth_enable) {
printk(BIOS_DEBUG, "Disabling ethernet1.\n");
mupd->FspmConfig.PcieRpEnableMask &= ~(1 << 5);

View File

@ -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();
}