diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-07-30 14:19:13 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2018-07-30 14:19:13 +0000 |
commit | 7554e005b3692fb542ea4b2255142b1b1826a890 (patch) | |
tree | 663d3af730db22a6fe5effe1fee700cef2cfe6a3 /sys/arch/i386/isa | |
parent | add29f63b41c61a471fa2084e9763724cf45bf23 (diff) |
Use the MI interrupt enable/distable API instead of the MD one on i386 and
remove the MD API.
ok deraadt@
Diffstat (limited to 'sys/arch/i386/isa')
-rw-r--r-- | sys/arch/i386/isa/clock.c | 21 | ||||
-rw-r--r-- | sys/arch/i386/isa/joy.c | 7 | ||||
-rw-r--r-- | sys/arch/i386/isa/npx.c | 13 |
3 files changed, 20 insertions, 21 deletions
diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index e4da81f5c94..0ce6949a438 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.52 2017/09/08 05:36:51 deraadt Exp $ */ +/* $OpenBSD: clock.c,v 1.53 2018/07/30 14:19:12 kettenis Exp $ */ /* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */ /*- @@ -244,6 +244,7 @@ rtcintr(void *arg) int gettick(void) { + u_long s; if (clock_broken_latch) { int v1, v2, v3; @@ -254,7 +255,7 @@ gettick(void) * CPUs don't do MP anyway. */ - disable_intr(); + s = intr_disable(); v1 = inb(IO_TIMER1 + TIMER_CNTR0); v1 |= inb(IO_TIMER1 + TIMER_CNTR0) << 8; @@ -263,7 +264,7 @@ gettick(void) v3 = inb(IO_TIMER1 + TIMER_CNTR0); v3 |= inb(IO_TIMER1 + TIMER_CNTR0) << 8; - enable_intr(); + intr_restore(s); if (v1 >= v2 && v2 >= v3 && v1 - v3 < 0x200) return (v2); @@ -298,17 +299,15 @@ gettick(void) return (v3); } else { u_char lo, hi; - u_long ef; mtx_enter(&timer_mutex); - ef = read_eflags(); - disable_intr(); + s = intr_disable(); /* Select counter 0 and latch it. */ outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); lo = inb(IO_TIMER1 + TIMER_CNTR0); hi = inb(IO_TIMER1 + TIMER_CNTR0); - write_eflags(ef); + intr_restore(s); mtx_leave(&timer_mutex); return ((hi << 8) | lo); } @@ -750,10 +749,9 @@ i8254_get_timecount(struct timecounter *tc) { u_char hi, lo; u_int count; - u_long ef; + u_long s; - ef = read_eflags(); - disable_intr(); + s = intr_disable(); outb(IO_TIMER1 + TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); lo = inb(IO_TIMER1 + TIMER_CNTR0); @@ -767,7 +765,8 @@ i8254_get_timecount(struct timecounter *tc) } i8254_lastcount = count; count += i8254_offset; - write_eflags(ef); + + intr_restore(s); return (count); } diff --git a/sys/arch/i386/isa/joy.c b/sys/arch/i386/isa/joy.c index c867eaf3899..204a5009d76 100644 --- a/sys/arch/i386/isa/joy.c +++ b/sys/arch/i386/isa/joy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: joy.c,v 1.15 2015/02/10 21:58:16 miod Exp $ */ +/* $OpenBSD: joy.c,v 1.16 2018/07/30 14:19:12 kettenis Exp $ */ /* $NetBSD: joy.c,v 1.3 1996/05/05 19:46:15 christos Exp $ */ /*- @@ -97,8 +97,9 @@ joyread(dev_t dev, struct uio *uio, int flag) int port = sc->port; int i, t0, t1; int state = 0, x = 0, y = 0; + u_long s; - disable_intr(); + s = intr_disable(); outb(port, 0xff); t0 = joy_get_tick(); t1 = t0; @@ -117,7 +118,7 @@ joyread(dev_t dev, struct uio *uio, int flag) if (x && y) break; } - enable_intr(); + intr_restore(s); c.x = x ? sc->x_off[JOYPART(dev)] + TICKS2USEC(t0 - x) : 0x80000000; c.y = y ? sc->y_off[JOYPART(dev)] + TICKS2USEC(t0 - y) : 0x80000000; state >>= 4; diff --git a/sys/arch/i386/isa/npx.c b/sys/arch/i386/isa/npx.c index cf4734ed2da..4e113b86b7d 100644 --- a/sys/arch/i386/isa/npx.c +++ b/sys/arch/i386/isa/npx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: npx.c,v 1.69 2018/04/11 15:44:08 bluhm Exp $ */ +/* $OpenBSD: npx.c,v 1.70 2018/07/30 14:19:12 kettenis Exp $ */ /* $NetBSD: npx.c,v 1.57 1996/05/12 23:12:24 mycroft Exp $ */ #if 0 @@ -275,7 +275,7 @@ npxprobe(struct device *parent, void *match, void *aux) struct isa_attach_args *ia = aux; int irq; int result; - u_long save_eflags; + u_long s; unsigned save_imen; struct gate_descriptor save_idt_npxintr; struct gate_descriptor save_idt_npxtrap; @@ -297,8 +297,7 @@ npxprobe(struct device *parent, void *match, void *aux) * won't need to do so much here. */ irq = NRSVIDT + ia->ia_irq; - save_eflags = read_eflags(); - disable_intr(); + s = intr_disable(); save_idt_npxintr = idt[irq]; save_idt_npxtrap = idt[16]; setgate(&idt[irq], probeintr, 0, SDT_SYS386IGT, SEL_KPL, GICODE_SEL); @@ -320,16 +319,16 @@ npxprobe(struct device *parent, void *match, void *aux) * We have to turn off the CR0_EM bit temporarily while probing. */ lcr0(rcr0() & ~(CR0_EM|CR0_TS)); - enable_intr(); + intr_restore(s); result = npxprobe1(ia); - disable_intr(); + s = intr_disable(); lcr0(rcr0() | (CR0_EM|CR0_TS)); imen = save_imen; SET_ICUS(); idt[irq] = save_idt_npxintr; idt[16] = save_idt_npxtrap; - write_eflags(save_eflags); + intr_restore(s); return (result); } |