mirror of
				https://xff.cz/git/u-boot/
				synced 2025-10-31 18:35:42 +01:00 
			
		
		
		
	x86: Save the BIST value on reset
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>
This commit is contained in:
		| @@ -49,6 +49,8 @@ _start: | |||||||
| 	 */ | 	 */ | ||||||
| 	movw	$GD_FLG_COLD_BOOT, %bx | 	movw	$GD_FLG_COLD_BOOT, %bx | ||||||
| 1: | 1: | ||||||
|  | 	/* Save BIST */ | ||||||
|  | 	movl	%eax, %ebp | ||||||
|  |  | ||||||
| 	/* 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 | ||||||
| @@ -117,9 +119,10 @@ car_init_ret: | |||||||
| 	addl	$GD_MALLOC_BASE, %edx | 	addl	$GD_MALLOC_BASE, %edx | ||||||
| 	movl	%esp, (%edx) | 	movl	%esp, (%edx) | ||||||
| #endif | #endif | ||||||
|  | 	/* Store BIST */ | ||||||
| 	/* Align temporary global descriptor table to 16-byte boundary */ | 	movl	%eax, %edx | ||||||
| 	andl	$0xfffffff0, %esp | 	addl	$GD_BIST, %edx | ||||||
|  | 	movl	%ebp, (%edx) | ||||||
|  |  | ||||||
| 	/* Set second parameter to setup_gdt */ | 	/* Set second parameter to setup_gdt */ | ||||||
| 	movl	%ecx, %edx | 	movl	%ecx, %edx | ||||||
|   | |||||||
| @@ -21,6 +21,9 @@ | |||||||
| .code16 | .code16 | ||||||
| .globl start16 | .globl start16 | ||||||
| start16: | start16: | ||||||
|  | 	/* Save BIST */ | ||||||
|  | 	movl	%eax, %ecx | ||||||
|  |  | ||||||
| 	/* Set the Cold Boot / Hard Reset flag */ | 	/* Set the Cold Boot / Hard Reset flag */ | ||||||
| 	movl	$GD_FLG_COLD_BOOT, %ebx | 	movl	$GD_FLG_COLD_BOOT, %ebx | ||||||
|  |  | ||||||
| @@ -45,9 +48,11 @@ o32 cs	lgdt	gdt_ptr | |||||||
| 	/* Flush the prefetch queue */ | 	/* Flush the prefetch queue */ | ||||||
| 	jmp	ff | 	jmp	ff | ||||||
| ff: | ff: | ||||||
| 	/* Finally jump to the 32bit initialization code */ |  | ||||||
|  | 	/* Finally restore BIST and jump to the 32bit initialization code */ | ||||||
| 	movw	$code32start, %ax | 	movw	$code32start, %ax | ||||||
| 	movw	%ax, %bp | 	movw	%ax, %bp | ||||||
|  | 	movl	%ecx, %eax | ||||||
| o32 cs	ljmp	*(%bp) | o32 cs	ljmp	*(%bp) | ||||||
|  |  | ||||||
| 	/* 48-bit far pointer */ | 	/* 48-bit far pointer */ | ||||||
|   | |||||||
| @@ -17,6 +17,7 @@ struct arch_global_data { | |||||||
| 	uint32_t tsc_base_kclocks;	/* Initial tsc as a kclocks value */ | 	uint32_t tsc_base_kclocks;	/* Initial tsc as a kclocks value */ | ||||||
| 	uint32_t tsc_prev;		/* For show_boot_progress() */ | 	uint32_t tsc_prev;		/* For show_boot_progress() */ | ||||||
| 	void *new_fdt;			/* Relocated FDT */ | 	void *new_fdt;			/* Relocated FDT */ | ||||||
|  | 	uint32_t bist;			/* Built-in self test value */ | ||||||
| }; | }; | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -31,6 +31,9 @@ int main(void) | |||||||
| #ifdef CONFIG_SYS_MALLOC_F_LEN | #ifdef CONFIG_SYS_MALLOC_F_LEN | ||||||
| 	DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base)); | 	DEFINE(GD_MALLOC_BASE, offsetof(struct global_data, malloc_base)); | ||||||
| #endif | #endif | ||||||
|  | #ifdef CONFIG_X86 | ||||||
|  | 	DEFINE(GD_BIST, offsetof(struct global_data, arch.bist)); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #if defined(CONFIG_ARM) | #if defined(CONFIG_ARM) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user