CVS commit: src/external/mit/xorg/server/drivers/xf86-video-intel

2019-01-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Jan  2 22:58:44 UTC 2019

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-intel: Makefile

Log Message:
explicitly link libXfont since it is used.

from Patrick Welche in private email.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 \
src/external/mit/xorg/server/drivers/xf86-video-intel/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-video-intel/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-intel/Makefile:1.28 src/external/mit/xorg/server/drivers/xf86-video-intel/Makefile:1.29
--- src/external/mit/xorg/server/drivers/xf86-video-intel/Makefile:1.28	Tue Jan  1 00:37:06 2019
+++ src/external/mit/xorg/server/drivers/xf86-video-intel/Makefile	Wed Jan  2 22:58:44 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2019/01/01 00:37:06 mrg Exp $
+#	$NetBSD: Makefile,v 1.29 2019/01/02 22:58:44 mrg Exp $
 
 .include 
 
@@ -188,6 +188,7 @@ CPPFLAGS+=		-DHAVE_XF86_CURSOR_RESET_CUR
 # on ELF &c.
 CFLAGS+=	-fvisibility=hidden
 
+LIBDPLIBS+=	Xfont		${.CURDIR}/../../../lib/libXfont
 LIBDPLIBS+=	drm_intel	${.CURDIR}/../../../lib/libdrm_intel
 LIBDPLIBS+=	pthread		${NETBSDSRCDIR}/lib/libpthread
 



CVS commit: xsrc/local/programs/bdfload

2019-01-02 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Jan  2 22:05:24 UTC 2019

Added Files:
xsrc/local/programs/bdfload: Makefile README bdfload.c

Log Message:
a crude BDF font loader for wsdisplay


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 xsrc/local/programs/bdfload/Makefile \
xsrc/local/programs/bdfload/README xsrc/local/programs/bdfload/bdfload.c

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

Added files:

