From d078ef2152052b5ce8686249dcd05ebd50010889 Mon Sep 17 00:00:00 2001 From: Marx Wang Date: Fri, 10 Nov 2023 17:09:16 +0800 Subject: 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/78999 Reviewed-by: Subrata Banik Reviewed-by: Eric Lai Tested-by: build bot (Jenkins) Reviewed-by: Kapil Porwal --- src/soc/intel/common/block/pmc/pmclib.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/soc') 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; } -- cgit v1.2.3