summaryrefslogtreecommitdiffstats
path: root/sys/isa/atrtc.c
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>2005-04-12 20:49:31 +0000
committermdodd <mdodd@FreeBSD.org>2005-04-12 20:49:31 +0000
commite6ee4c824fb4c975c27d54b64b39a4df13203c3b (patch)
tree4adff14f1f86c4ef9ca113533049aa24eaa66d3c /sys/isa/atrtc.c
parent1cb970696d62f3fa8fe7c8f8936a9ab57f3e1479 (diff)
downloadFreeBSD-src-e6ee4c824fb4c975c27d54b64b39a4df13203c3b.zip
FreeBSD-src-e6ee4c824fb4c975c27d54b64b39a4df13203c3b.tar.gz
Replace spl protection in rtcin() and writertc() with spinlocks
using the existing clock_lock mutex.
Diffstat (limited to 'sys/isa/atrtc.c')
-rw-r--r--sys/isa/atrtc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/isa/atrtc.c b/sys/isa/atrtc.c
index 3664483..eb8f282 100644
--- a/sys/isa/atrtc.c
+++ b/sys/isa/atrtc.c
@@ -111,6 +111,8 @@ u_int timer_freq = TIMER_FREQ;
int timer0_max_count;
int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */
struct mtx clock_lock;
+#define RTC_LOCK mtx_lock_spin(&clock_lock)
+#define RTC_UNLOCK mtx_unlock_spin(&clock_lock)
static int beeping = 0;
static const u_char daysinmonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
@@ -415,30 +417,28 @@ int
rtcin(reg)
int reg;
{
- int s;
u_char val;
- s = splhigh();
+ RTC_LOCK;
outb(IO_RTC, reg);
inb(0x84);
val = inb(IO_RTC + 1);
inb(0x84);
- splx(s);
+ RTC_UNLOCK;
return (val);
}
static __inline void
writertc(u_char reg, u_char val)
{
- int s;
- s = splhigh();
+ RTC_LOCK;
inb(0x84);
outb(IO_RTC, reg);
inb(0x84);
outb(IO_RTC + 1, val);
inb(0x84); /* XXX work around wrong order in rtcin() */
- splx(s);
+ RTC_UNLOCK;
}
static __inline int
OpenPOWER on IntegriCloud