aboutsummaryrefslogtreecommitdiff
path: root/sys/pc98/cbus
diff options
context:
space:
mode:
authorKATO Takenori <kato@FreeBSD.org>1999-12-27 13:56:54 +0000
committerKATO Takenori <kato@FreeBSD.org>1999-12-27 13:56:54 +0000
commitb8559e5e3f975d63a2497dbd41918f8b329cbb31 (patch)
treefaac32601d1e3f6754519bdf7bebbc204f0784fa /sys/pc98/cbus
parent18a1cdb3e6c5168a21c6e6fdab444fd6b0369560 (diff)
downloadsrc-b8559e5e3f975d63a2497dbd41918f8b329cbb31.tar.gz
src-b8559e5e3f975d63a2497dbd41918f8b329cbb31.zip
Synced with sys/i386/isa/clock.c rev 1.148. This is a cosmetic change
because PC-98 doesn't have RTC and RTC related code is included by `#ifndef PC98' and `#endif'.
Notes
Notes: svn path=/head/; revision=55150
Diffstat (limited to 'sys/pc98/cbus')
-rw-r--r--sys/pc98/cbus/clock.c20
-rw-r--r--sys/pc98/cbus/pcrtc.c20
2 files changed, 32 insertions, 8 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c
index 1c7e231dc8a4..9d5c88218c33 100644
--- a/sys/pc98/cbus/clock.c
+++ b/sys/pc98/cbus/clock.c
@@ -637,23 +637,30 @@ int
rtcin(reg)
int reg;
{
+ int s;
u_char val;
+ s = splhigh();
outb(IO_RTC, reg);
inb(0x84);
val = inb(IO_RTC + 1);
inb(0x84);
+ splx(s);
return (val);
}
static __inline void
writertc(u_char reg, u_char val)
{
+ int s;
+
+ s = splhigh();
inb(0x84);
outb(IO_RTC, reg);
inb(0x84);
outb(IO_RTC + 1, val);
inb(0x84); /* XXX work around wrong order in rtcin() */
+ splx(s);
}
static __inline int
@@ -1134,7 +1141,11 @@ inittodr(time_t base)
/* wait for time update to complete */
/* If RTCSA_TUP is zero, we have at least 244us before next update */
- while (rtcin(RTC_STATUSA) & RTCSA_TUP);
+ s = splhigh();
+ while (rtcin(RTC_STATUSA) & RTCSA_TUP) {
+ splx(s);
+ s = splhigh();
+ }
days = 0;
#ifdef USE_RTC_CENTURY
@@ -1144,8 +1155,10 @@ inittodr(time_t base)
if (year < 1970)
year += 100;
#endif
- if (year < 1970)
+ if (year < 1970) {
+ splx(s);
goto wrong_time;
+ }
month = readrtc(RTC_MONTH);
for (m = 1; m < month; m++)
days += daysinmonth[m-1];
@@ -1168,12 +1181,11 @@ inittodr(time_t base)
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
- s = splclock();
ts.tv_sec = sec;
ts.tv_nsec = 0;
set_timecounter(&ts);
- splx(s);
}
+ splx(s);
return;
wrong_time:
diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c
index 1c7e231dc8a4..9d5c88218c33 100644
--- a/sys/pc98/cbus/pcrtc.c
+++ b/sys/pc98/cbus/pcrtc.c
@@ -637,23 +637,30 @@ int
rtcin(reg)
int reg;
{
+ int s;
u_char val;
+ s = splhigh();
outb(IO_RTC, reg);
inb(0x84);
val = inb(IO_RTC + 1);
inb(0x84);
+ splx(s);
return (val);
}
static __inline void
writertc(u_char reg, u_char val)
{
+ int s;
+
+ s = splhigh();
inb(0x84);
outb(IO_RTC, reg);
inb(0x84);
outb(IO_RTC + 1, val);
inb(0x84); /* XXX work around wrong order in rtcin() */
+ splx(s);
}
static __inline int
@@ -1134,7 +1141,11 @@ inittodr(time_t base)
/* wait for time update to complete */
/* If RTCSA_TUP is zero, we have at least 244us before next update */
- while (rtcin(RTC_STATUSA) & RTCSA_TUP);
+ s = splhigh();
+ while (rtcin(RTC_STATUSA) & RTCSA_TUP) {
+ splx(s);
+ s = splhigh();
+ }
days = 0;
#ifdef USE_RTC_CENTURY
@@ -1144,8 +1155,10 @@ inittodr(time_t base)
if (year < 1970)
year += 100;
#endif
- if (year < 1970)
+ if (year < 1970) {
+ splx(s);
goto wrong_time;
+ }
month = readrtc(RTC_MONTH);
for (m = 1; m < month; m++)
days += daysinmonth[m-1];
@@ -1168,12 +1181,11 @@ inittodr(time_t base)
y = time_second - sec;
if (y <= -2 || y >= 2) {
/* badly off, adjust it */
- s = splclock();
ts.tv_sec = sec;
ts.tv_nsec = 0;
set_timecounter(&ts);
- splx(s);
}
+ splx(s);
return;
wrong_time: