[coreboot-gerrit] Patch set updated for coreboot: x86/cpu/tsc: Allow use of monotonic_timer_get in early boot stages
Andrey Petrov (andrey.petrov@intel.com)
gerrit at coreboot.org
Sat Apr 9 00:33:26 CEST 2016
Andrey Petrov (andrey.petrov at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14297
-gerrit
commit 162b97c67b4af6767ddd3df342c9efb49558d0cf
Author: Andrey Petrov <andrey.petrov at intel.com>
Date: Fri Apr 8 14:29:54 2016 -0700
x86/cpu/tsc: Allow use of monotonic_timer_get in early boot stages
This change allows using of monotonic_timer_get() in pre-ram stages
by storing variables in CAR memory.
Change-Id: I2253960fd7f5da1f6b06af289911c08441b6c74c
Signed-off-by: Andrey Petrov <andrey.petrov at intel.com>
---
src/cpu/x86/tsc/delay_tsc.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/cpu/x86/tsc/delay_tsc.c b/src/cpu/x86/tsc/delay_tsc.c
index 0ad5d3b..f654ac0 100644
--- a/src/cpu/x86/tsc/delay_tsc.c
+++ b/src/cpu/x86/tsc/delay_tsc.c
@@ -1,3 +1,4 @@
+#include <arch/early_variables.h>
#include <console/console.h>
#include <arch/io.h>
#include <cpu/x86/msr.h>
@@ -6,9 +7,10 @@
#include <delay.h>
#include <thread.h>
-#if !defined(__PRE_RAM__)
+#if !defined(__ROMCC__)
+static unsigned long clocks_per_usec CAR_GLOBAL;
-static unsigned long clocks_per_usec;
+#if !defined(__PRE_RAM__)
#if CONFIG_TSC_CONSTANT_RATE
static unsigned long calibrate_tsc(void)
@@ -188,9 +190,6 @@ void udelay(unsigned us)
}
}
-#if CONFIG_TSC_MONOTONIC_TIMER && !defined(__PRE_RAM__)
-#include <timer.h>
-
static struct monotonic_counter {
int initialized;
struct mono_time time;
@@ -202,6 +201,9 @@ void timer_monotonic_get(struct mono_time *mt)
uint64_t current_tick;
uint64_t ticks_elapsed;
+ if (!IS_ENABLED(CONFIG_TSC_MONOTONIC_TIMER))
+ return;
+
if (!mono_counter.initialized) {
init_timer();
mono_counter.last_value = rdtscll();
@@ -223,4 +225,4 @@ void timer_monotonic_get(struct mono_time *mt)
/* Save result. */
*mt = mono_counter.time;
}
-#endif
+#endif /* !defined(__ROMCC__) */
More information about the coreboot-gerrit
mailing list