CVS commit: src/share/man/man9

2017-10-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Oct 29 03:48:17 UTC 2017

Modified Files:
src/share/man/man9: memoryallocators.9

Log Message:
Fix typo.

Wishful thinking for some of our resource-constrained platforms!


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man9/memoryallocators.9

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

Modified files:

Index: src/share/man/man9/memoryallocators.9
diff -u src/share/man/man9/memoryallocators.9:1.7 src/share/man/man9/memoryallocators.9:1.8
--- src/share/man/man9/memoryallocators.9:1.7	Sat Oct 28 17:40:45 2017
+++ src/share/man/man9/memoryallocators.9	Sun Oct 29 03:48:17 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: memoryallocators.9,v 1.7 2017/10/28 17:40:45 riastradh Exp $
+.\" $NetBSD: memoryallocators.9,v 1.8 2017/10/29 03:48:17 riastradh Exp $
 .\"
 .\" Copyright (c) 2006 Elad Efrat 
 .\" All rights reserved.
@@ -52,7 +52,7 @@ a maximum usable number of allocations
 .It
 costly object initialization that can be reused
 .It
-allocating resources other than pageable RAM-packed kernel virtual
+allocating resources other than pageable RAM-backed kernel virtual
 address space
 .El
 .Ss The Kmem Allocator



CVS commit: src/usr.bin/seq

2017-10-28 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sun Oct 29 01:28:46 UTC 2017

Modified Files:
src/usr.bin/seq: seq.c

Log Message:
The sign is optional in an exponent

Treat numbers after [Ee] as a positive number rather than an invalid
numeric sequence.  (Taken from FreeBSD but done differently.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/seq/seq.c

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

Modified files:

Index: src/usr.bin/seq/seq.c
diff -u src/usr.bin/seq/seq.c:1.9 src/usr.bin/seq/seq.c:1.10
--- src/usr.bin/seq/seq.c:1.9	Sun Oct 29 00:02:23 2017
+++ src/usr.bin/seq/seq.c	Sun Oct 29 01:28:46 2017
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2005\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: seq.c,v 1.9 2017/10/29 00:02:23 ginsbach Exp $");
+__RCSID("$NetBSD: seq.c,v 1.10 2017/10/29 01:28:46 ginsbach Exp $");
 #endif /* not lint */
 
 #include 
@@ -211,10 +211,10 @@ numeric(const char *s)
 			}
 			if (ISEXP((unsigned char)*s)) {
 s++;
-if (ISSIGN((unsigned char)*s)) {
+/* optional sign */
+if (ISSIGN((unsigned char)*s))
 	s++;
-	continue;
-}
+continue;
 			}
 			break;
 		}



CVS commit: src/bin/sh

2017-10-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Oct 29 00:20:42 UTC 2017

Modified Files:
src/bin/sh: sh.1

Log Message:
Correct a markup typo (Sv -> Dv)


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.170 src/bin/sh/sh.1:1.171
--- src/bin/sh/sh.1:1.170	Sat Oct 28 06:36:17 2017
+++ src/bin/sh/sh.1	Sun Oct 29 00:20:42 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.170 2017/10/28 06:36:17 kre Exp $
+.\"	$NetBSD: sh.1,v 1.171 2017/10/29 00:20:42 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3301,7 +3301,7 @@ To cause a foreground process to stop, e
 .Ic stop
 character (usually control-Z).
 To cause a background process to stop, send it a
-.Sv STOP
+.Dv STOP
 signal, using the kill command.
 A useful function to define is
 .Bd -literal -compact



CVS commit: src/usr.bin/seq

2017-10-28 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Sun Oct 29 00:02:23 UTC 2017

Modified Files:
src/usr.bin/seq: seq.c

Log Message:
Fix typos (from FreeBSD)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/seq/seq.c

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

Modified files:

Index: src/usr.bin/seq/seq.c
diff -u src/usr.bin/seq/seq.c:1.8 src/usr.bin/seq/seq.c:1.9
--- src/usr.bin/seq/seq.c:1.8	Mon Sep  5 00:40:29 2016
+++ src/usr.bin/seq/seq.c	Sun Oct 29 00:02:23 2017
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 2005\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: seq.c,v 1.8 2016/09/05 00:40:29 sevan Exp $");
+__RCSID("$NetBSD: seq.c,v 1.9 2017/10/29 00:02:23 ginsbach Exp $");
 #endif /* not lint */
 
 #include 
@@ -349,7 +349,7 @@ unescape(char *orig)
 			*orig = c;
 			--cp;
 			continue;
