summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/hardwaremain.c2
-rw-r--r--src/lib/timestamp.c25
2 files changed, 11 insertions, 16 deletions
diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index be052b3587..e01247b58d 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -452,7 +452,7 @@ static void boot_state_schedule_static_entries(void)
void main(void)
{
/* Record current time, try to locate timestamps in CBMEM. */
- timestamp_init(rdtsc());
+ timestamp_init(timestamp_get());
timestamp_add_now(TS_START_RAMSTAGE);
post_code(POST_ENTRY_RAMSTAGE);
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index f0ee48df72..67635f87ed 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -28,16 +28,11 @@
#define MAX_TIMESTAMPS 30
static struct timestamp_table* ts_table_p CAR_GLOBAL = NULL;
-static tsc_t ts_basetime CAR_GLOBAL = { .lo = 0, .hi =0 };
+static uint64_t ts_basetime CAR_GLOBAL = 0;
-static void timestamp_stash(enum timestamp_id id, tsc_t ts_time);
+static void timestamp_stash(enum timestamp_id id, uint64_t ts_time);
-static uint64_t tsc_to_uint64(tsc_t tstamp)
-{
- return (((uint64_t)tstamp.hi) << 32) + tstamp.lo;
-}
-
-static void timestamp_real_init(tsc_t base)
+static void timestamp_real_init(uint64_t base)
{
struct timestamp_table* tst;
@@ -50,14 +45,14 @@ static void timestamp_real_init(tsc_t base)
return;
}
- tst->base_time = tsc_to_uint64(base);
+ tst->base_time = base;
tst->max_entries = MAX_TIMESTAMPS;
tst->num_entries = 0;
car_set_var(ts_table_p, tst);
}
-void timestamp_add(enum timestamp_id id, tsc_t ts_time)
+void timestamp_add(enum timestamp_id id, uint64_t ts_time)
{
struct timestamp_entry *tse;
struct timestamp_table *ts_table = NULL;
@@ -75,18 +70,18 @@ void timestamp_add(enum timestamp_id id, tsc_t ts_time)
tse = &ts_table->entries[ts_table->num_entries++];
tse->entry_id = id;
- tse->entry_stamp = tsc_to_uint64(ts_time) - ts_table->base_time;
+ tse->entry_stamp = ts_time - ts_table->base_time;
}
void timestamp_add_now(enum timestamp_id id)
{
- timestamp_add(id, rdtsc());
+ timestamp_add(id, timestamp_get());
}
#define MAX_TIMESTAMP_CACHE 8
struct timestamp_cache {
enum timestamp_id id;
- tsc_t time;
+ uint64_t time;
} timestamp_cache[MAX_TIMESTAMP_CACHE] CAR_GLOBAL;
static int timestamp_entries CAR_GLOBAL = 0;
@@ -99,7 +94,7 @@ static int timestamp_entries CAR_GLOBAL = 0;
* part of CAR migration for romstage, and in ramstage main().
*/
-static void timestamp_stash(enum timestamp_id id, tsc_t ts_time)
+static void timestamp_stash(enum timestamp_id id, uint64_t ts_time)
{
struct timestamp_cache *ts_cache = car_get_var(timestamp_cache);
int ts_entries = car_get_var(timestamp_entries);
@@ -124,7 +119,7 @@ static void timestamp_do_sync(void)
car_set_var(timestamp_entries, 0);
}
-void timestamp_init(tsc_t base)
+void timestamp_init(uint64_t base)
{
if (!boot_cpu())
return;