2 * U-boot - x86 Startup Code
4 * (C) Copyright 2008-2011
5 * Graeme Russ, <graeme.russ@gmail.com>
8 * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
10 * See file CREDITS for list of people who contributed to this
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation; either version 2 of
16 * the License, or (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <asm/global_data.h>
32 #include <asm/processor-flags.h>
33 #include <generated/asm-offsets.h>
38 .type _start, @function
42 * This is the fail safe 32-bit bootstrap entry point. The
43 * following code is not executed from a cold-reset (actually, a
44 * lot of it is, but from real-mode after cold reset. It is
45 * repeated here to put the board into a state as close to cold
51 /* Turn off cache (this might require a 486-class CPU) */
53 orl $(X86_CR0_NW | X86_CR0_CD), %eax
58 /* This is the 32-bit cold-reset entry point */
60 /* Load the segement registes to match the gdt loaded in start16.S */
68 /* Clear the interrupt vectors */
71 /* Early platform init (setup gpio, etc ) */
73 .globl early_board_init_ret
76 /* Initialise Cache-As-RAM */
81 * We now have CONFIG_SYS_CAR_SIZE bytes of Cache-As-RAM (or SRAM,
82 * or fully initialised SDRAM - we really don't care which)
83 * starting at CONFIG_SYS_CAR_ADDR to be used as a temporary stack
85 movl $CONFIG_SYS_INIT_SP_ADDR, %esp
87 /* Set parameter to board_init_f() to boot flags */
94 /* indicate (lack of) progress */
99 .type relocate_code, @function
102 * SDRAM has been initialised, U-Boot code has been copied into
103 * RAM, BSS has been cleared and relocation adjustments have been
104 * made. It is now time to jump into the in-RAM copy of U-Boot
106 * %eax = Address of top of stack
107 * %edx = Address of Global Data
108 * %ecx = Base address of in-RAM copy of U-Boot
111 /* Setup stack in RAM */
114 /* Setup call address of in-RAM copy of board_init_r() */
115 movl $board_init_r, %ebp
116 addl (GENERATED_GD_RELOC_OFF)(%edx), %ebp
118 /* Setup parameters to board_init_r() */
122 /* Jump to in-RAM copy of board_init_r() */
134 .p2align 2 /* force 4-byte alignment */
142 .long -0x1BADB002 - (1 << 16)
144 .long multiboot_header - _x86boot_start + CONFIG_SYS_TEXT_BASE
146 .long CONFIG_SYS_TEXT_BASE
152 .long CONFIG_SYS_TEXT_BASE