Skip to contentSkip to conversation

x86: make LOAD_FROM_32_BIT visible for platforms

PATCH Superseded Andy Shevchenko 2 participants 2 messages Jan 24, 2017 – Feb 4, 2017 x86

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 x86: make LOAD_FROM_32_BIT visible for platforms

This option useful not only for development, but for the platforms where U-Boot is run from custom ROM bootloader. For example, Intel Edison is that board.

Make this option visible that platforms can select it if needed.

---
- fix logic bug for non-Edison platforms
- move comment to Kconfig as option description

 arch/x86/Kconfig     |  9 +++++++++
 arch/x86/cpu/start.S | 12 ++----------
 2 files changed, 11 insertions(+), 10 deletions(-)
arch/x86/Kconfig +9 -0
index 0884af22a7..1da1a2199c 100644
@@ -109,6 +109,15 @@ config SYS_X86_START16
 	depends on X86_RESET_VECTOR
 	default 0xfffff800
 
+config X86_LOAD_FROM_32_BIT
+	bool "Boot from a 32-bit program"
+	default n
+	help
+	  Define this to boot U-Boot from a 32-bit program which sets
+	  the GDT differently. This can be used to boot directly from
+	  any stage of coreboot, for example, bypassing the normal
+	  payload-loading feature.
+
 config BOARD_ROMSIZE_KB_512
 	bool
 config BOARD_ROMSIZE_KB_1024
arch/x86/cpu/start.S +2 -10
index a5cba1cf2a..8de55a0af1 100644
@@ -18,14 +18,6 @@
 #include <generated/generic-asm-offsets.h>
 #include <generated/asm-offsets.h>
 
-/*
- * Define this to boot U-Boot from a 32-bit program which sets the GDT
- * differently. This can be used to boot directly from any stage of coreboot,
- * for example, bypassing the normal payload-loading feature.
- * This is only useful for development.
- */
-#undef LOAD_FROM_32_BIT
-
 .section .text
 .code32
 .globl _start
@@ -76,7 +68,7 @@ _start:
 	/* Save table pointer */
 	movl	%ecx, %esi
 
-#ifdef LOAD_FROM_32_BIT
+#ifdef CONFIG_X86_LOAD_FROM_32_BIT
 	lgdt	gdt_ptr2
 #endif
 
@@ -233,7 +225,7 @@ multiboot_header:
 	/* entry addr */
 	.long	CONFIG_SYS_TEXT_BASE
 
-#ifdef LOAD_FROM_32_BIT
+#ifdef CONFIG_X86_LOAD_FROM_32_BIT
 	/*
 	 * The following Global Descriptor Table is just enough to get us into
 	 * 'Flat Protected Mode' - It will be discarded as soon as the final
Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 1/1 x86: make LOAD_FROM_32_BIT visible for platforms

Hi Andy,

Quoted 1 line · Andy Shevchenko

This option useful not only for development, but for the platforms where

This option "is" useful ..

Quoted 18 lines

U-Boot is run from custom ROM bootloader. For example, Intel Edison is that board.

Make this option visible that platforms can select it if needed.

---
- fix logic bug for non-Edison platforms
- move comment to Kconfig as option description

 arch/x86/Kconfig     |  9 +++++++++
 arch/x86/cpu/start.S | 12 ++----------
 2 files changed, 11 insertions(+), 10 deletions(-)
arch/x86/Kconfig +0 -0
index 0884af22a7..1da1a2199c 100644

arch/x86/Kconfig config SYS_X86_START16 · line 114

Quoted 6 lines
arch/x86/Kconfig +3 -0
@@ -109,6 +109,15 @@ config SYS_X86_START16
        depends on X86_RESET_VECTOR
        default 0xfffff800
 
+config X86_LOAD_FROM_32_BIT
+       bool "Boot from a 32-bit program"
+       default n

nits: 'default n' can be removed

arch/x86/Kconfig config SYS_X86_START16 · line 120

Quoted 6 lines
arch/x86/Kconfig +6 -0
+       help
+         Define this to boot U-Boot from a 32-bit program which sets
+         the GDT differently. This can be used to boot directly from
+         any stage of coreboot, for example, bypassing the normal
+         payload-loading feature.
+

[snip]

Regards,
Bin