sndio: rename unix socket name

2018-07-27 Thread Alexandre Ratchov
5+ years since aucat was renamed to sndiod; IMHO, we should have
renamed the socket to remove reference to aucat. This avoids wondering
what are these "aucat" files in /tmp.

The socket is only used for IPC between libsndio and sndiod; so you
only need to rebuild and reinstall libsndio and sndiod.

Thoughts? OK?

Index: amsg.h
===
RCS file: /cvs/src/lib/libsndio/amsg.h,v
retrieving revision 1.10
diff -u -p -r1.10 amsg.h
--- amsg.h  9 Jan 2016 08:27:24 -   1.10
+++ amsg.h  27 Jul 2018 06:42:24 -
@@ -24,11 +24,11 @@
  *
  * DIR [ '-' UID ] '/' FILE UNIT
  *
- * example: "/tmp/aucat-1000/aucat0"
+ * example: "/tmp/sndio-1000/sock0"
  *
  */
-#define SOCKPATH_DIR   "/tmp/aucat"
-#define SOCKPATH_FILE  "aucat"
+#define SOCKPATH_DIR   "/tmp/sndio"
+#define SOCKPATH_FILE  "sock"
 #define SOCKPATH_MAX   (1 +\
sizeof(SOCKPATH_DIR) - 1 +  \
sizeof(char) +  \



bgpd, lies bloody lies

2018-07-27 Thread Claudio Jeker
Since the RIBs have been fully split there is no way that an update of a
Loc-RIB is modifying the Adj-RIB-In. Because of that there is no need
for the comment and also for the more complex loop construct.

-- 
:wq Claudio

