aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2015-05-01 16:48:54 -0500
committerPatrick Georgi <pgeorgi@google.com>2015-05-05 17:49:30 +0200
commit9e80e27d3874b1eebe06ef90e9af16f0b07ec180 (patch)
tree4ae4725c878a07673e11b7880285b4d303055bfd
parentae1fcc3c1d95067e41dbffa6dacb27279ee7a07e (diff)
downloadcoreboot-9e80e27d3874b1eebe06ef90e9af16f0b07ec180.tar.gz
coreboot-9e80e27d3874b1eebe06ef90e9af16f0b07ec180.tar.xz
coreboot-9e80e27d3874b1eebe06ef90e9af16f0b07ec180.zip
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>
-rw-r--r--src/lib/timestamp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 9a0e631b0..0c9c88494 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -174,3 +174,14 @@ void timestamp_reinit(void)
/* 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);
+}