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 <kapilporwal@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89223
Reviewed-by: Caveh Jalali <caveh@chromium.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Kapil Porwal 2025-09-17 18:51:18 +05:30 committed by Matt DeVillier
commit 0d4c0ee7fc
2 changed files with 9 additions and 0 deletions

View file

@ -659,6 +659,13 @@ int google_chromeec_reboot(enum ec_reboot_cmd type, uint8_t flags)
return ec_cmd_reboot_ec(PLAT_EC, &params);
}
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 = {

View file

@ -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
*