Index: rde.c
===
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.402
diff -u -p -r1.402 rde.c
--- rde.c   27 Jul 2018 12:03:17 -  1.402
+++ rde.c   27 Jul 2018 13:22:34 -
@@ -2843,7 +2842,7 @@ rde_softreconfig_in(struct rib_entry *re
 {
struct filterstate   state;
struct rib_desc *rib = ptr;
-   struct prefix   *p, *np;
+   struct prefix   *p;
struct pt_entry *pt;
struct rde_peer *peer;
struct rde_aspath   *asp;
@@ -2852,12 +2851,7 @@ rde_softreconfig_in(struct rib_entry *re
 
pt = re->prefix;
pt_getaddr(pt, &addr);
-   for (p = LIST_FIRST(&re->prefix_h); p != NULL; p = np) {
-   /*
-* prefix_remove() and path_update() may change the object
-* so cache the values.
-*/
-   np = LIST_NEXT(p, rib_l);
+   LIST_FOREACH(p, &re->prefix_h, rib_l) {
asp = prefix_aspath(p);
peer = asp->peer;
 



Re: bgpd, lies bloody lies

2018-07-27 Thread Sebastian Benoit


ok

Claudio Jeker(cje...@diehard.n-r-g.com) on 2018.07.27 15:33:36 +0200:
> Since the RIBs have been fully split there is no way that an update of a
> Loc-RIB is modifying the Adj-RIB-In. Because of that there is no need
> for the comment and also for the more complex loop construct.
> 
> -- 
> :wq Claudio
> 
> Index: rde.c
> ===
> RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
> retrieving revision 1.402
> diff -u -p -r1.402 rde.c
> --- rde.c 27 Jul 2018 12:03:17 -  1.402
> +++ rde.c 27 Jul 2018 13:22:34 -
> @@ -2843,7 +2842,7 @@ rde_softreconfig_in(struct rib_entry *re
>  {
>   struct filterstate   state;
>   struct rib_desc *rib = ptr;
> - struct prefix   *p, *np;
> + struct prefix   *p;
>   struct pt_entry *pt;
>   struct rde_peer *peer;
>   struct rde_aspath   *asp;
> @@ -2852,12 +2851,7 @@ rde_softreconfig_in(struct rib_entry *re
>  
>   pt = re->prefix;
>   pt_getaddr(pt, &addr);
> - for (p = LIST_FIRST(&re->prefix_h); p != NULL; p = np) {
> - /*
> -  * prefix_remove() and path_update() may change the object
> -  * so cache the values.
> -  */
> - np = LIST_NEXT(p, rib_l);
> + LIST_FOREACH(p, &re->prefix_h, rib_l) {
>   asp = prefix_aspath(p);
>   peer = asp->peer;
>  
> 



ssdfb(4): SSD1309 OLED display (128x64)

2018-07-27 Thread Patrick Wildt
Hi,

I have an SPI-connected SSD1309 OLED display (128x64) that I would like
to support.  At some point I'd like to attach a graphical program to it,
so that a userland tool can draw graphics (or maybe something like X11).

I don't know the display subsystem very well, so this diff attempts to
attach wsdisplay(4) to ssdfb(4).  Since it's SPI connected and there is
no memory mapped framebuffer I have to manually update the display.  One
attempt I tried was hooking up the putchar/col/row functions, but I have
simplified it into a 100ms periodic timeout.  This seems usable enough.
Is there a better approach?

With the integrated 8x16 font I do get 4 rows with 16 characters per
row.  This is rather hard to use, a 5x8 font would make some more room.
But at the moment I don't intend to change that.

Feedback?

Patrick

diff --git a/sys/arch/arm64/conf/GENERIC b/sys/arch/arm64/conf/GENERIC
index d93417f4cce..144e54bd1c8 100644
--- a/sys/arch/arm64/conf/GENERIC
+++ b/sys/arch/arm64/conf/GENERIC
@@ -112,6 +112,8 @@ sdmmc*  at imxesdhc?
 imxpd* at fdt?
 imxdwusb*  at fdt?
 imxspi*at fdt?
+ssdfb* at spi?
+wsdisplay* at ssdfb?
 
 # Raspberry Pi 3
 bcmaux*at fdt?
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC
index 6f43b436c54..7a8cea0c4d0 100644
--- a/sys/arch/armv7/conf/GENERIC
+++ b/sys/arch/armv7/conf/GENERIC
@@ -60,6 +60,8 @@ imxehci*  at fdt? # EHCI
 usb*   at imxehci?
 imxrtc*at fdt? # SNVS RTC
 imxspi*at fdt?
+ssdfb* at spi?
+wsdisplay* at ssdfb?
 
 # OMAP3xxx/OMAP4xxx SoC
 omap0  at mainbus?
diff --git a/sys/dev/fdt/files.fdt b/sys/dev/fdt/files.fdt
index f65d9c3a5b8..52851b404d9 100644
--- a/sys/dev/fdt/files.fdt
+++ b/sys/dev/fdt/files.fdt
@@ -260,3 +260,7 @@ filedev/fdt/ccp_fdt.c   ccp_fdt
 
 attach com at fdt with com_fdt
 file   dev/fdt/com_fdt.c   com_fdt
+
+device ssdfb: wsemuldisplaydev, rasops1
+attach ssdfb at spi
+file   dev/fdt/ssdfb.c ssdfb
diff --git a/sys/dev/fdt/ssdfb.c b/sys/dev/fdt/ssdfb.c
new file mode 100644
index 000..ca136e0a28f
--- /dev/null
+++ b/sys/dev/fdt/ssdfb.c
@@ -0,0 +1,441 @@
+/* $OpenBSD$ */
+/*
+ * Copyright (c) 2018 Patrick Wildt 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define SSDFB_SET_LOWER_COLUMN_START_ADRESS0x00
+#define SSDFB_SET_HIGHER_COLUMN_START_ADRESS   0x10
+#define SSDFB_SET_MEMORY_ADRESSING_MODE0x20
+#define SSDFB_SET_START_LINE   0x40
+#define SSDFB_SET_CONTRAST_CONTROL 0x81
+#define SSDFB_SET_COLUMN_DIRECTION_REVERSE 0xa1
+#define SSDFB_SET_MULTIPLEX_RATIO  0xa8
+#define SSDFB_SET_COM_OUTPUT_DIRECTION 0xc0
+#define SSDFB_ENTIRE_DISPLAY_ON0xa4
+#define SSDFB_SET_DISPLAY_MODE_NORMAL  0xa6
+#define SSDFB_SET_DISPLAY_MODE_INVERS  0xa7
+#define SSDFB_SET_DISPLAY_OFF  0xae
+#define SSDFB_SET_DISPLAY_ON   0xaf
+#define SSDFB_SET_DISPLAY_OFFSET   0xd3
+#define SSDFB_SET_DISPLAY_CLOCK_DIVIDE_RATIO   0xd5
+#define SSDFB_SET_PRE_CHARGE_PERIOD0xd9
+#define SSDFB_SET_COM_PINS_HARD_CONF   0xda
+#define SSDFB_SET_VCOM_DESELECT_LEVEL  0xdb
+#define SSDFB_SET_PAGE_START_ADRESS0xb0
+
+#define SSDFB_WIDTH128
+#define SSDFB_HEIGHT   64
+
+struct ssdfb_softc {
+   struct devicesc_dev;
+   spi_tag_tsc_tag;
+   int  sc_node;
+
+   struct spi_configsc_conf;
+   uint32_t*sc_gpio;
+   size_t   sc_gpiolen;
+   int  sc_cd;
+
+   uint8_t *sc_fb;
+   size_t   sc_fbsize;
+   struct rasops_info   sc_rinfo;
+
+   struct task  sc_task;
+   struct timeout   sc_to;
+};
+
+int ssdfb_match(struct device *, void *, void *);
+voidssdfb_attach(struct device *, struct device *, void *)

MAKEDEV: don't make /dev/audio* symlinks

2018-07-27 Thread Alexandre Ratchov
The /dev/audio and /dev/audioctl symlinks aren't used anymore and can
be removed (the /dev/mixer symlink is still used).

OK?

Index: MAKEDEV.common
===
RCS file: /cvs/src/etc/MAKEDEV.common,v
retrieving revision 1.98
diff -u -p -r1.98 MAKEDEV.common
--- MAKEDEV.common  14 Nov 2017 20:21:29 -  1.98
+++ MAKEDEV.common  27 Jul 2018 13:01:50 -
@@ -418,9 +418,7 @@ __devitem(au, audio*, Audio devices,audi
 _mkdev(au, audio*, {-M audio$U c major_au_c $U
M mixer$U   c major_au_c Add($U, 16)
M audioctl$Uc major_au_c Add($U, 192)
-   MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio"
-   MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
-   MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U 
audioctl"-})dnl
+   MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"-})dnl
 __devitem(vi, video*, Video V4L2 devices,video)dnl
 _mkdev(vi, video*, {-M video$U  c major_vi_c $U 600
MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video"-})dnl



Re: inteldrm: always use probed screen size for fb

2018-07-27 Thread Mark Kettenis
> Date: Thu, 26 Jul 2018 17:56:03 -0500
> From: joshua stein 
> 
> On Thu, 26 Jul 2018 at 22:26:51 +0200, Mark Kettenis wrote:
> > I'm hesitant to change this code.  How does Linux behave on tese
> > machines?  Does it use the invisible part of the framebuffer?  Or have
> > they done away with actually using the kernel framebuffer completely
> > like some developers threatened a couple of years ago...
> 
> I booted a Linux USB drive and it just shows a purple/black screen 
> for a few seconds while the kernel loads until some text flashes for 
> half a second (systemd?) and then X loads.  When I switch back to 
> the console, it doesn't draw off the screen.  I have no idea what 
> it's doing under the hood to figure out the resolution for the 
> console.

All the information about the size of the connected displays is there.
But it is unclear to me how that information is propagated to the
Linux kernel framebuffer code.

Anyway, here is an alternative diff.  This keeps the BIOS framebuffer
but only uses the area that corresponds to the size we want.  Keeping
the BIOS framebuffer has some benefits.  On many systems that
framebuffer lives in "stolen" memory that we can't really use for any
other purpose because the BIOS owns it.  Also keeping the BIOS
framebuffer would avoid a mode switch (at least in theory) and speed
up the boot processes.


Index: dev/pci/drm/i915/intel_fbdev.c
===
RCS file: /cvs/src/sys/dev/pci/drm/i915/intel_fbdev.c,v
retrieving revision 1.3
diff -u -p -r1.3 intel_fbdev.c
--- dev/pci/drm/i915/intel_fbdev.c  1 Jul 2017 16:14:10 -   1.3
+++ dev/pci/drm/i915/intel_fbdev.c  27 Jul 2018 17:26:33 -
@@ -220,8 +220,10 @@ static int intelfb_create(struct drm_fb_
} else {
DRM_DEBUG_KMS("re-using BIOS fb\n");
prealloc = true;
+#ifdef __linux__
sizes->fb_width = intel_fb->base.width;
sizes->fb_height = intel_fb->base.height;
+#endif
}
 
obj = intel_fb->obj;



Re: inteldrm: always use probed screen size for fb

2018-07-27 Thread joshua stein
On Fri, 27 Jul 2018 at 19:44:28 +0200, Mark Kettenis wrote:
> > Date: Thu, 26 Jul 2018 17:56:03 -0500
> > From: joshua stein 
> > 
> > On Thu, 26 Jul 2018 at 22:26:51 +0200, Mark Kettenis wrote:
> > > I'm hesitant to change this code.  How does Linux behave on tese
> > > machines?  Does it use the invisible part of the framebuffer?  Or have
> > > they done away with actually using the kernel framebuffer completely
> > > like some developers threatened a couple of years ago...
> > 
> > I booted a Linux USB drive and it just shows a purple/black screen 
> > for a few seconds while the kernel loads until some text flashes for 
> > half a second (systemd?) and then X loads.  When I switch back to 
> > the console, it doesn't draw off the screen.  I have no idea what 
> > it's doing under the hood to figure out the resolution for the 
> > console.
> 
> All the information about the size of the connected displays is there.
> But it is unclear to me how that information is propagated to the
> Linux kernel framebuffer code.
> 
> Anyway, here is an alternative diff.  This keeps the BIOS framebuffer
> but only uses the area that corresponds to the size we want.  Keeping
> the BIOS framebuffer has some benefits.  On many systems that
> framebuffer lives in "stolen" memory that we can't really use for any
> other purpose because the BIOS owns it.  Also keeping the BIOS
> framebuffer would avoid a mode switch (at least in theory) and speed
> up the boot processes.

Works For Me (tm)

> Index: dev/pci/drm/i915/intel_fbdev.c
> ===
> RCS file: /cvs/src/sys/dev/pci/drm/i915/intel_fbdev.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 intel_fbdev.c
> --- dev/pci/drm/i915/intel_fbdev.c1 Jul 2017 16:14:10 -   1.3
> +++ dev/pci/drm/i915/intel_fbdev.c27 Jul 2018 17:26:33 -
> @@ -220,8 +220,10 @@ static int intelfb_create(struct drm_fb_
>   } else {
>   DRM_DEBUG_KMS("re-using BIOS fb\n");
>   prealloc = true;
> +#ifdef __linux__
>   sizes->fb_width = intel_fb->base.width;
>   sizes->fb_height = intel_fb->base.height;
> +#endif
>   }
>  
>   obj = intel_fb->obj;
> 



stop using WSMOUSE_TYPE_ELANTECH in other drivers

2018-07-27 Thread joshua stein
Back when touchpad drivers were using the synaptics Xorg driver, 
they had to pretend to be Elantech devices in order to get 
particular packet processing.

Since Ulf switched us to wstpad and xf86-input-ws a while ago, these 
drivers can stop claiming to be WSMOUSE_TYPE_ELANTECH devices and 
use a common WSMOUSE_TYPE_TOUCHPAD.

This also makes the WSMOUSEIO_GTYPE ioctl in those drivers respond 
with whatever is stored in the softc to avoid repeating ourselves 
(or possibly responding incorrectly).

There's also a corresponding xenocara diff coming after this.


Index: sys/dev/hid/hidmt.c
===
RCS file: /cvs/src/sys/dev/hid/hidmt.c,v
retrieving revision 1.6
diff -u -p -u -p -r1.6 hidmt.c
--- sys/dev/hid/hidmt.c 10 Oct 2017 20:31:50 -  1.6
+++ sys/dev/hid/hidmt.c 27 Jul 2018 19:53:59 -
@@ -235,7 +235,7 @@ hidmt_configure(struct hidmt *mt)
return;
 
hw = wsmouse_get_hw(mt->sc_wsmousedev);
-   hw->type = WSMOUSE_TYPE_ELANTECH;   /* see hidmt_ioctl */
+   hw->type = WSMOUSE_TYPE_TOUCHPAD;
hw->hw_type = (mt->sc_clickpad
? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD);
hw->x_min = mt->sc_minx;
@@ -468,13 +468,11 @@ hidmt_ioctl(struct hidmt *mt, u_long cmd
int wsmode;
 
switch (cmd) {
-   case WSMOUSEIO_GTYPE:
-   /*
-* So we can specify our own finger/w values to the
-* xf86-input-synaptics driver like pms(4)
-*/
-   *(u_int *)data = WSMOUSE_TYPE_ELANTECH;
+   case WSMOUSEIO_GTYPE: {
+   struct wsmousehw *hw = wsmouse_get_hw(mt->sc_wsmousedev);
+   *(u_int *)data = hw->type;
break;
+   }
 
case WSMOUSEIO_GCALIBCOORDS:
wsmc->minx = mt->sc_minx;
Index: sys/dev/i2c/iatp.c
===
RCS file: /cvs/src/sys/dev/i2c/iatp.c,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 iatp.c
--- sys/dev/i2c/iatp.c  22 Jun 2018 15:58:26 -  1.5
+++ sys/dev/i2c/iatp.c  27 Jul 2018 19:53:59 -
@@ -325,7 +325,7 @@ iatp_configure(struct iatp_softc *sc)
 
hw = wsmouse_get_hw(sc->sc_wsmousedev);
if (sc->sc_touchpad) {
-   hw->type = WSMOUSE_TYPE_SYNAPTICS;
+   hw->type = WSMOUSE_TYPE_TOUCHPAD;
hw->hw_type = WSMOUSEHW_CLICKPAD;
} else {
hw->type = WSMOUSE_TYPE_TPANEL;
@@ -415,12 +415,11 @@ iatp_ioctl(void *v, u_long cmd, caddr_t 
wsmc->resy = sc->sc_tsscale.resy;
break;
 
-   case WSMOUSEIO_GTYPE:
-   if (sc->sc_touchpad)
-   *(u_int *)data = WSMOUSE_TYPE_SYNAPTICS;
-   else
-   *(u_int *)data = WSMOUSE_TYPE_TPANEL;
+   case WSMOUSEIO_GTYPE: {
+   struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
+   *(u_int *)data = hw->type;
break;
+   }
 
case WSMOUSEIO_SETMODE:
if (!sc->sc_touchpad)
Index: sys/dev/usb/ubcmtp.c
===
RCS file: /cvs/src/sys/dev/usb/ubcmtp.c,v
retrieving revision 1.17
diff -u -p -u -p -r1.17 ubcmtp.c
--- sys/dev/usb/ubcmtp.c6 Jun 2017 21:53:07 -   1.17
+++ sys/dev/usb/ubcmtp.c27 Jul 2018 19:53:59 -
@@ -521,7 +521,7 @@ ubcmtp_configure(struct ubcmtp_softc *sc
 {
struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
 
-   hw->type = WSMOUSE_TYPE_ELANTECH;   /* see ubcmtp_ioctl */
+   hw->type = WSMOUSE_TYPE_TOUCHPAD;
hw->hw_type = (IS_CLICKPAD(sc->dev_type->type)
? WSMOUSEHW_CLICKPAD : WSMOUSEHW_TOUCHPAD);
hw->x_min = sc->dev_type->l_x.min;
@@ -601,11 +601,11 @@ ubcmtp_ioctl(void *v, unsigned long cmd,
cmd);
 
switch (cmd) {
-   case WSMOUSEIO_GTYPE:
-   /* so we can specify our own finger/w values to the
-* xf86-input-synaptics driver like pms(4) */
-   *(u_int *)data = WSMOUSE_TYPE_ELANTECH;
+   case WSMOUSEIO_GTYPE: {
+   struct wsmousehw *hw = wsmouse_get_hw(sc->sc_wsmousedev);
+   *(u_int *)data = hw->type;
break;
+   }
 
case WSMOUSEIO_GCALIBCOORDS:
wsmc->minx = sc->dev_type->l_x.min;
Index: sys/dev/wscons/wsconsio.h
===
RCS file: /cvs/src/sys/dev/wscons/wsconsio.h,v
retrieving revision 1.88
diff -u -p -u -p -r1.88 wsconsio.h
--- sys/dev/wscons/wsconsio.h   7 May 2018 21:58:42 -   1.88
+++ sys/dev/wscons/wsconsio.h   27 Jul 2018 19:53:59 -
@@ -238,6 +238,7 @@ struct wskbd_encoding_data {
 #defineWSMOUSE_TYPE_SGI17  /* SGI serial mouse */
 #defineWSMOUSE_TYPE_ELANTECH   18  /* Elantech touchpad */
 #define  

stop using WSMOUSE_TYPE_ELANTECH in other drivers (xenocara)

2018-07-27 Thread joshua stein
And here is the xenocara part.

Index: xserver/config/wscons.c
===
RCS file: /cvs/xenocara/xserver/config/wscons.c,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 wscons.c
--- xserver/config/wscons.c 8 Dec 2017 15:02:00 -   1.21
+++ xserver/config/wscons.c 27 Jul 2018 19:54:17 -
@@ -239,6 +239,7 @@ wscons_add_pointers(void)
   case WSMOUSE_TYPE_ALPS:
   case WSMOUSE_TYPE_ELANTECH:
   case WSMOUSE_TYPE_SYNAP_SBTN:
+  case WSMOUSE_TYPE_TOUCHPAD:
 wscons_add_pointer(devnam, "ws",
ATTR_TOUCHPAD);
 break;



Re: Kill MD-specific interrupt enable/disable API on amd64

2018-07-27 Thread Mark Kettenis
> Date: Wed, 25 Jul 2018 00:01:18 +0200 (CEST)
> From: Mark Kettenis 
> 
> Diff below switches to the MI equivalent and kills the MD-specific
> API.
> 
> ok?

Here is the equivalent i386 diff.  Only compile-tested so I'd
appreciate it if somebody can test this for me.  Do test
suspend/resume and hibernate.


Index: arch/i386/i386/apm.c
===
RCS file: /cvs/src/sys/arch/i386/i386/apm.c,v
retrieving revision 1.117
diff -u -p -r1.117 apm.c
--- arch/i386/i386/apm.c17 Aug 2017 19:44:27 -  1.117
+++ arch/i386/i386/apm.c27 Jul 2018 23:10:46 -
@@ -247,7 +247,7 @@ apm_suspend(int state)
bufq_quiesce();
 
s = splhigh();
-   disable_intr();
+   intr_disable();
cold = 2;
config_suspend_all(DVACT_SUSPEND);
suspend_randomness();
@@ -272,7 +272,7 @@ apm_suspend(int state)
 
config_suspend_all(DVACT_RESUME);
cold = 0;
-   enable_intr();
+   intr_enable();
splx(s);
 
resume_randomness(NULL, 0); /* force RNG upper level reseed */
Index: arch/i386/i386/cpu.c
===
RCS file: /cvs/src/sys/arch/i386/i386/cpu.c,v
retrieving revision 1.93
diff -u -p -r1.93 cpu.c
--- arch/i386/i386/cpu.c22 Jun 2018 13:21:14 -  1.93
+++ arch/i386/i386/cpu.c27 Jul 2018 23:10:46 -
@@ -705,7 +705,7 @@ cpu_hatch(void *v)
 
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);
Index: arch/i386/i386/hibernate_machdep.c
===
RCS file: /cvs/src/sys/arch/i386/i386/hibernate_machdep.c,v
retrieving revision 1.54
diff -u -p -r1.54 hibernate_machdep.c
--- arch/i386/i386/hibernate_machdep.c  4 Jul 2018 02:05:06 -   1.54
+++ arch/i386/i386/hibernate_machdep.c  27 Jul 2018 23:10:46 -
@@ -387,13 +387,13 @@ hibernate_inflate_skip(union hibernate_i
 void
 hibernate_enable_intr_machdep(void)
 {
-   enable_intr();
+   intr_enable();
 }
 
 void
 hibernate_disable_intr_machdep(void)
 {
-   disable_intr();
+   intr_disable();
 }
 
 #ifdef MULTIPROCESSOR
Index: arch/i386/i386/i686_mem.c
===
RCS file: /cvs/src/sys/arch/i386/i386/i686_mem.c,v
retrieving revision 1.18
diff -u -p -r1.18 i686_mem.c
--- arch/i386/i386/i686_mem.c   26 Apr 2016 15:27:32 -  1.18
+++ arch/i386/i386/i686_mem.c   27 Jul 2018 23:10:46 -
@@ -275,12 +275,14 @@ mrt2mtrr(u_int64_t flags)
 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);
 }
 
 /*
@@ -618,7 +620,9 @@ mrinit_cpu(struct mem_range_softc *sc)
 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);
 }
Index: arch/i386/i386/ipifuncs.c
===
RCS file: /cvs/src/sys/arch/i386/i386/ipifuncs.c,v
retrieving revision 1.30
diff -u -p -r1.30 ipifuncs.c
--- arch/i386/i386/ipifuncs.c   4 Dec 2017 21:12:41 -   1.30
+++ arch/i386/i386/ipifuncs.c   27 Jul 2018 23:10:46 -
@@ -116,7 +116,7 @@ i386_ipi_halt(struct cpu_info *ci)
KASSERT(!_kernel_lock_held());
 
npxsave_cpu(ci, 1);
-   disable_intr();
+   intr_disable();
lapic_disable();
wbinvd();
ci->ci_flags &= ~CPUF_RUNNING;
Index: arch/i386/i386/k6_mem.c
===
RCS file: /cvs/src/sys/arch/i386/i386/k6_mem.c,v
retrieving revision 1.12
diff -u -p -r1.12 k6_mem.c
--- arch/i386/i386/k6_mem.c 8 Sep 2015 04:28:34 -   1.12
+++ arch/i386/i386/k6_mem.c 27 Jul 2018 23:10:46 -
@@ -130,6 +130,7 @@ k6_mrset(struct mem_range_softc *sc, str
u_int64_t reg;
u_int32_t mtrr;
int error, d;
+   u_long s;
 
switch (*arg) {
case MEMRANGE_SET_UPDATE:
@@ -163,14 +164,14 @@ k6_mrset(struct mem_range_softc *sc, str
 
 out:

-   disable_intr();
+   s = intr_disable();
wbinvd();
reg = rdmsr(UWCCR);
reg &= ~(0x << (32 * d));
reg |= mtrr << (32 * d);
wrmsr(UWCCR, reg);
wbinvd();
-   enable_intr();
+   intr_restore(s);
 
return 0;
 }
@@ -184,17 +185,18 @@ k6_mrinit_cpu(struct mem_range_softc