The built in self test value is available in register eax on start-up. Save
it so that it can be accessed later. Unfortunately we must wait until the
global_data is available before we can do this, so there is a little bit of
shuffling to keep it around.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
         */
        movw    $GD_FLG_COLD_BOOT, %bx
 1:
+       /* Save BIST */
+       movl    %eax, %ebp
 
        /* Load the segement registes to match the gdt loaded in start16.S */
        movl    $(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
        addl    $GD_MALLOC_BASE, %edx
        movl    %esp, (%edx)
 #endif
-
-       /* Align temporary global descriptor table to 16-byte boundary */
-       andl    $0xfffffff0, %esp
+       /* Store BIST */
+       movl    %eax, %edx
+       addl    $GD_BIST, %edx
+       movl    %ebp, (%edx)
 
        /* Set second parameter to setup_gdt */
        movl    %ecx, %edx
 
 .code16
 .globl start16
 start16:
+       /* Save BIST */
+       movl    %eax, %ecx
+
        /* Set the Cold Boot / Hard Reset flag */
        movl    $GD_FLG_COLD_BOOT, %ebx
 
        /* Flush the prefetch queue */
        jmp     ff
 ff:
-       /* Finally jump to the 32bit initialization code */
+
+       /* Finally restore BIST and jump to the 32bit initialization code */
        movw    $code32start, %ax
        movw    %ax, %bp
+       movl    %ecx, %eax
 o32 cs ljmp    *(%bp)
 
        /* 48-bit far pointer */
 
        uint32_t tsc_base_kclocks;      /* Initial tsc as a kclocks value */
        uint32_t tsc_prev;              /* For show_boot_progress() */
        void *new_fdt;                  /* Relocated FDT */
+       uint32_t bist;                  /* Built-in self test value */
 };
 
 #endif
 
 #ifdef CONFIG_SYS_MALLOC_F_LEN
        DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base));
 #endif
+#ifdef CONFIG_X86
+       DEFINE(GD_BIST, offsetof(struct global_data, arch.bist));
+#endif
 
 #if defined(CONFIG_ARM)