aboutsummaryrefslogtreecommitdiff
path: root/src/soc/amd/picasso/monotonic_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/soc/amd/picasso/monotonic_timer.c')
-rw-r--r--src/soc/amd/picasso/monotonic_timer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/soc/amd/picasso/monotonic_timer.c b/src/soc/amd/picasso/monotonic_timer.c
new file mode 100644
index 0000000000..941532cca6
--- /dev/null
+++ b/src/soc/amd/picasso/monotonic_timer.c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <cpu/x86/msr.h>
+#include <cpu/x86/tsc.h>
+#include <timer.h>
+#include <timestamp.h>
+
+void timer_monotonic_get(struct mono_time *mt)
+{
+ mono_time_set_usecs(mt, timestamp_get());
+}
+
+uint64_t timestamp_get(void)
+{
+ return rdtscll() / tsc_freq_mhz();
+}