ec/google: Use EC_HOST_EVENT_NONE
google_chromeec_get_event returns 0 for no event. Return
EC_HOST_EVENT_NONE=0 to improve readability.
BUG=b:184074997
TEST=Build and boot guybrush without error
Signed-off-by: Rob Barnes <robbarnes@google.com>
Change-Id: Ic08ed9ccdd7c0023d0fe8b641fcf60dca495a242
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55547
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h
index 35ce3cc..ed9f4e4 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -19,7 +19,7 @@
int google_chromeec_set_sci_mask(uint64_t mask);
int google_chromeec_set_smi_mask(uint64_t mask);
int google_chromeec_set_wake_mask(uint64_t mask);
-uint8_t google_chromeec_get_event(void);
+enum host_event_code google_chromeec_get_event(void);
/* Check if EC supports feature EC_FEATURE_UNIFIED_WAKE_MASKS */
bool google_chromeec_is_uhepi_supported(void);
diff --git a/src/ec/google/chromeec/ec_i2c.c b/src/ec/google/chromeec/ec_i2c.c
index 68e3cf2..7342fc2 100644
--- a/src/ec/google/chromeec/ec_i2c.c
+++ b/src/ec/google/chromeec/ec_i2c.c
@@ -239,8 +239,8 @@
#endif /* CONFIG_EC_GOOGLE_CHROMEEC_I2C_PROTO3 */
-u8 google_chromeec_get_event(void)
+enum host_event_code google_chromeec_get_event(void)
{
printk(BIOS_ERR, "%s: Not supported.\n", __func__);
- return 0;
+ return EC_HOST_EVENT_NONE;
}
diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c
index 623aed5..a82ea5d 100644
--- a/src/ec/google/chromeec/ec_lpc.c
+++ b/src/ec/google/chromeec/ec_lpc.c
@@ -461,11 +461,11 @@
EC_LPC_CMDR_DATA);
}
-u8 google_chromeec_get_event(void)
+enum host_event_code google_chromeec_get_event(void)
{
if (google_chromeec_wait_ready(EC_LPC_ADDR_ACPI_CMD)) {
printk(BIOS_ERR, "Timeout waiting for EC ready!\n");
- return 0;
+ return EC_HOST_EVENT_NONE;
}
/* Issue the ACPI query-event command */
@@ -473,12 +473,12 @@
if (google_chromeec_wait_ready(EC_LPC_ADDR_ACPI_CMD)) {
printk(BIOS_ERR, "Timeout waiting for EC QUERY_EVENT!\n");
- return 0;
+ return EC_HOST_EVENT_NONE;
}
if (google_chromeec_data_ready(EC_LPC_ADDR_ACPI_CMD)) {
printk(BIOS_ERR, "Timeout waiting for data ready!\n");
- return 0;
+ return EC_HOST_EVENT_NONE;
}
/* Event (or 0 if none) is returned directly in the data byte */
diff --git a/src/ec/google/chromeec/ec_spi.c b/src/ec/google/chromeec/ec_spi.c
index ecf1b42..0124191 100644
--- a/src/ec/google/chromeec/ec_spi.c
+++ b/src/ec/google/chromeec/ec_spi.c
@@ -100,8 +100,8 @@
return crosec_command_proto(cec_command, crosec_spi_io, &slave);
}
-u8 google_chromeec_get_event(void)
+enum host_event_code google_chromeec_get_event(void)
{
printk(BIOS_ERR, "%s: Not supported.\n", __func__);
- return 0;
+ return EC_HOST_EVENT_NONE;
}
diff --git a/src/ec/google/chromeec/smihandler.c b/src/ec/google/chromeec/smihandler.c
index fca67ca..cd0cd4f 100644
--- a/src/ec/google/chromeec/smihandler.c
+++ b/src/ec/google/chromeec/smihandler.c
@@ -37,7 +37,7 @@
{
struct ec_response_get_next_event mkbp_event;
- while (google_chromeec_get_event() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
printk(BIOS_DEBUG, "Clearing pending EC events. Error code EC_RES_UNAVAILABLE(9) is expected.\n");
diff --git a/src/mainboard/google/auron/ec.c b/src/mainboard/google/auron/ec.c
index 5be20c0..d4482b0 100644
--- a/src/mainboard/google/auron/ec.c
+++ b/src/mainboard/google/auron/ec.c
@@ -23,7 +23,7 @@
google_chromeec_events_init(&info, s3_wakeup);
if (s3_wakeup) {
/* Clear pending events. */
- while (google_chromeec_get_event() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
}
diff --git a/src/mainboard/google/auron/smihandler.c b/src/mainboard/google/auron/smihandler.c
index 34ed171..6fa95e8 100644
--- a/src/mainboard/google/auron/smihandler.c
+++ b/src/mainboard/google/auron/smihandler.c
@@ -97,7 +97,7 @@
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
- while (google_chromeec_get_event() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
}
@@ -107,14 +107,14 @@
case APM_CNT_ACPI_ENABLE:
google_chromeec_set_smi_mask(0);
/* Clear all pending events */
- while (google_chromeec_get_event() != 0)
+ 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() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS);
break;
diff --git a/src/mainboard/google/cyan/smihandler.c b/src/mainboard/google/cyan/smihandler.c
index d9121e1..9083a87 100644
--- a/src/mainboard/google/cyan/smihandler.c
+++ b/src/mainboard/google/cyan/smihandler.c
@@ -126,7 +126,7 @@
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
- while (google_chromeec_get_event() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
/* Set LPC lines to low power in S3/S5. */
@@ -141,14 +141,14 @@
case APM_CNT_ACPI_ENABLE:
google_chromeec_set_smi_mask(0);
/* Clear all pending events */
- while (google_chromeec_get_event() != 0)
+ 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() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS);
break;
diff --git a/src/mainboard/google/link/smihandler.c b/src/mainboard/google/link/smihandler.c
index 719076b..2f42b7d 100644
--- a/src/mainboard/google/link/smihandler.c
+++ b/src/mainboard/google/link/smihandler.c
@@ -69,7 +69,8 @@
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
- while (google_chromeec_get_event() != 0);
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
+ ;
/* Enable wake events */
google_chromeec_set_wake_mask(LINK_EC_S3_WAKE_EVENTS);
@@ -81,13 +82,15 @@
case APM_CNT_ACPI_ENABLE:
google_chromeec_set_smi_mask(0);
/* Clear all pending events */
- while (google_chromeec_get_event() != 0);
+ 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() != 0);
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
+ ;
google_chromeec_set_smi_mask(LINK_EC_SMI_EVENTS);
break;
}
diff --git a/src/mainboard/google/rambi/smihandler.c b/src/mainboard/google/rambi/smihandler.c
index c16a0f5..358a92f 100644
--- a/src/mainboard/google/rambi/smihandler.c
+++ b/src/mainboard/google/rambi/smihandler.c
@@ -84,7 +84,8 @@
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
- while (google_chromeec_get_event() != 0);
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
+ ;
}
int mainboard_smi_apmc(uint8_t apmc)
@@ -93,13 +94,15 @@
case APM_CNT_ACPI_ENABLE:
google_chromeec_set_smi_mask(0);
/* Clear all pending events */
- while (google_chromeec_get_event() != 0);
+ 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() != 0);
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
+ ;
google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS);
break;
}
diff --git a/src/mainboard/google/slippy/ec.c b/src/mainboard/google/slippy/ec.c
index 5761a7c..a3ee95b 100644
--- a/src/mainboard/google/slippy/ec.c
+++ b/src/mainboard/google/slippy/ec.c
@@ -22,7 +22,7 @@
google_chromeec_events_init(&info, s3_wakeup);
if (s3_wakeup) {
/* Clear pending events. */
- while (google_chromeec_get_event() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
}
diff --git a/src/mainboard/google/slippy/smihandler.c b/src/mainboard/google/slippy/smihandler.c
index 81fcb0a..16a1b18 100644
--- a/src/mainboard/google/slippy/smihandler.c
+++ b/src/mainboard/google/slippy/smihandler.c
@@ -100,7 +100,8 @@
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
- while (google_chromeec_get_event() != 0);
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
+ ;
}
int mainboard_smi_apmc(u8 apmc)
@@ -109,13 +110,15 @@
case APM_CNT_ACPI_ENABLE:
google_chromeec_set_smi_mask(0);
/* Clear all pending events */
- while (google_chromeec_get_event() != 0);
+ 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() != 0);
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
+ ;
google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS);
break;
}
diff --git a/src/mainboard/intel/strago/smihandler.c b/src/mainboard/intel/strago/smihandler.c
index fc77103..e953ccd 100644
--- a/src/mainboard/intel/strago/smihandler.c
+++ b/src/mainboard/intel/strago/smihandler.c
@@ -112,7 +112,7 @@
google_chromeec_set_sci_mask(0);
/* Clear pending events that may trigger immediate wake */
- while (google_chromeec_get_event() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
/* Set LPC lines to low power in S3/S5. */
@@ -126,14 +126,14 @@
case APM_CNT_ACPI_ENABLE:
google_chromeec_set_smi_mask(0);
/* Clear all pending events */
- while (google_chromeec_get_event() != 0)
+ 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() != 0)
+ while (google_chromeec_get_event() != EC_HOST_EVENT_NONE)
;
google_chromeec_set_smi_mask(MAINBOARD_EC_SMI_EVENTS);
break;