mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-15 10:17:20 +00:00
Replace spl protection in rtcin() and writertc() with spinlocks
using the existing clock_lock mutex.
This commit is contained in:
parent
55ec9ed408
commit
93fa9a8d72
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144965
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user