summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2022-04-20 11:52:37 -0500
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-25 21:02:04 +0000
commita2e434d6c70f605b89cfe403dfc64ed2bd430cc3 (patch)
tree882545197d4420c83658bc9aab786cca2080dc6f
parent44744edfcac4125900903f719b1096baf3d73ece (diff)
downloadchrome-ec-a2e434d6c70f605b89cfe403dfc64ed2bd430cc3.tar.gz
ap_state: add device state info
Add "K" or "F" to the AP state to give more information about the device state. K for kernel. F for Firmware. This uses 48 bytes BUG=b:148492097 TEST=check ccdstate output at different times during boot. Run firmware_Cr50DeviceState Change-Id: If2a26c39047b9ae1818eb8d6afbaafa3d1765ca5 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3597035 Reviewed-by: Andrey Pronin <apronin@chromium.org>
-rw-r--r--board/cr50/ap_state.c10
-rw-r--r--chip/g/system.c3
-rw-r--r--chip/g/system_chip.h5
3 files changed, 17 insertions, 1 deletions
diff --git a/board/cr50/ap_state.c b/board/cr50/ap_state.c
index 88385b639d..1dfd73af32 100644
--- a/board/cr50/ap_state.c
+++ b/board/cr50/ap_state.c
@@ -18,11 +18,13 @@
static enum device_state state = DEVICE_STATE_INIT;
static bool disable_ds_temp;
+static bool inkernel;
void print_ap_state(void)
{
ccprintf("DS Dis: %s\n", disable_ds_temp ? "on" : "off");
- ccprintf("AP: %s\n", device_state_name(state));
+ ccprintf("AP: %s (%s)\n", device_state_name(state),
+ !ap_is_on() ? "" : inkernel ? "K" : "F");
}
int ap_is_on(void)
@@ -30,6 +32,11 @@ int ap_is_on(void)
return state == DEVICE_STATE_ON;
}
+void system_notify_ap_boot(void)
+{
+ inkernel = 1;
+}
+
void pmu_check_tpm_rst(void)
{
/*
@@ -203,6 +210,7 @@ void tpm_rst_asserted(enum gpio_signal unused)
if (!tpm_reset_in_progress())
ap_ro_device_reset();
#endif
+ inkernel = 0;
/*
* It's possible the signal is being pulsed. Wait 1 second to disable
* functionality, so it's more likely the AP is fully off and not being
diff --git a/chip/g/system.c b/chip/g/system.c
index 2e464391db..2fffebdc4a 100644
--- a/chip/g/system.c
+++ b/chip/g/system.c
@@ -531,6 +531,9 @@ int system_process_retry_counter(void)
CPRINTS("%s: retry counter %d", __func__,
GREG32(PMU, LONG_LIFE_SCRATCH0));
system_clear_retry_counter();
+#if defined(CHIP_FAMILY_CR50)
+ system_notify_ap_boot();
+#endif
if (!system_rollback_detected())
return EC_SUCCESS;
diff --git a/chip/g/system_chip.h b/chip/g/system_chip.h
index 3547bf58c7..7c450315fb 100644
--- a/chip/g/system_chip.h
+++ b/chip/g/system_chip.h
@@ -94,4 +94,9 @@ void system_pinhold_on_reset_disable(void);
*/
void system_pinhold_disengage(void);
+/**
+ * Notify the board booted.
+ */
+void system_notify_ap_boot(void);
+
#endif /* __CROS_EC_SYSTEM_CHIP_H */