Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/x86/isa/clock.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/x86/isa/clock.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.8 retrieving revision 1.8.10.1 diff -u -p -r1.8 -r1.8.10.1 --- src/sys/arch/x86/isa/clock.c 2006/12/08 15:05:18 1.8 +++ src/sys/arch/x86/isa/clock.c 2007/07/11 20:03:16 1.8.10.1 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.8 2006/12/08 15:05:18 yamt Exp $ */ +/* $NetBSD: clock.c,v 1.8.10.1 2007/07/11 20:03:16 mjf Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -121,7 +121,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFT */ #include -__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.8 2006/12/08 15:05:18 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.8.10.1 2007/07/11 20:03:16 mjf Exp $"); /* #define CLOCKDEBUG */ /* #define CLOCK_PARANOIA */ @@ -135,6 +135,7 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1. #include #include #include +#include #include #include @@ -207,7 +208,8 @@ static volatile uint32_t i8254_lastcount static volatile uint32_t i8254_offset; static volatile int i8254_ticked; -static struct simplelock tmr_lock = SIMPLELOCK_INITIALIZER; /* protect TC timer variables */ +/* to protect TC timer variables */ +static __cpu_simple_lock_t tmr_lock = __SIMPLELOCK_UNLOCKED; inline u_int mc146818_read(void *, u_int); inline void mc146818_write(void *, u_int, u_int); @@ -334,6 +336,7 @@ void initrtclock(u_long freq) { u_long tval; + /* * Compute timer_count, the count-down count the timer will be * set to. Also, correctly round @@ -377,7 +380,9 @@ startrtclock(void) rtc_register(); } - +/* + * Must be called at splclock(). + */ static void tickle_tc(void) { @@ -391,14 +396,14 @@ tickle_tc(void) return; #endif if (rtclock_tval && timecounter->tc_get_timecount == i8254_get_timecount) { - simple_lock(&tmr_lock); + __cpu_simple_lock(&tmr_lock); if (i8254_ticked) i8254_ticked = 0; else { i8254_offset += rtclock_tval; i8254_lastcount = 0; } - simple_unlock(&tmr_lock); + __cpu_simple_unlock(&tmr_lock); } } @@ -429,8 +434,7 @@ i8254_get_timecount(struct timecounter * /* Don't want someone screwing with the counter while we're here. */ flags = READ_FLAGS(); disable_intr(); - - simple_lock(&tmr_lock); + __cpu_simple_lock(&tmr_lock); /* Select timer0 and latch counter value. */ outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -447,9 +451,9 @@ i8254_get_timecount(struct timecounter * i8254_lastcount = count; count += i8254_offset; - simple_unlock(&tmr_lock); - + __cpu_simple_unlock(&tmr_lock); WRITE_FLAGS(flags); + return (count); }