mb/google/nissa: Create pujjogatwin variant
[coreboot2.git] / src / soc / amd / stoneyridge / monotonic_timer.c
blobbd1e4e7aac9f1b6a7bfa5e35ce8563a86ee6ad32
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <cpu/x86/msr.h>
4 #include <timer.h>
5 #include <timestamp.h>
7 #define CU_PTSC_MSR 0xc0010280
8 #define PTSC_FREQ_MHZ 100
10 void timer_monotonic_get(struct mono_time *mt)
12 mono_time_set_usecs(mt, timestamp_get());
15 /* The TSC has a non-constant rate before the microcode update is applied, so it can't be used
16 in timestamp_get before that. Instead, the Performance Time Stamp Counter is used. */
17 uint64_t timestamp_get(void)
19 msr_t msr;
21 msr = rdmsr(CU_PTSC_MSR);
23 return msr.raw / PTSC_FREQ_MHZ;