* starting at CONFIG_SYS_CAR_ADDR to be used as a temporary stack
*/
movl $CONFIG_SYS_INIT_SP_ADDR, %esp
+ movl $CONFIG_SYS_INIT_GD_ADDR, %ebp
- /* Skip memory initialization if not starting from cold-reset */
- movl %ebx, %ecx
- andl $GD_FLG_COLD_BOOT, %ecx
- jz skip_mem_init
+ /* Set Boot Flags in Global Data */
+ movl %ebx, (GD_FLAGS * 4)(%ebp)
- /* size memory */
- call mem_init
-
-skip_mem_init:
- /* fetch memory size (into %eax) */
- call get_mem_size
- movl %eax, %esp
-
-#if CONFIG_SYS_SDRAM_ECC_ENABLE
- /* Skip ECC initialization if not starting from cold-reset */
- movl %ebx, %ecx
- andl $GD_FLG_COLD_BOOT, %ecx
- jz skip_ecc_init
- call init_ecc
-
-skip_init_ecc:
-#endif
-
- /* Test the stack */
- pushl $0
- popl %ecx
- cmpl $0, %ecx
- jne die
- push $0x55aa55aa
- popl %ecx
- cmpl $0x55aa55aa, %ecx
- jne die
-
- wbinvd
-
- /* Determine our load offset */
+ /* Determine our load offset (and put in Global Data) */
call 1f
1: popl %ecx
subl $1b, %ecx
+ movl %ecx, (GD_LOAD_OFF * 4)(%ebp)
- /* Set the upper memory limit parameter */
- subl $CONFIG_SYS_STACK_SIZE, %eax
-
- /* Pointer to temporary global data */
- movl $CONFIG_SYS_INIT_GD_ADDR, %edx
-
- /* %edx points to the global data structure */
- movl %esp, (GD_RAM_SIZE * 4)(%edx)
- movl %ebx, (GD_FLAGS * 4)(%edx)
- movl %ecx, (GD_LOAD_OFF * 4)(%edx)
+ /* Set parameter to board_init_f() to boot flags */
+ movl (GD_FLAGS * 4)(%ebp), %eax
call board_init_f /* Enter, U-boot! */
/* indicate (lack of) progress */
movw $0x85, %ax
+ jmp die
+
+.globl relocate_code
+.type relocate_code, @function
+relocate_code:
+ /*
+ * SDRAM has been initialised, U-Boot code has been copied into
+ * RAM, BSS has been cleared and relocation adjustments have been
+ * made. It is now time to jump into the in-RAM copy of U-Boot
+ *
+ * %eax = Address of top of stack
+ * %edx = Address of Global Data
+ * %ecx = Base address of in-RAM copy of U-Boot
+ */
+
+ /* Setup stack in RAM */
+ movl %eax, %esp
+
+ /* Setup call address of in-RAM copy of board_init_r() */
+ movl $board_init_r, %ebp
+ addl (GD_RELOC_OFF * 4)(%edx), %ebp
+
+ /* Setup parameters to board_init_r() */
+ movl %edx, %eax
+ movl %ecx, %edx
+
+ /* Jump to in-RAM copy of board_init_r() */
+ call *%ebp
+
die: hlt
jmp die
hlt