2 * U-boot - i386 Startup Code
4 * Copyright (c) 2002, 2003 Omicron Ceti AB, Daniel Engström <denaiel@omicron.se>
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation; either version 2 of
12 * the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <asm/global_data.h>
26 #include <asm/processor-flags.h>
28 #define BOOT_SEG 0xffff0000 /* linear segment of boot code */
29 #define a32 .byte 0x67;
30 #define o32 .byte 0x66;
32 .section .start16, "ax"
36 /* Set the Cold Boot / Hard Reset flag */
37 movl $GD_FLG_COLD_BOOT, %ebx
40 * First we let the BSP do some early initialization
41 * this code have to map the flash to its final position
44 .globl board_init16_ret
47 /* Turn of cache (this might require a 486-class CPU) */
49 orl $(X86_CR0_NW & X86_CR0_CD), %eax
53 /* load the temporary Global Descriptor Table */
57 /* Now, we enter protected mode */
62 /* Flush the prefetch queue */
65 /* Finally jump to the 32bit initialization code */
66 movw $code32start, %ax
70 /* 48-bit far pointer */
72 .long _start /* offset */
73 .word 0x10 /* segment */
80 * The following Global Descriptor Table is just enough to get us into
81 * 'Flat Protected Mode' - It will be discarded as soon as the final
82 * GDT is setup in a safe location in RAM
85 .word 0x20 /* limit (32 bytes = 4 GDT entries) */
86 .long BOOT_SEG + gdt /* base */
94 * 0x18 32bit data/stack
98 .word 0, 0, 0, 0 /* NULL */
99 .word 0, 0, 0, 0 /* unused */
101 .word 0xFFFF /* 4Gb - (0x100000*0x1000 = 4Gb) */
102 .word 0 /* base address = 0 */
103 .word 0x9B00 /* code read/exec */
104 .word 0x00CF /* granularity = 4096, 386 (+5th nibble of limit) */
106 .word 0xFFFF /* 4Gb - (0x100000*0x1000 = 4Gb) */
107 .word 0x0 /* base address = 0 */
108 .word 0x9300 /* data read/write */
109 .word 0x00CF /* granularity = 4096, 386 (+5th nibble of limit) */