Thread (15 messages) 15 messages, 5 authors, 2007-09-20

Re: [PATCH 2/5] Implement generic time of day clocksource for powerpc machines.

From: Daniel Walker <hidden>
Date: 2007-09-19 15:46:49
Also in: linux-rt-users

On Wed, 2007-09-19 at 16:49 +1000, Tony Breeds wrote:
+/* clocksource code */
+/* FIXME: provide an RTC clocksource /or/ use a better name */
+static cycle_t timebase_read(void)
+{
+       if (__USE_RTC())
+               return (cycle_t)get_rtc();
+       return (cycle_t)get_tb();
+}
If you switch to the rtc do the shift and mult need to change?
+void update_vsyscall(struct timespec *wall_time, struct clocksource
*clock)
+{
+       u64 t2x, stamp_xsec;
+
+       if (__USE_RTC() || clock != &clocksource_timebase)
+               return;
+
+       /* Make userspace gettimeofday spin until we're done. */
+       ++vdso_data->tb_update_count;
+       smp_mb();
+
+       /* XXX this assumes clock->shift == 22 */
+       /* 4611686018 ~= 2^(20+64-22) / 1e9 */
+       t2x = (u64) clock->mult * 4611686018ULL;
It might make the code more readable if you put that constant into a
macro that gives it a name.

Daniel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help