summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-04-19 13:15:28 +0200
committerPatrick Georgi <pgeorgi@google.com>2021-04-21 09:00:18 +0000
commit62719a379776efdde3439f053363170133fd8e69 (patch)
treec091d47e9b9cc26a2b7ee19bfffebb728e7253d9
parent5daa412939bfb35cec7a876d68860fe0f4bb9515 (diff)
downloadcoreboot-62719a379776efdde3439f053363170133fd8e69.tar.gz
coreboot-62719a379776efdde3439f053363170133fd8e69.tar.bz2
coreboot-62719a379776efdde3439f053363170133fd8e69.zip
{sb,soc}/intel: Use `get_int_option` function
Change-Id: I05f724785880089a513319d70dfd70fc2a6b7679 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47109 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Patrick Rudolph <siro@das-labor.org>
-rw-r--r--src/soc/intel/broadwell/pch/lpc.c4
-rw-r--r--src/soc/intel/broadwell/pch/smihandler.c5
-rw-r--r--src/soc/intel/common/block/pmc/pmclib.c4
-rw-r--r--src/southbridge/intel/bd82x6x/lpc.c9
-rw-r--r--src/southbridge/intel/common/smihandler.c5
-rw-r--r--src/southbridge/intel/i82801dx/lpc.c9
-rw-r--r--src/southbridge/intel/i82801gx/lpc.c9
-rw-r--r--src/southbridge/intel/i82801ix/lpc.c9
-rw-r--r--src/southbridge/intel/i82801jx/lpc.c9
-rw-r--r--src/southbridge/intel/ibexpeak/lpc.c9
-rw-r--r--src/southbridge/intel/lynxpoint/lpc.c8
-rw-r--r--src/southbridge/intel/lynxpoint/smihandler.c5
12 files changed, 27 insertions, 58 deletions
diff --git a/src/soc/intel/broadwell/pch/lpc.c b/src/soc/intel/broadwell/pch/lpc.c
index 170f88998fa6..9981624f8830 100644
--- a/src/soc/intel/broadwell/pch/lpc.c
+++ b/src/soc/intel/broadwell/pch/lpc.c
@@ -125,7 +125,6 @@ static void pch_power_options(struct device *dev)
{
u16 reg16;
const char *state;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
/* Which state do we want to goto after g3 (power restored)?
* 0 == S0 Full On
@@ -133,7 +132,8 @@ static void pch_power_options(struct device *dev)
*
* If the option is not existent (Laptops), use Kconfig setting.
*/
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
reg16 = pci_read_config16(dev, GEN_PMCON_3);
reg16 &= 0xfffe;
diff --git a/src/soc/intel/broadwell/pch/smihandler.c b/src/soc/intel/broadwell/pch/smihandler.c
index 542b330221db..262ed47a18a7 100644
--- a/src/soc/intel/broadwell/pch/smihandler.c
+++ b/src/soc/intel/broadwell/pch/smihandler.c
@@ -127,13 +127,12 @@ static void backlight_off(void)
static int power_on_after_fail(void)
{
- u8 s5pwr = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
-
/* save and recover RTC port values */
u8 tmp70, tmp72;
tmp70 = inb(0x70);
tmp72 = inb(0x72);
- get_option(&s5pwr, "power_on_after_fail");
+ const int s5pwr = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
outb(tmp70, 0x70);
outb(tmp72, 0x72);
diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c
index 3b7aa0a1693e..935dd0c6063a 100644
--- a/src/soc/intel/common/block/pmc/pmclib.c
+++ b/src/soc/intel/common/block/pmc/pmclib.c
@@ -583,8 +583,8 @@ void pmc_set_power_failure_state(const bool target_on)
{
bool on;
- uint8_t state = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- get_option(&state, "power_on_after_fail");
+ const int state = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
switch (state) {
case MAINBOARD_POWER_STATE_OFF:
diff --git a/src/southbridge/intel/bd82x6x/lpc.c b/src/southbridge/intel/bd82x6x/lpc.c
index ee416c1753f6..4ba88637fbbf 100644
--- a/src/southbridge/intel/bd82x6x/lpc.c
+++ b/src/southbridge/intel/bd82x6x/lpc.c
@@ -162,16 +162,14 @@ static void pch_power_options(struct device *dev)
/* Get the chip configuration */
config_t *config = dev->chip_info;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
-
/* Which state do we want to goto after g3 (power restored)?
* 0 == S0 Full On
* 1 == S5 Soft Off
*
* If the option is not existent (Laptops), use Kconfig setting.
*/
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
reg16 = pci_read_config16(dev, GEN_PMCON_3);
reg16 &= 0xfffe;
@@ -212,8 +210,7 @@ static void pch_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x70);
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/common/smihandler.c b/src/southbridge/intel/common/smihandler.c
index 733c625f6c71..db034fc24529 100644
--- a/src/southbridge/intel/common/smihandler.c
+++ b/src/southbridge/intel/common/smihandler.c
@@ -95,13 +95,12 @@ __weak void southbridge_smm_xhci_sleep(u8 slp_type)
static int power_on_after_fail(void)
{
- u8 s5pwr = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
-
/* save and recover RTC port values */
u8 tmp70, tmp72;
tmp70 = inb(0x70);
tmp72 = inb(0x72);
- get_option(&s5pwr, "power_on_after_fail");
+ const int s5pwr = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
outb(tmp70, 0x70);
outb(tmp72, 0x72);
diff --git a/src/southbridge/intel/i82801dx/lpc.c b/src/southbridge/intel/i82801dx/lpc.c
index 2c3d5d56fe2e..098af838a33a 100644
--- a/src/southbridge/intel/i82801dx/lpc.c
+++ b/src/southbridge/intel/i82801dx/lpc.c
@@ -88,17 +88,13 @@ static void i82801dx_power_options(struct device *dev)
u32 reg32;
const char *state;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
-
/* Which state do we want to goto after g3 (power restored)?
* 0 == S0 Full On
* 1 == S5 Soft Off
*
* If the option is not existent (Laptops), use MAINBOARD_POWER_ON.
*/
- pwr_on = MAINBOARD_POWER_ON;
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail", MAINBOARD_POWER_ON);
reg8 = pci_read_config8(dev, GEN_PMCON_3);
reg8 &= 0xfe;
@@ -133,8 +129,7 @@ static void i82801dx_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x70);
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/i82801gx/lpc.c b/src/southbridge/intel/i82801gx/lpc.c
index 6cfd3e475f2b..08019acd9be9 100644
--- a/src/southbridge/intel/i82801gx/lpc.c
+++ b/src/southbridge/intel/i82801gx/lpc.c
@@ -150,17 +150,13 @@ static void i82801gx_power_options(struct device *dev)
/* Get the chip configuration */
const struct southbridge_intel_i82801gx_config *config = dev->chip_info;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
-
/* Which state do we want to goto after g3 (power restored)?
* 0 == S0 Full On
* 1 == S5 Soft Off
*
* If the option is not existent (Laptops), use MAINBOARD_POWER_ON.
*/
- pwr_on = MAINBOARD_POWER_ON;
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail", MAINBOARD_POWER_ON);
reg8 = pci_read_config8(dev, GEN_PMCON_3);
reg8 &= 0xfe;
@@ -196,8 +192,7 @@ static void i82801gx_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x70);
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/i82801ix/lpc.c b/src/southbridge/intel/i82801ix/lpc.c
index 25a4069e7ee9..667d81dbc785 100644
--- a/src/southbridge/intel/i82801ix/lpc.c
+++ b/src/southbridge/intel/i82801ix/lpc.c
@@ -152,9 +152,6 @@ static void i82801ix_power_options(struct device *dev)
/* Get the chip configuration */
config_t *config = dev->chip_info;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
-
/* BIOS must program... */
pci_or_config32(dev, 0xac, (1 << 30) | (3 << 8));
@@ -164,8 +161,7 @@ static void i82801ix_power_options(struct device *dev)
*
* If the option is not existent (Laptops), use MAINBOARD_POWER_ON.
*/
- pwr_on = MAINBOARD_POWER_ON;
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail", MAINBOARD_POWER_ON);
reg8 = pci_read_config8(dev, D31F0_GEN_PMCON_3);
reg8 &= 0xfe;
@@ -201,8 +197,7 @@ static void i82801ix_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x74); /* Read from 0x74 as 0x70 is write only. */
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/i82801jx/lpc.c b/src/southbridge/intel/i82801jx/lpc.c
index cb80cae2a753..f70636dde6ed 100644
--- a/src/southbridge/intel/i82801jx/lpc.c
+++ b/src/southbridge/intel/i82801jx/lpc.c
@@ -154,9 +154,6 @@ static void i82801jx_power_options(struct device *dev)
/* Get the chip configuration */
config_t *config = dev->chip_info;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
-
/* BIOS must program... */
pci_or_config32(dev, 0xac, (1 << 30) | (3 << 8));
@@ -166,8 +163,7 @@ static void i82801jx_power_options(struct device *dev)
*
* If the option is not existent (Laptops), use MAINBOARD_POWER_ON.
*/
- pwr_on = MAINBOARD_POWER_ON;
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail", MAINBOARD_POWER_ON);
reg8 = pci_read_config8(dev, D31F0_GEN_PMCON_3);
reg8 &= 0xfe;
@@ -203,8 +199,7 @@ static void i82801jx_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x74); /* Read from 0x74 as 0x70 is write only. */
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/ibexpeak/lpc.c b/src/southbridge/intel/ibexpeak/lpc.c
index 706df254d722..ae3233c55c6e 100644
--- a/src/southbridge/intel/ibexpeak/lpc.c
+++ b/src/southbridge/intel/ibexpeak/lpc.c
@@ -155,16 +155,14 @@ static void pch_power_options(struct device *dev)
/* Get the chip configuration */
config_t *config = dev->chip_info;
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
-
/* Which state do we want to goto after g3 (power restored)?
* 0 == S0 Full On
* 1 == S5 Soft Off
*
* If the option is not existent (Laptops), use Kconfig setting.
*/
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
reg16 = pci_read_config16(dev, GEN_PMCON_3);
reg16 &= 0xfffe;
@@ -205,8 +203,7 @@ static void pch_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x70);
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/lynxpoint/lpc.c b/src/southbridge/intel/lynxpoint/lpc.c
index 55157a8d54f3..71e4d7460270 100644
--- a/src/southbridge/intel/lynxpoint/lpc.c
+++ b/src/southbridge/intel/lynxpoint/lpc.c
@@ -185,8 +185,6 @@ static void pch_power_options(struct device *dev)
u32 reg32;
const char *state;
u16 pmbase = get_pmbase();
- int pwr_on = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
- int nmi_option;
/* Which state do we want to goto after g3 (power restored)?
* 0 == S0 Full On
@@ -194,7 +192,8 @@ static void pch_power_options(struct device *dev)
*
* If the option is not existent (Laptops), use Kconfig setting.
*/
- get_option(&pwr_on, "power_on_after_fail");
+ const int pwr_on = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
reg16 = pci_read_config16(dev, GEN_PMCON_3);
reg16 &= 0xfffe;
@@ -235,8 +234,7 @@ static void pch_power_options(struct device *dev)
outb(reg8, 0x61);
reg8 = inb(0x70);
- nmi_option = NMI_OFF;
- get_option(&nmi_option, "nmi");
+ const int nmi_option = get_int_option("nmi", NMI_OFF);
if (nmi_option) {
printk(BIOS_INFO, "NMI sources enabled.\n");
reg8 &= ~(1 << 7); /* Set NMI. */
diff --git a/src/southbridge/intel/lynxpoint/smihandler.c b/src/southbridge/intel/lynxpoint/smihandler.c
index 9c7b269c1f5e..2c89a9538ebd 100644
--- a/src/southbridge/intel/lynxpoint/smihandler.c
+++ b/src/southbridge/intel/lynxpoint/smihandler.c
@@ -78,13 +78,12 @@ static void busmaster_disable_on_bus(int bus)
static int power_on_after_fail(void)
{
- u8 s5pwr = CONFIG_MAINBOARD_POWER_FAILURE_STATE;
-
/* save and recover RTC port values */
u8 tmp70, tmp72;
tmp70 = inb(0x70);
tmp72 = inb(0x72);
- get_option(&s5pwr, "power_on_after_fail");
+ const int s5pwr = get_int_option("power_on_after_fail",
+ CONFIG_MAINBOARD_POWER_FAILURE_STATE);
outb(tmp70, 0x70);
outb(tmp72, 0x72);