soc/intel/common: Refactor poweroff() logic for early poweroff support
The existing logic prioritized the check for ENV_ROMSTAGE_OR_BEFORE
over the HAVE_EARLY_POWEROFF_SUPPORT configuration. This meant that
platforms with early poweroff support might still fall through to the
incorrect path depending on the boot phase.
Refactor the logic to:
1. Prioritize CONFIG(HAVE_EARLY_POWEROFF_SUPPORT) as the primary
mechanism for poweroff.
2. If early support is not available, check the environment stage:
- Perform standard pmc_control_poweroff() if after romstage.
- Halt with an emergency message if attempted too early in the
boot process without platform support.
This structure ensures that platform-specific early poweroff routines
are always preferred when configured.
TEST=Able to verify the AC host event is not getting cleared after
power-off.
Change-Id: Ieec8bcae5e1002d264db59cafe9236aaef6576e0
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91149
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Pranava Y N <pranavayn@google.com>
Reviewed-by: Avi Uday <aviuday@google.com>
This commit is contained in:
parent
7158a1746c
commit
2e8545c441
1 changed files with 8 additions and 6 deletions
|
|
@ -632,14 +632,16 @@ static void pmc_control_poweroff(void)
|
|||
|
||||
void poweroff(void)
|
||||
{
|
||||
if (!ENV_ROMSTAGE_OR_BEFORE) {
|
||||
pmc_control_poweroff();
|
||||
} else if (CONFIG(HAVE_EARLY_POWEROFF_SUPPORT)) {
|
||||
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();
|
||||
if (!ENV_ROMSTAGE_OR_BEFORE) {
|
||||
pmc_control_poweroff();
|
||||
} else {
|
||||
printk(BIOS_EMERG, "This platform cannot be powered off until the silicon"
|
||||
" initialization is complete, hanging!\n");
|
||||
halt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue