Skip to content
Snippets Groups Projects
Commit 258b1357 authored by Bin Meng's avatar Bin Meng Committed by Simon Glass
Browse files

x86: Save TSC frequency in the global data


Return the saved TSC frequency in get_tbclk_mhz().

Signed-off-by: default avatarBin Meng <bmeng.cn@gmail.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarSimon Glass <sjg@chromium.org>
parent 80de0495
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ struct arch_global_data {
uint64_t tsc_base; /* Initial value returned by rdtsc() */
uint32_t tsc_base_kclocks; /* Initial tsc as a kclocks value */
uint32_t tsc_prev; /* For show_boot_progress() */
uint32_t tsc_mhz; /* TSC frequency in MHz */
void *new_fdt; /* Relocated FDT */
uint32_t bist; /* Built-in self test value */
};
......
......@@ -293,6 +293,9 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
{
unsigned long fast_calibrate;
if (gd->arch.tsc_mhz)
return gd->arch.tsc_mhz;
fast_calibrate = try_msr_calibrate_tsc();
if (fast_calibrate)
return fast_calibrate;
......@@ -301,6 +304,7 @@ unsigned __attribute__((no_instrument_function)) long get_tbclk_mhz(void)
if (!fast_calibrate)
panic("TSC frequency is ZERO");
gd->arch.tsc_mhz = fast_calibrate;
return fast_calibrate;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment