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