Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10227
-gerrit
commit 6adabab38e8efb0861ce73af65913219178d8538 Author: Vladimir Serbinenko phcoder@gmail.com Date: Sat May 16 13:48:10 2015 +0200
bd82x6x: Merge common apmc fimalize procedure.
Change-Id: I9c938b8a69479fae6b0eb99d1135f1caaf26d0e2 Signed-off-by: Vladimir Serbinenko phcoder@gmail.com --- src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c | 38 ---------------------- src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c | 38 ---------------------- src/mainboard/google/butterfly/mainboard_smi.c | 17 ---------- src/mainboard/google/link/mainboard_smi.c | 15 --------- src/mainboard/google/parrot/smihandler.c | 16 --------- src/mainboard/google/stout/mainboard_smi.c | 13 -------- src/mainboard/intel/emeraldlake2/smihandler.c | 23 ------------- src/mainboard/kontron/ktqm77/smihandler.c | 25 -------------- src/mainboard/lenovo/t420s/smihandler.c | 17 ---------- src/mainboard/lenovo/t430s/smihandler.c | 17 ---------- src/mainboard/lenovo/t520/smihandler.c | 17 ---------- src/mainboard/lenovo/t530/smihandler.c | 17 ---------- src/mainboard/lenovo/x220/smihandler.c | 17 ---------- src/mainboard/lenovo/x230/smihandler.c | 17 ---------- src/mainboard/samsung/lumpy/smihandler.c | 17 ---------- src/mainboard/samsung/stumpy/smihandler.c | 23 ------------- src/southbridge/intel/bd82x6x/smihandler.c | 17 ++++++++++ 17 files changed, 17 insertions(+), 327 deletions(-)
diff --git a/src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c b/src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c index 35702f0..448fcc4 100644 --- a/src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c +++ b/src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c @@ -54,41 +54,3 @@ int mainboard_io_trap_handler(int smif) * On failure, the IO Trap Handler returns a value != 1 */ return 1; } - -static int mainboard_finalized = 0; - -int mainboard_smi_apmc(u8 data) -{ - u16 pmbase = pci_read_config16(PCI_DEV(0, 0x1f, 0), 0x40) & 0xfffc; - - printk(BIOS_DEBUG, "%s: pmbase %04X, data %02X\n", __func__, pmbase, - data); - - if (!pmbase) - return 0; - - switch (data) { - case APM_CNT_ACPI_ENABLE: - break; - case APM_CNT_ACPI_DISABLE: - break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - - default: - break; - } - return 0; -} diff --git a/src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c b/src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c index 35702f0..448fcc4 100644 --- a/src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c +++ b/src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c @@ -54,41 +54,3 @@ int mainboard_io_trap_handler(int smif) * On failure, the IO Trap Handler returns a value != 1 */ return 1; } - -static int mainboard_finalized = 0; - -int mainboard_smi_apmc(u8 data) -{ - u16 pmbase = pci_read_config16(PCI_DEV(0, 0x1f, 0), 0x40) & 0xfffc; - - printk(BIOS_DEBUG, "%s: pmbase %04X, data %02X\n", __func__, pmbase, - data); - - if (!pmbase) - return 0; - - switch (data) { - case APM_CNT_ACPI_ENABLE: - break; - case APM_CNT_ACPI_DISABLE: - break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - - default: - break; - } - return 0; -} diff --git a/src/mainboard/google/butterfly/mainboard_smi.c b/src/mainboard/google/butterfly/mainboard_smi.c index 1876f31..576298b 100644 --- a/src/mainboard/google/butterfly/mainboard_smi.c +++ b/src/mainboard/google/butterfly/mainboard_smi.c @@ -76,27 +76,10 @@ void mainboard_smi_sleep(u8 slp_typ) #define APMC_ACPI_EN 0xe1 #define APMC_ACPI_DIS 0x1e
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 apmc) { printk(BIOS_DEBUG, "mainboard_smi_apmc: %x\n", apmc); switch (apmc) { - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - case APMC_ACPI_EN: printk(BIOS_DEBUG, "APMC: ACPI_EN\n"); /* Clear all pending events and enable SCI */ diff --git a/src/mainboard/google/link/mainboard_smi.c b/src/mainboard/google/link/mainboard_smi.c index d60d319..bb8826c 100644 --- a/src/mainboard/google/link/mainboard_smi.c +++ b/src/mainboard/google/link/mainboard_smi.c @@ -121,24 +121,9 @@ void mainboard_smi_sleep(u8 slp_typ) #define APMC_ACPI_EN 0xe1 #define APMC_ACPI_DIS 0x1e
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 apmc) { switch (apmc) { - case APM_CNT_FINALIZE: - if (mainboard_finalized) { - printk(BIOS_DEBUG, "SMI#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; case APMC_ACPI_EN: google_chromeec_set_smi_mask(0); /* Clear all pending events */ diff --git a/src/mainboard/google/parrot/smihandler.c b/src/mainboard/google/parrot/smihandler.c index 99fabfc..943317d 100644 --- a/src/mainboard/google/parrot/smihandler.c +++ b/src/mainboard/google/parrot/smihandler.c @@ -133,26 +133,10 @@ void mainboard_smi_sleep(u8 slp_typ) #define APMC_ACPI_EN 0xe1 #define APMC_ACPI_DIS 0x1e
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 apmc) { printk(BIOS_DEBUG, "mainboard_smi_apmc: %x\n", apmc); switch (apmc) { - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; case APMC_ACPI_EN: printk(BIOS_DEBUG, "APMC: ACPI_EN\n"); /* Clear all pending events */ diff --git a/src/mainboard/google/stout/mainboard_smi.c b/src/mainboard/google/stout/mainboard_smi.c index c44e931..1e23a68 100644 --- a/src/mainboard/google/stout/mainboard_smi.c +++ b/src/mainboard/google/stout/mainboard_smi.c @@ -113,24 +113,11 @@ void mainboard_smi_sleep(u8 slp_typ) #define APMC_ACPI_EN 0xe1 #define APMC_ACPI_DIS 0x1e
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 apmc) { switch (apmc) { case APM_CNT_FINALIZE: - if (mainboard_finalized) { - printk(BIOS_DEBUG, "SMI#: Already finalized\n"); - return 0; - } - printk(BIOS_DEBUG, "SMI#: finalize\n"); - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); stout_ec_finalize_smm(); - - mainboard_finalized = 1; break; case APMC_ACPI_EN: /* diff --git a/src/mainboard/intel/emeraldlake2/smihandler.c b/src/mainboard/intel/emeraldlake2/smihandler.c index e9aeb2a..b63b44d 100644 --- a/src/mainboard/intel/emeraldlake2/smihandler.c +++ b/src/mainboard/intel/emeraldlake2/smihandler.c @@ -70,26 +70,3 @@ void mainboard_smi_sleep(u8 slp_typ) break; } } - - -static int mainboard_finalized = 0; - -int mainboard_smi_apmc(u8 apmc) -{ - switch (apmc) { - case APM_CNT_FINALIZE: - if (mainboard_finalized) { - printk(BIOS_DEBUG, "SMI#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - } - return 0; -} diff --git a/src/mainboard/kontron/ktqm77/smihandler.c b/src/mainboard/kontron/ktqm77/smihandler.c index 9317943..40eb1f7 100644 --- a/src/mainboard/kontron/ktqm77/smihandler.c +++ b/src/mainboard/kontron/ktqm77/smihandler.c @@ -52,28 +52,3 @@ void mainboard_smi_gpi(u32 gpi_sts) { printk(BIOS_DEBUG, "warn: unknown mainboard_smi_gpi: %x\n", gpi_sts); } - - -static int mainboard_finalized = 0; - -int mainboard_smi_apmc(u8 apmc) -{ - printk(BIOS_DEBUG, "mainboard_smi_apmc: %x\n", apmc); - switch (apmc) { - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - } - return 0; -} diff --git a/src/mainboard/lenovo/t420s/smihandler.c b/src/mainboard/lenovo/t420s/smihandler.c index 430ad1b..d18552e 100644 --- a/src/mainboard/lenovo/t420s/smihandler.c +++ b/src/mainboard/lenovo/t420s/smihandler.c @@ -115,8 +115,6 @@ void mainboard_smi_gpi(u32 gpi_sts) mainboard_smi_handle_ec_sci(); }
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 data) { switch (data) { @@ -137,21 +135,6 @@ int mainboard_smi_apmc(u8 data) /* discard all events, and enable attention */ ec_write(0x80, 0x01); break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - default: break; } diff --git a/src/mainboard/lenovo/t430s/smihandler.c b/src/mainboard/lenovo/t430s/smihandler.c index 2f690b4..c22d434 100644 --- a/src/mainboard/lenovo/t430s/smihandler.c +++ b/src/mainboard/lenovo/t430s/smihandler.c @@ -113,8 +113,6 @@ void mainboard_smi_gpi(u32 gpi_sts) mainboard_smi_handle_ec_sci(); }
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 data) { switch (data) { @@ -135,21 +133,6 @@ int mainboard_smi_apmc(u8 data) /* discard all events, and enable attention */ ec_write(0x80, 0x01); break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - default: break; } diff --git a/src/mainboard/lenovo/t520/smihandler.c b/src/mainboard/lenovo/t520/smihandler.c index 4d874fd..f651f32 100644 --- a/src/mainboard/lenovo/t520/smihandler.c +++ b/src/mainboard/lenovo/t520/smihandler.c @@ -110,8 +110,6 @@ void mainboard_smi_gpi(u32 gpi_sts) mainboard_smi_handle_ec_sci(); }
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 data) { switch (data) { @@ -132,21 +130,6 @@ int mainboard_smi_apmc(u8 data) /* discard all events, and enable attention */ ec_write(0x80, 0x01); break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - default: break; } diff --git a/src/mainboard/lenovo/t530/smihandler.c b/src/mainboard/lenovo/t530/smihandler.c index 8208fe7..cd53f06 100644 --- a/src/mainboard/lenovo/t530/smihandler.c +++ b/src/mainboard/lenovo/t530/smihandler.c @@ -115,8 +115,6 @@ void mainboard_smi_gpi(u32 gpi_sts) mainboard_smi_handle_ec_sci(); }
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 data) { switch (data) { @@ -137,21 +135,6 @@ int mainboard_smi_apmc(u8 data) /* discard all events, and enable attention */ ec_write(0x80, 0x01); break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - default: break; } diff --git a/src/mainboard/lenovo/x220/smihandler.c b/src/mainboard/lenovo/x220/smihandler.c index 8208fe7..cd53f06 100644 --- a/src/mainboard/lenovo/x220/smihandler.c +++ b/src/mainboard/lenovo/x220/smihandler.c @@ -115,8 +115,6 @@ void mainboard_smi_gpi(u32 gpi_sts) mainboard_smi_handle_ec_sci(); }
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 data) { switch (data) { @@ -137,21 +135,6 @@ int mainboard_smi_apmc(u8 data) /* discard all events, and enable attention */ ec_write(0x80, 0x01); break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - default: break; } diff --git a/src/mainboard/lenovo/x230/smihandler.c b/src/mainboard/lenovo/x230/smihandler.c index 8208fe7..cd53f06 100644 --- a/src/mainboard/lenovo/x230/smihandler.c +++ b/src/mainboard/lenovo/x230/smihandler.c @@ -115,8 +115,6 @@ void mainboard_smi_gpi(u32 gpi_sts) mainboard_smi_handle_ec_sci(); }
-static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 data) { switch (data) { @@ -137,21 +135,6 @@ int mainboard_smi_apmc(u8 data) /* discard all events, and enable attention */ ec_write(0x80, 0x01); break; - case APM_CNT_FINALIZE: - printk(BIOS_DEBUG, "APMC: FINALIZE\n"); - if (mainboard_finalized) { - printk(BIOS_DEBUG, "APMC#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - default: break; } diff --git a/src/mainboard/samsung/lumpy/smihandler.c b/src/mainboard/samsung/lumpy/smihandler.c index e560d0e..eaee46b 100644 --- a/src/mainboard/samsung/lumpy/smihandler.c +++ b/src/mainboard/samsung/lumpy/smihandler.c @@ -85,9 +85,6 @@ void mainboard_smi_gpi(u32 gpi_sts) } }
- -static int mainboard_finalized = 0; - int mainboard_smi_apmc(u8 apmc) { ec_set_ports(EC_MAILBOX_PORT, EC_MAILBOX_PORT+1); @@ -102,20 +99,6 @@ int mainboard_smi_apmc(u8 apmc) send_ec_command(EC_SMI_ENABLE); send_ec_command(EC_ACPI_DISABLE); break; - - case APM_CNT_FINALIZE: - if (mainboard_finalized) { - printk(BIOS_DEBUG, "SMI#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; } return 0; } diff --git a/src/mainboard/samsung/stumpy/smihandler.c b/src/mainboard/samsung/stumpy/smihandler.c index 6625792..93b691a 100644 --- a/src/mainboard/samsung/stumpy/smihandler.c +++ b/src/mainboard/samsung/stumpy/smihandler.c @@ -88,26 +88,3 @@ void mainboard_smi_sleep(u8 slp_typ) break; } } - - -static int mainboard_finalized = 0; - -int mainboard_smi_apmc(u8 apmc) -{ - switch (apmc) { - case APM_CNT_FINALIZE: - if (mainboard_finalized) { - printk(BIOS_DEBUG, "SMI#: Already finalized\n"); - return 0; - } - - intel_me_finalize_smm(); - intel_pch_finalize_smm(); - intel_sandybridge_finalize_smm(); - intel_model_206ax_finalize_smm(); - - mainboard_finalized = 1; - break; - } - return 0; -} diff --git a/src/southbridge/intel/bd82x6x/smihandler.c b/src/southbridge/intel/bd82x6x/smihandler.c index 7ecbd81..fbe0872 100644 --- a/src/southbridge/intel/bd82x6x/smihandler.c +++ b/src/southbridge/intel/bd82x6x/smihandler.c @@ -38,6 +38,8 @@ */ #include <northbridge/intel/sandybridge/sandybridge.h> #include <arch/pci_mmio_cfg.h> +#include <southbridge/intel/bd82x6x/me.h> +#include <cpu/intel/model_206ax/model_206ax.h>
/* While we read PMBASE dynamically in case it changed, let's * initialize it with a sane value @@ -584,6 +586,8 @@ static void southbridge_smi_gsmi(void) } #endif
+static int mainboard_finalized = 0; + static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state_save) { u32 pmctrl; @@ -634,6 +638,19 @@ static void southbridge_smi_apmc(unsigned int node, smm_state_save_area_t *state printk(BIOS_DEBUG, "SMI#: Setting GNVS to %p\n", gnvs); } break; + case APM_CNT_FINALIZE: + if (mainboard_finalized) { + printk(BIOS_DEBUG, "SMI#: Already finalized\n"); + return; + } + + intel_me_finalize_smm(); + intel_pch_finalize_smm(); + intel_sandybridge_finalize_smm(); + intel_model_206ax_finalize_smm(); + + mainboard_finalized = 1; + break; #if CONFIG_ELOG_GSMI case ELOG_GSMI_APM_CNT: southbridge_smi_gsmi();