Patrick Rudolph | 1af8923 | 2018-11-11 12:50:51 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2000,2007 Ronald G. Minnich <rminnich@gmail.com> |
| 5 | * Copyright (C) 2007-2008 coresystems GmbH |
| 6 | * Copyright (C) 2018 Patrick Rudolph <siro@das-labor.org> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; version 2 of the License. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | */ |
| 17 | |
| 18 | #include <cpu/x86/cache.h> |
| 19 | #include <cpu/x86/post_code.h> |
| 20 | |
| 21 | .global bootblock_pre_c_entry |
| 22 | bootblock_pre_c_entry: |
| 23 | |
| 24 | cache_as_ram: |
| 25 | post_code(0x20) |
| 26 | /* |
| 27 | * Nothing to do here on qemu, RAM works just fine without any |
| 28 | * initialization. |
| 29 | */ |
| 30 | |
| 31 | post_code(0x21) |
| 32 | |
| 33 | movl $_car_stack_end, %esp |
| 34 | /* Align the stack and keep aligned for call to bootblock_c_entry() */ |
| 35 | and $0xfffffff0, %esp |
| 36 | sub $12, %esp |
| 37 | |
| 38 | /* Clear the cache memory region. This will also clear CAR GLOBAL */ |
| 39 | movl $_car_region_start, %esi |
| 40 | movl %esi, %edi |
| 41 | movl $_car_region_end, %ecx |
| 42 | sub $_car_region_start, %ecx |
| 43 | shr $2, %ecx |
| 44 | xorl %eax, %eax |
| 45 | rep stosl |
| 46 | |
| 47 | /* Restore the BIST result and timestamps. */ |
| 48 | movd %mm0, %ebx |
| 49 | movd %mm1, %eax |
| 50 | movd %mm2, %edx |
| 51 | |
| 52 | pushl %ebx |
| 53 | pushl %edx |
| 54 | pushl %eax |
| 55 | |
| 56 | before_c_entry: |
| 57 | post_code(0x29) |
| 58 | call bootblock_c_entry_bist |
| 59 | /* Never returns */ |
| 60 | .Lhlt: |
| 61 | post_code(POST_DEAD_CODE) |
| 62 | hlt |
| 63 | jmp .Lhlt |