blob: 1fa0018dc88d92a2210aeec885e8ecabb10d0dd3 [file] [log] [blame]
Patrick Rudolph1af89232018-11-11 12:50:51 +01001/*
2 * This file is part of the coreboot project.
3 *
Patrick Rudolph1af89232018-11-11 12:50:51 +01004 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <cpu/x86/cache.h>
15#include <cpu/x86/post_code.h>
16
17.global bootblock_pre_c_entry
18bootblock_pre_c_entry:
19
20cache_as_ram:
21 post_code(0x20)
22 /*
23 * Nothing to do here on qemu, RAM works just fine without any
24 * initialization.
25 */
26
Patrick Rudolph1af89232018-11-11 12:50:51 +010027 /* Clear the cache memory region. This will also clear CAR GLOBAL */
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030028 movl $_car_region_start, %edi
Patrick Rudolph1af89232018-11-11 12:50:51 +010029 movl $_car_region_end, %ecx
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030030 sub %edi, %ecx
Patrick Rudolph1af89232018-11-11 12:50:51 +010031 shr $2, %ecx
32 xorl %eax, %eax
33 rep stosl
34
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030035 post_code(0x21)
36
Arthur Heymansdf9cdcf2019-11-09 06:50:20 +010037 movl $_ecar_stack, %esp
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030038
39 /* Align the stack and keep aligned for call to bootblock_c_entry() */
40 and $0xfffffff0, %esp
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030041
Patrick Rudolph1af89232018-11-11 12:50:51 +010042 /* Restore the BIST result and timestamps. */
Patrick Rudolphb1ef7252019-09-28 17:44:01 +020043#if defined(__x86_64__)
44 movd %mm1, %rdi
45 shld %rdi, 32
46 movd %mm1, %rsi
47 or %rsi, %rdi
48 movd %mm2, %rsi
49#else
50 sub $4, %esp
51
Patrick Rudolph1af89232018-11-11 12:50:51 +010052 movd %mm0, %ebx
53 movd %mm1, %eax
54 movd %mm2, %edx
55
56 pushl %ebx
57 pushl %edx
58 pushl %eax
Patrick Rudolphb1ef7252019-09-28 17:44:01 +020059#endif
Patrick Rudolph1af89232018-11-11 12:50:51 +010060
61before_c_entry:
62 post_code(0x29)
63 call bootblock_c_entry_bist
64 /* Never returns */
65.Lhlt:
66 post_code(POST_DEAD_CODE)
67 hlt
68 jmp .Lhlt