浏览代码

x86: Add back cold- and warm-boot flags

These were removed, but actually are useful.

Cold means that we started from a reset/power on.
Warm means that we started from another U-Boot.

We determine whether u-boot on x86 was warm or cold booted (really if
it started at the beginning of the text segment or at the ELF entry point).
We plumb the result through to the global data structure.

Signed-off-by: Simon Glass <sjg@chromium.org>
Gabe Black 12 年之前
父节点
当前提交
91d82a29e7
共有 3 个文件被更改,包括 18 次插入1 次删除
  1. 9 1
      arch/x86/cpu/start.S
  2. 3 0
      arch/x86/cpu/start16.S
  3. 6 0
      arch/x86/include/asm/global_data.h

+ 9 - 1
arch/x86/cpu/start.S

@@ -55,8 +55,16 @@ _x86boot_start:
 	movl	%eax, %cr0
 	movl	%eax, %cr0
 	wbinvd
 	wbinvd
 
 
+	/* Tell 32-bit code it is being entered from an in-RAM copy */
+	movw	$GD_FLG_WARM_BOOT, %bx
+	jmp	1f
 _start:
 _start:
-	/* This is the 32-bit cold-reset entry point */
+	/*
+	 * This is the 32-bit cold-reset entry point. Initialize %bx to 0
+	 * in case we're preceeded by some sort of boot stub.
+	 */
+	movw	$GD_FLG_COLD_BOOT, %bx
+1:
 
 
 	/* Load the segement registes to match the gdt loaded in start16.S */
 	/* Load the segement registes to match the gdt loaded in start16.S */
 	movl	$(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
 	movl	$(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax

+ 3 - 0
arch/x86/cpu/start16.S

@@ -37,6 +37,9 @@
 .code16
 .code16
 .globl start16
 .globl start16
 start16:
 start16:
+	/* Set the Cold Boot / Hard Reset flag */
+	movl	$GD_FLG_COLD_BOOT, %ebx
+
 	/*
 	/*
 	 * First we let the BSP do some early initialization
 	 * First we let the BSP do some early initialization
 	 * this code have to map the flash to its final position
 	 * this code have to map the flash to its final position

+ 6 - 0
arch/x86/include/asm/global_data.h

@@ -78,6 +78,12 @@ static inline gd_t *get_fs_gd_ptr(void)
 
 
 #include <asm-generic/global_data_flags.h>
 #include <asm-generic/global_data_flags.h>
 
 
+/*
+ * Our private Global Data Flags
+ */
+#define GD_FLG_COLD_BOOT	0x00100	/* Cold Boot */
+#define GD_FLG_WARM_BOOT	0x00200	/* Warm Boot */
+
 #define DECLARE_GLOBAL_DATA_PTR
 #define DECLARE_GLOBAL_DATA_PTR
 
 
 #endif /* __ASM_GBL_DATA_H */
 #endif /* __ASM_GBL_DATA_H */