diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index 8c48e8873f..64b9bb997c 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -615,7 +616,8 @@ void vboot_platform_prepare_reboot(void) pmc_write_pm1_control(pm1_cnt); } -void poweroff(void) +/* Helper function to perform poweroff operation using PMC chipset register. */ +static void pmc_control_poweroff(void) { pmc_enable_pm1_control(SLP_EN | (SLP_TYP_S5 << SLP_TYP_SHIFT)); @@ -628,6 +630,19 @@ void poweroff(void) halt(); } +void poweroff(void) +{ + if (!ENV_ROMSTAGE_OR_BEFORE) { + pmc_control_poweroff(); + } else if (CONFIG(HAVE_EARLY_POWEROFF_SUPPORT)) { + platform_do_early_poweroff(); + } else { + printk(BIOS_EMERG, "This platform cannot be powered off until the silicon" + " initialization is complete, hanging!\n"); + halt(); + } +} + void pmc_gpe_init(void) { uint32_t gpio_cfg = 0;