Angel Pons | 8a3453f | 2020-04-02 23:48:19 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 2 | |
| 3 | #include <bootblock_common.h> |
| 4 | #include <halt.h> |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 5 | #include <amdblocks/amd_pci_mmconf.h> |
| 6 | #include <amdblocks/biosram.h> |
Kyösti Mälkki | 520717d | 2019-12-15 21:37:48 +0200 | [diff] [blame] | 7 | #include <arch/bootblock.h> |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 8 | #include <cpu/amd/msr.h> |
| 9 | #include <cpu/x86/mtrr.h> |
Kyösti Mälkki | fedaac8 | 2019-12-15 21:37:38 +0200 | [diff] [blame] | 10 | #include <cpu/x86/lapic.h> |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 11 | |
| 12 | #define EARLY_VMTRR_FLASH 6 |
| 13 | |
| 14 | static void set_early_mtrrs(void) |
| 15 | { |
| 16 | /* Cache the ROM to speed up booting */ |
| 17 | set_var_mtrr(EARLY_VMTRR_FLASH, OPTIMAL_CACHE_ROM_BASE, |
| 18 | OPTIMAL_CACHE_ROM_SIZE, MTRR_TYPE_WRPROT); |
| 19 | } |
| 20 | |
Kyösti Mälkki | 520717d | 2019-12-15 21:37:48 +0200 | [diff] [blame] | 21 | void bootblock_soc_early_init(void) |
| 22 | { |
| 23 | bootblock_early_southbridge_init(); |
| 24 | } |
| 25 | |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 26 | asmlinkage void bootblock_c_entry(uint64_t base_timestamp) |
| 27 | { |
| 28 | enable_pci_mmconf(); |
| 29 | set_early_mtrrs(); |
| 30 | |
Kyösti Mälkki | fedaac8 | 2019-12-15 21:37:38 +0200 | [diff] [blame] | 31 | if (CONFIG(UDELAY_LAPIC)) |
| 32 | enable_lapic(); |
| 33 | |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 34 | bootblock_main_with_basetime(base_timestamp); |
| 35 | } |
| 36 | |
| 37 | asmlinkage void ap_bootblock_c_entry(void) |
| 38 | { |
| 39 | enable_pci_mmconf(); |
| 40 | set_early_mtrrs(); |
| 41 | |
Kyösti Mälkki | fedaac8 | 2019-12-15 21:37:38 +0200 | [diff] [blame] | 42 | if (CONFIG(UDELAY_LAPIC)) |
| 43 | enable_lapic(); |
| 44 | |
Michał Żygowski | 1b12b64 | 2019-11-24 16:32:05 +0100 | [diff] [blame] | 45 | void (*ap_romstage_entry)(void) = get_ap_entry_ptr(); |
| 46 | ap_romstage_entry(); /* execution does not return */ |
| 47 | halt(); |
| 48 | } |