blob: baf87c8dd8ecec4e7eaa71c37f3ed92c734ed6af [file] [log] [blame]
Angel Ponsf23ae0b2020-04-02 23:48:12 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Patrick Rudolph1af89232018-11-11 12:50:51 +01003
4#include <cpu/x86/cache.h>
5#include <cpu/x86/post_code.h>
6
7.global bootblock_pre_c_entry
8bootblock_pre_c_entry:
9
10cache_as_ram:
11 post_code(0x20)
12 /*
13 * Nothing to do here on qemu, RAM works just fine without any
14 * initialization.
15 */
16
Patrick Rudolph1af89232018-11-11 12:50:51 +010017 /* Clear the cache memory region. This will also clear CAR GLOBAL */
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030018 movl $_car_region_start, %edi
Patrick Rudolph1af89232018-11-11 12:50:51 +010019 movl $_car_region_end, %ecx
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030020 sub %edi, %ecx
Patrick Rudolph1af89232018-11-11 12:50:51 +010021 shr $2, %ecx
22 xorl %eax, %eax
23 rep stosl
24
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030025 post_code(0x21)
26
Arthur Heymansdf9cdcf2019-11-09 06:50:20 +010027 movl $_ecar_stack, %esp
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030028
29 /* Align the stack and keep aligned for call to bootblock_c_entry() */
30 and $0xfffffff0, %esp
Kyösti Mälkkia7cac0a2019-08-18 08:30:30 +030031
Patrick Rudolph1af89232018-11-11 12:50:51 +010032 /* Restore the BIST result and timestamps. */
Patrick Rudolphb1ef7252019-09-28 17:44:01 +020033#if defined(__x86_64__)
34 movd %mm1, %rdi
35 shld %rdi, 32
36 movd %mm1, %rsi
37 or %rsi, %rdi
38 movd %mm2, %rsi
39#else
40 sub $4, %esp
41
Patrick Rudolph1af89232018-11-11 12:50:51 +010042 movd %mm0, %ebx
43 movd %mm1, %eax
44 movd %mm2, %edx
45
46 pushl %ebx
47 pushl %edx
48 pushl %eax
Patrick Rudolphb1ef7252019-09-28 17:44:01 +020049#endif
Patrick Rudolph1af89232018-11-11 12:50:51 +010050
51before_c_entry:
52 post_code(0x29)
53 call bootblock_c_entry_bist
54 /* Never returns */
55.Lhlt:
56 post_code(POST_DEAD_CODE)
57 hlt
58 jmp .Lhlt