[U-Boot] [PATCH 40/48] x86: Add support for passing tables into U-Boot

Simon Glass sjg at chromium.org
Wed Jul 22 17:49:32 CEST 2015


The EFI stub provides information to U-Boot in a table. This includes the
memory map which is needed to decide where to relocate U-Boot. Collect this
information in the early init code and store it in global_data.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/x86/cpu/start.S               | 9 +++++++++
 arch/x86/include/asm/global_data.h | 1 +
 arch/x86/lib/asm-offsets.c         | 1 +
 3 files changed, 11 insertions(+)

diff --git a/arch/x86/cpu/start.S b/arch/x86/cpu/start.S
index 7ef8b88..356c1a5 100644
--- a/arch/x86/cpu/start.S
+++ b/arch/x86/cpu/start.S
@@ -53,6 +53,9 @@ _start:
 	/* Save BIST */
 	movl	%eax, %ebp
 
+	/* Save table pointer */
+	movl	%ecx, %esi
+
 	/* Load the segement registers to match the GDT loaded in start16.S */
 	movl	$(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
 	movw	%ax, %fs
@@ -129,7 +132,13 @@ car_init_ret:
 	movl	%esi, (%edx)
 
 skip_hob:
+#else
+	/* Store table pointer */
+	movl	%esp, %edx
+	addl	$GD_TABLE, %edx
+	movl	%esi, (%edx)
 #endif
+
 	/* Setup first parameter to setup_gdt, pointer to global_data */
 	movl	%esp, %eax
 
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 6df6a78..ca32046 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -69,6 +69,7 @@ struct arch_global_data {
 	char *mrc_output;
 	unsigned int mrc_output_len;
 	void *gdt;			/* Global descriptor table */
+	ulong table;			/* Table pointer from previous loader */
 };
 
 #endif
diff --git a/arch/x86/lib/asm-offsets.c b/arch/x86/lib/asm-offsets.c
index 70ccf1b..9da04dd 100644
--- a/arch/x86/lib/asm-offsets.c
+++ b/arch/x86/lib/asm-offsets.c
@@ -21,5 +21,6 @@ int main(void)
 #ifdef CONFIG_HAVE_FSP
 	DEFINE(GD_HOB_LIST, offsetof(gd_t, arch.hob_list));
 #endif
+	DEFINE(GD_TABLE, offsetof(gd_t, arch.table));
 	return 0;
 }
-- 
2.4.3.573.g4eafbef



More information about the U-Boot mailing list