[U-Boot,14/22] x86: fsp: Mark the first 64K low memory as reserved

Submitted by Bin Meng on March 16, 2017, 2:26 p.m.

Details

Message ID 1489674408-17498-15-git-send-email-bmeng.cn@gmail.com
State New
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng March 16, 2017, 2:26 p.m.
Mark the first 64K memory as reserved as well since U-Boot uses this
memory region for things like VBIOS execution in real mode. After
kernel resumes, it 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.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 arch/x86/lib/fsp/fsp_dram.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Simon Glass March 21, 2017, 8:06 p.m.
On 16 March 2017 at 08:26, Bin Meng <bmeng.cn@gmail.com> wrote:
> Mark the first 64K memory as reserved as well since U-Boot uses this
> memory region for things like VBIOS execution in real mode. After
> kernel resumes, it 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.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> ---
>
>  arch/x86/lib/fsp/fsp_dram.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Patch hide | download patch | download mbox

diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index 417c611..2b383ef 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -100,6 +100,18 @@  unsigned install_e820_map(unsigned max_entries, struct e820entry *entries)
 		CONFIG_STACK_SIZE;
 	entries[num_entries].type = E820_RESERVED;
 	num_entries++;
+
+	/*
+	 * Mark the first 64K memory as reserved as well since U-Boot uses
+	 * this memory region for things like VBIOS execution in real mode.
+	 * After kernel resumes, it 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.
+	 */
+	entries[num_entries].addr = 0;
+	entries[num_entries].size = 0x10000;
+	entries[num_entries].type = E820_RESERVED;
+	num_entries++;
 #endif
 
 	return num_entries;