1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2019 Intel Corporation <www.intel.com>
10 #include <asm/arch/slimbootloader.h>
12 DECLARE_GLOBAL_DATA_PTR;
15 * This sets tsc_base and clock_rate for early_timer and tsc_timer.
16 * The performance info guid hob has all performance timestamp data, but
17 * the only tsc frequency info is used for the timer driver for now.
19 * Slim Bootloader already calibrated TSC and provides it to U-Boot.
20 * Therefore, U-Boot does not have to re-calibrate TSC.
21 * Configuring tsc_base and clock_rate here makes x86 tsc_timer driver
22 * bypass TSC calibration and use the provided TSC frequency.
24 static void tsc_init(void)
26 struct sbl_performance_info *data;
27 const efi_guid_t guid = SBL_PERFORMANCE_INFO_GUID;
29 if (!gd->arch.hob_list)
30 panic("hob list not found!");
32 gd->arch.tsc_base = rdtsc();
33 debug("tsc_base=0x%llx\n", gd->arch.tsc_base);
35 data = hob_get_guid_hob_data(gd->arch.hob_list, NULL, &guid);
37 debug("performance info hob not found\n");
41 /* frequency is in KHz, so to Hz */
42 gd->arch.clock_rate = data->frequency * 1000;
43 debug("freq=0x%lx\n", gd->arch.clock_rate);
46 int arch_cpu_init(void)
50 return x86_cpu_init_f();
58 int print_cpuinfo(void)
60 return default_print_cpuinfo();