Angel Pons | f23ae0b | 2020-04-02 23:48:12 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 3 | |
| 4 | #include <cpu/x86/cache.h> |
| 5 | #include <cpu/x86/post_code.h> |
| 6 | |
| 7 | .global bootblock_pre_c_entry |
| 8 | bootblock_pre_c_entry: |
| 9 | |
| 10 | cache_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 Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 17 | /* Clear the cache memory region. This will also clear CAR GLOBAL */ |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 18 | movl $_car_region_start, %edi |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 19 | movl $_car_region_end, %ecx |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 20 | sub %edi, %ecx |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 21 | shr $2, %ecx |
| 22 | xorl %eax, %eax |
| 23 | rep stosl |
| 24 | |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 25 | post_code(0x21) |
| 26 | |
Arthur Heymans | df9cdcf | 2019-11-09 06:50:20 +0100 | [diff] [blame] | 27 | movl $_ecar_stack, %esp |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 28 | |
| 29 | /* Align the stack and keep aligned for call to bootblock_c_entry() */ |
| 30 | and $0xfffffff0, %esp |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 31 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 32 | /* Restore the BIST result and timestamps. */ |
Patrick Rudolph | b1ef725 | 2019-09-28 17:44:01 +0200 | [diff] [blame] | 33 | #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 Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 42 | movd %mm0, %ebx |
| 43 | movd %mm1, %eax |
| 44 | movd %mm2, %edx |
| 45 | |
| 46 | pushl %ebx |
| 47 | pushl %edx |
| 48 | pushl %eax |
Patrick Rudolph | b1ef725 | 2019-09-28 17:44:01 +0200 | [diff] [blame] | 49 | #endif |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 50 | |
| 51 | before_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 |