summaryrefslogtreecommitdiff
path: root/src/lib/timestamp.c
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2013-09-07 20:26:36 +0300
committerKyösti Mälkki <kyosti.malkki@gmail.com>2013-09-21 06:20:44 +0200
commit3d45c4077665a17735c69576638dc510f96a2dff (patch)
treeb245303e94318cab2633e7e4785e84b73cfc3b50 /src/lib/timestamp.c
parentb766b1c76aa2258bf66569f429fb092c23813bbc (diff)
downloadcoreboot-3d45c4077665a17735c69576638dc510f96a2dff.tar.xz
timestamps: Stash early timestamps in CAR_GLOBAL
Change-Id: I87b454c748cf885491d5b38bfe53a2ec0e9f38c5 Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/3910 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-by: Aaron Durbin <adurbin@google.com>
Diffstat (limited to 'src/lib/timestamp.c')
-rw-r--r--src/lib/timestamp.c21
1 files changed, 13 insertions, 8 deletions
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();
+}