timestamp: provide weak default implementation of timestamp_get
Change-Id: I2e7f17a686f6af3426c9d68cd9394e9a88dbf358
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/10104
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 9a0e631..0c9c884 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -174,3 +174,14 @@
/* Call timestamp_reinit at CAR migration time. */
CAR_MIGRATE(timestamp_reinit)
+
+/* Provide default timestamp implementation using monotonic timer. */
+uint64_t __attribute__((weak)) timestamp_get(void)
+{
+ struct mono_time t1, t2;
+
+ mono_time_set_usecs(&t1, 0);
+ timer_monotonic_get(&t2);
+
+ return mono_time_diff_microseconds(&t1, &t2);
+}