coreboot-kgpe-d16/src/soc
Subrata Banik 6d64155cc8 soc/intel/cannonlake: Fix incorrect prev_sleep_state issue
The patch fixes indication of incorrect `prev_sleep_state` on the next
boot after global reset trigger. The existing code misses an important check about `if PCH doesn't set the WAK_STS` while checking power
failure. As a result, every early warm/global reset is considered
as power failure after looking into the PMC MMIO CON-A register
alone (as ignoring the ACPI PM_CTRL.WAK_STS bit).

As per the code comment this code logic is expected to check the power
failure reason if PCH doesn't set the WAK_STS while waking from G3
state.

TEST=Able to build and boot google/hatch.

Without this patch:

Observation: Resuming after a warm reset is considered as
`prev_sleep_state 5` although the SLP_TYP is zero and WAK_STS bit
is set.

    pm1_sts: 8100 pm1_en: 0000 pm1_cnt: 00000000
    GEN_PMCON: d1215238 00002200
    ....
    prev_sleep_state 5

With this patch:

Observation: Resuming after a warm reset is considered as
`prev_sleep_state 0`. It matches with the SLP_TYP is zero and
WAK_STS bit is set.

    pm1_sts: 8100 pm1_en: 0000 pm1_cnt: 00000000
    GEN_PMCON: d1215238 00002200
    ....
    prev_sleep_state 0

Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I05a2fab75c3d931651885db0003ab8c5748a1568
Reviewed-on: https://review.coreboot.org/c/coreboot/+/71934
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Sridhar Siricilla <sridhar.siricilla@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2023-01-18 08:41:48 +00:00
..
amd soc/amd: Include <gpio.h> instead of <soc/gpio.h> 2023-01-18 05:13:30 +00:00
cavium treewide: stop calling custom TPM log "TCPA" 2023-01-11 16:00:55 +00:00
example/min86 soc: Add SPDX license headers to Makefiles 2022-10-31 03:27:13 +00:00
intel soc/intel/cannonlake: Fix incorrect prev_sleep_state issue 2023-01-18 08:41:48 +00:00
mediatek commonlib/storage: Add common eMMC functions 2023-01-16 00:33:11 +00:00
nvidia treewide: stop calling custom TPM log "TCPA" 2023-01-11 16:00:55 +00:00
qualcomm treewide: stop calling custom TPM log "TCPA" 2023-01-11 16:00:55 +00:00
rockchip cbmem_top_chipset: Change the return value to uintptr_t 2022-11-18 16:00:45 +00:00
samsung treewide: Fix old-style declarations 2023-01-17 04:23:49 +00:00
sifive/fu540 cbmem_top_chipset: Change the return value to uintptr_t 2022-11-18 16:00:45 +00:00
ti src/soc/ti: Remove unnecessary space after casts 2022-11-22 13:42:28 +00:00
ucb/riscv cbmem_top_chipset: Change the return value to uintptr_t 2022-11-18 16:00:45 +00:00