diff options
author | Marx Wang <marx.wang@intel.corp-partner.google.com> | 2023-11-10 17:09:16 +0800 |
---|---|---|
committer | Subrata Banik <subratabanik@google.com> | 2023-12-22 12:29:59 +0000 |
commit | d078ef2152052b5ce8686249dcd05ebd50010889 (patch) | |
tree | 6facc67cd696ece9d7df3b6575ac2918714fbfa0 /src/soc/intel/common | |
parent | e41bf5f37388bc4cfa96eb84fff5a66766fbd14d (diff) |
soc/intel/cmn/block/pmc: Add previous sleep state strings in log
Previous sleep state showing in serial log is a magic number.
In order to let users understand its meanings directly, add
the strings to describe the modes.
TEST=build, boot the device and check the logs:
without this change, the log is like:
[DEBUG] prev_sleep_state 0
with this change:
[DEBUG] prev_sleep_state 0 (S0)
Change-Id: Iabe63610d3416b3b6e823746e3ccc5116fabb17d
Signed-off-by: Marx Wang <marx.wang@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/78999
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r-- | src/soc/intel/common/block/pmc/pmclib.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/soc/intel/common/block/pmc/pmclib.c b/src/soc/intel/common/block/pmc/pmclib.c index 84fc5cafe5..f11926c2fd 100644 --- a/src/soc/intel/common/block/pmc/pmclib.c +++ b/src/soc/intel/common/block/pmc/pmclib.c @@ -461,10 +461,25 @@ void pmc_fill_pm_reg_info(struct chipset_power_state *ps) /* Reads and prints ACPI specific PM registers */ int pmc_fill_power_state(struct chipset_power_state *ps) { + /* Define the sleep state string */ + static const char * const acpi_sleep_states[] = { + [SLP_TYP_S0] = "S0", + [SLP_TYP_S1] = "S1", + [SLP_TYP_S3] = "S3", + [SLP_TYP_S4] = "S4", + [SLP_TYP_S5] = "S5", + }; + pmc_fill_pm_reg_info(ps); ps->prev_sleep_state = pmc_prev_sleep_state(ps); - printk(BIOS_DEBUG, "prev_sleep_state %d\n", ps->prev_sleep_state); + + if (ps->prev_sleep_state < ARRAY_SIZE(acpi_sleep_states) && + acpi_sleep_states[ps->prev_sleep_state] != NULL) + printk(BIOS_DEBUG, "prev_sleep_state %d (%s)\n", ps->prev_sleep_state, + acpi_sleep_states[ps->prev_sleep_state]); + else + printk(BIOS_DEBUG, "prev_sleep_state %d (unknown state)\n", ps->prev_sleep_state); return ps->prev_sleep_state; } |