diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2017-04-21 07:24:47 -0700 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2017-05-17 17:11:46 +0800 |
commit | 5ae5aa931042bb4163c6343a3cba65e95d90205a (patch) | |
tree | 0eb3a11a1fbbf38ff707c22debf54d912094b185 /arch/x86/cpu | |
parent | 68769ebcbc892c85e9a1ffff09bbc6e4877f2d1f (diff) | |
download | u-boot-5ae5aa931042bb4163c6343a3cba65e95d90205a.tar.gz u-boot-5ae5aa931042bb4163c6343a3cba65e95d90205a.tar.xz u-boot-5ae5aa931042bb4163c6343a3cba65e95d90205a.zip |
x86: acpi: Fix Windows S3 resume failure
U-Boot sets up the real mode interrupt handler stubs starting from
address 0x1000. In most cases, the first 640K (0x00000 - 0x9ffff)
system memory is reported as system RAM in E820 table to the OS.
(see install_e820_map() implementation for each platform). So OS
can use these memories whatever it wants.
If U-Boot is in an S3 resume path, care must be taken not to corrupt
these memorie otherwise OS data gets lost. Testing shows that, on
Microsoft Windows 10 on Intel Baytrail its wake up vector happens to
be installed at the same address 0x1000. While on Linux its wake up
vector does not overlap this memory range, but after resume kernel
checks low memory range per config option CONFIG_X86_RESERVE_LOW
which is 64K by default to see whether a memory corruption occurs
during the suspend/resume (it's harmless, but warnings are shown
in the kernel dmesg logs).
We cannot simply mark the these memory as reserved in E820 table
because such configuration makes GRUB complain: unable to allocate
real mode page. Hence we choose to back up these memories to the
place where we reserved on our stack for our S3 resume work.
Before jumping to OS wake up vector, we need restore the original
content there.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'arch/x86/cpu')
-rw-r--r-- | arch/x86/cpu/cpu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c index dfe624f54a..e13786efa5 100644 --- a/arch/x86/cpu/cpu.c +++ b/arch/x86/cpu/cpu.c @@ -278,13 +278,17 @@ int reserve_arch(void) high_table_reserve(); #endif -#if defined(CONFIG_HAVE_ACPI_RESUME) && defined(CONFIG_HAVE_FSP) +#ifdef CONFIG_HAVE_ACPI_RESUME + acpi_s3_reserve(); + +#ifdef CONFIG_HAVE_FSP /* * Save stack address to CMOS so that at next S3 boot, * we can use it as the stack address for fsp_contiue() */ fsp_save_s3_stack(); -#endif +#endif /* CONFIG_HAVE_FSP */ +#endif /* CONFIG_HAVE_ACPI_RESUME */ return 0; } |