2 * U-boot - x86 Startup Code
4 * (C) Copyright 2008-2011
5 * Graeme Russ, <graeme.russ@gmail.com>
7 * (C) Copyright 2002,2003
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,
29 #include <asm/global_data.h>
30 #include <asm/processor-flags.h>
32 #define BOOT_SEG 0xffff0000 /* linear segment of boot code */
33 #define a32 .byte 0x67;
34 #define o32 .byte 0x66;
36 .section .start16, "ax"
41 * First we let the BSP do some early initialization
42 * this code have to map the flash to its final position
45 .globl board_init16_ret
48 /* Turn of cache (this might require a 486-class CPU) */
50 orl $(X86_CR0_NW | X86_CR0_CD), %eax
54 /* load the temporary Global Descriptor Table */
58 /* Now, we enter protected mode */
63 /* Flush the prefetch queue */
66 /* Finally jump to the 32bit initialization code */
67 movw $code32start, %ax
71 /* 48-bit far pointer */
73 .long _start /* offset */
74 .word 0x10 /* segment */
81 * The following Global Descriptor Table is just enough to get us into
82 * 'Flat Protected Mode' - It will be discarded as soon as the final
83 * GDT is setup in a safe location in RAM
86 .word 0x20 /* limit (32 bytes = 4 GDT entries) */
87 .long BOOT_SEG + gdt /* base */
95 * 0x18 32bit data/stack
99 .word 0, 0, 0, 0 /* NULL */
100 .word 0, 0, 0, 0 /* unused */
102 .word 0xFFFF /* 4Gb - (0x100000*0x1000 = 4Gb) */
103 .word 0 /* base address = 0 */
104 .word 0x9B00 /* code read/exec */
105 .word 0x00CF /* granularity = 4096, 386 (+5th nibble of limit) */
107 .word 0xFFFF /* 4Gb - (0x100000*0x1000 = 4Gb) */
108 .word 0x0 /* base address = 0 */
109 .word 0x9300 /* data read/write */
110 .word 0x00CF /* granularity = 4096, 386 (+5th nibble of limit) */