blob: f8dab1a728879f9161c244835641dd47931a9478 [file] [log] [blame]
Patrick Rudolph1af89232018-11-11 12:50:51 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2000,2007 Ronald G. Minnich <rminnich@gmail.com>
5 * Copyright (C) 2007-2008 coresystems GmbH
6 * Copyright (C) 2018 Patrick Rudolph <siro@das-labor.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#include <cpu/x86/cache.h>
19#include <cpu/x86/post_code.h>
20
21.global bootblock_pre_c_entry
22bootblock_pre_c_entry:
23
24cache_as_ram:
25 post_code(0x20)
26 /*
27 * Nothing to do here on qemu, RAM works just fine without any
28 * initialization.
29 */
30
Patrick Rudolph1af89232018-11-11 12:50:51 +010031 /* Clear the cache memory region. This will also clear CAR GLOBAL */
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030032 movl $_car_region_start, %edi
Patrick Rudolph1af89232018-11-11 12:50:51 +010033 movl $_car_region_end, %ecx
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030034 sub %edi, %ecx
Patrick Rudolph1af89232018-11-11 12:50:51 +010035 shr $2, %ecx
36 xorl %eax, %eax
37 rep stosl
38
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030039 post_code(0x21)
40
41 movl $_car_stack_end, %esp
42
43 /* Align the stack and keep aligned for call to bootblock_c_entry() */
44 and $0xfffffff0, %esp
45 sub $4, %esp
46
Patrick Rudolph1af89232018-11-11 12:50:51 +010047 /* Restore the BIST result and timestamps. */
48 movd %mm0, %ebx
49 movd %mm1, %eax
50 movd %mm2, %edx
51
52 pushl %ebx
53 pushl %edx
54 pushl %eax
55
56before_c_entry:
57 post_code(0x29)
58 call bootblock_c_entry_bist
59 /* Never returns */
60.Lhlt:
61 post_code(POST_DEAD_CODE)
62 hlt
63 jmp .Lhlt