Angel Pons | f23ae0b | 2020-04-02 23:48:12 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 2 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 3 | #include <cpu/x86/post_code.h> |
| 4 | |
| 5 | .global bootblock_pre_c_entry |
| 6 | bootblock_pre_c_entry: |
| 7 | |
| 8 | cache_as_ram: |
| 9 | post_code(0x20) |
| 10 | /* |
| 11 | * Nothing to do here on qemu, RAM works just fine without any |
| 12 | * initialization. |
| 13 | */ |
| 14 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 15 | /* 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] | 16 | movl $_car_region_start, %edi |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 17 | movl $_car_region_end, %ecx |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 18 | sub %edi, %ecx |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 19 | shr $2, %ecx |
| 20 | xorl %eax, %eax |
| 21 | rep stosl |
| 22 | |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 23 | post_code(0x21) |
| 24 | |
Arthur Heymans | df9cdcf | 2019-11-09 06:50:20 +0100 | [diff] [blame] | 25 | movl $_ecar_stack, %esp |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 26 | |
| 27 | /* Align the stack and keep aligned for call to bootblock_c_entry() */ |
| 28 | and $0xfffffff0, %esp |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 29 | |
Patrick Rudolph | dc2f0e3 | 2019-11-15 12:31:18 +0100 | [diff] [blame] | 30 | /* entry64.inc preserves ebx. */ |
| 31 | #include <cpu/x86/64bit/entry64.inc> |
| 32 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 33 | /* Restore the BIST result and timestamps. */ |
Patrick Rudolph | b1ef725 | 2019-09-28 17:44:01 +0200 | [diff] [blame] | 34 | #if defined(__x86_64__) |
Patrick Rudolph | 98c987a | 2020-07-02 08:08:37 +0200 | [diff] [blame] | 35 | movd %mm2, %rdi |
Patrick Rudolph | 7a04222 | 2020-09-29 13:32:06 +0200 | [diff] [blame] | 36 | shlq $32, %rdi |
Patrick Rudolph | b1ef725 | 2019-09-28 17:44:01 +0200 | [diff] [blame] | 37 | movd %mm1, %rsi |
| 38 | or %rsi, %rdi |
Patrick Rudolph | 98c987a | 2020-07-02 08:08:37 +0200 | [diff] [blame] | 39 | |
| 40 | movd %mm0, %rsi |
Patrick Rudolph | b1ef725 | 2019-09-28 17:44:01 +0200 | [diff] [blame] | 41 | #else |
| 42 | sub $4, %esp |
| 43 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 44 | movd %mm0, %ebx |
| 45 | movd %mm1, %eax |
| 46 | movd %mm2, %edx |
| 47 | |
| 48 | pushl %ebx |
| 49 | pushl %edx |
| 50 | pushl %eax |
Patrick Rudolph | b1ef725 | 2019-09-28 17:44:01 +0200 | [diff] [blame] | 51 | #endif |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 52 | |
| 53 | before_c_entry: |
| 54 | post_code(0x29) |
| 55 | call bootblock_c_entry_bist |
| 56 | /* Never returns */ |
| 57 | .Lhlt: |
| 58 | post_code(POST_DEAD_CODE) |
| 59 | hlt |
| 60 | jmp .Lhlt |