Index: xsrc/local/programs/bdfload/Makefile
diff -u /dev/null xsrc/local/programs/bdfload/Makefile:1.1
--- /dev/null	Wed Jan  2 22:05:24 2019
+++ xsrc/local/programs/bdfload/Makefile	Wed Jan  2 22:05:24 2019
@@ -0,0 +1,4 @@
+PROG = bdfload
+SRCS = bdfload.c
+
+.include 
\ No newline at end of file
Index: xsrc/local/programs/bdfload/README
diff -u /dev/null xsrc/local/programs/bdfload/README:1.1
--- /dev/null	Wed Jan  2 22:05:24 2019
+++ xsrc/local/programs/bdfload/README	Wed Jan  2 22:05:24 2019
@@ -0,0 +1,10 @@
+This will attempt to load a .bdf font into wsdisplay, to be used with
+wsconsctl -dw font=
+Caveats:
+- fonts wider than 16 pixels won't work yet
+- the program does not distinguish between monospace and proportional fonts,
+  and terminal output is necessarily monospace. Proportional fonts should
+  work but the glyphs will be left justified in the character cell so things
+  will look uneven.
+- some drivers may have trouble with font widths that are not a multiple of 4
+- no attempt has been made to make this play nice with vga text mode
Index: xsrc/local/programs/bdfload/bdfload.c
diff -u /dev/null xsrc/local/programs/bdfload/bdfload.c:1.1
--- /dev/null	Wed Jan  2 22:05:24 2019
+++ xsrc/local/programs/bdfload/bdfload.c	Wed Jan  2 22:05:24 2019
@@ -0,0 +1,180 @@
+/*	$NetBSD: bdfload.c,v 1.1 2019/01/02 22:05:24 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2018 Michael Lorenz
+ * 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.
+ */
+
+/*
+ * a crude BDF loader for wsdisplay
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+void
+interpret(FILE *foo)
+{
+	char line[128], *arg, name[64] = "foop", *buffer, buflen = -1;
+	int len, in_char = 0, current = -1, stride = 0, charsize = 0;
+	int width, height, x, y, num;
+	int first = 255, last = 0;
+	int left, top, lines;
+	int bl = 255, bt = 255, br = -1, bb = -1;
+	struct wsdisplay_font f;
+	int fdev;
+
+	while (fgets(line, sizeof(line), foo) != NULL) {
+		int i = 0;
+		/* separate keyword from parameters */
+		len = strlen(line);
+		while (!isspace(line[i]) && (i < len)) i++;
+		line[i] = 0;
+		arg = &line[i + 1];
+		i = 0;
+		len = strlen(arg);
+		/* get rid of garbage */
+		while ((!iscntrl(arg[i])) && (arg[i] != 0)) {
+			i++;
+		}
+		arg[i] = 0;
+		if (strcmp(line, "FAMILY_NAME") == 0) {
+			/* cut off quotation marks */
+			strncpy(name, arg + 1, 64);
+			name[strlen(name) - 1] = 0;
+			printf("name: %s\n", name);
+		} else if (strcmp(line, "FONTBOUNDINGBOX") == 0) {
+			int res;
+			res = sscanf(arg, "%d %d %d %d",
+	  &width, &height, &x, &y);
+			stride = (width + 7) >> 3;
+			printf("box %d x %d\n", width, height);
+			if (stride > 2) {
+printf("no fonts wider than 16 work for now\n");
+exit(1);
+			}
+			charsize = height * stride;
+			buflen = 256 * charsize;
+			buffer = malloc(buflen);
+			if (buffer == NULL) {
+printf("failed to allocate %dKB for glyphs\n",
+buflen);
+exit(1);
+			} 
+		} else if (strcmp(line, "CHARS") == 0) {
+			if (sscanf(arg, "%d", &num) == 1)
+printf("number of characters: %d\n", num);
+		} else if (strcmp(line, "STARTCHAR") == 0) {
+			in_char = 1;
+		} else if (strcmp(line, "ENDCHAR") 

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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 19:34:32 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun8i-a83t.dtsi

Log Message:
Add thermal sensor node


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/dts/sun8i-a83t.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/sun8i-a83t.dtsi
diff -u src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.2 src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.3
--- src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.2	Sat Jun 30 12:23:24 2018
+++ src/sys/arch/arm/dts/sun8i-a83t.dtsi	Wed Jan  2 19:34:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-a83t.dtsi,v 1.2 2018/06/30 12:23:24 jmcneill Exp $ */
+/* $NetBSD: sun8i-a83t.dtsi,v 1.3 2019/01/02 19:34:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -39,4 +39,13 @@
 			status = "disabled";
 		};
 	};
+
+	soc {
+		rtp: rtp@1f04000 {
+			compatible = "allwinner,sun8i-a83t-ts";
+			reg = <0x01f04000 0x400>;
+			interrupts = ;
+			#thermal-sensor-cells = <0>;
+		};
+	};
 };



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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 19:33:06 UTC 2019

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

Log Message:
Support SUNXI_CCU_NKMP_FACTOR_P_X4 flag


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.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_ccu_nkmp.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c:1.7 src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c:1.8
--- src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c:1.7	Fri Oct  6 21:09:21 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu_nkmp.c	Wed Jan  2 19:33:06 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_nkmp.c,v 1.7 2017/10/06 21:09:21 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_nkmp.c,v 1.8 2019/01/02 19:33:06 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nkmp.c,v 1.7 2017/10/06 21:09:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nkmp.c,v 1.8 2019/01/02 19:33:06 jmcneill Exp $");
 
 #include 
 #include 
@@ -121,6 +121,8 @@ sunxi_ccu_nkmp_get_rate(struct sunxi_ccu
 
 	if ((nkmp->flags & SUNXI_CCU_NKMP_FACTOR_P_POW2) != 0)
 		p = 1 << p;
+	else if ((nkmp->flags & SUNXI_CCU_NKMP_FACTOR_P_X4) != 0)
+		p = p ? 4 : 1;
 	else
 		p++;
 



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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 19:32:41 UTC 2019

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

Log Message:
Clocks and resets are not present on all SoCs


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_thermal.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_thermal.c
diff -u src/sys/arch/arm/sunxi/sunxi_thermal.c:1.6 src/sys/arch/arm/sunxi/sunxi_thermal.c:1.7
--- src/sys/arch/arm/sunxi/sunxi_thermal.c:1.6	Tue Aug 21 14:09:41 2018
+++ src/sys/arch/arm/sunxi/sunxi_thermal.c	Wed Jan  2 19:32:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_thermal.c,v 1.6 2018/08/21 14:09:41 bsiegert Exp $ */
+/* $NetBSD: sunxi_thermal.c,v 1.7 2019/01/02 19:32:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.6 2018/08/21 14:09:41 bsiegert Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_thermal.c,v 1.7 2019/01/02 19:32:41 jmcneill Exp $");
 
 #include 
 #include 
@@ -513,28 +513,28 @@ sunxi_thermal_init_clocks(struct sunxi_t
 	int error;
 
 	clk = fdtbus_clock_get(sc->phandle, "ahb");
-	if (clk == NULL)
-		return ENXIO;
-	error = clk_enable(clk);
-	if (error != 0)
-		return error;
+	if (clk) {
+		error = clk_enable(clk);
+		if (error != 0)
+			return error;
+	}
 
 	clk = fdtbus_clock_get(sc->phandle, "ths");
-	if (clk == NULL)
-		return ENXIO;
-	error = clk_set_rate(clk, sc->conf->clk_rate);
-	if (error != 0)
-		return error;
-	error = clk_enable(clk);
-	if (error != 0)
-		return error;
+	if (clk) {
+		error = clk_set_rate(clk, sc->conf->clk_rate);
+		if (error != 0)
+			return error;
+		error = clk_enable(clk);
+		if (error != 0)
+			return error;
+	}
 
 	rst = fdtbus_reset_get_index(sc->phandle, 0);
-	if (rst == NULL)
-		return ENXIO;
-	error = fdtbus_reset_deassert(rst);
-	if (error != 0)
-		return error;
+	if (rst) {
+		error = fdtbus_reset_deassert(rst);
+		if (error != 0)
+			return error;
+	}
 
 	return 0;
 }



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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 19:32:18 UTC 2019

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

Log Message:
Support A83T


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_sid.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_sid.c
diff -u src/sys/arch/arm/sunxi/sunxi_sid.c:1.1 src/sys/arch/arm/sunxi/sunxi_sid.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_sid.c:1.1	Tue Oct  3 23:42:17 2017
+++ src/sys/arch/arm/sunxi/sunxi_sid.c	Wed Jan  2 19:32:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_sid.c,v 1.1 2017/10/03 23:42:17 jmcneill Exp $ */
+/* $NetBSD: sunxi_sid.c,v 1.2 2019/01/02 19:32:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_sid.c,v 1.1 2017/10/03 23:42:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_sid.c,v 1.2 2019/01/02 19:32:18 jmcneill Exp $");
 
 #include 
 #include 
@@ -58,6 +58,7 @@ static const struct of_compat_data compa
 	{ "allwinner,sun4i-a10-sid",	(uintptr_t)&sun4i_a10_sid_config },
 	{ "allwinner,sun7i-a20-sid",	(uintptr_t)&sun4i_a10_sid_config },
 	{ "allwinner,sun8i-h3-sid",	(uintptr_t)&sun8i_h3_sid_config },
+	{ "allwinner,sun8i-a83t-sid",	(uintptr_t)&sun8i_h3_sid_config },
 	{ NULL }
 };
 



CVS commit: xsrc/external/mit/xf86-video-ati/dist/src/AtomBios

2019-01-02 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Wed Jan  2 18:51:58 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-ati/dist/src/AtomBios: CD_Operations.c

Log Message:
make this work with both the old and the new version of compiler.h


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c:1.6 xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c:1.7
--- xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c:1.6	Wed Jan  2 10:54:24 2019
+++ xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c	Wed Jan  2 13:51:58 2019
@@ -215,28 +215,29 @@ VOID IndirectIOCommand_CLEAR(PARSER_TEMP
 pParserTempData->IndirectData &= ~((0x >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[2]);
 }
 
-/* from xorg-server 1.18 compiler.h */
-struct __una_u64 { uint64_t x __attribute__((packed)); };
-struct __una_u32 { uint32_t x __attribute__((packed)); };
+/* Avoid conflicts with older versions of compiler.h */
+
+#define ldw_u xldw_u
+#define ldl_u xldl_u
+#define stl_u xstl_u
 
 static __inline__ uint16_t ldw_u(uint16_t *p)
 {
 	uint16_t ret;
-	memmove(&ret, p, sizeof(*p));
+	memmove(&ret, p, sizeof(ret));
 	return ret;
 }
 
 static __inline__ uint32_t ldl_u(uint32_t *p)
 {
 	uint32_t ret;
-	memmove(&ret, p, sizeof(*p));
+	memmove(&ret, p, sizeof(ret));
 	return ret;
 }
 
 static __inline__ void stl_u(uint32_t val, uint32_t *p)
 {
-	struct __una_u32 *ptr = (struct __una_u32 *) p;
-	ptr->x = val;
+	memmove(p, &val, sizeof(*p));
 }
 
 UINT32 IndirectInputOutput(PARSER_TEMP_DATA STACK_BASED * pParserTempData)



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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 18:39:01 UTC 2019

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

Log Message:
Only set signal voltage if the regulator can handle it


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/sunxi/sunxi_mmc.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_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.29 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.30
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.29	Wed Jan  2 17:28:18 2019
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Wed Jan  2 18:39:01 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.29 2019/01/02 17:28:18 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.30 2019/01/02 18:39:01 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.29 2019/01/02 17:28:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.30 2019/01/02 18:39:01 jmcneill Exp $");
 
 #include 
 #include 
@@ -911,6 +911,10 @@ sunxi_mmc_signal_voltage(sdmmc_chipset_h
 		return EINVAL;
 	}
 
+	error = fdtbus_regulator_supports_voltage(sc->sc_reg_vqmmc, uvol, uvol);
+	if (error != 0)
+		return 0;
+
 	error = fdtbus_regulator_set_voltage(sc->sc_reg_vqmmc, uvol, uvol);
 	if (error != 0)
 		return error;



CVS commit: src/sys/dev/fdt

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 18:38:43 UTC 2019

Modified Files:
src/sys/dev/fdt: fdt_regulator.c fdtvar.h

Log Message:
Add a function to report if a regulator can support the requested voltage range


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/fdt_regulator.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/fdt/fdtvar.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/dev/fdt/fdt_regulator.c
diff -u src/sys/dev/fdt/fdt_regulator.c:1.6 src/sys/dev/fdt/fdt_regulator.c:1.7
--- src/sys/dev/fdt/fdt_regulator.c:1.6	Sat Jun 30 20:34:43 2018
+++ src/sys/dev/fdt/fdt_regulator.c	Wed Jan  2 18:38:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_regulator.c,v 1.6 2018/06/30 20:34:43 jmcneill Exp $ */
+/* $NetBSD: fdt_regulator.c,v 1.7 2019/01/02 18:38:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.6 2018/06/30 20:34:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.7 2019/01/02 18:38:43 jmcneill Exp $");
 
 #include 
 #include 
@@ -130,6 +130,9 @@ fdtbus_regulator_disable(struct fdtbus_r
 {
 	struct fdtbus_regulator_controller *rc = reg->reg_rc;
 
+	if (of_hasprop(rc->rc_phandle, "regulator-always-on"))
+		return EIO;
+
 	return rc->rc_funcs->enable(rc->rc_dev, false);
 }
 
@@ -155,3 +158,25 @@ fdtbus_regulator_get_voltage(struct fdtb
 
 	return rc->rc_funcs->get_voltage(rc->rc_dev, puvol);
 }
+
+int
+fdtbus_regulator_supports_voltage(struct fdtbus_regulator *reg, u_int min_uvol,
+u_int max_uvol)
+{
+	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	u_int uvol;
+
+	if (rc->rc_funcs->set_voltage == NULL)
+		return EINVAL;
+
+	if (of_getprop_uint32(rc->rc_phandle, "regulator-min-microvolt", &uvol) == 0) {
+		if (uvol < min_uvol)
+			return ERANGE;
+	}
+	if (of_getprop_uint32(rc->rc_phandle, "regulator-max-microvolt", &uvol) == 0) {
+		if (uvol > max_uvol)
+			return ERANGE;
+	}
+
+	return 0;
+}

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.43 src/sys/dev/fdt/fdtvar.h:1.44
--- src/sys/dev/fdt/fdtvar.h:1.43	Wed Jan  2 14:54:54 2019
+++ src/sys/dev/fdt/fdtvar.h	Wed Jan  2 18:38:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.43 2019/01/02 14:54:54 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.44 2019/01/02 18:38:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -300,6 +300,8 @@ int		fdtbus_regulator_set_voltage(struct
 		u_int, u_int);
 int		fdtbus_regulator_get_voltage(struct fdtbus_regulator *,
 		u_int *);
+int		fdtbus_regulator_supports_voltage(struct fdtbus_regulator *,
+		u_int, u_int);
 struct syscon *	fdtbus_syscon_acquire(int, const char *);
 struct syscon *	fdtbus_syscon_lookup(int);
 



CVS commit: src/sys/dev/i2c

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 18:38:03 UTC 2019

Modified Files:
src/sys/dev/i2c: axppmic.c

Log Message:
Revert part of previous - do not reserve regulators, it's perfectly normal for 
devices to share one.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/i2c/axppmic.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/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.17 src/sys/dev/i2c/axppmic.c:1.18
--- src/sys/dev/i2c/axppmic.c:1.17	Wed Jan  2 17:28:55 2019
+++ src/sys/dev/i2c/axppmic.c	Wed Jan  2 18:38:03 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.17 2019/01/02 17:28:55 jmcneill Exp $ */
+/* $NetBSD: axppmic.c,v 1.18 2019/01/02 18:38:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,13 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.17 2019/01/02 17:28:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.18 2019/01/02 18:38:03 jmcneill Exp $");
 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -310,7 +309,6 @@ struct axpreg_softc {
 	i2c_tag_t	sc_i2c;
 	i2c_addr_t	sc_addr;
 	const struct axppmic_ctrl *sc_ctrl;
-	u_int		sc_inuse;
 };
 
 struct axpreg_attach_args {
@@ -880,20 +878,12 @@ axppmic_attach(device_t parent, device_t
 static int
 axpreg_acquire(device_t dev)
 {
-	struct axpreg_softc *sc = device_private(dev);
-
-	if (atomic_cas_uint(&sc->sc_inuse, 0, 1) != 0)
-		return EBUSY;
-
 	return 0;
 }
 
 static void
 axpreg_release(device_t dev)
 {
-	struct axpreg_softc *sc = device_private(dev);
-
-	atomic_swap_uint(&sc->sc_inuse, 0);
 }
 
 static int



CVS commit: src/distrib/shark/instkernel/instkernel

2019-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  2 17:34:03 UTC 2019

Modified Files:
src/distrib/shark/instkernel/instkernel: Makefile

Log Message:
use ARM_ELF2AOUT


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/distrib/shark/instkernel/instkernel/Makefile

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

Modified files:

Index: src/distrib/shark/instkernel/instkernel/Makefile
diff -u src/distrib/shark/instkernel/instkernel/Makefile:1.23 src/distrib/shark/instkernel/instkernel/Makefile:1.24
--- src/distrib/shark/instkernel/instkernel/Makefile:1.23	Sun Jul 10 00:37:56 2011
+++ src/distrib/shark/instkernel/instkernel/Makefile	Wed Jan  2 12:34:03 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.23 2011/07/10 04:37:56 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.24 2019/01/02 17:34:03 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -12,7 +12,7 @@ MDSET_RELEASEDIR=	binary/kernel
 MDSET_SUFFIXES.-=	aout create-aout
 
 create-aout= \
-	${OBJCOPY} ${OBJCOPY_ELF2AOUT_FLAGS} ${.TARGET:R} ${.TARGET}
+	${ARM_ELF2AOUT} ${.TARGET:R} ${.TARGET}
 
 release::	check_RELEASEDIR .WAIT netbsd-INSTALL.aout.gz
 	${RELEASE_INSTALL} netbsd-INSTALL.aout.gz \



CVS commit: src/distrib/cats/instkernel

2019-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  2 17:32:25 UTC 2019

Modified Files:
src/distrib/cats/instkernel: Makefile

Log Message:
use arm_elf2aout


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/distrib/cats/instkernel/Makefile

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

Modified files:

Index: src/distrib/cats/instkernel/Makefile
diff -u src/distrib/cats/instkernel/Makefile:1.21 src/distrib/cats/instkernel/Makefile:1.22
--- src/distrib/cats/instkernel/Makefile:1.21	Sun Jul 10 00:37:56 2011
+++ src/distrib/cats/instkernel/Makefile	Wed Jan  2 12:32:25 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2011/07/10 04:37:56 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.22 2019/01/02 17:32:25 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -13,7 +13,7 @@ MDSET_RELEASEDIR=	binary/kernel
 MDSET_NOSTRIP=		# defined
 
 MDSET_POST.netbsd-INSTALL.aout= \
-${OBJCOPY} ${OBJCOPY_ELF2AOUT_FLAGS} ${.TARGET} ${.TARGET}.tmp ;\
+${ARM_ELF2AOUT} ${.TARGET} ${.TARGET}.tmp && \
 	mv ${.TARGET}.tmp ${.TARGET}
 
 .include "${DISTRIBDIR}/common/Makefile.mdset"



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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 17:29:58 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sun8i_a83t_ccu.c sunxi_ccu.h

Log Message:
Add support for cluster 0 and 1 CPUX PLLs.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/sunxi/sunxi_ccu.h

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.5 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.6
--- src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.5	Sat Oct 28 22:59:27 2017
+++ src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c	Wed Jan  2 17:29:58 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_a83t_ccu.c,v 1.5 2017/10/28 22:59:27 jmcneill Exp $ */
+/* $NetBSD: sun8i_a83t_ccu.c,v 1.6 2019/01/02 17:29:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.5 2017/10/28 22:59:27 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.6 2019/01/02 17:29:58 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,7 +41,12 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_c
 #include 
 #include 
 
+#define	PLL_C0CPUX_CTRL_REG	0x000
+#define	PLL_C1CPUX_CTRL_REG	0x004
+#define	 PLL_CxCPUX_CTRL_PLL_FACTOR_N	__BITS(15,8)
 #define	PLL_PERIPH_CTRL_REG	0x028
+#define	CPUX_AXI_CFG_REG	0x050
+#define	 Cx_CPUX_CLK_SRC_SEL(cluster)	__BIT(12 + (cluster) * 16)
 #define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
 #define	BUS_CLK_GATING_REG0	0x060
@@ -54,6 +59,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_c
 #define	 SDMMC2_CLK_MODE_SELECT	__BIT(30)
 #define	USBPHY_CFG_REG		0x0cc
 #define	MBUS_RST_REG		0x0fc
+#define	PLL_STABLE_STATUS_REG	0x20c
 #define	BUS_SOFT_RST_REG0	0x2c0
 #define	BUS_SOFT_RST_REG1	0x2c4
 #define	BUS_SOFT_RST_REG2	0x2c8
@@ -123,7 +129,91 @@ static const char *apb1_parents[] = { "a
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph" };
 static const char *mod_parents[] = { "hosc", "pll_periph" };
 
+static kmutex_t cpux_axi_cfg_lock;
+
+static int
+sun8i_a83t_ccu_cpux_set_rate(struct sunxi_ccu_softc *sc,
+struct sunxi_ccu_clk *clk, u_int rate)
+{
+	const int cluster = clk->u.nkmp.reg == PLL_C0CPUX_CTRL_REG ? 0 : 1;
+	struct sunxi_ccu_nkmp *nkmp = &clk->u.nkmp;
+	uint32_t val;
+	u_int n;
+
+	n = rate / 2400;
+	if (n < 0x11 || n > 0xff)
+		return EINVAL;
+
+	/* Switch cluster to OSC24M clock */
+	mutex_enter(&cpux_axi_cfg_lock);
+	val = CCU_READ(sc, CPUX_AXI_CFG_REG);
+	val &= ~Cx_CPUX_CLK_SRC_SEL(cluster);
+	CCU_WRITE(sc, CPUX_AXI_CFG_REG, val);
+	mutex_exit(&cpux_axi_cfg_lock);
+
+	/* Set new PLL rate */
+	val = CCU_READ(sc, nkmp->reg);
+	val &= ~PLL_CxCPUX_CTRL_PLL_FACTOR_N;
+	val |= __SHIFTIN(n, PLL_CxCPUX_CTRL_PLL_FACTOR_N);
+	CCU_WRITE(sc, nkmp->reg, val);
+
+	/* Wait for PLL lock */
+	while ((CCU_READ(sc, PLL_STABLE_STATUS_REG) & nkmp->lock) == 0)
+		;
+
+	/* Switch cluster back to CPUX PLL */
+	mutex_enter(&cpux_axi_cfg_lock);
+	val = CCU_READ(sc, CPUX_AXI_CFG_REG);
+	val |= Cx_CPUX_CLK_SRC_SEL(cluster);
+	CCU_WRITE(sc, CPUX_AXI_CFG_REG, val);
+	mutex_exit(&cpux_axi_cfg_lock);
+
+	return 0;
+}
+
 static struct sunxi_ccu_clk sun8i_a83t_ccu_clks[] = {
+	[A83T_CLK_C0CPUX] = {
+		.type = SUNXI_CCU_NKMP,
+		.base.name = "pll_c0cpux",
+		.u.nkmp.reg = PLL_C0CPUX_CTRL_REG,
+		.u.nkmp.parent = "hosc",
+		.u.nkmp.n = __BITS(15,8),
+		.u.nkmp.k = 0,
+		.u.nkmp.m = __BITS(1,0),
+		.u.nkmp.p = __BIT(16),
+		.u.nkmp.enable = __BIT(31),
+		.u.nkmp.flags = SUNXI_CCU_NKMP_SCALE_CLOCK |
+SUNXI_CCU_NKMP_FACTOR_N_EXACT |
+SUNXI_CCU_NKMP_FACTOR_P_X4,
+		.u.nkmp.lock = __BIT(0),	/* PLL_STABLE_STATUS_REG */
+		.u.nkmp.table = NULL,
+		.enable = sunxi_ccu_nkmp_enable,
+		.get_rate = sunxi_ccu_nkmp_get_rate,
+		.set_rate = sun8i_a83t_ccu_cpux_set_rate,
+		.get_parent = sunxi_ccu_nkmp_get_parent,
+	},
+
+	[A83T_CLK_C1CPUX] = {
+		.type = SUNXI_CCU_NKMP,
+		.base.name = "pll_c1cpux",
+		.u.nkmp.reg = PLL_C1CPUX_CTRL_REG,
+		.u.nkmp.parent = "hosc",
+		.u.nkmp.n = __BITS(15,8),
+		.u.nkmp.k = 0,
+		.u.nkmp.m = __BITS(1,0),
+		.u.nkmp.p = __BIT(16),
+		.u.nkmp.enable = __BIT(31),
+		.u.nkmp.flags = SUNXI_CCU_NKMP_SCALE_CLOCK |
+SUNXI_CCU_NKMP_FACTOR_N_EXACT |
+SUNXI_CCU_NKMP_FACTOR_P_X4,
+		.u.nkmp.lock = __BIT(1),	/* PLL_STABLE_STATUS_REG */
+		.u.nkmp.table = NULL,
+		.enable = sunxi_ccu_nkmp_enable,
+		.get_rate = sunxi_ccu_nkmp_get_rate,
+		.set_rate = sun8i_a83t_ccu_cpux_set_rate,
+		.get_parent = sunxi_ccu_nkmp_get_parent,
+	},
+
 	SUNXI_CCU_NKMP(A83T_CLK_PLL_PERIPH, "pll_periph", "hosc",
 	PLL_PERIPH_CTRL_REG,	/* reg */
 	__BITS(15,8),		/* n */
@@ -298,6 +388,8 @@ sun8i_a83t_ccu_attach(device_t parent, d
 	sc->sc_clks = sun8i_a83t_ccu_clks;
 	sc->sc_nclks = __arraycount(sun8i_a83t_ccu_clks);
 
+	mutex_init(&cpux_axi_cfg_lock, MUTEX_DEFAULT, IPL_

CVS commit: src/sys/dev/i2c

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 17:28:55 UTC 2019

Modified Files:
src/sys/dev/i2c: axppmic.c

Log Message:
Add support for AXP813 and only allow one consumer per regulator at a time


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/i2c/axppmic.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/i2c/axppmic.c
diff -u src/sys/dev/i2c/axppmic.c:1.16 src/sys/dev/i2c/axppmic.c:1.17
--- src/sys/dev/i2c/axppmic.c:1.16	Tue Nov 13 19:06:05 2018
+++ src/sys/dev/i2c/axppmic.c	Wed Jan  2 17:28:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.16 2018/11/13 19:06:05 jakllsch Exp $ */
+/* $NetBSD: axppmic.c,v 1.17 2019/01/02 17:28:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill 
@@ -27,12 +27,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.16 2018/11/13 19:06:05 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.17 2019/01/02 17:28:55 jmcneill Exp $");
 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -202,6 +203,47 @@ static const struct axppmic_ctrl axp805_
 		0x11, __BIT(6), 0x26, __BITS(4,0)),
 };
 
+static const struct axppmic_ctrl axp813_ctrls[] = {
+	AXP_CTRL("dldo1", 700, 3300, 100,
+		0x12, __BIT(3), 0x15, __BITS(4,0)),
+	AXP_CTRL2("dldo2", 700, 4200, 100, 28, 200, 4,
+		0x12, __BIT(4), 0x16, __BITS(4,0)),
+	AXP_CTRL("dldo3", 700, 3300, 100,
+	 	0x12, __BIT(5), 0x17, __BITS(4,0)),
+	AXP_CTRL("dldo4", 700, 3300, 100,
+		0x12, __BIT(6), 0x18, __BITS(4,0)),
+	AXP_CTRL("eldo1", 700, 1900, 50,
+		0x12, __BIT(0), 0x19, __BITS(4,0)),
+	AXP_CTRL("eldo2", 700, 1900, 50,
+		0x12, __BIT(1), 0x1a, __BITS(4,0)),
+	AXP_CTRL("eldo3", 700, 1900, 50,
+		0x12, __BIT(2), 0x1b, __BITS(4,0)),
+	AXP_CTRL("fldo1", 700, 1450, 50,
+		0x13, __BIT(2), 0x1c, __BITS(3,0)),
+	AXP_CTRL("fldo2", 700, 1450, 50,
+		0x13, __BIT(3), 0x1d, __BITS(3,0)),
+	AXP_CTRL("dcdc1", 1600, 3400, 100,
+		0x10, __BIT(0), 0x20, __BITS(4,0)),
+	AXP_CTRL2("dcdc2", 500, 1300, 10, 70, 20, 5,
+		0x10, __BIT(1), 0x21, __BITS(6,0)),
+	AXP_CTRL2("dcdc3", 500, 1300, 10, 70, 20, 5,
+		0x10, __BIT(2), 0x22, __BITS(6,0)),
+	AXP_CTRL2("dcdc4", 500, 1300, 10, 70, 20, 5,
+		0x10, __BIT(3), 0x23, __BITS(6,0)),
+	AXP_CTRL2("dcdc5", 800, 1840, 10, 33, 20, 36,
+		0x10, __BIT(4), 0x24, __BITS(6,0)),
+	AXP_CTRL2("dcdc6", 600, 1520, 10, 51, 20, 21,
+		0x10, __BIT(5), 0x25, __BITS(6,0)),
+	AXP_CTRL2("dcdc7", 600, 1520, 10, 51, 20, 21,
+		0x10, __BIT(6), 0x26, __BITS(6,0)),
+	AXP_CTRL("aldo1", 700, 3300, 100,
+		0x13, __BIT(5), 0x28, __BITS(4,0)),
+	AXP_CTRL("aldo2", 700, 3300, 100,
+		0x13, __BIT(6), 0x29, __BITS(4,0)),
+	AXP_CTRL("aldo3", 700, 3300, 100,
+		0x13, __BIT(7), 0x2a, __BITS(4,0)),
+};
+
 struct axppmic_irq {
 	u_int reg;
 	uint8_t mask;
@@ -268,6 +310,7 @@ struct axpreg_softc {
 	i2c_tag_t	sc_i2c;
 	i2c_addr_t	sc_addr;
 	const struct axppmic_ctrl *sc_ctrl;
+	u_int		sc_inuse;
 };
 
 struct axpreg_attach_args {
@@ -305,10 +348,31 @@ static const struct axppmic_config axp80
 	.poklirq = AXPPMIC_IRQ(2, __BIT(0)),
 };
 
+static const struct axppmic_config axp813_config = {
+	.name = "AXP813",
+	.controls = axp813_ctrls,
+	.ncontrols = __arraycount(axp813_ctrls),
+	.irq_regs = 6,
+	.has_battery = true,
+	.has_fuel_gauge = true,
+	.batsense_step = 1100,
+	.charge_step = 1000,
+	.discharge_step = 1000,
+	.maxcap_step = 1456,
+	.coulomb_step = 1456,
+	.poklirq = AXPPMIC_IRQ(5, __BIT(3)),
+	.acinirq = AXPPMIC_IRQ(1, __BITS(6,5)),
+	.vbusirq = AXPPMIC_IRQ(1, __BITS(3,2)),
+	.battirq = AXPPMIC_IRQ(2, __BITS(7,6)),
+	.chargeirq = AXPPMIC_IRQ(2, __BITS(3,2)),
+	.chargestirq = AXPPMIC_IRQ(4, __BITS(1,0)),	
+};
+
 static const struct device_compatible_entry compat_data[] = {
 	{ "x-powers,axp803",		(uintptr_t)&axp803_config },
 	{ "x-powers,axp805",		(uintptr_t)&axp805_config },
 	{ "x-powers,axp806",		(uintptr_t)&axp805_config },
+	{ "x-powers,axp813",		(uintptr_t)&axp813_config },
 	{ NULL,0 }
 };
 
@@ -816,12 +880,20 @@ axppmic_attach(device_t parent, device_t
 static int
 axpreg_acquire(device_t dev)
 {
+	struct axpreg_softc *sc = device_private(dev);
+
+	if (atomic_cas_uint(&sc->sc_inuse, 0, 1) != 0)
+		return EBUSY;
+
 	return 0;
 }
 
 static void
 axpreg_release(device_t dev)
 {
+	struct axpreg_softc *sc = device_private(dev);
+
+	atomic_swap_uint(&sc->sc_inuse, 0);
 }
 
 static int



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

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 17:28:18 UTC 2019

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

Log Message:
Try to acquire vmmc-supply if present


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/sunxi/sunxi_mmc.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_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.28 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.29
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.28	Fri Nov  9 14:39:51 2018
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Wed Jan  2 17:28:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.28 2018/11/09 14:39:51 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.29 2019/01/02 17:28:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.28 2018/11/09 14:39:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.29 2019/01/02 17:28:18 jmcneill Exp $");
 
 #include 
 #include 
@@ -190,6 +190,7 @@ struct sunxi_mmc_softc {
 	struct fdtbus_gpio_pin *sc_gpio_wp;
 	int sc_gpio_wp_inverted;
 
+	struct fdtbus_regulator *sc_reg_vmmc;
 	struct fdtbus_regulator *sc_reg_vqmmc;
 
 	struct fdtbus_mmc_pwrseq *sc_pwrseq;
@@ -328,8 +329,6 @@ sunxi_mmc_attach(device_t parent, device
 
 	sc->sc_rst_ahb = fdtbus_reset_get(phandle, "ahb");
 
-	sc->sc_reg_vqmmc = fdtbus_regulator_acquire(phandle, "vqmmc-supply");
-
 	sc->sc_pwrseq = fdtbus_mmc_pwrseq_get(phandle);
 
 	if (clk_enable(sc->sc_clk_ahb) != 0 ||
@@ -362,6 +361,9 @@ sunxi_mmc_attach(device_t parent, device
 	aprint_naive("\n");
 	aprint_normal(": SD/MMC controller\n");
 
+	sc->sc_reg_vmmc = fdtbus_regulator_acquire(phandle, "vmmc-supply");
+	sc->sc_reg_vqmmc = fdtbus_regulator_acquire(phandle, "vqmmc-supply");
+
 	sc->sc_gpio_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",
 	GPIO_PIN_INPUT);
 	sc->sc_gpio_wp = fdtbus_gpio_acquire(phandle, "wp-gpios",



CVS commit: src/usr.bin/menuc

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 16:32:59 UTC 2019

Modified Files:
src/usr.bin/menuc: menu_sys.def

Log Message:
If a menu starts with disabled options, skip those and start at the
first enabled one instead.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/usr.bin/menuc/menu_sys.def

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

Modified files:

Index: src/usr.bin/menuc/menu_sys.def
diff -u src/usr.bin/menuc/menu_sys.def:1.60 src/usr.bin/menuc/menu_sys.def:1.61
--- src/usr.bin/menuc/menu_sys.def:1.60	Wed Nov 21 20:04:48 2018
+++ src/usr.bin/menuc/menu_sys.def	Wed Jan  2 16:32:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: menu_sys.def,v 1.60 2018/11/21 20:04:48 martin Exp $	*/
+/*	$NetBSD: menu_sys.def,v 1.61 2019/01/02 16:32:59 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -684,12 +684,16 @@ process_menu(int num, void *arg)
 	if (m == NULL)
 		return;
 
-	/* Default to select option 0 and display from 0 */
+	/* Default to select option 0 and display from 0, skip any
+	 * disabled options at the top of the menu. */
 	m->topline = 0;
-	if ((m->mopt & (MC_DFLTEXIT | MC_NOEXITOPT)) == MC_DFLTEXIT)
+	if ((m->mopt & (MC_DFLTEXIT | MC_NOEXITOPT)) == MC_DFLTEXIT) {
 		m->cursel = -1;
-	else
-		m->cursel = 0;
+	} else {
+		for (m->cursel = 0; m->cursel < m->numopts; m->cursel++)
+			if ((m->opts[m->cursel].opt_flags & OPT_IGNORE) == 0)
+break;
+	}
 
 	for (;;) {
 		if (isendwin())



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

2019-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  2 16:27:04 UTC 2019

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm/armv6_start.S

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/arm/armv6_start.S
diff -u src/sys/arch/arm/arm/armv6_start.S:1.3 src/sys/arch/arm/arm/armv6_start.S:1.4
--- src/sys/arch/arm/arm/armv6_start.S:1.3	Wed Jan  2 16:17:15 2019
+++ src/sys/arch/arm/arm/armv6_start.S	Wed Jan  2 16:27:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv6_start.S,v 1.3 2019/01/02 16:17:15 skrll Exp $	*/
+/*	$NetBSD: armv6_start.S,v 1.4 2019/01/02 16:27:04 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2017, 2018 The NetBSD Foundation, Inc.
@@ -480,6 +480,7 @@ generic_startv6:
 #else
 #define CPU_CONTROL_EX_BEND_SET		CPU_CONTROL_EX_BEND
 #endif
+
 #ifdef ARM32_DISABLE_ALIGNMENT_FAULTS
 #define CPU_CONTROL_AFLT_ENABLE_CLR	CPU_CONTROL_AFLT_ENABLE
 #define CPU_CONTROL_AFLT_ENABLE_SET	0
@@ -487,6 +488,7 @@ generic_startv6:
 #define CPU_CONTROL_AFLT_ENABLE_CLR	0
 #define CPU_CONTROL_AFLT_ENABLE_SET	CPU_CONTROL_AFLT_ENABLE
 #endif
+
 #ifdef ARM_MMU_EXTENDED
 #define CPU_CONTROL_XP_ENABLE_CLR	0
 #define CPU_CONTROL_XP_ENABLE_SET	CPU_CONTROL_XP_ENABLE
@@ -760,7 +762,6 @@ ENTRY_NP(cpu_mpstart)
 	// disables and clears caches
 	bl	armv7_init
 
-
 	movw	r0, #:lower16:TEMP_L1_TABLE
 	movt	r0, #:upper16:TEMP_L1_TABLE
 	sub	r0, R_VTOPDIFF



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

2019-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  2 16:17:15 UTC 2019

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
Misc. tidyup


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/arm/armv6_start.S

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/arm/armv6_start.S
diff -u src/sys/arch/arm/arm/armv6_start.S:1.2 src/sys/arch/arm/arm/armv6_start.S:1.3
--- src/sys/arch/arm/arm/armv6_start.S:1.2	Wed Jan  2 14:31:33 2019
+++ src/sys/arch/arm/arm/armv6_start.S	Wed Jan  2 16:17:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv6_start.S,v 1.2 2019/01/02 14:31:33 skrll Exp $	*/
+/*	$NetBSD: armv6_start.S,v 1.3 2019/01/02 16:17:15 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2017, 2018 The NetBSD Foundation, Inc.
@@ -667,16 +667,15 @@ armv7_mmuinit:
 
 
 #if 0
-//XXXNH FreeBSD
 
-288	/*
-289	 * Set TEX remap registers
-290	 *  - All is set to uncacheable memory
-291	 */
-292	ldr	r0, =0xA
-293	mcr	CP15_PRRR(r0)
-294	mov	r0, #0
-295	mcr	CP15_NMRR(r0)
+/*
+ * Set TEX remap registers
+ *  - All is set to uncacheable memory
+ */
+	ldr	r0, =0xA
+	mcr	CP15_PRRR(r0)
+	mov	r0, #0
+	mcr	CP15_NMRR(r0)
 #endif
 
 	XPUTC(#'I')
@@ -758,16 +757,6 @@ ENTRY_NP(cpu_mpstart)
 	XPUTC('\n')
 	XPUTC('\r')
 
-#if 0
-	// We haven't used anything from memory yet so we can invalidate the
-	// L1 cache without fear of losing valuable data.  Afterwards, we can
-	// flush icache without worrying about anything getting written back
-	// to memory.
-	bl	armv7_dcache_l1inv_all		// toss-dcache
-	bl	armv7_icache_inv_all		// toss i-cache after d-cache
-
-#endif
-
 	// disables and clears caches
 	bl	armv7_init
 
@@ -970,13 +959,6 @@ armv6_mmuinit:
 	nop
 	nop
 
-#if 0
-	VPRINTF("MMU\n\r")
-
-	VPRINTX(r4)
-	VPRINTF("\n\r")
-#endif
-
 	mov	pc, r4
 
 	.ltorg



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

2019-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  2 16:13:49 UTC 2019

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

Log Message:
Avoid double negative


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/fdt/cpu_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/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.16 src/sys/arch/arm/fdt/cpu_fdt.c:1.17
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.16	Thu Oct 18 09:01:52 2018
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Wed Jan  2 16:13:49 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.16 2018/10/18 09:01:52 skrll Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.17 2019/01/02 16:13:49 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "psci_fdt.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.16 2018/10/18 09:01:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.17 2019/01/02 16:13:49 skrll Exp $");
 
 #include 
 #include 
@@ -286,7 +286,7 @@ arm_fdt_cpu_mpstart(void)
 	int child, ret;
 	const char *method;
 #if NPSCI_FDT > 0
-	bool nopsci = false;
+	bool psci_p = true;
 #endif
 
 	const int cpus = OF_finddevice("/cpus");
@@ -297,7 +297,7 @@ arm_fdt_cpu_mpstart(void)
 
 #if NPSCI_FDT > 0
 	if (psci_fdt_preinit() != 0)
-		nopsci = true;
+		psci_p = false;
 #endif
 
 	/* MPIDR affinity levels of boot processor. */
@@ -340,7 +340,7 @@ arm_fdt_cpu_mpstart(void)
 continue;
 
 #if NPSCI_FDT > 0
-		} else if (!nopsci && (strcmp(method, "psci") == 0)) {
+		} else if (psci_p && (strcmp(method, "psci") == 0)) {
 			ret = psci_cpu_on(mpidr, cpu_fdt_mpstart_pa(), 0);
 			if (ret != PSCI_SUCCESS)
 continue;



CVS commit: src/share/mk

2019-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  2 16:08:53 UTC 2019

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
un-86'ed the ELF2AOUT variable.


To generate a diff of this commit:
cvs rdiff -u -r1.1091 -r1.1092 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1091 src/share/mk/bsd.own.mk:1.1092
--- src/share/mk/bsd.own.mk:1.1091	Mon Dec 31 08:31:25 2018
+++ src/share/mk/bsd.own.mk	Wed Jan  2 11:08:53 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1091 2018/12/31 13:31:25 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1092 2019/01/02 16:08:53 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -337,7 +337,7 @@ LDFLAGS+=	--sysroot=/
 
 DBSYM=		${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-dbsym
 ARM_ELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}arm-elf2aout
-M86K_ELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
+M68K_ELF2AOUT=	${TOOLDIR}/bin/${_TOOL_PREFIX}m68k-elf2aout
 MIPS_ELF2ECOFF=	${TOOLDIR}/bin/${_TOOL_PREFIX}mips-elf2ecoff
 INSTALL=	${TOOLDIR}/bin/${MACHINE_GNU_PLATFORM}-install
 LEX=		${TOOLDIR}/bin/${_TOOL_PREFIX}lex



CVS commit: xsrc/external/mit/xf86-video-ati/dist/src/AtomBios

2019-01-02 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Wed Jan  2 15:54:24 UTC 2019

Modified Files:
xsrc/external/mit/xf86-video-ati/dist/src/AtomBios: CD_Operations.c

Log Message:
put back compatibility code for now; needed for sparc (from martin@)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c:1.5 xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c:1.6
--- xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c:1.5	Tue Jan  1 21:58:48 2019
+++ xsrc/external/mit/xf86-video-ati/dist/src/AtomBios/CD_Operations.c	Wed Jan  2 10:54:24 2019
@@ -215,6 +215,30 @@ VOID IndirectIOCommand_CLEAR(PARSER_TEMP
 pParserTempData->IndirectData &= ~((0x >> (32-pParserTempData->IndirectIOTablePointer[1])) << pParserTempData->IndirectIOTablePointer[2]);
 }
 
+/* from xorg-server 1.18 compiler.h */
+struct __una_u64 { uint64_t x __attribute__((packed)); };
+struct __una_u32 { uint32_t x __attribute__((packed)); };
+
+static __inline__ uint16_t ldw_u(uint16_t *p)
+{
+	uint16_t ret;
+	memmove(&ret, p, sizeof(*p));
+	return ret;
+}
+
+static __inline__ uint32_t ldl_u(uint32_t *p)
+{
+	uint32_t ret;
+	memmove(&ret, p, sizeof(*p));
+	return ret;
+}
+
+static __inline__ void stl_u(uint32_t val, uint32_t *p)
+{
+	struct __una_u32 *ptr = (struct __una_u32 *) p;
+	ptr->x = val;
+}
+
 UINT32 IndirectInputOutput(PARSER_TEMP_DATA STACK_BASED * pParserTempData)
 {
 // if ((pParserTempData->IndirectData & 0x7f)==INDIRECT_IO_MM) pParserTempData->IndirectData|=pParserTempData->CurrentPortID;



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

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:53:27 UTC 2019

Modified Files:
src/sys/conf [netbsd-8]: copyright

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1152):

sys/conf/copyright: revision 1.17

Welcome to 2019!


To generate a diff of this commit:
cvs rdiff -u -r1.15.8.1 -r1.15.8.2 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.15.8.1 src/sys/conf/copyright:1.15.8.2
--- src/sys/conf/copyright:1.15.8.1	Sun May  6 09:27:04 2018
+++ src/sys/conf/copyright	Wed Jan  2 15:53:27 2019
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
-2018 The NetBSD Foundation, Inc.  All rights reserved.
+2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



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

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:51:31 UTC 2019

Modified Files:
src/sys/compat/netbsd32 [netbsd-8]: netbsd32_compat_14.c
netbsd32_conv.h
src/sys/compat/sys [netbsd-8]: msg.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1151):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0x80bad7a7 in kleak_copyout
| #1 0x8048e71b in netbsd32___msgctl50
| #2 0x8022fb5b in netbsd32_syscall
| #3 0x802096dd in handle_syscall


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.10.1 src/sys/compat/netbsd32/netbsd32_compat_14.c
cvs rdiff -u -r1.31.8.1 -r1.31.8.2 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.4 -r1.4.58.1 src/sys/compat/sys/msg.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_14.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.26 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.26.10.1
--- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.26	Thu Jan  7 21:58:28 2016
+++ src/sys/compat/netbsd32/netbsd32_compat_14.c	Wed Jan  2 15:51:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_14.c,v 1.26 2016/01/07 21:58:28 joerg Exp $	*/
+/*	$NetBSD: netbsd32_compat_14.c,v 1.26.10.1 2019/01/02 15:51:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1999 Eduardo E. Horvath
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.26 2016/01/07 21:58:28 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.26.10.1 2019/01/02 15:51:31 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sysv.h"
@@ -107,6 +107,7 @@ static inline void
 native_to_netbsd32_msqid_ds14(struct msqid_ds *msqbuf, struct netbsd32_msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	native_to_netbsd32_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.31.8.1 src/sys/compat/netbsd32/netbsd32_conv.h:1.31.8.2
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.31.8.1	Mon Nov  6 10:33:06 2017
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Wed Jan  2 15:51:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.31.8.1 2017/11/06 10:33:06 snj Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.31.8.2 2019/01/02 15:51:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -544,6 +544,7 @@ netbsd32_from_msqid_ds50(const struct ms
 struct netbsd32_msqid_ds50 *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;
@@ -560,6 +561,7 @@ netbsd32_from_msqid_ds(const struct msqi
 struct netbsd32_msqid_ds *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;

Index: src/sys/compat/sys/msg.h
diff -u src/sys/compat/sys/msg.h:1.4 src/sys/compat/sys/msg.h:1.4.58.1
--- src/sys/compat/sys/msg.h:1.4	Mon Jan 19 19:39:41 2009
+++ src/sys/compat/sys/msg.h	Wed Jan  2 15:51:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.h,v 1.4 2009/01/19 19:39:41 christos Exp $	*/
+/*	$NetBSD: msg.h,v 1.4.58.1 2019/01/02 15:51:31 martin Exp $	*/
 
 /*
  * SVID compatible msg.h file
@@ -108,6 +108,7 @@ static __inline void
 __native_to_msqid_ds13(const struct msqid_ds *msqbuf, struct msqid_ds13 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	omsqbuf->msg_perm = msqbuf->msg_perm;
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x
@@ -149,6 +150,7 @@ static __inline void
 __native_to_msqid_ds14(const struct msqid_ds *msqbuf, struct msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	__native_to_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x



CVS commit: [netbsd-8] src

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:48:01 UTC 2019

Modified Files:
src/distrib/sets/lists/base [netbsd-8]: mi
src/doc [netbsd-8]: 3RDPARTY
src/external/public-domain/tz/dist [netbsd-8]: Makefile NEWS
TZDATA_VERSION africa asia australasia leapseconds leapseconds.awk
northamerica theory.html version ziguard.awk zone.tab zone1970.tab

Log Message:
Pull up the following, requested by kre in ticket #1150:

doc/3RDPARTY1.1581 (patch)
distrib/sets/lists/base/mi  1.1196 (patch)
external/public-domain/tz/dist/Makefile up to 1.1.1.23
external/public-domain/tz/dist/NEWS up to 1.1.1.26
external/public-domain/tz/dist/TZDATA_VERSION   up to 1.16
external/public-domain/tz/dist/africa   up to 1.1.1.19
external/public-domain/tz/dist/asia up to 1.1.1.22
external/public-domain/tz/dist/australasia  up to 1.1.1.17
external/public-domain/tz/dist/leapseconds  up to 1.1.1.12
external/public-domain/tz/dist/leapseconds.awk  up to 1.1.1.8
external/public-domain/tz/dist/northamerica up to 1.1.1.22
external/public-domain/tz/dist/theory.html  up to 1.1.1.7
external/public-domain/tz/dist/version  up to 1.1.1.13
external/public-domain/tz/dist/ziguard.awk  up to 1.1.1.4
external/public-domain/tz/dist/zone.tab up to 1.1.1.16
external/public-domain/tz/dist/zone1970.tab up to 1.1.1.18

Import tzdata2018h from ftp://ftp.iana.org/tz/releases/tzdata2018h.tar.gz

Summary of changes in tzdata2018h (2018-12-23 17:59:32 -0800):

Qyzylorda (aka Kyzylorda) oblast in Kazakhstan moved from +06 to
+05 on 2018-12-21.  This is a zone split as Qostanay (aka
Kostanay) did not switch, so create a zone Asia/Qostanay.

Metlakatla, Alaska observes PST this winter only.

Add predictions for Iran from 2038 through 2090.

Changes to some old timestamps for Nauru (1979) Guam (1959-77),
Hong Kong (1904, 1941, 1945, 1952) (others in Pacific during WWII)

Summary of changes in tzdata2018i (2018-12-30 11:05:43 -0800):

Due to a change in government, Sao Tome and Principe switches back
from +01 to +00 on 2019-01-01 at 02:00.


To generate a diff of this commit:
cvs rdiff -u -r1.1158.2.5 -r1.1158.2.6 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.1444.2.19 -r1.1444.2.20 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.17.4.5 -r1.1.1.17.4.6 \
src/external/public-domain/tz/dist/Makefile
cvs rdiff -u -r1.1.1.18.4.6 -r1.1.1.18.4.7 \
src/external/public-domain/tz/dist/NEWS
cvs rdiff -u -r1.8.4.6 -r1.8.4.7 \
src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.1.1.11.4.6 -r1.1.1.11.4.7 \
src/external/public-domain/tz/dist/africa
cvs rdiff -u -r1.1.1.16.4.5 -r1.1.1.16.4.6 \
src/external/public-domain/tz/dist/asia \
src/external/public-domain/tz/dist/northamerica
cvs rdiff -u -r1.1.1.11.4.5 -r1.1.1.11.4.6 \
src/external/public-domain/tz/dist/australasia
cvs rdiff -u -r1.1.1.8.4.3 -r1.1.1.8.4.4 \
src/external/public-domain/tz/dist/leapseconds
cvs rdiff -u -r1.1.1.5.8.2 -r1.1.1.5.8.3 \
src/external/public-domain/tz/dist/leapseconds.awk
cvs rdiff -u -r1.1.1.1.2.7 -r1.1.1.1.2.8 \
src/external/public-domain/tz/dist/theory.html
cvs rdiff -u -r1.1.1.5.4.6 -r1.1.1.5.4.7 \
src/external/public-domain/tz/dist/version
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
src/external/public-domain/tz/dist/ziguard.awk
cvs rdiff -u -r1.1.1.11.4.4 -r1.1.1.11.4.5 \
src/external/public-domain/tz/dist/zone.tab
cvs rdiff -u -r1.1.1.13.4.4 -r1.1.1.13.4.5 \
src/external/public-domain/tz/dist/zone1970.tab

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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1158.2.5 src/distrib/sets/lists/base/mi:1.1158.2.6
--- src/distrib/sets/lists/base/mi:1.1158.2.5	Wed Oct 31 08:55:32 2018
+++ src/distrib/sets/lists/base/mi	Wed Jan  2 15:48:00 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1158.2.5 2018/10/31 08:55:32 martin Exp $
+# $NetBSD: mi,v 1.1158.2.6 2019/01/02 15:48:00 martin Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -5558,6 +5558,7 @@
 ./usr/share/zoneinfo/Asia/Pontianak		base-sys-share		share
 ./usr/share/zoneinfo/Asia/Pyongyang		base-sys-share		share
 ./usr/share/zoneinfo/Asia/Qatar			base-sys-share		share
+./usr/share/zoneinfo/Asia/Qostanay		base-sys-share		share
 ./usr/share/zoneinfo/Asia/Qyzylorda		base-sys-share		share
 ./usr/share/zoneinfo/Asia/Rangoon		base-sys-share		share
 ./usr/share/zoneinfo/Asia/Riyadh		base-sys-share		share

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1444.2.19 src/doc/3RDPARTY:1.1444.2.20
--- src/doc/3RDPARTY:1.1444.2.19	Wed Oct 31 10:02:14 2018
+++ src/doc/3RDPARTY	Wed Jan  2 15:48:00 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1444.2.1

CVS commit: [netbsd-7] src/doc

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:32:26 UTC 2019

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

Log Message:
Tickets #1668 and #1669


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.28 -r1.1.2.29 src/doc/CHANGES-7.3

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

Modified files:

Index: src/doc/CHANGES-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.28 src/doc/CHANGES-7.3:1.1.2.29
--- src/doc/CHANGES-7.3:1.1.2.28	Thu Dec 27 12:00:42 2018
+++ src/doc/CHANGES-7.3	Wed Jan  2 15:32:26 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.28 2018/12/27 12:00:42 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.29 2019/01/02 15:32:26 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -347,3 +347,15 @@ sys/kern/kern_time.c1.191
 	Fix kernel info leak.
 	[maxv, ticket #1667]
 
+sys/compat/netbsd32/netbsd32_compat_14.c	1.27
+sys/compat/netbsd32/netbsd32_conv.h		1.37
+sys/compat/sys/msg.h1.5
+
+	Fix kernel info leaks.
+	[maxv, ticket #1668]
+
+sys/conf/copyright1.17
+
+	Welcome to 2019!
+	[jnemeth, ticket #1669]
+



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

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:31:46 UTC 2019

Modified Files:
src/sys/conf [netbsd-7]: copyright

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1669):

sys/conf/copyright: revision 1.17

Welcome to 2019!


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.3 -r1.12.4.4 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.12.4.3 src/sys/conf/copyright:1.12.4.4
--- src/sys/conf/copyright:1.12.4.3	Fri Mar  9 19:50:16 2018
+++ src/sys/conf/copyright	Wed Jan  2 15:31:46 2019
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
-2018 The NetBSD Foundation, Inc.  All rights reserved.
+2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-7-1] src/doc

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:31:18 UTC 2019

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

Log Message:
Tickets #1668 and #1669


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/doc/CHANGES-7.1.3

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

Modified files:

Index: src/doc/CHANGES-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.32 src/doc/CHANGES-7.1.3:1.1.2.33
--- src/doc/CHANGES-7.1.3:1.1.2.32	Thu Dec 27 12:01:28 2018
+++ src/doc/CHANGES-7.1.3	Wed Jan  2 15:31:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.32 2018/12/27 12:01:28 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.33 2019/01/02 15:31:18 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -334,3 +334,15 @@ sys/kern/kern_time.c1.191
 	Fix kernel info leak.
 	[maxv, ticket #1667]
 
+sys/compat/netbsd32/netbsd32_compat_14.c	1.27
+sys/compat/netbsd32/netbsd32_conv.h		1.37
+sys/compat/sys/msg.h1.5
+
+	Fix kernel info leaks.
+	[maxv, ticket #1668]
+
+sys/conf/copyright1.17
+
+	Welcome to 2019!
+	[jnemeth, ticket #1669]
+



CVS commit: [netbsd-7-1] src/sys/conf

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:30:49 UTC 2019

Modified Files:
src/sys/conf [netbsd-7-1]: copyright

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1669):

sys/conf/copyright: revision 1.17

Welcome to 2019!


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.2.2.1 -r1.12.4.2.2.2 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.12.4.2.2.1 src/sys/conf/copyright:1.12.4.2.2.2
--- src/sys/conf/copyright:1.12.4.2.2.1	Fri Mar  9 19:50:15 2018
+++ src/sys/conf/copyright	Wed Jan  2 15:30:49 2019
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
-2018 The NetBSD Foundation, Inc.  All rights reserved.
+2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-7-0] src/doc

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:30:17 UTC 2019

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

Log Message:
Tickets #1668 and #1669


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.125 -r1.1.2.126 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.125 src/doc/CHANGES-7.0.3:1.1.2.126
--- src/doc/CHANGES-7.0.3:1.1.2.125	Thu Dec 27 12:02:18 2018
+++ src/doc/CHANGES-7.0.3	Wed Jan  2 15:30:17 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.125 2018/12/27 12:02:18 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.126 2019/01/02 15:30:17 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5642,3 +5642,15 @@ sys/kern/kern_time.c1.191
 	Fix kernel info leak.
 	[maxv, ticket #1667]
 
+sys/compat/netbsd32/netbsd32_compat_14.c	1.27
+sys/compat/netbsd32/netbsd32_conv.h		1.37
+sys/compat/sys/msg.h1.5
+
+	Fix kernel info leaks.
+	[maxv, ticket #1668]
+
+sys/conf/copyright1.17
+
+	Welcome to 2019!
+	[jnemeth, ticket #1669]
+



CVS commit: [netbsd-7-0] src/sys/conf

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:29:22 UTC 2019

Modified Files:
src/sys/conf [netbsd-7-0]: copyright

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #1669):

sys/conf/copyright: revision 1.17

Welcome to 2019!


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.1.2.2 -r1.12.4.1.2.3 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.12.4.1.2.2 src/sys/conf/copyright:1.12.4.1.2.3
--- src/sys/conf/copyright:1.12.4.1.2.2	Fri Mar  9 19:50:14 2018
+++ src/sys/conf/copyright	Wed Jan  2 15:29:22 2019
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
-2018 The NetBSD Foundation, Inc.  All rights reserved.
+2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: [netbsd-7-0] src/sys/compat

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:27:23 UTC 2019

Modified Files:
src/sys/compat/netbsd32 [netbsd-7-0]: netbsd32_compat_14.c
netbsd32_conv.h
src/sys/compat/sys [netbsd-7-0]: msg.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0x80bad7a7 in kleak_copyout
| #1 0x8048e71b in netbsd32___msgctl50
| #2 0x8022fb5b in netbsd32_syscall
| #3 0x802096dd in handle_syscall


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.78.1 src/sys/compat/netbsd32/netbsd32_compat_14.c
cvs rdiff -u -r1.28 -r1.28.8.1 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.4 -r1.4.44.1 src/sys/compat/sys/msg.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_14.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21.78.1
--- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21	Thu Dec 20 23:03:01 2007
+++ src/sys/compat/netbsd32/netbsd32_compat_14.c	Wed Jan  2 15:27:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $	*/
+/*	$NetBSD: netbsd32_compat_14.c,v 1.21.78.1 2019/01/02 15:27:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1999 Eduardo E. Horvath
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21.78.1 2019/01/02 15:27:23 martin Exp $");
 
 #include 
 #include 
@@ -126,6 +126,7 @@ static inline void
 native_to_netbsd32_msqid_ds14(struct msqid_ds *msqbuf, struct netbsd32_msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	native_to_netbsd32_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.28 src/sys/compat/netbsd32/netbsd32_conv.h:1.28.8.1
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.28	Tue Mar 18 18:20:41 2014
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Wed Jan  2 15:27:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.28 2014/03/18 18:20:41 riastradh Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.28.8.1 2019/01/02 15:27:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -543,6 +543,7 @@ netbsd32_from_msqid_ds50(const struct ms
 struct netbsd32_msqid_ds50 *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;
@@ -559,6 +560,7 @@ netbsd32_from_msqid_ds(const struct msqi
 struct netbsd32_msqid_ds *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;

Index: src/sys/compat/sys/msg.h
diff -u src/sys/compat/sys/msg.h:1.4 src/sys/compat/sys/msg.h:1.4.44.1
--- src/sys/compat/sys/msg.h:1.4	Mon Jan 19 19:39:41 2009
+++ src/sys/compat/sys/msg.h	Wed Jan  2 15:27:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.h,v 1.4 2009/01/19 19:39:41 christos Exp $	*/
+/*	$NetBSD: msg.h,v 1.4.44.1 2019/01/02 15:27:23 martin Exp $	*/
 
 /*
  * SVID compatible msg.h file
@@ -108,6 +108,7 @@ static __inline void
 __native_to_msqid_ds13(const struct msqid_ds *msqbuf, struct msqid_ds13 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	omsqbuf->msg_perm = msqbuf->msg_perm;
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x
@@ -149,6 +150,7 @@ static __inline void
 __native_to_msqid_ds14(const struct msqid_ds *msqbuf, struct msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	__native_to_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x



CVS commit: [netbsd-7-1] src/sys/compat

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:26:38 UTC 2019

Modified Files:
src/sys/compat/netbsd32 [netbsd-7-1]: netbsd32_compat_14.c
netbsd32_conv.h
src/sys/compat/sys [netbsd-7-1]: msg.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0x80bad7a7 in kleak_copyout
| #1 0x8048e71b in netbsd32___msgctl50
| #2 0x8022fb5b in netbsd32_syscall
| #3 0x802096dd in handle_syscall


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.82.1 src/sys/compat/netbsd32/netbsd32_compat_14.c
cvs rdiff -u -r1.28.4.1 -r1.28.4.1.4.1 \
src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.4 -r1.4.52.1 src/sys/compat/sys/msg.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_14.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21.82.1
--- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21	Thu Dec 20 23:03:01 2007
+++ src/sys/compat/netbsd32/netbsd32_compat_14.c	Wed Jan  2 15:26:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $	*/
+/*	$NetBSD: netbsd32_compat_14.c,v 1.21.82.1 2019/01/02 15:26:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1999 Eduardo E. Horvath
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21.82.1 2019/01/02 15:26:38 martin Exp $");
 
 #include 
 #include 
@@ -126,6 +126,7 @@ static inline void
 native_to_netbsd32_msqid_ds14(struct msqid_ds *msqbuf, struct netbsd32_msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	native_to_netbsd32_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1 src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1.4.1
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1	Wed Nov  4 17:46:21 2015
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Wed Jan  2 15:26:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.28.4.1 2015/11/04 17:46:21 riz Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.28.4.1.4.1 2019/01/02 15:26:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -544,6 +544,7 @@ netbsd32_from_msqid_ds50(const struct ms
 struct netbsd32_msqid_ds50 *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;
@@ -560,6 +561,7 @@ netbsd32_from_msqid_ds(const struct msqi
 struct netbsd32_msqid_ds *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;

Index: src/sys/compat/sys/msg.h
diff -u src/sys/compat/sys/msg.h:1.4 src/sys/compat/sys/msg.h:1.4.52.1
--- src/sys/compat/sys/msg.h:1.4	Mon Jan 19 19:39:41 2009
+++ src/sys/compat/sys/msg.h	Wed Jan  2 15:26:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.h,v 1.4 2009/01/19 19:39:41 christos Exp $	*/
+/*	$NetBSD: msg.h,v 1.4.52.1 2019/01/02 15:26:38 martin Exp $	*/
 
 /*
  * SVID compatible msg.h file
@@ -108,6 +108,7 @@ static __inline void
 __native_to_msqid_ds13(const struct msqid_ds *msqbuf, struct msqid_ds13 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	omsqbuf->msg_perm = msqbuf->msg_perm;
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x
@@ -149,6 +150,7 @@ static __inline void
 __native_to_msqid_ds14(const struct msqid_ds *msqbuf, struct msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	__native_to_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x



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

2019-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  2 15:25:29 UTC 2019

Modified Files:
src/sys/compat/netbsd32 [netbsd-7]: netbsd32_compat_14.c
netbsd32_conv.h
src/sys/compat/sys [netbsd-7]: msg.h

Log Message:
Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0x80bad7a7 in kleak_copyout
| #1 0x8048e71b in netbsd32___msgctl50
| #2 0x8022fb5b in netbsd32_syscall
| #3 0x802096dd in handle_syscall


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.74.1 src/sys/compat/netbsd32/netbsd32_compat_14.c
cvs rdiff -u -r1.28.4.1 -r1.28.4.2 src/sys/compat/netbsd32/netbsd32_conv.h
cvs rdiff -u -r1.4 -r1.4.40.1 src/sys/compat/sys/msg.h

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_14.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21 src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21.74.1
--- src/sys/compat/netbsd32/netbsd32_compat_14.c:1.21	Thu Dec 20 23:03:01 2007
+++ src/sys/compat/netbsd32/netbsd32_compat_14.c	Wed Jan  2 15:25:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $	*/
+/*	$NetBSD: netbsd32_compat_14.c,v 1.21.74.1 2019/01/02 15:25:29 martin Exp $	*/
 
 /*
  * Copyright (c) 1999 Eduardo E. Horvath
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21 2007/12/20 23:03:01 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_14.c,v 1.21.74.1 2019/01/02 15:25:29 martin Exp $");
 
 #include 
 #include 
@@ -126,6 +126,7 @@ static inline void
 native_to_netbsd32_msqid_ds14(struct msqid_ds *msqbuf, struct netbsd32_msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	native_to_netbsd32_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x

Index: src/sys/compat/netbsd32/netbsd32_conv.h
diff -u src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1 src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.2
--- src/sys/compat/netbsd32/netbsd32_conv.h:1.28.4.1	Wed Nov  4 17:46:21 2015
+++ src/sys/compat/netbsd32/netbsd32_conv.h	Wed Jan  2 15:25:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_conv.h,v 1.28.4.1 2015/11/04 17:46:21 riz Exp $	*/
+/*	$NetBSD: netbsd32_conv.h,v 1.28.4.2 2019/01/02 15:25:29 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -544,6 +544,7 @@ netbsd32_from_msqid_ds50(const struct ms
 struct netbsd32_msqid_ds50 *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;
@@ -560,6 +561,7 @@ netbsd32_from_msqid_ds(const struct msqi
 struct netbsd32_msqid_ds *ds32p)
 {
 
+	memset(ds32p, 0, sizeof(*ds32p));
 	netbsd32_from_ipc_perm(&dsp->msg_perm, &ds32p->msg_perm);
 	ds32p->_msg_cbytes = (netbsd32_u_long)dsp->_msg_cbytes;
 	ds32p->msg_qnum = (netbsd32_u_long)dsp->msg_qnum;

Index: src/sys/compat/sys/msg.h
diff -u src/sys/compat/sys/msg.h:1.4 src/sys/compat/sys/msg.h:1.4.40.1
--- src/sys/compat/sys/msg.h:1.4	Mon Jan 19 19:39:41 2009
+++ src/sys/compat/sys/msg.h	Wed Jan  2 15:25:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.h,v 1.4 2009/01/19 19:39:41 christos Exp $	*/
+/*	$NetBSD: msg.h,v 1.4.40.1 2019/01/02 15:25:29 martin Exp $	*/
 
 /*
  * SVID compatible msg.h file
@@ -108,6 +108,7 @@ static __inline void
 __native_to_msqid_ds13(const struct msqid_ds *msqbuf, struct msqid_ds13 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	omsqbuf->msg_perm = msqbuf->msg_perm;
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x
@@ -149,6 +150,7 @@ static __inline void
 __native_to_msqid_ds14(const struct msqid_ds *msqbuf, struct msqid_ds14 *omsqbuf)
 {
 
+	memset(omsqbuf, 0, sizeof(*omsqbuf));
 	__native_to_ipc_perm14(&msqbuf->msg_perm, &omsqbuf->msg_perm);
 
 #define	CVT(x)	omsqbuf->x = msqbuf->x



CVS commit: src/sys/dev/fdt

2019-01-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  2 14:54:54 UTC 2019

Modified Files:
src/sys/dev/fdt: cpus.c fdtbus.c fdtvar.h

Log Message:
Do not sort cpu nodes when enumerating so they attach in the order listed
in the devicetree.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/cpus.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/fdt/fdtvar.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/dev/fdt/cpus.c
diff -u src/sys/dev/fdt/cpus.c:1.4 src/sys/dev/fdt/cpus.c:1.5
--- src/sys/dev/fdt/cpus.c:1.4	Sun Sep  9 21:15:21 2018
+++ src/sys/dev/fdt/cpus.c	Wed Jan  2 14:54:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpus.c,v 1.4 2018/09/09 21:15:21 jmcneill Exp $ */
+/* $NetBSD: cpus.c,v 1.5 2019/01/02 14:54:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.4 2018/09/09 21:15:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.5 2019/01/02 14:54:54 jmcneill Exp $");
 
 #include 
 #include 
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.4
 static int	cpus_match(device_t, cfdata_t, void *);
 static void	cpus_attach(device_t, device_t, void *);
 
-static bool	cpus_bus_match(void *, int);
+static bool	cpus_cpu_enabled(int);
 
 CFATTACH_DECL_NEW(cpus, 0, cpus_match, cpus_attach, NULL, NULL);
 
@@ -59,15 +59,20 @@ cpus_attach(device_t parent, device_t se
 {
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
+	int child;
 
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-	fdt_add_bus_match(self, phandle, faa, cpus_bus_match, NULL);
+	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+		if (!cpus_cpu_enabled(child))
+			continue;
+		fdt_add_child(self, child, faa, 0);
+	}
 }
 
 static bool
-cpus_bus_match(void *priv, int child)
+cpus_cpu_enabled(int child)
 {
 	const char *s;
 

Index: src/sys/dev/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.24 src/sys/dev/fdt/fdtbus.c:1.25
--- src/sys/dev/fdt/fdtbus.c:1.24	Sun Sep 23 19:32:03 2018
+++ src/sys/dev/fdt/fdtbus.c	Wed Jan  2 14:54:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.24 2018/09/23 19:32:03 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.25 2019/01/02 14:54:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.24 2018/09/23 19:32:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.25 2019/01/02 14:54:54 jmcneill Exp $");
 
 #include 
 #include 
@@ -198,29 +198,37 @@ void
 fdt_add_bus_match(device_t bus, const int phandle, struct fdt_attach_args *faa,
 bool (*fn)(void *, int), void *fnarg)
 {
-	struct fdt_node *node;
 	int child;
 
 	for (child = OF_child(phandle); child; child = OF_peer(child)) {
 		if (fn && !fn(fnarg, child))
 			continue;
 
-		/* Add the node to our device list */
-		node = kmem_alloc(sizeof(*node), KM_SLEEP);
-		node->n_bus = bus;
-		node->n_dev = NULL;
-		node->n_phandle = child;
-		node->n_name = fdtbus_get_string(child, "name");
-		node->n_order = fdt_get_order(child);
-		node->n_faa = *faa;
-		node->n_faa.faa_phandle = child;
-		node->n_faa.faa_name = node->n_name;
-
-		fdt_add_node(node);
-		fdt_need_rescan = true;
+		fdt_add_child(bus, child, faa, fdt_get_order(child));
 	}
 }
 
+void
+fdt_add_child(device_t bus, const int child, struct fdt_attach_args *faa,
+u_int order)
+{
+	struct fdt_node *node;
+
+	/* Add the node to our device list */
+	node = kmem_alloc(sizeof(*node), KM_SLEEP);
+	node->n_bus = bus;
+	node->n_dev = NULL;
+	node->n_phandle = child;
+	node->n_name = fdtbus_get_string(child, "name");
+	node->n_order = order;
+	node->n_faa = *faa;
+	node->n_faa.faa_phandle = child;
+	node->n_faa.faa_name = node->n_name;
+
+	fdt_add_node(node);
+	fdt_need_rescan = true;
+}
+
 static int
 fdt_scan_submatch(device_t parent, cfdata_t cf, const int *locs, void *aux)
 {

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.42 src/sys/dev/fdt/fdtvar.h:1.43
--- src/sys/dev/fdt/fdtvar.h:1.42	Sat Sep 15 13:42:41 2018
+++ src/sys/dev/fdt/fdtvar.h	Wed Jan  2 14:54:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.42 2018/09/15 13:42:41 jakllsch Exp $ */
+/* $NetBSD: fdtvar.h,v 1.43 2019/01/02 14:54:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -362,6 +362,7 @@ const char *	fdtbus_get_string_index(int
 void		fdt_add_bus(device_t, int, struct fdt_attach_args *);
 void		fdt_add_bus_match(device_t, int, struct fdt_attach_args *,
   bool (*)(void *, int), void *);
+void		fdt_add_child(device_t, int, struct fdt_attach_args *, u_int);
 
 void		fdt_remove_byhandle(int);
 void		fdt_remove_bycompat(const char *[]);



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

2019-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  2 14:31:33 UTC 2019

Modified Files:
src/sys/arch/arm/arm: armv6_start.S

Log Message:
Fix a ASEND


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm/armv6_start.S

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/arm/armv6_start.S
diff -u src/sys/arch/arm/arm/armv6_start.S:1.1 src/sys/arch/arm/arm/armv6_start.S:1.2
--- src/sys/arch/arm/arm/armv6_start.S:1.1	Thu Oct 18 09:01:52 2018
+++ src/sys/arch/arm/arm/armv6_start.S	Wed Jan  2 14:31:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: armv6_start.S,v 1.1 2018/10/18 09:01:52 skrll Exp $	*/
+/*	$NetBSD: armv6_start.S,v 1.2 2019/01/02 14:31:33 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2017, 2018 The NetBSD Foundation, Inc.
@@ -1034,7 +1034,7 @@ ENTRY_NP(generic_vprint)
 	pop	{r4}
 	add	sp, sp, #4
 	mov	pc, lr
-ASEND(generic_prints)
+ASEND(generic_vprint)
 
 ENTRY_NP(generic_prints)
 	push	{r4, lr}



CVS commit: src/tools

2019-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jan  2 13:29:22 UTC 2019

Modified Files:
src/tools: Makefile

Log Message:
use MACHINE_CPU for elf2aout


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/tools/Makefile

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

Modified files:

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.197 src/tools/Makefile:1.198
--- src/tools/Makefile:1.197	Mon Dec 31 08:35:15 2018
+++ src/tools/Makefile	Wed Jan  2 08:29:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.197 2018/12/31 13:35:15 christos Exp $
+#	$NetBSD: Makefile,v 1.198 2019/01/02 13:29:22 christos Exp $
 
 .include 
 .include 
@@ -173,11 +173,11 @@ SUBDIR+=	macppc-fixcoff
 SUBDIR+=	powerpc-mkbootimage
 .endif
 
-.if ${MACHINE_ARCH} == "arm"
+.if ${MACHINE_CPU} == "arm"
 SUBDIR+=	arm-elf2aout
 .endif
 
-.if ${MACHINE_ARCH} == "m68k"
+.if ${MACHINE_CPU} == "m68k"
 SUBDIR+=	m68k-elf2aout
 .endif
 



CVS commit: src

2019-01-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jan  2 12:18:08 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c
src/sys/dev/nvmm/x86: nvmm_x86_svm.c

Log Message:
When there's no DecodeAssist in hardware, decode manually in software. This
is needed on certain AMD CPUs (like mine): the segment base of OUTS can be
overridden, and it is wrong to just assume DS.

We fetch the instruction and look at the prefixes if any to determine the
correct segment.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libnvmm/libnvmm_x86.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/nvmm/x86/nvmm_x86_svm.c

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

Modified files:

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.7 src/lib/libnvmm/libnvmm_x86.c:1.8
--- src/lib/libnvmm/libnvmm_x86.c:1.7	Sat Dec 29 17:54:54 2018
+++ src/lib/libnvmm/libnvmm_x86.c	Wed Jan  2 12:18:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.7 2018/12/29 17:54:54 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.8 2019/01/02 12:18:08 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -76,13 +76,14 @@ nvmm_vcpu_dump(struct nvmm_machine *mach
 	printf("| -> RBX=%p\n", (void *)state.gprs[NVMM_X64_GPR_RBX]);
 	printf("| -> RCX=%p\n", (void *)state.gprs[NVMM_X64_GPR_RCX]);
 	for (i = 0; i < NVMM_X64_NSEG; i++) {
-		printf("| -> %s: sel=0x%lx base=%p, limit=%p, P=%d\n",
+		printf("| -> %s: sel=0x%lx base=%p, limit=%p, P=%d, D=%d\n",
 		segnames[i],
 		state.segs[i].selector,
 		(void *)state.segs[i].base,
 		(void *)state.segs[i].limit,
-		state.segs[i].attrib.p);
+		state.segs[i].attrib.p, state.segs[i].attrib.def32);
 	}
+	printf("| -> CPL=%p\n", (void *)state.misc[NVMM_X64_MISC_CPL]);
 
 	return 0;
 }
@@ -619,6 +620,8 @@ write_guest_memory(struct nvmm_machine *
 
 /* -- */
 
+static int fetch_segment(struct nvmm_machine *, struct nvmm_x64_state *);
+
 int
 nvmm_assist_io(struct nvmm_machine *mach, nvmm_cpuid_t cpuid,
 struct nvmm_exit *exit)
@@ -628,7 +631,7 @@ nvmm_assist_io(struct nvmm_machine *mach
 	uint64_t cnt;
 	gvaddr_t gva;
 	int reg = 0; /* GCC */
-	int ret;
+	int ret, seg;
 
 	if (__predict_false(exit->reason != NVMM_EXIT_IO)) {
 		errno = EINVAL;
@@ -659,8 +662,19 @@ nvmm_assist_io(struct nvmm_machine *mach
 		gva &= mask_from_adsize(exit->u.io.address_size);
 
 		if (!is_long_mode(&state)) {
-			ret = segment_apply(&state.segs[exit->u.io.seg], &gva,
-			io.size);
+			if (exit->u.io.seg != -1) {
+seg = exit->u.io.seg;
+			} else {
+if (io.in) {
+	seg = NVMM_X64_SEG_ES;
+} else {
+	seg = fetch_segment(mach, &state);
+	if (seg == -1)
+		return -1;
+}
+			}
+
+			ret = segment_apply(&state.segs[seg], &gva, io.size);
 			if (ret == -1)
 return -1;
 		}
@@ -2091,24 +2105,27 @@ node_rex_prefix(struct x86_decode_fsm *f
 	return 0;
 }
 
-static const uint8_t legpref_table[NLEG] = {
+static const struct {
+	uint8_t byte;
+	int seg;
+} legpref_table[NLEG] = {
 	/* Group 1 */
-	[LEG_LOCK] = 0xF0,
-	[LEG_REPN] = 0xF2,
-	[LEG_REP]  = 0xF3,
+	[LEG_LOCK] = { 0xF0, -1 },
+	[LEG_REPN] = { 0xF2, -1 },
+	[LEG_REP]  = { 0xF3, -1 },
 	/* Group 2 */
-	[LEG_OVR_CS] = 0x2E,
-	[LEG_OVR_SS] = 0x36,
-	[LEG_OVR_DS] = 0x3E,
-	[LEG_OVR_ES] = 0x26,
-	[LEG_OVR_FS] = 0x64,
-	[LEG_OVR_GS] = 0x65,
-	[LEG_BRN_TAKEN]  = 0x2E,
-	[LEG_BRN_NTAKEN] =  0x3E,
+	[LEG_OVR_CS] = { 0x2E, NVMM_X64_SEG_CS },
+	[LEG_OVR_SS] = { 0x36, NVMM_X64_SEG_SS },
+	[LEG_OVR_DS] = { 0x3E, NVMM_X64_SEG_DS },
+	[LEG_OVR_ES] = { 0x26, NVMM_X64_SEG_ES },
+	[LEG_OVR_FS] = { 0x64, NVMM_X64_SEG_FS },
+	[LEG_OVR_GS] = { 0x65, NVMM_X64_SEG_GS },
+	[LEG_BRN_TAKEN]  = { 0x2E, -1 },
+	[LEG_BRN_NTAKEN] = { 0x3E, -1 },
 	/* Group 3 */
-	[LEG_OPR_OVR] = 0x66,
+	[LEG_OPR_OVR] = { 0x66, -1 },
 	/* Group 4 */
-	[LEG_ADR_OVR] = 0x67
+	[LEG_ADR_OVR] = { 0x67, -1 },
 };
 
 static int
@@ -2122,7 +2139,7 @@ node_legacy_prefix(struct x86_decode_fsm
 	}
 
 	for (i = 0; i < NLEG; i++) {
-		if (byte == legpref_table[i])
+		if (byte == legpref_table[i].byte)
 			break;
 	}
 
@@ -2451,6 +2468,46 @@ store_to_mem(struct nvmm_machine *mach, 
 }
 
 static int
+fetch_segment(struct nvmm_machine *mach, struct nvmm_x64_state *state)
+{
+	uint8_t inst_bytes[15], byte;
+	size_t i, n, fetchsize;
+	gvaddr_t gva;
+	int ret, seg;
+
+	fetchsize = sizeof(inst_bytes);
+
+	gva = state->gprs[NVMM_X64_GPR_RIP];
+	if (!is_long_mode(state)) {
+		ret = segment_apply(&state->segs[NVMM_X64_SEG_CS], &gva,
+		fetchsize);
+		if (ret == -1)
+			return -1;
+	}
+
+	ret = read_guest_memory(mach, state, gva, inst_bytes, fetchsize);
+	if (ret == -1)
+		return -1;
+
+	seg = NVMM_X64_SEG_DS;
+	for (n = 0; n < fetchsize; n++) {
+		byte = inst_bytes[n];
+		for (i = 0; i < NLEG; i++) {
+			if (byte != legpref_table[i].byte)
+continue;
+			if (i >= LEG_OVR_CS && i

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

2019-01-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan  2 09:04:09 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: cpu.c

Log Message:
Don't overwrite the setting of cpu_core_id from mpidr


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/arm/arm32/cpu.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/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.123 src/sys/arch/arm/arm32/cpu.c:1.124
--- src/sys/arch/arm/arm32/cpu.c:1.123	Thu Oct 18 09:01:52 2018
+++ src/sys/arch/arm/arm32/cpu.c	Wed Jan  2 09:04:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.123 2018/10/18 09:01:52 skrll Exp $	*/
+/*	$NetBSD: cpu.c,v 1.124 2019/01/02 09:04:09 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.123 2018/10/18 09:01:52 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.124 2019/01/02 09:04:09 skrll Exp $");
 
 #include 
 #include 
@@ -113,7 +113,6 @@ cpu_attach(device_t dv, cpuid_t id)
 			ci->ci_data.cpu_core_id = mpidr & MPIDR_AFF0;
 			ci->ci_data.cpu_package_id = mpidr & MPIDR_AFF1;
 		}
-		ci->ci_data.cpu_core_id = id;
 		ci->ci_data.cpu_cc_freq = cpu_info_store.ci_data.cpu_cc_freq;
 		ci->ci_arm_cpuid = cpu_info_store.ci_arm_cpuid;
 		ci->ci_arm_cputype = cpu_info_store.ci_arm_cputype;