CVS commit: src/sys/netipsec

2017-11-30 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Dec  1 06:34:14 UTC 2017

Modified Files:
src/sys/netipsec: key.c

Log Message:
Don't touch an SP without a reference to it


To generate a diff of this commit:
cvs rdiff -u -r1.245 -r1.246 src/sys/netipsec/key.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/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.245 src/sys/netipsec/key.c:1.246
--- src/sys/netipsec/key.c:1.245	Thu Nov 30 02:45:12 2017
+++ src/sys/netipsec/key.c	Fri Dec  1 06:34:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.245 2017/11/30 02:45:12 ozaki-r Exp $	*/
+/*	$NetBSD: key.c,v 1.246 2017/12/01 06:34:14 ozaki-r Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.245 2017/11/30 02:45:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.246 2017/12/01 06:34:14 ozaki-r Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -2112,6 +2112,7 @@ key_api_spdadd(struct socket *so, struct
 	struct secpolicyindex spidx;
 	struct secpolicy *newsp;
 	int error;
+	uint32_t sadb_x_policy_id;
 
 	if (mhp->ext[SADB_EXT_ADDRESS_SRC] == NULL ||
 	mhp->ext[SADB_EXT_ADDRESS_DST] == NULL ||
@@ -2216,9 +2217,16 @@ key_api_spdadd(struct socket *so, struct
 
 	key_init_sp(newsp);
 
+	sadb_x_policy_id = newsp->id;
+
 	mutex_enter(_spd.lock);
 	SPLIST_WRITER_INSERT_TAIL(newsp->spidx.dir, newsp);
 	mutex_exit(_spd.lock);
+	/*
+	 * We don't have a reference to newsp, so we must not touch newsp from
+	 * now on.  If you want to do, you must take a reference beforehand.
+	 */
+	newsp = NULL;
 
 #ifdef notyet
 	/* delete the entry in key_misc.spacqlist */
@@ -2274,7 +2282,7 @@ key_api_spdadd(struct socket *so, struct
 		m_freem(n);
 		return key_senderror(so, m, EINVAL);
 	}
-	xpl->sadb_x_policy_id = newsp->id;
+	xpl->sadb_x_policy_id = sadb_x_policy_id;
 
 	m_freem(m);
 	return key_sendup_mbuf(so, n, KEY_SENDUP_ALL);



CVS commit: src/tests/lib/libc/locale

2017-11-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Fri Dec  1 01:08:35 UTC 2017

Modified Files:
src/tests/lib/libc/locale: t_sprintf.c

Log Message:
Since the C standard allows for intermediate floating results to contain
more precision bits than the data type expects, but (kind of obviously)
does not allow such values to be stored in memory, expecting the value
returned from strtod() (an intermediate result) to be identical (that is,
equal) to a stored value is incorrect.

So instead go back to checking that the two numbers are very very close.
See comments added to the test for more explanation.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libc/locale/t_sprintf.c

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

Modified files:

Index: src/tests/lib/libc/locale/t_sprintf.c
diff -u src/tests/lib/libc/locale/t_sprintf.c:1.6 src/tests/lib/libc/locale/t_sprintf.c:1.7
--- src/tests/lib/libc/locale/t_sprintf.c:1.6	Tue Nov 28 23:26:01 2017
+++ src/tests/lib/libc/locale/t_sprintf.c	Fri Dec  1 01:08:35 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sprintf.c,v 1.6 2017/11/28 23:26:01 kre Exp $ */
+/* $NetBSD: t_sprintf.c,v 1.7 2017/12/01 01:08:35 kre Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2017\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_sprintf.c,v 1.6 2017/11/28 23:26:01 kre Exp $");
+__RCSID("$NetBSD: t_sprintf.c,v 1.7 2017/12/01 01:08:35 kre Exp $");
 
 #include 
 #include 
@@ -133,16 +133,44 @@ h_strto(const struct test *t)
 	ATF_REQUIRE(setlocale(LC_NUMERIC, t->locale) != NULL);
 
 	ATF_REQUIRE_EQ((int)strtol(t->int_input, NULL, 10), t->int_value);
-	d = strtod(t->double_input, NULL);
+
+	/*
+	 * Note that the C standard permits function values to be
+	 * returned with more precision than is expected by (floating)
+	 * data types, and on i386 (and potentially other implementations)
+	 * that is exactly what happens, meaning that the result from
+	 * strtod() is not identical to the expected value - it turns out
+	 * that it is the same if the value is constrained to the number
+	 * of mantissa bits in a double (so the %a values printed below
+	 * show the exact same bit patterns) and on i386 -ffloat-store
+	 * will cause gcc to constrain the result that way, but nothing
+	 * demands that be true, so instead, we simply test that the
+	 * value returned is very very close to that expected.
+	 *
+	 * 1e-12 is chosen as the allowable delta, as we know (from
+	 * the data in the "struct test" earlier in this file) that
+	 * its magnitude is ~ 10^5, with values of that magnitude,
+	 * 10^-12 difference is a 10^-17 relative difference, and
+	 * with a 56 bit mantissa (standard IEEE "double") a difference
+	 * that small vanishes (requires at least 57 mantissa bits to
+	 * be representable).   If the data values were to change, then
+	 * so might this delta (if they were not all the same, we would
+	 * move the delta into the struct rather than having it a constant
+	 * here.).
+	 *
+	 * Finally, note that our purpose here is not to test floating
+	 * point arithmetic, we're testing locale dependent string to
+	 * binary conversions.
+	 */
+
+	d = (double)strtod(t->double_input, NULL);
 	diff = fabs(d - t->double_value);
-#if 0
-	if (diff >= 1e-7)
-#endif
-		ATF_REQUIRE_EQ_MSG(d, t->double_value, "In %s:"
-		" d=strtod(t->double_input[%s], NULL)[%.12g = %a] !="
-		" t->double_value[%.12g = %a]: diff=%g",
-		t->locale, t->double_input, d, d,
-		t->double_value, t->double_value, diff);
+	if (diff >= 1e-12)
+		ATF_REQUIRE_EQ_MSG(d, t->double_value, "In %s: " 
+		"d=strtod(t->double_input[%s], NULL)[%.12g = %a] != "
+		"t->double_value[%.12g = %a]: diff=%g", t->locale,
+		t->double_input, d, d, t->double_value, t->double_value,
+		diff);
 }
 
 static void



CVS commit: src/sys/arch/arm/dts

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 21:39:35 UTC 2017

Added Files:
src/sys/arch/arm/dts: sun8i-h3-orangepi-one.dts

Log Message:
Re-add this, it is still needed for simplefb


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts

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

Added files:

Index: src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts:1.3
--- /dev/null	Thu Nov 30 21:39:35 2017
+++ src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts	Thu Nov 30 21:39:35 2017
@@ -0,0 +1,31 @@
+/* $NetBSD: sun8i-h3-orangepi-one.dts,v 1.3 2017/11/30 21:39:35 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+#include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts"
+#include "sun8i-h3.dtsi"
+



CVS commit: src/sys/arch/arm/dts

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 21:36:45 UTC 2017

Modified Files:
src/sys/arch/arm/dts: sun50i-a64.dtsi sun8i-h3-nanopi-neo.dts
sun8i-h3-orangepi-plus2e.dts sun8i-h3.dtsi
Removed Files:
src/sys/arch/arm/dts: sun8i-h3-orangepi-one.dts

Log Message:
Switch to new emac bindings for H3 boards


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-a64.dtsi
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts \
src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts
cvs rdiff -u -r1.1 -r0 src/sys/arch/arm/dts/sun8i-h3-orangepi-one.dts
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/dts/sun8i-h3.dtsi

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/dts/sun50i-a64.dtsi
diff -u src/sys/arch/arm/dts/sun50i-a64.dtsi:1.3 src/sys/arch/arm/dts/sun50i-a64.dtsi:1.4
--- src/sys/arch/arm/dts/sun50i-a64.dtsi:1.3	Sat Sep  9 12:05:28 2017
+++ src/sys/arch/arm/dts/sun50i-a64.dtsi	Thu Nov 30 21:36:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64.dtsi,v 1.3 2017/09/09 12:05:28 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64.dtsi,v 1.4 2017/11/30 21:36:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -75,33 +75,3 @@
 		drive-strength = <40>;
 	};
 };
-
-/ {
-	soc {
-		ehci0: usb@01c1a000 {
-			compatible = "allwinner,sun50i-a64-ehci", "generic-ehci";
-			reg = <0x01c1a000 0x100>;
-			interrupts = ;
-			clocks = < CLK_BUS_OHCI0>,
- < CLK_BUS_EHCI0>,
- < CLK_USB_OHCI0>;
-			resets = < RST_BUS_OHCI0>,
- < RST_BUS_EHCI0>;
-			phys = < 0>;
-			phy-names = "usb";
-			status = "disabled";
-		};
-
-		ohci0: usb@01c1a400 {
-			compatible = "allwinner,sun50i-a64-ohci", "generic-ohci";
-			reg = <0x01c1a400 0x100>;
-			interrupts = ;
-			clocks = < CLK_BUS_OHCI0>,
- < CLK_USB_OHCI0>;
-			resets = < RST_BUS_OHCI0>;
-			phys = < 0>;
-			phy-names = "usb";
-			status = "disabled";
-		};
-	};
-};

Index: src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts
diff -u src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts:1.2 src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts:1.3
--- src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts:1.2	Thu Oct  5 13:25:33 2017
+++ src/sys/arch/arm/dts/sun8i-h3-nanopi-neo.dts	Thu Nov 30 21:36:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3-nanopi-neo.dts,v 1.2 2017/10/05 13:25:33 jmcneill Exp $ */
+/* $NetBSD: sun8i-h3-nanopi-neo.dts,v 1.3 2017/11/30 21:36:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -57,16 +57,3 @@
 		enable-active-high;
 	};
 };
-
- {
-	phy-mode = "mii";
-	phy = <>;
-
-	allwinner,use-internal-phy;
-	allwinner,leds-active-low;
-	status = "okay";
-
-	phy1: ethernet-phy@1 {
-		reg = <1>;
-	};
-};
Index: src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts
diff -u src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.2 src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.3
--- src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts:1.2	Mon Oct  2 22:51:15 2017
+++ src/sys/arch/arm/dts/sun8i-h3-orangepi-plus2e.dts	Thu Nov 30 21:36:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3-orangepi-plus2e.dts,v 1.2 2017/10/02 22:51:15 jmcneill Exp $ */
+/* $NetBSD: sun8i-h3-orangepi-plus2e.dts,v 1.3 2017/11/30 21:36:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,18 +30,6 @@
 #include "sun8i-h3.dtsi"
 
 / {
-	reg_gmac_3v3: gmac-3v3 {
-		compatible = "regulator-fixed";
-		pinctrl-names = "default";
-		pinctrl-0 = <_phy_reset_pin>;
-		regulator-name = "gmac-3v3";
-		regulator-min-microvolt = <330>;
-		regulator-max-microvolt = <330>;
-		startup-delay-us = <10>;
-		enable-active-high;
-		gpio = < 3 6 GPIO_ACTIVE_HIGH>;
-	};
-
 	cpus {
 		cpu@0 {
 			cpu-supply = <_cpu>;
@@ -57,21 +45,6 @@
 	};
 };
 
- {
-	pinctrl-names = "default";
-	pinctrl-0 = <_pins_rgmii_a>;
-	phy-supply = <_gmac_3v3>;
-	phy-mode = "rgmii";
-	phy = <>;
-
-	allwinner,leds-active-low;
-	status = "okay";
-
-	phy1: ethernet-phy@1 {
-		reg = <1>;
-	};
-};
-
 _i2c {
 	status = "okay";
 

Index: src/sys/arch/arm/dts/sun8i-h3.dtsi
diff -u src/sys/arch/arm/dts/sun8i-h3.dtsi:1.5 src/sys/arch/arm/dts/sun8i-h3.dtsi:1.6
--- src/sys/arch/arm/dts/sun8i-h3.dtsi:1.5	Thu Oct  5 01:32:46 2017
+++ src/sys/arch/arm/dts/sun8i-h3.dtsi	Thu Nov 30 21:36:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-h3.dtsi,v 1.5 2017/10/05 01:32:46 jmcneill Exp $ */
+/* $NetBSD: sun8i-h3.dtsi,v 1.6 2017/11/30 21:36:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -48,20 +48,6 @@
 	};
 
 	soc {
-		emac: ethernet@1c3 {
-			compatible = "allwinner,sun8i-h3-emac";
-			reg = <0x01c3 0x104>, <0x01c00030 0x4>;
-			reg-names = "emac", "syscon";
-			interrupts = ;
-			resets = < RST_BUS_EMAC>, < RST_BUS_EPHY>;
-			reset-names = "ahb", "ephy";
-			clocks = < CLK_BUS_EMAC>, < CLK_BUS_EPHY>;
-			clock-names = "ahb", "ephy";
-	

CVS commit: src/sys/arch/arm/sunxi

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 21:36:11 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_emac.c

Log Message:
Add support for new emac bindings


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_emac.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/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.9 src/sys/arch/arm/sunxi/sunxi_emac.c:1.10
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.9	Thu Nov 16 03:07:17 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Thu Nov 30 21:36:11 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.9 2017/11/16 03:07:17 ozaki-r Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.10 2017/11/30 21:36:11 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.9 2017/11/16 03:07:17 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.10 2017/11/30 21:36:11 jmcneill Exp $");
 
 #include 
 #include 
@@ -97,23 +97,24 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
 #define	PAUSE_TIME_DEFAULT	0x400
 
 /* syscon EMAC clock register */
-#define	EMAC_CLK_EPHY_ADDR	(0x1f << 20)	/* H3 */
-#define	EMAC_CLK_EPHY_ADDR_SHIFT 20
-#define	EMAC_CLK_EPHY_LED_POL	(1 << 17)	/* H3 */
-#define	EMAC_CLK_EPHY_SHUTDOWN	(1 << 16)	/* H3 */
-#define	EMAC_CLK_EPHY_SELECT	(1 << 15)	/* H3 */
-#define	EMAC_CLK_RMII_EN	(1 << 13)
-#define	EMAC_CLK_ETXDC		(0x7 << 10)
-#define	EMAC_CLK_ETXDC_SHIFT	10
-#define	EMAC_CLK_ERXDC		(0x1f << 5)
-#define	EMAC_CLK_ERXDC_SHIFT	5
-#define	EMAC_CLK_PIT		(0x1 << 2)
-#define	 EMAC_CLK_PIT_MII	(0 << 2)
-#define	 EMAC_CLK_PIT_RGMII	(1 << 2)
-#define	EMAC_CLK_SRC		(0x3 << 0)
-#define	 EMAC_CLK_SRC_MII	(0 << 0)
-#define	 EMAC_CLK_SRC_EXT_RGMII	(1 << 0)
-#define	 EMAC_CLK_SRC_RGMII	(2 << 0)
+#define	EMAC_CLK_REG		0x30
+#define	 EMAC_CLK_EPHY_ADDR		(0x1f << 20)	/* H3 */
+#define	 EMAC_CLK_EPHY_ADDR_SHIFT	20
+#define	 EMAC_CLK_EPHY_LED_POL		(1 << 17)	/* H3 */
+#define	 EMAC_CLK_EPHY_SHUTDOWN		(1 << 16)	/* H3 */
+#define	 EMAC_CLK_EPHY_SELECT		(1 << 15)	/* H3 */
+#define	 EMAC_CLK_RMII_EN		(1 << 13)
+#define	 EMAC_CLK_ETXDC			(0x7 << 10)
+#define	 EMAC_CLK_ETXDC_SHIFT		10
+#define	 EMAC_CLK_ERXDC			(0x1f << 5)
+#define	 EMAC_CLK_ERXDC_SHIFT		5
+#define	 EMAC_CLK_PIT			(0x1 << 2)
+#define	  EMAC_CLK_PIT_MII		(0 << 2)
+#define	  EMAC_CLK_PIT_RGMII		(1 << 2)
+#define	 EMAC_CLK_SRC			(0x3 << 0)
+#define	  EMAC_CLK_SRC_MII		(0 << 0)
+#define	  EMAC_CLK_SRC_EXT_RGMII	(1 << 0)
+#define	  EMAC_CLK_SRC_RGMII		(2 << 0)
 
 /* Burst length of RX and TX DMA transfers */
 static int sunxi_emac_burst_len = BURST_LEN_DEFAULT;
@@ -889,6 +890,27 @@ sunxi_emac_ioctl(struct ifnet *ifp, u_lo
 	return error;
 }
 
+static bool
+sunxi_emac_has_internal_phy(struct sunxi_emac_softc *sc)
+{
+	const char * mdio_internal_compat[] = {
+		"allwinner,sun8i-h3-mdio-internal",
+		NULL
+	};
+	int phy;
+
+	/* Non-standard property, for compatible with old dts files */
+	if (of_hasprop(sc->phandle, "allwinner,use-internal-phy"))
+		return true;
+
+	phy = fdtbus_get_phandle(sc->phandle, "phy-handle");
+	if (phy == -1)
+		return false;
+
+	/* For internal PHY, check compatible string of parent node */
+	return of_compatible(OF_parent(phy), mdio_internal_compat) >= 0;
+}
+
 static int
 sunxi_emac_setup_phy(struct sunxi_emac_softc *sc)
 {
@@ -921,7 +943,7 @@ sunxi_emac_setup_phy(struct sunxi_emac_s
 	}
 
 	if (sc->type == EMAC_H3) {
-		if (of_hasprop(sc->phandle, "allwinner,use-internal-phy")) {
+		if (sunxi_emac_has_internal_phy(sc)) {
 			reg |= EMAC_CLK_EPHY_SELECT;
 			reg &= ~EMAC_CLK_EPHY_SHUTDOWN;
 			if (of_hasprop(sc->phandle,
@@ -1262,15 +1284,31 @@ sunxi_emac_get_resources(struct sunxi_em
 {
 	const int phandle = sc->phandle;
 	bus_addr_t addr, size;
-	u_int n;
 
-	/* Map registers */
-	for (n = 0; n < _RES_NITEMS; n++) {
-		if (fdtbus_get_reg(phandle, n, , ) != 0)
+	/* Map EMAC registers */
+	if (fdtbus_get_reg(phandle, 0, , ) != 0)
+		return ENXIO;
+	if (bus_space_map(sc->bst, addr, size, 0, >bsh[_RES_EMAC]) != 0)
+		return ENXIO;
+
+	/* Map SYSCON registers */
+	if (of_hasprop(phandle, "syscon")) {
+		const int syscon_phandle = fdtbus_get_phandle(phandle,
+		"syscon");
+		if (syscon_phandle == -1)
+			return ENXIO;
+		if (fdtbus_get_reg(syscon_phandle, 0, , ) != 0)
 			return ENXIO;
-		if (bus_space_map(sc->bst, addr, size, 0, >bsh[n]) != 0)
+		if (size < EMAC_CLK_REG + 4)
+			return ENXIO;
+		addr += EMAC_CLK_REG;
+		size -= EMAC_CLK_REG;
+	} else {
+		if (fdtbus_get_reg(phandle, 1, , ) != 0)
 			return ENXIO;
 	}
+	if (bus_space_map(sc->bst, addr, size, 0, >bsh[_RES_SYSCON]) != 0)
+		return ENXIO;
 
 	/* Get clocks and resets. "ahb" is required, "ephy" is optional. */
 



CVS commit: src/sys

2017-11-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 30 20:25:56 UTC 2017

Modified Files:
src/sys/arch/xen/xen: xenevt.c
src/sys/compat/svr4: svr4_net.c
src/sys/compat/svr4_32: svr4_32_net.c
src/sys/dev: audio.c rndpseudo.c
src/sys/dev/dmover: dmover_io.c
src/sys/dev/dtv: dtv_demux.c
src/sys/dev/filemon: filemon.c
src/sys/dev/iscsi: iscsi_main.c
src/sys/dev/pad: pad.c
src/sys/dev/putter: putter.c
src/sys/external/bsd/drm2/drm: drm_drv.c
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm: vchiq_arm.c
src/sys/kern: kern_drvctl.c kern_event.c sys_mqueue.c sys_pipe.c
sys_socket.c uipc_sem.c vfs_vnops.c
src/sys/net: bpf.c if_tap.c
src/sys/opencrypto: cryptodev.c
src/sys/rump/librump/rumpkern: cons.c
src/sys/sys: file.h

Log Message:
add fo_name so we can identify the fileops in a simple way.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/xen/xenevt.c
cvs rdiff -u -r1.61 -r1.62 src/sys/compat/svr4/svr4_net.c
cvs rdiff -u -r1.22 -r1.23 src/sys/compat/svr4_32/svr4_32_net.c
cvs rdiff -u -r1.441 -r1.442 src/sys/dev/audio.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/rndpseudo.c
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/dmover/dmover_io.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dtv/dtv_demux.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/filemon/filemon.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/iscsi/iscsi_main.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/putter/putter.c
cvs rdiff -u -r1.18 -r1.19 src/sys/external/bsd/drm2/drm/drm_drv.c
cvs rdiff -u -r1.18 -r1.19 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_arm.c
cvs rdiff -u -r1.42 -r1.43 src/sys/kern/kern_drvctl.c
cvs rdiff -u -r1.100 -r1.101 src/sys/kern/kern_event.c
cvs rdiff -u -r1.39 -r1.40 src/sys/kern/sys_mqueue.c
cvs rdiff -u -r1.141 -r1.142 src/sys/kern/sys_pipe.c
cvs rdiff -u -r1.75 -r1.76 src/sys/kern/sys_socket.c
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/uipc_sem.c
cvs rdiff -u -r1.196 -r1.197 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.219 -r1.220 src/sys/net/bpf.c
cvs rdiff -u -r1.103 -r1.104 src/sys/net/if_tap.c
cvs rdiff -u -r1.96 -r1.97 src/sys/opencrypto/cryptodev.c
cvs rdiff -u -r1.6 -r1.7 src/sys/rump/librump/rumpkern/cons.c
cvs rdiff -u -r1.82 -r1.83 src/sys/sys/file.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/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.47 src/sys/arch/xen/xen/xenevt.c:1.48
--- src/sys/arch/xen/xen/xenevt.c:1.47	Sun Jul 16 10:02:48 2017
+++ src/sys/arch/xen/xen/xenevt.c	Thu Nov 30 15:25:54 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.47 2017/07/16 14:02:48 cherry Exp $  */
+/*  $NetBSD: xenevt.c,v 1.48 2017/11/30 20:25:54 christos Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.47 2017/07/16 14:02:48 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.48 2017/11/30 20:25:54 christos Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -74,6 +74,7 @@ static int	xenevt_fclose(struct file *);
 /* static int	xenevt_fkqfilter(struct file *, struct knote *); */
 
 static const struct fileops xenevt_fileops = {
+	.fo_name = "xenevt",
 	.fo_read = xenevt_fread,
 	.fo_write = xenevt_fwrite,
 	.fo_ioctl = xenevt_fioctl,

Index: src/sys/compat/svr4/svr4_net.c
diff -u src/sys/compat/svr4/svr4_net.c:1.61 src/sys/compat/svr4/svr4_net.c:1.62
--- src/sys/compat/svr4/svr4_net.c:1.61	Fri Sep  5 05:21:55 2014
+++ src/sys/compat/svr4/svr4_net.c	Thu Nov 30 15:25:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_net.c,v 1.61 2014/09/05 09:21:55 matt Exp $	*/
+/*	$NetBSD: svr4_net.c,v 1.62 2017/11/30 20:25:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_net.c,v 1.61 2014/09/05 09:21:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_net.c,v 1.62 2017/11/30 20:25:54 christos Exp $");
 
 #define COMPAT_SVR4 1
 
@@ -110,6 +110,7 @@ int svr4_netattach(int);
 int svr4_soo_close(file_t *);
 
 static const struct fileops svr4_netops = {
+	.fo_name = "srv4_net",
 	.fo_read = soo_read,
 	.fo_write = soo_write,
 	.fo_ioctl = soo_ioctl,

Index: src/sys/compat/svr4_32/svr4_32_net.c
diff -u src/sys/compat/svr4_32/svr4_32_net.c:1.22 src/sys/compat/svr4_32/svr4_32_net.c:1.23
--- src/sys/compat/svr4_32/svr4_32_net.c:1.22	Fri Sep  5 05:21:55 2014
+++ src/sys/compat/svr4_32/svr4_32_net.c	Thu Nov 30 15:25:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_net.c,v 1.22 2014/09/05 09:21:55 matt Exp $	 */
+/*	$NetBSD: svr4_32_net.c,v 1.23 2017/11/30 20:25:54 christos Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/distrib/utils/embedded/conf

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 19:55:47 UTC 2017

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf

Log Message:
Remove legacy awin kernels from image


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/distrib/utils/embedded/conf/armv7.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.20 src/distrib/utils/embedded/conf/armv7.conf:1.21
--- src/distrib/utils/embedded/conf/armv7.conf:1.20	Tue Nov 28 02:56:44 2017
+++ src/distrib/utils/embedded/conf/armv7.conf	Thu Nov 30 19:55:47 2017
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.20 2017/11/28 02:56:44 kre Exp $
+# $NetBSD: armv7.conf,v 1.21 2017/11/30 19:55:47 jmcneill Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -8,7 +8,6 @@ resize=true
 . ${DIR}/conf/evbarm.conf
 
 kernels_beagle="BEAGLEBOARD BEAGLEBONE"
-kernels_awin="BPI CUBIEBOARD CUBIETRUCK"
 kernels_rpi="RPI2"
 kernels_amlogic="ODROID-C1"
 kernels_tegra="TEGRA"
@@ -41,10 +40,6 @@ populate_beagle() {
 	:
 }
 
-populate_awin() {
-	:
-}
-
 populate_rpi() {
 	firmwaredir="${src}/external/broadcom/rpi-firmware/dist"
 	firmwarefiles="LICENCE.broadcom bootcode.bin fixup.dat fixup_cd.dat start.elf start_cd.elf"
@@ -119,7 +114,7 @@ populate() {
 	echo "${bar} looking for kernels in ${kernel} ${bar}"
 	kernels=""
 	# .ub kernels
-	for k in $kernels_beagle $kernels_awin $kernels_sunxi $kernels_amlogic $kernels_tegra; do
+	for k in $kernels_beagle $kernels_sunxi $kernels_amlogic $kernels_tegra; do
 		f="${kernel}/netbsd-${k}.ub.gz"
 		test -f "${f}" && kernels="${kernels} ${f}"
 	done
@@ -156,7 +151,6 @@ populate() {
 
 	# board specific configuration
 	populate_beagle
-	populate_awin
 	populate_rpi
 	populate_amlogic
 	populate_tegra



CVS commit: src/etc/etc.evbarm

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 19:54:50 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Unhook BPI, CUBIEBOARD, and CUBIETRUCK kernels from the build (use SUNXI kernel 
now)


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/etc/etc.evbarm/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/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.90 src/etc/etc.evbarm/Makefile.inc:1.91
--- src/etc/etc.evbarm/Makefile.inc:1.90	Sun Aug 20 15:35:31 2017
+++ src/etc/etc.evbarm/Makefile.inc	Thu Nov 30 19:54:50 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.90 2017/08/20 15:35:31 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.91 2017/11/30 19:54:50 jmcneill Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -24,12 +24,8 @@ EVBARM_BOARDS.armv7+=		BCM5301X
 EVBARM_BOARDS.armv7hf+=		BCM5301X
 #EVBARM_BOARDS.armv7+=		BCM56340
 #EVBARM_BOARDS.armv7hf+= 	BCM56340
-EVBARM_BOARDS.armv7+=		BPI
-EVBARM_BOARDS.armv7hf+=		BPI
-EVBARM_BOARDS.armv7+=		CUBIEBOARD
-EVBARM_BOARDS.armv7hf+=		CUBIEBOARD
-EVBARM_BOARDS.armv7+=		CUBIETRUCK
-EVBARM_BOARDS.armv7hf+=		CUBIETRUCK
+KERNEL_SETS.armv7+=		SUNXI
+KERNEL_SETS.armv7hf+=		SUNXI
 .else
 IMAGEENDIAN=	le
 # little endian boards
@@ -90,12 +86,6 @@ EVBARM_BOARDS.armv7+=		BEAGLEBOARDXM
 EVBARM_BOARDS.armv7hf+= 	BEAGLEBOARDXM
 EVBARM_BOARDS.armv7+=		BEAGLEBONE
 EVBARM_BOARDS.armv7hf+= 	BEAGLEBONE
-EVBARM_BOARDS.armv7+=		BPI
-EVBARM_BOARDS.armv7hf+= 	BPI
-EVBARM_BOARDS.armv7+=		CUBIEBOARD
-EVBARM_BOARDS.armv7hf+= 	CUBIEBOARD
-EVBARM_BOARDS.armv7+=		CUBIETRUCK
-EVBARM_BOARDS.armv7hf+= 	CUBIETRUCK
 EVBARM_BOARDS.armv7+=		CUBOX
 EVBARM_BOARDS.armv7hf+= 	CUBOX
 EVBARM_BOARDS.armv7+=		CUBOX-I



CVS commit: src/sys/arch/evbarm/conf

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 19:52:23 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: SUNXI

Log Message:
Add sun4i and sun7i DTS files to the build.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/evbarm/conf/SUNXI

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/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.53 src/sys/arch/evbarm/conf/SUNXI:1.54
--- src/sys/arch/evbarm/conf/SUNXI:1.53	Thu Nov 30 19:48:44 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Nov 30 19:52:23 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.53 2017/11/30 19:48:44 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.54 2017/11/30 19:52:23 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -10,6 +10,28 @@ include	"arch/evbarm/conf/GENERIC.common
 makeoptions	DTSGNUARCH="arm arm64"
 makeoptions	DTSSUBDIR="allwinner"
 makeoptions	DTS="
+	sun4i-a10-a1000.dts
+	sun4i-a10-ba10-tvbox.dts
+	sun4i-a10-chuwi-v7-cw0825.dts
+	sun4i-a10-cubieboard.dts
+	sun4i-a10-dserve-dsrv9703c.dts
+	sun4i-a10-gemei-g9.dts
+	sun4i-a10-hackberry.dts
+	sun4i-a10-hyundai-a7hd.dts
+	sun4i-a10-inet1.dts
+	sun4i-a10-inet97fv2.dts
+	sun4i-a10-inet9f-rev03.dts
+	sun4i-a10-itead-iteaduino-plus.dts
+	sun4i-a10-jesurun-q5.dts
+	sun4i-a10-marsboard.dts
+	sun4i-a10-mini-xplus.dts
+	sun4i-a10-mk802.dts
+	sun4i-a10-mk802ii.dts
+	sun4i-a10-olinuxino-lime.dts
+	sun4i-a10-pcduino.dts
+	sun4i-a10-pcduino2.dts
+	sun4i-a10-pov-protab2-ips9.dts
+
 	sun5i-a13-difrnce-dit4350.dts
 	sun5i-a13-empire-electronix-d709.dts
 	sun5i-a13-empire-electronix-m712.dts
@@ -34,6 +56,31 @@ makeoptions	DTS="
 	sun6i-a31-m9.dts
 	sun6i-a31-mele-a1000g-quad.dts
 
+	sun7i-a20-bananapi-m1-plus.dts
+	sun7i-a20-bananapi.dts
+	sun7i-a20-bananapro.dts
+	sun7i-a20-cubieboard2.dts
+	sun7i-a20-cubietruck.dts
+	sun7i-a20-hummingbird.dts
+	sun7i-a20-i12-tvbox.dts
+	sun7i-a20-icnova-swac.dts
+	sun7i-a20-itead-ibox.dts
+	sun7i-a20-lamobo-r1.dts
+	sun7i-a20-m3.dts
+	sun7i-a20-mk808c.dts
+	sun7i-a20-olimex-som-evb.dts
+	sun7i-a20-olinuxino-lime.dts
+	sun7i-a20-olinuxino-lime2-emmc.dts
+	sun7i-a20-olinuxino-lime2.dts
+	sun7i-a20-olinuxino-micro-emmc.dts
+	sun7i-a20-olinuxino-micro.dts
+	sun7i-a20-orangepi-mini.dts
+	sun7i-a20-orangepi.dts
+	sun7i-a20-pcduino3-nano.dts
+	sun7i-a20-pcduino3.dts
+	sun7i-a20-wexler-tab7200.dts
+	sun7i-a20-wits-pro-a20-dkt.dts
+
 	sun8i-a83t-allwinner-h8homlet-v2.dts
 	sun8i-a83t-bananapi-m3.dts
 	sun8i-a83t-cubietruck-plus.dts



CVS commit: src/sys/arch/evbarm/conf

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 19:48:44 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: SUNXI

Log Message:
add sun8i-a83t-tbs-a711.dts and sun8i-h3-nanopi-m1-plus.dts


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/evbarm/conf/SUNXI

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/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.52 src/sys/arch/evbarm/conf/SUNXI:1.53
--- src/sys/arch/evbarm/conf/SUNXI:1.52	Mon Nov 13 17:37:47 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Thu Nov 30 19:48:44 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.52 2017/11/13 17:37:47 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.53 2017/11/30 19:48:44 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -37,12 +37,14 @@ makeoptions	DTS="
 	sun8i-a83t-allwinner-h8homlet-v2.dts
 	sun8i-a83t-bananapi-m3.dts
 	sun8i-a83t-cubietruck-plus.dts
+	sun8i-a83t-tbs-a711.dts
 
 	sun8i-h2-plus-orangepi-zero.dts
 
 	sun8i-h3-bananapi-m2-plus.dts
 	sun8i-h3-beelink-x2.dts
 	sun8i-h3-nanopi-m1.dts
+	sun8i-h3-nanopi-m1-plus.dts
 	sun8i-h3-nanopi-neo.dts
 	sun8i-h3-nanopi-neo-air.dts
 	sun8i-h3-orangepi-2.dts



CVS commit: src/external/bsd/elftoolchain/dist/libdwarf

2017-11-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 30 19:45:53 UTC 2017

Modified Files:
src/external/bsd/elftoolchain/dist/libdwarf: dwarf.h

Log Message:
add more DW_ATE_ constants


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/elftoolchain/dist/libdwarf/dwarf.h

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

Modified files:

Index: src/external/bsd/elftoolchain/dist/libdwarf/dwarf.h
diff -u src/external/bsd/elftoolchain/dist/libdwarf/dwarf.h:1.3 src/external/bsd/elftoolchain/dist/libdwarf/dwarf.h:1.4
--- src/external/bsd/elftoolchain/dist/libdwarf/dwarf.h:1.3	Fri Feb 19 21:43:41 2016
+++ src/external/bsd/elftoolchain/dist/libdwarf/dwarf.h	Thu Nov 30 14:45:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwarf.h,v 1.3 2016/02/20 02:43:41 christos Exp $	*/
+/*	$NetBSD: dwarf.h,v 1.4 2017/11/30 19:45:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007 John Birrell (j...@freebsd.org)
@@ -436,22 +436,42 @@
 #define	DW_OP_GNU_addr_index		0xfb
 #define	DW_OP_GNU_const_index		0xfc
 
-#define DW_ATE_address		 	0x1
-#define DW_ATE_boolean		 	0x2
-#define DW_ATE_complex_float	 	0x3
-#define DW_ATE_float		 	0x4
-#define DW_ATE_signed		 	0x5
-#define DW_ATE_signed_char	 	0x6
-#define DW_ATE_unsigned		 	0x7
-#define DW_ATE_unsigned_char	 	0x8
-#define DW_ATE_imaginary_float	 	0x9
-#define DW_ATE_packed_decimal	 	0xa
-#define DW_ATE_numeric_string	 	0xb
-#define DW_ATE_edited		 	0xc
-#define DW_ATE_signed_fixed	 	0xd
-#define DW_ATE_unsigned_fixed	 	0xe
-#define DW_ATE_decimal_float	 	0xf
-#define DW_ATE_lo_user		 	0x80
+#define	DW_ATE_address			0x01
+#define	DW_ATE_boolean			0x02
+#define	DW_ATE_complex_float		0x03
+#define	DW_ATE_float			0x04
+#define	DW_ATE_signed			0x05
+#define	DW_ATE_signed_char		0x06
+#define	DW_ATE_unsigned			0x07
+#define	DW_ATE_unsigned_char		0x08
+#define	DW_ATE_imaginary_float		0x09
+#define	DW_ATE_packed_decimal		0x0a
+#define	DW_ATE_numeric_string		0x0b
+#define	DW_ATE_edited			0x0c
+#define	DW_ATE_signed_fixed		0x0d
+#define	DW_ATE_unsigned_fixed		0x0e
+#define	DW_ATE_decimal_float		0x0f
+#define	DW_ATE_UTF			0x10
+
+#define	DW_ATE_lo_user			0x80
+
+#define	DW_ATE_HP_float80		0x80	/* FP (80 bit) */
+#define	DW_ATE_HP_complex_float80	0x81	/* Complex FP (80 bit) */
+#define	DW_ATE_HP_float128		0x82	/* FP (128 bit) */
+#define	DW_ATE_HP_complex_float128	0x83	/* Complex FP (128 bit) */
+#define	DW_ATE_HP_floathpintel		0x84	/* FP (82 bit IA64) */
+#define	DW_ATE_HP_imaginary_float80	0x85	
+#define	DW_ATE_HP_imaginary_float128	0x86	
+#define	DW_ATE_HP_VAX_float		0x88	/* FP (F, G) */
+#define	DW_ATE_HP_VAX_float_d		0x89	/* FP (D) */
+#define	DW_ATE_HP_packed_decimal	0x8a	/* Cobol */
+#define	DW_ATE_HP_zoned_decimal		0x8b	/* Cobol */
+#define	DW_ATE_HP_edited		0x8c	/* Cobol */
+#define	DW_ATE_HP_signed_fixed		0x8d	/* Cobol */
+#define	DW_ATE_HP_unsigned_fixed	0x8e	/* Cobol */
+#define	DW_ATE_HP_VAX_complex_float	0x8f	/* Complex FP (F, G) */
+#define	DW_ATE_HP_VAX_complex_float_d	0x90	/* Complex FP (D) */
+
 #define DW_ATE_hi_user		 	0xff
 
 #define DW_ACCESS_public		0x01



CVS commit: src/doc

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 19:49:31 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
dts updated to 4.15-rc1


To generate a diff of this commit:
cvs rdiff -u -r1.1487 -r1.1488 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1487 src/doc/3RDPARTY:1.1488
--- src/doc/3RDPARTY:1.1487	Wed Nov 29 04:09:01 2017
+++ src/doc/3RDPARTY	Thu Nov 30 19:49:31 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1487 2017/11/29 04:09:01 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1488 2017/11/30 19:49:31 jmcneill Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1717,8 +1717,8 @@ Notes:
 external/gpl2/dtc/dtc2netbsd should be used to create directories to import
 
 Package:	dts
-Version:	4.14-rc6
-Current Vers:	4.14-rc6
+Version:	4.15-rc1
+Current Vers:	4.15-rc1
 Maintainer:	https://www.kernel.org/
 Archive Site:	https://cdn.kernel.org/pub/linux/kernel/v4.x/
 Home Page:	https://www.kernel.org/



CVS commit: src/sys/external/gpl2/dts/dist

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 19:42:59 UTC 2017

Modified Files:
src/sys/external/gpl2/dts/dist/include/dt-bindings/input:
linux-event-codes.h
Removed Files:
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts: .gitignore
src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl:
stm32f429-pinfunc.h stm32f746-pinfunc.h stm32h7-pinfunc.h

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/.gitignore
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h
cvs rdiff -u -r1.1.1.1 -r0 \

src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32f429-pinfunc.h \

src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32f746-pinfunc.h \
src/sys/external/gpl2/dts/dist/include/dt-bindings/pinctrl/stm32h7-pinfunc.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/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h
diff -u src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h:1.4 src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h:1.5
--- src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h:1.4	Sat Oct 28 10:35:04 2017
+++ src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h	Thu Nov 30 19:42:58 2017
@@ -1,5 +1,6 @@
-/*	$NetBSD: linux-event-codes.h,v 1.4 2017/10/28 10:35:04 jmcneill Exp $	*/
+/*	$NetBSD: linux-event-codes.h,v 1.5 2017/11/30 19:42:58 jmcneill Exp $	*/
 
+/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 /*
  * Input event codes
  *
@@ -408,6 +409,7 @@
 #define BTN_TOOL_MOUSE		0x146
 #define BTN_TOOL_LENS		0x147
 #define BTN_TOOL_QUINTTAP	0x148	/* Five fingers on trackpad */
+#define BTN_STYLUS3		0x149
 #define BTN_TOUCH		0x14a
 #define BTN_STYLUS		0x14b
 #define BTN_STYLUS2		0x14c



CVS commit: src/sys/kern

2017-11-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov 30 18:44:16 UTC 2017

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

Log Message:
If no auxv is present, don't kmem_alloc(0). Easy to panic the kernel by
typing 'cat /proc/aout_pid/auxv' on whatever a.out binary you're running.
Fortunately, amd64 does not enable EXEC_AOUT by default. Unfortunately,
i386 does enable it by default.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/sys/kern/kern_proc.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/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.208 src/sys/kern/kern_proc.c:1.209
--- src/sys/kern/kern_proc.c:1.208	Tue Nov  7 19:44:04 2017
+++ src/sys/kern/kern_proc.c	Thu Nov 30 18:44:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.208 2017/11/07 19:44:04 christos Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.209 2017/11/30 18:44:16 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.208 2017/11/07 19:44:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.209 2017/11/30 18:44:16 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -2463,16 +2463,19 @@ proc_getauxv(struct proc *p, void **buf,
 	struct ps_strings pss;
 	int error;
 	void *uauxv, *kauxv;
+	size_t size;
 
 	if ((error = copyin_psstrings(p, )) != 0)
 		return error;
-
 	if (pss.ps_envstr == NULL)
 		return EIO;
 
+	size = p->p_execsw->es_arglen;
+	if (size == 0)
+		return EIO;
+
 	size_t ptrsz = PROC_PTRSZ(p);
 	uauxv = (void *)((char *)pss.ps_envstr + (pss.ps_nenvstr + 1) * ptrsz);
-	size_t size = p->p_execsw->es_arglen;
 
 	kauxv = kmem_alloc(size, KM_SLEEP);
 



CVS commit: src/sys/arch/arm/sunxi

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 18:29:25 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sun4i_emac.c

Log Message:
report VLAN MTU capability


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun4i_emac.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/sunxi/sun4i_emac.c
diff -u src/sys/arch/arm/sunxi/sun4i_emac.c:1.1 src/sys/arch/arm/sunxi/sun4i_emac.c:1.2
--- src/sys/arch/arm/sunxi/sun4i_emac.c:1.1	Fri Oct 20 22:29:15 2017
+++ src/sys/arch/arm/sunxi/sun4i_emac.c	Thu Nov 30 18:29:25 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun4i_emac.c,v 1.1 2017/10/20 22:29:15 jmcneill Exp $ */
+/* $NetBSD: sun4i_emac.c,v 1.2 2017/11/30 18:29:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013-2017 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.1 2017/10/20 22:29:15 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun4i_emac.c,v 1.2 2017/11/30 18:29:25 jmcneill Exp $");
 
 #include 
 #include 
@@ -346,6 +346,9 @@ sun4i_emac_attach(device_t parent, devic
 	ifp->if_watchdog = sun4i_emac_ifwatchdog;
 	IFQ_SET_READY(>if_snd);
 
+	/* 802.1Q VLAN-sized frames are supported */
+	sc->sc_ec.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
 	ifmedia_init(>mii_media, 0, ether_mediachange, ether_mediastatus);
 
 mii->mii_ifp = ifp;



CVS commit: [netbsd-8] src/doc

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 16:13:35 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
Note tickets #400 - #408, #411


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.85 -r1.1.2.86 src/doc/CHANGES-8.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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.85 src/doc/CHANGES-8.0:1.1.2.86
--- src/doc/CHANGES-8.0:1.1.2.85	Mon Nov 27 14:18:21 2017
+++ src/doc/CHANGES-8.0	Thu Nov 30 16:13:35 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.85 2017/11/27 14:18:21 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.86 2017/11/30 16:13:35 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -7952,3 +7952,84 @@ sys/dev/pci/mlyreg.h1.6
 	Fix a typo, pack the structure correctly.
 	[maxv, ticket #399]
 
+sys/compat/linux/common/linux_sg.c		1.14
+
+	Use "linux_sg_version", and not "version".
+	[maxv, ticket #400]
+
+sys/arch/amd64/amd64/machdep.c			1.267
+
+	Do not leak GDT slots during context switches.
+	[maxv, ticket #401]
+
+sys/arch/x86/x86/lapic.c			1.61
+
+	Use the correct default LAPIC base address.
+	[maxv, ticket #402]
+
+sys/arch/x86/x86/lapic.c			1.63
+
+	Fix a stack overflow in the LAPIC code.
+	[maxv, ticket #403]
+
+sys/kern/subr_localcount.c			1.7
+sys/sys/localcount.h1.5
+
+	Implement a debugging facility (overflow/underflow detection)
+	for localcount(9).
+	[ozaki-r, ticket #404]
+
+sys/kern/kern_lock.c1.160
+sys/kern/subr_pserialize.c			1.9
+sys/rump/librump/rumpkern/emul.c		1.184-1.185
+sys/rump/librump/rumpkern/rump.c		1.330
+sys/sys/pserialize.h1.2
+
+	Implement debugging feature for pserialize(9).
+	[ozaki-r, ticket #405]
+
+sys/netipsec/ipsec.c1.123
+sys/netipsec/key.c1.236-1.242
+sys/netipsec/key.h1.33
+
+	Provide a function to call MGETHDR and MCLGET.
+	Fix error handling of MCLGET in key_alloc_mbuf.
+	Add missing splx to key_spdexpire.
+	Use M_WAITOK to allocate mbufs wherever sleepable.
+	Get rid of unnecessary NULL checks that are obsoleted by M_WAITOK.
+	Simplify the code by avoiding unnecessary error checks.
+	Call key_sendup_mbuf immediately unless key_acquire is called in
+	softint.
+	[ozaki-r, ticket #406]
+
+sys/compat/common/uipc_syscalls_40.c		1.14
+sys/compat/linux/common/linux_socket.c		1.139
+sys/compat/linux32/common/linux32_socket.c	1.28
+sys/net/if.c	1.400
+sys/net/if_spppsubr.c1.173-1.174
+sys/netinet/ip_carp.c1.93
+sys/netinet6/in6.c1.252-1.254
+sys/netipsec/key.c1.243
+
+	Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref.
+	Fix and make consistently use psz/psref in ifconf variants.
+	Tweak a condition; we don't need to care ifacount to be negative.
+	Fix a race condition of in6_ifinit. Cleanup.
+	[ozaki-r, ticket #407]
+
+sys/arch/arm/broadcom/bcm2835_space.c		1.12-1.13
+
+	Sync with armv7_generic_space.c
+	- big endian support (probably not needed)
+	- a4x subreagion/mmap support
+	- fix some a4x stream methods
+	- add UVM_KMF_COLORMATCH in bs_map when allocating KVA
+	- support BUS_SPACE_MAP_PREFETCHABLE
+	[skrll, ticket #408]
+
+lib/libc/gen/vis.c1.74
+
+	Use 16x instead of 4x the amount of space since each wint_t
+	can result in 4 bytes of 4 characters ("\ooo") each.
+	[maya, ticket #411]
+



CVS commit: src/lib/libc/hash/sha3

2017-11-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Nov 30 16:00:48 UTC 2017

Modified Files:
src/lib/libc/hash/sha3: Makefile.inc
Added Files:
src/lib/libc/hash/sha3: SHA3_Selftest.3 SHAKE.3 keccak.3 sha3.3

Log Message:
Add riastradh's man pages for sha3 and friends.

Commented out since the symbols themselves are not yet public.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/hash/sha3/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/hash/sha3/SHA3_Selftest.3 \
src/lib/libc/hash/sha3/SHAKE.3 src/lib/libc/hash/sha3/keccak.3 \
src/lib/libc/hash/sha3/sha3.3

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

Modified files:

Index: src/lib/libc/hash/sha3/Makefile.inc
diff -u src/lib/libc/hash/sha3/Makefile.inc:1.1 src/lib/libc/hash/sha3/Makefile.inc:1.2
--- src/lib/libc/hash/sha3/Makefile.inc:1.1	Thu Nov 30 05:47:24 2017
+++ src/lib/libc/hash/sha3/Makefile.inc	Thu Nov 30 16:00:48 2017
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.inc,v 1.1 2017/11/30 05:47:24 riastradh Exp $
+#	$NetBSD: Makefile.inc,v 1.2 2017/11/30 16:00:48 wiz Exp $
 
 .PATH: ${.CURDIR}/hash/sha3
 
 SRCS+=	keccak.c sha3.c
 
 # XXX not (yet) public
-#MAN+=	sha3.3
+#MAN+=	SHA3_Selftest.3 SHAKE.3 keccak.3 sha3.3
 
 #MLINKS+=sha3.3 SHA3_224_Init.3 sha3.3 SHA3_224_Update.3 sha3.3 SHA3_224_Final.3
 #MLINKS+=sha3.3 SHA3_256_Init.3 sha3.3 SHA3_256_Update.3 sha3.3 SHA3_256_Final.3
@@ -13,4 +13,3 @@ SRCS+=	keccak.c sha3.c
 #MLINKS+=sha3.3 SHA3_512_Init.3 sha3.3 SHA3_512_Update.3 sha3.3 SHA3_512_Final.3
 #MLINKS+=sha3.3 SHAKE128_Init.3 sha3.3 SHAKE128_Update.3 sha3.3 SHAKE128_Final.3
 #MLINKS+=sha3.3 SHAKE256_Init.3 sha3.3 SHAKE256_Update.3 sha3.3 SHAKE256_Final.3
-#MLINKS+=sha3.3 SHA3_Selftest.3

Added files:

Index: src/lib/libc/hash/sha3/SHA3_Selftest.3
diff -u /dev/null src/lib/libc/hash/sha3/SHA3_Selftest.3:1.1
--- /dev/null	Thu Nov 30 16:00:48 2017
+++ src/lib/libc/hash/sha3/SHA3_Selftest.3	Thu Nov 30 16:00:48 2017
@@ -0,0 +1,73 @@
+.\" $NetBSD: SHA3_Selftest.3,v 1.1 2017/11/30 16:00:48 wiz Exp $
+.\"
+.\" Copyright (c) 2015 Taylor R. Campbell
+.\" All rights reserved.
+.\"
+.\" 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 AUTHOR 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 AUTHOR 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.
+.\"
+.Dd October 14, 2015
+.Dt SHA3_SELFTEST 3
+.Os
+.Sh NAME
+.Nm SHA3_Selftest
+.Nd NIST FIPS PUB 202: SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions
+.Sh SYNOPSIS
+.In sha3.h
+.Ft int
+.Fn SHA3_Selftest "void"
+.Sh DESCRIPTION
+The
+.Nm
+function automatically tests a number of SHA-3 computations on fixed
+inputs with with known outputs to make sure the
+.Xr sha3 3
+library is not catastrophically broken.
+Applications should call
+.Fn SHA3_Selftest
+and confirm that it succeeded before using the
+.Xr sha3 3 ,
+.Xr SHAKE 3 ,
+or
+.Xr keccak 3
+functions.
+.Pp
+.Fn SHA3_Selftest
+returns 0 if successful, or -1 if the self-test failed.
+.Pp
+The
+.Fn SHA3_Selftest
+function costs a few hundred thousand cycles on most CPUs, since it
+involves a little over a hundred calls to the Keccak permutation,
+which usually take one or two thousand cycles each.
+.Sh SEE ALSO
+.Xr keccak 3 ,
+.Xr sha3 3 ,
+.Xr SHAKE 3
+.Sh STANDARDS
+.Rs
+.%A National Institute of Standards and Technology
+.%T SHA-3 Standard: Permutation-Based Hash and Extendable-Output Functions
+.%O FIPS PUB 202
+.%D August 2015
+.Re
+.Sh AUTHORS
+.An Taylor R Campbell Aq campbell+s...@mumble.net
Index: src/lib/libc/hash/sha3/SHAKE.3
diff -u /dev/null src/lib/libc/hash/sha3/SHAKE.3:1.1
--- /dev/null	Thu Nov 30 16:00:48 2017
+++ src/lib/libc/hash/sha3/SHAKE.3	Thu Nov 30 16:00:48 2017
@@ -0,0 +1,114 @@
+.\" $NetBSD: SHAKE.3,v 1.1 2017/11/30 16:00:48 wiz Exp $
+.\"
+.\" Copyright (c) 

CVS commit: [netbsd-8] src/sys

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 15:57:37 UTC 2017

Modified Files:
src/sys/compat/common [netbsd-8]: uipc_syscalls_40.c
src/sys/compat/linux/common [netbsd-8]: linux_socket.c
src/sys/compat/linux32/common [netbsd-8]: linux32_socket.c
src/sys/net [netbsd-8]: if.c if_spppsubr.c
src/sys/netinet [netbsd-8]: ip_carp.c
src/sys/netinet6 [netbsd-8]: in6.c
src/sys/netipsec [netbsd-8]: key.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #407):
sys/compat/linux32/common/linux32_socket.c: revision 1.28
sys/net/if.c: revision 1.400
sys/netipsec/key.c: revision 1.243
sys/compat/linux/common/linux_socket.c: revision 1.139
sys/netinet/ip_carp.c: revision 1.93
sys/netinet6/in6.c: revision 1.252
sys/netinet6/in6.c: revision 1.253
sys/netinet6/in6.c: revision 1.254
sys/net/if_spppsubr.c: revision 1.173
sys/net/if_spppsubr.c: revision 1.174
sys/compat/common/uipc_syscalls_40.c: revision 1.14
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Fix usage of FOREACH macro
key_sad.lock is held there so SAVLIST_WRITER_FOREACH is enough.
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)
Fix and make consistent of usages of psz/psref in ifconf variants
Remove unnecessary goto because there is no cleanup code to share (NFC)
Tweak a condition; we don't need to care ifacount to be negative
Fix a race condition of in6_ifinit
in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.
Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.138 -r1.138.6.1 src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.27 -r1.27.6.1 src/sys/compat/linux32/common/linux32_socket.c
cvs rdiff -u -r1.394.2.1 -r1.394.2.2 src/sys/net/if.c
cvs rdiff -u -r1.169.6.1 -r1.169.6.2 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.90 -r1.90.2.1 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.245.2.2 -r1.245.2.3 src/sys/netinet6/in6.c
cvs rdiff -u -r1.163.2.3 -r1.163.2.4 src/sys/netipsec/key.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/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.13 src/sys/compat/common/uipc_syscalls_40.c:1.13.6.1
--- src/sys/compat/common/uipc_syscalls_40.c:1.13	Tue Mar 14 09:03:08 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Thu Nov 30 15:57:37 2017
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.13 2017/03/14 09:03:08 ozaki-r Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.13.6.1 2017/11/30 15:57:37 martin Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13 2017/03/14 09:03:08 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.1 2017/11/30 15:57:37 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -53,6 +53,7 @@ compat_ifconf(u_long cmd, void *data)
 		struct ifaddr *ifa;
 
 		if_acquire(ifp, );
+		pserialize_read_exit(s);
 
 		(void)strncpy(ifr.ifr_name, ifp->if_xname,
 		sizeof(ifr.ifr_name));
@@ -69,9 +70,10 @@ compat_ifconf(u_long cmd, void *data)
 ifrp++;
 			}
 			space -= sizeof(ifr);
-			continue;
+			goto next;
 		}
 
+		s = pserialize_read_enter();
 		IFADDR_READER_FOREACH(ifa, ifp) {
 			struct sockaddr *sa = ifa->ifa_addr;
 			struct psref psref_ifa;
@@ -85,11 +87,8 @@ compat_ifconf(u_long cmd, void *data)
 /*
  * If it does not fit, we don't bother with it
  */
-if (sa->sa_len > sizeof(*osa)) {
-	s = pserialize_read_enter();
-	ifa_release(ifa, _ifa);
-	continue;
-}
+if (sa->sa_len > sizeof(*osa))
+	goto next_ifa;
 memcpy(_addr, sa, sa->sa_len);
 osa->sa_family = sa->sa_family;
 if (space >= sz) {
@@ -119,13 +118,20 @@ compat_ifconf(u_long cmd, void *data)
 		 (char *)>ifr_addr);
 }
 			}
-			s = pserialize_read_enter();
-			ifa_release(ifa, _ifa);
-			if (error != 0)
+			if (error != 0) {
+ifa_release(ifa, _ifa);
 goto release_exit;
+			}
 			space -= sz;
+
+		next_ifa:
+			s = pserialize_read_enter();
+			ifa_release(ifa, _ifa);
 		}
+		pserialize_read_exit(s);
 
+	next:
+		s = pserialize_read_enter();
 		if_release(ifp, );
 	}
 	pserialize_read_exit(s);
@@ -138,7 +144,6 @@ compat_ifconf(u_long cmd, void *data)
 	return (0);
 
 release_exit:
-	

CVS commit: src/sbin/mount_qemufwcfg

2017-11-30 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Nov 30 15:42:18 UTC 2017

Modified Files:
src/sbin/mount_qemufwcfg: fwcfg.c

Log Message:
Sync (dead) usage with man page.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/mount_qemufwcfg/fwcfg.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/mount_qemufwcfg/fwcfg.c
diff -u src/sbin/mount_qemufwcfg/fwcfg.c:1.4 src/sbin/mount_qemufwcfg/fwcfg.c:1.5
--- src/sbin/mount_qemufwcfg/fwcfg.c:1.4	Thu Nov 30 03:31:08 2017
+++ src/sbin/mount_qemufwcfg/fwcfg.c	Thu Nov 30 15:42:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fwcfg.c,v 1.4 2017/11/30 03:31:08 christos Exp $ */
+/* $NetBSD: fwcfg.c,v 1.5 2017/11/30 15:42:18 wiz Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: fwcfg.c,v 1.4 2017/11/30 03:31:08 christos Exp $");
+__RCSID("$NetBSD: fwcfg.c,v 1.5 2017/11/30 15:42:18 wiz Exp $");
 
 #include 
 
@@ -212,8 +212,8 @@ build_tree(virtdir_t *v)
 static __dead void
 usage(void)
 {
-	fprintf(stderr, "Usage: %s [-F ] [-g ] [-m ] "
-	"[-M ] [-u ] []", getprogname());
+	fprintf(stderr, "Usage: %s [-F path] [-g gid] [-M dir-mode] "
+	"[-m file-mode] [-u uid] [fuse-options]", getprogname());
 	exit(EXIT_FAILURE);
 }
 #endif



CVS commit: [netbsd-8] src/sys/netipsec

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 14:57:34 UTC 2017

Modified Files:
src/sys/netipsec [netbsd-8]: ipsec.c key.c key.h

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #406):
sys/netipsec/key.c: revision 1.239
sys/netipsec/key.c: revision 1.240
sys/netipsec/key.c: revision 1.241
sys/netipsec/key.c: revision 1.242
sys/netipsec/key.h: revision 1.33
sys/netipsec/ipsec.c: revision 1.123
sys/netipsec/key.c: revision 1.236
sys/netipsec/key.c: revision 1.237
sys/netipsec/key.c: revision 1.238
Provide a function to call MGETHDR and MCLGET
The change fixes two usages of MGETHDR that don't check whether a mbuf is really
allocated before passing it to MCLGET.
Fix error handling of MCLGET in key_alloc_mbuf
Add missing splx to key_spdexpire
Use M_WAITOK to allocate mbufs wherever sleepable
Further changes will get rid of unnecessary NULL checks then.
Get rid of unnecessary NULL checks that are obsoleted by M_WAITOK
Simply the code by avoiding unnecessary error checks
- Remove unnecessary m_pullup for self-allocated mbufs
- Replace some if-fails-return sanity checks with KASSERT
Call key_sendup_mbuf immediately unless key_acquire is called in softint
We need to defer it only if it's called in softint to avoid deadlock.


To generate a diff of this commit:
cvs rdiff -u -r1.99.2.1 -r1.99.2.2 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.163.2.2 -r1.163.2.3 src/sys/netipsec/key.c
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/netipsec/key.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/netipsec/ipsec.c
diff -u src/sys/netipsec/ipsec.c:1.99.2.1 src/sys/netipsec/ipsec.c:1.99.2.2
--- src/sys/netipsec/ipsec.c:1.99.2.1	Sat Oct 21 19:43:54 2017
+++ src/sys/netipsec/ipsec.c	Thu Nov 30 14:57:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec.c,v 1.99.2.1 2017/10/21 19:43:54 snj Exp $	*/
+/*	$NetBSD: ipsec.c,v 1.99.2.2 2017/11/30 14:57:34 martin Exp $	*/
 /*	$FreeBSD: /usr/local/www/cvsroot/FreeBSD/src/sys/netipsec/ipsec.c,v 1.2.2.2 2003/07/01 01:38:13 sam Exp $	*/
 /*	$KAME: ipsec.c,v 1.103 2001/05/24 07:14:18 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.99.2.1 2017/10/21 19:43:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec.c,v 1.99.2.2 2017/11/30 14:57:34 martin Exp $");
 
 /*
  * IPsec controller part.
@@ -1422,7 +1422,7 @@ ipsec_get_policy(struct secpolicy *polic
 	if (policy == NULL || mp == NULL)
 		return EINVAL;
 
-	*mp = key_sp2msg(policy);
+	*mp = key_sp2msg(policy, M_NOWAIT);
 	if (!*mp) {
 		IPSECLOG(LOG_DEBUG, "No more memory.\n");
 		return ENOBUFS;

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.163.2.2 src/sys/netipsec/key.c:1.163.2.3
--- src/sys/netipsec/key.c:1.163.2.2	Tue Nov 21 11:11:20 2017
+++ src/sys/netipsec/key.c	Thu Nov 30 14:57:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.163.2.2 2017/11/21 11:11:20 martin Exp $	*/
+/*	$NetBSD: key.c,v 1.163.2.3 2017/11/30 14:57:34 martin Exp $	*/
 /*	$FreeBSD: src/sys/netipsec/key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.2 2017/11/21 11:11:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.163.2.3 2017/11/30 14:57:34 martin Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -601,23 +601,18 @@ key_msghdr_get_sockaddr(const struct sad
 	return PFKEY_ADDR_SADDR(mhp->ext[idx]);
 }
 
-static struct mbuf *
+static void
 key_fill_replymsg(struct mbuf *m, int seq)
 {
 	struct sadb_msg *msg;
 
-	if (m->m_len < sizeof(*msg)) {
-		m = m_pullup(m, sizeof(*msg));
-		if (m == NULL)
-			return NULL;
-	}
+	KASSERT(m->m_len >= sizeof(*msg));
+
 	msg = mtod(m, struct sadb_msg *);
 	msg->sadb_msg_errno = 0;
 	msg->sadb_msg_len = PFKEY_UNIT64(m->m_pkthdr.len);
 	if (seq != 0)
 		msg->sadb_msg_seq = seq;
-
-	return m;
 }
 
 #if 0
@@ -684,17 +679,17 @@ static struct mbuf *key_setsadbxfrag (u_
 static void key_porttosaddr (union sockaddr_union *, u_int16_t);
 static int key_checksalen (const union sockaddr_union *);
 static struct mbuf *key_setsadbmsg (u_int8_t, u_int16_t, u_int8_t,
-	u_int32_t, pid_t, u_int16_t);
+	u_int32_t, pid_t, u_int16_t, int);
 static struct mbuf *key_setsadbsa (struct secasvar *);
-static struct mbuf *key_setsadbaddr (u_int16_t,
-	const struct sockaddr *, u_int8_t, u_int16_t);
+static struct mbuf *key_setsadbaddr(u_int16_t,
+	const struct sockaddr *, u_int8_t, u_int16_t, int);
 #if 0
 static struct mbuf *key_setsadbident (u_int16_t, u_int16_t, void *,
 	int, u_int64_t);
 #endif
 static struct mbuf *key_setsadbxsa2 (u_int8_t, u_int32_t, u_int16_t);
 static struct mbuf *key_setsadbxpolicy (u_int16_t, u_int8_t,
-	u_int32_t);
+	u_int32_t, int);
 static void *key_newbuf (const void *, u_int);
 #ifdef INET6
 static int 

CVS commit: src/sys/arch/arm/fdt

2017-11-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 30 14:51:01 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: gtmr_fdt.c

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/gtmr_fdt.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/fdt/gtmr_fdt.c
diff -u src/sys/arch/arm/fdt/gtmr_fdt.c:1.6 src/sys/arch/arm/fdt/gtmr_fdt.c:1.7
--- src/sys/arch/arm/fdt/gtmr_fdt.c:1.6	Thu Nov 30 14:50:34 2017
+++ src/sys/arch/arm/fdt/gtmr_fdt.c	Thu Nov 30 14:51:01 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_fdt.c,v 1.6 2017/11/30 14:50:34 skrll Exp $ */
+/* $NetBSD: gtmr_fdt.c,v 1.7 2017/11/30 14:51:01 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.6 2017/11/30 14:50:34 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.7 2017/11/30 14:51:01 skrll Exp $");
 
 #include 
 #include 
@@ -51,7 +51,7 @@ static void	gtmr_fdt_cpu_hatch(void *, s
 
 CFATTACH_DECL_NEW(gtmr_fdt, 0, gtmr_fdt_match, gtmr_fdt_attach, NULL, NULL);
 
-/* The vritual timer list entry */
+/* The virtual timer list entry */
 #define GTMR_VTIMER 2
 
 static int



CVS commit: src/sys/arch/arm

2017-11-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 30 14:50:34 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: gtmr.c gtmr_var.h
src/sys/arch/arm/fdt: gtmr_fdt.c

Log Message:
When attaching gtmr at fdt use fdtbus_intr_establish to establish the
gtmr interrupt.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/cortex/gtmr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/cortex/gtmr_var.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/fdt/gtmr_fdt.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/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.22 src/sys/arch/arm/cortex/gtmr.c:1.23
--- src/sys/arch/arm/cortex/gtmr.c:1.22	Wed Oct 25 16:09:46 2017
+++ src/sys/arch/arm/cortex/gtmr.c	Thu Nov 30 14:50:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.22 2017/10/25 16:09:46 skrll Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.23 2017/11/30 14:50:34 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.22 2017/10/25 16:09:46 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.23 2017/11/30 14:50:34 skrll Exp $");
 
 #include 
 #include 
@@ -129,12 +129,14 @@ gtmr_attach(device_t parent, device_t se
 	evcnt_attach_dynamic(>sc_ev_missing_ticks, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "missing interrupts");
 
-	sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK,
-	IST_LEVEL | IST_MPSAFE, gtmr_intr, NULL);
-	if (sc->sc_global_ih == NULL)
-		panic("%s: unable to register timer interrupt", __func__);
-	aprint_normal_dev(self, "interrupting on irq %d\n",
-	mpcaa->mpcaa_irq);
+	if (mpcaa->mpcaa_irq != -1) {
+		sc->sc_global_ih = intr_establish(mpcaa->mpcaa_irq, IPL_CLOCK,
+		IST_LEVEL | IST_MPSAFE, gtmr_intr, NULL);
+		if (sc->sc_global_ih == NULL)
+			panic("%s: unable to register timer interrupt", __func__);
+		aprint_normal_dev(self, "interrupting on irq %d\n",
+		mpcaa->mpcaa_irq);
+	}
 
 	const uint32_t cnt_frq = armreg_cnt_frq_read();
 	if (cnt_frq == 0) {

Index: src/sys/arch/arm/cortex/gtmr_var.h
diff -u src/sys/arch/arm/cortex/gtmr_var.h:1.8 src/sys/arch/arm/cortex/gtmr_var.h:1.9
--- src/sys/arch/arm/cortex/gtmr_var.h:1.8	Thu Nov  9 21:38:25 2017
+++ src/sys/arch/arm/cortex/gtmr_var.h	Thu Nov 30 14:50:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.8 2017/11/09 21:38:25 skrll Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.9 2017/11/30 14:50:34 skrll Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -47,6 +47,7 @@ struct gtmr_softc {
 #ifdef _KERNEL
 #include "opt_arm_timer.h"
 struct cpu_info;
+void	gtmr_init(device_t);
 int	gtmr_intr(void *);
 void	gtmr_init_cpu_clock(struct cpu_info *);
 void	gtmr_delay(unsigned int n);

Index: src/sys/arch/arm/fdt/gtmr_fdt.c
diff -u src/sys/arch/arm/fdt/gtmr_fdt.c:1.5 src/sys/arch/arm/fdt/gtmr_fdt.c:1.6
--- src/sys/arch/arm/fdt/gtmr_fdt.c:1.5	Thu Aug 24 13:06:23 2017
+++ src/sys/arch/arm/fdt/gtmr_fdt.c	Thu Nov 30 14:50:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_fdt.c,v 1.5 2017/08/24 13:06:23 jmcneill Exp $ */
+/* $NetBSD: gtmr_fdt.c,v 1.6 2017/11/30 14:50:34 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.5 2017/08/24 13:06:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.6 2017/11/30 14:50:34 skrll Exp $");
 
 #include 
 #include 
@@ -51,6 +51,9 @@ static void	gtmr_fdt_cpu_hatch(void *, s
 
 CFATTACH_DECL_NEW(gtmr_fdt, 0, gtmr_fdt_match, gtmr_fdt_attach, NULL, NULL);
 
+/* The vritual timer list entry */
+#define GTMR_VTIMER 2
+
 static int
 gtmr_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -72,8 +75,24 @@ gtmr_fdt_attach(device_t parent, device_
 
 	struct mpcore_attach_args mpcaa = {
 		.mpcaa_name = "armgtmr",
-		.mpcaa_irq = IRQ_GTMR_PPI_VTIMER
+		.mpcaa_irq = -1		/* setup handler locally */
 	};
+	struct fdt_attach_args * const faa = aux;
+	const int phandle = faa->faa_phandle;
+
+	char intrstr[128];
+	if (!fdtbus_intr_str(phandle, GTMR_VTIMER, intrstr, sizeof(intrstr))) {
+		aprint_error(": failed to decode interrupt\n");
+		return;
+	}
+
+	void *ih = fdtbus_intr_establish(phandle, GTMR_VTIMER, IPL_CLOCK,
+	FDT_INTR_MPSAFE, gtmr_intr, NULL);
+	if (ih == NULL) {
+		aprint_error_dev(self, "couldn't install interrupt handler\n");
+		return;
+	}
+	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 
 	config_found(self, , NULL);
 



CVS commit: src/sys/arch/arm/fdt

2017-11-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 30 14:42:37 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Handle NULL arg interrupt handlers that want the clock frame.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/fdt/gic_fdt.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/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.7 src/sys/arch/arm/fdt/gic_fdt.c:1.8
--- src/sys/arch/arm/fdt/gic_fdt.c:1.7	Sun Jul  2 21:59:14 2017
+++ src/sys/arch/arm/fdt/gic_fdt.c	Thu Nov 30 14:42:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.7 2017/07/02 21:59:14 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.8 2017/11/30 14:42:37 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.7 2017/07/02 21:59:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.8 2017/11/30 14:42:37 skrll Exp $");
 
 #include 
 #include 
@@ -190,26 +190,38 @@ gic_fdt_establish(device_t dev, u_int *s
 		firq->intr_level = level;
 		firq->intr_mpsafe = mpsafe;
 		TAILQ_INIT(>intr_handlers);
-		firq->intr_ih = intr_establish(irq, ipl, level | mpsafe,
-		gic_fdt_intr, firq);
+		if (arg == NULL) {
+			firq->intr_ih = intr_establish(irq, ipl, level | mpsafe,
+			func, NULL);
+		} else {
+			firq->intr_ih = intr_establish(irq, ipl, level | mpsafe,
+			gic_fdt_intr, firq);
+		}
 		if (firq->intr_ih == NULL) {
 			kmem_free(firq, sizeof(*firq));
 			return NULL;
 		}
 		sc->sc_irq[irq] = firq;
-	}
-
-	if (firq->intr_ipl != ipl) {
-		device_printf(dev, "cannot share irq with different ipl\n");
-		return NULL;
-	}
-	if (firq->intr_level != level) {
-		device_printf(dev, "cannot share edge and level interrupts\n");
-		return NULL;
-	}
-	if (firq->intr_mpsafe != mpsafe) {
-		device_printf(dev, "cannot share between mpsafe/non-mpsafe\n");
-		return NULL;
+	} else {
+		if (arg) {
+			device_printf(dev, "cannot share irq with NULL arg\n");
+			return NULL;
+		}
+		if (firq->intr_ipl != ipl) {
+			device_printf(dev, "cannot share irq with different "
+			"ipl\n");
+			return NULL;
+		}
+		if (firq->intr_level != level) {
+			device_printf(dev, "cannot share edge and level "
+			"interrupts\n");
+			return NULL;
+		}
+		if (firq->intr_mpsafe != mpsafe) {
+			device_printf(dev, "cannot share between "
+			"mpsafe/non-mpsafe\n");
+			return NULL;
+		}
 	}
 
 	firq->intr_refcnt++;



CVS commit: [netbsd-8] src/sys

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 14:40:46 UTC 2017

Modified Files:
src/sys/kern [netbsd-8]: kern_lock.c subr_pserialize.c
src/sys/rump/librump/rumpkern [netbsd-8]: emul.c rump.c
src/sys/sys [netbsd-8]: pserialize.h

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #405):
sys/sys/pserialize.h: revision 1.2
sys/kern/kern_lock.c: revision 1.160
sys/kern/subr_pserialize.c: revision 1.9
sys/rump/librump/rumpkern/emul.c: revision 1.184
sys/rump/librump/rumpkern/emul.c: revision 1.185
sys/rump/librump/rumpkern/rump.c: revision 1.330
Implement debugging feature for pserialize(9)
The debugging feature detects violations of pserialize constraints.
It causes a panic:
- if a context switch happens in a read section, or
- if a sleepable function is called in a read section.
The feature is enabled only if LOCKDEBUG is on.
Discussed on tech-kern@
Add missing inclusion of pserialize.h (fix build)


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.158.6.1 src/sys/kern/kern_lock.c
cvs rdiff -u -r1.8 -r1.8.10.1 src/sys/kern/subr_pserialize.c
cvs rdiff -u -r1.181.6.1 -r1.181.6.2 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.329 -r1.329.10.1 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.1 -r1.1.46.1 src/sys/sys/pserialize.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/kern_lock.c
diff -u src/sys/kern/kern_lock.c:1.158 src/sys/kern/kern_lock.c:1.158.6.1
--- src/sys/kern/kern_lock.c:1.158	Thu Jan 26 04:11:56 2017
+++ src/sys/kern/kern_lock.c	Thu Nov 30 14:40:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lock.c,v 1.158 2017/01/26 04:11:56 christos Exp $	*/
+/*	$NetBSD: kern_lock.c,v 1.158.6.1 2017/11/30 14:40:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.158 2017/01/26 04:11:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lock.c,v 1.158.6.1 2017/11/30 14:40:46 martin Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_lock.c,
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -88,6 +89,9 @@ assert_sleepable(void)
 	if (cpu_softintr_p()) {
 		reason = "softint";
 	}
+	if (!pserialize_not_in_read_section()) {
+		reason = "pserialize";
+	}
 
 	if (reason) {
 		panic("%s: %s caller=%p", __func__, reason,

Index: src/sys/kern/subr_pserialize.c
diff -u src/sys/kern/subr_pserialize.c:1.8 src/sys/kern/subr_pserialize.c:1.8.10.1
--- src/sys/kern/subr_pserialize.c:1.8	Fri Jun 12 19:18:30 2015
+++ src/sys/kern/subr_pserialize.c	Thu Nov 30 14:40:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pserialize.c,v 1.8 2015/06/12 19:18:30 dholland Exp $	*/
+/*	$NetBSD: subr_pserialize.c,v 1.8.10.1 2017/11/30 14:40:46 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8 2015/06/12 19:18:30 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pserialize.c,v 1.8.10.1 2017/11/30 14:40:46 martin Exp $");
 
 #include 
 
@@ -73,6 +73,12 @@ static TAILQ_HEAD(, pserialize)	psz_queu
 static TAILQ_HEAD(, pserialize)	psz_queue1	__cacheline_aligned;
 static TAILQ_HEAD(, pserialize)	psz_queue2	__cacheline_aligned;
 
+#ifdef LOCKDEBUG
+#include 
+
+static percpu_t		*psz_debug_nreads	__cacheline_aligned;
+#endif
+
 /*
  * pserialize_init:
  *
@@ -89,6 +95,9 @@ pserialize_init(void)
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	evcnt_attach_dynamic(_ev_excl, EVCNT_TYPE_MISC, NULL,
 	"pserialize", "exclusive access");
+#ifdef LOCKDEBUG
+	psz_debug_nreads = percpu_alloc(sizeof(uint32_t));
+#endif
 }
 
 /*
@@ -185,15 +194,37 @@ pserialize_perform(pserialize_t psz)
 int
 pserialize_read_enter(void)
 {
+	int s;
 
 	KASSERT(!cpu_intr_p());
-	return splsoftserial();
+	s = splsoftserial();
+#ifdef LOCKDEBUG
+	{
+		uint32_t *nreads;
+		nreads = percpu_getref(psz_debug_nreads);
+		(*nreads)++;
+		if (*nreads == 0)
+			panic("nreads overflow");
+		percpu_putref(psz_debug_nreads);
+	}
+#endif
+	return s;
 }
 
 void
 pserialize_read_exit(int s)
 {
 
+#ifdef LOCKDEBUG
+	{
+		uint32_t *nreads;
+		nreads = percpu_getref(psz_debug_nreads);
+		(*nreads)--;
+		if (*nreads == UINT_MAX)
+			panic("nreads underflow");
+		percpu_putref(psz_debug_nreads);
+	}
+#endif
 	splx(s);
 }
 
@@ -209,6 +240,9 @@ pserialize_switchpoint(void)
 	pserialize_t psz, next;
 	cpuid_t cid;
 
+	/* We must to ensure not to come here from inside a read section. */
+	KASSERT(pserialize_not_in_read_section());
+
 	/*
 	 * If no updates pending, bail out.  No need to lock in order to
 	 * test psz_work_todo; the only ill effect of missing an update
@@ -261,3 +295,61 @@ pserialize_switchpoint(void)
 	}
 	mutex_spin_exit(_lock);
 }
+
+/*
+ * 

CVS commit: [netbsd-8] src/sys

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 14:31:04 UTC 2017

Modified Files:
src/sys/kern [netbsd-8]: subr_localcount.c
src/sys/sys [netbsd-8]: localcount.h

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #404):
sys/sys/localcount.h: revision 1.5
sys/kern/subr_localcount.c: revision 1.7
Implement a debugging facility (overflow/underflow detection) for localcount
We cannot get an accurate count from a localcount instance because it consists
of per-cpu counters and we have no way to sum them up atomically. So we cannot
detect counter overflow/underflow as we can do on a normal refcount.
The facility adds an atomic counter to each localcount instance to enable the
validations. The counter ups and downs in synchronization with the per-CPU
counters. The counter is used iff both DEBUG and LOCKDEBUG are enabled in the
kernel.
Discussed on tech-kern@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/kern/subr_localcount.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/sys/localcount.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/subr_localcount.c
diff -u src/sys/kern/subr_localcount.c:1.4 src/sys/kern/subr_localcount.c:1.4.2.1
--- src/sys/kern/subr_localcount.c:1.4	Fri Jun  2 00:32:12 2017
+++ src/sys/kern/subr_localcount.c	Thu Nov 30 14:31:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_localcount.c,v 1.4 2017/06/02 00:32:12 chs Exp $	*/
+/*	$NetBSD: subr_localcount.c,v 1.4.2.1 2017/11/30 14:31:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.4 2017/06/02 00:32:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.4.2.1 2017/11/30 14:31:04 martin Exp $");
 
 #include 
 #include 
@@ -54,6 +54,9 @@ __KERNEL_RCSID(0, "$NetBSD: subr_localco
 #include 
 #include 
 #include 
+#if defined(DEBUG) && defined(LOCKDEBUG)
+#include 
+#endif
 
 /*
  * localcount_init(lc)
@@ -203,6 +206,10 @@ localcount_acquire(struct localcount *lc
 
 	KASSERT(lc->lc_totalp == NULL);
 	localcount_adjust(lc, +1);
+#if defined(DEBUG) && defined(LOCKDEBUG)
+	if (atomic_inc_32_nv(>lc_refcnt) == 0)
+		panic("counter overflow");
+#endif
 }
 
 /*
@@ -247,5 +254,26 @@ localcount_release(struct localcount *lc
 	}
 
 	localcount_adjust(lc, -1);
+#if defined(DEBUG) && defined(LOCKDEBUG)
+	if (atomic_dec_32_nv(>lc_refcnt) == UINT_MAX)
+		panic("counter underflow");
+#endif
  out:	kpreempt_enable();
 }
+
+/*
+ * localcount_debug_refcnt(lc)
+ *
+ *	Return a total reference count of lc.  It returns a correct value
+ *	only if DEBUG and LOCKDEBUG enabled.  Otherwise always return 0.
+ */
+uint32_t
+localcount_debug_refcnt(const struct localcount *lc)
+{
+
+#if defined(DEBUG) && defined(LOCKDEBUG)
+	return lc->lc_refcnt;
+#else
+	return 0;
+#endif
+}

Index: src/sys/sys/localcount.h
diff -u src/sys/sys/localcount.h:1.4 src/sys/sys/localcount.h:1.4.2.1
--- src/sys/sys/localcount.h:1.4	Fri Jun  2 00:32:12 2017
+++ src/sys/sys/localcount.h	Thu Nov 30 14:31:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: localcount.h,v 1.4 2017/06/02 00:32:12 chs Exp $	*/
+/*	$NetBSD: localcount.h,v 1.4.2.1 2017/11/30 14:31:04 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -43,8 +43,9 @@ struct kmutex;
 struct percpu;
 
 struct localcount {
-	int64_t		*lc_totalp;
-	struct percpu	*lc_percpu; /* int64_t */
+	int64_t			*lc_totalp;
+	struct percpu		*lc_percpu; /* int64_t */
+	volatile uint32_t	lc_refcnt; /* only for debugging */
 };
 
 void	localcount_init(struct localcount *);
@@ -55,4 +56,7 @@ void	localcount_acquire(struct localcoun
 void	localcount_release(struct localcount *, struct kcondvar *,
 	struct kmutex *);
 
+uint32_t
+	localcount_debug_refcnt(const struct localcount *);
+
 #endif	/* _SYS_LOCALCOUNT_H */



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 14:23:12 UTC 2017

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: lapic.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #403):
sys/arch/x86/x86/lapic.c: revision 1.63
Fix stack overflow, found when testing a new feature.


To generate a diff of this commit:
cvs rdiff -u -r1.58.2.3 -r1.58.2.4 src/sys/arch/x86/x86/lapic.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/x86/x86/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.58.2.3 src/sys/arch/x86/x86/lapic.c:1.58.2.4
--- src/sys/arch/x86/x86/lapic.c:1.58.2.3	Thu Nov 30 14:21:48 2017
+++ src/sys/arch/x86/x86/lapic.c	Thu Nov 30 14:23:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.58.2.3 2017/11/30 14:21:48 martin Exp $	*/
+/*	$NetBSD: lapic.c,v 1.58.2.4 2017/11/30 14:23:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.58.2.3 2017/11/30 14:21:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.58.2.4 2017/11/30 14:23:12 martin Exp $");
 
 #include "acpica.h"
 #include "ioapic.h"
@@ -250,7 +250,7 @@ lapic_is_x2apic(void)
 static void
 lapic_setup_bsp(paddr_t lapic_base)
 {
-	u_int regs[4];
+	u_int regs[6];
 	const char *reason = NULL;
 	const char *hw_vendor;
 	bool bios_x2apic;



CVS commit: [netbsd-8] src/sys/arch/x86/x86

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 14:21:48 UTC 2017

Modified Files:
src/sys/arch/x86/x86 [netbsd-8]: lapic.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #402):
sys/arch/x86/x86/lapic.c: revision 1.61
Fix a bug introduced in r1.55, this should be LAPIC_BASE.


To generate a diff of this commit:
cvs rdiff -u -r1.58.2.2 -r1.58.2.3 src/sys/arch/x86/x86/lapic.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/x86/x86/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.58.2.2 src/sys/arch/x86/x86/lapic.c:1.58.2.3
--- src/sys/arch/x86/x86/lapic.c:1.58.2.2	Fri Jul 14 08:41:18 2017
+++ src/sys/arch/x86/x86/lapic.c	Thu Nov 30 14:21:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.58.2.2 2017/07/14 08:41:18 martin Exp $	*/
+/*	$NetBSD: lapic.c,v 1.58.2.3 2017/11/30 14:21:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.58.2.2 2017/07/14 08:41:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.58.2.3 2017/11/30 14:21:48 martin Exp $");
 
 #include "acpica.h"
 #include "ioapic.h"
@@ -367,7 +367,7 @@ lapic_map(paddr_t lapic_base)
 	if (CPUID_TO_FAMILY(curcpu()->ci_signature) >= 6) {
 		lapic_base = (paddr_t)rdmsr(MSR_APICBASE);
 		if ((lapic_base & APICBASE_PHYSADDR) == 0) {
-			lapic_base |= APICBASE_PHYSADDR;
+			lapic_base |= LAPIC_BASE;
 		}
 		wrmsr(MSR_APICBASE, lapic_base | APICBASE_EN);
 		lapic_base &= APICBASE_PHYSADDR;



CVS commit: src/sys/kern

2017-11-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov 30 14:19:27 UTC 2017

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

Log Message:
Put previous removed diagnostic back as debug. It has caught in the past
(and now) different kqueue behavior between NetBSD and other kqueue
implementations that depend on specific file types. If 3rd party programs
trigger this it is probably because we are doing something different.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/kern/kern_event.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/kern_event.c
diff -u src/sys/kern/kern_event.c:1.99 src/sys/kern/kern_event.c:1.100
--- src/sys/kern/kern_event.c:1.99	Thu Nov 30 00:52:40 2017
+++ src/sys/kern/kern_event.c	Thu Nov 30 09:19:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.99 2017/11/30 05:52:40 riastradh Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.100 2017/11/30 14:19:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.99 2017/11/30 05:52:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.100 2017/11/30 14:19:27 christos Exp $");
 
 #include 
 #include 
@@ -1063,6 +1063,13 @@ kqueue_register(struct kqueue *kq, struc
 			error = (*kfilter->filtops->f_attach)(kn);
 			KERNEL_UNLOCK_ONE(NULL);	/* XXXSMP */
 			if (error != 0) {
+#ifdef DEBUG
+printf("%s: event type %d not supported for "
+"file type %d (error %d)\n", __func__,
+kn->kn_filter, kn->kn_obj ?
+((file_t *)kn->kn_obj)->f_type : -1, error);
+#endif
+
 /* knote_detach() drops fdp->fd_lock */
 knote_detach(kn, fdp, false);
 goto done;



CVS commit: [netbsd-8] src/sys/arch/amd64/amd64

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 14:03:41 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-8]: machdep.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #401):
sys/arch/amd64/amd64/machdep.c: revision 1.267
Mmh, don't forget to clear the TLS gdt slots on Xen. Otherwise, when doing
a lwp32->lwp64 context switch, the new lwp can use the slots to reconstruct
the address of the previous lwp's TLS space (and defeat ASLR?).


To generate a diff of this commit:
cvs rdiff -u -r1.255.6.1 -r1.255.6.2 src/sys/arch/amd64/amd64/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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.255.6.1 src/sys/arch/amd64/amd64/machdep.c:1.255.6.2
--- src/sys/arch/amd64/amd64/machdep.c:1.255.6.1	Mon Sep  4 20:41:28 2017
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Nov 30 14:03:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.255.6.1 2017/09/04 20:41:28 snj Exp $	*/
+/*	$NetBSD: machdep.c,v 1.255.6.2 2017/11/30 14:03:41 martin Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.1 2017/09/04 20:41:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.255.6.2 2017/11/30 14:03:41 martin Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -427,6 +427,7 @@ x86_64_tls_switch(struct lwp *l)
 	struct cpu_info *ci = curcpu();
 	struct pcb *pcb = lwp_getpcb(l);
 	struct trapframe *tf = l->l_md.md_regs;
+	uint64_t zero = 0;
 
 	/*
 	 * Raise the IPL to IPL_HIGH.
@@ -449,6 +450,8 @@ x86_64_tls_switch(struct lwp *l)
 		setfs(tf->tf_fs);
 		HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, tf->tf_gs);
 	} else {
+		update_descriptor(()->ci_gdt[GUFS_SEL], );
+		update_descriptor(()->ci_gdt[GUGS_SEL], );
 		setfs(0);
 		HYPERVISOR_set_segment_base(SEGBASE_GS_USER_SEL, 0);
 		HYPERVISOR_set_segment_base(SEGBASE_FS, pcb->pcb_fs);



CVS commit: [netbsd-8] src/sys/compat/linux/common

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 13:44:31 UTC 2017

Modified Files:
src/sys/compat/linux/common [netbsd-8]: linux_sg.c

Log Message:
Pull up following revision(s) (requested by maxv in ticket #400):
sys/compat/linux/common/linux_sg.c: revision 1.14
This should be "linux_sg_version", not "version".


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.84.1 src/sys/compat/linux/common/linux_sg.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/compat/linux/common/linux_sg.c
diff -u src/sys/compat/linux/common/linux_sg.c:1.13 src/sys/compat/linux/common/linux_sg.c:1.13.84.1
--- src/sys/compat/linux/common/linux_sg.c:1.13	Fri Mar 21 21:54:58 2008
+++ src/sys/compat/linux/common/linux_sg.c	Thu Nov 30 13:44:31 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_sg.c,v 1.13 2008/03/21 21:54:58 ad Exp $ */
+/* $NetBSD: linux_sg.c,v 1.13.84.1 2017/11/30 13:44:31 martin Exp $ */
 
 /*
  * Copyright (c) 2004 Soren S. Jorvang.  All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.13 2008/03/21 21:54:58 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sg.c,v 1.13.84.1 2017/11/30 13:44:31 martin Exp $");
 
 #include 
 #include 
@@ -88,7 +88,7 @@ linux_ioctl_sg(struct lwp *l, const stru
 	DPRINTF(("Command = %lx\n", com));
 	switch (com) {
 	case LINUX_SG_GET_VERSION_NUM: {
-		error = copyout(, SCARG(uap, data),
+		error = copyout(_sg_version, SCARG(uap, data),
 		sizeof(linux_sg_version));
 		break;
 	}



CVS commit: src/sys/arch/i386/conf

2017-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 30 11:56:45 UTC 2017

Modified Files:
src/sys/arch/i386/conf: ALL GENERIC

Log Message:
add qemufwcfg(4)


To generate a diff of this commit:
cvs rdiff -u -r1.430 -r1.431 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1171 -r1.1172 src/sys/arch/i386/conf/GENERIC

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/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.430 src/sys/arch/i386/conf/ALL:1.431
--- src/sys/arch/i386/conf/ALL:1.430	Thu Sep 14 07:58:41 2017
+++ src/sys/arch/i386/conf/ALL	Thu Nov 30 11:56:45 2017
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.430 2017/09/14 07:58:41 mrg Exp $
+# $NetBSD: ALL,v 1.431 2017/11/30 11:56:45 jmcneill Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.430 $"
+#ident		"ALL-$Revision: 1.431 $"
 
 maxusers	64		# estimated number of users
 
@@ -377,6 +377,7 @@ lpt*		at acpi?		# Parallel port
 mpu*		at acpi?		# Roland MPU-401 MIDI UART
 pckbc*		at acpi?		# PC keyboard controller
 pcppi*		at acpi?		# AT-style speaker sound
+qemufwcfg*	at acpi?		# QEMU Firmware Configuration device
 thinkpad*	at acpi?		# IBM/Lenovo Thinkpad hotkeys
 #tpm*		at acpi?		# ACPI TPM (Experimental)
 ug*		at acpi?		# Abit uGuru Hardware monitor

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1171 src/sys/arch/i386/conf/GENERIC:1.1172
--- src/sys/arch/i386/conf/GENERIC:1.1171	Wed Nov 29 16:10:01 2017
+++ src/sys/arch/i386/conf/GENERIC	Thu Nov 30 11:56:45 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1171 2017/11/29 16:10:01 martin Exp $
+# $NetBSD: GENERIC,v 1.1172 2017/11/30 11:56:45 jmcneill Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1171 $"
+#ident		"GENERIC-$Revision: 1.1172 $"
 
 maxusers	64		# estimated number of users
 
@@ -351,6 +351,7 @@ joy*		at acpi?		# Joystick/Game port
 mpu*		at acpi?		# Roland MPU-401 MIDI UART
 pckbc*		at acpi?		# PC keyboard controller
 pcppi*		at acpi?		# AT-style speaker sound
+qemufwcfg*	at acpi?		# QEMU Firmware Configuration device
 sdhc*		at acpi?		# SD Host Controller
 sony*		at acpi?		# Sony Miscellaneous Controller
 thinkpad*	at acpi?		# IBM/Lenovo Thinkpad hotkeys



CVS commit: src/sys/dev/pci

2017-11-30 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 30 09:24:18 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- 82583 supports jumbo frame. Fixes PR#52773 reported by Shinichi Doyashiki.
- Cleanup comment.


To generate a diff of this commit:
cvs rdiff -u -r1.545 -r1.546 src/sys/dev/pci/if_wm.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_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.545 src/sys/dev/pci/if_wm.c:1.546
--- src/sys/dev/pci/if_wm.c:1.545	Thu Nov 30 03:53:24 2017
+++ src/sys/dev/pci/if_wm.c	Thu Nov 30 09:24:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.545 2017/11/30 03:53:24 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.546 2017/11/30 09:24:18 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.545 2017/11/30 03:53:24 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.546 2017/11/30 09:24:18 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2676,11 +2676,12 @@ alloc_retry:
 	case WM_T_82571:
 	case WM_T_82572:
 	case WM_T_82574:
+	case WM_T_82583:
 	case WM_T_82575:
 	case WM_T_82576:
 	case WM_T_82580:
 	case WM_T_I350:
-	case WM_T_I354: /*  ok? */
+	case WM_T_I354:
 	case WM_T_I210:
 	case WM_T_I211:
 	case WM_T_80003:
@@ -2698,7 +2699,6 @@ alloc_retry:
 		break;
 	case WM_T_82542_2_0:
 	case WM_T_82542_2_1:
-	case WM_T_82583:
 	case WM_T_ICH8:
 		/* No support for jumbo frame */
 		break;



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

2017-11-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 30 08:14:03 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add the new sha3.h file


To generate a diff of this commit:
cvs rdiff -u -r1.2160 -r1.2161 src/distrib/sets/lists/comp/mi

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2160 src/distrib/sets/lists/comp/mi:1.2161
--- src/distrib/sets/lists/comp/mi:1.2160	Sat Nov 25 16:31:03 2017
+++ src/distrib/sets/lists/comp/mi	Thu Nov 30 08:14:03 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2160 2017/11/25 16:31:03 jmcneill Exp $
+#	$NetBSD: mi,v 1.2161 2017/11/30 08:14:03 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2947,6 +2947,7 @@
 ./usr/include/sys/semaphore.h			comp-c-include
 ./usr/include/sys/sha1.h			comp-c-include
 ./usr/include/sys/sha2.h			comp-c-include
+./usr/include/sys/sha3.h			comp-c-include
 ./usr/include/sys/shm.hcomp-c-include
 ./usr/include/sys/siginfo.h			comp-c-include
 ./usr/include/sys/signal.h			comp-c-include