-		case 'x':	/* hexidecimal number */
+		case 'x':	/* hexadecimal number */
 			cp++;	/* skip 'x' */
 			for (i = 0, c = 0;
 			 isxdigit((unsigned char)*cp) && i < 2;
@@ -422,7 +422,7 @@ decimal_places(const char *number)
 /*
  * generate_format - create a format string
  *
- * XXX to be bug for bug compatable with Plan9 and GNU return "%g"
+ * XXX to be bug for bug compatible with Plan9 and GNU return "%g"
  * when "%g" prints as "%e" (this way no width adjustments are made)
  */
 char *



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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 22:59:27 UTC 2017

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

Log Message:
add missing clock gates


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.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/sun8i_a83t_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.4 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.5
--- src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.4	Sat Oct 28 13:13:45 2017
+++ src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c	Sat Oct 28 22:59:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_a83t_ccu.c,v 1.4 2017/10/28 13:13:45 jmcneill Exp $ */
+/* $NetBSD: sun8i_a83t_ccu.c,v 1.5 2017/10/28 22:59:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.4 2017/10/28 13:13:45 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.5 2017/10/28 22:59:27 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_c
 #define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
 #define	BUS_CLK_GATING_REG0	0x060
+#define	BUS_CLK_GATING_REG1	0x064
 #define	BUS_CLK_GATING_REG2	0x068
 #define	BUS_CLK_GATING_REG3	0x06c
 #define	SDMMC0_CLK_REG		0x088
@@ -172,14 +173,30 @@ static struct sunxi_ccu_clk sun8i_a83t_c
 	SDMMC2_CLK_REG, __BITS(17, 16), __BITS(3,0), __BITS(25, 24), __BIT(31),
 	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN|SUNXI_CCU_NM_DIVIDE_BY_TWO),
 
+	SUNXI_CCU_GATE(A83T_CLK_BUS_MIPI_DSI, "bus-mipi-dsi", "ahb1",
+	BUS_CLK_GATING_REG0, 1),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_SS, "bus-ss", "ahb1",
+	BUS_CLK_GATING_REG0, 5),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_DMA, "bus-dma", "ahb1",
+	BUS_CLK_GATING_REG0, 6),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_MMC0, "bus-mmc0", "ahb1",
 	BUS_CLK_GATING_REG0, 8),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_MMC1, "bus-mmc1", "ahb1",
 	BUS_CLK_GATING_REG0, 9),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_MMC2, "bus-mmc2", "ahb1",
 	BUS_CLK_GATING_REG0, 10),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_NAND, "bus-nand", "ahb1",
+	BUS_CLK_GATING_REG0, 13),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_DRAM, "bus-dram", "ahb1",
+	BUS_CLK_GATING_REG0, 14),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_EMAC, "bus-emac", "ahb2",
 	BUS_CLK_GATING_REG0, 17),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_HSTIMER, "bus-hstimer", "ahb1",
+	BUS_CLK_GATING_REG0, 19),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_SPI0, "bus-spi0", "ahb1",
+	BUS_CLK_GATING_REG0, 20),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_SPI1, "bus-spi1", "ahb1",
+	BUS_CLK_GATING_REG0, 21),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_OTG, "bus-otg", "ahb1",
 	BUS_CLK_GATING_REG0, 24),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_EHCI0, "bus-ehci0", "ahb1",
@@ -189,8 +206,37 @@ static struct sunxi_ccu_clk sun8i_a83t_c
 	SUNXI_CCU_GATE(A83T_CLK_BUS_OHCI0, "bus-ohci0", "ahb1",
 	BUS_CLK_GATING_REG0, 29),
 
+	SUNXI_CCU_GATE(A83T_CLK_BUS_VE, "bus-ve", "ahb2",
+	BUS_CLK_GATING_REG1, 0),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_TCON0, "bus-tcon0", "ahb2",
+	BUS_CLK_GATING_REG1, 4),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_TCON1, "bus-tcon1", "ahb2",
+	BUS_CLK_GATING_REG1, 5),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_CSI, "bus-csi", "ahb2",
+	BUS_CLK_GATING_REG1, 8),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_HDMI, "bus-hdmi", "ahb2",
+	BUS_CLK_GATING_REG1, 11),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_DE, "bus-de", "ahb2",
+	BUS_CLK_GATING_REG1, 12),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_GPU, "bus-gpu", "ahb2",
+	BUS_CLK_GATING_REG1, 20),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_MSGBOX, "bus-msgbox", "ahb2",
+	BUS_CLK_GATING_REG1, 21),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_SPINLOCK, "bus-spinlock", "ahb2",
+	BUS_CLK_GATING_REG1, 22),
+
+	SUNXI_CCU_GATE(A83T_CLK_BUS_SPDIF, "bus-spdif", "apb1",
+	BUS_CLK_GATING_REG2, 1),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_PIO, "bus-pio", "apb1",
 	BUS_CLK_GATING_REG2, 5),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_I2S0, "bus-i2s0", "apb1",
+	BUS_CLK_GATING_REG2, 12),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_I2S1, "bus-i2s1", "apb1",
+	BUS_CLK_GATING_REG2, 13),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_I2S2, "bus-i2s2", "apb1",
+	BUS_CLK_GATING_REG2, 14),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_TDM, "bus-tdm", "apb1",
+	BUS_CLK_GATING_REG2, 15),
 
 	SUNXI_CCU_GATE(A83T_CLK_BUS_I2C0, "bus-i2c0", "apb2",
 	BUS_CLK_GATING_REG3, 0),
@@ -206,6 +252,8 @@ static struct sunxi_ccu_clk sun8i_a83t_c
 	BUS_CLK_GATING_REG3, 18),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_UART3, "bus-uart3", "apb2",
 	BUS_CLK_GATING_REG3, 19),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_UART4, "bus-uart4", "apb2",
+	BUS_CLK_GATING_REG3, 20),
 
 	SUNXI_CCU_GATE(A83T_CLK_USB_PHY0, "usb-phy0", "hosc",
 	USBPHY_CFG_REG, 8),



CVS commit: src/usr.bin/make

2017-10-28 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Oct 28 21:54:54 UTC 2017

Modified Files:
src/usr.bin/make: main.c

Log Message:
Ignore empty MAKEOBJDIR

Otherwise we end up with .OBJDIR = ${.CURDIR}/
which is quivalent, but fails the typial
.if ${.OBJDIR} == ${.CURDIR}


To generate a diff of this commit:
cvs rdiff -u -r1.272 -r1.273 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.272 src/usr.bin/make/main.c:1.273
--- src/usr.bin/make/main.c:1.272	Mon Jun 19 19:58:24 2017
+++ src/usr.bin/make/main.c	Sat Oct 28 21:54:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.273 2017/10/28 21:54:54 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -761,7 +761,8 @@ Main_SetVarObjdir(const char *var, const
 {
 	char *p, *path, *xpath;
 
-	if ((path = Var_Value(var, VAR_CMD, )) == NULL)
+	if ((path = Var_Value(var, VAR_CMD, )) == NULL ||
+	*path == '\0')
 		return FALSE;
 
 	/* expand variable substitutions */



CVS commit: src/sys/dev/usb

2017-10-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Oct 28 20:57:52 UTC 2017

Modified Files:
src/sys/dev/usb: umass.c

Log Message:
And yet another one.  :(


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/usb/umass.c

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

Modified files:

Index: src/sys/dev/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.161 src/sys/dev/usb/umass.c:1.162
--- src/sys/dev/usb/umass.c:1.161	Sat Oct 28 20:56:51 2017
+++ src/sys/dev/usb/umass.c	Sat Oct 28 20:57:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.161 2017/10/28 20:56:51 pgoyette Exp $	*/
+/*	$NetBSD: umass.c,v 1.162 2017/10/28 20:57:51 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.161 2017/10/28 20:56:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.162 2017/10/28 20:57:51 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2015,8 +2015,8 @@ umass_dump_buffer(struct umass_softc *sc
 	UMASSHIST_FUNC(); UMASSHIST_CALLED();
 	int i;
 
-	DPRINTFM(UDMASS_GEN, "sc %#jx: buffer %#jx", (uintptr_t)sc, buffer,
-	0, 0);
+	DPRINTFM(UDMASS_GEN, "sc %#jx: buffer %#jx", (uintptr_t)sc,
+	(uintptr_t)buffer, 0, 0);
 	for (i = 0; i < buflen && i < printlen;) {
 		if (i + 3 < buflen && i + 3 < printlen) {
 			DPRINTFM(UDMASS_GEN, "   0x%02jx%02jx%02jx%02jx",



CVS commit: src/sys/arch/amd64/amd64

2017-10-28 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Oct 28 20:57:17 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf locore.S

Log Message:
Use FLAT_RING3_CS64 (defined in Xen public headers) instead of numeric
value.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.139 -r1.140 src/sys/arch/amd64/amd64/locore.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/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.61 src/sys/arch/amd64/amd64/genassym.cf:1.62
--- src/sys/arch/amd64/amd64/genassym.cf:1.61	Sun Jul 16 14:02:48 2017
+++ src/sys/arch/amd64/amd64/genassym.cf	Sat Oct 28 20:57:17 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.61 2017/07/16 14:02:48 cherry Exp $
+#	$NetBSD: genassym.cf,v 1.62 2017/10/28 20:57:17 bouyer Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -349,6 +349,7 @@ define EVTCHN_UPCALL_MASK	offsetof(struc
 define XEN_PT_BASE		offsetof(struct start_info, pt_base)
 define XEN_NR_PT_FRAMES		offsetof(struct start_info, nr_pt_frames)
 define __HYPERVISOR_iret	__HYPERVISOR_iret
+define FLAT_RING3_CS64		FLAT_RING3_CS64
 endif
 
 define	NKL4_KIMG_ENTRIES	NKL4_KIMG_ENTRIES

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.139 src/sys/arch/amd64/amd64/locore.S:1.140
--- src/sys/arch/amd64/amd64/locore.S:1.139	Sat Oct 28 20:06:31 2017
+++ src/sys/arch/amd64/amd64/locore.S	Sat Oct 28 20:57:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.139 2017/10/28 20:06:31 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.140 2017/10/28 20:57:17 bouyer Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1484,7 +1484,7 @@ ENTRY(intrfastexit)
 	cmpw	$GSEL(GUCODE_SEL, SEL_UPL),TF_CS(%rsp)
 	je	.Luexit64
 #ifdef XEN
-	cmpw	$0xe033,TF_CS(%rsp)
+	cmpw	$FLAT_RING3_CS64,TF_CS(%rsp)
 	je	.Luexit64
 #endif
 



CVS commit: src/sys/dev/usb

2017-10-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Oct 28 20:56:51 UTC 2017

Modified Files:
src/sys/dev/usb: umass.c

Log Message:
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/usb/umass.c

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

Modified files:

Index: src/sys/dev/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.160 src/sys/dev/usb/umass.c:1.161
--- src/sys/dev/usb/umass.c:1.160	Sat Oct 28 00:37:12 2017
+++ src/sys/dev/usb/umass.c	Sat Oct 28 20:56:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.160 2017/10/28 00:37:12 pgoyette Exp $	*/
+/*	$NetBSD: umass.c,v 1.161 2017/10/28 20:56:51 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.160 2017/10/28 00:37:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umass.c,v 1.161 2017/10/28 20:56:51 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1982,7 +1982,8 @@ umass_bbb_dump_cbw(struct umass_softc *s
 	int tag = UGETDW(cbw->dCBWTag);
 	int flags = cbw->bCBWFlags;
 
-	DPRINTFM(UDMASS_BBB, "sc %#jx: CBW %jd: cmdlen=%jd", sc, tag, clen, 0);
+	DPRINTFM(UDMASS_BBB, "sc %#jx: CBW %jd: cmdlen=%jd",
+	(uintptr_t)sc, tag, clen, 0);
 	DPRINTFM(UDMASS_BBB, "  0x%02jx%02jx%02jx%02jx...",
 	c[0], c[1], c[2], c[3]);
 	DPRINTFM(UDMASS_BBB, "  0x%02jx%02jx%02jx%02jx...",



CVS commit: src/sys/arch/amd64/amd64

2017-10-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Oct 28 20:06:31 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: locore.S

Log Message:
It appears that Xen remaps the userland %cs to 0xE033. So add it to the
checklist. Otherwise we're going through Luexit32: %fs gets reloaded,
which sets the FS.base to NULL, which will cause the thread to page-fault
next time it accesses its TLS (as seen in PR/52662).

This fix is not very clean, and it would be nice to understand why Xen
remaps %cs. But I'm committing it now anyway, so that people can test.


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/amd64/amd64/locore.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/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.138 src/sys/arch/amd64/amd64/locore.S:1.139
--- src/sys/arch/amd64/amd64/locore.S:1.138	Sat Oct 21 08:08:26 2017
+++ src/sys/arch/amd64/amd64/locore.S	Sat Oct 28 20:06:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.138 2017/10/21 08:08:26 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.139 2017/10/28 20:06:31 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1483,6 +1483,10 @@ ENTRY(intrfastexit)
 	je	.Luexit64
 	cmpw	$GSEL(GUCODE_SEL, SEL_UPL),TF_CS(%rsp)
 	je	.Luexit64
+#ifdef XEN
+	cmpw	$0xe033,TF_CS(%rsp)
+	je	.Luexit64
+#endif
 
 .Luexit32:
 	NOT_XEN(cli;)



CVS commit: src/sys/arch/amd64/stand/prekern

2017-10-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Oct 28 19:28:11 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: mm.c

Log Message:
Fix a mistake I made in the very first revision. The calculation of the
number of slots was incorrect in some cases, and it could cause the
prekern to fault right away at boot time, or the kernel to fault when
loading kernel modules near the end of the module map.

The variables are divided by PAGE_SIZE to prevent integer overflows.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/mm.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/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.4 src/sys/arch/amd64/stand/prekern/mm.c:1.5
--- src/sys/arch/amd64/stand/prekern/mm.c:1.4	Mon Oct 23 06:00:59 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Sat Oct 28 19:28:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.4 2017/10/23 06:00:59 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.5 2017/10/28 19:28:11 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -112,20 +112,28 @@ mm_mprotect(vaddr_t startva, size_t size
 	}
 }
 
+static size_t
+mm_nentries_range(vaddr_t startva, vaddr_t endva, size_t pgsz)
+{
+	size_t npages;
+
+	npages = roundup((endva / PAGE_SIZE), (pgsz / PAGE_SIZE)) -
+	rounddown((startva / PAGE_SIZE), (pgsz / PAGE_SIZE));
+	return (npages / (pgsz / PAGE_SIZE));
+}
+
 static void
 mm_map_tree(vaddr_t startva, vaddr_t endva)
 {
-	size_t i, size, nL4e, nL3e, nL2e;
+	size_t i, nL4e, nL3e, nL2e;
 	size_t L4e_idx, L3e_idx, L2e_idx;
 	paddr_t pa;
 
-	size = endva - startva;
-
 	/*
 	 * Build L4.
 	 */
 	L4e_idx = pl4_i(startva);
-	nL4e = roundup(size, NBPD_L4) / NBPD_L4;
+	nL4e = mm_nentries_range(startva, endva, NBPD_L4);
 	ASSERT(L4e_idx == 511);
 	ASSERT(nL4e == 1);
 	if (!mm_pte_is_valid(L4_BASE[L4e_idx])) {
@@ -137,7 +145,7 @@ mm_map_tree(vaddr_t startva, vaddr_t end
 	 * Build L3.
 	 */
 	L3e_idx = pl3_i(startva);
-	nL3e = roundup(size, NBPD_L3) / NBPD_L3;
+	nL3e = mm_nentries_range(startva, endva, NBPD_L3);
 	for (i = 0; i < nL3e; i++) {
 		if (mm_pte_is_valid(L3_BASE[L3e_idx+i])) {
 			continue;
@@ -150,7 +158,7 @@ mm_map_tree(vaddr_t startva, vaddr_t end
 	 * Build L2.
 	 */
 	L2e_idx = pl2_i(startva);
-	nL2e = roundup(size, NBPD_L2) / NBPD_L2;
+	nL2e = mm_nentries_range(startva, endva, NBPD_L2);
 	for (i = 0; i < nL2e; i++) {
 		if (mm_pte_is_valid(L2_BASE[L2e_idx+i])) {
 			continue;



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

2017-10-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 28 19:25:31 UTC 2017

Modified Files:
src/tests/lib/libc/tls: t_tls_static.c

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/tls/t_tls_static.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/tls/t_tls_static.c
diff -u src/tests/lib/libc/tls/t_tls_static.c:1.3 src/tests/lib/libc/tls/t_tls_static.c:1.4
--- src/tests/lib/libc/tls/t_tls_static.c:1.3	Sat Oct 28 15:24:55 2017
+++ src/tests/lib/libc/tls/t_tls_static.c	Sat Oct 28 15:25:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tls_static.c,v 1.3 2017/10/28 19:24:55 christos Exp $	*/
+/*	$NetBSD: t_tls_static.c,v 1.4 2017/10/28 19:25:31 christos Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_tls_static.c,v 1.3 2017/10/28 19:24:55 christos Exp $");
+__RCSID("$NetBSD: t_tls_static.c,v 1.4 2017/10/28 19:25:31 christos Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ testf(void *dummy)
 #define CHECK(a, b) \
 ATF_CHECK_EQ_MSG(var ## a, b, "var%d[%d] != %d", a, var ## a, b)
 	CHECK(1, 1);
-	CHECK(1, 0);
+	CHECK(2, 0);
 	testf_helper();
 	CHECK(1, -1);
 	CHECK(2, -1);



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

2017-10-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 28 19:24:55 UTC 2017

Modified Files:
src/tests/lib/libc/tls: t_tls_static.c

Log Message:
make tests print the values.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/tls/t_tls_static.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/tls/t_tls_static.c
diff -u src/tests/lib/libc/tls/t_tls_static.c:1.2 src/tests/lib/libc/tls/t_tls_static.c:1.3
--- src/tests/lib/libc/tls/t_tls_static.c:1.2	Tue Jan 17 15:34:57 2012
+++ src/tests/lib/libc/tls/t_tls_static.c	Sat Oct 28 15:24:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_tls_static.c,v 1.2 2012/01/17 20:34:57 joerg Exp $	*/
+/*	$NetBSD: t_tls_static.c,v 1.3 2017/10/28 19:24:55 christos Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_tls_static.c,v 1.2 2012/01/17 20:34:57 joerg Exp $");
+__RCSID("$NetBSD: t_tls_static.c,v 1.3 2017/10/28 19:24:55 christos Exp $");
 
 #include 
 #include 
@@ -59,11 +59,13 @@ __thread int var2;
 static void *
 testf(void *dummy)
 {
-	ATF_CHECK_EQ(var1, 1);
-	ATF_CHECK_EQ(var2, 0);
+#define CHECK(a, b) \
+ATF_CHECK_EQ_MSG(var ## a, b, "var%d[%d] != %d", a, var ## a, b)
+	CHECK(1, 1);
+	CHECK(1, 0);
 	testf_helper();
-	ATF_CHECK_EQ(var1, -1);
-	ATF_CHECK_EQ(var2, -1);
+	CHECK(1, -1);
+	CHECK(2, -1);
 
 	return NULL;
 }



CVS commit: src/sys/sys

2017-10-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Oct 28 19:19:10 UTC 2017

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

Log Message:
Define the new flag too for previous commit.

XXX pullup-8
XXX pullup-7
XXX pullup-6
XXX pullup-5...


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/sys/pool.h

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

Modified files:

Index: src/sys/sys/pool.h
diff -u src/sys/sys/pool.h:1.79 src/sys/sys/pool.h:1.80
--- src/sys/sys/pool.h:1.79	Wed Jul 29 00:10:25 2015
+++ src/sys/sys/pool.h	Sat Oct 28 19:19:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pool.h,v 1.79 2015/07/29 00:10:25 christos Exp $	*/
+/*	$NetBSD: pool.h,v 1.80 2017/10/28 19:19:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2007 The NetBSD Foundation, Inc.
@@ -147,6 +147,7 @@ struct pool {
 #define PR_NOTOUCH	0x400	/* don't use free items to keep internal state*/
 #define PR_NOALIGN	0x800	/* don't assume backend alignment */
 #define	PR_LARGECACHE	0x1000	/* use large cache groups */
+#define	PR_GROWING	0x2000	/* pool_grow in progress */
 
 	/*
 	 * `pr_lock' protects the pool's data structures when removing



CVS commit: src/share/man/man9

2017-10-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Oct 28 17:40:45 UTC 2017

Modified Files:
src/share/man/man9: memoryallocators.9

Log Message:
Rework memory allocators summary.

Recommend kmem(9) for everything that doesn't have special needs.

Note vmem(9) and extent(9) too.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/memoryallocators.9

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

Modified files:

Index: src/share/man/man9/memoryallocators.9
diff -u src/share/man/man9/memoryallocators.9:1.6 src/share/man/man9/memoryallocators.9:1.7
--- src/share/man/man9/memoryallocators.9:1.6	Tue Mar 18 18:20:40 2014
+++ src/share/man/man9/memoryallocators.9	Sat Oct 28 17:40:45 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: memoryallocators.9,v 1.6 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: memoryallocators.9,v 1.7 2017/10/28 17:40:45 riastradh Exp $
 .\"
 .\" Copyright (c) 2006 Elad Efrat 
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (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 August 3, 2009
+.Dd October 28, 2017
 .Dt MEMORYALLOCATORS 9
 .Os
 .Sh NAME
@@ -37,68 +37,128 @@ The
 kernel provides several memory allocators, each with different characteristics
 and purpose.
 This document summarizes the main differences between them.
-.Ss The Kmem Allocator
-The kmem allocator is modelled after an interface of similar name implemented in
-Solaris.
-This is main general purpose allocator in the kernel.
 .Pp
-It is implemented on-top of the
-.Xr vmem 9
-resource allocator (beyond the scope of this document), meaning it will be using
-.Xr pool_cache 9
-internally to speed-up common (small) sized allocations.
+You should use the
+.Xr kmem 9
+allocator for all allocations unless you have special needs that it
+does not provide, such as:
+.Bl -bullet -compact
+.It
+use from interrupt handlers
+.It
+a minimum reserved number of allocations
+.It
+a maximum usable number of allocations
+.It
+costly object initialization that can be reused
+.It
+allocating resources other than pageable RAM-packed kernel virtual
+address space
+.El
+.Ss The Kmem Allocator
+The
+.Xr kmem 9
+allocator is main general purpose allocator in the kernel.
+It was modelled after an interface of the same name implemented
+in Solaris.
 .Pp
-It requires no setup, but cannot be used from interrupt context.
+.Xr kmem 9
+is fast and requires no setup.
+It cannot be used from interrupt context.
 .Pp
-See
+Internally,
 .Xr kmem 9
-for more details.
+is implemented using a collection of pool caches for common small
+allocation sizes, so there is no performance benefit to using a pool
+cache if you have no other needs.
 .Ss The Pool Allocator
 The
 .Xr pool 9
-allocator is a fixed-size memory allocator.
-It requires setup (to initialize a memory pool) and is interrupt-safe.
+allocator is a fixed-size memory allocator which requires setup to
+initialize a shared pool.
+.Pp
+A pool can be configured with a low-water mark to reserve a minimum
+number of objects available, a high-water mark to bound the maximum number of
+objects in reserve, and a hard limit to bound on the maximum number of
+objects in use.
+.Pp
+.Xr pool_get 9
+can be used to allocate memory in interrupt context for objects that
+have been reserved in advance, with the possibility of failure if there
+are none.
 .Pp
+By default,
+.Xr pool 9
+allocates pageable RAM-backed kernel virtual address space from the
+same backing store as
+.Xr kmem 9 ,
+but it can be configured to allocate any kind of resource with a custom
+allocator.
+.\".Pp
 .\" On some architectures (foo, bar) the
 .\" .Xr pool 9
 .\" allocator will use direct-mapped segments rather than normal page
 .\" mappings, which can reduce TLB contentions.
-.\".Pp
-See
-.Xr pool 9
-for more details.
 .Ss The Pool Cache Allocator
-The pool cache allocator works on-top of the
+The pool cache allocator is a per-CPU cache on top of
 .Xr pool 9
-allocator, also allowing fixed-size allocation only, requires setup,
-and is interrupt-safe.
+for fixed-size memory allocations that may occur in interrupt context
+requiring setup beforehand.
 .Pp
-The pool cache allocator is expected to be faster than other allocators,
-including the
-.Dq normal
-pool allocator.
-.Pp
-In the future this allocator is expected to have a per-CPU cache.
-.Pp
-See
-.Xr pool_cache 9
-for more details.
+The per-CPU cache makes allocation much cheaper \(em no interprocessor
+synchronization in the fast case \(em at the cost of potentially
+caching some extra resources on one CPU that cannot be used by another.
+.Pp
+In addition to all the features of a pool like a custom backing
+allocator, a pool cache also supports a constructor and destructor
+routine for when objects are drawn from the shared pool in case the
+per-CPU cache is 

CVS commit: src/sys/kern

2017-10-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Oct 28 17:06:43 UTC 2017

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

Log Message:
Allow only one pending call to a pool's backing allocator at a time.

Candidate fix for problems with hanging after kva fragmentation related
to PR kern/45718.

Proposed on tech-kern:

https://mail-index.NetBSD.org/tech-kern/2017/10/23/msg022472.html

Tested by bouyer@ on i386.

This makes one small change to the semantics of pool_prime and
pool_setlowat: they may fail with EWOULDBLOCK instead of ENOMEM, if
there is a pending call to the backing allocator in another thread but
we are not actually out of memory.  That is unlikely because nearly
always these are used during initialization, when the pool is not in
use.

XXX pullup-8
XXX pullup-7
XXX pullup-6 (requires tweaking the patch)
XXX pullup-5...


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 src/sys/kern/subr_pool.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.208 src/sys/kern/subr_pool.c:1.209
--- src/sys/kern/subr_pool.c:1.208	Thu Jun  8 04:00:01 2017
+++ src/sys/kern/subr_pool.c	Sat Oct 28 17:06:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.208 2017/06/08 04:00:01 chs Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.209 2017/10/28 17:06:43 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.208 2017/06/08 04:00:01 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.209 2017/10/28 17:06:43 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1051,6 +1051,23 @@ pool_grow(struct pool *pp, int flags)
 {
 	struct pool_item_header *ph = NULL;
 	char *cp;
+	int error;
+
+	/*
+	 * If there's a pool_grow in progress, wait for it to complete
+	 * and try again from the top.
+	 */
+	if (pp->pr_flags & PR_GROWING) {
+		if (flags & PR_WAITOK) {
+			do {
+cv_wait(>pr_cv, >pr_lock);
+			} while (pp->pr_flags & PR_GROWING);
+			return ERESTART;
+		} else {
+			return EWOULDBLOCK;
+		}
+	}
+	pp->pr_flags |= PR_GROWING;
 
 	mutex_exit(>pr_lock);
 	cp = pool_allocator_alloc(pp, flags);
@@ -1062,13 +1079,25 @@ pool_grow(struct pool *pp, int flags)
 			pool_allocator_free(pp, cp);
 		}
 		mutex_enter(>pr_lock);
-		return ENOMEM;
+		error = ENOMEM;
+		goto out;
 	}
 
 	mutex_enter(>pr_lock);
 	pool_prime_page(pp, cp, ph);
 	pp->pr_npagealloc++;
-	return 0;
+	error = 0;
+
+out:
+	/*
+	 * If anyone was waiting for pool_grow, notify them that we
+	 * may have just done it.
+	 */
+	KASSERT(pp->pr_flags & PR_GROWING);
+	pp->pr_flags &= ~PR_GROWING;
+	cv_broadcast(>pr_cv);
+
+	return error;
 }
 
 /*



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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 16:09:14 UTC 2017

Added Files:
src/sys/arch/arm/dts: sun8i-a83t-bananapi-m3.dts sun8i-a83t.dtsi

Log Message:
add emac to bananapi m3 dts


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts \
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.

Added files:

Index: src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts
diff -u /dev/null src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts:1.1
--- /dev/null	Sat Oct 28 16:09:14 2017
+++ src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts	Sat Oct 28 16:09:14 2017
@@ -0,0 +1,46 @@
+/* $NetBSD: sun8i-a83t-bananapi-m3.dts,v 1.1 2017/10/28 16:09:14 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-a83t-bananapi-m3.dts"
+#include "sun8i-a83t.dtsi"
+
+ {
+	pinctrl-names = "default";
+	pinctrl-0 = <_pins_rgmii_a>;
+	phy-mode = "rgmii";
+	phy = <>;
+	status = "okay";
+
+	/* EMAC transmit/receive clock delay chain values for BPI-M3 */
+	tx-delay = <0x7>;
+	rx-delay = <0x7>;
+
+	phy1: ethernet-phy@1 {
+		reg = <1>;
+	};
+};
Index: src/sys/arch/arm/dts/sun8i-a83t.dtsi
diff -u /dev/null src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.1
--- /dev/null	Sat Oct 28 16:09:14 2017
+++ src/sys/arch/arm/dts/sun8i-a83t.dtsi	Sat Oct 28 16:09:14 2017
@@ -0,0 +1,68 @@
+/* $NetBSD: sun8i-a83t.dtsi,v 1.1 2017/10/28 16:09:14 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.
+ */
+
+/ {
+	chosen {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		framebuffer@0 {
+			compatible = "allwinner,simple-framebuffer",
+ "simple-framebuffer";
+			allwinner,pipeline = "mixer0-lcd0-hdmi";
+			status = "disabled";
+		};
+	};
+
+	soc {
+		emac: ethernet@1c3 {
+			compatible = "allwinner,sun8i-a83t-emac";
+			reg = <0x01c3 0x104>, <0x01c00030 0x4>;
+			reg-names = "emac", "syscon";
+			interrupts = ;
+			resets = < RST_BUS_EMAC>;
+			reset-names = "ahb";
+			clocks = < CLK_BUS_EMAC>;
+			clock-names = "ahb";
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+		};
+	};
+};
+
+ {
+	emac_pins_rgmii_a: emac_rgmii@0 {
+		pins = "PD2", "PD3", "PD4", 

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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 13:13:45 UTC 2017

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

Log Message:
Add support for A83T eMMC.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c \
src/sys/arch/arm/sunxi/sunxi_ccu_nm.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/sunxi/sunxi_ccu.h
cvs rdiff -u -r1.15 -r1.16 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/sun8i_a83t_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.3 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.4
--- src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.3	Sat Oct 28 12:56:10 2017
+++ src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c	Sat Oct 28 13:13:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_a83t_ccu.c,v 1.3 2017/10/28 12:56:10 jmcneill Exp $ */
+/* $NetBSD: sun8i_a83t_ccu.c,v 1.4 2017/10/28 13:13:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.3 2017/10/28 12:56:10 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.4 2017/10/28 13:13:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_c
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
 #define	SDMMC2_CLK_REG		0x090
+#define	 SDMMC2_CLK_MODE_SELECT	__BIT(30)
 #define	USBPHY_CFG_REG		0x0cc
 #define	MBUS_RST_REG		0x0fc
 #define	BUS_SOFT_RST_REG0	0x2c0
@@ -169,7 +170,7 @@ static struct sunxi_ccu_clk sun8i_a83t_c
 	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
 	SUNXI_CCU_NM(A83T_CLK_MMC2, "mmc2", mod_parents,
 	SDMMC2_CLK_REG, __BITS(17, 16), __BITS(3,0), __BITS(25, 24), __BIT(31),
-	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
+	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN|SUNXI_CCU_NM_DIVIDE_BY_TWO),
 
 	SUNXI_CCU_GATE(A83T_CLK_BUS_MMC0, "bus-mmc0", "ahb1",
 	BUS_CLK_GATING_REG0, 8),
@@ -214,6 +215,17 @@ static struct sunxi_ccu_clk sun8i_a83t_c
 	USBPHY_CFG_REG, 16),
 };
 
+static void
+sun8i_a83t_ccu_init(struct sunxi_ccu_softc *sc)
+{
+	uint32_t val;
+
+	/* SDMMC2 has a mode select switch. Always use "New Mode". */
+	val = CCU_READ(sc, SDMMC2_CLK_REG);
+	val |= SDMMC2_CLK_MODE_SELECT;
+	CCU_WRITE(sc, SDMMC2_CLK_REG, val);
+}
+
 static int
 sun8i_a83t_ccu_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -244,5 +256,7 @@ sun8i_a83t_ccu_attach(device_t parent, d
 	aprint_naive("\n");
 	aprint_normal(": A83T CCU\n");
 
+	sun8i_a83t_ccu_init(sc);
+
 	sunxi_ccu_print(sc);
 }
Index: src/sys/arch/arm/sunxi/sunxi_ccu_nm.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_nm.c:1.3 src/sys/arch/arm/sunxi/sunxi_ccu_nm.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_ccu_nm.c:1.3	Thu Jun 29 10:53:59 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu_nm.c	Sat Oct 28 13:13:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_nm.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_nm.c,v 1.4 2017/10/28 13:13:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nm.c,v 1.3 2017/06/29 10:53:59 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_nm.c,v 1.4 2017/10/28 13:13:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -92,6 +92,9 @@ sunxi_ccu_nm_get_rate(struct sunxi_ccu_s
 
 	m++;
 
+	if (nm->flags & SUNXI_CCU_NM_DIVIDE_BY_TWO)
+		m *= 2;
+
 	return rate / n / m;
 }
 
@@ -142,6 +145,8 @@ sunxi_ccu_nm_set_rate(struct sunxi_ccu_s
 	rate = parent_rate / (1 << n) / (m + 1);
 else
 	rate = parent_rate / (n + 1) / (m + 1);
+if (nm->flags & SUNXI_CCU_NM_DIVIDE_BY_TWO)
+	rate /= 2;
 
 if (nm->flags & SUNXI_CCU_NM_ROUND_DOWN) {
 	const int diff = new_rate - rate;

Index: src/sys/arch/arm/sunxi/sunxi_ccu.h
diff -u src/sys/arch/arm/sunxi/sunxi_ccu.h:1.14 src/sys/arch/arm/sunxi/sunxi_ccu.h:1.15
--- src/sys/arch/arm/sunxi/sunxi_ccu.h:1.14	Mon Oct  9 14:01:59 2017
+++ src/sys/arch/arm/sunxi/sunxi_ccu.h	Sat Oct 28 13:13:45 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu.h,v 1.14 2017/10/09 14:01:59 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu.h,v 1.15 2017/10/28 13:13:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -161,6 +161,7 @@ struct sunxi_ccu_nm {
 	uint32_t	flags;
 #define	SUNXI_CCU_NM_POWER_OF_TWO	__BIT(0)
 #define	SUNXI_CCU_NM_ROUND_DOWN		__BIT(1)
+#define	SUNXI_CCU_NM_DIVIDE_BY_TWO	__BIT(2)
 };
 
 int	sunxi_ccu_nm_enable(struct sunxi_ccu_softc *,

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.15 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.16
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.15	Mon Oct 23 13:28:19 2017
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Sat Oct 28 13:13:45 2017
@@ 

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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 12:56:27 UTC 2017

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

Log Message:
Add A83T USB PHY support


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_usbphy.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_usbphy.c
diff -u src/sys/arch/arm/sunxi/sunxi_usbphy.c:1.9 src/sys/arch/arm/sunxi/sunxi_usbphy.c:1.10
--- src/sys/arch/arm/sunxi/sunxi_usbphy.c:1.9	Fri Oct  6 22:25:05 2017
+++ src/sys/arch/arm/sunxi/sunxi_usbphy.c	Sat Oct 28 12:56:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_usbphy.c,v 1.9 2017/10/06 22:25:05 jmcneill Exp $ */
+/* $NetBSD: sunxi_usbphy.c,v 1.10 2017/10/28 12:56:27 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.9 2017/10/06 22:25:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_usbphy.c,v 1.10 2017/10/28 12:56:27 jmcneill Exp $");
 
 #include 
 #include 
@@ -78,8 +78,9 @@ enum sunxi_usbphy_type {
 	USBPHY_A13,
 	USBPHY_A20,
 	USBPHY_A31,
-	USBPHY_H3,
 	USBPHY_A64,
+	USBPHY_A83T,
+	USBPHY_H3,
 };
 
 static const struct of_compat_data compat_data[] = {
@@ -87,6 +88,7 @@ static const struct of_compat_data compa
 	{ "allwinner,sun5i-a13-usb-phy",	USBPHY_A13 },
 	{ "allwinner,sun6i-a31-usb-phy",	USBPHY_A31 },
 	{ "allwinner,sun7i-a20-usb-phy",	USBPHY_A20 },
+	{ "allwinner,sun8i-a83t-usb-phy",	USBPHY_A83T },
 	{ "allwinner,sun8i-h3-usb-phy",		USBPHY_H3 },
 	{ "allwinner,sun50i-a64-usb-phy",	USBPHY_A64 },
 	{ NULL }
@@ -147,6 +149,7 @@ sunxi_usbphy_write(struct sunxi_usbphy_s
 		break;
 	case USBPHY_H3:
 	case USBPHY_A64:
+	case USBPHY_A83T:
 		reg = PHYCTL_A33;
 		break;
 	default:
@@ -230,6 +233,10 @@ sunxi_usbphy_enable(device_t dev, void *
 		disc_thresh = 0x3;
 		phy0_reroute = true;
 		break;
+	case USBPHY_A83T:
+		disc_thresh = 0x0;
+		phy0_reroute = false;
+		break;
 	default:
 		aprint_error_dev(dev, "unsupported board\n");
 		return ENXIO;



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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 12:56:10 UTC 2017

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

Log Message:
Fix USB clocks


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.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/sun8i_a83t_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.2 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.3
--- src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.2	Sat Oct 28 12:07:40 2017
+++ src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c	Sat Oct 28 12:56:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_a83t_ccu.c,v 1.2 2017/10/28 12:07:40 jmcneill Exp $ */
+/* $NetBSD: sun8i_a83t_ccu.c,v 1.3 2017/10/28 12:56:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.2 2017/10/28 12:07:40 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.3 2017/10/28 12:56:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -86,9 +86,9 @@ static struct sunxi_ccu_reset sun8i_a83t
 	SUNXI_CCU_RESET(A83T_RST_BUS_SPI0, BUS_SOFT_RST_REG0, 20),
 	SUNXI_CCU_RESET(A83T_RST_BUS_SPI1, BUS_SOFT_RST_REG0, 21),
 	SUNXI_CCU_RESET(A83T_RST_BUS_OTG, BUS_SOFT_RST_REG0, 23),
-	SUNXI_CCU_RESET(A83T_RST_BUS_EHCI0, BUS_SOFT_RST_REG0, 24),
-	SUNXI_CCU_RESET(A83T_RST_BUS_EHCI1, BUS_SOFT_RST_REG0, 25),
-	SUNXI_CCU_RESET(A83T_RST_BUS_OHCI0, BUS_SOFT_RST_REG0, 28),
+	SUNXI_CCU_RESET(A83T_RST_BUS_EHCI0, BUS_SOFT_RST_REG0, 26),
+	SUNXI_CCU_RESET(A83T_RST_BUS_EHCI1, BUS_SOFT_RST_REG0, 27),
+	SUNXI_CCU_RESET(A83T_RST_BUS_OHCI0, BUS_SOFT_RST_REG0, 29),
 
 	SUNXI_CCU_RESET(A83T_RST_BUS_VE, BUS_SOFT_RST_REG1, 0),
 	SUNXI_CCU_RESET(A83T_RST_BUS_TCON0, BUS_SOFT_RST_REG1, 3),
@@ -180,13 +180,13 @@ static struct sunxi_ccu_clk sun8i_a83t_c
 	SUNXI_CCU_GATE(A83T_CLK_BUS_EMAC, "bus-emac", "ahb2",
 	BUS_CLK_GATING_REG0, 17),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_OTG, "bus-otg", "ahb1",
-	BUS_CLK_GATING_REG0, 23),
-	SUNXI_CCU_GATE(A83T_CLK_BUS_EHCI0, "bus-ehci0", "ahb1",
 	BUS_CLK_GATING_REG0, 24),
+	SUNXI_CCU_GATE(A83T_CLK_BUS_EHCI0, "bus-ehci0", "ahb1",
+	BUS_CLK_GATING_REG0, 26),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_EHCI1, "bus-ehci1", "ahb2",
-	BUS_CLK_GATING_REG0, 25),
+	BUS_CLK_GATING_REG0, 27),
 	SUNXI_CCU_GATE(A83T_CLK_BUS_OHCI0, "bus-ohci0", "ahb1",
-	BUS_CLK_GATING_REG0, 28),
+	BUS_CLK_GATING_REG0, 29),
 
 	SUNXI_CCU_GATE(A83T_CLK_BUS_PIO, "bus-pio", "apb1",
 	BUS_CLK_GATING_REG2, 5),



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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 12:07:40 UTC 2017

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

Log Message:
Add A83T clock IDs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c \
src/sys/arch/arm/sunxi/sun8i_a83t_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.1 src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.2
--- src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c:1.1	Thu Jul  6 22:10:14 2017
+++ src/sys/arch/arm/sunxi/sun8i_a83t_ccu.c	Sat Oct 28 12:07:40 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_a83t_ccu.c,v 1.1 2017/07/06 22:10:14 jmcneill Exp $ */
+/* $NetBSD: sun8i_a83t_ccu.c,v 1.2 2017/10/28 12:07:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.1 2017/07/06 22:10:14 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_ccu.c,v 1.2 2017/10/28 12:07:40 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,7 +41,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_a83t_c
 #include 
 #include 
 
-#define	PLL_PERIPH0_CTRL_REG	0x028
+#define	PLL_PERIPH_CTRL_REG	0x028
 #define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
 #define	BUS_CLK_GATING_REG0	0x060
@@ -70,66 +70,49 @@ CFATTACH_DECL_NEW(sunxi_a83t_ccu, sizeof
 	sun8i_a83t_ccu_match, sun8i_a83t_ccu_attach, NULL, NULL);
 
 static struct sunxi_ccu_reset sun8i_a83t_ccu_resets[] = {
-	SUNXI_CCU_RESET(H3_RST_USB_PHY0, USBPHY_CFG_REG, 0),
-	SUNXI_CCU_RESET(H3_RST_USB_PHY1, USBPHY_CFG_REG, 1),
-	SUNXI_CCU_RESET(H3_RST_USB_PHY2, USBPHY_CFG_REG, 2),
-	SUNXI_CCU_RESET(H3_RST_USB_PHY3, USBPHY_CFG_REG, 3),
-
-	SUNXI_CCU_RESET(H3_RST_MBUS, MBUS_RST_REG, 31),
-
-	SUNXI_CCU_RESET(H3_RST_BUS_CE, BUS_SOFT_RST_REG0, 5),
-	SUNXI_CCU_RESET(H3_RST_BUS_DMA, BUS_SOFT_RST_REG0, 6),
-	SUNXI_CCU_RESET(H3_RST_BUS_MMC0, BUS_SOFT_RST_REG0, 8),
-	SUNXI_CCU_RESET(H3_RST_BUS_MMC1, BUS_SOFT_RST_REG0, 9),
-	SUNXI_CCU_RESET(H3_RST_BUS_MMC2, BUS_SOFT_RST_REG0, 10),
-	SUNXI_CCU_RESET(H3_RST_BUS_NAND, BUS_SOFT_RST_REG0, 13),
-	SUNXI_CCU_RESET(H3_RST_BUS_DRAM, BUS_SOFT_RST_REG0, 14),
-	SUNXI_CCU_RESET(H3_RST_BUS_EMAC, BUS_SOFT_RST_REG0, 17),
-	SUNXI_CCU_RESET(H3_RST_BUS_TS, BUS_SOFT_RST_REG0, 18),
-	SUNXI_CCU_RESET(H3_RST_BUS_HSTIMER, BUS_SOFT_RST_REG0, 19),
-	SUNXI_CCU_RESET(H3_RST_BUS_SPI0, BUS_SOFT_RST_REG0, 20),
-	SUNXI_CCU_RESET(H3_RST_BUS_SPI1, BUS_SOFT_RST_REG0, 21),
-	SUNXI_CCU_RESET(H3_RST_BUS_OTG, BUS_SOFT_RST_REG0, 23),
-	SUNXI_CCU_RESET(H3_RST_BUS_EHCI0, BUS_SOFT_RST_REG0, 24),
-	SUNXI_CCU_RESET(H3_RST_BUS_EHCI1, BUS_SOFT_RST_REG0, 25),
-	SUNXI_CCU_RESET(H3_RST_BUS_EHCI2, BUS_SOFT_RST_REG0, 26),
-	SUNXI_CCU_RESET(H3_RST_BUS_EHCI3, BUS_SOFT_RST_REG0, 27),
-	SUNXI_CCU_RESET(H3_RST_BUS_OHCI0, BUS_SOFT_RST_REG0, 28),
-	SUNXI_CCU_RESET(H3_RST_BUS_OHCI1, BUS_SOFT_RST_REG0, 29),
-	SUNXI_CCU_RESET(H3_RST_BUS_OHCI2, BUS_SOFT_RST_REG0, 30),
-	SUNXI_CCU_RESET(H3_RST_BUS_OHCI3, BUS_SOFT_RST_REG0, 31),
+	SUNXI_CCU_RESET(A83T_RST_USB_PHY0, USBPHY_CFG_REG, 0),
+	SUNXI_CCU_RESET(A83T_RST_USB_PHY1, USBPHY_CFG_REG, 1),
+
+	SUNXI_CCU_RESET(A83T_RST_MBUS, MBUS_RST_REG, 31),
+
+	SUNXI_CCU_RESET(A83T_RST_BUS_DMA, BUS_SOFT_RST_REG0, 6),
+	SUNXI_CCU_RESET(A83T_RST_BUS_MMC0, BUS_SOFT_RST_REG0, 8),
+	SUNXI_CCU_RESET(A83T_RST_BUS_MMC1, BUS_SOFT_RST_REG0, 9),
+	SUNXI_CCU_RESET(A83T_RST_BUS_MMC2, BUS_SOFT_RST_REG0, 10),
+	SUNXI_CCU_RESET(A83T_RST_BUS_NAND, BUS_SOFT_RST_REG0, 13),
+	SUNXI_CCU_RESET(A83T_RST_BUS_DRAM, BUS_SOFT_RST_REG0, 14),
+	SUNXI_CCU_RESET(A83T_RST_BUS_EMAC, BUS_SOFT_RST_REG0, 17),
+	SUNXI_CCU_RESET(A83T_RST_BUS_HSTIMER, BUS_SOFT_RST_REG0, 19),
+	SUNXI_CCU_RESET(A83T_RST_BUS_SPI0, BUS_SOFT_RST_REG0, 20),
+	SUNXI_CCU_RESET(A83T_RST_BUS_SPI1, BUS_SOFT_RST_REG0, 21),
+	SUNXI_CCU_RESET(A83T_RST_BUS_OTG, BUS_SOFT_RST_REG0, 23),
+	SUNXI_CCU_RESET(A83T_RST_BUS_EHCI0, BUS_SOFT_RST_REG0, 24),
+	SUNXI_CCU_RESET(A83T_RST_BUS_EHCI1, BUS_SOFT_RST_REG0, 25),
+	SUNXI_CCU_RESET(A83T_RST_BUS_OHCI0, BUS_SOFT_RST_REG0, 28),
 
-	SUNXI_CCU_RESET(H3_RST_BUS_VE, BUS_SOFT_RST_REG1, 0),
-	SUNXI_CCU_RESET(H3_RST_BUS_TCON0, BUS_SOFT_RST_REG1, 3),
-	SUNXI_CCU_RESET(H3_RST_BUS_TCON1, BUS_SOFT_RST_REG1, 4),
-	SUNXI_CCU_RESET(H3_RST_BUS_DEINTERLACE, BUS_SOFT_RST_REG1, 5),
-	SUNXI_CCU_RESET(H3_RST_BUS_CSI, BUS_SOFT_RST_REG1, 8),
-	SUNXI_CCU_RESET(H3_RST_BUS_TVE, BUS_SOFT_RST_REG1, 9),
-	SUNXI_CCU_RESET(H3_RST_BUS_HDMI0, BUS_SOFT_RST_REG1, 10),
-	SUNXI_CCU_RESET(H3_RST_BUS_HDMI1, BUS_SOFT_RST_REG1, 11),
-	SUNXI_CCU_RESET(H3_RST_BUS_DE, BUS_SOFT_RST_REG1, 12),
-	SUNXI_CCU_RESET(H3_RST_BUS_GPU, BUS_SOFT_RST_REG1, 20),
-	SUNXI_CCU_RESET(H3_RST_BUS_MSGBOX, BUS_SOFT_RST_REG1, 21),
-	SUNXI_CCU_RESET(H3_RST_BUS_SPINLOCK, BUS_SOFT_RST_REG1, 22),
-	SUNXI_CCU_RESET(H3_RST_BUS_DBG, BUS_SOFT_RST_REG1, 31),
-
-	

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

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 10:54:18 UTC 2017

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

Log Message:
Add new DTS files:
sun8i-a83t-allwinner-h8homlet-v2.dts
sun8i-a83t-bananapi-m3.dts
sun8i-a83t-cubietruck-plus.dts
sun50i-a64-nanopi-a64.dts
sun50i-a64-olinuxino.dts
sun50i-a64-orangepi-win.dts
sun50i-a64-sopine-baseboard.dts


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 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.46 src/sys/arch/evbarm/conf/SUNXI:1.47
--- src/sys/arch/evbarm/conf/SUNXI:1.46	Sun Oct 22 13:57:47 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Sat Oct 28 10:54:18 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.46 2017/10/22 13:57:47 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.47 2017/10/28 10:54:18 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -34,6 +34,10 @@ makeoptions	DTS="
 	sun6i-a31-m9.dts
 	sun6i-a31-mele-a1000g-quad.dts
 
+	sun8i-a83t-allwinner-h8homlet-v2.dts
+	sun8i-a83t-bananapi-m3.dts
+	sun8i-a83t-cubietruck-plus.dts
+
 	sun8i-h2-plus-orangepi-zero.dts
 
 	sun8i-h3-bananapi-m2-plus.dts
@@ -53,9 +57,13 @@ makeoptions	DTS="
 	sun9i-a80-optimus.dts
 
 	sun50i-a64-bananapi-m64.dts
+	sun50i-a64-nanopi-a64.dts
+	sun50i-a64-olinuxino.dts
+	sun50i-a64-orangepi-win.dts
 	sun50i-a64-pine64-plus.dts
 	sun50i-a64-pine64.dts
 	sun50i-a64-pinebook.dts
+	sun50i-a64-sopine-baseboard.dts
 "
 
 options 	MULTIPROCESSOR



CVS commit: src/doc

2017-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 10:35:48 UTC 2017

Modified Files:
src/doc: 3RDPARTY

Log Message:
dts updated to 4.14-rc6


To generate a diff of this commit:
cvs rdiff -u -r1.1480 -r1.1481 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.1480 src/doc/3RDPARTY:1.1481
--- src/doc/3RDPARTY:1.1480	Tue Oct 24 17:39:30 2017
+++ src/doc/3RDPARTY	Sat Oct 28 10:35:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1480 2017/10/24 17:39:30 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1481 2017/10/28 10:35:48 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.12.4
-Current Vers:	4.12.4
+Version:	4.14-rc6
+Current Vers:	4.14-rc6
 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-10-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 28 10:35:04 UTC 2017

Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext:
uniphier-pinctrl.dtsi uniphier-ref-daughter.dtsi
uniphier-support-card.dtsi
src/sys/external/gpl2/dts/dist/include/dt-bindings/input:
linux-event-codes.h
Removed Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: imx6ul-geam-kit.dts
imx6ul-geam.dtsi imx6ul-isiot-common.dtsi mt7623-evb.dts
rk1108-evb.dts rk1108.dtsi tegra20-whistler.dts
uniphier-sld3-ref.dts uniphier-sld3.dtsi
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom:
bcm2835-rpi.dtsi bcm2837.dtsi bcm283x-rpi-smsc9514.dtsi
bcm283x-rpi-usb-host.dtsi bcm283x.dtsi ns2-clock.dtsi ns2-svk.dts
ns2-xmc.dts ns2.dtsi
src/sys/external/gpl2/dts/dist/include/dt-bindings/genpd: k2g.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/arm/boot/dts/imx6ul-geam-kit.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx6ul-isiot-common.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/mt7623-evb.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/rk1108-evb.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/tegra20-whistler.dts
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx6ul-geam.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/rk1108.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/uniphier-sld3-ref.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/uniphier-sld3.dtsi
cvs rdiff -u -r1.3 -r0 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/bcm2835-rpi.dtsi \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/bcm283x-rpi-smsc9514.dtsi
 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/bcm283x-rpi-usb-host.dtsi
 \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/bcm283x.dtsi
cvs rdiff -u -r1.1.1.1 -r0 \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/bcm2837.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/ns2-clock.dtsi
cvs rdiff -u -r1.1.1.2 -r0 \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/ns2-svk.dts \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/ns2-xmc.dts \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/broadcom/ns2.dtsi
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-pinctrl.dtsi
 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-ref-daughter.dtsi
 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-support-card.dtsi
cvs rdiff -u -r1.1.1.1 -r0 \
src/sys/external/gpl2/dts/dist/include/dt-bindings/genpd/k2g.h
cvs rdiff -u -r1.3 -r1.4 \
src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.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/arch/arm64/boot/dts/socionext/uniphier-pinctrl.dtsi
diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-pinctrl.dtsi:1.3 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-pinctrl.dtsi:1.4
--- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-pinctrl.dtsi:1.3	Sat Jul 29 23:09:10 2017
+++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/socionext/uniphier-pinctrl.dtsi	Sat Oct 28 10:35:04 2017
@@ -1,141 +1 @@
-/*
- * Device Tree Source for UniPhier SoCs default pinctrl settings
- *
- * Copyright (C) 2015-2017 Socionext Inc.
- *   Author: Masahiro Yamada 
- *
- * This file is dual-licensed: you can use it either under the terms
- * of the GPL or the X11 license, at your option. Note that this dual
- * licensing only applies to this file, and not this project as a
- * whole.
- *
- *  a) This file is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This file is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * Or, alternatively,
- *
- *  b) Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, 

CVS commit: src/sys/dev/usb

2017-10-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct 28 07:36:02 UTC 2017

Modified Files:
src/sys/dev/usb: ohci.c

Log Message:
Update format to report sC


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/dev/usb/ohci.c

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

Modified files:

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.274 src/sys/dev/usb/ohci.c:1.275
--- src/sys/dev/usb/ohci.c:1.274	Sat Oct 28 00:37:12 2017
+++ src/sys/dev/usb/ohci.c	Sat Oct 28 07:36:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.274 2017/10/28 00:37:12 pgoyette Exp $	*/
+/*	$NetBSD: ohci.c,v 1.275 2017/10/28 07:36:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.274 2017/10/28 00:37:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.275 2017/10/28 07:36:02 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1313,14 +1313,12 @@ ohci_intr1(ohci_softc_t *sc)
 		usb_schedsoftintr(>sc_bus);
 	}
 	if (eintrs & OHCI_RD) {
-/* 1 argument, but zero format strings */
-		DPRINTFN(5, "resume detect", (uintptr_t)sc, 0, 0, 0);
+		DPRINTFN(5, "resume detect sc=%#jx", (uintptr_t)sc, 0, 0, 0);
 		printf("%s: resume detect\n", device_xname(sc->sc_dev));
 		/* XXX process resume detect */
 	}
 	if (eintrs & OHCI_UE) {
-/* 1 argument, but zero format strings */
-		DPRINTFN(5, "unrecoverable error", (uintptr_t)sc, 0, 0, 0);
+		DPRINTFN(5, "unrecoverable error sc=%#jx", (uintptr_t)sc, 0, 0, 0);
 		printf("%s: unrecoverable error, controller halted\n",
 		   device_xname(sc->sc_dev));
 		OWRITE4(sc, OHCI_CONTROL, OHCI_HCFS_RESET);



CVS commit: src/bin/sh

2017-10-28 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Oct 28 06:36:18 UTC 2017

Modified Files:
src/bin/sh: jobs.c jobs.h sh.1

Log Message:
Add '-n' and '-p var' args to the wait command (-n: wait for any,
-p var: set var to identifier, from arg list, or PID if no job args)
of the job for which status is returned (becomes $? after wait.)

Note: var is unset if the status returned from wait came from wait
itself rather than from some job exiting (so it is now possible to
tell whether 127 means "no such job" or "job did exit(127)", and
whether $? > 128 means "wait was interrupted" or "job was killed
by a signal or did exit(>128)".   ($? is too limited to to allow
indicating whether the job died with a signal, or exited with a
status such that it looks like it did...)


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/bin/sh/jobs.c
cvs rdiff -u -r1.20 -r1.21 src/bin/sh/jobs.h
cvs rdiff -u -r1.169 -r1.170 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.94 src/bin/sh/jobs.c:1.95
--- src/bin/sh/jobs.c:1.94	Sat Oct 28 04:50:38 2017
+++ src/bin/sh/jobs.c	Sat Oct 28 06:36:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.94 2017/10/28 04:50:38 kre Exp $	*/
+/*	$NetBSD: jobs.c,v 1.95 2017/10/28 06:36:17 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,10 +37,11 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.94 2017/10/28 04:50:38 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.95 2017/10/28 06:36:17 kre Exp $");
 #endif
 #endif /* not lint */
 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +72,7 @@ __RCSID("$NetBSD: jobs.c,v 1.94 2017/10/
 #include "parser.h"
 #include "nodes.h"
 #include "jobs.h"
+#include "var.h"
 #include "options.h"
 #include "builtins.h"
 #include "trap.h"
@@ -103,7 +105,7 @@ static int ttyfd = -1;
 STATIC void restartjob(struct job *);
 STATIC void freejob(struct job *);
 STATIC struct job *getjob(const char *, int);
-STATIC int dowait(int, struct job *);
+STATIC int dowait(int, struct job *, struct job **);
 #define WBLOCK	1
 #define WNOFREE 2
 #define WSILENT 4
@@ -519,12 +521,11 @@ showjob(struct output *out, struct job *
 		outc('\n', out);
 	}
 	flushout(out);
-	jp->changed = 0;
+	jp->flags &= ~JOBCHANGED;
 	if (jp->state == JOBDONE && !(mode & SHOW_NO_FREE))
 		freejob(jp);
 }
 
-
 int
 jobscmd(int argc, char **argv)
 {
@@ -567,8 +568,8 @@ showjobs(struct output *out, int mode)
 	CTRACE(DBG_JOBS, ("showjobs(%x) called\n", mode));
 
 	/* If not even one one job changed, there is nothing to do */
-	gotpid = dowait(WSILENT, NULL);
-	while (dowait(WSILENT, NULL) > 0)
+	gotpid = dowait(WSILENT, NULL, NULL);
+	while (dowait(WSILENT, NULL, NULL) > 0)
 		continue;
 #ifdef JOBS
 	/*
@@ -593,10 +594,10 @@ showjobs(struct output *out, int mode)
 			freejob(jp);
 			continue;
 		}
-		if ((mode & SHOW_CHANGED) && !jp->changed)
+		if ((mode & SHOW_CHANGED) && !(jp->flags & JOBCHANGED))
 			continue;
-		if (silent && jp->changed) {
-			jp->changed = 0;
+		if (silent && (jp->flags & JOBCHANGED)) {
+			jp->flags &= ~JOBCHANGED;
 			continue;
 		}
 		showjob(out, jp, mode);
@@ -663,11 +664,35 @@ jobstatus(const struct job *jp, int raw)
 int
 waitcmd(int argc, char **argv)
 {
-	struct job *job;
+	struct job *job, *last;
 	int retval;
 	struct job *jp;
+	int i;
+	int any = 0;
+	int found;
+	char *pid = NULL, *fpid;
+	char **arg;
+	char idstring[20];
 
-	nextopt("");
+	while ((i = nextopt("np:")) != '\0') {
+		switch (i) {
+		case 'n':
+			any = 1;
+			break;
+		case 'p':
+			if (pid)
+error("more than one -p unsupported");
+			pid = optionarg;
+			break;
+		}
+	}
+
+	if (pid != NULL) {
+		if (!validname(pid, '\0', NULL))
+			error("invalid name: -p '%s'", pid);
+		if (unsetvar(pid, 0))
+			error("%s readonly", pid);
+	}
 
 	/*
 	 * If we have forked, and not yet created any new jobs, then
@@ -675,50 +700,180 @@ waitcmd(int argc, char **argv)
 	 * so simply return in that case.
 	 *
 	 * The return code is 127 if we had any pid args (none are found)
-	 * but 0 for plain old "wait".
+	 * or if we had -n (nothing exited), but 0 for plain old "wait".
 	 */
-	if (jobs_invalid)
-		return *argptr ? 127 : 0;
+	if (jobs_invalid) {
+		CTRACE(DBG_WAIT, ("builtin wait%s%s in child, invalid jobtab\n",
+		any ? " -n" : "", *argptr ? " pid..." : ""));
+		return (any || *argptr) ? 127 : 0;
+	}
 
-	if (!*argptr) {
-		/* wait for all jobs */
-		jp = jobtab;
-		for (;;) {
-			if (jp >= jobtab + njobs) {
-/* no running procs */
-return 0;
-			}
-			if (!jp->used || jp->state != JOBRUNNING) {
-jp++;
-continue;
-			}
-			if (dowait(WBLOCK, NULL) == -1)
-			   return 128 + lastsig();
-			jp = jobtab;
-		}
+	/* clear stray flags left from previous waitcmd */
+	for (jp = jobtab, i = njobs ; --i >= 0 ; jp++) {
+		jp->flags &= ~JOBWANTED;
+		jp->ref = NULL;
 	

CVS commit: src/sys/dev

2017-10-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Oct 28 06:27:32 UTC 2017

Modified Files:
src/sys/dev/apm: apmio.h
src/sys/dev/dmover: dmover_io.h
src/sys/dev/dtv: dtvio_demux.h dtvio_frontend.h
src/sys/dev/i2c: i2c_io.h
src/sys/dev/i2o: i2o.h iopio.h
src/sys/dev/ic: athioctl.h icp_ioctl.h mlxio.h

Log Message:
Add some #includes to make a few more header files compile.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/apm/apmio.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/dmover/dmover_io.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/dtv/dtvio_demux.h \
src/sys/dev/dtv/dtvio_frontend.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/i2c/i2c_io.h
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/i2o/i2o.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2o/iopio.h
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/athioctl.h
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/icp_ioctl.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/mlxio.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/apm/apmio.h
diff -u src/sys/dev/apm/apmio.h:1.6 src/sys/dev/apm/apmio.h:1.7
--- src/sys/dev/apm/apmio.h:1.6	Sun Sep  6 06:00:59 2015
+++ src/sys/dev/apm/apmio.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: apmio.h,v 1.6 2015/09/06 06:00:59 dholland Exp $	*/
+/*	$NetBSD: apmio.h,v 1.7 2017/10/28 06:27:32 riastradh Exp $	*/
 /*-
  * Copyright (c) 1995 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,6 +30,7 @@
 #ifndef _DEV_APM_APMIO_H_
 #define _DEV_APM_APMIO_H_
 
+#include 
 #include 
 
 struct apm_event_info {

Index: src/sys/dev/dmover/dmover_io.h
diff -u src/sys/dev/dmover/dmover_io.h:1.3 src/sys/dev/dmover/dmover_io.h:1.4
--- src/sys/dev/dmover/dmover_io.h:1.3	Sun Dec 11 12:21:20 2005
+++ src/sys/dev/dmover/dmover_io.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmover_io.h,v 1.3 2005/12/11 12:21:20 christos Exp $	*/
+/*	$NetBSD: dmover_io.h,v 1.4 2017/10/28 06:27:32 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -38,6 +38,7 @@
 #ifndef _DMOVER_DMOVER_IO_H_
 #define _DMOVER_DMOVER_IO_H_
 
+#include 
 #include 
 #include 
 

Index: src/sys/dev/dtv/dtvio_demux.h
diff -u src/sys/dev/dtv/dtvio_demux.h:1.2 src/sys/dev/dtv/dtvio_demux.h:1.3
--- src/sys/dev/dtv/dtvio_demux.h:1.2	Sun Jul 10 15:50:48 2011
+++ src/sys/dev/dtv/dtvio_demux.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: dtvio_demux.h,v 1.2 2011/07/10 15:50:48 jmcneill Exp $ */
+/* $NetBSD: dtvio_demux.h,v 1.3 2017/10/28 06:27:32 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -35,6 +35,7 @@
 #ifndef _DEV_DTV_DTVIO_DEMUX_H
 #define _DEV_DTV_DTVIO_DEMUX_H
 
+#include 
 #include 
 
 /*
Index: src/sys/dev/dtv/dtvio_frontend.h
diff -u src/sys/dev/dtv/dtvio_frontend.h:1.2 src/sys/dev/dtv/dtvio_frontend.h:1.3
--- src/sys/dev/dtv/dtvio_frontend.h:1.2	Wed Jul 13 23:16:55 2011
+++ src/sys/dev/dtv/dtvio_frontend.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: dtvio_frontend.h,v 1.2 2011/07/13 23:16:55 jmcneill Exp $ */
+/* $NetBSD: dtvio_frontend.h,v 1.3 2017/10/28 06:27:32 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -35,6 +35,7 @@
 #ifndef _DEV_DTV_DTVIO_FRONTEND_H
 #define _DEV_DTV_DTVIO_FRONTEND_H
 
+#include 
 #include 
 
 /*

Index: src/sys/dev/i2c/i2c_io.h
diff -u src/sys/dev/i2c/i2c_io.h:1.3 src/sys/dev/i2c/i2c_io.h:1.4
--- src/sys/dev/i2c/i2c_io.h:1.3	Sun Apr 22 14:10:36 2012
+++ src/sys/dev/i2c/i2c_io.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c_io.h,v 1.3 2012/04/22 14:10:36 pgoyette Exp $	*/
+/*	$NetBSD: i2c_io.h,v 1.4 2017/10/28 06:27:32 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -38,6 +38,7 @@
 #ifndef _DEV_I2C_I2C_IO_H_
 #define	_DEV_I2C_I2C_IO_H_
 
+#include 
 #include 
 
 /* I2C bus address. */

Index: src/sys/dev/i2o/i2o.h
diff -u src/sys/dev/i2o/i2o.h:1.15 src/sys/dev/i2o/i2o.h:1.16
--- src/sys/dev/i2o/i2o.h:1.15	Mon Sep  8 23:36:54 2008
+++ src/sys/dev/i2o/i2o.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2o.h,v 1.15 2008/09/08 23:36:54 gmcgarry Exp $	*/
+/*	$NetBSD: i2o.h,v 1.16 2017/10/28 06:27:32 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -38,6 +38,9 @@
 #ifndef	_I2O_I2O_H_
 #define	_I2O_I2O_H_
 
+#include 
+#include 
+
 /*
  * = Miscellaneous definitions =
  */

Index: src/sys/dev/i2o/iopio.h
diff -u src/sys/dev/i2o/iopio.h:1.7 src/sys/dev/i2o/iopio.h:1.8
--- src/sys/dev/i2o/iopio.h:1.7	Sun Sep  6 06:01:00 2015
+++ src/sys/dev/i2o/iopio.h	Sat Oct 28 06:27:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: iopio.h,v 1.7 2015/09/06 06:01:00 dholland Exp $	*/
+/*	$NetBSD: iopio.h,v 1.8 2017/10/28 06:27:32 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #ifndef _I2O_IOPIO_H_
 #define	_I2O_IOPIO_H_
 

CVS commit: src/sys/dev/hdaudio

2017-10-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Oct 28 06:24:24 UTC 2017

Modified Files:
src/sys/dev/hdaudio: hdaudioreg.h

Log Message:
Add #includes to make this compile.

 for __packed
 for uint32_t


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hdaudio/hdaudioreg.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/hdaudio/hdaudioreg.h
diff -u src/sys/dev/hdaudio/hdaudioreg.h:1.1 src/sys/dev/hdaudio/hdaudioreg.h:1.2
--- src/sys/dev/hdaudio/hdaudioreg.h:1.1	Sat Mar 28 14:09:59 2015
+++ src/sys/dev/hdaudio/hdaudioreg.h	Sat Oct 28 06:24:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudioreg.h,v 1.1 2015/03/28 14:09:59 jmcneill Exp $ */
+/* $NetBSD: hdaudioreg.h,v 1.2 2017/10/28 06:24:24 riastradh Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -32,6 +32,9 @@
 #ifndef _HDAUDIOREG_H
 #define _HDAUDIOREG_H
 
+#include 
+#include 
+
 /*
  * High Definition Audio Audio PCI Configuration Space
  */