blob: 095b9b6cda874af735d9255d1798fbbc091bc4d7 [file] [log] [blame]
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2000,2007 Ronald G. Minnich <rminnich@gmail.com>
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +02005 * Copyright (C) 2005 Tyan (written by Yinghai Lu for Tyan)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +02006 * Copyright (C) 2007-2008 coresystems GmbH
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +02007 * Copyright (C) 2012 Kyösti Mälkki <kyosti.malkki@gmail.com>
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +02008 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2 of the License.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020017 */
18
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020019#include <cpu/x86/mtrr.h>
Patrick Georgi05e740f2012-03-31 12:52:21 +020020#include <cpu/x86/cache.h>
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020021#include <cpu/x86/post_code.h>
Kyösti Mälkkif9d1a422012-02-28 01:45:44 +020022#include <cpu/x86/lapic_def.h>
23
24/* Macro to access Local APIC registers at default base. */
25#define LAPIC(x) $(LAPIC_DEFAULT_BASE | LAPIC_ ## x)
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +020026#define START_IPI_VECTOR ((CONFIG_AP_SIPI_VECTOR >> 12) & 0xff)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020027
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020028#define CACHE_AS_RAM_SIZE CONFIG_DCACHE_RAM_SIZE
29#define CACHE_AS_RAM_BASE CONFIG_DCACHE_RAM_BASE
30
31 /* Save the BIST result. */
32 movl %eax, %ebp
33
34cache_as_ram:
35 post_code(0x20)
36
Kyösti Mälkkia860c682012-02-28 02:06:45 +020037 movl $LAPIC_BASE_MSR, %ecx
38 rdmsr
39 andl $LAPIC_BASE_MSR_BOOTSTRAP_PROCESSOR, %eax
40 jz ap_init
41
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +020042 /* Zero out all fixed range and variable range MTRRs.
Kyösti Mälkkia860c682012-02-28 02:06:45 +020043 * For hyper-threaded CPUs these are shared.
44 */
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020045 movl $mtrr_table, %esi
Stefan Reinauer4a45ec42015-07-07 00:54:05 +020046 movl $((mtrr_table_end - mtrr_table) >> 1), %edi
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020047 xorl %eax, %eax
48 xorl %edx, %edx
49clear_mtrrs:
50 movw (%esi), %bx
51 movzx %bx, %ecx
52 wrmsr
53 add $2, %esi
54 dec %edi
55 jnz clear_mtrrs
56
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +020057 post_code(0x21)
58
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020059 /* Configure the default memory type to uncacheable. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -070060 movl $MTRR_DEF_TYPE_MSR, %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +020061 rdmsr
62 andl $(~0x00000cff), %eax
63 wrmsr
64
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +020065 post_code(0x22)
66
Kyösti Mälkkia860c682012-02-28 02:06:45 +020067 /* Determine CPU_ADDR_BITS and load PHYSMASK high
68 * word to %edx.
69 */
70 movl $0x80000000, %eax
71 cpuid
72 cmpl $0x80000008, %eax
73 jc addrsize_no_MSR
74 movl $0x80000008, %eax
75 cpuid
76 movb %al, %cl
77 sub $32, %cl
78 movl $1, %edx
79 shl %cl, %edx
80 subl $1, %edx
81 jmp addrsize_set_high
82addrsize_no_MSR:
83 movl $1, %eax
84 cpuid
85 andl $(1<<6 | 1<<17), %edx /* PAE or PSE36 */
86 jz addrsize_set_high
87 movl $0x0f, %edx
88
89 /* Preload high word of address mask (in %edx) for Variable
90 * MTRRs 0 and 1 and enable local apic at default base.
91 */
92addrsize_set_high:
93 xorl %eax, %eax
Alexandru Gagniuc86091f92015-09-30 20:23:09 -070094 movl $MTRR_PHYS_MASK(0), %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +020095 wrmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -070096 movl $MTRR_PHYS_MASK(1), %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +020097 wrmsr
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +020098 movl $LAPIC_BASE_MSR, %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +020099 not %edx
100 movl %edx, %ebx
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200101 rdmsr
Kyösti Mälkkia860c682012-02-28 02:06:45 +0200102 andl %ebx, %edx
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200103 andl $(~LAPIC_BASE_MSR_ADDR_MASK), %eax
104 orl $(LAPIC_DEFAULT_BASE | LAPIC_BASE_MSR_ENABLE), %eax
105 wrmsr
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200106
107bsp_init:
108
109 post_code(0x23)
110
111 /* Send INIT IPI to all excluding ourself. */
112 movl LAPIC(ICR), %edi
113 movl $(LAPIC_DEST_ALLBUT | LAPIC_INT_ASSERT | LAPIC_DM_INIT), %eax
1141: movl %eax, (%edi)
115 movl $0x30, %ecx
1162: pause
117 dec %ecx
118 jnz 2b
119 movl (%edi), %ecx
120 andl $LAPIC_ICR_BUSY, %ecx
121 jnz 1b
122
123 post_code(0x24)
Patrick Georgi819c7d42012-03-31 13:08:12 +0200124
Kyösti Mälkkidf0fbc72012-07-04 12:02:58 +0300125 movl $1, %eax
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200126 cpuid
127 btl $28, %edx
128 jnc sipi_complete
129 bswapl %ebx
Kyösti Mälkkidf0fbc72012-07-04 12:02:58 +0300130 movzx %bh, %edi
131 cmpb $1, %bh
132 jbe sipi_complete /* only one LAPIC ID in package */
133
134 movl $0, %eax
135 cpuid
136 movb $1, %bl
137 cmpl $4, %eax
138 jb cores_counted
139 movl $4, %eax
140 movl $0, %ecx
141 cpuid
142 shr $26, %eax
143 movb %al, %bl
144 inc %bl
145
146cores_counted:
147 movl %edi, %eax
148 divb %bl
149 cmpb $1, %al
150 jbe sipi_complete /* only LAPIC ID of a core */
151
152 /* For a hyper-threading processor, cache must not be disabled
153 * on an AP on the same physical package with the BSP.
154 */
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200155
156hyper_threading_cpu:
157
158 /* delay 10 ms */
159 movl $10000, %ecx
1601: inb $0x80, %al
161 dec %ecx
162 jnz 1b
163
164 post_code(0x25)
165
166 /* Send Start IPI to all excluding ourself. */
167 movl LAPIC(ICR), %edi
168 movl $(LAPIC_DEST_ALLBUT | LAPIC_DM_STARTUP | START_IPI_VECTOR), %eax
1691: movl %eax, (%edi)
170 movl $0x30, %ecx
1712: pause
172 dec %ecx
173 jnz 2b
174 movl (%edi), %ecx
175 andl $LAPIC_ICR_BUSY, %ecx
176 jnz 1b
177
178 /* delay 250 us */
179 movl $250, %ecx
1801: inb $0x80, %al
181 dec %ecx
182 jnz 1b
183
184 post_code(0x26)
185
186 /* Wait for sibling CPU to start. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -07001871: movl $(MTRR_PHYS_BASE(0)), %ecx
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200188 rdmsr
189 andl %eax, %eax
190 jnz sipi_complete
191
192 movl $0x30, %ecx
1932: pause
194 dec %ecx
195 jnz 2b
196 jmp 1b
197
198
199ap_init:
200 post_code(0x27)
201
202 /* Do not disable cache (so BSP can enable it). */
203 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200204 andl $(~(CR0_CacheDisable | CR0_NoWriteThrough)), %eax
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200205 movl %eax, %cr0
206
207 post_code(0x28)
208
209 /* MTRR registers are shared between HT siblings. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700210 movl $(MTRR_PHYS_BASE(0)), %ecx
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200211 movl $(1<<12), %eax
212 xorl %edx, %edx
213 wrmsr
214
215 post_code(0x29)
216
217ap_halt:
218 cli
2191: hlt
Kyösti Mälkkidf0fbc72012-07-04 12:02:58 +0300220 jmp 1b
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200221
222
223
224sipi_complete:
225
226 post_code(0x2a)
227
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200228 /* Set Cache-as-RAM base address. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700229 movl $(MTRR_PHYS_BASE(0)), %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200230 movl $(CACHE_AS_RAM_BASE | MTRR_TYPE_WRBACK), %eax
231 xorl %edx, %edx
232 wrmsr
233
234 /* Set Cache-as-RAM mask. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700235 movl $(MTRR_PHYS_MASK(0)), %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +0200236 rdmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700237 movl $(~(CACHE_AS_RAM_SIZE - 1) | MTRR_PHYS_MASK_VALID), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200238 wrmsr
239
240 /* Enable MTRR. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700241 movl $MTRR_DEF_TYPE_MSR, %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200242 rdmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700243 orl $MTRR_DEF_TYPE_EN, %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200244 wrmsr
245
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200246 post_code(0x2b)
247
Kyösti Mälkki05d6ffb2012-02-16 23:12:04 +0200248 /* Enable L2 cache Write-Back (WBINVD and FLUSH#).
249 *
250 * MSR is set when DisplayFamily_DisplayModel is one of:
251 * 06_0x, 06_17, 06_1C
252 *
253 * Description says this bit enables use of WBINVD and FLUSH#.
254 * Should this be set only after the system bus and/or memory
255 * controller can successfully handle write cycles?
256 */
257
258#define EAX_FAMILY(a) (a << 8) /* for family <= 0fH */
259#define EAX_MODEL(a) (((a & 0xf0) << 12) | ((a & 0xf) << 4))
260
261 movl $1, %eax
262 cpuid
263 movl %eax, %ebx
264 andl $EAX_FAMILY(0x0f), %eax
265 cmpl $EAX_FAMILY(0x06), %eax
266 jne no_msr_11e
267 movl %ebx, %eax
268 andl $EAX_MODEL(0xff), %eax
269 cmpl $EAX_MODEL(0x17), %eax
270 je has_msr_11e
271 cmpl $EAX_MODEL(0x1c), %eax
272 je has_msr_11e
273 andl $EAX_MODEL(0xf0), %eax
274 cmpl $EAX_MODEL(0x00), %eax
275 jne no_msr_11e
276has_msr_11e:
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200277 movl $0x11e, %ecx
278 rdmsr
279 orl $(1 << 8), %eax
280 wrmsr
Kyösti Mälkki05d6ffb2012-02-16 23:12:04 +0200281no_msr_11e:
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200282
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200283 post_code(0x2c)
284
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200285 /* Enable cache (CR0.CD = 0, CR0.NW = 0). */
Kyösti Mälkkif9d1a422012-02-28 01:45:44 +0200286 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200287 andl $(~(CR0_CacheDisable | CR0_NoWriteThrough)), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200288 invd
289 movl %eax, %cr0
290
291 /* Clear the cache memory reagion. */
Kyösti Mälkkif9d1a422012-02-28 01:45:44 +0200292 cld
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200293 xorl %eax, %eax
Kyösti Mälkkif9d1a422012-02-28 01:45:44 +0200294 movl $CACHE_AS_RAM_BASE, %edi
Stefan Reinauer4a45ec42015-07-07 00:54:05 +0200295 movl $(CACHE_AS_RAM_SIZE >> 2), %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200296 rep stosl
297
298 /* Enable Cache-as-RAM mode by disabling cache. */
299 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200300 orl $CR0_CacheDisable, %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200301 movl %eax, %cr0
302
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200303 post_code(0x2d)
304
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200305#if CONFIG_XIP_ROM_SIZE
306 /* Enable cache for our code in Flash because we do XIP here */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700307 movl $MTRR_PHYS_BASE(1), %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200308 xorl %edx, %edx
309 /*
310 * IMPORTANT: The following calculation _must_ be done at runtime. See
311 * http://www.coreboot.org/pipermail/coreboot/2010-October/060855.html
312 */
313 movl $copy_and_run, %eax
314 andl $(~(CONFIG_XIP_ROM_SIZE - 1)), %eax
315 orl $MTRR_TYPE_WRBACK, %eax
316 wrmsr
317
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700318 movl $MTRR_PHYS_MASK(1), %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +0200319 rdmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700320 movl $(~(CONFIG_XIP_ROM_SIZE - 1) | MTRR_PHYS_MASK_VALID), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200321 wrmsr
322#endif /* CONFIG_XIP_ROM_SIZE */
323
324 /* Enable cache. */
325 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200326 andl $(~(CR0_CacheDisable | CR0_NoWriteThrough)), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200327 movl %eax, %cr0
328
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200329 post_code(0x2e)
330
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200331 /* Set up the stack pointer. */
Kyösti Mälkkif9d1a422012-02-28 01:45:44 +0200332 movl $(CACHE_AS_RAM_BASE + CACHE_AS_RAM_SIZE - 4), %esp
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200333
334 /* Restore the BIST result. */
335 movl %ebp, %eax
336 movl %esp, %ebp
337 pushl %eax
338
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200339 post_code(0x2f)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200340
341 /* Call romstage.c main function. */
Kyösti Mälkki408d3922016-06-17 10:43:48 +0300342 call romstage_main
343
344 /* Save return value from romstage_main. It contains the stack to use
Kyösti Mälkkib4f827d2016-06-21 06:59:30 +0300345 * after cache-as-ram is torn down.
346 */
Kyösti Mälkki408d3922016-06-17 10:43:48 +0300347 movl %eax, %ebx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200348
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200349 post_code(0x30)
350
351 /* Disable cache. */
352 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200353 orl $CR0_CacheDisable, %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200354 movl %eax, %cr0
355
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200356 post_code(0x34)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200357
358 /* Disable MTRR. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700359 movl $MTRR_DEF_TYPE_MSR, %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200360 rdmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700361 andl $(~MTRR_DEF_TYPE_EN), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200362 wrmsr
363
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200364 post_code(0x35)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200365
366 invd
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200367
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200368 post_code(0x36)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200369
370 /* Enable cache. */
371 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200372 andl $~(CR0_CacheDisable | CR0_NoWriteThrough), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200373 movl %eax, %cr0
374
Kyösti Mälkki0078ceb2012-02-28 02:02:27 +0200375 post_code(0x37)
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200376
377 /* Disable cache. */
378 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200379 orl $CR0_CacheDisable, %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200380 movl %eax, %cr0
381
382 post_code(0x38)
383
Kyösti Mälkkif9d1a422012-02-28 01:45:44 +0200384 /* Enable Write Back and Speculative Reads for low RAM. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700385 movl $MTRR_PHYS_BASE(0), %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200386 movl $(0x00000000 | MTRR_TYPE_WRBACK), %eax
387 xorl %edx, %edx
388 wrmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700389 movl $MTRR_PHYS_MASK(0), %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +0200390 rdmsr
Kyösti Mälkki65cc5262016-06-19 20:38:41 +0300391 movl $(~(CACHE_TMP_RAMTOP - 1) | MTRR_PHYS_MASK_VALID), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200392 wrmsr
393
Kyösti Mälkki107f72e2014-01-06 11:06:26 +0200394#if CACHE_ROM_SIZE
Kyösti Mälkki325b92f2012-02-28 00:24:15 +0200395 /* Enable caching and Speculative Reads for Flash ROM device. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700396 movl $MTRR_PHYS_BASE(1), %ecx
Kyösti Mälkki325b92f2012-02-28 00:24:15 +0200397 movl $(CACHE_ROM_BASE | MTRR_TYPE_WRPROT), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200398 xorl %edx, %edx
399 wrmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700400 movl $MTRR_PHYS_MASK(1), %ecx
Kyösti Mälkkia860c682012-02-28 02:06:45 +0200401 rdmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700402 movl $(~(CACHE_ROM_SIZE - 1) | MTRR_PHYS_MASK_VALID), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200403 wrmsr
Kyösti Mälkki5458b9d2012-06-30 11:41:08 +0300404#endif
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200405
406 post_code(0x39)
407
408 /* And enable cache again after setting MTRRs. */
409 movl %cr0, %eax
Patrick Georgi05e740f2012-03-31 12:52:21 +0200410 andl $~(CR0_CacheDisable | CR0_NoWriteThrough), %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200411 movl %eax, %cr0
412
413 post_code(0x3a)
414
415 /* Enable MTRR. */
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700416 movl $MTRR_DEF_TYPE_MSR, %ecx
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200417 rdmsr
Alexandru Gagniuc86091f92015-09-30 20:23:09 -0700418 orl $MTRR_DEF_TYPE_EN, %eax
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200419 wrmsr
420
421 post_code(0x3b)
422
423 /* Invalidate the cache again. */
424 invd
425
426 post_code(0x3c)
427
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200428__main:
429 post_code(POST_PREPARE_RAMSTAGE)
430 cld /* Clear direction flag. */
431
Kyösti Mälkki408d3922016-06-17 10:43:48 +0300432 /* Setup stack as indicated by return value from romstage_main(). */
433 movl %ebx, %esp
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200434 movl %esp, %ebp
Kyösti Mälkki5a660ca2012-02-28 00:15:30 +0200435 call copy_and_run
436
437.Lhlt:
438 post_code(POST_DEAD_CODE)
439 hlt
440 jmp .Lhlt
441
442mtrr_table:
443 /* Fixed MTRRs */
444 .word 0x250, 0x258, 0x259
445 .word 0x268, 0x269, 0x26A
446 .word 0x26B, 0x26C, 0x26D
447 .word 0x26E, 0x26F
448 /* Variable MTRRs */
449 .word 0x200, 0x201, 0x202, 0x203
450 .word 0x204, 0x205, 0x206, 0x207
451 .word 0x208, 0x209, 0x20A, 0x20B
452 .word 0x20C, 0x20D, 0x20E, 0x20F
453mtrr_table_end: