CVS commit: src/sys

2015-07-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jul 30 07:32:40 UTC 2015

Modified Files:
src/sys/arch/arm/amlogic: amlogic_dwctwo.c
src/sys/arch/arm/broadcom: bcm2835_dwctwo.c
src/sys/arch/arm/rockchip: rockchip_dwctwo.c
src/sys/arch/mips/cavium/dev: octeon_dwctwo.c
src/sys/arch/powerpc/ibm4xx/dev: dwctwo_plb.c
src/sys/external/bsd/dwc2: dwc2.h

Log Message:
Use IPL_VM for dwc2_intr and mark as MP safe where possible.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/amlogic/amlogic_dwctwo.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm2835_dwctwo.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rockchip_dwctwo.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/dwc2/dwc2.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/amlogic/amlogic_dwctwo.c
diff -u src/sys/arch/arm/amlogic/amlogic_dwctwo.c:1.3 src/sys/arch/arm/amlogic/amlogic_dwctwo.c:1.4
--- src/sys/arch/arm/amlogic/amlogic_dwctwo.c:1.3	Wed Jul 22 10:32:16 2015
+++ src/sys/arch/arm/amlogic/amlogic_dwctwo.c	Thu Jul 30 07:32:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: amlogic_dwctwo.c,v 1.3 2015/07/22 10:32:16 skrll Exp $	*/
+/*	$NetBSD: amlogic_dwctwo.c,v 1.4 2015/07/30 07:32:40 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amlogic_dwctwo.c,v 1.3 2015/07/22 10:32:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amlogic_dwctwo.c,v 1.4 2015/07/30 07:32:40 skrll Exp $");
 
 #include 
 #include 
@@ -118,8 +118,8 @@ amlogic_dwctwo_attach(device_t parent, d
 	aprint_naive("\n");
 	aprint_normal(": USB controller\n");
 
-	sc->sc_ih = intr_establish(loc->loc_intr, IPL_SCHED,
-	   IST_LEVEL, dwc2_intr, &sc->sc_dwc2);
+	sc->sc_ih = intr_establish(loc->loc_intr, IPL_VM,
+	   IST_LEVEL | IST_MPSAFE, dwc2_intr, &sc->sc_dwc2);
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",
 		 loc->loc_intr);

Index: src/sys/arch/arm/broadcom/bcm2835_dwctwo.c
diff -u src/sys/arch/arm/broadcom/bcm2835_dwctwo.c:1.4 src/sys/arch/arm/broadcom/bcm2835_dwctwo.c:1.5
--- src/sys/arch/arm/broadcom/bcm2835_dwctwo.c:1.4	Wed Jul 29 14:22:49 2015
+++ src/sys/arch/arm/broadcom/bcm2835_dwctwo.c	Thu Jul 30 07:32:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_dwctwo.c,v 1.4 2015/07/29 14:22:49 skrll Exp $	*/
+/*	$NetBSD: bcm2835_dwctwo.c,v 1.5 2015/07/30 07:32:40 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_dwctwo.c,v 1.4 2015/07/29 14:22:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_dwctwo.c,v 1.5 2015/07/30 07:32:40 skrll Exp $");
 
 #include 
 #include 
@@ -130,8 +130,8 @@ bcmdwc2_attach(device_t parent, device_t
 	aprint_naive(": USB controller\n");
 	aprint_normal(": USB controller\n");
 
-	sc->sc_ih = intr_establish(aaa->aaa_intr, IPL_SCHED, IST_LEVEL,
-	   dwc2_intr, &sc->sc_dwc2);
+	sc->sc_ih = intr_establish(aaa->aaa_intr, IPL_VM,
+	IST_LEVEL | IST_MPSAFE, dwc2_intr, &sc->sc_dwc2);
 
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",

Index: src/sys/arch/arm/rockchip/rockchip_dwctwo.c
diff -u src/sys/arch/arm/rockchip/rockchip_dwctwo.c:1.3 src/sys/arch/arm/rockchip/rockchip_dwctwo.c:1.4
--- src/sys/arch/arm/rockchip/rockchip_dwctwo.c:1.3	Wed Jul 22 10:32:16 2015
+++ src/sys/arch/arm/rockchip/rockchip_dwctwo.c	Thu Jul 30 07:32:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rockchip_dwctwo.c,v 1.3 2015/07/22 10:32:16 skrll Exp $	*/
+/*	$NetBSD: rockchip_dwctwo.c,v 1.4 2015/07/30 07:32:40 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rockchip_dwctwo.c,v 1.3 2015/07/22 10:32:16 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rockchip_dwctwo.c,v 1.4 2015/07/30 07:32:40 skrll Exp $");
 
 #include 
 #include 
@@ -125,8 +125,8 @@ rkdwc2_attach(device_t parent, device_t 
 	aprint_naive(": USB controller\n");
 	aprint_normal(": USB controller\n");
 
-	sc->sc_ih = intr_establish(obio->obio_intr, IPL_SCHED,
-	   IST_LEVEL, dwc2_intr, &sc->sc_dwc2);
+	sc->sc_ih = intr_establish(obio->obio_intr, IPL_VM,
+	   IST_LEVEL | IST_MPSAFE, dwc2_intr, &sc->sc_dwc2);
 #if 0
 	   IST_EDGE, dwc2_intr, &sc->sc_dwc2);
 #endif

Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c
diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.4 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.5
--- src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.4	Wed Jul 22 10:32:16 2015
+++ src/sys/arch/mips/cavium/dev/octeon_dwctwo.c	Thu Jul 30 07:32:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon_dwctwo.c,v 1.4 2015/07/22 10:32:16 skrll Exp $	*/
+/*	$Ne

CVS commit: src/sys/lib/libkern/arch/m68k

2015-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 30 07:44:40 UTC 2015

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
add mulsi3, needed by inet_addr.o


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/lib/libkern/arch/m68k/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.35 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.36
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.35	Mon Sep  8 08:12:19 2014
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Thu Jul 30 03:44:40 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.35 2014/09/08 12:12:19 joerg Exp $
+#	$NetBSD: Makefile.inc,v 1.36 2015/07/30 07:44:40 christos Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -12,7 +12,7 @@ SRCS+=	ffs.S
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
 .endif
 .if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "m68k"
-SRCS+=	random.S
+SRCS+=	mulsi3.S random.S
 .else
 random.o random.po random.pico random.d: random.c
 .endif



CVS commit: src/distrib/sets/lists/xdebug

2015-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 30 07:56:13 UTC 2015

Modified Files:
src/distrib/sets/lists/xdebug: md.sun3

Log Message:
add missing x11 selector


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/sets/lists/xdebug/md.sun3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/xdebug/md.sun3
diff -u src/distrib/sets/lists/xdebug/md.sun3:1.1 src/distrib/sets/lists/xdebug/md.sun3:1.2
--- src/distrib/sets/lists/xdebug/md.sun3:1.1	Wed Jan 16 16:11:19 2013
+++ src/distrib/sets/lists/xdebug/md.sun3	Thu Jul 30 03:56:13 2015
@@ -1,6 +1,6 @@
-# $NetBSD: md.sun3,v 1.1 2013/01/16 21:11:19 christos Exp $
-./usr/libdata/debug/usr/X11R6/bin/Xsun.debug		-unknown-	debug
-./usr/libdata/debug/usr/X11R6/bin/XsunMono.debug	-unknown-	debug
-./usr/libdata/debug/usr/X11R6/bin/Xvfb.debug		-unknown-	debug
-./usr/libdata/debug/usr/X11R6/bin/constype.debug	-unknown-	debug
-./usr/libdata/debug/usr/X11R6/bin/kbd_mode.debug	-unknown-	debug
+# $NetBSD: md.sun3,v 1.2 2015/07/30 07:56:13 christos Exp $
+./usr/libdata/debug/usr/X11R6/bin/Xsun.debug		-unknown-	debug,x11
+./usr/libdata/debug/usr/X11R6/bin/XsunMono.debug	-unknown-	debug,x11
+./usr/libdata/debug/usr/X11R6/bin/Xvfb.debug		-unknown-	debug,x11
+./usr/libdata/debug/usr/X11R6/bin/constype.debug	-unknown-	debug,x11
+./usr/libdata/debug/usr/X11R6/bin/kbd_mode.debug	-unknown-	debug,x11



CVS commit: src/sys/arch

2015-07-30 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Jul 30 08:09:37 UTC 2015

Modified Files:
src/sys/arch/arm/imx: imx6_iomuxreg.h imx6var.h
src/sys/arch/evbarm/conf: CUBOX-I NITROGEN6X files.nitrogen6
std.nitrogen6
src/sys/arch/evbarm/nitrogen6: nitrogen6_machdep.c
Added Files:
src/sys/arch/evbarm/nitrogen6: nitrogen6_iomux.c

Log Message:
- setup iomux before attach console
- define EVBARM_BOARDTYPE in each config file
- add iomux settings for UART1
- add some iomux definitions


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/imx6_iomuxreg.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx6var.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/CUBOX-I \
src/sys/arch/evbarm/conf/std.nitrogen6
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/NITROGEN6X
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/files.nitrogen6
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/nitrogen6/nitrogen6_iomux.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/nitrogen6/nitrogen6_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/imx/imx6_iomuxreg.h
diff -u src/sys/arch/arm/imx/imx6_iomuxreg.h:1.1 src/sys/arch/arm/imx/imx6_iomuxreg.h:1.2
--- src/sys/arch/arm/imx/imx6_iomuxreg.h:1.1	Thu Sep 25 05:05:28 2014
+++ src/sys/arch/arm/imx/imx6_iomuxreg.h	Thu Jul 30 08:09:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_iomuxreg.h,v 1.1 2014/09/25 05:05:28 ryo Exp $	*/
+/*	$NetBSD: imx6_iomuxreg.h,v 1.2 2015/07/30 08:09:36 ryo Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -65,10 +65,30 @@
 #define IOMUX_GPR6	0x0018
 #define IOMUX_GPR7	0x001c
 #define IOMUX_GPR8	0x0020
+#define  IOMUX_GPR8_PCS_TX_SWING_LOW		__BITS(31, 25)
+#define  IOMUX_GPR8_PCS_TX_SWING_FULL		__BITS(24, 18)
+#define  IOMUX_GPR8_PCS_TX_DEEMPH_GEN2_6DB	__BITS(17, 12)
+#define  IOMUX_GPR8_PCS_TX_DEEMPH_GEN2_3P5DB	__BITS(11, 6)
+#define  IOMUX_GPR8_PCS_TX_DEEMPH_GEN1		__BITS(5, 0)
 #define IOMUX_GPR9	0x0024
 #define IOMUX_GPR10	0x0028
 #define IOMUX_GPR11	0x002c
 #define IOMUX_GPR12	0x0030
+#define  IOMUX_GPR12_ARMP_IPG_CLK_EN		__BIT(27)
+#define  IOMUX_GPR12_ARMP_AHB_CLK_EN		__BIT(26)
+#define  IOMUX_GPR12_ARMP_ATB_CLK_EN		__BIT(25)
+#define  IOMUX_GPR12_ARMP_APB_CLK_EN		__BIT(24)
+#define  IOMUX_GPR12_PCIE_CTL_7			__BITS(23, 21)
+#define  IOMUX_GPR12_DIA_STATUS_BUS_SELECT	__BITS(20, 17)
+#define  IOMUX_GPR12_APPS_PM_XMT_TURNOFF	__BIT(16)
+#define  IOMUX_GPR12_DEVICE_TYPE		__BITS(15, 12)
+#define  IOMUX_GPR12_DEVICE_TYPE_PCIE_EP	(0 << 12)
+#define  IOMUX_GPR12_DEVICE_TYPE_PCIE_RC	(2 << 12)
+#define  IOMUX_GPR12_APP_INIT_RST		__BIT(11)
+#define  IOMUX_GPR12_APP_LTSSM_ENABLE		__BIT(10)
+#define  IOMUX_GPR12_APPS_PM_XMT_PME		__BIT(9)
+#define  IOMUX_GPR12_LOS_LEVEL			__BITS(8, 4)
+#define  IOMUX_GPR12_USDHC_DBG_MUX		__BITS(3, 2)
 #define IOMUX_GPR13	0x0034
 #define  IOMUX_GPR13_SDMA_STOP_REQ		__BIT(30)
 #define  IOMUX_GPR13_CAN2_STOP_REQ		__BIT(29)
@@ -686,15 +706,32 @@
 #define PAD_CTL_PKE		__BIT(12)
 #define PAD_CTL_PULL		(PAD_CTL_PKE|PAD_CTL_PUE)
 #define PAD_CTL_KEEPER		(PAD_CTL_PKE|0)
+#define PAD_CTL_ODE		__BIT(11)
+#define PAD_CTL_ODT		__BITS(10, 8)
+#define PAD_CTL_SPEED_MASK	__BITS(7, 6)
+#define PAD_CTL_SPEED_RESERVED0	__SHIFTIN(0, PAD_CTL_SPEED_MASK)
+#define PAD_CTL_SPEED_50MHZ	__SHIFTIN(1, PAD_CTL_SPEED_MASK)
+#define PAD_CTL_SPEED_100MHZ	__SHIFTIN(2, PAD_CTL_SPEED_MASK)
+#define PAD_CTL_SPEED_200MHZ	__SHIFTIN(3, PAD_CTL_SPEED_MASK)
 #define PAD_CTL_DSE_MASK	__BITS(5, 3)
 #define PAD_CTL_DSE_HIZ		__SHIFTIN(0x0, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_290OHM	__SHIFTIN(0x1, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_240OHM	__SHIFTIN(0x1, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_121OHM	__SHIFTIN(0x2, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_120OHM	__SHIFTIN(0x2, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_80OHM	__SHIFTIN(0x3, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_76OHM	__SHIFTIN(0x3, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_60OHM	__SHIFTIN(0x4, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_48OHM	__SHIFTIN(0x5, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_47OHM	__SHIFTIN(0x4, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_45OHM	__SHIFTIN(0x5, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_40OHM	__SHIFTIN(0x6, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_37OHM	__SHIFTIN(0x6, PAD_CTL_DSE_MASK)
+#define PAD_CTL_DSE_34OHM	__SHIFTIN(0x7, PAD_CTL_DSE_MASK)
 #define PAD_CTL_DSE_31OHM	__SHIFTIN(0x7, PAD_CTL_DSE_MASK)
+#define PAD_CTL_SRE		__BIT(0)
+#define PAD_CTL_SRE_SLOW	0
+#define PAD_CTL_SRE_FAST	PAD_CTL_SRE
 /* IOMUXC_SW_PAD_CTL_PAD_xxx */
 #define INPUT_DAISY_0		0
 #define INPUT_DAISY_1		1

