summaryrefslogtreecommitdiff
path: root/arch/x86/machine
diff options
context:
space:
mode:
authorRemy Noel <mocramis@gmail.com>2018-04-30 20:26:33 +0200
committerRemy Noel <mocramis@gmail.com>2018-04-30 20:26:33 +0200
commit8bf7a4afd769a2cb1d6edfdc89b954f79e697f18 (patch)
tree983acea19b28c9627bc1859bcff60f8673a49cb2 /arch/x86/machine
parenta441643cb427b8600bfb5ae3313522765a6f6521 (diff)
cpu: add cpu_freq accessor.
Diffstat (limited to 'arch/x86/machine')
-rw-r--r--arch/x86/machine/cpu.c6
-rw-r--r--arch/x86/machine/cpu.h5
2 files changed, 11 insertions, 0 deletions
diff --git a/arch/x86/machine/cpu.c b/arch/x86/machine/cpu.c
index b60bea9..6cbe168 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 334a51c..2464117 100644
--- a/arch/x86/machine/cpu.h
+++ b/arch/x86/machine/cpu.h
@@ -646,6 +646,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);