[coreboot-gerrit] New patch to review for coreboot: include/timer.h: Guard stopwatch functions by CONFIG_MONOTONIC_TIMER
Paul Menzel (paulepanter@users.sourceforge.net)
gerrit at coreboot.org
Tue Oct 20 22:29:35 CEST 2015
Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12105
-gerrit
commit 5c58df8ec7f9c4dd9d9c4378a9d16d7c5c1c5549
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date: Tue Oct 20 22:27:05 2015 +0200
include/timer.h: Guard stopwatch functions by CONFIG_MONOTONIC_TIMER
Fix up the functions to not do anything, when CONFIG_MONOTONIC_TIMER is
not enabled.
```
[…]
CC cbfs/fallback/ramstage.debug
/dev/cb-build/coreboot-gerrit/amd_rumba/generated/ramstage.o: In function `stopwatch_init':
/home/coreboot/slave-root/workspace/coreboot-gerrit/src/include/timer.h:133: undefined reference to `timer_monotonic_get'
/dev/cb-build/coreboot-gerrit/amd_rumba/generated/ramstage.o: In function `stopwatch_tick':
/home/coreboot/slave-root/workspace/coreboot-gerrit/src/include/timer.h:153: undefined reference to `timer_monotonic_get'
src/arch/x86/Makefile.inc:318: recipe for target '/dev/cb-build/coreboot-gerrit/amd_rumba/cbfs/fallback/ramstage.debug' failed
make[1]: *** [/dev/cb-build/coreboot-gerrit/amd_rumba/cbfs/fallback/ramstage.debug] Error 1
make[1]: Leaving directory '/home/coreboot/slave-root/workspace/coreboot-gerrit'
```
Change-Id: If9cba4c0c17a7011aa357079d8fdd0aa47ad1b66
Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
src/include/timer.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/include/timer.h b/src/include/timer.h
index aa5746d..ebc303c 100644
--- a/src/include/timer.h
+++ b/src/include/timer.h
@@ -130,19 +130,25 @@ struct stopwatch {
static inline void stopwatch_init(struct stopwatch *sw)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
timer_monotonic_get(&sw->start);
sw->current = sw->expires = sw->start;
+#endif
}
static inline void stopwatch_init_usecs_expire(struct stopwatch *sw, long us)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
stopwatch_init(sw);
mono_time_add_usecs(&sw->expires, us);
+#endif
}
static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
stopwatch_init_usecs_expire(sw, USECS_PER_MSEC * ms);
+#endif
}
/*
@@ -150,7 +156,9 @@ static inline void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
*/
static inline void stopwatch_tick(struct stopwatch *sw)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
timer_monotonic_get(&sw->current);
+#endif
}
/*
@@ -158,8 +166,12 @@ static inline void stopwatch_tick(struct stopwatch *sw)
*/
static inline int stopwatch_expired(struct stopwatch *sw)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
stopwatch_tick(sw);
return !mono_time_before(&sw->current, &sw->expires);
+#else
+ return 0;
+#endif
}
/*
@@ -167,6 +179,7 @@ static inline int stopwatch_expired(struct stopwatch *sw)
*/
static inline long stopwatch_duration_usecs(struct stopwatch *sw)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
/*
* If the stopwatch hasn't been ticked (current == start) tick
* the stopwatch to gather the accumulated time.
@@ -175,11 +188,18 @@ static inline long stopwatch_duration_usecs(struct stopwatch *sw)
stopwatch_tick(sw);
return mono_time_diff_microseconds(&sw->start, &sw->current);
+#else
+ return 0;
+#endif
}
static inline long stopwatch_duration_msecs(struct stopwatch *sw)
{
+#if IS_ENABLED(CONFIG_HAVE_MONOTONIC_TIMER)
return stopwatch_duration_usecs(sw) / USECS_PER_MSEC;
+#else
+ return 0;
+#endif
}
#endif /* TIMER_H */
More information about the coreboot-gerrit
mailing list