]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/x86/cpu/start16.S
x86: Remove board_init16() call which is not used
[karo-tx-uboot.git] / arch / x86 / cpu / start16.S
1 /*
2  *  U-boot - x86 Startup Code
3  *
4  * (C) Copyright 2008-2011
5  * Graeme Russ, <graeme.russ@gmail.com>
6  *
7  * (C) Copyright 2002,2003
8  * Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
9  *
10  * SPDX-License-Identifier:     GPL-2.0+
11  */
12
13 #include <asm/global_data.h>
14 #include <asm/processor-flags.h>
15
16 #define BOOT_SEG        0xffff0000      /* linear segment of boot code */
17 #define a32             .byte 0x67;
18 #define o32             .byte 0x66;
19
20 .section .start16, "ax"
21 .code16
22 .globl start16
23 start16:
24         /* Set the Cold Boot / Hard Reset flag */
25         movl    $GD_FLG_COLD_BOOT, %ebx
26
27         /* Turn off cache (this might require a 486-class CPU) */
28         movl    %cr0, %eax
29         orl     $(X86_CR0_NW | X86_CR0_CD), %eax
30         movl    %eax, %cr0
31         wbinvd
32
33         /* load the temporary Global Descriptor Table */
34 o32 cs  lidt    idt_ptr
35 o32 cs  lgdt    gdt_ptr
36
37         /* Now, we enter protected mode */
38         movl    %cr0, %eax
39         orl     $X86_CR0_PE, %eax
40         movl    %eax, %cr0
41
42         /* Flush the prefetch queue */
43         jmp     ff
44 ff:
45         /* Finally jump to the 32bit initialization code */
46         movw    $code32start, %ax
47         movw    %ax, %bp
48 o32 cs  ljmp    *(%bp)
49
50         /* 48-bit far pointer */
51 code32start:
52         .long   _start          /* offset */
53         .word   0x10            /* segment */
54
55 idt_ptr:
56         .word   0               /* limit */
57         .long   0               /* base */
58
59 /*
60  * The following Global Descriptor Table is just enough to get us into
61  * 'Flat Protected Mode' - It will be discarded as soon as the final
62  * GDT is setup in a safe location in RAM
63  */
64 gdt_ptr:
65         .word   0x1f            /* limit (31 bytes = 4 GDT entries - 1) */
66         .long   BOOT_SEG + gdt  /* base */
67
68 /* Some CPUs are picky about GDT alignment... */
69 .align 16
70 gdt:
71         /*
72          * The GDT table ...
73          *
74          *       Selector       Type
75          *       0x00           NULL
76          *       0x08           Unused
77          *       0x10           32bit code
78          *       0x18           32bit data/stack
79          */
80         /* The NULL Desciptor - Mandatory */
81         .word   0x0000          /* limit_low */
82         .word   0x0000          /* base_low */
83         .byte   0x00            /* base_middle */
84         .byte   0x00            /* access */
85         .byte   0x00            /* flags + limit_high */
86         .byte   0x00            /* base_high */
87
88         /* Unused Desciptor - (matches Linux) */
89         .word   0x0000          /* limit_low */
90         .word   0x0000          /* base_low */
91         .byte   0x00            /* base_middle */
92         .byte   0x00            /* access */
93         .byte   0x00            /* flags + limit_high */
94         .byte   0x00            /* base_high */
95
96         /*
97          * The Code Segment Descriptor:
98          * - Base   = 0x00000000
99          * - Size   = 4GB
100          * - Access = Present, Ring 0, Exec (Code), Readable
101          * - Flags  = 4kB Granularity, 32-bit
102          */
103         .word   0xffff          /* limit_low */
104         .word   0x0000          /* base_low */
105         .byte   0x00            /* base_middle */
106         .byte   0x9b            /* access */
107         .byte   0xcf            /* flags + limit_high */
108         .byte   0x00            /* base_high */
109
110         /*
111          * The Data Segment Descriptor:
112          * - Base   = 0x00000000
113          * - Size   = 4GB
114          * - Access = Present, Ring 0, Non-Exec (Data), Writable
115          * - Flags  = 4kB Granularity, 32-bit
116          */
117         .word   0xffff          /* limit_low */
118         .word   0x0000          /* base_low */
119         .byte   0x00            /* base_middle */
120         .byte   0x93            /* access */
121         .byte   0xcf            /* flags + limit_high */
122         .byte   0x00            /* base_high */