Index: src/sys/arch/arm/imx/imx6var.h
diff -u src/sys/arch/arm/imx/imx6var.h:1.2 src/sys/arch/arm/imx/imx6var.h:1.3
--- src/sys/arch/arm/imx/imx6var.h:1.2	Tue Oct  7 09:32:47 2014
+++ src/sys/arch/arm/imx/imx6var.h	Thu Jul 30 08:09:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx

CVS commit: src/sys/kern

2015-07-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jul 30 08:11:44 UTC 2015

Modified Files:
src/sys/kern: sys_pset.c

Log Message:
Don't forget to unlock the LWP.

ok rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/kern/sys_pset.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/sys_pset.c
diff -u src/sys/kern/sys_pset.c:1.18 src/sys/kern/sys_pset.c:1.19
--- src/sys/kern/sys_pset.c:1.18	Tue Feb 25 18:30:11 2014
+++ src/sys/kern/sys_pset.c	Thu Jul 30 08:11:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_pset.c,v 1.18 2014/02/25 18:30:11 pooka Exp $	*/
+/*	$NetBSD: sys_pset.c,v 1.19 2015/07/30 08:11:44 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, Mindaugas Rasiukevicius 
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_pset.c,v 1.18 2014/02/25 18:30:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pset.c,v 1.19 2015/07/30 08:11:44 maxv Exp $");
 
 #include 
 
@@ -380,6 +380,7 @@ sys_pset_assign(struct lwp *l, const str
 mutex_exit(&cpu_lock);
 return EPERM;
 			}
+			lwp_unlock(t);
 		}
 		/*
 		 * Set the processor-set ID.



CVS commit: src/tests/net/arp

2015-07-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Thu Jul 30 08:41:18 UTC 2015

Modified Files:
src/tests/net/arp: t_arp.sh

Log Message:
Add tests for arp -a option


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/arp/t_arp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.2 src/tests/net/arp/t_arp.sh:1.3
--- src/tests/net/arp/t_arp.sh:1.2	Thu Jul 30 02:51:05 2015
+++ src/tests/net/arp/t_arp.sh	Thu Jul 30 08:41:18 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.2 2015/07/30 02:51:05 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.3 2015/07/30 08:41:18 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -187,6 +187,13 @@ command_body()
 	atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.14
 	atf_check -s exit:0 -o match:'permanent' rump.arp -n 10.0.1.15
 
+	# Test arp -a
+	atf_check -s exit:0 -o match:'10.0.1.11' rump.arp -n -a
+	atf_check -s exit:0 -o match:'10.0.1.12' rump.arp -n -a
+	atf_check -s exit:0 -o match:'10.0.1.13' rump.arp -n -a
+	atf_check -s exit:0 -o match:'10.0.1.14' rump.arp -n -a
+	atf_check -s exit:0 -o match:'10.0.1.15' rump.arp -n -a
+
 	# Flush all entries
 	$DEBUG && rump.arp -n -a
 	atf_check -s exit:0 -o ignore rump.arp -d -a



CVS commit: [netbsd-7] xsrc/external/mit/libXi/dist

2015-07-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Thu Jul 30 09:15:20 UTC 2015

Modified Files:
xsrc/external/mit/libXi/dist [netbsd-7]: ChangeLog configure
configure.ac
xsrc/external/mit/libXi/dist/src [netbsd-7]: XIAllowEvents.c
XIPassiveGrab.c

Log Message:
Pull up the following revisions, requeusted by mrg in #888:

xsrc/external/mit/libXi/dist/ChangeLog  1.1.1.11
xsrc/external/mit/libXi/dist/configure  1.1.1.11
xsrc/external/mit/libXi/dist/configure.ac   1.1.1.11
xsrc/external/mit/libXi/dist/src/XIAllowEvents.c1.1.1.4
xsrc/external/mit/libXi/dist/src/XIPassiveGrab.c1.1.1.7

Update libXi to 1.7.4.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.10 -r1.1.1.10.2.1 xsrc/external/mit/libXi/dist/ChangeLog \
xsrc/external/mit/libXi/dist/configure \
xsrc/external/mit/libXi/dist/configure.ac
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.4.1 \
xsrc/external/mit/libXi/dist/src/XIAllowEvents.c
cvs rdiff -u -r1.4 -r1.4.2.1 xsrc/external/mit/libXi/dist/src/XIPassiveGrab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXi/dist/ChangeLog
diff -u xsrc/external/mit/libXi/dist/ChangeLog:1.1.1.10 xsrc/external/mit/libXi/dist/ChangeLog:1.1.1.10.2.1
--- xsrc/external/mit/libXi/dist/ChangeLog:1.1.1.10	Fri Jul 11 18:30:38 2014
+++ xsrc/external/mit/libXi/dist/ChangeLog	Thu Jul 30 09:15:19 2015
@@ -1,3 +1,23 @@
+commit 8c255b30f3a4ed8bf67e6bb76df47cbd480735f8
+Author: Peter Hutterer 
+Date:   Fri Jul 18 16:45:51 2014 +1000
+
+libXi 1.7.4
+
+Signed-off-by: Peter Hutterer 
+
+commit b731d1357d993663ee6b28d6627bdeba69b60dd2
+Author: Owen W. Taylor 
+Date:   Fri Jul 11 15:13:54 2014 -0400
+
+Fix locking bugs with XIAllowTouchEvents() and XIUngrabTouchBegin()
+
+Fix two places where the display was double locked when an API
+function chained to an implementation that also locks the display.
+
+Reviewed-by: Peter Hutterer 
+Signed-off-by: Peter Hutterer 
+
 commit 0250f40fb7c9cb7d542189b9cd37e0ae75309729
 Author: Peter Hutterer 
 Date:   Thu Jul 10 08:58:48 2014 +1000
Index: xsrc/external/mit/libXi/dist/configure
diff -u xsrc/external/mit/libXi/dist/configure:1.1.1.10 xsrc/external/mit/libXi/dist/configure:1.1.1.10.2.1
--- xsrc/external/mit/libXi/dist/configure:1.1.1.10	Fri Jul 11 18:30:38 2014
+++ xsrc/external/mit/libXi/dist/configure	Thu Jul 30 09:15:19 2015
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libXi 1.7.3.
+# Generated by GNU Autoconf 2.69 for libXi 1.7.4.
 #
 # Report bugs to .
 #
@@ -651,8 +651,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libXi'
 PACKAGE_TARNAME='libXi'
-PACKAGE_VERSION='1.7.3'
-PACKAGE_STRING='libXi 1.7.3'
+PACKAGE_VERSION='1.7.4'
+PACKAGE_STRING='libXi 1.7.4'
 PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
 PACKAGE_URL=''
 
@@ -1447,7 +1447,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libXi 1.7.3 to adapt to many kinds of systems.
+\`configure' configures libXi 1.7.4 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1517,7 +1517,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of libXi 1.7.3:";;
+ short | recursive ) echo "Configuration of libXi 1.7.4:";;
esac
   cat <<\_ACEOF
 
@@ -1653,7 +1653,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libXi configure 1.7.3
+libXi configure 1.7.4
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1977,7 +1977,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libXi $as_me 1.7.3, which was
+It was created by libXi $as_me 1.7.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2845,7 +2845,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libXi'
- VERSION='1.7.3'
+ VERSION='1.7.4'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -19254,7 +19254,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libXi $as_me 1.7.3, which was
+This file was extended by libXi $as_me 1.7.4, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
@@ -19320,7 +19320,7 @@ _ACEOF
 cat 

CVS commit: [netbsd-7] src/sys/dev/pci

2015-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 30 09:23:05 UTC 2015

Modified Files:
src/sys/dev/pci [netbsd-7]: if_bge.c if_pcn.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #889):
sys/dev/pci/if_bge.c: revision 1.283
sys/dev/pci/if_pcn.c: revision 1.60
Fix mbuf leaks in error branches (found by the Brainy code scanner)


To generate a diff of this commit:
cvs rdiff -u -r1.277.2.2 -r1.277.2.3 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.58 -r1.58.2.1 src/sys/dev/pci/if_pcn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.277.2.2 src/sys/dev/pci/if_bge.c:1.277.2.3
--- src/sys/dev/pci/if_bge.c:1.277.2.2	Sat May  9 08:37:53 2015
+++ src/sys/dev/pci/if_bge.c	Thu Jul 30 09:23:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.277.2.2 2015/05/09 08:37:53 snj Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.277.2.3 2015/07/30 09:23:05 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.277.2.2 2015/05/09 08:37:53 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.277.2.3 2015/07/30 09:23:05 martin Exp $");
 
 #include 
 #include 
@@ -1744,8 +1744,10 @@ bge_newbuf_std(struct bge_softc *sc, int
 	if (!(sc->bge_flags & BGEF_RX_ALIGNBUG))
 	m_adj(m_new, ETHER_ALIGN);
 	if (bus_dmamap_load_mbuf(sc->bge_dmatag, dmamap, m_new,
-	BUS_DMA_READ|BUS_DMA_NOWAIT))
+	BUS_DMA_READ|BUS_DMA_NOWAIT)) {
+		m_freem(m_new);
 		return ENOBUFS;
+	}
 	bus_dmamap_sync(sc->bge_dmatag, dmamap, 0, dmamap->dm_mapsize,
 	BUS_DMASYNC_PREREAD);
 

Index: src/sys/dev/pci/if_pcn.c
diff -u src/sys/dev/pci/if_pcn.c:1.58 src/sys/dev/pci/if_pcn.c:1.58.2.1
--- src/sys/dev/pci/if_pcn.c:1.58	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/pci/if_pcn.c	Thu Jul 30 09:23:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_pcn.c,v 1.58 2014/08/10 16:44:36 tls Exp $	*/
+/*	$NetBSD: if_pcn.c,v 1.58.2.1 2015/07/30 09:23:05 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.58 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.58.2.1 2015/07/30 09:23:05 martin Exp $");
 
 #include 
 #include 
@@ -982,6 +982,7 @@ pcn_start(struct ifnet *ifp)
 printf("%s: unable to load Tx buffer, "
 "error = %d\n", device_xname(sc->sc_dev),
 error);
+m_freem(m);
 break;
 			}
 		}



CVS commit: [netbsd-7] src/sys/arch

2015-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 30 09:37:37 UTC 2015

Modified Files:
src/sys/arch/arm/broadcom [netbsd-7]: bcm2835_intr.c bcm2835_intr.h
bcm2835_obio.c bcm2835reg.h
src/sys/arch/arm/cortex [netbsd-7]: gic.c
src/sys/arch/arm/marvell [netbsd-7]: mvsoc_intr.h
src/sys/arch/arm/omap [netbsd-7]: omap4430_intr.h omap5430_intr.h
src/sys/arch/arm/pic [netbsd-7]: pic.c picvar.h
src/sys/arch/evbarm/rpi [netbsd-7]: rpi_machdep.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #890):
sys/arch/arm/pic/pic.c: revision 1.27-1.32
sys/arch/arm/omap/omap5430_intr.h: revision 1.3
sys/arch/arm/broadcom/bcm2835_obio.c: revision 1.25
sys/arch/arm/cortex/gic.c: revision 1.18
sys/arch/arm/broadcom/bcm2835reg.h: revision 1.15
sys/arch/evbarm/rpi/rpi_machdep.c: revision 1.61
sys/arch/arm/broadcom/bcm2835_intr.h: revision 1.2
sys/arch/arm/marvell/mvsoc_intr.h: revision 1.5
sys/arch/arm/broadcom/bcm2835_intr.c: revision 1.8-1.10
sys/arch/arm/pic/picvar.h: revision 1.12-1.14
sys/arch/arm/omap/omap4430_intr.h: revision 1.3

Don't clear CI_ASTPENDING in exception return, do it in ast() instead.
Add basic support for __HAVE_PREEMPTION.
Use atomic ops for ci_astpending if __HAVE_PREEMPTION is defined.
Use kpreempt_disable/kpreempt_enable
Add __HAVE_PIC_HAVE_PENDING_INTRS and define it if __HAVE_PIC_SET_PRIORITY
is undefined (also define in mvsoc_intr.h since their use of the latter is
peculiar).  This new define controls whether the pending interrupt logic is
compiled.  The GIC doesn't use pending interrupts since it uses the priority
level on the GIC to control delivery of interrupts, thus there can never
be a pending interrupt.  The kernel shrinks about 4KB with the removal of
the pending interupt support,
Only if we __HAVE_PIC_PENDING_INTRS do we need the variables to track them.
Add #define __HAVE_PIC_PENDING_INTRS for the non-GIC PICs.
Add a pic_cpus to the softc which specifies which cpus the pic can send
IPIs to.  For GIC, initialize pic_cpus to kcpuset_running since it can handle
all the cpus.
Adapt pic to deal with the BCM2836 interrupts.
Move pic_pending_pics, pic_pending_ipls, and pic_blocked_irqs into a
structure and make then per-cpu.  There is no global interrupt state anymore.
Use right kcpuset call.
Don't need pic_ipi_sender anymore.
Don't send IPIs to ourselves if sending to everyone.
RPI2 MP support.
Thanks to Matt Thomas for making this possible with his changes to pic.c
Use a bit per IPI type in local mailbox 0 registers. Ok matt@
IPIs should be IPL_HIGH according to rmind@
Fix bcm2836mp_pic_{un,}block_irqs to handle timer AND mailbox interrupts
if they're both passed.  Thanks to nat@ for finding this.
Sprinkle some KASSERTs


To generate a diff of this commit:
cvs rdiff -u -r1.3.12.2 -r1.3.12.3 src/sys/arch/arm/broadcom/bcm2835_intr.c
cvs rdiff -u -r1.1 -r1.1.18.1 src/sys/arch/arm/broadcom/bcm2835_intr.h
cvs rdiff -u -r1.20.2.2 -r1.20.2.3 src/sys/arch/arm/broadcom/bcm2835_obio.c
cvs rdiff -u -r1.10.12.3 -r1.10.12.4 src/sys/arch/arm/broadcom/bcm2835reg.h
cvs rdiff -u -r1.10.2.4 -r1.10.2.5 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/arch/arm/marvell/mvsoc_intr.h
cvs rdiff -u -r1.2 -r1.2.18.1 src/sys/arch/arm/omap/omap4430_intr.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/arch/arm/omap/omap5430_intr.h
cvs rdiff -u -r1.22.2.2 -r1.22.2.3 src/sys/arch/arm/pic/pic.c
cvs rdiff -u -r1.10.2.1 -r1.10.2.2 src/sys/arch/arm/pic/picvar.h
cvs rdiff -u -r1.43.2.4 -r1.43.2.5 src/sys/arch/evbarm/rpi/rpi_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.3.12.2 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.3.12.3
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.3.12.2	Wed Mar 11 20:22:55 2015
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Thu Jul 30 09:37:37 2015
@@ -1,7 +1,7 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.3.12.2 2015/03/11 20:22:55 snj Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.3.12.3 2015/07/30 09:37:37 martin Exp $	*/
 
 /*-
- * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * Copyright (c) 2012, 2015 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.3.12.2 2015/03/11 20:22:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.3.12.3 2015/07/30 09:37:37 martin Exp $");
 
 #define _INTR_PRIVATE
 
@@ -67,21 +67,12 @@ static int bcm2836mp_pic_find_pending_ir
 static void bcm2836mp_pic_establish_irq(struct pic_softc *, struct intrsource *);
 static void bcm2836mp_pic_source_name(struct pic_softc *, int, char *,
 size_t);
-#if 0
 #ifdef MULTIPROCESSOR
 int bc

CVS commit: [netbsd-7] src/sbin/disklabel

2015-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 30 09:45:24 UTC 2015

Modified Files:
src/sbin/disklabel [netbsd-7]: bswap.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #891):
sbin/disklabel/bswap.c: revision 1.3-1.4

Fix botch in "make disklabel a MI tool" changes in rev 1.2.

After that chanage, "MAXPARTITIONS" constant is not for the target port.
If host's MAXPARTITIONS is larger than a value of the target label and
target endianness is different from the build host, bswaplabel() could
overwrite data beyond the disklabel and primary boot stored after
LABELSECTOR in images might be corrupted.

This fixes boot failure of sun2 liveimage built by
"build.sh -U -m sun2 release live-image"
on TME.

Fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.6.1 src/sbin/disklabel/bswap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/disklabel/bswap.c
diff -u src/sbin/disklabel/bswap.c:1.2 src/sbin/disklabel/bswap.c:1.2.6.1
--- src/sbin/disklabel/bswap.c:1.2	Fri May  3 16:05:12 2013
+++ src/sbin/disklabel/bswap.c	Thu Jul 30 09:45:24 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: bswap.c,v 1.2 2013/05/03 16:05:12 matt Exp $	*/
+/*	$NetBSD: bswap.c,v 1.2.6.1 2015/07/30 09:45:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 2009 Izumi Tsutsui.  All rights reserved.
@@ -74,7 +74,7 @@
 static void
 bswaplabel(struct disklabel *nlp, const struct disklabel *olp)
 {
-	int i;
+	u_int i;
 
 	nlp->d_magic  = bswap32(olp->d_magic);
 	nlp->d_type   = bswap16(olp->d_type);
@@ -120,7 +120,7 @@ bswaplabel(struct disklabel *nlp, const 
 	nlp->d_bbsize = bswap32(olp->d_bbsize);
 	nlp->d_sbsize = bswap32(olp->d_sbsize);
 
-	for (i = 0; i < MAXPARTITIONS; i++) {
+	for (i = 0; i < maxpartitions; i++) {
 		nlp->d_partitions[i].p_size =
 		bswap32(olp->d_partitions[i].p_size);
 		nlp->d_partitions[i].p_offset =



CVS commit: src/sys

2015-07-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jul 30 09:55:57 UTC 2015

Modified Files:
src/sys/compat/netbsd32: netbsd32_netbsd.c
src/sys/uvm: uvm_swap.c uvm_swap.h

Log Message:
Lock before calling uvm_swap_stats(). Otherwise a race condition could
corrupt memory.


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.172 -r1.173 src/sys/uvm/uvm_swap.c
cvs rdiff -u -r1.20 -r1.21 src/sys/uvm/uvm_swap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.196 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.197
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.196	Sun Jun 21 12:54:33 2015
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Thu Jul 30 09:55:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.196 2015/06/21 12:54:33 martin Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.197 2015/07/30 09:55:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.196 2015/06/21 12:54:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.197 2015/07/30 09:55:57 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1747,11 +1747,16 @@ netbsd32_swapctl_stats(struct lwp *l, st
 
 	if (count < 0)
 		return EINVAL;
-	if (count == 0 || uvmexp.nswapdev == 0)
-		return 0;
-	/* Make sure userland cannot exhaust kernel memory */
+
+	swapsys_lock(RW_WRITER);
+
 	if ((size_t)count > (size_t)uvmexp.nswapdev)
 		count = uvmexp.nswapdev;
