From 0d4c0ee7fc2d1705ff6663a2133ffa5c7323890e Mon Sep 17 00:00:00 2001 From: Kapil Porwal Date: Wed, 17 Sep 2025 18:51:18 +0530 Subject: [PATCH] ec/google/chromeec: Add API for AP shutdown command Adds the `google_chromeec_ap_poweroff()` helper function to the ChromeEC driver. This new API wraps the `EC_CMD_AP_SHUTDOWN` command and sends it to the Embedded Controller (EC). This provides a cleaner, standardized way for other coreboot components to initiate an Application Processor (AP) power-off sequence via the EC. After sending the shutdown command, the function calls `halt()` as the AP is expected to power down immediately after the EC processes the command. BUG=b:439819922 TEST=Verify shutdown on Google/Quenbi. Change-Id: Iace6a66972791bb7acdb978dfeea67b6ff0fec68 Signed-off-by: Kapil Porwal Reviewed-on: https://review.coreboot.org/c/coreboot/+/89223 Reviewed-by: Caveh Jalali Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) --- src/ec/google/chromeec/ec.c | 7 +++++++ src/ec/google/chromeec/ec.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 993bddf6ae..eeef4341f3 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -659,6 +659,13 @@ int google_chromeec_reboot(enum ec_reboot_cmd type, uint8_t flags) return ec_cmd_reboot_ec(PLAT_EC, ¶ms); } +void google_chromeec_ap_poweroff(void) +{ + if (ec_cmd_ap_shutdown(PLAT_EC)) + printk(BIOS_ERR, "Failed to power off the AP.\n"); + halt(); +} + static int cbi_get_uint32(uint32_t *id, uint32_t tag) { struct ec_params_get_cbi params = { diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 4b8d0958c3..febef6c1ab 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -94,6 +94,8 @@ int google_chromeec_vstore_write(int slot, uint8_t *data, size_t size); success, < 0 otherwise. */ int google_chromeec_reboot(enum ec_reboot_cmd type, uint8_t flags); +void google_chromeec_ap_poweroff(void); + /** * Get data from Cros Board Info *