summaryrefslogtreecommitdiff
path: root/src/mainboard/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/mainboard/intel')
-rw-r--r--src/mainboard/intel/glkrvp/ec.c28
-rw-r--r--src/mainboard/intel/kblrvp/ec.c28
-rw-r--r--src/mainboard/intel/kunimitsu/ec.c28
-rw-r--r--src/mainboard/intel/strago/ec.c33
4 files changed, 33 insertions, 84 deletions
diff --git a/src/mainboard/intel/glkrvp/ec.c b/src/mainboard/intel/glkrvp/ec.c
index ff891a99a9..c17033832e 100644
--- a/src/mainboard/intel/glkrvp/ec.c
+++ b/src/mainboard/intel/glkrvp/ec.c
@@ -24,28 +24,16 @@
static void ramstage_ec_init(void)
{
- printk(BIOS_ERR, "mainboard: EC init\n");
-
- if (acpi_is_wakeup_s3()) {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S3_WAKE_EVENTS);
-
- /* Disable SMI and wake events */
- google_chromeec_set_smi_mask(0);
+ const struct google_chromeec_event_info info = {
+ .log_events = MAINBOARD_EC_LOG_EVENTS,
+ .sci_events = MAINBOARD_EC_SCI_EVENTS,
+ .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS,
+ .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS,
+ };
- /* Clear pending events */
- while (google_chromeec_get_event() != 0)
- ;
-
- /* Restore SCI event mask */
- google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS);
- } else {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S5_WAKE_EVENTS);
- }
+ printk(BIOS_ERR, "mainboard: EC init\n");
- /* Clear wake event mask */
- google_chromeec_set_wake_mask(0);
+ google_chromeec_events_init(&info, acpi_is_wakeup_s3());
}
static void bootblock_ec_init(void)
diff --git a/src/mainboard/intel/kblrvp/ec.c b/src/mainboard/intel/kblrvp/ec.c
index 235ecab9ef..b40aabf73c 100644
--- a/src/mainboard/intel/kblrvp/ec.c
+++ b/src/mainboard/intel/kblrvp/ec.c
@@ -21,26 +21,14 @@
void mainboard_ec_init(void)
{
- printk(BIOS_DEBUG, "mainboard: EC init\n");
+ const struct google_chromeec_event_info info = {
+ .log_events = MAINBOARD_EC_LOG_EVENTS,
+ .sci_events = MAINBOARD_EC_SCI_EVENTS,
+ .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS,
+ .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS,
+ };
- if (acpi_is_wakeup_s3()) {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S3_WAKE_EVENTS);
+ printk(BIOS_ERR, "mainboard: EC init\n");
- /* Disable SMI and wake events */
- google_chromeec_set_smi_mask(0);
-
- /* Clear pending events */
- while (google_chromeec_get_event() != 0)
- ;
-
- /* Restore SCI event mask */
- google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS);
- } else {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S5_WAKE_EVENTS);
- }
-
- /* Clear wake event mask */
- google_chromeec_set_wake_mask(0);
+ google_chromeec_events_init(&info, acpi_is_wakeup_s3());
}
diff --git a/src/mainboard/intel/kunimitsu/ec.c b/src/mainboard/intel/kunimitsu/ec.c
index 36cd10acd1..32ae8ba22f 100644
--- a/src/mainboard/intel/kunimitsu/ec.c
+++ b/src/mainboard/intel/kunimitsu/ec.c
@@ -21,26 +21,14 @@
void mainboard_ec_init(void)
{
- printk(BIOS_DEBUG, "mainboard: EC init\n");
+ const struct google_chromeec_event_info info = {
+ .log_events = MAINBOARD_EC_LOG_EVENTS,
+ .sci_events = MAINBOARD_EC_SCI_EVENTS,
+ .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS,
+ .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS,
+ };
- if (acpi_is_wakeup_s3()) {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S3_WAKE_EVENTS);
+ printk(BIOS_ERR, "mainboard: EC init\n");
- /* Disable SMI and wake events */
- google_chromeec_set_smi_mask(0);
-
- /* Clear pending events */
- while (google_chromeec_get_event() != 0)
- ;
-
- /* Restore SCI event mask */
- google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS);
- } else {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S5_WAKE_EVENTS);
- }
-
- /* Clear wake event mask */
- google_chromeec_set_wake_mask(0);
+ google_chromeec_events_init(&info, acpi_is_wakeup_s3());
}
diff --git a/src/mainboard/intel/strago/ec.c b/src/mainboard/intel/strago/ec.c
index dabe274fbf..efd20a597f 100644
--- a/src/mainboard/intel/strago/ec.c
+++ b/src/mainboard/intel/strago/ec.c
@@ -23,33 +23,18 @@
void mainboard_ec_init(void)
{
+ const struct google_chromeec_event_info info = {
+ .log_events = MAINBOARD_EC_LOG_EVENTS,
+ .sci_events = MAINBOARD_EC_SCI_EVENTS,
+ .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS,
+ .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS,
+ };
+
printk(BIOS_DEBUG, "mainboard_ec_init\n");
post_code(0xf0);
-#if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC)
- /* Restore SCI event mask on resume. */
- if (acpi_is_wakeup_s3()) {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S3_WAKE_EVENTS);
-
- /* Disable SMI and wake events */
- google_chromeec_set_smi_mask(0);
-
- /* Clear pending events */
- while (google_chromeec_get_event() != 0)
- ;
- /*
- * Set SCI mask.OS may not generate the SMI event to
- * set this on S3 resume
- */
- google_chromeec_set_sci_mask(MAINBOARD_EC_SCI_EVENTS);
- } else {
- google_chromeec_log_events(MAINBOARD_EC_LOG_EVENTS |
- MAINBOARD_EC_S5_WAKE_EVENTS);
- }
+ if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC))
+ google_chromeec_events_init(&info, acpi_is_wakeup_s3());
- /* Clear wake event mask */
- google_chromeec_set_wake_mask(0);
-#endif
post_code(0xf1);
}