Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/74513 )
Change subject: mb/google,intel: Use common ChromeEC code for SMI APMC ......................................................................
mb/google,intel: Use common ChromeEC code for SMI APMC
Change-Id: If4b7c2b94e0fec84831740336ccdbea0922ffbfe Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/mainboard/google/auron/smihandler.c M src/mainboard/google/cyan/smihandler.c M src/mainboard/google/link/smihandler.c M src/mainboard/google/rambi/smihandler.c M src/mainboard/google/slippy/smihandler.c M src/mainboard/intel/strago/smihandler.c 6 files changed, 22 insertions(+), 96 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/13/74513/1
diff --git a/src/mainboard/google/auron/smihandler.c b/src/mainboard/google/auron/smihandler.c index 6fa95e8..42ab937 100644 --- a/src/mainboard/google/auron/smihandler.c +++ b/src/mainboard/google/auron/smihandler.c @@ -7,6 +7,7 @@ #include <soc/pm.h> #include <elog.h> #include <ec/google/chromeec/ec.h> +#include <ec/google/chromeec/smm.h> #include <southbridge/intel/lynxpoint/lp_gpio.h> #include <soc/iomap.h> #include <soc/nvs.h> @@ -103,21 +104,6 @@
int mainboard_smi_apmc(u8 apmc) { - switch (apmc) { - case APM_CNT_ACPI_ENABLE: - google_chromeec_set_smi_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); - break; - case APM_CNT_ACPI_DISABLE: - google_chromeec_set_sci_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS); - break; - } + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); return 0; } diff --git a/src/mainboard/google/cyan/smihandler.c b/src/mainboard/google/cyan/smihandler.c index 7394b78..65daab4 100644 --- a/src/mainboard/google/cyan/smihandler.c +++ b/src/mainboard/google/cyan/smihandler.c @@ -7,6 +7,7 @@ #include <cpu/x86/smm.h> #include "ec.h" #include <ec/google/chromeec/ec.h> +#include <ec/google/chromeec/smm.h> #include <elog.h> #include <soc/nvs.h> #include <soc/pm.h> @@ -115,21 +116,6 @@
int mainboard_smi_apmc(uint8_t apmc) { - switch (apmc) { - case APM_CNT_ACPI_ENABLE: - google_chromeec_set_smi_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); - break; - case APM_CNT_ACPI_DISABLE: - google_chromeec_set_sci_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS); - break; - } + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); return 0; } diff --git a/src/mainboard/google/link/smihandler.c b/src/mainboard/google/link/smihandler.c index 2f42b7d..fb596b6 100644 --- a/src/mainboard/google/link/smihandler.c +++ b/src/mainboard/google/link/smihandler.c @@ -12,6 +12,7 @@
/* Include EC functions */ #include <ec/google/chromeec/ec.h> +#include <ec/google/chromeec/smm.h> #include "ec.h"
static u8 mainboard_smi_ec(void) @@ -78,21 +79,6 @@
int mainboard_smi_apmc(u8 apmc) { - switch (apmc) { - case APM_CNT_ACPI_ENABLE: - google_chromeec_set_smi_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_sci_mask(LINK_EC_SCI_EVENTS); - break; - case APM_CNT_ACPI_DISABLE: - google_chromeec_set_sci_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_smi_mask(LINK_EC_SMI_EVENTS); - break; - } + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); return 0; } diff --git a/src/mainboard/google/rambi/smihandler.c b/src/mainboard/google/rambi/smihandler.c index 358a92f..29dc8b2 100644 --- a/src/mainboard/google/rambi/smihandler.c +++ b/src/mainboard/google/rambi/smihandler.c @@ -7,6 +7,7 @@ #include <elog.h>
#include <ec/google/chromeec/ec.h> +#include <ec/google/chromeec/smm.h> #include "ec.h"
#include <soc/nvs.h> @@ -90,21 +91,6 @@
int mainboard_smi_apmc(uint8_t apmc) { - switch (apmc) { - case APM_CNT_ACPI_ENABLE: - google_chromeec_set_smi_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); - break; - case APM_CNT_ACPI_DISABLE: - google_chromeec_set_sci_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS); - break; - } + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); return 0; } diff --git a/src/mainboard/google/slippy/smihandler.c b/src/mainboard/google/slippy/smihandler.c index 16a1b18..f02ee40 100644 --- a/src/mainboard/google/slippy/smihandler.c +++ b/src/mainboard/google/slippy/smihandler.c @@ -14,6 +14,7 @@
/* Include EC functions */ #include <ec/google/chromeec/ec.h> +#include <ec/google/chromeec/smm.h> #include "ec.h"
/* Codec enable: GPIO45 */ @@ -106,21 +107,6 @@
int mainboard_smi_apmc(u8 apmc) { - switch (apmc) { - case APM_CNT_ACPI_ENABLE: - google_chromeec_set_smi_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); - break; - case APM_CNT_ACPI_DISABLE: - google_chromeec_set_sci_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS); - break; - } + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); return 0; } diff --git a/src/mainboard/intel/strago/smihandler.c b/src/mainboard/intel/strago/smihandler.c index c660e5a..f8f7c57 100644 --- a/src/mainboard/intel/strago/smihandler.c +++ b/src/mainboard/intel/strago/smihandler.c @@ -7,6 +7,7 @@ #include "ec.h"
#include <ec/google/chromeec/ec.h> +#include <ec/google/chromeec/smm.h> #include <elog.h>
#include <soc/nvs.h> @@ -100,21 +101,6 @@
int mainboard_smi_apmc(uint8_t apmc) { - switch (apmc) { - case APM_CNT_ACPI_ENABLE: - google_chromeec_set_smi_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS); - break; - case APM_CNT_ACPI_DISABLE: - google_chromeec_set_sci_mask(0); - /* Clear all pending events */ - while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) - ; - google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS); - break; - } + chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, MAINBOARD_EC_SMI_EVENTS); return 0; }