
Hi Bin,
On 16 March 2017 at 08:26, Bin Meng bmeng.cn@gmail.com wrote:
Add one member in the global data to store previous sleep state, and display the state during boot in print_cpuinfo().
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/cpu/cpu.c | 6 ++++++ arch/x86/include/asm/acpi_s3.h | 20 ++++++++++++++++++++ arch/x86/include/asm/global_data.h | 3 +++ arch/x86/lib/fsp/fsp_common.c | 1 + 4 files changed, 30 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index 8fa6953..9dde54c 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -25,6 +25,7 @@ #include <errno.h> #include <malloc.h> #include <syscon.h> +#include <asm/acpi_s3.h> #include <asm/control_regs.h> #include <asm/coreboot_tables.h> #include <asm/cpu.h> @@ -179,6 +180,11 @@ int default_print_cpuinfo(void) cpu_has_64bit() ? "x86_64" : "x86", cpu_vendor_name(gd->arch.x86_vendor), gd->arch.x86_device);
+#ifdef CONFIG_HAVE_ACPI_RESUME
printf("ACPI previous sleep state: %s\n",
acpi_ss_string(gd->arch.prev_sleep_state));
+#endif
return 0;
}
diff --git a/arch/x86/include/asm/acpi_s3.h b/arch/x86/include/asm/acpi_s3.h index 74878c1..c1cdbd0 100644 --- a/arch/x86/include/asm/acpi_s3.h +++ b/arch/x86/include/asm/acpi_s3.h @@ -36,6 +36,26 @@ enum acpi_sleep_state { ACPI_S5, };
+/* Given the ACPI sleep state return the state string */ +static inline char *acpi_ss_string(enum acpi_sleep_state state) +{
switch (state) {
case ACPI_S0:
return "S0";
Since this is your own enum can you use a string array for this?
case ACPI_S1:
return "S1";
case ACPI_S2:
return "S2";
case ACPI_S3:
return "S3";
case ACPI_S4:
return "S4";
case ACPI_S5:
default:
return "S5";
}
+}
/* Given the provided PM1 control register return the ACPI sleep type */ static inline enum acpi_sleep_state acpi_sleep_from_pm1(u32 pm1_cnt) { diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index 4570bc7..7d5efea 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -99,6 +99,9 @@ struct arch_global_data { u32 high_table_ptr; u32 high_table_limit; #endif +#ifdef CONFIG_HAVE_ACPI_RESUME
int prev_sleep_state; /* Previous sleep state */
What kind of value does this have? Can you add a little detail>
+#endif };
#endif diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c index 2058ee3..2b33fba 100644 --- a/arch/x86/lib/fsp/fsp_common.c +++ b/arch/x86/lib/fsp/fsp_common.c @@ -77,6 +77,7 @@ int x86_fsp_init(void) int boot_mode = BOOT_FULL_CONFIG; #ifdef CONFIG_HAVE_ACPI_RESUME int prev_sleep_state = chipset_prev_sleep_state();
gd->arch.prev_sleep_state = prev_sleep_state;
#endif
if (!gd->arch.hob_list) {
-- 2.9.2
Regard, Simon