diff options
author | Richard Braun <rbraun@sceen.net> | 2018-06-25 20:33:45 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-06-25 20:36:26 +0200 |
commit | 452852d887514c172a26981e4d1ab24785cf27c1 (patch) | |
tree | be70ba4592c08b6b55cd87b52dd4fe52f8f3d752 | |
parent | 5f961d20b2ff1a0b9b2f530678139b3c9ed6975c (diff) |
x86/cpu: new cpu_get_freq function
-rw-r--r-- | arch/x86/machine/cpu.c | 6 | ||||
-rw-r--r-- | arch/x86/machine/cpu.h | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c index b60bea95..6cbe168a 100644 --- a/arch/x86/machine/cpu.c +++ b/arch/x86/machine/cpu.c @@ -160,6 +160,12 @@ static alignas(8) struct cpu_gate_desc cpu_idt[CPU_IDT_SIZE] __read_mostly; static unsigned long cpu_double_fault_handler; static alignas(CPU_DATA_ALIGN) char cpu_double_fault_stack[TRAP_STACK_SIZE]; +uint64_t +cpu_get_freq(void) +{ + return cpu_freq; +} + void cpu_delay(unsigned long usecs) { diff --git a/arch/x86/machine/cpu.h b/arch/x86/machine/cpu.h index 7bc3a527..28308042 100644 --- a/arch/x86/machine/cpu.h +++ b/arch/x86/machine/cpu.h @@ -639,6 +639,11 @@ cpu_tlb_flush_va(unsigned long va) } /* + * Get CPU frequency in Hz. + */ +uint64_t cpu_get_freq(void); + +/* * Busy-wait for a given amount of time, in microseconds. */ void cpu_delay(unsigned long usecs); |