remove the MD API.
ok deraadt@
-/* $OpenBSD: apm.c,v 1.117 2017/08/17 19:44:27 tedu Exp $ */
+/* $OpenBSD: apm.c,v 1.118 2018/07/30 14:19:12 kettenis Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
bufq_quiesce();
s = splhigh();
- disable_intr();
+ intr_disable();
cold = 2;
config_suspend_all(DVACT_SUSPEND);
suspend_randomness();
config_suspend_all(DVACT_RESUME);
cold = 0;
- enable_intr();
+ intr_enable();
splx(s);
resume_randomness(NULL, 0); /* force RNG upper level reseed */
-/* $OpenBSD: cpu.c,v 1.93 2018/06/22 13:21:14 bluhm Exp $ */
+/* $OpenBSD: cpu.c,v 1.94 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */
/*-
s = splhigh(); /* XXX prevent softints from running here.. */
lapic_tpr = 0;
- enable_intr();
+ intr_enable();
if (mp_verbose)
printf("%s: CPU at apid %ld running\n",
ci->ci_dev->dv_xname, ci->ci_cpuid);
-/* $OpenBSD: hibernate_machdep.c,v 1.54 2018/07/04 02:05:06 mlarkin Exp $ */
+/* $OpenBSD: hibernate_machdep.c,v 1.55 2018/07/30 14:19:12 kettenis Exp $ */
/*
* Copyright (c) 2011 Mike Larkin <mlarkin@openbsd.org>
void
hibernate_enable_intr_machdep(void)
{
- enable_intr();
+ intr_enable();
}
void
hibernate_disable_intr_machdep(void)
{
- disable_intr();
+ intr_disable();
}
#ifdef MULTIPROCESSOR
-/* $OpenBSD: i686_mem.c,v 1.18 2016/04/26 15:27:32 mlarkin Exp $ */
+/* $OpenBSD: i686_mem.c,v 1.19 2018/07/30 14:19:12 kettenis Exp $ */
/*
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* All rights reserved.
void
mrstore(struct mem_range_softc *sc)
{
- disable_intr(); /* disable interrupts */
+ u_long s;
+
+ s = intr_disable(); /* disable interrupts */
#ifdef MULTIPROCESSOR
i386_broadcast_ipi(I386_IPI_MTRR);
#endif
mrstoreone(sc);
- enable_intr();
+ intr_restore(s);
}
/*
void
mrreload_cpu(struct mem_range_softc *sc)
{
- disable_intr();
+ u_long s;
+
+ s = intr_disable();
mrstoreone(sc); /* set MTRRs to match BSP */
- enable_intr();
+ intr_restore(s);
}
-/* $OpenBSD: ipifuncs.c,v 1.30 2017/12/04 21:12:41 mpi Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.31 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1.2.3 2000/06/26 02:04:06 sommerfeld Exp $ */
/*-
KASSERT(!_kernel_lock_held());
npxsave_cpu(ci, 1);
- disable_intr();
+ intr_disable();
lapic_disable();
wbinvd();
ci->ci_flags &= ~CPUF_RUNNING;
-/* $OpenBSD: k6_mem.c,v 1.12 2015/09/08 04:28:34 semarie Exp $ */
+/* $OpenBSD: k6_mem.c,v 1.13 2018/07/30 14:19:12 kettenis Exp $ */
/*-
* Copyright (c) 1999 Brian Fundakowski Feldman
* All rights reserved.
u_int64_t reg;
u_int32_t mtrr;
int error, d;
+ u_long s;
switch (*arg) {
case MEMRANGE_SET_UPDATE:
out:
- disable_intr();
+ s = intr_disable();
wbinvd();
reg = rdmsr(UWCCR);
reg &= ~(0xffffffff << (32 * d));
reg |= mtrr << (32 * d);
wrmsr(UWCCR, reg);
wbinvd();
- enable_intr();
+ intr_restore(s);
return 0;
}
u_int64_t reg;
u_int32_t mtrr;
int d;
+ u_long s;
for (d = 0; d < sc->mr_ndesc; d++) {
k6_mrmake(&sc->mr_desc[d], &mtrr);
- disable_intr();
+ s = intr_disable();
wbinvd();
reg = rdmsr(UWCCR);
reg &= ~(0xffffffff << (32 * d));
reg |= mtrr << (32 * d);
wrmsr(UWCCR, reg);
wbinvd();
- enable_intr();
+ intr_restore(s);
}
}
-/* $OpenBSD: lapic.c,v 1.46 2018/04/20 07:27:54 mlarkin Exp $ */
+/* $OpenBSD: lapic.c,v 1.47 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: lapic.c,v 1.1.2.8 2000/02/23 06:10:50 sommerfeld Exp $ */
/*-
void
lapic_map(paddr_t lapic_base)
{
- int s;
vaddr_t va = (vaddr_t)&local_apic;
+ u_long s;
+ int tpr;
- disable_intr();
- s = lapic_tpr;
+ s = intr_disable();
+ tpr = lapic_tpr;
/*
* Map local apic. If we have a local apic, it's safe to assume
cpu_init_first();
#endif
- lapic_tpr = s;
- enable_intr();
+ lapic_tpr = tpr;
+ intr_restore(s);
}
/*
{
unsigned int startapic, endapic;
u_int64_t dtick, dapic, tmp;
- int i, ef = read_eflags();
+ u_long s;
+ int i;
if (mp_verbose)
printf("%s: calibrating local timer\n", ci->ci_dev->dv_xname);
i82489_writereg(LAPIC_DCR_TIMER, LAPIC_DCRT_DIV1);
i82489_writereg(LAPIC_ICR_TIMER, 0x80000000);
- disable_intr();
+ s = intr_disable();
/* wait for current cycle to finish */
wait_next_cycle();
wait_next_cycle();
endapic = lapic_gettick();
- write_eflags(ef);
+
+ intr_restore(s);
dtick = hz * TIMER_DIV(hz);
dapic = startapic-endapic;
-/* $OpenBSD: longrun.c,v 1.16 2014/09/14 14:17:23 jsg Exp $ */
+/* $OpenBSD: longrun.c,v 1.17 2018/07/30 14:19:12 kettenis Exp $ */
/*
* Copyright (c) 2003 Ted Unangst
* Copyright (c) 2001 Tamotsu Hattori
void
longrun_update(void *arg)
{
- uint32_t eflags, regs[4];
+ uint32_t regs[4];
+ u_long s;
- eflags = read_eflags();
- disable_intr();
+ s = intr_disable();
cpuid(0x80860007, regs);
- enable_intr();
- write_eflags(eflags);
+ intr_restore(s);
cpuspeed = regs[0];
void
longrun_setperf(int high)
{
- uint32_t eflags, mode;
union msrinfo msrinfo;
+ uint32_t mode;
+ u_long s;
if (high >= 50)
mode = 1; /* power */
else
mode = 0; /* battery */
- eflags = read_eflags();
- disable_intr();
+ s = intr_disable();
msrinfo.msr = rdmsr(MSR_TMx86_LONGRUN);
msrinfo.regs[0] = LONGRUN_MODE_WRITE(msrinfo.regs[0], 0); /* low */
msrinfo.regs[0] = (msrinfo.regs[0] & ~0x01) | mode;
wrmsr(MSR_TMx86_LONGRUN_FLAGS, msrinfo.msr);
- enable_intr();
- write_eflags(eflags);
+ intr_restore(s);
longrun_update(NULL);
}
-/* $OpenBSD: machdep.c,v 1.621 2018/07/24 17:31:23 brynet Exp $ */
+/* $OpenBSD: machdep.c,v 1.622 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */
/*-
{
struct region_descriptor region;
- disable_intr();
+ intr_disable();
if (cpuresetfn)
(*cpuresetfn)();
-/* $OpenBSD: powernow-k7.c,v 1.42 2018/07/04 02:06:15 mlarkin Exp $ */
+/* $OpenBSD: powernow-k7.c,v 1.43 2018/07/30 14:19:12 kettenis Exp $ */
/*
* Copyright (c) 2004 Martin VĂ©giard.
int cvid, cfid, vid = 0, fid = 0;
uint64_t status, ctl;
struct k7pnow_cpu_state * cstate;
+ u_long s;
cstate = k7pnow_current_state;
ctl |= PN7_CTR_SGTC(cstate->sgtc);
if (cstate->flags & PN7_FLAG_ERRATA_A0)
- disable_intr();
+ s = intr_disable();
if (k7pnow_fid_to_mult[fid] < k7pnow_fid_to_mult[cfid]) {
wrmsr(MSR_AMDK7_FIDVID_CTL, ctl | PN7_CTR_FIDC);
}
if (cstate->flags & PN7_FLAG_ERRATA_A0)
- enable_intr();
+ intr_restore(s);
status = rdmsr(MSR_AMDK7_FIDVID_STATUS);
cfid = PN7_STA_CFID(status);
-/* $OpenBSD: cpufunc.h,v 1.29 2018/06/30 10:16:35 kettenis Exp $ */
+/* $OpenBSD: cpufunc.h,v 1.30 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: cpufunc.h,v 1.8 1994/10/27 04:15:59 cgd Exp $ */
/*
static __inline void lcr4(u_int);
static __inline u_int rcr4(void);
static __inline void tlbflush(void);
-static __inline void disable_intr(void);
-static __inline void enable_intr(void);
static __inline u_int read_eflags(void);
static __inline void write_eflags(u_int);
static __inline void wbinvd(void);
/* XXXX ought to be in psl.h with spl() functions */
-static __inline void
-disable_intr(void)
-{
- __asm volatile("cli");
-}
-
-static __inline void
-enable_intr(void)
-{
- __asm volatile("sti");
-}
-
static __inline u_int
read_eflags(void)
{
static inline void
intr_enable(void)
{
- enable_intr();
+ __asm volatile("sti");
}
static inline u_long
u_long ef;
ef = read_eflags();
- disable_intr();
+ __asm volatile("cli");
return (ef);
}
-/* $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 $ */
/*-
int
gettick(void)
{
+ u_long s;
if (clock_broken_latch) {
int v1, v2, v3;
* CPUs don't do MP anyway.
*/
- disable_intr();
+ s = intr_disable();
v1 = inb(IO_TIMER1 + TIMER_CNTR0);
v1 |= inb(IO_TIMER1 + TIMER_CNTR0) << 8;
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);
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);
}
{
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);
}
i8254_lastcount = count;
count += i8254_offset;
- write_eflags(ef);
+
+ intr_restore(s);
return (count);
}
-/* $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 $ */
/*-
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;
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;
-/* $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
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;
* 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);
* 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);
}
-/* $OpenBSD: elan520.c,v 1.21 2014/12/10 12:27:56 mikeb Exp $ */
+/* $OpenBSD: elan520.c,v 1.22 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: elan520.c,v 1.4 2002/10/02 05:47:15 thorpej Exp $ */
/*-
void
elansc_setperf(int level)
{
- uint32_t eflags;
uint8_t cpuctl, speed;
+ u_long s;
level = (level > 50) ? 100 : 0;
if ((cpuctl & CPUCTL_CPU_CLK_SPD_MASK) == speed)
return;
- eflags = read_eflags();
- disable_intr();
+ s = intr_disable();
bus_space_write_1(elansc->sc_memt, elansc->sc_memh, MMCR_CPUCTL,
(cpuctl & ~CPUCTL_CPU_CLK_SPD_MASK) | speed);
- enable_intr();
- write_eflags(eflags);
+ intr_restore(s);
elansc_update_cpuspeed();
}
-/* $OpenBSD: gus.c,v 1.46 2017/05/04 15:19:01 bluhm Exp $ */
+/* $OpenBSD: gus.c,v 1.47 2018/07/30 14:19:12 kettenis Exp $ */
/* $NetBSD: gus.c,v 1.51 1998/01/25 23:48:06 mycroft Exp $ */
/*-
int i;
bus_space_tag_t iot;
unsigned char c,d,m;
+ u_long s;
iot = sc->sc_iot;
* The order of these operations is very magical.
*/
- disable_intr(); /* XXX needed? */
+ s = intr_disable(); /* XXX needed? */
bus_space_write_1(iot, sc->sc_ioh1, GUS_REG_CONTROL, GUS_REG_IRQCTL);
bus_space_write_1(iot, sc->sc_ioh1, GUS_MIX_CONTROL, m);
(m | GUSMASK_LATCHES) & ~(GUSMASK_LINE_OUT|GUSMASK_LINE_IN));
bus_space_write_1(iot, sc->sc_ioh2, GUS_VOICE_SELECT, 0x00);
- enable_intr();
+ intr_restore(s);
sc->sc_mixcontrol =
(m | GUSMASK_LATCHES) & ~(GUSMASK_LINE_OUT|GUSMASK_LINE_IN);