CVS commit: src/doc

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:18:23 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
rkpmic(4): Add driver for Rockchip RK808 Power Management IC.


To generate a diff of this commit:
cvs rdiff -u -r1.2434 -r1.2435 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2434 src/doc/CHANGES:1.2435
--- src/doc/CHANGES:1.2434	Sun Aug 26 07:48:31 2018
+++ src/doc/CHANGES	Sun Sep  2 01:18:22 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2434 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2435 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -213,3 +213,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	mue(4): Add driver for Microchip LAN75xx/LAN78xx (Raspberry Pi 3 B+)
 		from OpenBSD. [rin 20180825]
 	OpenSSH: Imported 7.8. [christos 20180826]
+	rkpmic(4): Add driver for Rockchip RK808 Power Management IC.
+		[jmcneill 20180901]



CVS commit: src/doc

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:18:23 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
rkpmic(4): Add driver for Rockchip RK808 Power Management IC.


To generate a diff of this commit:
cvs rdiff -u -r1.2434 -r1.2435 src/doc/CHANGES

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



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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:17:23 UTC 2018

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

Log Message:
Add rkpmic


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/GENERIC64

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



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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:17:23 UTC 2018

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

Log Message:
Add rkpmic


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/GENERIC64

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/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.33 src/sys/arch/evbarm/conf/GENERIC64:1.34
--- src/sys/arch/evbarm/conf/GENERIC64:1.33	Wed Aug 29 01:58:54 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Sep  2 01:17:23 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.33 2018/08/29 01:58:54 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.34 2018/09/02 01:17:23 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -250,6 +250,8 @@ axpreg*		at axppmic?
 fan53555reg*	at iic?			# FAN53555 / SY82x regulator
 max77620pmic*	at iic?
 pcf8563rtc*	at iic?			# PCF8563 RTC
+rkpmic*		at iic?			# Rockchip Power Management IC
+rkreg*		at rkpmic?
 tcagpio*	at iic?
 
 # Random number generators



CVS commit: src/sys/dev/i2c

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:16:58 UTC 2018

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: rkpmic.c

Log Message:
Add driver for Rockchip RK808 Power Management IC.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/rkpmic.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/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.95 src/sys/dev/i2c/files.i2c:1.96
--- src/sys/dev/i2c/files.i2c:1.95	Wed Aug 29 01:57:38 2018
+++ src/sys/dev/i2c/files.i2c	Sun Sep  2 01:16:58 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.95 2018/08/29 01:57:38 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.96 2018/09/02 01:16:58 jmcneill Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -349,3 +349,10 @@ file dev/i2c/tea5767.ctea5767radio
 device	fan53555reg
 attach	fan53555reg at iic
 file	dev/i2c/fan53555.c			fan53555reg
+
+# Rockchip Power Management IC
+device	rkpmic { }
+device	rkreg: rkpmic
+attach	rkpmic at iic
+attach	rkreg at rkpmic
+file	dev/i2c/rkpmic.c			rkpmic

Added files:

