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