[coreboot-gerrit] Patch set updated for coreboot: 3c5427d timestamps: Fix some lost timestamps for romstage
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Mon Oct 14 17:17:58 CEST 2013
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3967
-gerrit
commit 3c5427d333f6ed75ef657198a16f217d11dd0129
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Sun Oct 13 13:27:56 2013 +0300
timestamps: Fix some lost timestamps for romstage
Timestamps from cbfs_and_run, TS_START_COPYRAM and TS_END_COPYRAM,
were lost with commit b766b1c7.
Reason is variable ts_table was referencing CAR storage after CAR
is torn doesn. Add use of car_get_var() / car_set_var() so the
references go to migrated storage in CBMEM.
Change-Id: I5a942ad7fd59a04e3a5255f4a3636d37dcfc1591
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/lib/timestamp.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 8942649..7cb9597 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -27,7 +27,7 @@
#define MAX_TIMESTAMPS 30
-static struct timestamp_table* ts_table CAR_GLOBAL = NULL;
+static struct timestamp_table* ts_table_p CAR_GLOBAL = NULL;
static tsc_t ts_basetime CAR_GLOBAL = { .lo = 0, .hi =0 };
static void timestamp_stash(enum timestamp_id id, tsc_t ts_time);
@@ -54,16 +54,18 @@ static void timestamp_real_init(tsc_t base)
tst->max_entries = MAX_TIMESTAMPS;
tst->num_entries = 0;
- ts_table = tst;
+ car_set_var(ts_table_p, tst);
}
void timestamp_add(enum timestamp_id id, tsc_t ts_time)
{
struct timestamp_entry *tse;
+ struct timestamp_table *ts_table = NULL;
if (!boot_cpu())
return;
+ ts_table = car_get_var(ts_table_p);
if (!ts_table) {
timestamp_stash(id, ts_time);
return;
@@ -90,11 +92,11 @@ struct timestamp_cache {
static int timestamp_entries CAR_GLOBAL = 0;
/**
- * timestamp_stash() allows to temporarily cache time stamps.
- * This is needed when time stamping before the CBMEM area
- * is initialized. The function timestamp_sync() is used to
- * write the time stamps to the CBMEM area. This is done in
- * ram stage main()
+ * timestamp_stash() allows to temporarily cache timestamps.
+ * This is needed when timestamping before the CBMEM area
+ * is initialized. The function timestamp_do_sync() is used to
+ * write the timestamps to the CBMEM area and this is done as
+ * part of CAR migration for romstage, and in ramstage main().
*/
static void timestamp_stash(enum timestamp_id id, tsc_t ts_time)
@@ -123,19 +125,19 @@ void timestamp_init(tsc_t base)
#ifdef __PRE_RAM__
/* Copy of basetime, it is too early for CBMEM. */
- ts_basetime = base;
+ car_set_var(ts_basetime, base);
#else
struct timestamp_table* tst;
/* Locate and use an already existing table. */
tst = cbmem_find(CBMEM_ID_TIMESTAMP);
if (tst) {
- ts_table = tst;
+ car_set_var(ts_table_p, tst);
return;
}
/* Copy of basetime, may be too early for CBMEM. */
- ts_basetime = base;
+ car_set_var(ts_basetime, base);
timestamp_real_init(base);
#endif
}
@@ -146,12 +148,12 @@ void timestamp_reinit(void)
return;
#ifdef __PRE_RAM__
- timestamp_real_init(ts_basetime);
+ timestamp_real_init(car_get_var(ts_basetime));
#else
- if (!ts_table)
- timestamp_init(ts_basetime);
+ if (!car_get_var(ts_table_p))
+ timestamp_init(car_get_var(ts_basetime));
#endif
- if (ts_table)
+ if (car_get_var(ts_table_p))
timestamp_do_sync();
}
More information about the coreboot-gerrit
mailing list