]> git.sur5r.net Git - u-boot/blobdiff - arch/x86/cpu/start.S
Merge branch 'master' of git://git.denx.de/u-boot-mpc85xx
[u-boot] / arch / x86 / cpu / start.S
index 6c84c43f06aa917c466f50c58b40020c8fcc3284..ee0dabe4bcd049becb3c632ec408c98f32d13fb3 100644 (file)
@@ -5,7 +5,7 @@
  * Graeme Russ, <graeme.russ@gmail.com>
  *
  * (C) Copyright 2002
- * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
+ * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -29,7 +29,9 @@
 #include <config.h>
 #include <version.h>
 #include <asm/global_data.h>
+#include <asm/processor.h>
 #include <asm/processor-flags.h>
+#include <generated/generic-asm-offsets.h>
 
 .section .text
 .code32
@@ -47,19 +49,17 @@ _x86boot_start:
        cli
        cld
 
-       /* Turn of cache (this might require a 486-class CPU) */
+       /* Turn off cache (this might require a 486-class CPU) */
        movl    %cr0, %eax
        orl     $(X86_CR0_NW | X86_CR0_CD), %eax
        movl    %eax, %cr0
        wbinvd
 
-       /* Tell 32-bit code it is being entered from an in-RAM copy */
-       movw    $GD_FLG_WARM_BOOT, %bx
 _start:
        /* This is the 32-bit cold-reset entry point */
 
        /* Load the segement registes to match the gdt loaded in start16.S */
-       movl    $0x18, %eax
+       movl    $(X86_GDT_ENTRY_32BIT_DS * X86_GDT_ENTRY_SIZE), %eax
        movw    %ax, %fs
        movw    %ax, %ds
        movw    %ax, %gs
@@ -85,6 +85,12 @@ car_init_ret:
         */
        movl    $CONFIG_SYS_INIT_SP_ADDR, %esp
 
+       /* Initialise the Global Data Pointer */
+       movl    $CONFIG_SYS_INIT_GD_ADDR, %eax
+       movl    %eax, %edx
+       addl    $GENERATED_GBL_DATA_SIZE, %edx
+       call    init_gd;
+
        /* Set parameter to board_init_f() to boot flags */
        xorl    %eax, %eax
        movw    %bx, %ax
@@ -96,37 +102,48 @@ car_init_ret:
        movw    $0x85, %ax
        jmp     die
 
-.globl relocate_code
-.type relocate_code, @function
-relocate_code:
+.globl board_init_f_r_trampoline
+.type board_init_f_r_trampoline, @function
+board_init_f_r_trampoline:
        /*
         * 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
+        * %eax = Address of top of new stack
         */
 
        /* 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
+       /* Re-enter U-Boot by calling board_init_f_r */
+       call    board_init_f_r
 
-die:   hlt
+die:
+       hlt
        jmp     die
        hlt
 
 blank_idt_ptr:
        .word   0               /* limit */
        .long   0               /* base */
+
+       .p2align        2       /* force 4-byte alignment */
+
+multiboot_header:
+       /* magic */
+       .long   0x1BADB002
+       /* flags */
+       .long   (1 << 16)
+       /* checksum */
+       .long   -0x1BADB002 - (1 << 16)
+       /* header addr */
+       .long   multiboot_header - _x86boot_start + CONFIG_SYS_TEXT_BASE
+       /* load addr */
+       .long   CONFIG_SYS_TEXT_BASE
+       /* load end addr */
+       .long   0
+       /* bss end addr */
+       .long   0
+       /* entry addr */
+       .long   CONFIG_SYS_TEXT_BASE