diff options
author | Vladimir Serbinenko <phcoder@gmail.com> | 2015-05-16 13:48:10 +0200 |
---|---|---|
committer | Vladimir Serbinenko <phcoder@gmail.com> | 2015-05-20 15:46:56 +0200 |
commit | 4141b47b070cbaf3cd83445259067cd38599cc94 (patch) | |
tree | 9b5bade1b67b483b4c54abb4a6d9ada572924d98 /src | |
parent | eec8dfb5e7eec7d837005ce97eb09d18386fabdd (diff) |
bd82x6x: Merge common apmc finalize procedure.
Change-Id: I9c938b8a69479fae6b0eb99d1135f1caaf26d0e2
Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-on: http://review.coreboot.org/10227
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins)
Reviewed-by: Nicolas Reinecke <nr@das-labor.org>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c | 38 | ||||
-rw-r--r-- | src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c | 38 | ||||
-rw-r--r-- | src/mainboard/google/butterfly/mainboard_smi.c | 17 | ||||
-rw-r--r-- | src/mainboard/google/link/mainboard_smi.c | 15 | ||||
-rw-r--r-- | src/mainboard/google/parrot/smihandler.c | 16 | ||||
-rw-r--r-- | src/mainboard/google/stout/mainboard_smi.c | 13 | ||||
-rw-r--r-- | src/mainboard/intel/emeraldlake2/smihandler.c | 23 | ||||
-rw-r--r-- | src/mainboard/kontron/ktqm77/smihandler.c | 25 | ||||
-rw-r--r-- | src/mainboard/lenovo/t420s/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/lenovo/t430s/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/lenovo/t520/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/lenovo/t530/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/lenovo/x220/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/lenovo/x230/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/samsung/lumpy/smihandler.c | 17 | ||||
-rw-r--r-- | src/mainboard/samsung/stumpy/smihandler.c | 23 | ||||
-rw-r--r-- | 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 85409fccbf..45c35248ad 100644 --- a/src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c +++ b/src/mainboard/gigabyte/ga-b75m-d3h/mainboard_smi.c @@ -49,41 +49,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 85409fccbf..45c35248ad 100644 --- a/src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c +++ b/src/mainboard/gigabyte/ga-b75m-d3v/mainboard_smi.c @@ -49,41 +49,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 3171e9fe1e..b3dd27f600 100644 --- a/src/mainboard/google/butterfly/mainboard_smi.c +++ b/src/mainboard/google/butterfly/mainboard_smi.c @@ -54,27 +54,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 fb35377d10..ca50f6799a 100644 --- a/src/mainboard/google/link/mainboard_smi.c +++ b/src/mainboard/google/link/mainboard_smi.c @@ -100,24 +100,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 7426bc04c1..19ea2bbb88 100644 --- a/src/mainboard/google/parrot/smihandler.c +++ b/src/mainboard/google/parrot/smihandler.c @@ -110,26 +110,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 ee18ca7646..78039c62e6 100644 --- a/src/mainboard/google/stout/mainboard_smi.c +++ b/src/mainboard/google/stout/mainboard_smi.c @@ -92,24 +92,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 5310bb04f5..bbf495c9d4 100644 --- a/src/mainboard/intel/emeraldlake2/smihandler.c +++ b/src/mainboard/intel/emeraldlake2/smihandler.c @@ -49,26 +49,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 39656ff347..522f0fcec7 100644 --- a/src/mainboard/kontron/ktqm77/smihandler.c +++ b/src/mainboard/kontron/ktqm77/smihandler.c @@ -30,28 +30,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 8acd989b42..0cf999fe6f 100644 --- a/src/mainboard/lenovo/t420s/smihandler.c +++ b/src/mainboard/lenovo/t420s/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/t430s/smihandler.c b/src/mainboard/lenovo/t430s/smihandler.c index 44a39bcf1b..e658155d70 100644 --- a/src/mainboard/lenovo/t430s/smihandler.c +++ b/src/mainboard/lenovo/t430s/smihandler.c @@ -108,8 +108,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) { @@ -130,21 +128,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 0bd0d441da..c1f2737fa1 100644 --- a/src/mainboard/lenovo/t520/smihandler.c +++ b/src/mainboard/lenovo/t520/smihandler.c @@ -105,8 +105,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) { @@ -127,21 +125,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 cae590641e..91bb20e30c 100644 --- a/src/mainboard/lenovo/t530/smihandler.c +++ b/src/mainboard/lenovo/t530/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/x220/smihandler.c b/src/mainboard/lenovo/x220/smihandler.c index cae590641e..91bb20e30c 100644 --- a/src/mainboard/lenovo/x220/smihandler.c +++ b/src/mainboard/lenovo/x220/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/x230/smihandler.c b/src/mainboard/lenovo/x230/smihandler.c index 6b946fa68c..d77e0d529c 100644 --- a/src/mainboard/lenovo/x230/smihandler.c +++ b/src/mainboard/lenovo/x230/smihandler.c @@ -80,8 +80,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) { @@ -102,21 +100,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 d2e388c5ff..1b58dbaf38 100644 --- a/src/mainboard/samsung/lumpy/smihandler.c +++ b/src/mainboard/samsung/lumpy/smihandler.c @@ -64,9 +64,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); @@ -81,20 +78,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 a68dadc3e5..faa5e10858 100644 --- a/src/mainboard/samsung/stumpy/smihandler.c +++ b/src/mainboard/samsung/stumpy/smihandler.c @@ -67,26 +67,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 7ecbd81e92..fbe08728ea 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(); |