Index: src/sys/dev/i2c/rkpmic.c
diff -u /dev/null src/sys/dev/i2c/rkpmic.c:1.1
--- /dev/null	Sun Sep  2 01:16:58 2018
+++ src/sys/dev/i2c/rkpmic.c	Sun Sep  2 01:16:58 2018
@@ -0,0 +1,353 @@
+/* $NetBSD: rkpmic.c,v 1.1 2018/09/02 01:16:58 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: rkpmic.c,v 1.1 2018/09/02 01:16:58 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	CHIP_NAME_REG		0x17
+#define	CHIP_VER_REG		0x18
+
+struct rkpmic_ctrl {
+	const char *	name;
+	uint8_t		enable_reg;
+	uint8_t		enable_mask;
+	uint8_t		vsel_reg;
+	uint8_t		vsel_mask;
+	u_int		base;
+	u_int		step;	
+};
+
+struct rkpmic_config {
+	const char *	name;
+	const struct rkpmic_ctrl *ctrl;
+	u_int		nctrl;
+};
+
+static const struct rkpmic_ctrl rk808_ctrls[] = {
+	/* DCDC */
+	{ .name = "DCDC_REG1",
+	  .enable_reg = 0x23,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x2f,	.vsel_mask = __BITS(5,0),
+	  .base = 712500,	.step = 12500 },
+	{ .name = "DCDC_REG2",
+	  .enable_reg = 0x23,	.enable_mask = __BIT(1),
+	  .vsel_reg = 0x33,	.vsel_mask = __BITS(5,0),
+	  .base = 712500,	.step = 12500 },
+	{ .name = "DCDC_REG3",
+	  .enable_reg = 0x23,	.enable_mask = __BIT(2) },
+	{ .name = "DCDC_REG4",
+	  .enable_reg = 0x23,	.enable_mask = __BIT(3),
+	  .vsel_reg = 0x38,	.vsel_mask = __BITS(3,0),
+	  .base = 180,	.step = 10 },
+
+	/* LDO */
+	{ .name = "LDO_REG1",
+	  .enable_reg = 0x24,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x3b,	.vsel_mask = __BITS(4,0),
+	  .base = 180,	.step = 10 },
+	{ .name = "LDO_REG2",
+	  .enable_reg = 0x24,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x3d,	.vsel_mask = __BITS(4,0),
+	  .base = 180,	.step = 10 },
+	{ .name = "LDO_REG3",
+	  .enable_reg = 0x24,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x3f,	.vsel_mask = __BITS(3,0),
+	  .base = 80,	.step = 10 },
+	{ .name = "LDO_REG4",
+	  .enable_reg = 0x24,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x41,	.vsel_mask = __BITS(4,0),
+	  .base = 180,	.step = 10 },
+	{ .name = "LDO_REG5",
+	  .enable_reg = 0x24,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x43,	.vsel_mask = __BITS(4,0),
+	  .base = 180,	.step = 10 },
+	{ .name = "LDO_REG6",
+	  .enable_reg = 0x24,	.enable_mask = __BIT(0),
+	  .vsel_reg = 0x45,	.vsel_mask = 

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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:16:04 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_i2c.c

Log Message:
Calculate i2c divisor based on sclk not pclk


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_i2c.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/rockchip/rk_i2c.c
diff -u src/sys/arch/arm/rockchip/rk_i2c.c:1.2 src/sys/arch/arm/rockchip/rk_i2c.c:1.3
--- src/sys/arch/arm/rockchip/rk_i2c.c:1.2	Sun Sep  2 00:48:12 2018
+++ src/sys/arch/arm/rockchip/rk_i2c.c	Sun Sep  2 01:16:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_i2c.c,v 1.2 2018/09/02 00:48:12 jmcneill Exp $ */
+/* $NetBSD: rk_i2c.c,v 1.3 2018/09/02 01:16:03 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.2 2018/09/02 00:48:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.3 2018/09/02 01:16:03 jmcneill Exp $");
 
 #include 
 #include 
@@ -137,7 +137,7 @@ rk_i2c_init(struct rk_i2c_softc *sc)
 	 * SCL = PCLK / SCLK Divisor
 	 */
 
-	rate = clk_get_rate(sc->sc_pclk);
+	rate = clk_get_rate(sc->sc_sclk);
 	div = howmany(rate, sc->sc_clkfreq * 8) - 2;
 	if (div >= 0) {
 		divl = div / 2;



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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:16:04 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_i2c.c

Log Message:
Calculate i2c divisor based on sclk not pclk


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

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



CVS commit: src/sys/dev/i2c

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 01:16:58 UTC 2018

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: rkpmic.c

Log Message:
Add driver for Rockchip RK808 Power Management IC.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/rkpmic.c

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



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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 00:48:12 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_i2c.c

Log Message:
Send an ACK after the last byte is received


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_i2c.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/rockchip/rk_i2c.c
diff -u src/sys/arch/arm/rockchip/rk_i2c.c:1.1 src/sys/arch/arm/rockchip/rk_i2c.c:1.2
--- src/sys/arch/arm/rockchip/rk_i2c.c:1.1	Sun Jul  1 18:16:58 2018
+++ src/sys/arch/arm/rockchip/rk_i2c.c	Sun Sep  2 00:48:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_i2c.c,v 1.1 2018/07/01 18:16:58 jmcneill Exp $ */
+/* $NetBSD: rk_i2c.c,v 1.2 2018/09/02 00:48:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.1 2018/07/01 18:16:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.2 2018/09/02 00:48:12 jmcneill Exp $");
 
 #include 
 #include 
@@ -294,7 +294,7 @@ rk_i2c_read(struct rk_i2c_softc *sc, i2c
 		return EINVAL;
 
 	mode = RKI2C_CON_I2C_MODE_RTX;
-	con = RKI2C_CON_I2C_EN | __SHIFTIN(mode, RKI2C_CON_I2C_MODE);
+	con = RKI2C_CON_I2C_EN | RKI2C_CON_ACK | __SHIFTIN(mode, RKI2C_CON_I2C_MODE);
 	WR4(sc, RKI2C_CON, con);
 
 	if (send_start && (error = rk_i2c_start(sc)) != 0)



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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  2 00:48:12 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_i2c.c

Log Message:
Send an ACK after the last byte is received


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

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



CVS commit: src/sys/dev/fdt

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  1 23:41:16 UTC 2018

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Don't print an error message for shared opp tables


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/cpufreq_dt.c

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



CVS commit: src/sys/dev/fdt

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  1 23:41:16 UTC 2018

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Don't print an error message for shared opp tables


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/cpufreq_dt.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/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.4 src/sys/dev/fdt/cpufreq_dt.c:1.5
--- src/sys/dev/fdt/cpufreq_dt.c:1.4	Sat Sep  1 19:36:53 2018
+++ src/sys/dev/fdt/cpufreq_dt.c	Sat Sep  1 23:41:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.4 2018/09/01 19:36:53 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.5 2018/09/01 23:41:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.4 2018/09/01 19:36:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.5 2018/09/01 23:41:16 jmcneill Exp $");
 
 #include 
 #include 
@@ -428,8 +428,9 @@ cpufreq_dt_parse(struct cpufreq_dt_softc
 	mutex_exit(_dt_tables_lock);
 
 	if (error) {
-		aprint_error_dev(sc->sc_dev,
-		"couldn't parse operating points: %d\n", error);
+		if (error != EEXIST)
+			aprint_error_dev(sc->sc_dev,
+			"couldn't parse operating points: %d\n", error);
 		return error;
 	}
 



CVS commit: src/sys/external/bsd/drm2/linux

2018-09-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 22:28:04 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/linux: linux_fence.c

Log Message:
Allow fence_get(NULL).

This is kind of silly: if the caller has exclusive access to the
fence, they should be able to guarantee it's there, so this could
serve to suppress legitimate bugs.  But better to preserve Linux
semantics here than to be picky about API design.

Bug by me, fix from Tobias Ulmer in PR kern/53565.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/linux/linux_fence.c

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



CVS commit: src/sys/external/bsd/drm2/linux

2018-09-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 22:28:04 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/linux: linux_fence.c

Log Message:
Allow fence_get(NULL).

This is kind of silly: if the caller has exclusive access to the
fence, they should be able to guarantee it's there, so this could
serve to suppress legitimate bugs.  But better to preserve Linux
semantics here than to be picky about API design.

Bug by me, fix from Tobias Ulmer in PR kern/53565.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/linux/linux_fence.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_fence.c
diff -u src/sys/external/bsd/drm2/linux/linux_fence.c:1.12 src/sys/external/bsd/drm2/linux/linux_fence.c:1.13
--- src/sys/external/bsd/drm2/linux/linux_fence.c:1.12	Tue Aug 28 15:04:02 2018
+++ src/sys/external/bsd/drm2/linux/linux_fence.c	Sat Sep  1 22:28:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $	*/
+/*	$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.12 2018/08/28 15:04:02 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_fence.c,v 1.13 2018/09/01 22:28:04 riastradh Exp $");
 
 #include 
 #include 
@@ -179,7 +179,8 @@ struct fence *
 fence_get(struct fence *fence)
 {
 
-	kref_get(>refcount);
+	if (fence)
+		kref_get(>refcount);
 	return fence;
 }
 



CVS commit: src/sys/dev

2018-09-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 22:01:03 UTC 2018

Modified Files:
src/sys/dev/ic: bwfm.c bwfmvar.h
src/sys/dev/pci: if_bwfm_pci.c
src/sys/dev/usb: if_bwfm_usb.c

Log Message:
bwfm has only one tx descriptor; limit mbuf chains to one segment.

PR kern/53287

Can't use m_defrag because it always yields two segments.

Discussion on tech-net:
https://mail-index.netbsd.org/tech-net/2018/09/01/msg007031.html

Diagnosed and tested by maya.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/bwfmvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/if_bwfm_usb.c

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



CVS commit: src/sys/dev

2018-09-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Sep  1 22:01:03 UTC 2018

Modified Files:
src/sys/dev/ic: bwfm.c bwfmvar.h
src/sys/dev/pci: if_bwfm_pci.c
src/sys/dev/usb: if_bwfm_usb.c

Log Message:
bwfm has only one tx descriptor; limit mbuf chains to one segment.

PR kern/53287

Can't use m_defrag because it always yields two segments.

Discussion on tech-net:
https://mail-index.netbsd.org/tech-net/2018/09/01/msg007031.html

Diagnosed and tested by maya.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/bwfmvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/if_bwfm_usb.c

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

Modified files:

Index: src/sys/dev/ic/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.12 src/sys/dev/ic/bwfm.c:1.13
--- src/sys/dev/ic/bwfm.c:1.12	Tue Jun 26 06:48:00 2018
+++ src/sys/dev/ic/bwfm.c	Sat Sep  1 22:01:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.12 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: bwfm.c,v 1.13 2018/09/01 22:01:03 riastradh Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -337,7 +337,7 @@ bwfm_start(struct ifnet *ifp)
 			continue;
 		}
 
-		error = sc->sc_bus_ops->bs_txdata(sc, m);
+		error = sc->sc_bus_ops->bs_txdata(sc, );
 		if (error == ENOBUFS) {
 			IF_PREPEND(>if_snd, m);
 			ifp->if_flags |= IFF_OACTIVE;

Index: src/sys/dev/ic/bwfmvar.h
diff -u src/sys/dev/ic/bwfmvar.h:1.2 src/sys/dev/ic/bwfmvar.h:1.3
--- src/sys/dev/ic/bwfmvar.h:1.2	Fri May 11 07:41:11 2018
+++ src/sys/dev/ic/bwfmvar.h	Sat Sep  1 22:01:03 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmvar.h,v 1.2 2018/05/11 07:41:11 maya Exp $ */
+/* $NetBSD: bwfmvar.h,v 1.3 2018/09/01 22:01:03 riastradh Exp $ */
 /* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -93,7 +93,7 @@ struct bwfm_bus_ops {
 	void (*bs_init)(struct bwfm_softc *);
 	void (*bs_stop)(struct bwfm_softc *);
 	int (*bs_txcheck)(struct bwfm_softc *);
-	int (*bs_txdata)(struct bwfm_softc *, struct mbuf *);
+	int (*bs_txdata)(struct bwfm_softc *, struct mbuf **);
 	int (*bs_txctl)(struct bwfm_softc *, char *, size_t);
 	int (*bs_rxctl)(struct bwfm_softc *, char *, size_t *);
 };

Index: src/sys/dev/pci/if_bwfm_pci.c
diff -u src/sys/dev/pci/if_bwfm_pci.c:1.1 src/sys/dev/pci/if_bwfm_pci.c:1.2
--- src/sys/dev/pci/if_bwfm_pci.c:1.1	Fri May 11 07:42:22 2018
+++ src/sys/dev/pci/if_bwfm_pci.c	Sat Sep  1 22:01:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwfm_pci.c,v 1.1 2018/05/11 07:42:22 maya Exp $	*/
+/*	$NetBSD: if_bwfm_pci.c,v 1.2 2018/09/01 22:01:03 riastradh Exp $	*/
 /*	$OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $	*/
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -225,7 +225,7 @@ void		 bwfm_pci_dmamem_free(struct bwfm_
 int		 bwfm_pci_pktid_avail(struct bwfm_pci_softc *,
 		struct bwfm_pci_pkts *);
 int		 bwfm_pci_pktid_new(struct bwfm_pci_softc *,
-		struct bwfm_pci_pkts *, struct mbuf *,
+		struct bwfm_pci_pkts *, struct mbuf **,
 		uint32_t *, paddr_t *);
 struct mbuf *	 bwfm_pci_pktid_free(struct bwfm_pci_softc *,
 		struct bwfm_pci_pkts *, uint32_t);
@@ -281,7 +281,7 @@ void		 bwfm_pci_flowring_delete(struct b
 
 void		 bwfm_pci_stop(struct bwfm_softc *);
 int		 bwfm_pci_txcheck(struct bwfm_softc *);
-int		 bwfm_pci_txdata(struct bwfm_softc *, struct mbuf *);
+int		 bwfm_pci_txdata(struct bwfm_softc *, struct mbuf **);
 
 #ifdef BWFM_DEBUG
 void		 bwfm_pci_debug_console(struct bwfm_pci_softc *);
@@ -922,7 +922,7 @@ bwfm_pci_pktid_avail(struct bwfm_pci_sof
 
 int
 bwfm_pci_pktid_new(struct bwfm_pci_softc *sc, struct bwfm_pci_pkts *pkts,
-struct mbuf *m, uint32_t *pktid, paddr_t *paddr)
+struct mbuf **mp, uint32_t *pktid, paddr_t *paddr)
 {
 	int i, idx;
 
@@ -932,15 +932,32 @@ bwfm_pci_pktid_new(struct bwfm_pci_softc
 			idx = 0;
 		if (pkts->pkts[idx].bb_m == NULL) {
 			if (bus_dmamap_load_mbuf(sc->sc_dmat,
-			pkts->pkts[idx].bb_map, m, BUS_DMA_NOWAIT) != 0) {
-if (m_defrag(m, M_DONTWAIT))
-	return EFBIG;
+			pkts->pkts[idx].bb_map, *mp, BUS_DMA_NOWAIT) != 0) {
+/*
+ * Didn't fit.  Maybe it has too many
+ * segments.  If it has only one
+ * segment, fail; otherwise try to
+ * compact it into a single mbuf
+ * segment.
+ */
+if ((*mp)->m_next == NULL)
+	return ENOBUFS;
+struct mbuf *m0 = MCLGETI(NULL, M_DONTWAIT,
+NULL, MSGBUF_MAX_PKT_SIZE);
+if (m0 == NULL)
+	return ENOBUFS;
+m_copydata(*mp, 0, (*mp)->m_pkthdr.len,
+mtod(m0, void *));
+m0->m_pkthdr.len = m0->m_len =
+(*mp)->m_pkthdr.len;
+m_freem(*mp);
+*mp = m0;
 if (bus_dmamap_load_mbuf(sc->sc_dmat,
-pkts->pkts[idx].bb_map, m, BUS_DMA_NOWAIT) 

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

2018-09-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep  1 20:54:32 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/cortex/gtmr.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.32 src/sys/arch/arm/cortex/gtmr.c:1.33
--- src/sys/arch/arm/cortex/gtmr.c:1.32	Sat Jun 30 17:30:37 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Sat Sep  1 20:54:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.32 2018/06/30 17:30:37 jmcneill Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.33 2018/09/01 20:54:32 tnn Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.32 2018/06/30 17:30:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.33 2018/09/01 20:54:32 tnn Exp $");
 
 #include 
 #include 
@@ -87,7 +87,9 @@ reg ## _stable_read(struct gtmr_softc *s
 	return val; \
 }
 
+#ifdef DIAGNOSTIC
 stable_read(gtmr_cntv_cval);
+#endif
 stable_read(gtmr_cntvct);
 
 static int gtmr_match(device_t, cfdata_t, void *);
@@ -172,8 +174,10 @@ gtmr_attach(device_t parent, device_t se
 
 	evcnt_attach_dynamic(_cntv_tval_write_ev, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "CNTV_TVAL write retry max");
+#ifdef DIAGNOSTIC
 	evcnt_attach_dynamic(_cntv_cval_read_ev, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "CNTV_CVAL read retry max");
+#endif
 	evcnt_attach_dynamic(_cntvct_read_ev, EVCNT_TYPE_MISC, NULL,
 	device_xname(self), "CNTVCT read retry max");
 



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

2018-09-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep  1 20:54:32 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
fix non-DIAGNOSTIC build


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/cortex/gtmr.c

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



CVS commit: src/sys/dev/fdt

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  1 19:36:54 UTC 2018

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Add support for opp-v2 tables and multiple instances of the cpufreqdt
driver.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/cpufreq_dt.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/fdt/cpufreq_dt.c
diff -u src/sys/dev/fdt/cpufreq_dt.c:1.3 src/sys/dev/fdt/cpufreq_dt.c:1.4
--- src/sys/dev/fdt/cpufreq_dt.c:1.3	Sat Dec 16 16:41:18 2017
+++ src/sys/dev/fdt/cpufreq_dt.c	Sat Sep  1 19:36:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufreq_dt.c,v 1.3 2017/12/16 16:41:18 jmcneill Exp $ */
+/* $NetBSD: cpufreq_dt.c,v 1.4 2018/09/01 19:36:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.3 2017/12/16 16:41:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c,v 1.4 2018/09/01 19:36:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -37,12 +37,24 @@ __KERNEL_RCSID(0, "$NetBSD: cpufreq_dt.c
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
+struct cpufreq_dt_table {
+	int			phandle;
+	TAILQ_ENTRY(cpufreq_dt_table) next;
+};
+
+static TAILQ_HEAD(, cpufreq_dt_table) cpufreq_dt_tables =
+TAILQ_HEAD_INITIALIZER(cpufreq_dt_tables);
+static kmutex_t cpufreq_dt_tables_lock;
+
 struct cpufreq_dt_opp {
-	u_int		freq_khz;
-	u_int		voltage_uv;
+	u_int			freq_khz;
+	u_int			voltage_uv;
+	u_int			latency_ns;
 };
 
 struct cpufreq_dt_softc {
@@ -53,7 +65,6 @@ struct cpufreq_dt_softc {
 
 	struct cpufreq_dt_opp	*sc_opp;
 	ssize_t			sc_nopp;
-	int			sc_latency;
 
 	u_int			sc_freq_target;
 	bool			sc_freq_throttle;
@@ -64,6 +75,8 @@ struct cpufreq_dt_softc {
 	int			sc_node_target;
 	int			sc_node_current;
 	int			sc_node_available;
+
+	struct cpufreq_dt_table	sc_table;
 };
 
 static void
@@ -116,6 +129,10 @@ cpufreq_dt_set_rate(struct cpufreq_dt_so
 	if (error != 0)
 		return error;
 
+	const u_int latency_us = howmany(opp->latency_ns, 1000);
+	if (latency_us > 0)
+		delay(latency_us);
+
 	if (sc->sc_supply != NULL) {
 		if (new_uv < old_uv) {
 			error = fdtbus_regulator_set_voltage(sc->sc_supply,
@@ -233,11 +250,26 @@ cpufreq_dt_sysctl_helper(SYSCTLFN_ARGS)
 	return error;
 }
 
+static int
+cpufreq_dt_instance_count(void)
+{
+	deviter_t di;
+	int count = 0;
+
+	deviter_init(, 0);
+	while (deviter_next() != NULL)
+		++count;
+	deviter_release();
+
+	return count;
+}
+
 static void
 cpufreq_dt_init_sysctl(struct cpufreq_dt_softc *sc)
 {
 	const struct sysctlnode *node, *cpunode, *freqnode;
 	struct sysctllog *cpufreq_log = NULL;
+	const char *cpunodename;
 	int error, i;
 
 	sc->sc_freq_available = kmem_zalloc(strlen(" ") * sc->sc_nopp, KM_SLEEP);
@@ -247,13 +279,18 @@ cpufreq_dt_init_sysctl(struct cpufreq_dt
 		strcat(sc->sc_freq_available, buf);
 	}
 
+	if (cpufreq_dt_instance_count() > 1)
+		cpunodename = device_xname(sc->sc_dev);
+	else
+		cpunodename = "cpu";
+
 	error = sysctl_createv(_log, 0, NULL, ,
 	CTLFLAG_PERMANENT, CTLTYPE_NODE, "machdep", NULL,
 	NULL, 0, NULL, 0, CTL_MACHDEP, CTL_EOL);
 	if (error)
 		goto sysctl_failed;
 	error = sysctl_createv(_log, 0, , ,
-	0, CTLTYPE_NODE, "cpu", NULL,
+	0, CTLTYPE_NODE, cpunodename, NULL,
 	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
 	if (error)
 		goto sysctl_failed;
@@ -295,12 +332,77 @@ sysctl_failed:
 }
 
 static int
-cpufreq_dt_parse(struct cpufreq_dt_softc *sc)
+cpufreq_dt_parse_opp(struct cpufreq_dt_softc *sc)
 {
 	const int phandle = sc->sc_phandle;
 	const u_int *opp;
 	int len, i;
-	u_int lat;
+
+	opp = fdtbus_get_prop(phandle, "operating-points", );
+	if (len < 8)
+		return ENXIO;
+
+	sc->sc_nopp = len / 8;
+	sc->sc_opp = kmem_zalloc(sizeof(*sc->sc_opp) * sc->sc_nopp, KM_SLEEP);
+	for (i = 0; i < sc->sc_nopp; i++, opp += 2) {
+		sc->sc_opp[i].freq_khz = be32toh(opp[0]);
+		sc->sc_opp[i].voltage_uv = be32toh(opp[1]);
+	}
+
+	return 0;
+}
+
+static int
+cpufreq_dt_parse_opp_v2(struct cpufreq_dt_softc *sc)
+{
+	const int phandle = sc->sc_phandle;
+	struct cpufreq_dt_table *table;
+	uint64_t opp_hz;
+	uint32_t opp_uv;
+	int opp_node, i;
+
+	const int opp_table = fdtbus_get_phandle(phandle, "operating-points-v2");
+	if (opp_table < 0)
+		return ENOENT;
+
+	/* If the table is shared, only setup a single instance */
+	if (of_hasprop(opp_table, "opp-shared")) {
+		TAILQ_FOREACH(table, _dt_tables, next)
+			if (table->phandle == opp_table)
+return EEXIST;
+		sc->sc_table.phandle = opp_table;
+		TAILQ_INSERT_TAIL(_dt_tables, >sc_table, next);
+	}
+
+	for (opp_node = OF_child(opp_table); opp_node; opp_node = OF_peer(opp_node)) {
+		if (fdtbus_status_okay(opp_node))
+			sc->sc_nopp++;
+	}
+
+	if (sc->sc_nopp == 0)
+		return EINVAL;
+
+	sc->sc_opp = kmem_zalloc(sizeof(*sc->sc_opp) * sc->sc_nopp, KM_SLEEP);
+	for (opp_node = 

CVS commit: src/sys/dev/fdt

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  1 19:36:54 UTC 2018

Modified Files:
src/sys/dev/fdt: cpufreq_dt.c

Log Message:
Add support for opp-v2 tables and multiple instances of the cpufreqdt
driver.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/cpufreq_dt.c

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



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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  1 19:35:53 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk3399_cru.c rk_cru.h rk_cru_arm.c

Log Message:
Add support for RK3399 CPU clocks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_cru.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_cru_arm.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/rockchip/rk3399_cru.c
diff -u src/sys/arch/arm/rockchip/rk3399_cru.c:1.2 src/sys/arch/arm/rockchip/rk3399_cru.c:1.3
--- src/sys/arch/arm/rockchip/rk3399_cru.c:1.2	Sun Aug 12 19:28:41 2018
+++ src/sys/arch/arm/rockchip/rk3399_cru.c	Sat Sep  1 19:35:53 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_cru.c,v 1.2 2018/08/12 19:28:41 jmcneill Exp $ */
+/* $NetBSD: rk3399_cru.c,v 1.3 2018/09/01 19:35:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.2 2018/08/12 19:28:41 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.3 2018/09/01 19:35:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -139,6 +139,67 @@ static const struct rk_cru_pll_rate pll_
 static const struct rk_cru_pll_rate pll_norates[] = {
 };
 
+#define	RK3399_ACLKM_MASK	__BITS(12,8)
+#define	RK3399_ATCLK_MASK	__BITS(4,0)
+#define	RK3399_PDBG_MASK	__BITS(12,8)
+
+#define	RK3399_CPUL_RATE(_rate, _aclkm, _atclk, _pdbg)			\
+	RK_CPU_RATE(_rate,		\
+		CLKSEL_CON(0), RK3399_ACLKM_MASK,			\
+		__SHIFTIN((_aclkm), RK3399_ACLKM_MASK),		\
+		CLKSEL_CON(1), RK3399_ATCLK_MASK|RK3399_PDBG_MASK,	\
+		__SHIFTIN((_atclk), RK3399_ATCLK_MASK)|__SHIFTIN((_pdbg), RK3399_PDBG_MASK))
+
+#define	RK3399_CPUB_RATE(_rate, _aclkm, _atclk, _pdbg)			\
+	RK_CPU_RATE(_rate,		\
+		CLKSEL_CON(2), RK3399_ACLKM_MASK,			\
+		__SHIFTIN((_aclkm), RK3399_ACLKM_MASK),		\
+		CLKSEL_CON(3), RK3399_ATCLK_MASK|RK3399_PDBG_MASK,	\
+		__SHIFTIN((_atclk), RK3399_ATCLK_MASK)|__SHIFTIN((_pdbg), RK3399_PDBG_MASK))
+
+static const struct rk_cru_cpu_rate armclkl_rates[] = {
+RK3399_CPUL_RATE(18, 1, 8, 8),
+RK3399_CPUL_RATE(170400, 1, 8, 8),
+RK3399_CPUL_RATE(160800, 1, 7, 7),
+RK3399_CPUL_RATE(151200, 1, 7, 7),
+RK3399_CPUL_RATE(148800, 1, 6, 6),
+RK3399_CPUL_RATE(141600, 1, 6, 6),
+RK3399_CPUL_RATE(12, 1, 5, 5),
+RK3399_CPUL_RATE(100800, 1, 4, 4),
+RK3399_CPUL_RATE( 81600, 1, 3, 3),
+RK3399_CPUL_RATE( 69600, 1, 3, 3),
+RK3399_CPUL_RATE( 6, 1, 2, 2),
+RK3399_CPUL_RATE( 40800, 1, 1, 1),
+RK3399_CPUL_RATE( 31200, 1, 1, 1),
+RK3399_CPUL_RATE( 21600, 1, 1, 1),
+RK3399_CPUL_RATE(  9600, 1, 1, 1),
+};
+
+static const struct rk_cru_cpu_rate armclkb_rates[] = {
+RK3399_CPUB_RATE(220800, 1, 11, 11),
+RK3399_CPUB_RATE(218400, 1, 11, 11),
+RK3399_CPUB_RATE(208800, 1, 10, 10),
+RK3399_CPUB_RATE(204000, 1, 10, 10),
+RK3399_CPUB_RATE(201600, 1, 9, 9),
+RK3399_CPUB_RATE(199200, 1, 9, 9),
+RK3399_CPUB_RATE(189600, 1, 9, 9),
+RK3399_CPUB_RATE(18, 1, 8, 8),
+RK3399_CPUB_RATE(170400, 1, 8, 8),
+RK3399_CPUB_RATE(160800, 1, 7, 7),
+RK3399_CPUB_RATE(151200, 1, 7, 7),
+RK3399_CPUB_RATE(148800, 1, 6, 6),
+RK3399_CPUB_RATE(141600, 1, 6, 6),
+RK3399_CPUB_RATE(12, 1, 5, 5),
+RK3399_CPUB_RATE(100800, 1, 5, 5),
+RK3399_CPUB_RATE( 81600, 1, 4, 4),
+RK3399_CPUB_RATE( 69600, 1, 3, 3),
+RK3399_CPUB_RATE( 6, 1, 3, 3),
+RK3399_CPUB_RATE( 40800, 1, 2, 2),
+RK3399_CPUB_RATE( 31200, 1, 1, 1),
+RK3399_CPUB_RATE( 21600, 1, 1, 1),
+RK3399_CPUB_RATE(  9600, 1, 1, 1),
+};
+
 #define	PLL_CON0	0x00
 #define	 PLL_FBDIV	__BITS(11,0)
 
@@ -229,14 +290,13 @@ rk3399_cru_pll_set_rate(struct rk_cru_so
 	CRU_WRITE(sc, pll->con_base + PLL_CON3, val);
 
 	CRU_WRITE(sc, pll->con_base + PLL_CON0,
-	__SHIFTIN(pll_rate->fbdiv, PLL_FBDIV) |
-	PLL_WRITE_MASK);
+	__SHIFTIN(pll_rate->fbdiv, PLL_FBDIV) | (PLL_FBDIV << 16));
 
 	CRU_WRITE(sc, pll->con_base + PLL_CON1,
 	__SHIFTIN(pll_rate->postdiv2, PLL_POSTDIV2) |
 	__SHIFTIN(pll_rate->postdiv1, PLL_POSTDIV1) |
 	__SHIFTIN(pll_rate->refdiv, PLL_REFDIV) |
-	PLL_WRITE_MASK);
+	((PLL_POSTDIV2 | PLL_POSTDIV1 | PLL_REFDIV) << 16));
 
 	val = CRU_READ(sc, pll->con_base + PLL_CON2);
 	val &= ~PLL_FRACDIV;
@@ -246,11 +306,6 @@ rk3399_cru_pll_set_rate(struct rk_cru_so
 	val = __SHIFTIN(pll_rate->dsmpd, PLL_DSMPD) | (PLL_DSMPD << 16);
 	CRU_WRITE(sc, pll->con_base + PLL_CON3, val);
 
-	/* Set PLL work 

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

2018-09-01 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep  1 19:35:53 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk3399_cru.c rk_cru.h rk_cru_arm.c

Log Message:
Add support for RK3399 CPU clocks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_cru.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_cru_arm.c

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



CVS commit: src/usr.sbin/npf/npfctl

2018-09-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep  1 19:26:46 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.71 src/usr.sbin/npf/npfctl/npf.conf.5:1.72
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.71	Sat Sep  1 16:28:57 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Sat Sep  1 19:26:46 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.71 2018/09/01 16:28:57 rmind Exp $
+.\"$NetBSD: npf.conf.5,v 1.72 2018/09/01 19:26:46 wiz Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -298,7 +298,6 @@ IPv6-to-IPv6 network prefix translation 
 .El
 .Pp
 Currently, the static NAT algorithms do not perform port translation.
-.Pp
 .Ss Application Level Gateways
 Certain application layer protocols are not compatible with NAT and require
 translation outside layers 3 and 4.



CVS commit: src/usr.sbin/npf/npfctl

2018-09-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep  1 19:26:46 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
Remove superfluous Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/npf/npfctl/npf.conf.5

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



Re: CVS commit: src/usr.sbin/npf/npfctl

2018-09-01 Thread Maxime Villard

Le 01/09/2018 à 18:28, Mindaugas Rasiukevicius a écrit :

Module Name:src
Committed By:   rmind
Date:   Sat Sep  1 16:28:57 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
npf.conf(5): fix some of the previous incorrect or inaccurate changes.
The TCP flags option is not only for the stateful tracking.  Dynamic NAT
implies NAPT; algorithms, at least for now, are for static NAT mappings.
Mention that ALG ICMP is also for traceroute behind NAT; also mention
"MSS clamping" (some users might search for this term, so keeping the
terminology is helpful).


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/npf/npfctl/npf.conf.5

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


Indeed the 'flags' option was not documented in the right section, thanks
for moving it in the correct one.

I believe it would be better to change

-   The protocol keyword can additionally have ...
+   The
+   .Cd proto
+   keyword can additionally have ...

To keep things consistent. Or even "This keyword" to avoid repeating.

And the end of the sentence should maybe be "protocol-specific options such
as 'flags'", to make it clearer that you just want to talk about 'flags' in
what follows.


CVS commit: src/usr.sbin/npf/npfctl

2018-09-01 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Sep  1 16:28:57 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
npf.conf(5): fix some of the previous incorrect or inaccurate changes.
The TCP flags option is not only for the stateful tracking.  Dynamic NAT
implies NAPT; algorithms, at least for now, are for static NAT mappings.
Mention that ALG ICMP is also for traceroute behind NAT; also mention
"MSS clamping" (some users might search for this term, so keeping the
terminology is helpful).


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/npf/npfctl/npf.conf.5

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



CVS commit: src/usr.sbin/npf/npfctl

2018-09-01 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat Sep  1 16:28:57 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl: npf.conf.5

Log Message:
npf.conf(5): fix some of the previous incorrect or inaccurate changes.
The TCP flags option is not only for the stateful tracking.  Dynamic NAT
implies NAPT; algorithms, at least for now, are for static NAT mappings.
Mention that ALG ICMP is also for traceroute behind NAT; also mention
"MSS clamping" (some users might search for this term, so keeping the
terminology is helpful).


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.70 src/usr.sbin/npf/npfctl/npf.conf.5:1.71
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.70	Fri Aug 31 11:18:35 2018
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Sat Sep  1 16:28:57 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.70 2018/08/31 11:18:35 maxv Exp $
+.\"$NetBSD: npf.conf.5,v 1.71 2018/09/01 16:28:57 rmind Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 31, 2018
+.Dd September 1, 2018
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -87,8 +87,8 @@ table  type hash dynamic
 .Pp
 .Ed
 Currently, tables support three data storage types: "hash", "tree", or "cdb".
-Tables can also be set as containing "dynamic" or "static" data i.e. loaded from
- a specified file.
+Tables can also be set as containing "dynamic" or "static" data i.e. loaded
+from a specified file.
 Tables of type "hash" and "cdb" can only contain IP addresses.
 Only static data can be used with a storage type of "cdb".
 .Pp
@@ -166,9 +166,31 @@ option set, this rule is considered the 
 evaluation of subsequent rules is skipped.
 Otherwise, the last matching rule is used.
 .Pp
-A rule can also instruct NPF to create an entry in the state table
-when passing the packet, to notify the sender when blocking it, and
-to apply a procedure to the packet (e.g. "log") in either case.
+The
+.Cd proto
+keyword can be used to filter packets by layer 4 protocol (TCP, UDP, ICMP
+or other).
+Its parameter should be a protocol number or its symbolic name,
+as specified in the
+.Pa /etc/protocols
+file.
+The protocol keyword can additionally have protocol-specific options.
+The
+.Cd flags
+keyword can be used to match the packets against specific TCP flags,
+according to the following syntax:
+.Bl -tag -width protoXX -offset indent
+.It proto tcp flags Ar match[/mask]
+.El
+.Pp
+Where
+.Ar match
+is the set of TCP flags to be matched, out of the
+.Ar mask
+set, both sets being represented as a string combination of: S (SYN),
+A (ACK), F (FIN), R (RST). The flags that are not present in
+.Ar mask
+are ignored.
 .Pp
 To notify the sender of a blocking decision, three
 .Cd return
@@ -187,20 +209,19 @@ Return an ICMP UNREACHABLE message, when
 Applies to IPv4 and IPv6.
 .El
 .Pp
+Further packet specification at present is limited to TCP and UDP
+understanding source and destination ports, and ICMP and IPv6-ICMP
+understanding icmp-type.
+.Pp
+A rule can also instruct NPF to create an entry in the state table when
+passing the packet or to apply a procedure to the packet (e.g. "log").
+.Pp
 A "fully-featured" rule would for example be:
 .Bd -literal
 pass stateful in final family inet4 proto tcp flags S/SA \\
 	from $source port $sport to $dest port $dport apply "someproc"
 .Ed
 .Pp
-Any protocol in
-.Pa /etc/protocols
-can be specified.
-Further packet
-specification at present is limited to protocol TCP understanding flags,
-TCP and UDP understanding source and destination ports, and ICMP and
-IPv6-ICMP understanding icmp-type.
-.Pp
 Alternatively, NPF supports
 .Xr pcap-filter 7
 syntax, for example:
@@ -223,25 +244,6 @@ precaution.
 In both cases, a full TCP state tracking is performed for TCP connections
 and a limited tracking for message-based protocols (UDP and ICMP).
 .Pp
-The
-.Cd flags
-keyword can be used in conjunction with the
-.Cd stateful
-keyword to match the packets against specific TCP flags, according to
-the following syntax:
-.Bl -tag -width flagsXX -offset indent
-.It flags Ar match[/mask]
-.El
-.Pp
-Where
-.Ar match
-is the set of TCP flags to be matched, out of the
-.Ar mask
-set, both sets being represented as a string combination of: S (SYN),
-A (ACK), F (FIN), R (RST). The flags that are not present in
-.Ar mask
-are ignored.
-.Pp
 By default, a stateful rule implies SYN-only flag check ("flags S/SAFR")
 for the TCP packets.
 It is not advisable to change this behavior; however,
@@ -271,21 +273,32 @@ specified by $pub_ip for the packets on 
 map $ext_if dynamic 10.1.1.0/24 -> $pub_ip
 .Ed
 .Pp
-Several NAT 

CVS commit: src/sbin/cgdconfig

2018-09-01 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Sat Sep  1 11:46:52 UTC 2018

Modified Files:
src/sbin/cgdconfig: cgdconfig.8

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sbin/cgdconfig/cgdconfig.8

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

Modified files:

Index: src/sbin/cgdconfig/cgdconfig.8
diff -u src/sbin/cgdconfig/cgdconfig.8:1.40 src/sbin/cgdconfig/cgdconfig.8:1.41
--- src/sbin/cgdconfig/cgdconfig.8:1.40	Wed May  9 20:23:35 2018
+++ src/sbin/cgdconfig/cgdconfig.8	Sat Sep  1 11:46:52 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: cgdconfig.8,v 1.40 2018/05/09 20:23:35 kre Exp $
+.\" $NetBSD: cgdconfig.8,v 1.41 2018/09/01 11:46:52 prlw1 Exp $
 .\"
 .\" Copyright (c) 2002, The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -90,7 +90,7 @@ The options are as follows:
 .It Fl C
 Configure all the devices listed in the cgd configuration file.
 .It Fl e
-Echo the passphase.
+Echo the passphrase.
 .It Fl f Ar configfile
 Specify the configuration file explicitly, rather than using the default
 configuration file



CVS commit: src/sbin/cgdconfig

2018-09-01 Thread Patrick Welche
Module Name:src
Committed By:   prlw1
Date:   Sat Sep  1 11:46:52 UTC 2018

Modified Files:
src/sbin/cgdconfig: cgdconfig.8

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sbin/cgdconfig/cgdconfig.8

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



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ic

2018-09-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Sep  1 10:13:41 UTC 2018

Modified Files:
src/sys/dev/ic [jdolecek-ncqfixes]: ahcisata_core.c siisata.c

Log Message:
only call ata_deactivate_xfer() once completely done with the active
xfer in controller code (i.e. after bus_dmamap_sync() et.al.), so that
the command slot is safe to be reused immediatelly after deactivate


To generate a diff of this commit:
cvs rdiff -u -r1.62.2.1 -r1.62.2.2 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/dev/ic/siisata.c

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.62.2.1 src/sys/dev/ic/ahcisata_core.c:1.62.2.2
--- src/sys/dev/ic/ahcisata_core.c:1.62.2.1	Fri Aug 31 19:08:03 2018
+++ src/sys/dev/ic/ahcisata_core.c	Sat Sep  1 10:13:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.62.2.1 2018/08/31 19:08:03 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.62.2.2 2018/09/01 10:13:41 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.62.2.1 2018/08/31 19:08:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.62.2.2 2018/09/01 10:13:41 jdolecek Exp $");
 
 #include 
 #include 
@@ -1206,9 +1206,6 @@ ahci_cmd_complete(struct ata_channel *ch
 	if (ata_waitdrain_xfer_check(chp, xfer))
 		return 0;
 
-	KASSERT((achp->ahcic_cmds_active & (1U << xfer->c_slot)) != 0);
-	achp->ahcic_cmds_active &= ~(1U << xfer->c_slot);
-
 	if (xfer->c_flags & C_TIMEOU) {
 		ata_c->flags |= AT_TIMEOU;
 	}
@@ -1225,6 +1222,8 @@ ahci_cmd_complete(struct ata_channel *ch
 
 	ahci_cmd_done(chp, xfer);
 
+	KASSERT((achp->ahcic_cmds_active & (1U << xfer->c_slot)) != 0);
+	achp->ahcic_cmds_active &= ~(1U << xfer->c_slot);
 	ata_deactivate_xfer(chp, xfer);
 
 	return 0;
@@ -1453,10 +1452,6 @@ ahci_bio_complete(struct ata_channel *ch
 	if (ata_waitdrain_xfer_check(chp, xfer))
 		return 0;
 
-	KASSERT((achp->ahcic_cmds_active & (1U << xfer->c_slot)) != 0);
-	achp->ahcic_cmds_active &= ~(1U << xfer->c_slot);
-	ata_deactivate_xfer(chp, xfer);
-
 	if (xfer->c_flags & C_TIMEOU) {
 		ata_bio->error = TIMEOUT;
 	}
@@ -1497,6 +1492,11 @@ ahci_bio_complete(struct ata_channel *ch
 			le32toh(achp->ahcic_cmdh[xfer->c_slot].cmdh_prdbc);
 	}
 	AHCIDEBUG_PRINT((" now %ld\n", ata_bio->bcount), DEBUG_XFERS);
+
+	KASSERT((achp->ahcic_cmds_active & (1U << xfer->c_slot)) != 0);
+	achp->ahcic_cmds_active &= ~(1U << xfer->c_slot);
+	ata_deactivate_xfer(chp, xfer);
+
 	(*chp->ch_drive[drive].drv_done)(chp->ch_drive[drive].drv_softc, xfer);
 	if ((AHCI_TFD_ST(tfd) & WDCS_ERR) == 0)
 		atastart(chp);
@@ -1997,10 +1997,6 @@ ahci_atapi_complete(struct ata_channel *
 	if (ata_waitdrain_xfer_check(chp, xfer))
 		return 0;
 
-	KASSERT((achp->ahcic_cmds_active & (1U << xfer->c_slot)) != 0);
-	achp->ahcic_cmds_active &= ~(1U << xfer->c_slot);
-	ata_deactivate_xfer(chp, xfer);
-
 	if (xfer->c_flags & C_TIMEOU) {
 		sc_xfer->error = XS_TIMEOUT;
 	}
@@ -2030,7 +2026,12 @@ ahci_atapi_complete(struct ata_channel *
 			sc_xfer->error = XS_BUSY;
 			sc_xfer->status = SCSI_CHECK;
 		}
-	} 
+	}
+
+	KASSERT((achp->ahcic_cmds_active & (1U << xfer->c_slot)) != 0);
+	achp->ahcic_cmds_active &= ~(1U << xfer->c_slot);
+	ata_deactivate_xfer(chp, xfer);
+
 	ata_free_xfer(chp, xfer);
 	scsipi_done(sc_xfer);
 	if ((AHCI_TFD_ST(tfd) & WDCS_ERR) == 0)

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.35.6.1 src/sys/dev/ic/siisata.c:1.35.6.2
--- src/sys/dev/ic/siisata.c:1.35.6.1	Fri Aug 31 19:08:03 2018
+++ src/sys/dev/ic/siisata.c	Sat Sep  1 10:13:41 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.35.6.1 2018/08/31 19:08:03 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.35.6.2 2018/09/01 10:13:41 jdolecek Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.1 2018/08/31 19:08:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.2 2018/09/01 10:13:41 jdolecek Exp $");
 
 #include 
 #include 
@@ -1154,8 +1154,6 @@ siisata_cmd_complete(struct ata_channel 
 	if (ata_waitdrain_xfer_check(chp, xfer))
 		return 0;
 
-	siisata_deactivate_prb(schp, xfer->c_slot);
-
 	if (xfer->c_flags & C_TIMEOU)
 		ata_c->flags |= AT_TIMEOU;
 
@@ -1168,6 +1166,7 @@ siisata_cmd_complete(struct ata_channel 
 
 	siisata_cmd_done(chp, xfer, tfd);
 
+	siisata_deactivate_prb(schp, xfer->c_slot);
 	ata_deactivate_xfer(chp, xfer);
 
 	return 0;
@@ -1382,9 +1381,6 @@ siisata_bio_complete(struct ata_channel 
 	if (ata_waitdrain_xfer_check(chp, xfer))
 		return 0;
 
-	siisata_deactivate_prb(schp, xfer->c_slot);
-	ata_deactivate_xfer(chp, xfer);
-
 	if (xfer->c_flags & C_TIMEOU) {
 		ata_bio->error = TIMEOUT;
 	}
@@ -1414,6 +1410,10 @@ siisata_bio_complete(struct ata_channel 
 			ata_bio->bcount = 0;
 	}
 	

CVS commit: [jdolecek-ncqfixes] src/sys/dev/ic

2018-09-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Sep  1 10:13:41 UTC 2018

Modified Files:
src/sys/dev/ic [jdolecek-ncqfixes]: ahcisata_core.c siisata.c

Log Message:
only call ata_deactivate_xfer() once completely done with the active
xfer in controller code (i.e. after bus_dmamap_sync() et.al.), so that
the command slot is safe to be reused immediatelly after deactivate


To generate a diff of this commit:
cvs rdiff -u -r1.62.2.1 -r1.62.2.2 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.35.6.1 -r1.35.6.2 src/sys/dev/ic/siisata.c

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



CVS commit: src/sys/dev/usb

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 09:57:13 UTC 2018

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

Log Message:
fix diagnostic build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/if_mue.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/if_mue.c
diff -u src/sys/dev/usb/if_mue.c:1.5 src/sys/dev/usb/if_mue.c:1.6
--- src/sys/dev/usb/if_mue.c:1.5	Fri Aug 31 11:21:00 2018
+++ src/sys/dev/usb/if_mue.c	Sat Sep  1 09:57:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mue.c,v 1.5 2018/08/31 11:21:00 rin Exp $	*/
+/*	$NetBSD: if_mue.c,v 1.6 2018/09/01 09:57:12 mlelstv Exp $	*/
 /*	$OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Driver for Microchip LAN7500/LAN7800 chipsets. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.5 2018/08/31 11:21:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.6 2018/09/01 09:57:12 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1229,8 +1229,8 @@ mue_encap(struct mue_softc *sc, struct m
 	memcpy(c->mue_buf, , sizeof(hdr)); 
 	len = sizeof(hdr);
 
-	KASSERTMSG(len + m->m_pkthdr.len <= sc->mue_txbufsz, "%d <= %u",
-	len + m->m_pkthdr.len, sc->mue_txbufsz);
+	KASSERTMSG((unsigned)(len + m->m_pkthdr.len) <= sc->mue_txbufsz,
+	"%d <= %u", len + m->m_pkthdr.len, sc->mue_txbufsz);
 
 	m_copydata(m, 0, m->m_pkthdr.len, c->mue_buf + len);
 	len += m->m_pkthdr.len;
@@ -1284,7 +1284,7 @@ mue_tx_offload(struct mue_softc *sc, str
 		hlen += M_CSUM_DATA_IPv4_IPHL(m->m_pkthdr.csum_data);
 	else
 		hlen += M_CSUM_DATA_IPv6_IPHL(m->m_pkthdr.csum_data);
-	KASSERT(m->m_len >= hlen + sizeof(struct tcphdr));
+	KASSERT(m->m_len >= (int)(hlen + sizeof(struct tcphdr)));
 #endif
 
 	/* Packet length should be cleared. */



CVS commit: src/sys/dev/usb

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 09:57:13 UTC 2018

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

Log Message:
fix diagnostic build.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/if_mue.c

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



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-09-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Sep  1 09:48:32 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c wd.c

Log Message:
stop assuming c_slot is immutable, use the xfer pointer rather than c_slot
in printfs()


To generate a diff of this commit:
cvs rdiff -u -r1.141.6.1 -r1.141.6.2 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.441.2.1 -r1.441.2.2 src/sys/dev/ata/wd.c

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



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-09-01 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Sep  1 09:48:32 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c wd.c

Log Message:
stop assuming c_slot is immutable, use the xfer pointer rather than c_slot
in printfs()


To generate a diff of this commit:
cvs rdiff -u -r1.141.6.1 -r1.141.6.2 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.441.2.1 -r1.441.2.2 src/sys/dev/ata/wd.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141.6.1 src/sys/dev/ata/ata.c:1.141.6.2
--- src/sys/dev/ata/ata.c:1.141.6.1	Fri Aug 31 19:08:03 2018
+++ src/sys/dev/ata/ata.c	Sat Sep  1 09:48:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141.6.1 2018/08/31 19:08:03 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.2 2018/09/01 09:48:32 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.1 2018/08/31 19:08:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.2 2018/09/01 09:48:32 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -1370,8 +1370,7 @@ ata_timo_xfer_check(struct ata_xfer *xfe
 			ata_channel_unlock(chp);
 
 			aprint_normal_dev(drvp->drv_softc,
-			"xfer %d freed while invoking timeout\n",
-			xfer->c_slot); 
+			"xfer %p freed while invoking timeout\n", xfer); 
 
 			ata_free_xfer(chp, xfer);
 			return true;
@@ -1381,8 +1380,7 @@ ata_timo_xfer_check(struct ata_xfer *xfe
 		ata_channel_unlock(chp);
 
 		aprint_normal_dev(drvp->drv_softc,
-		"xfer %d deactivated while invoking timeout\n",
-		xfer->c_slot); 
+		"xfer %p deactivated while invoking timeout\n", xfer); 
 		return true;
 	}
 

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.441.2.1 src/sys/dev/ata/wd.c:1.441.2.2
--- src/sys/dev/ata/wd.c:1.441.2.1	Fri Aug 31 19:08:03 2018
+++ src/sys/dev/ata/wd.c	Sat Sep  1 09:48:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.441.2.1 2018/08/31 19:08:03 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.441.2.2 2018/09/01 09:48:32 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.1 2018/08/31 19:08:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.2 2018/09/01 09:48:32 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -660,8 +660,8 @@ wdstart1(struct wd_softc *wd, struct buf
 	 */
 	if (BUF_ISREAD(bp) && xfer->c_retries == 0 && wd->drv_chaos_freq > 0 &&
 	(++wd->drv_chaos_cnt % wd->drv_chaos_freq) == 0) {
-		aprint_normal_dev(dksc->sc_dev, "%s: chaos xfer %d\n",
-		__func__, xfer->c_slot);
+		aprint_normal_dev(dksc->sc_dev, "%s: chaos xfer %p\n",
+		__func__, xfer);
 		xfer->c_bio.blkno = 777 + wd->sc_capacity;
 		xfer->c_flags |= C_CHAOS;
 	}
@@ -852,7 +852,7 @@ retry2:
 		diskerr(bp, "wd", errmsg, LOG_PRINTF,
 		xfer->c_bio.blkdone, dksc->sc_dkdev.dk_label);
 		if (xfer->c_retries < WDIORETRIES)
-			printf(", slot %d, retry %d", xfer->c_slot,
+			printf(", xfer %p, retry %d", xfer,
 			xfer->c_retries + 1);
 		printf("\n");
 		if (do_perror)
@@ -916,7 +916,7 @@ out:
 	case NOERROR:
 noerror:	if ((xfer->c_bio.flags & ATA_CORR) || xfer->c_retries > 0)
 			aprint_error_dev(dksc->sc_dev,
-			"soft error (corrected) slot %d\n", xfer->c_slot);
+			"soft error (corrected) xfer %p\n", xfer);
 #ifdef WD_CHAOS_MONKEY
 		KASSERT((xfer->c_flags & C_CHAOS) == 0);
 #endif



CVS commit: src/bin/mt

2018-09-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep  1 07:26:56 UTC 2018

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

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/mt/mt.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/mt/mt.1
diff -u src/bin/mt/mt.1:1.37 src/bin/mt/mt.1:1.38
--- src/bin/mt/mt.1:1.37	Sat Sep  1 06:56:23 2018
+++ src/bin/mt/mt.1	Sat Sep  1 07:26:56 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mt.1,v 1.37 2018/09/01 06:56:23 mlelstv Exp $
+.\"	$NetBSD: mt.1,v 1.38 2018/09/01 07:26:56 wiz Exp $
 .\"
 .\" Copyright (c) 1981, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)mt.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd March 9, 2008
+.Dd September 1, 2018
 .Dt MT 1
 .Os
 .Sh NAME



CVS commit: src/bin/mt

2018-09-01 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Sep  1 07:26:56 UTC 2018

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

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/bin/mt/mt.1

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



CVS commit: src/sys/dev/scsipi

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 07:20:29 UTC 2018

Modified Files:
src/sys/dev/scsipi: scsiconf.c scsipiconf.h

Log Message:
Wait in detach if the discovery thread is still running. Avoids crashes
when a device is attached/detached rapidly.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/dev/scsipi/scsiconf.c
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/scsipi/scsipiconf.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/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.280 src/sys/dev/scsipi/scsiconf.c:1.281
--- src/sys/dev/scsipi/scsiconf.c:1.280	Sat Jun 17 22:35:50 2017
+++ src/sys/dev/scsipi/scsiconf.c	Sat Sep  1 07:20:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsiconf.c,v 1.280 2017/06/17 22:35:50 mlelstv Exp $	*/
+/*	$NetBSD: scsiconf.c,v 1.281 2018/09/01 07:20:29 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.280 2017/06/17 22:35:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.281 2018/09/01 07:20:29 mlelstv Exp $");
 
 #include 
 #include 
@@ -270,7 +270,7 @@ scsibusattach(device_t parent, device_t 
  * Create the discover thread
  */
 if (kthread_create(PRI_NONE, 0, NULL, scsibus_discover_thread, sc,
-NULL, "%s-d", chan->chan_name)) {
+>chan_dthread, "%s-d", chan->chan_name)) {
 aprint_error_dev(sc->sc_dev, "unable to create discovery "
 		"thread for channel %d\n", chan->chan_channel);
 return;
@@ -283,6 +283,7 @@ scsibus_discover_thread(void *arg)
 	struct scsibus_softc *sc = arg;
 
 	scsibus_config(sc);
+	sc->sc_channel->chan_dthread = NULL;
 	kthread_exit(0);
 }
 
@@ -336,6 +337,12 @@ scsibusdetach(device_t self, int flags)
 	int error;
 
 	/*
+	 * Defer while discovery thread is running
+	 */
+	while (chan->chan_dthread != NULL)
+		kpause("scsibusdet", false, hz, NULL);
+
+	/*
 	 * Detach all of the periphs.
 	 */
 	error = scsipi_target_detach(chan, -1, -1, flags);
@@ -415,6 +422,7 @@ scsi_probe_bus(struct scsibus_softc *sc,
 		 */
 		scsipi_set_xfer_mode(chan, target, 1);
 	}
+
 	scsipi_adapter_delref(chan->chan_adapter);
 ret:
 	return (error);

Index: src/sys/dev/scsipi/scsipiconf.h
diff -u src/sys/dev/scsipi/scsipiconf.h:1.127 src/sys/dev/scsipi/scsipiconf.h:1.128
--- src/sys/dev/scsipi/scsipiconf.h:1.127	Wed Jul  4 03:17:01 2018
+++ src/sys/dev/scsipi/scsipiconf.h	Sat Sep  1 07:20:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipiconf.h,v 1.127 2018/07/04 03:17:01 kamil Exp $	*/
+/*	$NetBSD: scsipiconf.h,v 1.128 2018/09/01 07:20:29 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2004 The NetBSD Foundation, Inc.
@@ -289,6 +289,7 @@ struct scsipi_channel {
 
 	int	chan_defquirks;		/* default device's quirks */
 
+	struct lwp *chan_dthread;	/* discovery thread */
 	struct lwp *chan_thread;	/* completion thread */
 	int	chan_tflags;		/* flags for the completion thread */
 



CVS commit: src/sys/dev/scsipi

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 07:20:29 UTC 2018

Modified Files:
src/sys/dev/scsipi: scsiconf.c scsipiconf.h

Log Message:
Wait in detach if the discovery thread is still running. Avoids crashes
when a device is attached/detached rapidly.


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/dev/scsipi/scsiconf.c
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/scsipi/scsipiconf.h

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



CVS commit: src/sys/dev/scsipi

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 07:19:19 UTC 2018

Modified Files:
src/sys/dev/scsipi: atapi_wdc.c

Log Message:
Make wdcdebug_atapi_mask configurable like the other debug variables.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/scsipi/atapi_wdc.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/scsipi/atapi_wdc.c
diff -u src/sys/dev/scsipi/atapi_wdc.c:1.129 src/sys/dev/scsipi/atapi_wdc.c:1.130
--- src/sys/dev/scsipi/atapi_wdc.c:1.129	Tue Oct 17 18:52:51 2017
+++ src/sys/dev/scsipi/atapi_wdc.c	Sat Sep  1 07:19:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: atapi_wdc.c,v 1.129 2017/10/17 18:52:51 jdolecek Exp $	*/
+/*	$NetBSD: atapi_wdc.c,v 1.130 2018/09/01 07:19:19 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.129 2017/10/17 18:52:51 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,v 1.130 2018/09/01 07:19:19 mlelstv Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -67,7 +67,10 @@ __KERNEL_RCSID(0, "$NetBSD: atapi_wdc.c,
 #define DEBUG_FUNCS  0x08
 #define DEBUG_PROBE  0x10
 #ifdef ATADEBUG
-int wdcdebug_atapi_mask = 0;
+#ifndef ATADEBUG_ATAPI_MASK
+#define ATADEBUG_ATAPI_MASK 0x0
+#endif
+int wdcdebug_atapi_mask = ATADEBUG_ATAPI_MASK;
 #define ATADEBUG_PRINT(args, level) \
 	if (wdcdebug_atapi_mask & (level)) \
 		printf args



CVS commit: src/sys/dev/scsipi

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 07:19:19 UTC 2018

Modified Files:
src/sys/dev/scsipi: atapi_wdc.c

Log Message:
Make wdcdebug_atapi_mask configurable like the other debug variables.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/scsipi/atapi_wdc.c

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



CVS commit: src/bin/mt

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 06:56:23 UTC 2018

Modified Files:
src/bin/mt: mt.1 mt.c

Log Message:
Make tape cache ioctls available to userland command.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/mt/mt.1
cvs rdiff -u -r1.47 -r1.48 src/bin/mt/mt.c

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

Modified files:

Index: src/bin/mt/mt.1
diff -u src/bin/mt/mt.1:1.36 src/bin/mt/mt.1:1.37
--- src/bin/mt/mt.1:1.36	Mon Mar 19 10:48:20 2012
+++ src/bin/mt/mt.1	Sat Sep  1 06:56:23 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mt.1,v 1.36 2012/03/19 10:48:20 njoly Exp $
+.\"	$NetBSD: mt.1,v 1.37 2018/09/01 06:56:23 mlelstv Exp $
 .\"
 .\" Copyright (c) 1981, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -184,6 +184,10 @@ If
 is zero, disable compression.
 Otherwise enable compression.
 Not all tape drives support this feature.
+.It Cm cache
+Enable controller buffering.
+.It Cm nocache
+Disable controller buffering.
 .El
 .Pp
 If a tape name is not specified, and the environment variable

Index: src/bin/mt/mt.c
diff -u src/bin/mt/mt.c:1.47 src/bin/mt/mt.c:1.48
--- src/bin/mt/mt.c:1.47	Mon Aug 29 14:46:01 2011
+++ src/bin/mt/mt.c	Sat Sep  1 06:56:23 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mt.c,v 1.47 2011/08/29 14:46:01 joerg Exp $ */
+/* $NetBSD: mt.c,v 1.48 2018/09/01 06:56:23 mlelstv Exp $ */
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)mt.c	8.2 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: mt.c,v 1.47 2011/08/29 14:46:01 joerg Exp $");
+__RCSID("$NetBSD: mt.c,v 1.48 2018/09/01 06:56:23 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -101,6 +101,8 @@ static const struct commands com[] = {
 	{ CMD("status"),	MTIOCGET, MTNOP,  1,  0 },
 	{ CMD("weof"),		MTIOCTOP, MTWEOF, 0,  1 },
 	{ CMD("eew"),		MTIOCTOP, MTEWARN,1,  0 },
+	{ CMD("cache"),		MTIOCTOP, MTCACHE,1,  0 },
+	{ CMD("nocache"),	MTIOCTOP, MTNOCACHE,  1,  0 },
 	{ .c_name = NULL }
 };
 



CVS commit: src/bin/mt

2018-09-01 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep  1 06:56:23 UTC 2018

Modified Files:
src/bin/mt: mt.1 mt.c

Log Message:
Make tape cache ioctls available to userland command.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/mt/mt.1
cvs rdiff -u -r1.47 -r1.48 src/bin/mt/mt.c

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



CVS commit: [netbsd-8] src/doc

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:35:20 UTC 2018

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

Log Message:
Tickets #996 - #1003


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.17 src/doc/CHANGES-8.1:1.1.2.18
--- src/doc/CHANGES-8.1:1.1.2.17	Tue Aug 28 16:25:19 2018
+++ src/doc/CHANGES-8.1	Sat Sep  1 06:35:20 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.17 2018/08/28 16:25:19 snj Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.18 2018/09/01 06:35:20 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -658,3 +658,72 @@ sys/arch/prep/prep/mainbus.c			1.34
 	Model 6015.
 	[martin, ticket #994]
 
+sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.c 1.5-1.9
+sys/external/bsd/drm2/dist/drm/nouveau/nouveau_fence.h 1.3-1.5
+sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv84_fence.c 1.3
+
+	Rewrite nouveau_fence in an attempt to make it make sense.
+	Fences may last longer than their channels.
+	Fix return values.
+	[riastradh, ticket #996]
+
+sys/external/bsd/common/include/linux/kernel.h	1.9
+sys/external/bsd/drm2/i915drm/intel_gtt.c	1.6
+sys/external/bsd/drm2/include/linux/bitops.h	1.12
+sys/external/bsd/drm2/include/linux/bitops.h	1.13
+sys/external/bsd/drm2/include/linux/delay.h	1.5
+sys/external/bsd/drm2/include/linux/vmalloc.h	1.5
+
+	Change hweight32 to take a uint32_t arg.
+	Fix find_first_zero_bit to find the high bits of 64-bit words.
+	Use uvm_km_alloc(kernel_map) and pmap_kenter, not uvm_pagermapin.
+	Flush chipset writes after GGTT update.
+	Round nsec up for usec delay.
+	libkern min/max is 32-bit.  Linux min/max is generic.
+	[riastradh, ticket #997]
+
+sys/dev/pci/agp_i810.c1.123
+sys/dev/pci/agp_i810var.h			1.7
+sys/external/bsd/drm2/i915drm/intel_gtt.c	1.7
+
+	Restore gtt page table control register on resume.
+	[riastradh, ticket #998]
+
+sys/dev/fss.c	1.105,1.106
+sys/dev/fssvar.h1.30,1.31
+
+	Change fss ioctl to no longer block while a snapshot gets
+	created or destroyed.
+	[hannken, ticket #999]
+
+sys/kern/vfs_bio.c1.277
+
+	Fix deadlock with getnewbuf().
+	[hannken, ticket #1000]
+
+usr.sbin/npf/npfctl/npf.conf.5			1.49,1.50(partly),
+		1.51-1.70 (patch)
+
+	Various improvements to the npf.conf(5) man page.
+	[maxv, ticket #1001]
+
+usr.bin/printf/printf.11.31 (patch)
+usr.bin/printf/printf.c1.43
+
+	Allow signed numbers as inputs for all integer formats, including
+	those which treat the data as unsigned.
+	[kre, ticket #1002]
+
+sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	1.2
+sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c 1.8
+sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c	1.10
+sys/external/bsd/drm2/drm/drm_scatter.c		1.4
+sys/external/bsd/drm2/linux/linux_idr.c		1.6
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.3,1.4
+
+	Miscelaneous minor improvements to DRM/KMS.
+	The state in netbsd-8 now matches HEAD before the
+	Linux 4.4 drm import, with the exception of Tegra (arm)
+	specific code.
+	[riastradh, ticket #1003]
+



CVS commit: [netbsd-8] src/doc

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:35:20 UTC 2018

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

Log Message:
Tickets #996 - #1003


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/doc/CHANGES-8.1

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



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

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:34:00 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-8]: i915_reg.h
intel_sdvo.c
src/sys/external/bsd/drm2/dist/drm/ttm [netbsd-8]: ttm_tt.c
src/sys/external/bsd/drm2/drm [netbsd-8]: drm_scatter.c
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_idr.c
linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1003):

sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c: revision 1.8
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c: revision 1.10
sys/external/bsd/drm2/drm/drm_scatter.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.2
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.3
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.4
sys/external/bsd/drm2/linux/linux_idr.c: revision 1.6

Pull in upstream commit:
Author: Ville Syrj=E4l=E4 
Date:   Mon Jun 9 16:20:46 2014 +0300
drm/i915: Avoid div-by-zero when pixel_multiplier is zero
On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disabled
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3D76520
Tweak slightly sketchy logic in linux_idr.
1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.
Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.
Fix error branch in ttm_dma_tt_init to avoid double-free.
Should fix symptom of PR kern/52438, but who knows what underlying
problem causes us to reach the error branch in the first place.
Fix lockdebug_locked annotations.
When thread A grants ownership to thread B waiting with a context,
thread B needs to assert lockdebug_locked; otherwise, when it
releases, lockdebug_unlocked thinks it's releasing an unlocked
ww_mutex.

Fixes LOCKDEBUG failure with radeon noticed by martin@.

more const

XXX: add a NULL init to avoid a GCC 6 maybe uninit warning.

Remove UB from definition of symbols in i915_reg.h
Kernel Undefined Behavior Sanitizer enforces more warnings in build time.
This makes the build fatal in the drm/i915 code in:
 - intel_ddi_put_crtc_pll(),
 - intel_ddi_clock_get(),
 - intel_ddi_pll_enable(),
 - intel_ddi_setup_hw_pll_state().
The error message in all the cases says:
  error: case label does not reduce to an integer constant
Set the type of the value left shifted to unsigned.
This change is required to build NetBSD/amd64 with KUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.22.1 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.7 -r1.7.10.1 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/external/bsd/drm2/drm/drm_scatter.c
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/external/bsd/drm2/linux/linux_idr.c
cvs rdiff -u -r1.2 -r1.2.10.1 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.1.1.2 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.1.1.2.22.1
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.1.1.2	Wed Jul 16 19:35:25 2014
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Sat Sep  1 06:34:00 2018
@@ -5426,10 +5426,10 @@ enum punit_power_well {
 #define  PORT_CLK_SEL_LCPLL_1350	(1<<29)
 #define  PORT_CLK_SEL_LCPLL_810		(2<<29)
 #define  PORT_CLK_SEL_SPLL		(3<<29)
-#define  PORT_CLK_SEL_WRPLL1		(4<<29)
-#define  PORT_CLK_SEL_WRPLL2		(5<<29)
-#define  PORT_CLK_SEL_NONE		(7<<29)
-#define  PORT_CLK_SEL_MASK		(7<<29)
+#define  PORT_CLK_SEL_WRPLL1		(4U<<29)
+#define  PORT_CLK_SEL_WRPLL2		(5U<<29)
+#define  PORT_CLK_SEL_NONE		(7U<<29)
+#define  PORT_CLK_SEL_MASK		(7U<<29)
 
 /* Transcoder clock selection */
 #define TRANS_CLK_SEL_A			0x46140

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7 src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7.10.1
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c:1.7	Tue Oct 27 13:16:33 2015
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c	Sat Sep  1 06:34:00 2018
@@ -1391,7 +1391,10 @@ static void intel_sdvo_get_config(struct
 			 >> SDVO_PORT_MULTIPLY_SHIFT) + 1;
 	}
 
-	dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
+	dotclock = 

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

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:34:00 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915 [netbsd-8]: i915_reg.h
intel_sdvo.c
src/sys/external/bsd/drm2/dist/drm/ttm [netbsd-8]: ttm_tt.c
src/sys/external/bsd/drm2/drm [netbsd-8]: drm_scatter.c
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_idr.c
linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1003):

sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c: revision 1.8
sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c: revision 1.10
sys/external/bsd/drm2/drm/drm_scatter.c: revision 1.4
sys/external/bsd/drm2/dist/drm/i915/i915_reg.h: revision 1.2
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.3
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.4
sys/external/bsd/drm2/linux/linux_idr.c: revision 1.6

Pull in upstream commit:
Author: Ville Syrj=E4l=E4 
Date:   Mon Jun 9 16:20:46 2014 +0300
drm/i915: Avoid div-by-zero when pixel_multiplier is zero
On certain platforms pixel_multiplier is read out in
.get_pipe_config(), but it also gets used to calculate the
pixel clock in intel_sdvo_get_config(). If the pipe is disabled
but some SDVO outputs are active, we may end up dividing by zero
in intel_sdvo_get_config().
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=3D76520
Tweak slightly sketchy logic in linux_idr.
1. idr_preload can fail if you don't set __GFP_WAIT.
2. If idr_preload fails, it is wrong for idr_alloc to assert.
3. There is no way for idr_alloc to know what flags idr_preload got.
Probably won't *fix* any bugs, but if there is a bug with a missing
__GFP_WAIT, then we will learn about a trifle sooner.
Fix error branch in ttm_dma_tt_init to avoid double-free.
Should fix symptom of PR kern/52438, but who knows what underlying
problem causes us to reach the error branch in the first place.
Fix lockdebug_locked annotations.
When thread A grants ownership to thread B waiting with a context,
thread B needs to assert lockdebug_locked; otherwise, when it
releases, lockdebug_unlocked thinks it's releasing an unlocked
ww_mutex.

Fixes LOCKDEBUG failure with radeon noticed by martin@.

more const

XXX: add a NULL init to avoid a GCC 6 maybe uninit warning.

Remove UB from definition of symbols in i915_reg.h
Kernel Undefined Behavior Sanitizer enforces more warnings in build time.
This makes the build fatal in the drm/i915 code in:
 - intel_ddi_put_crtc_pll(),
 - intel_ddi_clock_get(),
 - intel_ddi_pll_enable(),
 - intel_ddi_setup_hw_pll_state().
The error message in all the cases says:
  error: case label does not reduce to an integer constant
Set the type of the value left shifted to unsigned.
This change is required to build NetBSD/amd64 with KUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.22.1 \
src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.7 -r1.7.10.1 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_sdvo.c
cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/external/bsd/drm2/drm/drm_scatter.c
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/external/bsd/drm2/linux/linux_idr.c
cvs rdiff -u -r1.2 -r1.2.10.1 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-8] src/usr.bin/printf

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:28:23 UTC 2018

Modified Files:
src/usr.bin/printf [netbsd-8]: printf.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1002):

usr.bin/printf/printf.1: revision 1.31 (via patch)
usr.bin/printf/printf.c: revision 1.43

PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.37.8.1 -r1.37.8.2 src/usr.bin/printf/printf.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/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.37.8.1 src/usr.bin/printf/printf.c:1.37.8.2
--- src/usr.bin/printf/printf.c:1.37.8.1	Fri Jul 13 15:58:25 2018
+++ src/usr.bin/printf/printf.c	Sat Sep  1 06:28:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.37.8.1 2018/07/13 15:58:25 martin Exp $	*/
+/*	$NetBSD: printf.c,v 1.37.8.2 2018/09/01 06:28:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)printf.c	8.2 (Berkeley) 3/22/95";
 #else
-__RCSID("$NetBSD: printf.c,v 1.37.8.1 2018/07/13 15:58:25 martin Exp $");
+__RCSID("$NetBSD: printf.c,v 1.37.8.2 2018/09/01 06:28:23 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,7 +72,6 @@ static char	 getchr(void);
 static double	 getdouble(void);
 static int	 getwidth(void);
 static intmax_t	 getintmax(void);
-static uintmax_t getuintmax(void);
 static char	*getstr(void);
 static char	*mklong(const char *, char);
 static void  check_conversion(const char *, const char *);
@@ -286,7 +285,7 @@ int main(int argc, char *argv[])
 			case 'u':
 			case 'x':
 			case 'X': {
-uintmax_t p = getuintmax();
+uintmax_t p = (uintmax_t)getintmax();
 char *f = mklong(start, ch);
 PF(f, p);
 if (error < 0)
@@ -633,35 +632,6 @@ getintmax(void)
 	return val;
 }
 
-static uintmax_t
-getuintmax(void)
-{
-	uintmax_t val;
-	char *cp, *ep;
-
-	cp = *gargv;
-	if (cp == NULL)
-		return 0;
-	gargv++;
-
-	if (*cp == '\"' || *cp == '\'')
-		return (uintmax_t)*(cp + 1);
-
-	/* strtoumax won't error -ve values */
-	while (isspace(*(unsigned char *)cp))
-		cp++;
-	if (*cp == '-') {
-		warnx("%s: expected positive numeric value", cp);
-		rval = 1;
-		return 0;
-	}
-
-	errno = 0;
-	val = strtoumax(cp, , 0);
-	check_conversion(cp, ep);
-	return val;
-}
-
 static double
 getdouble(void)
 {



CVS commit: [netbsd-8] src/usr.bin/printf

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:28:23 UTC 2018

Modified Files:
src/usr.bin/printf [netbsd-8]: printf.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1002):

usr.bin/printf/printf.1: revision 1.31 (via patch)
usr.bin/printf/printf.c: revision 1.43

PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.37.8.1 -r1.37.8.2 src/usr.bin/printf/printf.c

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



CVS commit: [netbsd-8] src/usr.bin/printf

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:27:12 UTC 2018

Modified Files:
src/usr.bin/printf [netbsd-8]: printf.1

Log Message:
Pull up following revision(s) (requested by kre in ticket #1002):

usr.bin/printf/printf.1: revision 1.31 (via patch)
usr.bin/printf/printf.c: revision 1.43 (via patch)

PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.16.1 src/usr.bin/printf/printf.1

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



CVS commit: [netbsd-8] src/usr.bin/printf

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:27:12 UTC 2018

Modified Files:
src/usr.bin/printf [netbsd-8]: printf.1

Log Message:
Pull up following revision(s) (requested by kre in ticket #1002):

usr.bin/printf/printf.1: revision 1.31 (via patch)
usr.bin/printf/printf.c: revision 1.43 (via patch)

PR standards/53563

POSIX requires that signed numbers (strings preceded by '+' or '-')
be allowed as inputs to all of the integer format conversions, including
those which treat the data as unsigned.

Hence we do not need a variant function whose only difference from its
companion is to reject strings starting with '-' - instead we use
the primary function (getintmax()) for everything and remove getuintmax().

Minor update to the man page to indicate that the arg to all of the
integer conversions (diouxX) must be an integer constant (with an
optional sign) and to make it blatantly clear that %o is octal and
%u is unsigned decimal (for some reason those weren't explicitly stated
unlike d i x and X).  Delete "respectively", it is not needed (and does
not really apply).

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.16.1 src/usr.bin/printf/printf.1

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/printf/printf.1
diff -u src/usr.bin/printf/printf.1:1.25 src/usr.bin/printf/printf.1:1.25.16.1
--- src/usr.bin/printf/printf.1:1.25	Sun Apr 13 01:45:34 2014
+++ src/usr.bin/printf/printf.1	Sat Sep  1 06:27:12 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: printf.1,v 1.25 2014/04/13 01:45:34 snj Exp $
+.\"	$NetBSD: printf.1,v 1.25.16.1 2018/09/01 06:27:12 martin Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\"	from: @(#)printf.1	8.1 (Berkeley) 6/6/93
 .\"
-.Dd May 6, 2008
+.Dd August 31, 2018
 .Dt PRINTF 1
 .Os
 .Sh NAME
@@ -257,9 +257,12 @@ The format characters and their meanings
 .Bl -tag -width Fl
 .It Cm diouXx
 The
-.Ar argument
-is printed as a signed decimal (d or i), unsigned octal, unsigned decimal,
-or unsigned hexadecimal (X or x), respectively.
+.Ar argument ,
+which must represent an integer constant,
+with an optional leading plus or minus sign,
+is printed as a signed decimal (d or i),
+unsigned octal (o), unsigned decimal (u),
+or unsigned hexadecimal (X or x).
 .It Cm f
 The
 .Ar argument



CVS commit: [netbsd-8] src/usr.sbin/npf/npfctl

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:19:12 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl [netbsd-8]: npf.conf.5

Log Message:
Sync the following with -current, with minor modifications as the
"[ map-flags ]" feature is not available in netbsd-8, requested by
maxv in ticket #1001:

usr.sbin/npf/npfctl/npf.conf.5  1.49,1.50(partly),1.51-1.70 (via patch)

Remove workaround for ancient HTML generation code.

 -

npfctl: add support for the 'no-ports' flag in the 'map' statements.
This allows us to create a NAT policy without the port translation.

 -

Remove superfluous Pp.

 -

First pass at editing this manual.
Add a link to the NPF documentation website and refer to it.
Switch the multiple structural elements to a list to make it easier to read and
extend.
Clarify tables, re-order so all terms are before the example.
Clarify obtaining addresses per family
Move the minimum requirement for a default group to the group section.

 -

Add missing El. Remove trailing whitespace.

 -

Enlighten the "Procedures" section. In particular document the "no-df"
option. Also replace "normalisation" -> "normalization", to match the
name of the rule.

 -

Add quotes around the option names, to match the actual npf conf.

 -

Improve the "Rules" section: better explain the "final" keyword (it is
the same as PF's "quick", so use the same wording), and document the
"return" options.

While here simplify the man code, suggested by wiz.

 -

Document the "flags" keyword.

 -

Improve the "Map" section a little.

 -

Improve wording.

 -

Replace () by [] in tcp-flags.

Fix proc-opts, the value is optional, noted by he@.

 -

Replace "rproc"->"proc" in the grammar (spotted by he@), and slightly
reword.

 -

Add missing quote in static-rule, it causes man-k.org (and other tools)
to wrongly highlight the grammar.

 -

Add the values of "algo" in the grammar, and use # as comment marker for
man-k.org (and others) not to highlight things in an incorrect way.

 -

Document ALGs.

 -

Improve the "Map" section.

 -

Add missing -width; remove unnecessary .Pp.

 -

Clarify the "Groups" section.

 -

should be port-opts

 -

"interface" already contains "var-name", so don't mention it in "filt-addr",
that's redundant

 -

rename net-seg -> map-seg, and document it


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.4.1 src/usr.sbin/npf/npfctl/npf.conf.5

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

Modified files:

Index: src/usr.sbin/npf/npfctl/npf.conf.5
diff -u src/usr.sbin/npf/npfctl/npf.conf.5:1.48 src/usr.sbin/npf/npfctl/npf.conf.5:1.48.4.1
--- src/usr.sbin/npf/npfctl/npf.conf.5:1.48	Fri Jan 20 08:48:14 2017
+++ src/usr.sbin/npf/npfctl/npf.conf.5	Sat Sep  1 06:19:12 2018
@@ -1,4 +1,4 @@
-.\"$NetBSD: npf.conf.5,v 1.48 2017/01/20 08:48:14 wiz Exp $
+.\"$NetBSD: npf.conf.5,v 1.48.4.1 2018/09/01 06:19:12 martin Exp $
 .\"
 .\" Copyright (c) 2009-2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 19, 2017
+.Dd August 31, 2018
 .Dt NPF.CONF 5
 .Os
 .Sh NAME
@@ -40,31 +40,32 @@ is the default configuration file for th
 .Pp
 This manual page serves as a reference for editing
 .Nm .
-Please refer to the official NPF documentation for comprehensive and
+Please refer to the official NPF documentation website for comprehensive and
 in-depth information.
 .Pp
-There are multiple structural elements
+There are multiple structural elements that
 .Nm
-may contain:
-.Cd variable
-and
-.Cd table
-definitions (with or without content), abstraction
-.Cd groups ,
-packet filtering
-.Cd rules ,
-.Cd map
-rules for address translation and
-.Cd procedure
-definitions to call on filtered packets.
-The minimal
-.Nm
-must contain a mandatory
-.Cd default group .
+may contain, such as:
+.Bl -bullet -offset indent
+.It
+variables
+.It
+table definitions (with or without content)
+.It
+abstraction groups
+.It
+packet filtering rules
+.It
+map rules for address translation
+.It
+application level gateways
+.It
+procedure definitions to call on filtered packets.
+.El
 .Sh SYNTAX
 .Ss Variables
-Variables are specified using the dollar ($) sign, which is used both
-in definitions and uses of a variable.
+Variables are specified using the dollar ($) sign, which is used for both
+definition and referencing of a variable.
 Variables are defined by assigning a value to them as follows:
 .Bd -literal
 $var1 = 10.0.0.1
@@ -79,33 +80,34 @@ Common variable definitions are for IP a
 and interfaces.
 .Ss Tables
 Tables are specified using a name between angle brackets
-\*[Lt] and \*[Gt].
+< and >.
 The following is an example of table definition:
 .Bd -literal
 table  type hash dynamic
 .Pp
 .Ed
-Currently, tables support three storage types: "hash", "tree", or "cdb".
-They can 

CVS commit: [netbsd-8] src/usr.sbin/npf/npfctl

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:19:12 UTC 2018

Modified Files:
src/usr.sbin/npf/npfctl [netbsd-8]: npf.conf.5

Log Message:
Sync the following with -current, with minor modifications as the
"[ map-flags ]" feature is not available in netbsd-8, requested by
maxv in ticket #1001:

usr.sbin/npf/npfctl/npf.conf.5  1.49,1.50(partly),1.51-1.70 (via patch)

Remove workaround for ancient HTML generation code.

 -

npfctl: add support for the 'no-ports' flag in the 'map' statements.
This allows us to create a NAT policy without the port translation.

 -

Remove superfluous Pp.

 -

First pass at editing this manual.
Add a link to the NPF documentation website and refer to it.
Switch the multiple structural elements to a list to make it easier to read and
extend.
Clarify tables, re-order so all terms are before the example.
Clarify obtaining addresses per family
Move the minimum requirement for a default group to the group section.

 -

Add missing El. Remove trailing whitespace.

 -

Enlighten the "Procedures" section. In particular document the "no-df"
option. Also replace "normalisation" -> "normalization", to match the
name of the rule.

 -

Add quotes around the option names, to match the actual npf conf.

 -

Improve the "Rules" section: better explain the "final" keyword (it is
the same as PF's "quick", so use the same wording), and document the
"return" options.

While here simplify the man code, suggested by wiz.

 -

Document the "flags" keyword.

 -

Improve the "Map" section a little.

 -

Improve wording.

 -

Replace () by [] in tcp-flags.

Fix proc-opts, the value is optional, noted by he@.

 -

Replace "rproc"->"proc" in the grammar (spotted by he@), and slightly
reword.

 -

Add missing quote in static-rule, it causes man-k.org (and other tools)
to wrongly highlight the grammar.

 -

Add the values of "algo" in the grammar, and use # as comment marker for
man-k.org (and others) not to highlight things in an incorrect way.

 -

Document ALGs.

 -

Improve the "Map" section.

 -

Add missing -width; remove unnecessary .Pp.

 -

Clarify the "Groups" section.

 -

should be port-opts

 -

"interface" already contains "var-name", so don't mention it in "filt-addr",
that's redundant

 -

rename net-seg -> map-seg, and document it


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.4.1 src/usr.sbin/npf/npfctl/npf.conf.5

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



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

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:04:16 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: vfs_bio.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1000):

sys/kern/vfs_bio.c: revision 1.277

Make sure getnewbuf() runs bawrite() inside fstrans.

Use fstrans_start_nowait() to skip buffers that would block.


To generate a diff of this commit:
cvs rdiff -u -r1.273.2.1 -r1.273.2.2 src/sys/kern/vfs_bio.c

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



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

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:04:16 UTC 2018

Modified Files:
src/sys/kern [netbsd-8]: vfs_bio.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1000):

sys/kern/vfs_bio.c: revision 1.277

Make sure getnewbuf() runs bawrite() inside fstrans.

Use fstrans_start_nowait() to skip buffers that would block.


To generate a diff of this commit:
cvs rdiff -u -r1.273.2.1 -r1.273.2.2 src/sys/kern/vfs_bio.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/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.273.2.1 src/sys/kern/vfs_bio.c:1.273.2.2
--- src/sys/kern/vfs_bio.c:1.273.2.1	Thu Nov  2 21:29:52 2017
+++ src/sys/kern/vfs_bio.c	Sat Sep  1 06:04:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.273.2.1 2017/11/02 21:29:52 snj Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.273.2.2 2018/09/01 06:04:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.273.2.1 2017/11/02 21:29:52 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.273.2.2 2018/09/01 06:04:16 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1347,11 +1347,12 @@ allocbuf(buf_t *bp, int size, int preser
  * Called with the buffer queues locked.
  * Return buffer locked.
  */
-buf_t *
+static buf_t *
 getnewbuf(int slpflag, int slptimeo, int from_bufq)
 {
 	buf_t *bp;
 	struct vnode *vp;
+	struct mount *transmp = NULL;
 
  start:
 	KASSERT(mutex_owned(_lock));
@@ -1376,8 +1377,21 @@ getnewbuf(int slpflag, int slptimeo, int
 	}
 
 	KASSERT(mutex_owned(_lock));
-	if ((bp = TAILQ_FIRST([BQ_AGE].bq_queue)) != NULL ||
-	(bp = TAILQ_FIRST([BQ_LRU].bq_queue)) != NULL) {
+	if ((bp = TAILQ_FIRST([BQ_AGE].bq_queue)) != NULL) {
+		KASSERT(!ISSET(bp->b_oflags, BO_DELWRI));
+	} else {
+		TAILQ_FOREACH(bp, [BQ_LRU].bq_queue, b_freelist) {
+			if (ISSET(bp->b_cflags, BC_VFLUSH) ||
+			!ISSET(bp->b_oflags, BO_DELWRI))
+break;
+			if (fstrans_start_nowait(bp->b_vp->v_mount) == 0) {
+KASSERT(transmp == NULL);
+transmp = bp->b_vp->v_mount;
+break;
+			}
+		}
+	}
+	if (bp != NULL) {
 		KASSERT(!ISSET(bp->b_cflags, BC_BUSY) || ISSET(bp->b_cflags, BC_VFLUSH));
 		bremfree(bp);
 
@@ -1431,10 +1445,14 @@ getnewbuf(int slpflag, int slptimeo, int
 		SET(bp->b_cflags, BC_AGE);
 		mutex_exit(_lock);
 		bawrite(bp);
+		KASSERT(transmp != NULL);
+		fstrans_done(transmp);
 		mutex_enter(_lock);
 		return (NULL);
 	}
 
+	KASSERT(transmp == NULL);
+
 	vp = bp->b_vp;
 
 	/* clear out various other fields */



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

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:02:14 UTC 2018

Modified Files:
src/sys/dev [netbsd-8]: fss.c fssvar.h

Log Message:
Pull up following revision(s) (requested by hannken in ticket #999):

sys/dev/fssvar.h: revision 1.30
sys/dev/fssvar.h: revision 1.31
sys/dev/fss.c: revision 1.105
sys/dev/fss.c: revision 1.106

Convert flags FSS_ACTIVE and FSS_ERROR into new member sc_state
with states FSS_IDLE, FSS_ACTIVE and FSS_ERROR.

No functional change intended.

Add two new states FSS_CREATING and FSS_DESTROYING and use them
while creating or destroying a snapshot.

Remove now unneeded sc_lock that made fss_ioctl mutually exclusive.
Fss_ioctl no longer blocks forever because a snapshot gets
created or destroyed.

Serialize snapshot creation and make it interruptible.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.2 -r1.98.2.3 src/sys/dev/fss.c
cvs rdiff -u -r1.29 -r1.29.10.1 src/sys/dev/fssvar.h

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



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

2018-09-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep  1 06:02:14 UTC 2018

Modified Files:
src/sys/dev [netbsd-8]: fss.c fssvar.h

Log Message:
Pull up following revision(s) (requested by hannken in ticket #999):

sys/dev/fssvar.h: revision 1.30
sys/dev/fssvar.h: revision 1.31
sys/dev/fss.c: revision 1.105
sys/dev/fss.c: revision 1.106

Convert flags FSS_ACTIVE and FSS_ERROR into new member sc_state
with states FSS_IDLE, FSS_ACTIVE and FSS_ERROR.

No functional change intended.

Add two new states FSS_CREATING and FSS_DESTROYING and use them
while creating or destroying a snapshot.

Remove now unneeded sc_lock that made fss_ioctl mutually exclusive.
Fss_ioctl no longer blocks forever because a snapshot gets
created or destroyed.

Serialize snapshot creation and make it interruptible.


To generate a diff of this commit:
cvs rdiff -u -r1.98.2.2 -r1.98.2.3 src/sys/dev/fss.c
cvs rdiff -u -r1.29 -r1.29.10.1 src/sys/dev/fssvar.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/fss.c
diff -u src/sys/dev/fss.c:1.98.2.2 src/sys/dev/fss.c:1.98.2.3
--- src/sys/dev/fss.c:1.98.2.2	Sat Jan 13 05:38:54 2018
+++ src/sys/dev/fss.c	Sat Sep  1 06:02:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.98.2.2 2018/01/13 05:38:54 snj Exp $	*/
+/*	$NetBSD: fss.c,v 1.98.2.3 2018/09/01 06:02:13 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.98.2.2 2018/01/13 05:38:54 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.98.2.3 2018/09/01 06:02:13 martin Exp $");
 
 #include 
 #include 
@@ -93,6 +93,8 @@ static int fss_bs_io(struct fss_softc *,
 static u_int32_t *fss_bs_indir(struct fss_softc *, u_int32_t);
 
 static kmutex_t fss_device_lock;	/* Protect all units. */
+static kcondvar_t fss_device_cv;	/* Serialize snapshot creation. */
+static bool fss_creating = false;	/* Currently creating a snapshot. */
 static int fss_num_attached = 0;	/* Number of attached devices. */
 static struct vfs_hooks fss_vfs_hooks = {
 	.vh_unmount = fss_unmount_hook
@@ -137,6 +139,7 @@ fssattach(int num)
 {
 
 	mutex_init(_device_lock, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(_device_cv, "snapwait");
 	if (config_cfattach_attach(fss_cd.cd_name, _ca))
 		aprint_error("%s: unable to register\n", fss_cd.cd_name);
 }
@@ -155,7 +158,6 @@ fss_attach(device_t parent, device_t sel
 	sc->sc_dev = self;
 	sc->sc_bdev = NODEV;
 	mutex_init(>sc_slock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	cv_init(>sc_work_cv, "fssbs");
 	cv_init(>sc_cache_cv, "cowwait");
 	bufq_alloc(>sc_bufq, "fcfs", 0);
@@ -174,15 +176,18 @@ fss_detach(device_t self, int flags)
 {
 	struct fss_softc *sc = device_private(self);
 
-	if (sc->sc_flags & FSS_ACTIVE)
+	mutex_enter(>sc_slock);
+	if (sc->sc_state != FSS_IDLE) {
+		mutex_exit(>sc_slock);
 		return EBUSY;
+	}
+	mutex_exit(>sc_slock);
 
 	if (--fss_num_attached == 0)
 		vfs_hooks_detach(_vfs_hooks);
 
 	pmf_device_deregister(self);
 	mutex_destroy(>sc_slock);
-	mutex_destroy(>sc_lock);
 	cv_destroy(>sc_work_cv);
 	cv_destroy(>sc_cache_cv);
 	bufq_drain(sc->sc_bufq);
@@ -216,6 +221,7 @@ fss_open(dev_t dev, int flags, int mode,
 			mutex_exit(_device_lock);
 			return ENOMEM;
 		}
+		sc->sc_state = FSS_IDLE;
 	}
 
 	mutex_enter(>sc_slock);
@@ -247,20 +253,20 @@ restart:
 		mutex_exit(_device_lock);
 		return 0;
 	}
-	if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
+	if (sc->sc_state != FSS_IDLE &&
 	(sc->sc_uflags & FSS_UNCONFIG_ON_CLOSE) != 0) {
 		sc->sc_uflags &= ~FSS_UNCONFIG_ON_CLOSE;
 		mutex_exit(>sc_slock);
 		error = fss_ioctl(dev, FSSIOCCLR, NULL, FWRITE, l);
 		goto restart;
 	}
-	if ((sc->sc_flags & FSS_ACTIVE) != 0) {
+	if (sc->sc_state != FSS_IDLE) {
 		mutex_exit(>sc_slock);
 		mutex_exit(_device_lock);
 		return error;
 	}
 
-	KASSERT((sc->sc_flags & FSS_ACTIVE) == 0);
+	KASSERT(sc->sc_state == FSS_IDLE);
 	KASSERT((sc->sc_flags & (FSS_CDEV_OPEN|FSS_BDEV_OPEN)) == mflag);
 	mutex_exit(>sc_slock);
 	cf = device_cfdata(sc->sc_dev);
@@ -280,7 +286,7 @@ fss_strategy(struct buf *bp)
 
 	mutex_enter(>sc_slock);
 
-	if (write || !FSS_ISVALID(sc)) {
+	if (write || sc->sc_state != FSS_ACTIVE) {
 		bp->b_error = (write ? EROFS : ENXIO);
 		goto done;
 	}
@@ -318,7 +324,7 @@ fss_write(dev_t dev, struct uio *uio, in
 int
 fss_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
 {
-	int error;
+	int error = 0;
 	struct fss_softc *sc = device_lookup_private(_cd, minor(dev));
 	struct fss_set _fss;
 	struct fss_set *fss = (struct fss_set *)data;
@@ -337,81 +343,125 @@ fss_ioctl(dev_t dev, u_long cmd, void *d
 		fss->fss_flags = 0;
 		/* Fall through */
 	case FSSIOCSET:
-		mutex_enter(>sc_lock);
+		mutex_enter(>sc_slock);
 		if ((flag & FWRITE) == 0)
 			error = EPERM;
-		else if ((sc->sc_flags & FSS_ACTIVE) != 0)
+		if (error == 0 && sc->sc_state !=