From 3d45c4077665a17735c69576638dc510f96a2dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sat, 7 Sep 2013 20:26:36 +0300 Subject: timestamps: Stash early timestamps in CAR_GLOBAL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I87b454c748cf885491d5b38bfe53a2ec0e9f38c5 Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/3910 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi Reviewed-by: Aaron Durbin --- src/lib/timestamp.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/lib/timestamp.c') diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c index 7e2f7011e6..eac33a2aff 100644 --- a/src/lib/timestamp.c +++ b/src/lib/timestamp.c @@ -114,7 +114,10 @@ static void timestamp_do_sync(void) void timestamp_init(tsc_t base) { -#ifndef __PRE_RAM__ +#ifdef __PRE_RAM__ + /* Copy of basetime, it is too early for CBMEM. */ + ts_basetime = base; +#else struct timestamp_table* tst; /* Locate and use an already existing table. */ @@ -123,19 +126,21 @@ void timestamp_init(tsc_t base) ts_table = tst; return; } -#endif + /* Copy of basetime, may be too early for CBMEM. */ + ts_basetime = base; timestamp_real_init(base); - if (ts_table) - timestamp_do_sync(); - else - ts_basetime = base; +#endif } -#ifndef __PRE_RAM__ void timestamp_sync(void) { +#ifdef __PRE_RAM__ + timestamp_real_init(ts_basetime); +#else if (!ts_table) timestamp_init(ts_basetime); -} #endif + if (ts_table) + timestamp_do_sync(); +} -- cgit v1.2.3