Felix Held | 3c44c62 | 2022-01-10 20:57:29 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | /* TODO: Check if this is still correct */ |
| 4 | |
| 5 | #include <amdblocks/amd_pci_mmconf.h> |
| 6 | #include <amdblocks/cpu.h> |
| 7 | #include <bootblock_common.h> |
| 8 | #include <console/console.h> |
| 9 | #include <cpu/x86/tsc.h> |
| 10 | #include <soc/southbridge.h> |
| 11 | #include <soc/psp_transfer.h> |
| 12 | #include <stdint.h> |
| 13 | |
| 14 | asmlinkage void bootblock_c_entry(uint64_t base_timestamp) |
| 15 | { |
| 16 | early_cache_setup(); |
| 17 | write_resume_eip(); |
| 18 | enable_pci_mmconf(); |
| 19 | |
| 20 | /* |
| 21 | * base_timestamp is raw tsc value. We need to divide by tsc_freq_mhz |
| 22 | * to get micro-seconds granularity. |
| 23 | */ |
| 24 | base_timestamp /= tsc_freq_mhz(); |
| 25 | |
| 26 | if (CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)) |
| 27 | boot_with_psp_timestamp(base_timestamp); |
| 28 | |
| 29 | /* |
| 30 | * if VBOOT_STARTS_BEFORE_BOOTBLOCK is not selected or |
| 31 | * previous step did nothing, proceed with normal bootblock main. |
| 32 | */ |
| 33 | bootblock_main_with_basetime(base_timestamp); |
| 34 | } |
| 35 | |
| 36 | void bootblock_soc_early_init(void) |
| 37 | { |
| 38 | fch_pre_init(); |
| 39 | } |
| 40 | |
| 41 | void bootblock_soc_init(void) |
| 42 | { |
| 43 | u32 val = cpuid_eax(1); |
| 44 | printk(BIOS_DEBUG, "Family_Model: %08x\n", val); |
| 45 | |
| 46 | if (CONFIG(VBOOT_STARTS_BEFORE_BOOTBLOCK)) { |
| 47 | verify_psp_transfer_buf(); |
| 48 | show_psp_transfer_info(); |
| 49 | } |
| 50 | |
| 51 | fch_early_init(); |
| 52 | } |