+	if (count == 0) {
+		/* No swap device */
+		swapsys_unlock();
+		return 0;
+	}
 
 	ksep_len = sizeof(*ksep) * count;
 	ksep = kmem_alloc(ksep_len, KM_SLEEP);
@@ -1760,6 +1765,8 @@ netbsd32_swapctl_stats(struct lwp *l, st
 	uvm_swap_stats(SWAP_STATS, ksep, count, retval);
 	count = *retval;
 
+	swapsys_unlock();
+
 	for (i = 0; i < count; i++) {
 		se32.se_dev = ksep[i].se_dev;
 		se32.se_flags = ksep[i].se_flags;

Index: src/sys/uvm/uvm_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.172 src/sys/uvm/uvm_swap.c:1.173
--- src/sys/uvm/uvm_swap.c:1.172	Fri Jul 25 08:10:40 2014
+++ src/sys/uvm/uvm_swap.c	Thu Jul 30 09:55:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.c,v 1.172 2014/07/25 08:10:40 dholland Exp $	*/
+/*	$NetBSD: uvm_swap.c,v 1.173 2015/07/30 09:55:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.172 2014/07/25 08:10:40 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.173 2015/07/30 09:55:57 maxv Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_compat_netbsd.h"
@@ -430,6 +430,15 @@ swapdrum_getsdp(int pgno)
 	return NULL;
 }
 
+void swapsys_lock(krw_t op)
+{
+	rw_enter(&swap_syscall_lock, op);
+}
+
+void swapsys_unlock(void)
+{
+	rw_exit(&swap_syscall_lock);
+}
 
 /*
  * sys_swapctl: main entry point for swapctl(2) system call
@@ -741,6 +750,8 @@ uvm_swap_stats(int cmd, struct swapent *
 	struct swapdev *sdp;
 	int count = 0;
 
+	KASSERT(rw_lock_held(&swap_syscall_lock));
+
 	LIST_FOREACH(spp, &swap_priority, spi_swappri) {
 		TAILQ_FOREACH(sdp, &spp->spi_swapdev, swd_next) {
 			int inuse;

Index: src/sys/uvm/uvm_swap.h
diff -u src/sys/uvm/uvm_swap.h:1.20 src/sys/uvm/uvm_swap.h:1.21
--- src/sys/uvm/uvm_swap.h:1.20	Mon Feb  3 13:20:21 2014
+++ src/sys/uvm/uvm_swap.h	Thu Jul 30 09:55:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.h,v 1.20 2014/02/03 13:20:21 manu Exp $	*/
+/*	$NetBSD: uvm_swap.h,v 1.21 2015/07/30 09:55:57 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Matthew R. Green
@@ -48,7 +48,10 @@ int	uvm_swap_alloc(int *, bool);
 void	uvm_swap_free(int, int);
 void	uvm_swap_markbad(int, int);
 bool	uvm_swapisfull(void);
+void	swapsys_lock(krw_t);
+void	swapsys_unlock(void);
 void	uvm_swap_stats(int, struct swapent *, int, register_t *);
+
 #else /* defined(VMSWAP) */
 #define	uvm_swapisfull()	true
 #define uvm_swap_stats(c, sep, count, retval) { *retval = 0; }



CVS commit: [netbsd-7] src/sys/arch/macppc/stand/ofwboot

2015-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 30 10:22:12 UTC 2015

Modified Files:
src/sys/arch/macppc/stand/ofwboot [netbsd-7]: Locore.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #893):
sys/arch/macppc/stand/ofwboot/Locore.c: revision 1.26
Don't set garbages into BAT registers, which was broken in rev 1.25.
Should fix PR port-macppc/50018 (though there is no response for 3 weeks),
and should be pulled up to netbsd-7.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/arch/macppc/stand/ofwboot/Locore.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/macppc/stand/ofwboot/Locore.c
diff -u src/sys/arch/macppc/stand/ofwboot/Locore.c:1.25 src/sys/arch/macppc/stand/ofwboot/Locore.c:1.25.4.1
--- src/sys/arch/macppc/stand/ofwboot/Locore.c:1.25	Wed Feb 26 21:42:40 2014
+++ src/sys/arch/macppc/stand/ofwboot/Locore.c	Thu Jul 30 10:22:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.25 2014/02/26 21:42:40 macallan Exp $	*/
+/*	$NetBSD: Locore.c,v 1.25.4.1 2015/07/30 10:22:12 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -75,6 +75,7 @@ __asm(
 "   cmpi0,1,%r0,0x02  	\n" /* 601 CPU = 0x0001 */
 "   blt 1f		\n" /* skip over non-601 BAT setup */
 	/*non PPC 601 BATs*/
+"	li	%r0,0		\n"
 "	mtibatu	0,%r0		\n"
 "	mtibatu	1,%r0		\n"
 "	mtibatu	2,%r0		\n"
@@ -93,7 +94,8 @@ __asm(
 "	b 2f			\n"
 
 	/* PPC 601 BATs*/
-"1:	mtibatu	0,%r0		\n"
+"1:	li	%r0,0		\n"
+"	mtibatu	0,%r0		\n"
 "  	mtibatu 1,%r0   \n"
 "  	mtibatu 2,%r0   \n"
 "  	mtibatu 3,%r0   \n"



CVS commit: [netbsd-7] src/doc

2015-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 30 10:23:25 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
Tickets #888, 889, 890, 891 and 893


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.348 -r1.1.2.349 src/doc/CHANGES-7.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.348 src/doc/CHANGES-7.0:1.1.2.349
--- src/doc/CHANGES-7.0:1.1.2.348	Fri Jul 24 07:32:50 2015
+++ src/doc/CHANGES-7.0	Thu Jul 30 10:23:24 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.348 2015/07/24 07:32:50 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.349 2015/07/30 10:23:24 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -33448,3 +33448,77 @@ sys/netinet/tcp_output.c			1.184
 	Make sure that snd_win doesn't go negative.
 	[matt, ticket #886]
 
+xsrc/external/mit/libXi/dist/ChangeLog			1.1.1.11
+xsrc/external/mit/libXi/dist/configure			1.1.1.11
+xsrc/external/mit/libXi/dist/configure.ac		1.1.1.11
+xsrc/external/mit/libXi/dist/src/XIAllowEvents.c	1.1.1.4
+xsrc/external/mit/libXi/dist/src/XIPassiveGrab.c	1.1.1.7
+
+	Update libXi to 1.7.4.
+	[mrg, ticket #888]
+
+sys/dev/pci/if_bge.c1.283
+sys/dev/pci/if_pcn.c1.60
+
+	Fix mbuf leaks in error branches (found by the Brainy code scanner)
+	[maxv, ticket #889]
+
+sys/arch/arm/broadcom/bcm2835_intr.c		1.8-1.10
+sys/arch/arm/broadcom/bcm2835_intr.h		1.2
+sys/arch/arm/broadcom/bcm2835_obio.c		1.25
+sys/arch/arm/broadcom/bcm2835reg.h		1.15
+sys/arch/arm/cortex/gic.c			1.18
+sys/arch/arm/marvell/mvsoc_intr.h		1.5
+sys/arch/arm/omap/omap4430_intr.h		1.3
+sys/arch/arm/omap/omap5430_intr.h		1.3
+sys/arch/arm/pic/pic.c1.27-1.32
+sys/arch/arm/pic/picvar.h			1.12-1.14
+sys/arch/evbarm/rpi/rpi_machdep.c		1.61
+
+	Add basic support for __HAVE_PREEMPTION.
+
+	Remove the "pending interrupts" code from the kernel if
+	possible, which shrinks the kernel about 4KB.
+
+	Add a pic_cpus to the softc which specifies which cpus the pic can
+	send IPIs to.  For GIC, initialize pic_cpus to kcpuset_running since
+	it can handle all the cpus.
+
+	Adapt pic to deal with the BCM2836 interrupts.
+	Move pic_pending_pics, pic_pending_ipls, and pic_blocked_irqs into a
+	structure and make then per-cpu.
+	There is no global interrupt state anymore.
+
+	RPI2 MP support.
+
+	Use a bit per IPI type in local mailbox 0 registers.
+
+	IPIs should be IPL_HIGH according to rmind@
+
+	Fix bcm2836mp_pic_{un,}block_irqs to handle timer AND mailbox interrupts
+	if they're both passed.  Thanks to nat@ for finding this.
+
+	Sprinkle some KASSERTs
+	[skrll, ticket #890]
+
+sbin/disklabel/bswap.c1.3-1.4
+
+	Fix botch in "make disklabel a MI tool" changes in rev 1.2.
+
+	After that chanage, "MAXPARTITIONS" constant is not for the target
+	port.
+	If host's MAXPARTITIONS is larger than a value of the target label and
+	target endianness is different from the build host, bswaplabel() could
+	overwrite data beyond the disklabel and primary boot stored after
+	LABELSECTOR in images might be corrupted.
+
+	This fixes boot failure of sun2 liveimage built by
+	"build.sh -U -m sun2 release live-image"
+	on TME.
+	[tsutsui, ticket #891]
+
+sys/arch/macppc/stand/ofwboot/Locore.c		1.26
+
+	Fix rev 1.25, which caused garbage to be written into BAT registers.
+	[tsutsui, ticket #893]
+



CVS commit: src/sys/modules/compat_netbsd32

2015-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 30 10:26:14 UTC 2015

Modified Files:
src/sys/modules/compat_netbsd32: Makefile

Log Message:
Add VMSWAP


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/modules/compat_netbsd32/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/modules/compat_netbsd32/Makefile
diff -u src/sys/modules/compat_netbsd32/Makefile:1.13 src/sys/modules/compat_netbsd32/Makefile:1.14
--- src/sys/modules/compat_netbsd32/Makefile:1.13	Sun May 10 02:33:28 2015
+++ src/sys/modules/compat_netbsd32/Makefile	Thu Jul 30 06:26:14 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.13 2015/05/10 06:33:28 matt Exp $
+#	$NetBSD: Makefile,v 1.14 2015/07/30 10:26:14 christos Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -20,7 +20,7 @@ CPPFLAGS+=	-DCOMPAT_60 -DCOMPAT_70 -DCOM
 CPPFLAGS+=	-DCOMPAT_43
 CPPFLAGS+=	-DSYSVSHM -DSYSVSEM -DSYSVMSG -DCOMPAT_NETBSD32
 CPPFLAGS+=	-DEXEC_ELF32 -DEXEC_ELF64
-CPPFLAGS+=	-DCOREDUMP -DNTP
+CPPFLAGS+=	-DCOREDUMP -DNTP -DVMSWAP
 
 .PATH:	${S}/compat/netbsd32
 SRCS+=	netbsd32_compat_09.c netbsd32_compat_10.c



CVS commit: src/sys/uvm

2015-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 30 10:25:49 UTC 2015

Modified Files:
src/sys/uvm: uvm_swap.h

Log Message:
include decls for _MODULE


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/uvm/uvm_swap.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/uvm/uvm_swap.h
diff -u src/sys/uvm/uvm_swap.h:1.21 src/sys/uvm/uvm_swap.h:1.22
--- src/sys/uvm/uvm_swap.h:1.21	Thu Jul 30 05:55:57 2015
+++ src/sys/uvm/uvm_swap.h	Thu Jul 30 06:25:49 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_swap.h,v 1.21 2015/07/30 09:55:57 maxv Exp $	*/
+/*	$NetBSD: uvm_swap.h,v 1.22 2015/07/30 10:25:49 christos Exp $	*/
 
 /*
  * Copyright (c) 1997 Matthew R. Green
@@ -33,7 +33,7 @@
 
 #define	SWSLOT_BAD	(-1)
 
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_MODULE)
 #if defined(_KERNEL_OPT)
 #include "opt_vmswap.h"
 #endif
@@ -58,6 +58,6 @@ void	uvm_swap_stats(int, struct swapent 
 #endif /* defined(VMSWAP) */
 void	uvm_swap_shutdown(struct lwp *);
 
-#endif /* _KERNEL */
+#endif /* _KERNEL || _MODULE */
 
 #endif /* _UVM_UVM_SWAP_H_ */



CVS commit: src/sys/dev/sdmmc

2015-07-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Jul 30 15:03:14 UTC 2015

Modified Files:
src/sys/dev/sdmmc: sdhc.c

Log Message:
print "platform DMA" instead of "SDMA" when using external DMA engine


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/sdmmc/sdhc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sdmmc/sdhc.c
diff -u src/sys/dev/sdmmc/sdhc.c:1.63 src/sys/dev/sdmmc/sdhc.c:1.64
--- src/sys/dev/sdmmc/sdhc.c:1.63	Wed Jul 29 12:11:13 2015
+++ src/sys/dev/sdmmc/sdhc.c	Thu Jul 30 15:03:14 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc.c,v 1.63 2015/07/29 12:11:13 jmcneill Exp $	*/
+/*	$NetBSD: sdhc.c,v 1.64 2015/07/30 15:03:14 jmcneill Exp $	*/
 /*	$OpenBSD: sdhc.c,v 1.25 2009/01/13 19:44:20 grange Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.63 2015/07/29 12:11:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc.c,v 1.64 2015/07/30 15:03:14 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -351,7 +351,11 @@ sdhc_host_found(struct sdhc_softc *sc, b
 			if (!ISSET(sc->sc_flags, SDHC_FLAG_EXTERNAL_DMA) ||
 			ISSET(sc->sc_flags, SDHC_FLAG_EXTDMA_DMAEN))
 SET(hp->flags, SHF_MODE_DMAEN);
-			aprint_normal(", SDMA");
+			if (sc->sc_vendor_transfer_data_dma) {
+aprint_normal(", platform DMA");
+			} else {
+aprint_normal(", SDMA");
+			}
 		}
 	} else {
 		aprint_normal(", PIO");



CVS commit: [netbsd-7] src/sys/dev/pci

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:19:07 UTC 2015

Modified Files:
src/sys/dev/pci [netbsd-7]: oboe.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #887):
sys/dev/pci/oboe.c: revision 1.43
Pass the device, not the struct softc to config_found().
Avoids a crash at attach time, PR port-i386/50076.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/dev/pci/oboe.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/oboe.c
diff -u src/sys/dev/pci/oboe.c:1.42 src/sys/dev/pci/oboe.c:1.42.4.1
--- src/sys/dev/pci/oboe.c:1.42	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/oboe.c	Thu Jul 30 15:19:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: oboe.c,v 1.42 2014/03/29 19:28:25 christos Exp $	*/
+/*	$NetBSD: oboe.c,v 1.42.4.1 2015/07/30 15:19:07 snj Exp $	*/
 
 /*	FVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.42 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.42.4.1 2015/07/30 15:19:07 snj Exp $");
 
 #include 
 #include 
@@ -238,7 +238,7 @@ oboe_attach(device_t parent, device_t se
 
 	oboe_alloc_taskfile(sc);
 
-	sc->sc_child = config_found((void *)sc, &ia, ir_print);
+	sc->sc_child = config_found(self, &ia, ir_print);
 }
 
 static int



CVS commit: [netbsd-7] src/sys/external/bsd/drm2/dist/drm/i915

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:21:50 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-7]: intel_pm.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #892):
sys/external/bsd/drm2/dist/drm/i915/intel_pm.c: revision 1.7
Avoid NULL dev_priv->vlv_pctx-> deref in a WARN check on Lenovo B50-30,
add an additional check for the NULL dev_priv->vlv_pctx.
System now boots (though does not recognise any of the USB(3) ports)


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.4.2.2 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.4.2.3
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c:1.4.2.2	Fri Mar  6 21:39:08 2015
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	Thu Jul 30 15:21:50 2015
@@ -3625,6 +3625,8 @@ static void valleyview_check_pctx(struct
 {
 	unsigned long pctx_addr = I915_READ(VLV_PCBR) & ~4095;
 
+	if (WARN_ON(!dev_priv->vlv_pctx))
+		return;
 	WARN_ON(pctx_addr != dev_priv->mm.stolen_base +
 			 dev_priv->vlv_pctx->stolen->start);
 }



CVS commit: src/sys

2015-07-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Jul 30 15:28:18 UTC 2015

Modified Files:
src/sys/kern: exec_elf.c kern_pax.c
src/sys/sys: exec_elf.h pax.h

Log Message:
Revamp PaX:
 - don't confuse between ELF flags and proc flags. Introduce the proc-
   specific P_PAX_ASLR, P_PAX_MPROTECT and P_PAX_GUARD flags.
 - introduce pax_setup_elf_flags(), which takes as argument the PaX flag
   of the ELF PaX note section, and which sets the proc flag as
   appropriate. Also introduce a couple of other functions used for that
   purpose.
 - modify pax_aslr_active(), and all the other similar pieces of code, so
   that it checks the proc flag directly, without extra ELF computation

In addition to making PaX clearer, the combination of these changes fixes
the following bug: if a non-PaX'ed process is launched, and then someone
sets security.pax.{aslr,mprotect,segvguard}.global=1, the process becomes
PaX'ed while its address space hasn't been randomized, which is not likely
to be a good idea.

Now, only the proc flag is checked at runtime, which means the process's
PaX status won't be altered during the execution.

Also:
 - declare PAX_DPRINTF, makes it more readable
 - fix a typo in exec_elf.h


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/kern/exec_elf.c
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/kern_pax.c
cvs rdiff -u -r1.148 -r1.149 src/sys/sys/exec_elf.h
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/pax.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.72 src/sys/kern/exec_elf.c:1.73
--- src/sys/kern/exec_elf.c:1.72	Mon Apr 27 09:19:58 2015
+++ src/sys/kern/exec_elf.c	Thu Jul 30 15:28:18 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.72 2015/04/27 09:19:58 maxv Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.73 2015/07/30 15:28:18 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.72 2015/04/27 09:19:58 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.73 2015/07/30 15:28:18 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -715,7 +715,7 @@ exec_elf_makecmds(struct lwp *l, struct 
 	}
 
 #if defined(PAX_MPROTECT) || defined(PAX_SEGVGUARD) || defined(PAX_ASLR)
-	l->l_proc->p_pax = epp->ep_pax_flags;
+	pax_setup_elf_flags(l, epp->ep_pax_flags);
 #endif /* PAX_MPROTECT || PAX_SEGVGUARD || PAX_ASLR */
 
 	if (is_dyn)

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.28 src/sys/kern/kern_pax.c:1.29
--- src/sys/kern/kern_pax.c:1.28	Mon Apr 13 16:36:12 2015
+++ src/sys/kern/kern_pax.c	Thu Jul 30 15:28:18 2015
@@ -1,6 +1,35 @@
-/*	$NetBSD: kern_pax.c,v 1.28 2015/04/13 16:36:12 riastradh Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.29 2015/07/30 15:28:18 maxv Exp $	*/
 
-/*-
+/*
+ * Copyright (c) 2015 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Maxime Villard.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
  * Copyright (c) 2006 Elad Efrat 
  * All rights reserved.
  *
@@ -28,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.28 2015/04/13 16:36:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.29 2015/07/30 15:28:18 maxv Exp $");
 
 #include "opt_pax.h"
 
@@ -45,6 +74,12 @@ __KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v
 #include 
 #include 
 
+#ifdef PAX_ASLR_DEBUG
+#define PAX_DPRINTF(_fmt, args...)	uprintf("%s: " _fmt "\n", __func__, ##args)
+#else
+#define PAX_DPRINTF(_fmt, args...)	do {} while (/*CONSTC

CVS commit: [netbsd-7] src/sys/external/bsd/drm2/ttm

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:29:25 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/ttm [netbsd-7]: ttm_bo_vm.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #894):
sys/external/bsd/drm2/ttm/ttm_bo_vm.c: revisions 1.9, 1.10
Fix error branch: ttm_bo_unreserve on failure after ttm_bo_reserve.
Tiny chance this will fix PR kern/49862 by not leaking a ww_mutex
lock.
--
ttm_bo_unreserve in case of ttm_bo_uvm_fault_idle restart.
Better chance of fixing PR kern/49862 by avoiding leaking a buffer
ww_mutex lock.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.5 -r1.2.4.6 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.2.4.5 src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.2.4.6
--- src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c:1.2.4.5	Fri Nov 14 14:22:41 2014
+++ src/sys/external/bsd/drm2/ttm/ttm_bo_vm.c	Thu Jul 30 15:29:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bo_vm.c,v 1.2.4.5 2014/11/14 14:22:41 martin Exp $	*/
+/*	$NetBSD: ttm_bo_vm.c,v 1.2.4.6 2015/07/30 15:29:25 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.2.4.5 2014/11/14 14:22:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bo_vm.c,v 1.2.4.6 2015/07/30 15:29:25 snj Exp $");
 
 #include 
 
@@ -118,7 +118,7 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 	/* drm prime buffers are not mappable.  XXX Catch this earlier?  */
 	if (bo->ttm && ISSET(bo->ttm->page_flags, TTM_PAGE_FLAG_SG)) {
 		ret = -EINVAL;
-		goto out0;
+		goto out1;
 	}
 
 	/* Notify the driver of a fault if it wants.  */
@@ -127,14 +127,15 @@ ttm_bo_uvm_fault(struct uvm_faultinfo *u
 		if (ret) {
 			if (ret == -ERESTART)
 ret = -EIO;
-			goto out0;
+			goto out1;
 		}
 	}
 
 	ret = ttm_bo_uvm_fault_idle(bo, ufi);
 	if (ret) {
-		/* Unlocks if it restarts.  */
 		KASSERT(ret == -ERESTART);
+		/* ttm_bo_uvm_fault_idle calls uvmfault_unlockall for us.  */
+		ttm_bo_unreserve(bo);
 		/* XXX errno Linux->NetBSD */
 		return -ret;
 	}



CVS commit: src/sys/lib/libkern/arch/m68k

2015-07-30 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jul 30 15:29:52 UTC 2015

Modified Files:
src/sys/lib/libkern/arch/m68k: Makefile.inc

Log Message:
Revert untested and unnecessary change in previous rev 1.36.

Our autobuild doesn't always reflect the latest fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/lib/libkern/arch/m68k/Makefile.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libkern/arch/m68k/Makefile.inc
diff -u src/sys/lib/libkern/arch/m68k/Makefile.inc:1.36 src/sys/lib/libkern/arch/m68k/Makefile.inc:1.37
--- src/sys/lib/libkern/arch/m68k/Makefile.inc:1.36	Thu Jul 30 07:44:40 2015
+++ src/sys/lib/libkern/arch/m68k/Makefile.inc	Thu Jul 30 15:29:52 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.36 2015/07/30 07:44:40 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.37 2015/07/30 15:29:52 tsutsui Exp $
 
 SRCS+=	bswap16.S bswap32.S bswap64.S
 SRCS+=	memcmp.S memcpy.S memmove.S memset.S
@@ -12,7 +12,7 @@ SRCS+=	ffs.S
 SRCS+=	mulsi3.S divsi3.S udivsi3.S modsi3.S umodsi3.S
 .endif
 .if defined(MACHINE_ARCH) && ${MACHINE_ARCH} == "m68k"
-SRCS+=	mulsi3.S random.S
+SRCS+=	random.S
 .else
 random.o random.po random.pico random.d: random.c
 .endif



CVS commit: [netbsd-7] src/sys/external/bsd/drm2/dist/drm/radeon

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:32:46 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon [netbsd-7]:
radeon_connectors.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #897):
sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c: revisions 
1.2, 1.3
Don't pass along null encoder.  Noted by Coverity, CID 113253.
--
Add XXX comment for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.4.1 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c:1.1.1.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c:1.1.1.1.4.1
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c:1.1.1.1	Wed Jul 16 19:35:28 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c	Thu Jul 30 15:32:46 2015
@@ -822,7 +822,8 @@ radeon_vga_detect(struct drm_connector *
 		}
 	}
 
-	if (ret == connector_status_connected)
+	/* XXX Can encoder be null if the connector is connected here?  */
+	if (ret == connector_status_connected && encoder)
 		ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true);
 
 	/* RN50 and some RV100 asics in servers often have a hardcoded EDID in the



CVS commit: [netbsd-7] src

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:36:03 UTC 2015

Modified Files:
src/sbin/newfs [netbsd-7]: newfs.c
src/usr.sbin/installboot [netbsd-7]: installboot.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #900):
sbin/newfs/newfs.c: revision 1.113
usr.sbin/installboot/installboot.c: revision 1.39
Handle getfsspecname errors.


To generate a diff of this commit:
cvs rdiff -u -r1.111.10.1 -r1.111.10.2 src/sbin/newfs/newfs.c
cvs rdiff -u -r1.36.18.1 -r1.36.18.2 src/usr.sbin/installboot/installboot.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.111.10.1 src/sbin/newfs/newfs.c:1.111.10.2
--- src/sbin/newfs/newfs.c:1.111.10.1	Tue Nov 11 10:21:25 2014
+++ src/sbin/newfs/newfs.c	Thu Jul 30 15:36:03 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.111.10.1 2014/11/11 10:21:25 martin Exp $	*/
+/*	$NetBSD: newfs.c,v 1.111.10.2 2015/07/30 15:36:03 snj Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.111.10.1 2014/11/11 10:21:25 martin Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.111.10.2 2015/07/30 15:36:03 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -493,9 +493,11 @@ main(int argc, char *argv[])
 fso = fsi;
 		}
 	} else {	/* !Fflag && !mfs */
-		special = getfsspecname(specname, sizeof(specname), special);
-		raw = getdiskrawname(rawname, sizeof(rawname), special);
-		if (raw != NULL)
+		raw = getfsspecname(specname, sizeof(specname), special);
+		if (raw == NULL)
+			err(1, "%s: %s", special, specname);
+		special = getdiskrawname(rawname, sizeof(rawname), raw);
+		if (special == NULL)
 			special = raw;
 
 		fsi = opendisk(special, O_RDONLY, device, sizeof(device), 0);

Index: src/usr.sbin/installboot/installboot.c
diff -u src/usr.sbin/installboot/installboot.c:1.36.18.1 src/usr.sbin/installboot/installboot.c:1.36.18.2
--- src/usr.sbin/installboot/installboot.c:1.36.18.1	Thu Jul 16 21:36:59 2015
+++ src/usr.sbin/installboot/installboot.c	Thu Jul 30 15:36:03 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.36.18.1 2015/07/16 21:36:59 snj Exp $	*/
+/*	$NetBSD: installboot.c,v 1.36.18.2 2015/07/30 15:36:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: installboot.c,v 1.36.18.1 2015/07/16 21:36:59 snj Exp $");
+__RCSID("$NetBSD: installboot.c,v 1.36.18.2 2015/07/30 15:36:03 snj Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -240,6 +240,8 @@ main(int argc, char *argv[])
 
 #if !HAVE_NBTOOL_CONFIG_H
 	special = getfsspecname(specname, sizeof(specname), argv[0]);
+	if (special == NULL)
+		err(1, "%s: %s", argv[0], specname);
 	raw = getdiskrawname(rawname, sizeof(rawname), special);
 	if (raw != NULL)
 		special = raw;



CVS commit: [netbsd-7] src/sys/external/bsd/drm2/dist/drm/i915

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:38:39 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-7]: i915_gem.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #901):
sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: revision 1.30
Remove workaround for PR kern/49195.
Problem seems to have been properly fixed in rev. 1.25.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.9 -r1.14.2.10 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.14.2.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.14.2.10
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.14.2.9	Sun Jul  5 21:31:48 2015
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Thu Jul 30 15:38:39 2015
@@ -2815,21 +2815,10 @@ void i915_vma_move_to_active(struct i915
 static void
 i915_gem_object_move_to_inactive(struct drm_i915_gem_object *obj)
 {
-	struct drm_device *dev = obj->base.dev;
-	struct drm_i915_private *dev_priv = dev->dev_private;
+	struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
 	struct i915_address_space *vm;
 	struct i915_vma *vma;
 
-	if ((obj->base.write_domain & I915_GEM_DOMAIN_GTT) != 0) {
-		printk(KERN_ERR "%s: %p 0x%x flushing gtt\n", __func__, obj,
-			obj->base.write_domain);
-		i915_gem_object_flush_gtt_write_domain(obj);
-	}
-	if ((obj->base.write_domain & I915_GEM_DOMAIN_CPU) != 0) {
-		printk(KERN_ERR "%s: %p 0x%x flushing cpu\n", __func__, obj,
-			obj->base.write_domain);
-		i915_gem_object_flush_cpu_write_domain(obj, false);
-	}
 	BUG_ON(obj->base.write_domain & ~I915_GEM_GPU_DOMAINS);
 	BUG_ON(!obj->active);
 



CVS commit: [netbsd-7] src/distrib/common/bootimage

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:40:14 UTC 2015

Modified Files:
src/distrib/common/bootimage [netbsd-7]: Makefile.bootimage

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #902):
distrib/common/bootimage/Makefile.bootimage: revision 1.11
Fix ytpo: INSTALLBOOTOPTIONS, not INSTALLBOOTOPTOINS.
>From qjsgkem on Freenode.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.9.2.1 src/distrib/common/bootimage/Makefile.bootimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/common/bootimage/Makefile.bootimage
diff -u src/distrib/common/bootimage/Makefile.bootimage:1.9 src/distrib/common/bootimage/Makefile.bootimage:1.9.2.1
--- src/distrib/common/bootimage/Makefile.bootimage:1.9	Tue Aug  5 15:40:58 2014
+++ src/distrib/common/bootimage/Makefile.bootimage	Thu Jul 30 15:40:14 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.bootimage,v 1.9 2014/08/05 15:40:58 apb Exp $
+#	$NetBSD: Makefile.bootimage,v 1.9.2.1 2015/07/30 15:40:14 snj Exp $
 #
 # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui.  All rights reserved.
 #
@@ -381,7 +381,7 @@ ${IMGBASE}.img:	${TARGETFS} ${WORKLABEL}
 .endif
 	${TOOL_DISKLABEL} -R -F ${WORKIMG} ${WORKLABEL}
 .if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} != "no"
-	${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTOINS} ${WORKIMG} \
+	${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKIMG} \
 	${WORKDIR}/usr/mdec/${PRIMARY_BOOT}
 .endif
 	mv ${WORKIMG} ${.TARGET}



CVS commit: [netbsd-7] src/sys/external/bsd/drm2/ttm

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:41:44 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/ttm [netbsd-7]: ttm_agp_backend.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #903):
sys/external/bsd/drm2/ttm/ttm_agp_backend.c: revision 1.4
kmem_free the container structure, not a substructure.


To generate a diff of this commit:
cvs rdiff -u -r1.1.4.1 -r1.1.4.2 \
src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c:1.1.4.1 src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c:1.1.4.2
--- src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c:1.1.4.1	Fri Aug 15 11:11:59 2014
+++ src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c	Thu Jul 30 15:41:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_agp_backend.c,v 1.1.4.1 2014/08/15 11:11:59 martin Exp $	*/
+/*	$NetBSD: ttm_agp_backend.c,v 1.1.4.2 2015/07/30 15:41:44 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_agp_backend.c,v 1.1.4.1 2014/08/15 11:11:59 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_agp_backend.c,v 1.1.4.2 2015/07/30 15:41:44 snj Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ ttm_agp_destroy(struct ttm_tt *ttm)
 	if (ttm_agp->bound)
 		ttm_agp_unbind(ttm);
 	ttm_tt_fini(ttm);
-	kmem_free(ttm, sizeof(*ttm));
+	kmem_free(ttm_agp, sizeof(*ttm_agp));
 }
 
 static const struct ttm_backend_func ttm_agp_backend_func = {



CVS commit: [netbsd-7] src/sys/external/bsd/drm2

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:43:37 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm [netbsd-7]: drm_bufs.c
src/sys/external/bsd/drm2/dist/include/drm [netbsd-7]: drmP.h
src/sys/external/bsd/drm2/drm [netbsd-7]: drm_memory.c
src/sys/external/bsd/drm2/pci [netbsd-7]: drm_pci.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #904):
sys/external/bsd/drm2/dist/drm/drm_bufs.c: revision 1.7
sys/external/bsd/drm2/dist/include/drm/drmP.h: revision 1.11
sys/external/bsd/drm2/drm/drm_memory.c: revision 1.7
sys/external/bsd/drm2/pci/drm_pci.c: revision 1.13
Replace drm_ioremap by drm_core_ioremap, reducing diff a little.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 \
src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/external/bsd/drm2/drm/drm_memory.c
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/external/bsd/drm2/pci/drm_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_bufs.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.6 src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.6.2.1
--- src/sys/external/bsd/drm2/dist/drm/drm_bufs.c:1.6	Wed Jul 16 20:56:24 2014
+++ src/sys/external/bsd/drm2/dist/drm/drm_bufs.c	Thu Jul 30 15:43:36 2015
@@ -213,7 +213,7 @@ static int drm_addmap_core(struct drm_de
 		}
 		if (map->type == _DRM_REGISTERS) {
 #ifdef __NetBSD__
-			map->handle = drm_ioremap(dev, map);
+			drm_core_ioremap(map, dev);
 #else
 			if (map->flags & _DRM_WRITE_COMBINING)
 map->handle = ioremap_wc(map->offset,
@@ -351,7 +351,7 @@ static int drm_addmap_core(struct drm_de
 	if (!list) {
 		if (map->type == _DRM_REGISTERS)
 #ifdef __NetBSD__
-			drm_iounmap(dev, map);
+			drm_core_ioremapfree(map, dev);
 #else
 			iounmap(map->handle);
 #endif
@@ -372,7 +372,7 @@ static int drm_addmap_core(struct drm_de
 	if (ret) {
 		if (map->type == _DRM_REGISTERS)
 #ifdef __NetBSD__		/* XXX What about other map types...?  */
-			drm_iounmap(dev, map);
+			drm_core_ioremapfree(map, dev);
 #else
 			iounmap(map->handle);
 #endif
@@ -494,7 +494,7 @@ int drm_rmmap_locked(struct drm_device *
 	switch (map->type) {
 	case _DRM_REGISTERS:
 #ifdef __NetBSD__
-		drm_iounmap(dev, map);
+		drm_core_ioremapfree(map, dev);
 #else
 		iounmap(map->handle);
 #endif

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.7.2.2 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.7.2.3
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.7.2.2	Fri Mar  6 21:39:10 2015
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Thu Jul 30 15:43:37 2015
@@ -1437,9 +1437,7 @@ extern unsigned int drm_poll(struct file
 
 /* Memory management support (drm_memory.h) */
 #include 
-#ifdef __NetBSD__		/* XXX move to drm_memory.h */
-extern void *drm_ioremap(struct drm_device *dev, struct drm_local_map *map);
-extern void drm_iounmap(struct drm_device *dev, struct drm_local_map *map);
+#ifdef __NetBSD__
 extern int drm_limit_dma_space(struct drm_device *, resource_size_t,
 resource_size_t);
 #endif

Index: src/sys/external/bsd/drm2/drm/drm_memory.c
diff -u src/sys/external/bsd/drm2/drm/drm_memory.c:1.6 src/sys/external/bsd/drm2/drm/drm_memory.c:1.6.2.1
--- src/sys/external/bsd/drm2/drm/drm_memory.c:1.6	Wed Jul 16 20:56:25 2014
+++ src/sys/external/bsd/drm2/drm/drm_memory.c	Thu Jul 30 15:43:37 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_memory.c,v 1.6 2014/07/16 20:56:25 riastradh Exp $	*/
+/*	$NetBSD: drm_memory.c,v 1.6.2.1 2015/07/30 15:43:37 snj Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_memory.c,v 1.6 2014/07/16 20:56:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_memory.c,v 1.6.2.1 2015/07/30 15:43:37 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "agp_i810.h"
@@ -74,8 +74,8 @@ drm_bus_borrow(bus_addr_t base, bus_size
 	return false;
 }
 
-void *
-drm_ioremap(struct drm_device *dev, struct drm_local_map *map)
+void
+drm_core_ioremap(struct drm_local_map *map, struct drm_device *dev)
 {
 	const bus_space_tag_t bst = dev->bst;
 	unsigned int unit;
@@ -125,19 +125,20 @@ drm_ioremap(struct drm_device *dev, stru
 	}
 
 	/* Failure!  */
-	return NULL;
+	return;
 
 win:	map->lm_data.bus_space.bst = bst;
-	return bus_space_vaddr(bst, map->lm_data.bus_space.bsh);
+	map->handle = bus_space_vaddr(bst, map->lm_data.bus_space.bsh);
 }
 
 void
-drm_iounmap(struct drm_device *dev, struct drm_local_map *map)
+drm_core_ioremapfree(struct drm_local_map *map, struct drm_device *dev)
 {
 	if (map->lm_data.bus_space.bus_map != NULL) {
 		bus_space_unmap(map->lm_data.bus_space.bst,
 		map->lm_data.bus

CVS commit: [netbsd-7] src/sys/external/bsd/drm2

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:46:41 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon [netbsd-7]: radeon_bios.c
src/sys/external/bsd/drm2/include/linux [netbsd-7]: pci.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #906):
sys/external/bsd/drm2/include/linux/pci.h: revisions 1.18, 1.19
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.4
Save the location of the found ROM so caller can bus_space_read it.
--
Use bus_space_read rather than kmemdup to read ROM.
jakllsch@ reports that on some 64-bit systems, kmemdup does 8-byte
reads, which yield garbage in the high word.  bus_space_read_region_1
does 1-byte reads instead, which seem to work.
Derived from a patch from jakllsch@.
--
Fix type of pd_rom_found_size: it's a size, not a handle.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c
cvs rdiff -u -r1.7.2.6 -r1.7.2.7 \
src/sys/external/bsd/drm2/include/linux/pci.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.2.4.1
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.2	Wed Jul 16 20:59:57 2014
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c	Thu Jul 30 15:46:41 2015
@@ -116,6 +116,31 @@ static bool radeon_read_bios(struct rade
 		return false;
 	}
 
+#ifdef __NetBSD__
+	/*
+	 * Using kmemdup results in >4-byte memory access on 64-bit
+	 * systems, which yields bogus answers on some devices.  So we
+	 * use bus_space(9) to do guaranteed byte access with
+	 * bus_space_read_region_1 which seems to work better.
+	 */
+{
+	const bus_space_tag_t bst = rdev->pdev->pd_rom_bst;
+	const bus_space_handle_t bsh = rdev->pdev->pd_rom_found_bsh;
+
+	if (size == 0 ||
+	bus_space_read_1(bst, bsh, 0) != 0x55 ||
+	bus_space_read_1(bst, bsh, 1) != 0xaa) {
+		pci_unmap_rom(rdev->pdev, bios);
+		return false;
+	}
+	rdev->bios = kmalloc(size, GFP_KERNEL);
+	if (rdev->bios == NULL) {
+		pci_unmap_rom(rdev->pdev, bios);
+		return false;
+	}
+	bus_space_read_region_1(bst, bsh, 0, rdev->bios, size);
+}
+#else
 	if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) {
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
@@ -125,6 +150,7 @@ static bool radeon_read_bios(struct rade
 		pci_unmap_rom(rdev->pdev, bios);
 		return false;
 	}
+#endif
 	pci_unmap_rom(rdev->pdev, bios);
 	return true;
 }

Index: src/sys/external/bsd/drm2/include/linux/pci.h
diff -u src/sys/external/bsd/drm2/include/linux/pci.h:1.7.2.6 src/sys/external/bsd/drm2/include/linux/pci.h:1.7.2.7
--- src/sys/external/bsd/drm2/include/linux/pci.h:1.7.2.6	Thu Apr 23 07:31:17 2015
+++ src/sys/external/bsd/drm2/include/linux/pci.h	Thu Jul 30 15:46:41 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.h,v 1.7.2.6 2015/04/23 07:31:17 snj Exp $	*/
+/*	$NetBSD: pci.h,v 1.7.2.7 2015/07/30 15:46:41 snj Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -126,6 +126,8 @@ struct pci_dev {
 	bus_space_tag_t		pd_rom_bst;
 	bus_space_handle_t	pd_rom_bsh;
 	bus_size_t		pd_rom_size;
+	bus_space_handle_t	pd_rom_found_bsh;
+	bus_size_t		pd_rom_found_size;
 	void			*pd_rom_vaddr;
 	device_t		pd_dev;
 	struct drm_device	*pd_drm_dev; /* XXX Nouveau kludge!  */
@@ -504,8 +506,6 @@ pci_map_rom_md(struct pci_dev *pdev)
 static inline void __pci_rom_iomem *
 pci_map_rom(struct pci_dev *pdev, size_t *sizep)
 {
-	bus_space_handle_t bsh;
-	bus_size_t size;
 
 	KASSERT(!ISSET(pdev->pd_kludges, NBPCI_KLUDGE_MAP_ROM));
 
@@ -519,14 +519,16 @@ pci_map_rom(struct pci_dev *pdev, size_t
 
 	/* XXX This type is obviously wrong in general...  */
 	if (pci_find_rom(&pdev->pd_pa, pdev->pd_rom_bst, pdev->pd_rom_bsh,
-		pdev->pd_rom_size, PCI_ROM_CODE_TYPE_X86, &bsh, &size)) {
+		pdev->pd_rom_size, PCI_ROM_CODE_TYPE_X86,
+		&pdev->pd_rom_found_bsh, &pdev->pd_rom_found_size)) {
 		pci_unmap_rom(pdev, NULL);
 		return NULL;
 	}
 
-	KASSERT(size <= SIZE_T_MAX);
-	*sizep = size;
-	pdev->pd_rom_vaddr = bus_space_vaddr(pdev->pd_rom_bst, bsh);
+	KASSERT(pdev->pd_rom_found_size <= SIZE_T_MAX);
+	*sizep = pdev->pd_rom_found_size;
+	pdev->pd_rom_vaddr = bus_space_vaddr(pdev->pd_rom_bst,
+	pdev->pd_rom_found_bsh);
 	return pdev->pd_rom_vaddr;
 }
 



CVS commit: [netbsd-7] src/sys/external/bsd/drm2

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:50:16 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/include/linux [netbsd-7]: ww_mutex.h
src/sys/external/bsd/drm2/linux [netbsd-7]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #907):
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.2
sys/external/bsd/drm2/include/linux/ww_mutex.h: revision 1.11
Adapt ww_mutex to use LOCKDEBUG.
Should help track down PR 49862.


To generate a diff of this commit:
cvs rdiff -u -r1.4.4.3 -r1.4.4.4 \
src/sys/external/bsd/drm2/include/linux/ww_mutex.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/ww_mutex.h
diff -u src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.4.4.3 src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.4.4.4
--- src/sys/external/bsd/drm2/include/linux/ww_mutex.h:1.4.4.3	Fri Mar  6 21:39:10 2015
+++ src/sys/external/bsd/drm2/include/linux/ww_mutex.h	Thu Jul 30 15:50:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ww_mutex.h,v 1.4.4.3 2015/03/06 21:39:10 snj Exp $	*/
+/*	$NetBSD: ww_mutex.h,v 1.4.4.4 2015/07/30 15:50:15 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -56,7 +56,6 @@ struct ww_acquire_ctx {
 };
 
 struct ww_mutex {
-	kmutex_t		wwm_lock;
 	enum ww_mutex_state {
 		WW_UNLOCKED,	/* nobody owns it */
 		WW_OWNED,	/* owned by a lwp without a context */
@@ -67,9 +66,17 @@ struct ww_mutex {
 		struct lwp		*owner;
 		struct ww_acquire_ctx	*ctx;
 	}			wwm_u;
+	/*
+	 * XXX wwm_lock must *not* be first, so that the ww_mutex has a
+	 * different address from the kmutex for LOCKDEBUG purposes.
+	 */
+	kmutex_t		wwm_lock;
 	struct ww_class		*wwm_class;
 	struct rb_tree		wwm_waiters;
 	kcondvar_t		wwm_cv;
+#ifdef LOCKDEBUG
+	bool			wwm_debug;
+#endif
 };
 
 /* XXX Make the nm output a little more greppable...  */

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.1.2.2 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.1.2.3
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.1.2.2	Fri Mar  6 21:39:10 2015
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Thu Jul 30 15:50:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.1.2.2 2015/03/06 21:39:10 snj Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.1.2.3 2015/07/30 15:50:16 snj Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,17 +30,28 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.1.2.2 2015/03/06 21:39:10 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.1.2.3 2015/07/30 15:50:16 snj Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 
 #include 
 
+#define	WW_WANTLOCK(WW)			  \
+	LOCKDEBUG_WANTLOCK((WW)->wwm_debug, (WW),			  \
+	(uintptr_t)__builtin_return_address(0), 0)
+#define	WW_LOCKED(WW)			  \
+	LOCKDEBUG_LOCKED((WW)->wwm_debug, (WW), NULL,			  \
+	(uintptr_t)__builtin_return_address(0), 0)
+#define	WW_UNLOCKED(WW)			  \
+	LOCKDEBUG_UNLOCKED((WW)->wwm_debug, (WW),			  \
+	(uintptr_t)__builtin_return_address(0), 0)
+
 static int
 ww_acquire_ctx_compare(void *cookie __unused, const void *va, const void *vb)
 {
@@ -109,6 +120,53 @@ ww_acquire_fini(struct ww_acquire_ctx *c
 	ctx->wwx_owner = NULL;
 }
 
+#ifdef LOCKDEBUG
+static void
+ww_dump(volatile void *cookie)
+{
+	volatile struct ww_mutex *mutex = cookie;
+
+	printf_nolog("%-13s: ", "state");
+	switch (mutex->wwm_state) {
+	case WW_UNLOCKED:
+		printf_nolog("unlocked\n");
+		break;
+	case WW_OWNED:
+		printf_nolog("owned by lwp\n");
+		printf_nolog("%-13s: %p\n", "owner", mutex->wwm_u.owner);
+		printf_nolog("%-13s: %s\n", "waiters",
+		cv_has_waiters(__UNVOLATILE(&mutex->wwm_cv))
+			? "yes" : "no");
+		break;
+	case WW_CTX:
+		printf_nolog("owned via ctx\n");
+		printf_nolog("%-13s: %p\n", "context", mutex->wwm_u.ctx);
+		printf_nolog("%-13s: %p\n", "lwp",
+		mutex->wwm_u.ctx->wwx_owner);
+		printf_nolog("%-13s: %s\n", "waiters",
+		cv_has_waiters(__UNVOLATILE(&mutex->wwm_cv))
+			? "yes" : "no");
+		break;
+	case WW_WANTOWN:
+		printf_nolog("owned via ctx\n");
+		printf_nolog("%-13s: %p\n", "context", mutex->wwm_u.ctx);
+		printf_nolog("%-13s: %p\n", "lwp",
+		mutex->wwm_u.ctx->wwx_owner);
+		printf_nolog("%-13s: %s\n", "waiters", "yes (noctx)");
+		break;
+	default:
+		printf_nolog("unknown\n");
+		break;
+	}
+}
+
+static lockops_t ww_lockops = {
+	.lo_name = "Wait/wound mutex",
+	.lo_type = LOCKOPS_SLEEP,
+	.lo_dump = ww_dump,
+};
+#endif
+
 void
 ww_mutex_init(struct ww_mutex *mutex, struct ww_class *class)
 {
@@ -122,12 +180,21 @@ ww_mutex_init(struct ww_mutex *mutex, st
 	mutex->wwm_class = class;
 	rb_tree_in

CVS commit: [netbsd-7] src/sys/dev/usb

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:51:58 UTC 2015

Modified Files:
src/sys/dev/usb [netbsd-7]: uplcom.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #908):
sys/dev/usb/uplcom.c: revision 1.75
Null suspend/resume handler for uplcom(4).


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.74.2.1 src/sys/dev/usb/uplcom.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.74 src/sys/dev/usb/uplcom.c:1.74.2.1
--- src/sys/dev/usb/uplcom.c:1.74	Mon Jul 14 12:04:48 2014
+++ src/sys/dev/usb/uplcom.c	Thu Jul 30 15:51:58 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.74 2014/07/14 12:04:48 ryoon Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $	*/
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74 2014/07/14 12:04:48 ryoon Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $");
 
 #include 
 #include 
@@ -418,6 +418,9 @@ uplcom_attach(device_t parent, device_t 
 	sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca,
 	ucomprint, ucomsubmatch);
 
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 }
 
@@ -452,6 +455,9 @@ uplcom_detach(device_t self, int flags)
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 			   sc->sc_dev);
 
+	if (rv == 0)
+		pmf_device_deregister(self);
+
 	return (rv);
 }
 



CVS commit: [netbsd-7] src/sys/dev/ic

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:53:39 UTC 2015

Modified Files:
src/sys/dev/ic [netbsd-7]: mpt_netbsd.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #910):
sys/dev/ic/mpt_netbsd.c: revision 1.32
Adapter leaks requests when mpt_event_notify_reply() has to acknowledge
an event leading to "adapter resource shortage" messages when the scsipi
subsystem tries to use all adapt_openings.
Change mpt_ctlop() to free the request on event MPI_FUNCTION_EVENT_ACK.
Tested on a SunFire X4275 with Symbios Logic SAS1068E (1000:0058, rev. 4).


To generate a diff of this commit:
cvs rdiff -u -r1.25.2.1 -r1.25.2.2 src/sys/dev/ic/mpt_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.25.2.1 src/sys/dev/ic/mpt_netbsd.c:1.25.2.2
--- src/sys/dev/ic/mpt_netbsd.c:1.25.2.1	Mon Sep 29 16:15:58 2014
+++ src/sys/dev/ic/mpt_netbsd.c	Thu Jul 30 15:53:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.25.2.1 2014/09/29 16:15:58 msaitoh Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.25.2.2 2015/07/30 15:53:39 snj Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.25.2.1 2014/09/29 16:15:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.25.2.2 2015/07/30 15:53:39 snj Exp $");
 
 #include "bio.h"
 
@@ -1270,8 +1270,16 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, 
 		break;
 
 	case MPI_FUNCTION_EVENT_ACK:
+	{
+		MSG_EVENT_ACK_REPLY *msg = vmsg;
+		int index = le32toh(msg->MsgContext) & ~0x8000;
 		mpt_free_reply(mpt, (reply << 1));
+		if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) {
+			request_t *req = &mpt->request_pool[index];
+			mpt_free_request(mpt, req);
+		}
 		break;
+	}
 
 	case MPI_FUNCTION_PORT_ENABLE:
 	{



CVS commit: [netbsd-7] src/doc

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 16:03:12 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
tickets 887, 892, 894, 897, 900-904, 906-908, 910


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.349 -r1.1.2.350 src/doc/CHANGES-7.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.349 src/doc/CHANGES-7.0:1.1.2.350
--- src/doc/CHANGES-7.0:1.1.2.349	Thu Jul 30 10:23:24 2015
+++ src/doc/CHANGES-7.0	Thu Jul 30 16:03:12 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.349 2015/07/30 10:23:24 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.350 2015/07/30 16:03:12 snj Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -33522,3 +33522,80 @@ sys/arch/macppc/stand/ofwboot/Locore.c		
 	Fix rev 1.25, which caused garbage to be written into BAT registers.
 	[tsutsui, ticket #893]
 
+sys/dev/pci/oboe.c1.43
+
+	Pass the device, not the struct softc to config_found().
+	Avoids a crash at attach time, PR port-i386/50076.
+	[martin, ticket #887]
+
+sys/external/bsd/drm2/dist/drm/i915/intel_pm.c	1.7
+
+	Avoid NULL dev_priv->vlv_pctx-> deref in a WARN check.
+	Add an additional check for the NULL dev_priv->vlv_pctx.
+	[abs, ticket #892]
+
+sys/external/bsd/drm2/ttm/ttm_bo_vm.c		1.9, 1.10
+
+	Fix error branch: ttm_bo_unreserve on failure after ttm_bo_reserve.
+
+	ttm_bo_unreserve in case of ttm_bo_uvm_fault_idle restart, avoiding
+	leaking a buffer ww_mutex lock.  PR kern/49862.
+	[riastradh, ticket #894]
+
+sys/external/bsd/drm2/dist/drm/radeon/radeon_connectors.c 1.2, 1.3
+
+	Don't pass along null encoder.
+	[riastradh, ticket #897]
+
+sbin/newfs/newfs.c1.113
+usr.sbin/installboot/installboot.c		1.39
+
+	Handle getfsspecname errors, avoiding a NULL pointer exception
+	in case of an unknown wedge name.
+	[mlelstv, ticket #900]
+
+sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	1.30
+
+	Remove workaround for PR kern/49195.
+	[riastradh, ticket #901]
+
+distrib/common/bootimage/Makefile.bootimage	1.11
+
+	Fix typo: INSTALLBOOTOPTIONS, not INSTALLBOOTOPTOINS.
+	[riastradh, ticket #902]
+
+sys/external/bsd/drm2/ttm/ttm_agp_backend.c	1.4
+
+	kmem_free the container structure, not a substructure.
+	[riastradh, ticket #903]
+
+sys/external/bsd/drm2/dist/drm/drm_bufs.c	1.7
+sys/external/bsd/drm2/dist/include/drm/drmP.h	1.11
+sys/external/bsd/drm2/drm/drm_memory.c		1.7
+sys/external/bsd/drm2/pci/drm_pci.c		1.13
+
+	Replace drm_ioremap by drm_core_ioremap, reducing diff a little.
+	[riastradh, ticket #904]
+
+sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c 1.4
+sys/external/bsd/drm2/include/linux/pci.h	1.18, 1.19
+
+	Fix reading the video BIOS for radeon devices.
+	[riastradh, ticket #906]
+
+sys/external/bsd/drm2/include/linux/ww_mutex.h	1.11
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.2
+
+	Adapt ww_mutex to use LOCKDEBUG.
+	[riastradh, ticket #907]
+
+sys/dev/usb/uplcom.c1.75
+
+	Make uplcom(4) suspend/resume.
+	[riastradh, ticket #908]
+
+sys/dev/ic/mpt_netbsd.c1.32
+
+	Avoid leaking requests.
+	[hannken, ticket #910]
+



CVS commit: [netbsd-7] src/sys/external/bsd/drm2/dist/drm/radeon

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 16:29:38 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/dist/drm/radeon [netbsd-7]: radeon_bios.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #911):
sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c: revision 1.3
Fix two issues in NetBSD implementation of igp_read_bios_from_vram():
 * Allocate the correct buffer for the VGA BIOS image.
 * Abort if buffer allocation failed, not if buffer allocation succeeded.
Not directly tested, but I can't imagine this makes anything worse.


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.1 -r1.2.4.2 \
src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c
diff -u src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.2.4.1 src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.2.4.2
--- src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c:1.2.4.1	Thu Jul 30 15:46:41 2015
+++ src/sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c	Thu Jul 30 16:29:38 2015
@@ -72,7 +72,7 @@ static bool igp_read_bios_from_vram(stru
 	(size < 256 * 1024) ||
 	(bus_space_read_1(bst, bsh, 0) != 0x55) ||
 	(bus_space_read_1(bst, bsh, 1) != 0xaa) ||
-	((rdev = kmalloc(size, GFP_KERNEL)) != NULL)) {
+	((rdev->bios = kmalloc(size, GFP_KERNEL)) == NULL)) {
 		bus_space_unmap(bst, bsh, size);
 		return false;
 	}



CVS commit: [netbsd-7] src/doc

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 16:33:39 UTC 2015

Modified Files:
src/doc [netbsd-7]: CHANGES-7.0

Log Message:
911


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.350 -r1.1.2.351 src/doc/CHANGES-7.0

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-7.0
diff -u src/doc/CHANGES-7.0:1.1.2.350 src/doc/CHANGES-7.0:1.1.2.351
--- src/doc/CHANGES-7.0:1.1.2.350	Thu Jul 30 16:03:12 2015
+++ src/doc/CHANGES-7.0	Thu Jul 30 16:33:38 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.350 2015/07/30 16:03:12 snj Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.351 2015/07/30 16:33:38 snj Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -33599,3 +33599,9 @@ sys/dev/ic/mpt_netbsd.c1.32
 	Avoid leaking requests.
 	[hannken, ticket #910]
 
+sys/external/bsd/drm2/dist/drm/radeon/radeon_bios.c 1.3
+
+	Avoid a buffer leak and taking an error branch to be on
+	success.
+	[riastradh, ticket #911]
+



CVS commit: src/sys/sys

2015-07-30 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jul 30 21:31:15 UTC 2015

Modified Files:
src/sys/sys: types.h

Log Message:
Deduplicate stdbool.h definitions

Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/sys/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/types.h
diff -u src/sys/sys/types.h:1.92 src/sys/sys/types.h:1.93
--- src/sys/sys/types.h:1.92	Wed Jul 29 00:10:25 2015
+++ src/sys/sys/types.h	Thu Jul 30 21:31:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.92 2015/07/29 00:10:25 christos Exp $	*/
+/*	$NetBSD: types.h,v 1.93 2015/07/30 21:31:15 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -204,14 +204,7 @@ typedef	int		psetid_t;
  * Boolean type definitions for the kernel environment.  User-space
  * boolean definitions are found in .
  */
-#ifndef __bool_true_false_are_defined
-#ifndef __cplusplus
-#define bool	_Bool
-#define true	1
-#define false	0
-#endif
-#define __bool_true_false_are_defined 1
-#endif
+#include 
 
 /*
  * Deprecated Mach-style boolean_t type.  Should not be used by new code.



CVS commit: src/sys/sys

2015-07-30 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jul 30 21:38:53 UTC 2015

Modified Files:
src/sys/sys: types.h

Log Message:
Remove unneeded comment about  in the user-land

Suggested by 


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/sys/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/types.h
diff -u src/sys/sys/types.h:1.93 src/sys/sys/types.h:1.94
--- src/sys/sys/types.h:1.93	Thu Jul 30 21:31:15 2015
+++ src/sys/sys/types.h	Thu Jul 30 21:38:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.93 2015/07/30 21:31:15 kamil Exp $	*/
+/*	$NetBSD: types.h,v 1.94 2015/07/30 21:38:53 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1991, 1993, 1994
@@ -200,10 +200,7 @@ typedef	unsigned long	cpuid_t;
 typedef	int		psetid_t;
 
 #if defined(_KERNEL) || defined(_STANDALONE)
-/*
- * Boolean type definitions for the kernel environment.  User-space
- * boolean definitions are found in .
- */
+
 #include 
 
 /*



CVS commit: src/usr.bin/patch

2015-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jul 30 21:47:51 UTC 2015

Modified Files:
src/usr.bin/patch: pch.c

Log Message:
from bitrieg:

Substitution commands might contain a newline in the replacement pattern
(escaped with a backslash before it), causing patch's understanding of
the state the ed child process is in to diverge from reality. This can
lead to patch unwillingly feeding '!' (execute shell command) lines to
ed. Finding out how to do this is left as an exercise to the reader.

XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/patch/pch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/patch/pch.c
diff -u src/usr.bin/patch/pch.c:1.27 src/usr.bin/patch/pch.c:1.28
--- src/usr.bin/patch/pch.c:1.27	Thu Nov 27 10:07:23 2014
+++ src/usr.bin/patch/pch.c	Thu Jul 30 17:47:51 2015
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $
  * $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $
- * $NetBSD: pch.c,v 1.27 2014/11/27 15:07:23 christos Exp $
+ * $NetBSD: pch.c,v 1.28 2015/07/30 21:47:51 christos Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pch.c,v 1.27 2014/11/27 15:07:23 christos Exp $");
+__RCSID("$NetBSD: pch.c,v 1.28 2015/07/30 21:47:51 christos Exp $");
 
 #include 
 #include 
@@ -1407,6 +1407,7 @@ do_ed_script(void)
 	char	*t;
 	long	beginning_of_this_line;
 	FILE	*pipefp = NULL;
+	int	continuation;
 
 	if (!skip_rest_of_patch) {
 		if (copy_file(filearg[0], TMPOUTNAME) < 0) {
@@ -1431,7 +1432,19 @@ do_ed_script(void)
 		*t == 'd' || *t == 'i' || *t == 's')) {
 			if (pipefp != NULL)
 fputs(buf, pipefp);
-			if (*t != 'd') {
+			if (*t == 's') {
+for (;;) {
+	continuation = 0;
+	t = strchr(buf, '\0') - 1;
+	while (--t >= buf && *t == '\\')
+		continuation = !continuation;
+	if (!continuation ||
+	pgets(buf, sizeof buf, pfp) == NULL)
+		break;
+	if (pipefp != NULL)
+		fputs(buf, pipefp);
+}
+			} else if (*t != 'd') {
 while (pgets(buf, buf_len, pfp) != NULL) {
 	p_input_line++;
 	if (pipefp != NULL)



CVS commit: src/tests/net/arp

2015-07-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 31 00:22:44 UTC 2015

Modified Files:
src/tests/net/arp: t_dad.sh

Log Message:
Fix cleanup; halt all running rump_servers


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/arp/t_dad.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/arp/t_dad.sh
diff -u src/tests/net/arp/t_dad.sh:1.1 src/tests/net/arp/t_dad.sh:1.2
--- src/tests/net/arp/t_dad.sh:1.1	Thu Jul 30 02:52:53 2015
+++ src/tests/net/arp/t_dad.sh	Fri Jul 31 00:22:44 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.1 2015/07/30 02:52:53 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.2 2015/07/31 00:22:44 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -214,7 +214,7 @@ dad_basic_cleanup()
 dad_duplicated_cleanup()
 {
 	$DEBUG && dump
-	env RUMP_SERVER=$SOCKLOCAL rump.halt
+	cleanup
 }
 
 atf_init_test_cases()



CVS commit: src/tests/net/arp

2015-07-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 31 00:23:54 UTC 2015

Modified Files:
src/tests/net/arp: t_dad.sh

Log Message:
Remove remaining debug code


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/arp/t_dad.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/arp/t_dad.sh
diff -u src/tests/net/arp/t_dad.sh:1.2 src/tests/net/arp/t_dad.sh:1.3
--- src/tests/net/arp/t_dad.sh:1.2	Fri Jul 31 00:22:44 2015
+++ src/tests/net/arp/t_dad.sh	Fri Jul 31 00:23:54 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_dad.sh,v 1.2 2015/07/31 00:22:44 ozaki-r Exp $
+#	$NetBSD: t_dad.sh,v 1.3 2015/07/31 00:23:54 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -173,8 +173,6 @@ dad_duplicated_body()
 
 cleanup()
 {
-	gdb -ex bt /usr/bin/rump_server rump_server.core
-	gdb -ex bt /usr/sbin/arp arp.core
 	env RUMP_SERVER=$SOCKLOCAL rump.halt
 	env RUMP_SERVER=$SOCKPEER rump.halt
 }



CVS commit: src/tests/net/arp

2015-07-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 31 02:35:09 UTC 2015

Modified Files:
src/tests/net/arp: t_arp.sh

Log Message:
Add tests for temp option


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/arp/t_arp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.3 src/tests/net/arp/t_arp.sh:1.4
--- src/tests/net/arp/t_arp.sh:1.3	Thu Jul 30 08:41:18 2015
+++ src/tests/net/arp/t_arp.sh	Fri Jul 31 02:35:09 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.3 2015/07/30 08:41:18 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.4 2015/07/31 02:35:09 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -203,6 +203,17 @@ command_body()
 	atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.14
 	atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.15
 	atf_check -s not-exit:0 -e ignore rump.arp -n 10.0.1.1
+
+	# Test temp option
+	$DEBUG && rump.arp -n -a
+	atf_check -s exit:0 -o ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:10 temp
+	$DEBUG && rump.arp -n -a
+	atf_check -s exit:0 -o not-match:'permanent' rump.arp -n 10.0.1.10
+
+	# Hm? the cache doesn't expire...
+	atf_check -s exit:0 sleep $(($arp_keep + $arp_prune + $bonus))
+	$DEBUG && rump.arp -n -a
+	#atf_check -s exit:0 -o match:'incomplete' rump.arp -n 10.0.1.10
 }
 
 make_pkt_str()



CVS commit: src/tests/net/arp

2015-07-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 31 02:39:12 UTC 2015

Modified Files:
src/tests/net/arp: t_arp.sh

Log Message:
Add tests of cache overwriting


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/arp/t_arp.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.4 src/tests/net/arp/t_arp.sh:1.5
--- src/tests/net/arp/t_arp.sh:1.4	Fri Jul 31 02:35:09 2015
+++ src/tests/net/arp/t_arp.sh	Fri Jul 31 02:39:12 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.4 2015/07/31 02:35:09 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.5 2015/07/31 02:39:12 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -40,6 +40,7 @@ atf_test_case cache_expiration_5s cleanu
 atf_test_case cache_expiration_10s cleanup
 atf_test_case command cleanup
 atf_test_case garp cleanup
+atf_test_case cache_overwriting cleanup
 
 cache_expiration_5s_head()
 {
@@ -65,6 +66,12 @@ garp_head()
 	atf_set "require.progs" "rump_server"
 }
 
+cache_overwriting_head()
+{
+	atf_set "descr" "Tests for behavior of overwriting ARP caches"
+	atf_set "require.progs" "rump_server"
+}
+
 setup_dst_server()
 {
 	export RUMP_SERVER=$SOCKDST
@@ -262,6 +269,39 @@ garp_body()
 	atf_check -s not-exit:0 -x "cat ./out |grep -q '$pkt'"
 }
 
+cache_overwriting_body()
+{
+	local arp_prune=1
+	local arp_keep=5
+	local bonus=2
+
+	atf_check -s exit:0 ${inetserver} $SOCKSRC
+	atf_check -s exit:0 ${inetserver} $SOCKDST
+
+	setup_dst_server
+	setup_src_server $arp_prune $arp_keep
+
+	export RUMP_SERVER=$SOCKSRC
+
+	# Cannot overwrite a permanent cache
+	atf_check -s not-exit:0 -e ignore rump.arp -s $IP4SRC b2:a0:20:00:00:ff
+	$DEBUG && rump.arp -n -a
+
+	atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 $IP4DST
+	$DEBUG && rump.arp -n -a
+	# Can overwrite a dynamic cache
+	atf_check -s exit:0 -o ignore rump.arp -s $IP4DST b2:a0:20:00:00:00
+	$DEBUG && rump.arp -n -a
+	atf_check -s exit:0 -o match:'permanent' rump.arp -n $IP4DST
+
+	atf_check -s exit:0 -o ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:10 temp
+	$DEBUG && rump.arp -n -a
+	atf_check -s exit:0 -o not-match:'permanent' rump.arp -n 10.0.1.10
+	# Cannot overwrite a temp cache
+	atf_check -s not-exit:0 -e ignore rump.arp -s 10.0.1.10 b2:a0:20:00:00:ff
+	$DEBUG && rump.arp -n -a
+}
+
 cleanup()
 {
 	env RUMP_SERVER=$SOCKSRC rump.halt
@@ -318,10 +358,17 @@ garp_cleanup()
 	env RUMP_SERVER=$SOCKSRC rump.halt
 }
 
+cache_overwriting_cleanup()
+{
+	$DEBUG && dump
+	cleanup
+}
+
 atf_init_test_cases()
 {
 	atf_add_test_case cache_expiration_5s
 	atf_add_test_case cache_expiration_10s
 	atf_add_test_case command
 	atf_add_test_case garp
+	atf_add_test_case cache_overwriting
 }



CVS commit: src/usr.sbin/arp

2015-07-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jul 31 04:02:40 UTC 2015

Modified Files:
src/usr.sbin/arp: arp.c

Log Message:
Reduce abuse of global variables


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/arp/arp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/arp/arp.c
diff -u src/usr.sbin/arp/arp.c:1.52 src/usr.sbin/arp/arp.c:1.53
--- src/usr.sbin/arp/arp.c:1.52	Wed Jul 29 06:07:35 2015
+++ src/usr.sbin/arp/arp.c	Fri Jul 31 04:02:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp.c,v 1.52 2015/07/29 06:07:35 ozaki-r Exp $ */
+/*	$NetBSD: arp.c,v 1.53 2015/07/31 04:02:40 ozaki-r Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1984, 19
 #if 0
 static char sccsid[] = "@(#)arp.c	8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: arp.c,v 1.52 2015/07/29 06:07:35 ozaki-r Exp $");
+__RCSID("$NetBSD: arp.c,v 1.53 2015/07/31 04:02:40 ozaki-r Exp $");
 #endif
 #endif /* not lint */
 
@@ -88,15 +88,14 @@ static int atosdl(const char *s, struct 
 static int file(const char *);
 static void get(const char *);
 static int getinetaddr(const char *, struct in_addr *);
-static void getsocket(void);
-static int rtmsg(int);
+static int getsocket(void);
+static struct rt_msghdr *
+	rtmsg(const int, const int, const struct sockaddr_inarp *,
+	const struct sockaddr_dl *);
 static int set(int, char **);
 static void usage(void) __dead;
 
-static pid_t pid;
 static int aflag, nflag, vflag;
-static int s = -1;
-static struct ifaddrs* ifaddrs = NULL;
 static struct sockaddr_in so_mask = { 
 	.sin_len = 8,
 	.sin_addr = {
@@ -107,18 +106,12 @@ static struct sockaddr_inarp blank_sin =
 	.sin_len = sizeof(blank_sin),
 	.sin_family = AF_INET
 };
-static struct sockaddr_inarp sin_m;
 static struct sockaddr_dl blank_sdl = {
 	.sdl_len = sizeof(blank_sdl),
 	.sdl_family = AF_LINK
 };
-static struct sockaddr_dl sdl_m;
 
 static int expire_time, flags, export_only, doing_proxy, found_entry;
-static struct {
-	struct	rt_msghdr m_rtm;
-	char	m_space[512];
-} m_rtmsg;
 
 int
 main(int argc, char **argv)
@@ -158,8 +151,6 @@ main(int argc, char **argv)
 	if (prog_init && prog_init() == -1)
 		err(1, "init failed");
 
-	pid = prog_getpid();
-
 	switch((char)op) {
 	case 'a':
 		dump(0);
@@ -232,14 +223,14 @@ file(const char *name)
 	return retval;
 }
 
-static void
+static int
 getsocket(void)
 {
-	if (s >= 0)
-		return;
+	int s;
 	s = prog_socket(PF_ROUTE, SOCK_RAW, 0);
 	if (s < 0)
 		err(1, "socket");
+	return s;
 }
 
 static int
@@ -275,18 +266,17 @@ set(int argc, char **argv)
 	struct sockaddr_dl *sdl;
 	struct rt_msghdr *rtm;
 	char *host = argv[0], *eaddr;
-	int rval;
+	struct sockaddr_inarp sin_m = blank_sin; /* struct copy */
+	struct sockaddr_dl sdl_m = blank_sdl; /* struct copy */
+	int s;
 
-	sina = &sin_m;
-	rtm = &(m_rtmsg.m_rtm);
 	eaddr = argv[1];
 
-	getsocket();
+	s = getsocket();
 	argc -= 2;
 	argv += 2;
-	sdl_m = blank_sdl;		/* struct copy */
-	sin_m = blank_sin;		/* struct copy */
-	if (getinetaddr(host, &sina->sin_addr) == -1)
+
+	if (getinetaddr(host, &sin_m.sin_addr) == -1)
 		return (1);
 	if (atosdl(eaddr, &sdl_m))
 		warnx("invalid link-level address '%s'", eaddr);
@@ -322,7 +312,8 @@ set(int argc, char **argv)
 	if (memcmp(&sdl_m, &blank_sdl, sizeof(blank_sdl)))
 		goto out;
 tryagain:
-	if (rtmsg(RTM_GET) < 0) {
+	rtm = rtmsg(s, RTM_GET, &sin_m, &sdl_m);
+	if (rtm == NULL) {
 		warn("%s", host);
 		return (1);
 	}
@@ -353,10 +344,13 @@ overwrite:
 	sdl_m.sdl_type = sdl->sdl_type;
 	sdl_m.sdl_index = sdl->sdl_index;
 out:
-	rval = rtmsg(RTM_ADD);
+	sin_m.sin_other = 0;
+	if (doing_proxy && export_only)
+		sin_m.sin_other = SIN_PROXY;
+	rtm = rtmsg(s, RTM_ADD, &sin_m, &sdl_m);
 	if (vflag)
 		(void)printf("%s (%s) added\n", host, eaddr);
-	return (rval);
+	return (rtm == NULL) ? 1 : 0;
 }
 
 /*
@@ -365,15 +359,13 @@ out:
 static void
 get(const char *host)
 {
-	struct sockaddr_inarp *sina;
+	struct sockaddr_inarp sin = blank_sin; /* struct copy */
 
-	sina = &sin_m;
-	sin_m = blank_sin;		/* struct copy */
-	if (getinetaddr(host, &sina->sin_addr) == -1)
+	if (getinetaddr(host, &sin.sin_addr) == -1)
 		exit(1);
-	dump(sina->sin_addr.s_addr);
+	dump(sin.sin_addr.s_addr);
 	if (found_entry == 0)
-		errx(1, "%s (%s) -- no entry", host, inet_ntoa(sina->sin_addr));
+		errx(1, "%s (%s) -- no entry", host, inet_ntoa(sin.sin_addr));
 }
 
 
@@ -404,20 +396,20 @@ int
 delete(const char *host, const char *info)
 {
 	struct sockaddr_inarp *sina;
-	struct rt_msghdr *rtm;
 	struct sockaddr_dl *sdl;
+	struct rt_msghdr *rtm;
+	struct sockaddr_inarp sin_m = blank_sin; /* struct copy */
+	struct sockaddr_dl sdl_m = blank_sdl; /* struct copy */
+	int s;
 
-	sina = &sin_m;
-	rtm = &m_rtmsg.m_rtm;
-
-	getsocket();
-	sin_m = blank_sin;		/* struct copy */
+	s = getsocket();
 	if (info && strncmp(info, "pro", 3) == 0)
-		 sina->sin_other = SIN_P