Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 4 | * 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 |
| 18 | bootblock_pre_c_entry: |
| 19 | |
| 20 | cache_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 Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 27 | /* 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] | 28 | movl $_car_region_start, %edi |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 29 | movl $_car_region_end, %ecx |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 30 | sub %edi, %ecx |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 31 | shr $2, %ecx |
| 32 | xorl %eax, %eax |
| 33 | rep stosl |
| 34 | |
Kyösti Mälkki | a7cac0a | 2019-08-18 08:30:30 +0300 | [diff] [blame] | 35 | post_code(0x21) |
| 36 | |
| 37 | movl $_car_stack_end, %esp |
| 38 | |
| 39 | /* Align the stack and keep aligned for call to bootblock_c_entry() */ |
| 40 | and $0xfffffff0, %esp |
| 41 | sub $4, %esp |
| 42 | |
Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame] | 43 | /* Restore the BIST result and timestamps. */ |
| 44 | movd %mm0, %ebx |
| 45 | movd %mm1, %eax |
| 46 | movd %mm2, %edx |
| 47 | |
| 48 | pushl %ebx |
| 49 | pushl %edx |
| 50 | pushl %eax |
| 51 | |
| 52 | before_c_entry: |
| 53 | post_code(0x29) |
| 54 | call bootblock_c_entry_bist |
| 55 | /* Never returns */ |
| 56 | .Lhlt: |
| 57 | post_code(POST_DEAD_CODE) |
| 58 | hlt |
| 59 | jmp .Lhlt |