[U-Boot] [PATCH v2 16/20] x86: Set cold/warm boot flag

Graeme Russ graeme.russ at gmail.com
Tue Oct 5 13:19:22 CEST 2010


Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
---
 arch/i386/cpu/start.S               |   19 ++++++-------------
 arch/i386/cpu/start16.S             |    7 ++++---
 arch/i386/include/asm/global_data.h |    3 +++
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/arch/i386/cpu/start.S b/arch/i386/cpu/start.S
index cff4637..8fdcd81 100644
--- a/arch/i386/cpu/start.S
+++ b/arch/i386/cpu/start.S
@@ -51,7 +51,7 @@ _i386boot_start:
 	wbinvd
 
 	/* Tell 32-bit code it is being entered from an in-RAM copy */
-	movw	$0x0000, %bx
+	movw	$GD_FLG_WARM_BOOT, %bx
 _start:
 	/* This is the 32-bit cold-reset entry point */
 
@@ -66,18 +66,10 @@ _start:
 	/* Clear the interupt vectors */
 	lidt	blank_idt_ptr
 
-	/*
-	 * Skip low-level board and memory initialization if not starting
-	 * from cold-reset. This allows us to do a fail safe boot-strap
-	 * into a new build of U-Boot from a known-good boot flash
-	 */
-	movw	$0x0001, %ax
-	cmpw	%ax, %bx
-	jne	mem_init_ret
-
-	/* We call a few functions in the board support package
-	 * since we have no stack yet we'll have to use %ebp
-	 * to store the return address */
+	/* Skip low-level initialization if not starting from cold-reset */
+	movl	%ebx, %ecx
+	andl	$GD_FLG_COLD_BOOT, %ecx
+	jz	skip_mem_init
 
 	/* Early platform init (setup gpio, etc ) */
 	jmp	early_board_init
@@ -89,6 +81,7 @@ early_board_init_ret:
 .globl mem_init_ret
 mem_init_ret:
 
+skip_mem_init:
 	/* fetch memory size (into %eax) */
 	jmp	get_mem_size
 .globl get_mem_size_ret
diff --git a/arch/i386/cpu/start16.S b/arch/i386/cpu/start16.S
index 0de4d09..0a5823d 100644
--- a/arch/i386/cpu/start16.S
+++ b/arch/i386/cpu/start16.S
@@ -22,6 +22,7 @@
  * MA 02111-1307 USA
  */
 
+#include <asm/global_data.h>
 
 #define BOOT_SEG	0xffff0000	/* linear segment of boot code */
 #define a32		.byte 0x67;
@@ -31,6 +32,9 @@
 .code16
 .globl start16
 start16:
+	/* Set the Cold Boot / Hard Reset flag */
+	movl	$GD_FLG_COLD_BOOT, %ebx
+
 	/*
 	 * First we let the BSP do some early initialization
 	 * this code have to map the flash to its final position
@@ -57,9 +61,6 @@ o32 cs	lgdt	gdt_ptr
 	/* Flush the prefetch queue */
 	jmp	ff
 ff:
-	/* Tell 32-bit code it is being entered from hard-reset */
-	movw	$0x0001, %bx
-
 	/* Finally jump to the 32bit initialization code */
 	movw	$code32start, %ax
 	movw	%ax, %bp
diff --git a/arch/i386/include/asm/global_data.h b/arch/i386/include/asm/global_data.h
index 456f606..a15c598 100644
--- a/arch/i386/include/asm/global_data.h
+++ b/arch/i386/include/asm/global_data.h
@@ -82,6 +82,9 @@ extern gd_t *gd;
 #define	GD_FLG_LOGINIT		0x00020	/* Log Buffer has been initialized	*/
 #define GD_FLG_DISABLE_CONSOLE	0x00040	/* Disable console (in & out)		*/
 #define GD_FLG_ENV_READY	0x00080	/* Environment imported into hash table	*/
+#define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
+#define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
+
 
 #define DECLARE_GLOBAL_DATA_PTR
 
-- 
1.7.1.422.g049e9



More information about the U-Boot mailing list