Re: CVS commit: src/etc/etc.next68k

2017-07-07 Thread Izumi Tsutsui
> | The PR says:
> | > This information should be fixed to reflect reality, or 
> etc/etc.next68k/MAKEDEV.conf should build tty[ab] as done on e.g. sparc.
> | 
> | What makes you choose the latter?
> 
> That every arch except alpha uses ttya and ttyb for zstty?

In which file? zs(4) man page?

---
Izumi Tsutsui


Re: CVS commit: src/etc/etc.next68k

2017-07-07 Thread Izumi Tsutsui
The PR says:
> This information should be fixed to reflect reality, or 
> etc/etc.next68k/MAKEDEV.conf should build tty[ab] as done on e.g. sparc.

What makes you choose the latter?

---
Izumi Tsutsui


Re: CVS commit: src/etc/etc.next68k

2017-07-07 Thread Christos Zoulas
On Jul 8, 11:41am, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: CVS commit: src/etc/etc.next68k

| The PR says:
| > This information should be fixed to reflect reality, or 
etc/etc.next68k/MAKEDEV.conf should build tty[ab] as done on e.g. sparc.
| 
| What makes you choose the latter?

That every arch except alpha uses ttya and ttyb for zstty?

christos


Re: CVS commit: src/etc/etc.next68k

2017-07-07 Thread Christos Zoulas
On Jul 8, 11:31am, tsut...@ceres.dti.ne.jp (Izumi Tsutsui) wrote:
-- Subject: Re: CVS commit: src/etc/etc.next68k

| IMO man page should be updated to mention "ttyZ[01]",
| as MI src/etc/MAKEDEV.tmpl does.
| 
| tty[ab] were derived from sun3 and sparc, which followed SunOS ones.
| 
| Other ports used tty0[01] etc. but IIRC it caused conflicts with tty0?
| of com(4) on ports which has both zs(4) and com(4) when MI MAKEDEV.tmpl
| was introduced.  Then there was discussion to use ttyC? for com(4) and
| ttyZ? for zs(4) if there was no histrical restrictions.

Feel free to change it the way you feel is best.

christos


Re: CVS commit: src/etc/etc.next68k

2017-07-07 Thread Izumi Tsutsui
> Module Name:  src
> Committed By: christos
> Date: Fri Jul  7 23:48:34 UTC 2017
> 
> Modified Files:
>   src/etc/etc.next68k: MAKEDEV.conf
> 
> Log Message:
> PR/52377: Miod Vallat: Provide links to ttya and ttyb as mentioned in zs(4)

IMO man page should be updated to mention "ttyZ[01]",
as MI src/etc/MAKEDEV.tmpl does.

tty[ab] were derived from sun3 and sparc, which followed SunOS ones.

Other ports used tty0[01] etc. but IIRC it caused conflicts with tty0?
of com(4) on ports which has both zs(4) and com(4) when MI MAKEDEV.tmpl
was introduced.  Then there was discussion to use ttyC? for com(4) and
ttyZ? for zs(4) if there was no histrical restrictions.

---
Izumi Tsutsui


Re: CVS commit: src/sys

2017-07-07 Thread Christos Zoulas
In article <20170708005437.abfb1f...@cvs.netbsd.org>,
Jared D. McNeill  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  jmcneill
>Date:  Sat Jul  8 00:54:37 UTC 2017
>
>Modified Files:
>   src/sys/conf: files
>Added Files:
>   src/sys/dev: led.c led.h
>
>Log Message:
>Add a helper for exposing LED controls via sysctl.

(unsigned char) for isfoo?

christos



CVS commit: src/sys/dev/fdt

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:55:02 UTC 2017

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: gpioleds.c

Log Message:
Add GPIO LED driver.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/gpioleds.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/evbarm/conf

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:55:21 UTC 2017

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

Log Message:
add gpioleds


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

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



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:55:21 UTC 2017

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

Log Message:
add gpioleds


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.12 src/sys/arch/evbarm/conf/SUNXI:1.13
--- src/sys/arch/evbarm/conf/SUNXI:1.12	Thu Jul  6 22:10:14 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Sat Jul  8 00:55:21 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.12 2017/07/06 22:10:14 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.13 2017/07/08 00:55:21 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -68,6 +68,7 @@ sun8ih3ccu*	at fdt? pass 4		# H3 CCU
 fclock*		at fdt? pass 3
 fregulator*	at fdt? pass 4
 gpiokeys*	at fdt?
+gpioleds*	at fdt?
 
 # Timer
 gtmr*		at fdt? pass 1		# ARM Generic Timer



CVS commit: src/sys/dev/fdt

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:55:02 UTC 2017

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: gpioleds.c

Log Message:
Add GPIO LED driver.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/gpioleds.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/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.17 src/sys/dev/fdt/files.fdt:1.18
--- src/sys/dev/fdt/files.fdt:1.17	Thu Jun 29 17:04:17 2017
+++ src/sys/dev/fdt/files.fdt	Sat Jul  8 00:55:02 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.17 2017/06/29 17:04:17 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.18 2017/07/08 00:55:02 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -22,6 +22,10 @@ device	gpiokeys: sysmon_envsys, sysmon_p
 attach	gpiokeys at fdt
 file	dev/fdt/gpiokeys.c			gpiokeys
 
+device	gpioleds: leds
+attach	gpioleds at fdt
+file	dev/fdt/gpioleds.c			gpioleds
+
 file	dev/fdt/fdt_openfirm.c			fdtbus
 file	dev/fdt/fdt_subr.c			fdtbus
 file	dev/fdt/fdt_clock.c			fdtbus

Added files:

Index: src/sys/dev/fdt/gpioleds.c
diff -u /dev/null src/sys/dev/fdt/gpioleds.c:1.1
--- /dev/null	Sat Jul  8 00:55:02 2017
+++ src/sys/dev/fdt/gpioleds.c	Sat Jul  8 00:55:02 2017
@@ -0,0 +1,113 @@
+/* $NetBSD: gpioleds.c,v 1.1 2017/07/08 00:55:02 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: gpioleds.c,v 1.1 2017/07/08 00:55:02 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+static int	gpioleds_match(device_t, cfdata_t, void *);
+static void	gpioleds_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(gpioleds, 0, gpioleds_match, gpioleds_attach, NULL, NULL);
+
+static int
+gpioleds_get(void *priv)
+{
+	struct fdtbus_gpio_pin *pin = priv;
+
+	return fdtbus_gpio_read(pin);
+}
+
+static void
+gpioleds_set(void *priv, int state)
+{
+	struct fdtbus_gpio_pin *pin = priv;
+
+	fdtbus_gpio_write(pin, state);
+}
+
+static int
+gpioleds_match(device_t parent, cfdata_t cf, void *aux)
+{
+	const char * const compatible[] = { "gpio-leds", NULL };
+	const struct fdt_attach_args *faa = aux;
+
+	return of_match_compatible(faa->faa_phandle, compatible);
+}
+
+static void
+gpioleds_attach(device_t parent, device_t self, void *aux)
+{
+	const struct fdt_attach_args *faa = aux;
+	const int phandle = faa->faa_phandle;
+	struct fdtbus_gpio_pin *pin;
+	const char *default_state;
+	char label[64];
+	int child;
+
+	aprint_naive("\n");
+	aprint_normal(":");
+
+	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+		/* Get the label, fallback to node name */
+		if (OF_getprop(child, "label", label, sizeof(label)) <= 0 &&
+		OF_getprop(child, "name", label, sizeof(label)) <= 0)
+			continue;
+
+		/* Get the output pin */
+		pin = fdtbus_gpio_acquire(child, "gpios", GPIO_PIN_OUTPUT);
+		if (pin == NULL)
+			continue;
+
+		/* Attach the LED */
+		if (led_attach(label, pin, gpioleds_get, gpioleds_set) == NULL)
+			continue;
+
+		aprint_normal(" %s", label);
+
+		/* Set default state */
+		default_state = fdtbus_get_string(child, "default-state");
+		if (default_state && strcmp(default_state, "on") == 0)
+			gpioleds_set(pin, LED_STATE_ON);
+		else if (default_state && strcmp(default_state, "off") == 0)
+			gpioleds_set(pin, LED_STATE_OFF);
+	}
+
+	aprint_normal("\n");
+}



CVS commit: src/sys

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:54:37 UTC 2017

Modified Files:
src/sys/conf: files
Added Files:
src/sys/dev: led.c led.h

Log Message:
Add a helper for exposing LED controls via sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.1179 -r1.1180 src/sys/conf/files
cvs rdiff -u -r0 -r1.1 src/sys/dev/led.c src/sys/dev/led.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/conf/files
diff -u src/sys/conf/files:1.1179 src/sys/conf/files:1.1180
--- src/sys/conf/files:1.1179	Thu Jun 22 16:46:53 2017
+++ src/sys/conf/files	Sat Jul  8 00:54:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1179 2017/06/22 16:46:53 flxd Exp $
+#	$NetBSD: files,v 1.1180 2017/07/08 00:54:37 jmcneill Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20170615
@@ -1506,6 +1506,9 @@ file	dev/pud/pud_dev.c		pud
 # device-mapper driver for LVM
 include "dev/dm/files.dm"
 
+# LED framework
+file	dev/led.c			leds
+
 #
 # File systems
 #

Added files:

Index: src/sys/dev/led.c
diff -u /dev/null src/sys/dev/led.c:1.1
--- /dev/null	Sat Jul  8 00:54:37 2017
+++ src/sys/dev/led.c	Sat Jul  8 00:54:37 2017
@@ -0,0 +1,192 @@
+/* $NetBSD: led.c,v 1.1 2017/07/08 00:54:37 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: led.c,v 1.1 2017/07/08 00:54:37 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+struct led_device {
+	char 			*name;
+	led_getstate_fn		getstate;
+	led_setstate_fn		setstate;
+	void			*priv;
+
+	struct sysctllog	*slog;
+
+	TAILQ_ENTRY(led_device)	devices;
+};
+
+static TAILQ_HEAD(, led_device) led_devices =
+TAILQ_HEAD_INITIALIZER(led_devices);
+static kmutex_t led_lock;
+
+static int
+led_init(void)
+{
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
+
+	return 0;
+}
+
+static struct led_device *
+led_lookup(const char *name)
+{
+	struct led_device *led;
+
+	KASSERT(mutex_owned(_lock));
+
+	TAILQ_FOREACH(led, _devices, devices)
+		if (strcmp(led->name, name) == 0)
+			return led;
+
+	return NULL;
+}
+
+static void
+led_normalize_name(char *name)
+{
+	char *p;
+
+	for (p = name; *p; p++)
+		if (!isalpha(*p) && !isdigit(*p) && *p != '-' && *p != '_')
+			*p = '_';
+}
+
+static void
+led_free(struct led_device *led)
+{
+	KASSERT(mutex_owned(_lock));
+
+	kmem_free(led->name, strlen(led->name) + 1);
+	kmem_free(led, sizeof(*led));
+}
+
+static int
+led_sysctl_handler(SYSCTLFN_ARGS)
+{
+	struct sysctlnode node;
+	struct led_device *led;
+	int error, state;
+
+	mutex_enter(_lock);
+
+	node = *rnode;
+	led = node.sysctl_data;
+	state = led->getstate(led->priv);
+	node.sysctl_data = 
+	error = sysctl_lookup(SYSCTLFN_CALL());
+	if (error || newp == NULL) {
+		mutex_exit(_lock);
+		return error;
+	}
+
+	if (state < LED_STATE_OFF || state > LED_STATE_ON) {
+		mutex_exit(_lock);
+		return EINVAL;
+	}
+
+	led->setstate(led->priv, state);
+
+	mutex_exit(_lock);
+
+	return 0;
+}
+
+void *
+led_attach(const char *name, void *priv, led_getstate_fn getstate,
+led_setstate_fn setstate)
+{
+	static ONCE_DECL(control);
+	struct led_device *led;
+	const struct sysctlnode *node;
+	int error;
+
+	if (RUN_ONCE(, led_init) != 0)
+		return NULL;
+
+	led = kmem_zalloc(sizeof(*led), KM_SLEEP);
+	led->name = kmem_asprintf("%s", name);
+	led->getstate = getstate;
+	led->setstate = setstate;
+	led->priv = priv;
+
+	/* Convert invalid sysctl node name characters to underscores */
+	led_normalize_name(led->name);
+
+	mutex_enter(_lock);
+	if (led_lookup(name) != NULL) {
+		

CVS commit: src/sys

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:54:37 UTC 2017

Modified Files:
src/sys/conf: files
Added Files:
src/sys/dev: led.c led.h

Log Message:
Add a helper for exposing LED controls via sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.1179 -r1.1180 src/sys/conf/files
cvs rdiff -u -r0 -r1.1 src/sys/dev/led.c src/sys/dev/led.h

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/sunxi

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:26:19 UTC 2017

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

Log Message:
Write back the data value instead of mask in sunxi_gpio_write


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_gpio.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_gpio.c
diff -u src/sys/arch/arm/sunxi/sunxi_gpio.c:1.6 src/sys/arch/arm/sunxi/sunxi_gpio.c:1.7
--- src/sys/arch/arm/sunxi/sunxi_gpio.c:1.6	Thu Jul  6 22:10:14 2017
+++ src/sys/arch/arm/sunxi/sunxi_gpio.c	Sat Jul  8 00:26:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.6 2017/07/06 22:10:14 jmcneill Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.7 2017/07/08 00:26:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.6 2017/07/06 22:10:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.7 2017/07/08 00:26:19 jmcneill Exp $");
 
 #include 
 #include 
@@ -335,7 +335,7 @@ sunxi_gpio_write(device_t dev, void *pri
 	device_printf(dev, "P%c%02d wr %08x -> %08x\n",
 	pin_def->port + 'A', pin_def->pin, GPIO_READ(sc, data_reg), data);
 #endif
-	GPIO_WRITE(sc, data_reg, data_mask);
+	GPIO_WRITE(sc, data_reg, data);
 	mutex_exit(>sc_lock);
 }
 



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jul  8 00:26:19 UTC 2017

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

Log Message:
Write back the data value instead of mask in sunxi_gpio_write


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_gpio.c

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



CVS commit: src/etc/etc.next68k

2017-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul  7 23:48:34 UTC 2017

Modified Files:
src/etc/etc.next68k: MAKEDEV.conf

Log Message:
PR/52377: Miod Vallat: Provide links to ttya and ttyb as mentioned in zs(4)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/etc.next68k/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.next68k/MAKEDEV.conf
diff -u src/etc/etc.next68k/MAKEDEV.conf:1.3 src/etc/etc.next68k/MAKEDEV.conf:1.4
--- src/etc/etc.next68k/MAKEDEV.conf:1.3	Mon Jan 15 18:35:12 2007
+++ src/etc/etc.next68k/MAKEDEV.conf	Fri Jul  7 19:48:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: MAKEDEV.conf,v 1.3 2007/01/15 23:35:12 hubertf Exp $
+# $NetBSD: MAKEDEV.conf,v 1.4 2017/07/07 23:48:34 christos Exp $
 
 all_md)
 	makedev wscons sd0 sd1 sd2 sd3 tty0 tty1
@@ -7,10 +7,14 @@ all_md)
 	makedev bpf8 bpf9 bpf10 bpf11
 	makedev scsibus0 scsibus1 scsibus2 scsibus3
 	makedev ses0 ses1 ses2 ses3
+	lndev tty00 ttya
+	lndev tty01 ttyb
 	;;
 
 raminst)
 	makedev std
 	makedev sd0 sd1 sd2 sd3 st0 st1 cd0 cd1
 	makedev tty0 tty1 opty
+	lndev tty00 ttya
+	lndev tty01 ttyb
 	;;



CVS commit: src/etc/etc.next68k

2017-07-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jul  7 23:48:34 UTC 2017

Modified Files:
src/etc/etc.next68k: MAKEDEV.conf

Log Message:
PR/52377: Miod Vallat: Provide links to ttya and ttyb as mentioned in zs(4)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/etc.next68k/MAKEDEV.conf

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



CVS commit: src/sys/arch/powerpc/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 23:45:53 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
remove accidential debug printf()


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.83 src/sys/arch/powerpc/oea/cpu_subr.c:1.84
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.83	Fri Jul  7 22:30:28 2017
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Jul  7 23:45:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.84 2017/07/07 23:45:53 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.84 2017/07/07 23:45:53 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -674,7 +674,6 @@ cpu_setup(device_t self, struct cpu_info
 	
 #if HAVE_64BIT_HID0
 	if (bitmasku != NULL) {
-		printf("HID0 %llx\n", hid0);
 		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0 & 0x);
 		snprintb(hidbuf_u, sizeof hidbuf_u, bitmasku, hid0 >> 32);
 		aprint_normal_dev(self, "HID0 %s %s, powersave: %d\n",



CVS commit: src/sys/arch/powerpc/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 23:45:53 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
remove accidential debug printf()


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/include

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:50:02 UTC 2017

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
fix tpyo


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/powerpc/include/spr.h

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

Modified files:

Index: src/sys/arch/powerpc/include/spr.h
diff -u src/sys/arch/powerpc/include/spr.h:1.46 src/sys/arch/powerpc/include/spr.h:1.47
--- src/sys/arch/powerpc/include/spr.h:1.46	Fri Jul  7 22:11:36 2017
+++ src/sys/arch/powerpc/include/spr.h	Fri Jul  7 22:50:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.46 2017/07/07 22:11:36 macallan Exp $	*/
+/*	$NetBSD: spr.h,v 1.47 2017/07/07 22:50:02 macallan Exp $	*/
 
 #ifndef _POWERPC_SPR_H_
 #define	_POWERPC_SPR_H_
@@ -28,7 +28,7 @@ mfspr(int reg)
 			"sldi %2,%2,32;" \
 			"or %2,%2,%1;" \
 			"sync;" \
-			"mtspr %0,%1;" \
+			"mtspr %0,%2;" \
 			"mfspr %1,%0;" \
 			"mfspr %1,%0;" \
 			"mfspr %1,%0;" \



CVS commit: src/sys/arch/powerpc/include

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:50:02 UTC 2017

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
fix tpyo


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/powerpc/include/spr.h

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



CVS commit: src/sys/arch/macppc/dev

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:34:21 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: smuiic.c

Log Message:
tidy up output by moving linebreak to before we attach children


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/smuiic.c

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

Modified files:

Index: src/sys/arch/macppc/dev/smuiic.c
diff -u src/sys/arch/macppc/dev/smuiic.c:1.1 src/sys/arch/macppc/dev/smuiic.c:1.2
--- src/sys/arch/macppc/dev/smuiic.c:1.1	Tue Jun  6 15:58:17 2017
+++ src/sys/arch/macppc/dev/smuiic.c	Fri Jul  7 22:34:20 2017
@@ -78,8 +78,10 @@ smuiic_attach(device_t parent, device_t 
 	sc->sc_dev = self;
 	sc->sc_node = ca->ca_node;
 	sc->sc_i2c = ca->ca_tag;
+	printf("\n");
 
 	iba.iba_tag = sc->sc_i2c;
+
 	config_found_ia(sc->sc_dev, "i2cbus", , iicbus_print);
 
 	for (node = OF_child(sc->sc_node); node != 0; node = OF_peer(node)) {
@@ -95,8 +97,6 @@ smuiic_attach(device_t parent, device_t 
 		sca.ca_tag = sc->sc_i2c;
 		config_found_ia(sc->sc_dev, "smuiic", , smuiic_print);
 	}
-
-	printf("\n");
 }
 
 static int



CVS commit: src/sys/arch/macppc/dev

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:34:21 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: smuiic.c

Log Message:
tidy up output by moving linebreak to before we attach children


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/dev/smuiic.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/powerpc/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:30:28 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
deal with ppc970's HID0


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:30:28 UTC 2017

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
deal with ppc970's HID0


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.82 src/sys/arch/powerpc/oea/cpu_subr.c:1.83
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.82	Mon Mar 24 19:29:59 2014
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Jul  7 22:30:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.82 2014/03/24 19:29:59 christos Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.82 2014/03/24 19:29:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.83 2017/07/07 22:30:28 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -328,6 +328,9 @@ cpu_idlespin(void)
 		return;
 
 	__asm volatile(
+#if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
+		"dssall;"
+#endif
 		"sync;"
 		"mfmsr	%0;"
 		"oris	%0,%0,%1@h;"	/* enter power saving mode */
@@ -484,14 +487,25 @@ cpu_attach_common(device_t self, int id)
 	return (ci);
 }
 
+#define HAVE_64BIT_HID0 (defined(PPC_OEA64_BRIDGE) || defined(_ARCH_PPC64))
+
 void
 cpu_setup(device_t self, struct cpu_info *ci)
 {
-	u_int hid0, hid0_save, pvr, vers;
+	u_int pvr, vers;
 	const char * const xname = device_xname(self);
 	const char *bitmask;
 	char hidbuf[128];
 	char model[80];
+#if HAVE_64BIT_HID0
+	char hidbuf_u[128];
+	const char *bitmasku = NULL;
+#endif
+#if defined(PPC_OEA64_BRIDGE)
+	volatile uint64_t hid0;
+#else
+	register_t hid0;
+#endif
 
 	pvr = mfpvr();
 	vers = (pvr >> 16) & 0x;
@@ -503,7 +517,11 @@ cpu_setup(device_t self, struct cpu_info
 
 	/* set the cpu number */
 	ci->ci_cpuid = cpu_number();
-	hid0_save = hid0 = mfspr(SPR_HID0);
+#if defined(_ARCH_PPC64)
+	__asm volatile("mfspr %0,%1" : "=r"(hid0) : "K"(SPR_HID0));
+#else
+	hid0 = mfspr(SPR_HID0);
+#endif
 
 	cpu_probe_cache();
 
@@ -564,6 +582,13 @@ cpu_setup(device_t self, struct cpu_info
 	case IBM970:
 	case IBM970FX:
 	case IBM970MP:
+#if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
+		hid0 &= ~(HID0_64_DOZE | HID0_64_NAP | HID0_64_DEEPNAP);
+		hid0 |= HID0_64_DOZE | HID0_64_DPM | HID0_64_EX_TBEN |
+			HID0_64_TB_CTRL | HID0_64_EN_MCHK;
+		powersave = 1;
+		break;
+#endif
 	case IBMPOWER3II:
 	default:
 		/* No power-saving mode is available. */ ;
@@ -598,17 +623,31 @@ cpu_setup(device_t self, struct cpu_info
 		break;
 	}
 
-#ifdef MULTIPROCESSOR
+	/*
+	 * according to the 603e manual this is necessary for an external L2
+	 * cache to work properly
+	 */
 	switch (vers) {
 	case MPC603e:
 		hid0 |= HID0_ABE;
 	}
-#endif
 
-	if (hid0 != hid0_save) {
-		mtspr(SPR_HID0, hid0);
-		__asm volatile("sync;isync");
-	}
+#if defined(_ARCH_PPC64)
+	/* ppc970 needs extre goop around writes to HID0 */
+	__asm volatile( "sync;" \
+			"mtspr %0,%1;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			 : : "K"(SPR_HID0), "r"(hid0));
+#else
+	mtspr(SPR_HID0, hid0);
+#endif
+	__asm volatile("sync;isync");
+	
 
 
 	switch (vers) {
@@ -623,14 +662,30 @@ cpu_setup(device_t self, struct cpu_info
 	case IBM970:
 	case IBM970FX:
 	case IBM970MP:
-		bitmask = 0;
+		bitmask = HID0_970_BITMASK;
+#if HAVE_64BIT_HID0
+		bitmasku = HID0_970_BITMASK_U;
+#endif
 		break;
 	default:
 		bitmask = HID0_BITMASK;
 		break;
 	}
-	snprintb(hidbuf, sizeof hidbuf, bitmask, hid0);
-	aprint_normal_dev(self, "HID0 %s, powersave: %d\n", hidbuf, powersave);
+	
+#if HAVE_64BIT_HID0
+	if (bitmasku != NULL) {
+		printf("HID0 %llx\n", hid0);
+		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0 & 0x);
+		snprintb(hidbuf_u, sizeof hidbuf_u, bitmasku, hid0 >> 32);
+		aprint_normal_dev(self, "HID0 %s %s, powersave: %d\n",
+		hidbuf_u, hidbuf, powersave);
+	} else
+#endif
+	{
+		snprintb(hidbuf, sizeof hidbuf, bitmask, hid0);
+		aprint_normal_dev(self, "HID0 %s, powersave: %d\n",
+		hidbuf, powersave);
+	}
 
 	ci->ci_khz = 0;
 
@@ -1166,7 +1221,6 @@ cpu_tau_setup(struct cpu_info *ci)
 	}
 }
 
-
 /* Find the temperature of the CPU. */
 void
 cpu_tau_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)



CVS commit: src/doc

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 22:22:11 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note dts import


To generate a diff of this commit:
cvs rdiff -u -r1.2297 -r1.2298 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/doc

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 22:22:11 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note dts import


To generate a diff of this commit:
cvs rdiff -u -r1.2297 -r1.2298 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.2297 src/doc/CHANGES:1.2298
--- src/doc/CHANGES:1.2297	Fri Jul  7 22:20:54 2017
+++ src/doc/CHANGES	Fri Jul  7 22:22:11 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2297 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2298 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -29,6 +29,7 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
  	wsbell(4): added console bell support for all speaker devices, not
  		only those attached at pcppi [nat 20170612]
  	bind: Import version 9.10.5-P1. [christos 20170615]
+	dts: Import dts files from Linux 4.11.5. [jmcneill 20170615]
 	expat: Import 2.2.1 (security fixes) [christos 20170617]
 	arm: Add support for Allwinner H3 SoC. [jmcneill 20170628]
 	bind: Import version 9.10.5-P2. [christos 20170630]



CVS commit: src/doc

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 22:20:54 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note Allwinner H3, A83T, and Allwinner Gigabit Ethernet support


To generate a diff of this commit:
cvs rdiff -u -r1.2296 -r1.2297 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/doc

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 22:20:54 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note Allwinner H3, A83T, and Allwinner Gigabit Ethernet support


To generate a diff of this commit:
cvs rdiff -u -r1.2296 -r1.2297 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.2296 src/doc/CHANGES:1.2297
--- src/doc/CHANGES:1.2296	Fri Jul  7 08:46:49 2017
+++ src/doc/CHANGES	Fri Jul  7 22:20:54 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2296 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2297 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -30,7 +30,11 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
  		only those attached at pcppi [nat 20170612]
  	bind: Import version 9.10.5-P1. [christos 20170615]
 	expat: Import 2.2.1 (security fixes) [christos 20170617]
+	arm: Add support for Allwinner H3 SoC. [jmcneill 20170628]
 	bind: Import version 9.10.5-P2. [christos 20170630]
+	sunxiemac(4): Add support for Allwinner Gigabit Ethernet (EMAC).
+		[jmcneill 20170701]
 	wbsio(4): Add support for Winbond W83627DHG-P, W83627SF, W83627UHG,
 		W83667HGB, W83687THF, W83697UG,	Nuvoton NCT5104D, NCT6775,
 		NCT6779, NCT6791, NCT6792 and NCT6793. [msaitoh 20170707]
+	arm: Add support for Allwinner A83T SoC. [jmcneill 20170707]



CVS commit: src/sys/arch/powerpc/include/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:13:36 UTC 2017

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
add bits & masks for ppc970 HID0


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/include/oea/hid.h

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

Modified files:

Index: src/sys/arch/powerpc/include/oea/hid.h
diff -u src/sys/arch/powerpc/include/oea/hid.h:1.10 src/sys/arch/powerpc/include/oea/hid.h:1.11
--- src/sys/arch/powerpc/include/oea/hid.h:1.10	Sun Sep 22 17:51:31 2013
+++ src/sys/arch/powerpc/include/oea/hid.h	Fri Jul  7 22:13:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.h,v 1.10 2013/09/22 17:51:31 matt Exp $	*/
+/*	$NetBSD: hid.h,v 1.11 2017/07/07 22:13:35 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2000 Tsubai Masanari.  All rights reserved.
@@ -31,6 +31,28 @@
 
 /* Hardware Implementation Dependent registers for the PowerPC */
 
+#if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
+/* this way we can use the same bit numbers as IBM's PowerPC manuals */
+#define HIDBIT(x) (0x8000LL >> x)
+#define HID0_64_ONE_PPC	HIDBIT(0)   /* one instruction per dispatch group */
+#define HID0_64_DO_SNGL	HIDBIT(1)   /* single group completion mode */
+#define HID0_64_ISYNCSC	HIDBIT(2)   /* Disable isync scoreboard optimization */
+#define HID0_64_SER_GP	HIDBIT(3)   /* Serialize group dispatch */
+#define HID0_64_DEEPNAP	HIDBIT(7)   /* Enable deep nap mode (970) */
+#define HID0_64_DOZE	HIDBIT(8)   /* Enable doze mode */
+#define HID0_64_NAP	HIDBIT(9)   /* Enable nap mode */
+#define HID0_64_DPM	HIDBIT(11)  /* Enable Dynamic power management */
+#define HID0_64_TG	HIDBIT(13)  /* Perfmon threshold granularity control */
+#define HID0_64_HNG_DIS	HIDBIT(14)  /* Disable processor hang-detection */
+#define HID0_64_NHR	HIDBIT(15)  /* No Hard Reset */
+#define HID0_64_INORDER	HIDBIT(16)  /* Serialized group issue mode */
+#define HID0_64_TB_CTRL	HIDBIT(18)  /* TB keeps running if CPU stopped */
+#define HID0_64_EX_TBEN	HIDBIT(19)  /* timebase runs at external clock */
+#define HID0_64_CIABREN	HIDBIT(22)  /* enable CIABR register */
+#define HID0_64_HDICEEN	HIDBIT(23)  /* hypervisor decrementer enable */
+#define HID0_64_EN_ATTN	HIDBIT(31)  /* support processor attention inst. */
+#define HID0_64_EN_MCHK	HIDBIT(32)  /* ext. mchk interrupts */
+#endif
 #define HID0_EMCP	0x8000  /* Enable MCP */
 #define HID0_DBP	0x4000  /* Disable 60x bus parity generation */
 #define HID0_EBA	0x2000  /* Enable 60x bus address parity checking */
@@ -82,6 +104,14 @@
 "\020ICE\017DCE\016ILOCK\015DLOCK\014ICFI\013DCFI\012SPD\011XBSEN" \
 "\010SGE\007b25\006BTIC\005LRSTK\004FOLD\003BHT\002NOPDST\001NOPTI"
 
+#define HID0_970_BITMASK "\020" \
+"\040EMCP"
+
+#define HID0_970_BITMASK_U "\020" \
+"\040ONEPPC\036DOSNGL\036ISYNCSC\035SERGP\034res\033res\032res\031DEEPNAP" \
+"\030DOZE\027NAP\026res\025DPM\024res\023TG\022HNGDIS\021NHR" \
+"\020INORDER\017res\016TBCTRL\015EXTBEN\014res\013res\012CIABREN\011HDICEEN" \
+"\001ENATTN"
 /*
  *  HID0 bit definitions per CPU model
  *



CVS commit: src/sys/arch/powerpc/include/oea

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:13:36 UTC 2017

Modified Files:
src/sys/arch/powerpc/include/oea: hid.h

Log Message:
add bits & masks for ppc970 HID0


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/include/oea/hid.h

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



CVS commit: src/sys/arch/powerpc/include

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:11:37 UTC 2017

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
add mfspr/mtspr methods suitable for 64bit SPRs on ppc970 in bridge mode


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/powerpc/include/spr.h

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

Modified files:

Index: src/sys/arch/powerpc/include/spr.h
diff -u src/sys/arch/powerpc/include/spr.h:1.45 src/sys/arch/powerpc/include/spr.h:1.46
--- src/sys/arch/powerpc/include/spr.h:1.45	Thu Feb 25 23:30:04 2010
+++ src/sys/arch/powerpc/include/spr.h	Fri Jul  7 22:11:36 2017
@@ -1,9 +1,44 @@
-/*	$NetBSD: spr.h,v 1.45 2010/02/25 23:30:04 matt Exp $	*/
+/*	$NetBSD: spr.h,v 1.46 2017/07/07 22:11:36 macallan Exp $	*/
 
 #ifndef _POWERPC_SPR_H_
 #define	_POWERPC_SPR_H_
 
 #ifndef _LOCORE
+#ifdef PPC_OEA64_BRIDGE
+
+static inline uint64_t
+mfspr(int reg)
+{
+	uint64_t ret;
+	register_t h, l;
+	__asm volatile( "mfspr %0,%2;" \
+			"srdi %1,%0,32;" \
+			 : "=r"(l), "=r"(h) : "K"(reg));
+	ret = ((uint64_t)h << 32) | l;
+	return ret;
+}
+
+#define mtspr(reg, v) \
+( {		\
+	volatile register_t h, l;		\
+	uint64_t val = v;			\
+	h = (val >> 32);			\
+	l = val & 0x;			\
+	__asm volatile( \
+			"sldi %2,%2,32;" \
+			"or %2,%2,%1;" \
+			"sync;" \
+			"mtspr %0,%1;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			"mfspr %1,%0;" \
+			 : : "K"(reg), "r"(l), "r"(h)); \
+} )
+
+#else
 #define	mtspr(reg, val)			\
 	__asm volatile("mtspr %0,%1" : : "K"(reg), "r"(val))
 #ifdef __GNUC__
@@ -12,6 +47,7 @@
 	  __asm volatile("mfspr %0,%1" : "=r"(val) : "K"(reg));	\
 	  val; } )
 #endif
+#endif /* PPC_OEA64_BRIDGE */
 #endif /* _LOCORE */
 
 /*



CVS commit: src/sys/arch/powerpc/include

2017-07-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Jul  7 22:11:37 UTC 2017

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
add mfspr/mtspr methods suitable for 64bit SPRs on ppc970 in bridge mode


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/powerpc/include/spr.h

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/sunxi

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:40:56 UTC 2017

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

Log Message:
Drop the sunxi_emac_rx_batch feature. It was originally designed to
reduce the amount of mutex unlock/lock cycles during the RX path on
FreeBSD and if_input, but it is not required to drop the lock before
calling if_percpuq_enqueue on NetBSD.


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

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.3 src/sys/arch/arm/sunxi/sunxi_emac.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.3	Fri Jul  7 21:21:52 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Fri Jul  7 21:40:56 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.3 2017/07/07 21:21:52 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.4 2017/07/07 21:40:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.3 2017/07/07 21:21:52 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.4 2017/07/07 21:40:56 jmcneill Exp $");
 
 #include 
 #include 
@@ -96,7 +96,6 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
 #define	RX_TX_PRI_DEFAULT	0
 #define	PAUSE_TIME_DEFAULT	0x400
 #define	TX_INTERVAL_DEFAULT	64
-#define	RX_BATCH_DEFAULT	1
 
 /* syscon EMAC clock register */
 #define	EMAC_CLK_EPHY_ADDR	(0x1f << 20)	/* H3 */
@@ -129,9 +128,6 @@ static int sunxi_emac_pause_time = PAUSE
 /* Request a TX interrupt every  descriptors */
 static int sunxi_emac_tx_interval = TX_INTERVAL_DEFAULT;
 
-/* Maximum number of mbufs to send to if_input */
-static int sunxi_emac_rx_batch = RX_BATCH_DEFAULT;
-
 enum sunxi_emac_type {
 	EMAC_A83T = 1,
 	EMAC_H3,
@@ -709,12 +705,10 @@ static int
 sunxi_emac_rxintr(struct sunxi_emac_softc *sc)
 {
 	struct ifnet *ifp = >ec.ec_if;
-	struct mbuf *m, *m0, *mh, *mt;
-	int error, index, len, cnt, npkt;
+	int error, index, len, npkt;
+	struct mbuf *m, *m0;
 	uint32_t status;
 
-	mh = mt = NULL;
-	cnt = 0;
 	npkt = 0;
 
 	for (index = sc->rx.cur; ; index = RX_NEXT(index)) {
@@ -738,6 +732,7 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
 			m->m_flags |= M_HASFCS;
 			m->m_pkthdr.len = len;
 			m->m_len = len;
+			m->m_nextpkt = NULL;
 
 			if ((ifp->if_capenable & IFCAP_CSUM_IPv4_Rx) != 0 &&
 			(status & RX_FRM_TYPE) != 0) {
@@ -752,20 +747,9 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
 }
 			}
 
-			m->m_nextpkt = NULL;
-			if (mh == NULL)
-mh = m;
-			else
-mt->m_nextpkt = m;
-			mt = m;
-			++cnt;
 			++npkt;
 
-			if (cnt == sunxi_emac_rx_batch) {
-if_percpuq_enqueue(ifp->if_percpuq, mh);
-mh = mt = NULL;
-cnt = 0;
-			}
+			if_percpuq_enqueue(ifp->if_percpuq, m);
 		}
 
 		if ((m0 = sunxi_emac_alloc_mbufcl(sc)) != NULL) {
@@ -783,9 +767,6 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
 
 	sc->rx.cur = index;
 
-	if (mh != NULL)
-		if_percpuq_enqueue(ifp->if_percpuq, mh);
-
 	return npkt;
 }
 



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:40:56 UTC 2017

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

Log Message:
Drop the sunxi_emac_rx_batch feature. It was originally designed to
reduce the amount of mutex unlock/lock cycles during the RX path on
FreeBSD and if_input, but it is not required to drop the lock before
calling if_percpuq_enqueue on NetBSD.


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

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



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:21:52 UTC 2017

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

Log Message:
Restore TX_INTERVAL_DEFAULT to 64


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

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



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:21:52 UTC 2017

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

Log Message:
Restore TX_INTERVAL_DEFAULT to 64


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

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.2 src/sys/arch/arm/sunxi/sunxi_emac.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.2	Fri Jul  7 21:01:58 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Fri Jul  7 21:21:52 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.2 2017/07/07 21:01:58 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.3 2017/07/07 21:21:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.2 2017/07/07 21:01:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.3 2017/07/07 21:21:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -95,7 +95,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
 #define	BURST_LEN_DEFAULT	8
 #define	RX_TX_PRI_DEFAULT	0
 #define	PAUSE_TIME_DEFAULT	0x400
-#define	TX_INTERVAL_DEFAULT	1
+#define	TX_INTERVAL_DEFAULT	64
 #define	RX_BATCH_DEFAULT	1
 
 /* syscon EMAC clock register */



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:19:50 UTC 2017

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

Log Message:
Fix AHB2 register definition and explicitly set AHB2 parent to PLL_PERIPH0/2 -- 
this gives us 50% more bus bandwidth for emac


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sun8i_h3_ccu.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/sunxi

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:19:50 UTC 2017

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

Log Message:
Fix AHB2 register definition and explicitly set AHB2 parent to PLL_PERIPH0/2 -- 
this gives us 50% more bus bandwidth for emac


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.6 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.7
--- src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.6	Sun Jul  2 13:36:46 2017
+++ src/sys/arch/arm/sunxi/sun8i_h3_ccu.c	Fri Jul  7 21:19:50 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.6 2017/07/02 13:36:46 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.7 2017/07/07 21:19:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.6 2017/07/02 13:36:46 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.7 2017/07/07 21:19:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,6 +44,9 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu
 #define	PLL_PERIPH0_CTRL_REG	0x028
 #define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
+#define	AHB2_CFG_REG		0x05c
+#define	 AHB2_CLK_CFG		__BITS(1,0)
+#define	 AHB2_CLK_CFG_PLL_PERIPH0_2	1
 #define	BUS_CLK_GATING_REG0	0x060
 #define	BUS_CLK_GATING_REG2	0x068
 #define	BUS_CLK_GATING_REG3	0x06c
@@ -157,7 +160,7 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	SUNXI_CCU_PREDIV_POWER_OF_TWO),
 
 	SUNXI_CCU_PREDIV(H3_CLK_AHB2, "ahb2", ahb2_parents,
-	APB2_CFG_REG,	/* reg */
+	AHB2_CFG_REG,	/* reg */
 	0,			/* prediv */
 	__BIT(1),		/* prediv_sel */
 	0,			/* div */
@@ -251,6 +254,18 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	USBPHY_CFG_REG, 19),
 };
 
+static void
+sun8i_h3_ccu_init(struct sunxi_ccu_softc *sc)
+{
+	uint32_t val;
+
+	/* Set AHB2 source to PLL_PERIPH/2 */
+	val = CCU_READ(sc, AHB2_CFG_REG);
+	val &= ~AHB2_CLK_CFG;
+	val |= __SHIFTIN(AHB2_CLK_CFG_PLL_PERIPH0_2, AHB2_CLK_CFG);
+	CCU_WRITE(sc, AHB2_CFG_REG, val);
+}
+
 static int
 sun8i_h3_ccu_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -281,5 +296,7 @@ sun8i_h3_ccu_attach(device_t parent, dev
 	aprint_naive("\n");
 	aprint_normal(": H3 CCU\n");
 
+	sun8i_h3_ccu_init(sc);
+
 	sunxi_ccu_print(sc);
 }



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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:01:58 UTC 2017

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

Log Message:
Fixup busdma sync and locking in the RX path. Disable batch RX/TX ints.


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

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.1 src/sys/arch/arm/sunxi/sunxi_emac.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.1	Sat Jul  1 16:25:16 2017
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Fri Jul  7 21:01:58 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.1 2017/07/01 16:25:16 jmcneill Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.2 2017/07/07 21:01:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.1 2017/07/01 16:25:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.2 2017/07/07 21:01:58 jmcneill Exp $");
 
 #include 
 #include 
@@ -75,7 +75,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
 #define	EMAC_UNLOCK(sc)		mutex_exit(&(sc)->mtx)
 #define	EMAC_ASSERT_LOCKED(sc)	KASSERT(mutex_owned(&(sc)->mtx))
 
-#define	DESC_ALIGN		8
+#define	DESC_ALIGN		sizeof(struct sunxi_emac_desc)
 #define	TX_DESC_COUNT		1024
 #define	TX_DESC_SIZE		(sizeof(struct sunxi_emac_desc) * TX_DESC_COUNT)
 #define	RX_DESC_COUNT		256
@@ -95,8 +95,8 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
 #define	BURST_LEN_DEFAULT	8
 #define	RX_TX_PRI_DEFAULT	0
 #define	PAUSE_TIME_DEFAULT	0x400
-#define	TX_INTERVAL_DEFAULT	64
-#define	RX_BATCH_DEFAULT	64
+#define	TX_INTERVAL_DEFAULT	1
+#define	RX_BATCH_DEFAULT	1
 
 /* syscon EMAC clock register */
 #define	EMAC_CLK_EPHY_ADDR	(0x1f << 20)	/* H3 */
@@ -318,8 +318,9 @@ sunxi_emac_dma_sync(struct sunxi_emac_so
 	} else {
 		bus_dmamap_sync(dmat, map, DESC_OFF(start),
 		DESC_OFF(total) - DESC_OFF(start), flags);
-		bus_dmamap_sync(dmat, map, DESC_OFF(0),
-		DESC_OFF(end) - DESC_OFF(0), flags);
+		if (DESC_OFF(end) - DESC_OFF(0) > 0)
+			bus_dmamap_sync(dmat, map, DESC_OFF(0),
+			DESC_OFF(end) - DESC_OFF(0), flags);
 	}
 }
 
@@ -376,9 +377,6 @@ sunxi_emac_setup_txbuf(struct sunxi_emac
 		flags |= (csum_flags << TX_CHECKSUM_CTL_SHIFT);
 	}
 
-	bus_dmamap_sync(sc->tx.buf_tag, sc->tx.buf_map[index].map,
-	0, sc->tx.buf_map[index].map->dm_mapsize, BUS_DMASYNC_PREWRITE);
-
 	for (cur = index, i = 0; i < nsegs; i++) {
 		sc->tx.buf_map[cur].mbuf = (i == 0 ? m : NULL);
 		if (i == nsegs - 1)
@@ -390,6 +388,9 @@ sunxi_emac_setup_txbuf(struct sunxi_emac
 		cur = TX_NEXT(cur);
 	}
 
+	bus_dmamap_sync(sc->tx.buf_tag, sc->tx.buf_map[index].map,
+	0, sc->tx.buf_map[index].map->dm_mapsize, BUS_DMASYNC_PREWRITE);
+
 	return nsegs;
 }
 
@@ -761,13 +762,10 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
 			++npkt;
 
 			if (cnt == sunxi_emac_rx_batch) {
-EMAC_UNLOCK(sc);
 if_percpuq_enqueue(ifp->if_percpuq, mh);
-EMAC_LOCK(sc);
 mh = mt = NULL;
 cnt = 0;
 			}
-			
 		}
 
 		if ((m0 = sunxi_emac_alloc_mbufcl(sc)) != NULL) {
@@ -780,17 +778,14 @@ sunxi_emac_rxintr(struct sunxi_emac_soft
 
 		sunxi_emac_dma_sync(sc, sc->rx.desc_tag, sc->rx.desc_map,
 		index, index + 1,
-		RX_DESC_COUNT, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
-	}
-
-	if (mh != NULL) {
-		EMAC_UNLOCK(sc);
-		if_percpuq_enqueue(ifp->if_percpuq, mh);
-		EMAC_LOCK(sc);
+		RX_DESC_COUNT, BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD);
 	}
 
 	sc->rx.cur = index;
 
+	if (mh != NULL)
+		if_percpuq_enqueue(ifp->if_percpuq, mh);
+
 	return npkt;
 }
 
@@ -825,6 +820,9 @@ sunxi_emac_txintr(struct sunxi_emac_soft
 		}
 
 		sunxi_emac_setup_txdesc(sc, i, 0, 0, 0);
+		sunxi_emac_dma_sync(sc, sc->tx.desc_tag, sc->tx.desc_map,
+		i, i + 1, TX_DESC_COUNT,
+		BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
 		ifp->if_flags &= ~IFF_OACTIVE;
 		ifp->if_opackets++;
@@ -1200,7 +1198,7 @@ sunxi_emac_setup_dma(struct sunxi_emac_s
 		return error;
 	error = bus_dmamem_map(sc->dmat, >tx.desc_dmaseg, nsegs,
 	TX_DESC_SIZE, (void *)>tx.desc_ring,
-	BUS_DMA_WAITOK | BUS_DMA_COHERENT);
+	BUS_DMA_WAITOK);
 	if (error)
 		return error;
 	error = bus_dmamap_load(sc->dmat, sc->tx.desc_map, sc->tx.desc_ring,
@@ -1211,7 +1209,7 @@ sunxi_emac_setup_dma(struct sunxi_emac_s
 
 	memset(sc->tx.desc_ring, 0, TX_DESC_SIZE);
 	bus_dmamap_sync(sc->dmat, sc->tx.desc_map, 0, TX_DESC_SIZE,
-	BUS_DMASYNC_POSTWRITE);
+	BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE);
 
 	for (i = 0; i < TX_DESC_COUNT; i++)
 		sc->tx.desc_ring[i].next =
@@ -1241,7 +1239,7 @@ sunxi_emac_setup_dma(struct sunxi_emac_s
 		return error;
 	error = bus_dmamem_map(sc->dmat, >rx.desc_dmaseg, nsegs,
 	RX_DESC_SIZE, (void *)>rx.desc_ring,
-	BUS_DMA_WAITOK | BUS_DMA_COHERENT);
+	

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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 21:01:58 UTC 2017

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

Log Message:
Fixup busdma sync and locking in the RX path. Disable batch RX/TX ints.


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

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



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

2017-07-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul  7 16:59:35 UTC 2017

Modified Files:
src/sys/arch/arm/include/arm32: frame.h

Log Message:
Fixup the non-KDTRACE_HOOKS case of PUSHDTRACEGAP - we need to copy the
stack pointer to r2.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/include/arm32/frame.h

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

Modified files:

Index: src/sys/arch/arm/include/arm32/frame.h
diff -u src/sys/arch/arm/include/arm32/frame.h:1.44 src/sys/arch/arm/include/arm32/frame.h:1.45
--- src/sys/arch/arm/include/arm32/frame.h:1.44	Fri Jul  7 00:34:09 2017
+++ src/sys/arch/arm/include/arm32/frame.h	Fri Jul  7 16:59:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.44 2017/07/07 00:34:09 chs Exp $	*/
+/*	$NetBSD: frame.h,v 1.45 2017/07/07 16:59:35 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -455,7 +455,8 @@ LOCK_CAS_DEBUG_LOCALS
 	mov	r2, sp;			   \
 	subeq	r2, r2, #(4 * 16);	/* if so, leave a gap for dtrace */
 #else
-#define PUSHDTRACEGAP			/* nothing */
+#define PUSHDTRACEGAP			   \
+	mov	r2, sp
 #endif
 
 #define PUSHTRAPFRAME(rX)		   \



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

2017-07-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Jul  7 16:59:35 UTC 2017

Modified Files:
src/sys/arch/arm/include/arm32: frame.h

Log Message:
Fixup the non-KDTRACE_HOOKS case of PUSHDTRACEGAP - we need to copy the
stack pointer to r2.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/include/arm32/frame.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/doc

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 14:12:21 UTC 2017

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

Log Message:
Tickets #100, #101, #106, #107, #109


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/CHANGES-8.0

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

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 14:12:21 UTC 2017

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

Log Message:
Tickets #100, #101, #106, #107, #109


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/CHANGES-8.0

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

Modified files:

Index: src/doc/CHANGES-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.20 src/doc/CHANGES-8.0:1.1.2.21
--- src/doc/CHANGES-8.0:1.1.2.20	Thu Jul  6 05:29:43 2017
+++ src/doc/CHANGES-8.0	Fri Jul  7 14:12:21 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.20 2017/07/06 05:29:43 martin Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.21 2017/07/07 14:12:21 martin Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -1799,3 +1799,92 @@ sys/arch/arm/cortex/a9_mpsubr.S			1.48
 	stack.
 	[skrll, ticket #99]
 
+sys/netinet/ip_output.c1.280,1.282
+
+	When outputting, search for the sending address on the sending
+	interface rather than blindly picking the first matcing address
+	from any interface when testing source address validity.
+
+	This allows another interface to have the same address, but be
+	detached.
+
+	Fix a regression caused in r1.280.
+	[roy, ticket #100]
+
+sys/dev/fdt/gpiokeys.c1.3-1.4
+
+	Read the initial key state at startup so we only trigger events on
+	state changes. Prevents a misconfigured power button from shutting
+	us down at boot.
+
+	Only read gpio pin if the pin is valid
+	[jmcneill, ticket #101]
+
+sys/netinet6/icmp6.c1.212
+
+	Fix PR kern/52353.
+	[knakahara, ticket #106]
+
+sbin/route/route.81.57
+sbin/route/route.c1.156
+sbin/route/rtutil.c1.9
+sys/net/if_llatbl.c1.19-1.21
+sys/net/if_llatbl.h1.11-1.12
+sys/net/route.c	1.196-1.197
+sys/net/route.h	1.113
+sys/net/rtsock.c1.214-1.224
+sys/netinet/if_arp.c1.251-1.252
+sys/netinet/in.c1.204-1.205
+sys/netinet6/in6.c1.246-1.248
+sys/netinet6/nd6.c1.233-1.235
+sys/netinet6/nd6.h1.84-1.85
+tests/net/arp/t_arp.sh1.23-1.20
+tests/net/ndp/t_ndp.sh1.21-1.29
+tests/net/ndp/t_ra.sh1.28-1.29
+tests/net/net/t_ipv6address.sh			1.14
+tests/net/net_common.sh1.19
+tests/net/route/t_flags.sh			1.16-1.19
+tests/net/route/t_flags6.sh			1.13-1.15
+tests/net/route/t_route.sh			1.13
+usr.sbin/arp/arp.c1.56-1.58
+usr.sbin/ndp/ndp.c1.49-1.50
+
+	Simplify. Send a routing message (RTM_ADD) on adding an llentry.
+	Drop RTF_CONNECTED from a result of RTM_GET for ARP/NDP entries.
+	Support -c  option for route monitor.
+	Test routing messages emitted on operations of ARP/NDP entries.
+	Do netstat -a for an appropriate protocol.
+	Set net.inet.arp.keep only if it's required.
+	Don't create a permanent L2 cache entry on adding an address
+	to an interface.
+	Fix in_lltable_match_prefix.
+	Remove unused function (nd6_rem_ifa_lle).
+	Allow in6_lltable_free_entry to be called without holding the
+	afdata lock of ifp as well as in_lltable_free_entry.
+	Purge ARP/NDP entries on an interface when the interface is down.
+	Purge all related L2 caches on removing a route.
+	Purge L2 caches on changing an interface of a route.
+	Test implicit removals of ARP/NDP entries.
+	Tweak lltable_sysctl_dumparp.
+	Fix usage of routing messages on arp -d and ndp -d.
+	Improve backward compatibility of (fake) routing messages
+	on adding an ARP/NDP entry.
+	Drop RTF_UP from a routing message of a deleted ARP/NDP entry.
+	Check existence of ARP/NDP entries.
+	Drop RTF_LLINFO flag (now it's RTF_LLDATA) from local routes.
+	Restore ARP/NDP entries to route show and netstat -r.
+	Enable to remove multiple ARP/NDP entries for one destination.
+	Check if ARP/NDP entries are purged when a related route is deleted.
+	[ozaki-r, ticket #107]
+
+xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c	1.2
+xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c	1.3
+xsrc/external/mit/xorg-server.old/dist/dix/events.c	1.2
+xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c	1.2
+xsrc/external/mit/xorg-server/dist/Xi/sendexev.c	1.4
+xsrc/external/mit/xorg-server/dist/dix/events.c		1.2
+xsrc/external/mit/xorg-server/dist/dix/swapreq.c	1.2
+
+	CVE-2017-10971 and CVE-2017-10972: apply fixes to the event loop.
+	[mrg, ticket #109]
+



CVS commit: [netbsd-8] xsrc/external/mit

2017-07-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Fri Jul  7 14:10:25 UTC 2017

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi [netbsd-8]: sendexev.c
xsrc/external/mit/xorg-server.old/dist/dix [netbsd-8]: events.c
swapreq.c
xsrc/external/mit/xorg-server/dist/Xi [netbsd-8]: sendexev.c
xsrc/external/mit/xorg-server/dist/dix [netbsd-8]: events.c swapreq.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #109):
external/mit/xorg-server.old/dist/Xi/sendexev.c: revision 1.2
external/mit/xorg-server.old/dist/Xi/sendexev.c: revision 1.3
external/mit/xorg-server/dist/dix/events.c: revision 1.2
external/mit/xorg-server.old/dist/dix/events.c: revision 1.2
external/mit/xorg-server/dist/dix/swapreq.c: revision 1.2
external/mit/xorg-server/dist/Xi/sendexev.c: revision 1.4
external/mit/xorg-server.old/dist/dix/swapreq.c: revision 1.2
CVE-2017-10971 and CVE-2017-10972: apply fixes to the event loop from
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3Dba336b24052122b136486961c82deac76bbde455
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3D8caed4df36b1f802b4992edcfd282cbeeec35d9d
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3D215f894965df5fb0bb45b107d84524e700d2073c
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3D05442de962d3dc624f79fc1a00eca3ffc5489ced
add missing } from the previous. apparently i mis-tested and it didn't compile.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.2.1 \
xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.2.1 \
xsrc/external/mit/xorg-server.old/dist/dix/events.c \
xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c
cvs rdiff -u -r1.3 -r1.3.2.1 xsrc/external/mit/xorg-server/dist/Xi/sendexev.c
cvs rdiff -u -r1.1.1.9 -r1.1.1.9.2.1 \
xsrc/external/mit/xorg-server/dist/dix/events.c
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.2.1 \
xsrc/external/mit/xorg-server/dist/dix/swapreq.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
diff -u xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.1.1.1.2.1
--- xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c	Fri Jul  7 14:10:24 2017
@@ -79,7 +79,7 @@ SProcXSendExtensionEvent(ClientPtr clien
 char n;
 CARD32 *p;
 int i;
-xEvent eventT;
+xEvent eventT = { .u.u.type = 0 };
 xEvent *eventP;
 EventSwapPtr proc;
 
@@ -95,9 +95,17 @@ SProcXSendExtensionEvent(ClientPtr clien
 
 eventP = (xEvent *) & stuff[1];
 for (i = 0; i < stuff->num_events; i++, eventP++) {
+if (eventP->u.u.type == GenericEvent) {
+client->errorValue = eventP->u.u.type;
+return BadValue;
+}
+
 	proc = EventSwapVector[eventP->u.u.type & 0177];
-	if (proc == NotImplemented)	/* no swapping proc; invalid event type? */
+/* no swapping proc; invalid event type? */
+if (proc == NotImplemented) {
+client->errorValue = eventP->u.u.type;
 	return BadValue;
+}
 	(*proc) (eventP, );
 	*eventP = eventT;
 }
@@ -117,7 +125,7 @@ SProcXSendExtensionEvent(ClientPtr clien
 int
 ProcXSendExtensionEvent(ClientPtr client)
 {
-int ret;
+int ret, i;
 DeviceIntPtr dev;
 xEvent *first;
 XEventClass *list;
@@ -140,10 +148,12 @@ ProcXSendExtensionEvent(ClientPtr client
 /* The client's event type must be one defined by an extension. */
 
 first = ((xEvent *) & stuff[1]);
-if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
-	  (first->u.u.type < lastEvent))) {
-	client->errorValue = first->u.u.type;
-	return BadValue;
+for (i = 0; i < stuff->num_events; i++) {
+if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
+(first[i].u.u.type < lastEvent))) {
+client->errorValue = first[i].u.u.type;
+return BadValue;
+}
 }
 
 list = (XEventClass *) (first + stuff->num_events);

Index: xsrc/external/mit/xorg-server.old/dist/dix/events.c
diff -u xsrc/external/mit/xorg-server.old/dist/dix/events.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/dix/events.c:1.1.1.1.2.1
--- xsrc/external/mit/xorg-server.old/dist/dix/events.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/dix/events.c	Fri Jul  7 14:10:24 2017
@@ -5021,6 +5021,12 @@ ProcSendEvent(ClientPtr client)
 	client->errorValue = stuff->event.u.u.type;
 	return BadValue;
 }
+/* Generic events can have variable size, but SendEvent request holds
+   exactly 32B of event data. */
+if (stuff->event.u.u.type == GenericEvent) {
+client->errorValue = stuff->event.u.u.type;
+

CVS commit: [netbsd-8] xsrc/external/mit

2017-07-07 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Fri Jul  7 14:10:25 UTC 2017

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi [netbsd-8]: sendexev.c
xsrc/external/mit/xorg-server.old/dist/dix [netbsd-8]: events.c
swapreq.c
xsrc/external/mit/xorg-server/dist/Xi [netbsd-8]: sendexev.c
xsrc/external/mit/xorg-server/dist/dix [netbsd-8]: events.c swapreq.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #109):
external/mit/xorg-server.old/dist/Xi/sendexev.c: revision 1.2
external/mit/xorg-server.old/dist/Xi/sendexev.c: revision 1.3
external/mit/xorg-server/dist/dix/events.c: revision 1.2
external/mit/xorg-server.old/dist/dix/events.c: revision 1.2
external/mit/xorg-server/dist/dix/swapreq.c: revision 1.2
external/mit/xorg-server/dist/Xi/sendexev.c: revision 1.4
external/mit/xorg-server.old/dist/dix/swapreq.c: revision 1.2
CVE-2017-10971 and CVE-2017-10972: apply fixes to the event loop from
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3Dba336b24052122b136486961c82deac76bbde455
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3D8caed4df36b1f802b4992edcfd282cbeeec35d9d
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3D215f894965df5fb0bb45b107d84524e700d2073c
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=3D05442de962d3dc624f79fc1a00eca3ffc5489ced
add missing } from the previous. apparently i mis-tested and it didn't compile.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.2.1 \
xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.2.1 \
xsrc/external/mit/xorg-server.old/dist/dix/events.c \
xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c
cvs rdiff -u -r1.3 -r1.3.2.1 xsrc/external/mit/xorg-server/dist/Xi/sendexev.c
cvs rdiff -u -r1.1.1.9 -r1.1.1.9.2.1 \
xsrc/external/mit/xorg-server/dist/dix/events.c
cvs rdiff -u -r1.1.1.3 -r1.1.1.3.2.1 \
xsrc/external/mit/xorg-server/dist/dix/swapreq.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

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 13:57:27 UTC 2017

Modified Files:
src/sbin/route [netbsd-8]: route.8 route.c rtutil.c
src/sys/net [netbsd-8]: if_llatbl.c if_llatbl.h route.c route.h
rtsock.c
src/sys/netinet [netbsd-8]: if_arp.c in.c
src/sys/netinet6 [netbsd-8]: in6.c nd6.c nd6.h
src/tests/net [netbsd-8]: net_common.sh
src/tests/net/arp [netbsd-8]: t_arp.sh
src/tests/net/ndp [netbsd-8]: t_ndp.sh t_ra.sh
src/tests/net/net [netbsd-8]: t_ipv6address.sh
src/tests/net/route [netbsd-8]: t_flags.sh t_flags6.sh t_route.sh
src/usr.sbin/arp [netbsd-8]: arp.c
src/usr.sbin/ndp [netbsd-8]: ndp.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #107):
usr.sbin/arp/arp.c: revision 1.56
sys/net/rtsock.c: revision 1.218
sys/net/if_llatbl.c: revision 1.20
usr.sbin/arp/arp.c: revision 1.57
sys/net/rtsock.c: revision 1.219
sys/net/if_llatbl.c: revision 1.21
usr.sbin/arp/arp.c: revision 1.58
tests/net/net_common.sh: revision 1.19
sys/netinet6/nd6.h: revision 1.84
sys/netinet6/nd6.h: revision 1.85
tests/net/arp/t_arp.sh: revision 1.23
sys/netinet6/in6.c: revision 1.246
tests/net/arp/t_arp.sh: revision 1.24
sys/netinet6/in6.c: revision 1.247
tests/net/arp/t_arp.sh: revision 1.25
sys/netinet6/in6.c: revision 1.248
tests/net/arp/t_arp.sh: revision 1.26
usr.sbin/ndp/ndp.c: revision 1.49
tests/net/arp/t_arp.sh: revision 1.27
tests/net/ndp/t_ndp.sh: revision 1.20
tests/net/arp/t_arp.sh: revision 1.28
tests/net/ndp/t_ndp.sh: revision 1.21
tests/net/arp/t_arp.sh: revision 1.29
tests/net/ndp/t_ndp.sh: revision 1.22
tests/net/ndp/t_ndp.sh: revision 1.23
tests/net/route/t_flags6.sh: revision 1.13
tests/net/ndp/t_ndp.sh: revision 1.24
tests/net/route/t_flags6.sh: revision 1.14
tests/net/ndp/t_ndp.sh: revision 1.25
tests/net/route/t_flags6.sh: revision 1.15
tests/net/ndp/t_ndp.sh: revision 1.26
sbin/route/rtutil.c: revision 1.9
tests/net/ndp/t_ndp.sh: revision 1.27
tests/net/ndp/t_ndp.sh: revision 1.28
tests/net/net/t_ipv6address.sh: revision 1.14
tests/net/ndp/t_ra.sh: revision 1.28
tests/net/ndp/t_ndp.sh: revision 1.29
sys/net/route.h: revision 1.113
tests/net/ndp/t_ra.sh: revision 1.29
sys/net/rtsock.c: revision 1.220
sys/net/rtsock.c: revision 1.221
sys/net/rtsock.c: revision 1.222
sys/net/rtsock.c: revision 1.223
tests/net/route/t_route.sh: revision 1.13
sys/net/rtsock.c: revision 1.224
sys/net/route.c: revision 1.196
sys/net/if_llatbl.c: revision 1.19
sys/net/route.c: revision 1.197
sbin/route/route.c: revision 1.156
tests/net/route/t_flags.sh: revision 1.16
tests/net/route/t_flags.sh: revision 1.17
usr.sbin/ndp/ndp.c: revision 1.50
tests/net/route/t_flags.sh: revision 1.18
sys/netinet/in.c: revision 1.204
tests/net/route/t_flags.sh: revision 1.19
sys/netinet/in.c: revision 1.205
tests/net/arp/t_arp.sh: revision 1.30
tests/net/arp/t_arp.sh: revision 1.31
sys/net/if_llatbl.h: revision 1.11
tests/net/arp/t_arp.sh: revision 1.32
sys/net/if_llatbl.h: revision 1.12
tests/net/arp/t_arp.sh: revision 1.33
sys/netinet6/nd6.c: revision 1.233
sys/netinet6/nd6.c: revision 1.234
sys/netinet/if_arp.c: revision 1.251
sys/netinet6/nd6.c: revision 1.235
sys/netinet/if_arp.c: revision 1.252
sbin/route/route.8: revision 1.57
sys/net/rtsock.c: revision 1.214
sys/net/rtsock.c: revision 1.215
sys/net/rtsock.c: revision 1.216
sys/net/rtsock.c: revision 1.217
whitespace police
Simplify
We can assume that rt_ifp is always non-NULL.
Sending a routing message (RTM_ADD) on adding an llentry
A message used to be sent on adding a cloned route. Restore the
behavior for backward compatibility.
Requested by ryo@
Drop RTF_CONNECTED from a result of RTM_GET for ARP/NDP entries
ARP/NDP entries aren't connected routes.
Reported by ryo@
Support -c  option for route monitor
route command exits if it receives  routing messages where
 is a value specified by -c.
The option is useful to get only particular message(s) in a test script.
Test routing messages emitted on operations of ARP/NDP entries
Do netstat -a for an appropriate protocol
Add missing declarations for cleanup
Set net.inet.arp.keep only if it's required
Don't create a permanent L2 cache entry on adding an address to an interface
It was created to copy FreeBSD, however actually the cache isn't
necessary. Remove it to simplify the code and reduce the cost to
maintain it (e.g., keep a 

CVS commit: [netbsd-8] src

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 13:57:27 UTC 2017

Modified Files:
src/sbin/route [netbsd-8]: route.8 route.c rtutil.c
src/sys/net [netbsd-8]: if_llatbl.c if_llatbl.h route.c route.h
rtsock.c
src/sys/netinet [netbsd-8]: if_arp.c in.c
src/sys/netinet6 [netbsd-8]: in6.c nd6.c nd6.h
src/tests/net [netbsd-8]: net_common.sh
src/tests/net/arp [netbsd-8]: t_arp.sh
src/tests/net/ndp [netbsd-8]: t_ndp.sh t_ra.sh
src/tests/net/net [netbsd-8]: t_ipv6address.sh
src/tests/net/route [netbsd-8]: t_flags.sh t_flags6.sh t_route.sh
src/usr.sbin/arp [netbsd-8]: arp.c
src/usr.sbin/ndp [netbsd-8]: ndp.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #107):
usr.sbin/arp/arp.c: revision 1.56
sys/net/rtsock.c: revision 1.218
sys/net/if_llatbl.c: revision 1.20
usr.sbin/arp/arp.c: revision 1.57
sys/net/rtsock.c: revision 1.219
sys/net/if_llatbl.c: revision 1.21
usr.sbin/arp/arp.c: revision 1.58
tests/net/net_common.sh: revision 1.19
sys/netinet6/nd6.h: revision 1.84
sys/netinet6/nd6.h: revision 1.85
tests/net/arp/t_arp.sh: revision 1.23
sys/netinet6/in6.c: revision 1.246
tests/net/arp/t_arp.sh: revision 1.24
sys/netinet6/in6.c: revision 1.247
tests/net/arp/t_arp.sh: revision 1.25
sys/netinet6/in6.c: revision 1.248
tests/net/arp/t_arp.sh: revision 1.26
usr.sbin/ndp/ndp.c: revision 1.49
tests/net/arp/t_arp.sh: revision 1.27
tests/net/ndp/t_ndp.sh: revision 1.20
tests/net/arp/t_arp.sh: revision 1.28
tests/net/ndp/t_ndp.sh: revision 1.21
tests/net/arp/t_arp.sh: revision 1.29
tests/net/ndp/t_ndp.sh: revision 1.22
tests/net/ndp/t_ndp.sh: revision 1.23
tests/net/route/t_flags6.sh: revision 1.13
tests/net/ndp/t_ndp.sh: revision 1.24
tests/net/route/t_flags6.sh: revision 1.14
tests/net/ndp/t_ndp.sh: revision 1.25
tests/net/route/t_flags6.sh: revision 1.15
tests/net/ndp/t_ndp.sh: revision 1.26
sbin/route/rtutil.c: revision 1.9
tests/net/ndp/t_ndp.sh: revision 1.27
tests/net/ndp/t_ndp.sh: revision 1.28
tests/net/net/t_ipv6address.sh: revision 1.14
tests/net/ndp/t_ra.sh: revision 1.28
tests/net/ndp/t_ndp.sh: revision 1.29
sys/net/route.h: revision 1.113
tests/net/ndp/t_ra.sh: revision 1.29
sys/net/rtsock.c: revision 1.220
sys/net/rtsock.c: revision 1.221
sys/net/rtsock.c: revision 1.222
sys/net/rtsock.c: revision 1.223
tests/net/route/t_route.sh: revision 1.13
sys/net/rtsock.c: revision 1.224
sys/net/route.c: revision 1.196
sys/net/if_llatbl.c: revision 1.19
sys/net/route.c: revision 1.197
sbin/route/route.c: revision 1.156
tests/net/route/t_flags.sh: revision 1.16
tests/net/route/t_flags.sh: revision 1.17
usr.sbin/ndp/ndp.c: revision 1.50
tests/net/route/t_flags.sh: revision 1.18
sys/netinet/in.c: revision 1.204
tests/net/route/t_flags.sh: revision 1.19
sys/netinet/in.c: revision 1.205
tests/net/arp/t_arp.sh: revision 1.30
tests/net/arp/t_arp.sh: revision 1.31
sys/net/if_llatbl.h: revision 1.11
tests/net/arp/t_arp.sh: revision 1.32
sys/net/if_llatbl.h: revision 1.12
tests/net/arp/t_arp.sh: revision 1.33
sys/netinet6/nd6.c: revision 1.233
sys/netinet6/nd6.c: revision 1.234
sys/netinet/if_arp.c: revision 1.251
sys/netinet6/nd6.c: revision 1.235
sys/netinet/if_arp.c: revision 1.252
sbin/route/route.8: revision 1.57
sys/net/rtsock.c: revision 1.214
sys/net/rtsock.c: revision 1.215
sys/net/rtsock.c: revision 1.216
sys/net/rtsock.c: revision 1.217
whitespace police
Simplify
We can assume that rt_ifp is always non-NULL.
Sending a routing message (RTM_ADD) on adding an llentry
A message used to be sent on adding a cloned route. Restore the
behavior for backward compatibility.
Requested by ryo@
Drop RTF_CONNECTED from a result of RTM_GET for ARP/NDP entries
ARP/NDP entries aren't connected routes.
Reported by ryo@
Support -c  option for route monitor
route command exits if it receives  routing messages where
 is a value specified by -c.
The option is useful to get only particular message(s) in a test script.
Test routing messages emitted on operations of ARP/NDP entries
Do netstat -a for an appropriate protocol
Add missing declarations for cleanup
Set net.inet.arp.keep only if it's required
Don't create a permanent L2 cache entry on adding an address to an interface
It was created to copy FreeBSD, however actually the cache isn't
necessary. Remove it to simplify the code and reduce the cost to
maintain it (e.g., keep a 

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

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 13:11:31 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi

Log Message:
Add A83T files


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/files.sunxi

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/sunxi

2017-07-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jul  7 13:11:31 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi

Log Message:
Add A83T files


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/files.sunxi

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

Modified files:

Index: src/sys/arch/arm/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.9 src/sys/arch/arm/sunxi/files.sunxi:1.10
--- src/sys/arch/arm/sunxi/files.sunxi:1.9	Sun Jul  2 18:06:45 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Fri Jul  7 13:11:31 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.9 2017/07/02 18:06:45 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.10 2017/07/07 13:11:31 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -31,6 +31,11 @@ device	sun6ia31ccu: sunxi_ccu
 attach	sun6ia31ccu at fdt with sunxi_a31_ccu
 file	arch/arm/sunxi/sun6i_a31_ccu.c		sunxi_a31_ccu
 
+# CCU (A83T)
+device	sun8ia83tccu: sunxi_ccu
+attach	sun8ia83tccu at fdt with sunxi_a83t_ccu
+file	arch/arm/sunxi/sun8i_a83t_ccu.c		sunxi_a83t_ccu
+
 # CCU (H3)
 device	sun8ih3ccu: sunxi_ccu
 attach	sun8ih3ccu at fdt with sunxi_h3_ccu
@@ -41,6 +46,7 @@ device	sunxigpio: gpiobus
 attach	sunxigpio at fdt with sunxi_gpio
 file	arch/arm/sunxi/sunxi_gpio.c		sunxi_gpio
 file	arch/arm/sunxi/sun6i_a31_gpio.c		sunxi_gpio & soc_sun6i_a31
+file	arch/arm/sunxi/sun8i_a83t_gpio.c	sunxi_gpio & soc_sun8i_a83t
 file	arch/arm/sunxi/sun8i_h3_gpio.c		sunxi_gpio & soc_sun8i_h3
 
 # UART
@@ -88,6 +94,7 @@ file	arch/arm/sunxi/sunxi_emac.c		sunxi_
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN8I: SOC_SUNXI
+defflag	opt_soc.h			SOC_SUN8I_A83T: SOC_SUN8I
 defflag	opt_soc.h			SOC_SUN8I_H3: SOC_SUN8I
 defflag	opt_soc.h			SOC_SUN6I: SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN6I_A31: SOC_SUN6I



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

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 09:46:40 UTC 2017

Modified Files:
src/sys/netinet6 [netbsd-8]: icmp6.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #106):
sys/netinet6/icmp6.c: revision 1.212
fix PR kern/52353. implemented by ozaki-r@n.o. I just commit by proxy.
XXX need to pullup to -8.


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.211.6.1 src/sys/netinet6/icmp6.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/netinet6/icmp6.c
diff -u src/sys/netinet6/icmp6.c:1.211 src/sys/netinet6/icmp6.c:1.211.6.1
--- src/sys/netinet6/icmp6.c:1.211	Tue Mar 14 04:24:04 2017
+++ src/sys/netinet6/icmp6.c	Fri Jul  7 09:46:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: icmp6.c,v 1.211 2017/03/14 04:24:04 ozaki-r Exp $	*/
+/*	$NetBSD: icmp6.c,v 1.211.6.1 2017/07/07 09:46:40 martin Exp $	*/
 /*	$KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.211 2017/03/14 04:24:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.211.6.1 2017/07/07 09:46:40 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -494,6 +494,15 @@ _icmp6_input(struct mbuf *m, int off, in
 		goto freeit;
 	}
 
+	if (m->m_len < sizeof(struct ip6_hdr)) {
+		m = m_pullup(m, sizeof(struct ip6_hdr));
+		if (m == NULL) {
+			ICMP6_STATINC(ICMP6_STAT_TOOSHORT);
+			icmp6_ifstat_inc(rcvif, ifs6_in_error);
+			goto freeit;
+		}
+	}
+
 	ip6 = mtod(m, struct ip6_hdr *);
 	IP6_EXTHDR_GET(icmp6, struct icmp6_hdr *, m, off, sizeof(*icmp6));
 	if (icmp6 == NULL) {



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

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 09:46:40 UTC 2017

Modified Files:
src/sys/netinet6 [netbsd-8]: icmp6.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #106):
sys/netinet6/icmp6.c: revision 1.212
fix PR kern/52353. implemented by ozaki-r@n.o. I just commit by proxy.
XXX need to pullup to -8.


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.211.6.1 src/sys/netinet6/icmp6.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/dev/fdt

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 09:29:23 UTC 2017

Modified Files:
src/sys/dev/fdt [netbsd-8]: gpiokeys.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #101):
sys/dev/fdt/gpiokeys.c: revision 1.3
sys/dev/fdt/gpiokeys.c: revision 1.4
Read the initial key state at startup so we only trigger events on state
changes. Prevents a misconfigured power button from shutting us down at
boot.
Only read gpio pin if the pin is valid


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.12.1 src/sys/dev/fdt/gpiokeys.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/gpiokeys.c
diff -u src/sys/dev/fdt/gpiokeys.c:1.2 src/sys/dev/fdt/gpiokeys.c:1.2.12.1
--- src/sys/dev/fdt/gpiokeys.c:1.2	Wed Dec 16 19:33:55 2015
+++ src/sys/dev/fdt/gpiokeys.c	Fri Jul  7 09:29:23 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gpiokeys.c,v 1.2 2015/12/16 19:33:55 jmcneill Exp $ */
+/* $NetBSD: gpiokeys.c,v 1.2.12.1 2017/07/07 09:29:23 martin Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.2 2015/12/16 19:33:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpiokeys.c,v 1.2.12.1 2017/07/07 09:29:23 martin Exp $");
 
 #include 
 #include 
@@ -128,6 +128,8 @@ gpiokeys_attach(device_t parent, device_
 		key->key_debounce = debounce;
 		key->key_pin = fdtbus_gpio_acquire(child, "gpios",
 		GPIO_PIN_INPUT);
+		if (key->key_pin)
+			key->key_state = fdtbus_gpio_read(key->key_pin);
 
 		key->key_pswitch.smpsw_name = key->key_label;
 		switch (code) {



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

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 09:29:23 UTC 2017

Modified Files:
src/sys/dev/fdt [netbsd-8]: gpiokeys.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #101):
sys/dev/fdt/gpiokeys.c: revision 1.3
sys/dev/fdt/gpiokeys.c: revision 1.4
Read the initial key state at startup so we only trigger events on state
changes. Prevents a misconfigured power button from shutting us down at
boot.
Only read gpio pin if the pin is valid


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.12.1 src/sys/dev/fdt/gpiokeys.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/netinet

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 09:23:01 UTC 2017

Modified Files:
src/sys/netinet [netbsd-8]: ip_output.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #100):
sys/netinet/ip_output.c: revision 1.280
sys/netinet/ip_output.c: revision 1.282
When outputting, search for the sending address on the sending interface
rather than blindly picking the first matcing address from any interface
when testing source address validity.
This allows another interface to have the same address, but be detached.
Rename u to udst, .dst to .sa and .dst4 to sin.
Create sockaddr for the source address in usrc so it won't stamp on udst.
This fixes a regression caused in r1.280


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.279.2.1 src/sys/netinet/ip_output.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/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.279 src/sys/netinet/ip_output.c:1.279.2.1
--- src/sys/netinet/ip_output.c:1.279	Fri May 12 17:53:54 2017
+++ src/sys/netinet/ip_output.c	Fri Jul  7 09:23:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.279 2017/05/12 17:53:54 ryo Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.279.2.1 2017/07/07 09:23:01 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.279 2017/05/12 17:53:54 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.279.2.1 2017/07/07 09:23:01 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -236,18 +236,19 @@ ip_output(struct mbuf *m0, struct mbuf *
 	struct route iproute;
 	const struct sockaddr_in *dst;
 	struct in_ifaddr *ia = NULL;
+	struct ifaddr *ifa;
 	int isbroadcast;
 	int sw_csum;
 	u_long mtu;
 	bool natt_frag = false;
 	bool rtmtu_nolock;
 	union {
-		struct sockaddr		dst;
-		struct sockaddr_in	dst4;
-	} u;
-	struct sockaddr *rdst = 	/* real IP destination, as opposed
-	 * to the nexthop
-	 */
+		struct sockaddr		sa;
+		struct sockaddr_in	sin;
+	} udst, usrc;
+	struct sockaddr *rdst = 	/* real IP destination, as
+		 * opposed to the nexthop
+		 */
 	struct psref psref, psref_ia;
 	int bound;
 	bool bind_need_restore = false;
@@ -288,7 +289,7 @@ ip_output(struct mbuf *m0, struct mbuf *
 		memset(, 0, sizeof(iproute));
 		ro = 
 	}
-	sockaddr_in_init(, >ip_dst, 0);
+	sockaddr_in_init(, >ip_dst, 0);
 	dst = satocsin(rtcache_getdst(ro));
 
 	/*
@@ -303,8 +304,8 @@ ip_output(struct mbuf *m0, struct mbuf *
 
 	if ((rt = rtcache_validate(ro)) == NULL &&
 	(rt = rtcache_update(ro, 1)) == NULL) {
-		dst = 
-		error = rtcache_setdst(ro, );
+		dst = 
+		error = rtcache_setdst(ro, );
 		if (error != 0)
 			goto bad;
 	}
@@ -315,8 +316,6 @@ ip_output(struct mbuf *m0, struct mbuf *
 	 * If routing to interface only, short circuit routing lookup.
 	 */
 	if (flags & IP_ROUTETOIF) {
-		struct ifaddr *ifa;
-
 		ifa = ifa_ifwithladdr_psref(sintocsa(dst), _ia);
 		if (ifa == NULL) {
 			IP_STATINC(IP_STAT_NOROUTE);
@@ -448,7 +447,7 @@ ip_output(struct mbuf *m0, struct mbuf *
 			 * on the outgoing interface, and the caller did not
 			 * forbid loopback, loop back a copy.
 			 */
-			ip_mloopback(ifp, m, );
+			ip_mloopback(ifp, m, );
 		}
 #ifdef MROUTING
 		else {
@@ -612,7 +611,10 @@ sendit:
 	 * validity
 	 */
 	KASSERT(ia == NULL);
-	ia = in_get_ia_psref(ip->ip_src, _ia);
+	sockaddr_in_init(, >ip_src, 0);
+	ifa = ifaof_ifpforaddr_psref(, ifp, _ia);
+	if (ifa != NULL)
+		ia = ifatoia(ifa);
 
 	/*
 	 * Ensure we only send from a valid address.



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

2017-07-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jul  7 09:23:01 UTC 2017

Modified Files:
src/sys/netinet [netbsd-8]: ip_output.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #100):
sys/netinet/ip_output.c: revision 1.280
sys/netinet/ip_output.c: revision 1.282
When outputting, search for the sending address on the sending interface
rather than blindly picking the first matcing address from any interface
when testing source address validity.
This allows another interface to have the same address, but be detached.
Rename u to udst, .dst to .sa and .dst4 to sin.
Create sockaddr for the source address in usrc so it won't stamp on udst.
This fixes a regression caused in r1.280


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.279.2.1 src/sys/netinet/ip_output.c

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



CVS commit: src/doc

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 08:46:49 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
wbsio(4): Add 12 devices.


To generate a diff of this commit:
cvs rdiff -u -r1.2295 -r1.2296 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/doc

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 08:46:49 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
wbsio(4): Add 12 devices.


To generate a diff of this commit:
cvs rdiff -u -r1.2295 -r1.2296 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.2295 src/doc/CHANGES:1.2296
--- src/doc/CHANGES:1.2295	Fri Jun 30 11:55:56 2017
+++ src/doc/CHANGES	Fri Jul  7 08:46:49 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2295 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2296 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -31,3 +31,6 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
  	bind: Import version 9.10.5-P1. [christos 20170615]
 	expat: Import 2.2.1 (security fixes) [christos 20170617]
 	bind: Import version 9.10.5-P2. [christos 20170630]
+	wbsio(4): Add support for Winbond W83627DHG-P, W83627SF, W83627UHG,
+		W83667HGB, W83687THF, W83697UG,	Nuvoton NCT5104D, NCT6775,
+		NCT6779, NCT6791, NCT6792 and NCT6793. [msaitoh 20170707]



CVS commit: src/sys/dev/isa

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 08:42:16 UTC 2017

Modified Files:
src/sys/dev/isa: wbsio.c
Added Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/wbsio.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/isa/wbsioreg.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/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.10 src/sys/dev/isa/wbsio.c:1.11
--- src/sys/dev/isa/wbsio.c:1.10	Wed Jun  1 02:37:47 2016
+++ src/sys/dev/isa/wbsio.c	Fri Jul  7 08:42:15 2017
@@ -1,5 +1,5 @@
-/*	$NetBSD: wbsio.c,v 1.10 2016/06/01 02:37:47 pgoyette Exp $	*/
-/*	$OpenBSD: wbsio.c,v 1.5 2009/03/29 21:53:52 sthen Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.11 2017/07/07 08:42:15 msaitoh Exp $	*/
+/*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis 
  *
@@ -30,37 +30,7 @@
 
 #include 
 #include 
-
-/* ISA bus registers */
-#define WBSIO_INDEX		0x00	/* Configuration Index Register */
-#define WBSIO_DATA		0x01	/* Configuration Data Register */
-
-#define WBSIO_IOSIZE		0x02	/* ISA I/O space size */
-
-#define WBSIO_CONF_EN_MAGIC	0x87	/* enable configuration mode */
-#define WBSIO_CONF_DS_MAGIC	0xaa	/* disable configuration mode */
-
-/* Configuration Space Registers */
-#define WBSIO_LDN		0x07	/* Logical Device Number */
-#define WBSIO_ID		0x20	/* Device ID */
-#define WBSIO_REV		0x21	/* Device Revision */
-
-#define WBSIO_ID_W83627HF	0x52
-#define WBSIO_ID_W83627THF	0x82
-#define WBSIO_ID_W83627EHF	0x88
-#define WBSIO_ID_W83627DHG	0xa0
-#define WBSIO_ID_W83627SF	0x59
-#define WBSIO_ID_W83637HF	0x70
-#define WBSIO_ID_W83667HG	0xa5
-#define WBSIO_ID_W83697HF	0x60
-#define WBSIO_ID_NCT6776F	0xc3
-
-/* Logical Device Number (LDN) Assignments */
-#define WBSIO_LDN_HM		0x0b
-
-/* Hardware Monitor Control Registers (LDN B) */
-#define WBSIO_HM_ADDR_MSB	0x60	/* Address [15:8] */
-#define WBSIO_HM_ADDR_LSB	0x61	/* Address [7:0] */
+#include 
 
 struct wbsio_softc {
 	device_t	sc_dev;
@@ -143,12 +113,24 @@ wbsio_probe(device_t parent, cfdata_t ma
 	bus_space_unmap(iot, ioh, WBSIO_IOSIZE);
 	switch (reg) {
 	case WBSIO_ID_W83627HF:
-	case WBSIO_ID_W83627THF:
-	case WBSIO_ID_W83627EHF:
 	case WBSIO_ID_W83627DHG:
+	case WBSIO_ID_W83627DHGP:
+	case WBSIO_ID_W83627EHF:
+	case WBSIO_ID_W83627SF:
+	case WBSIO_ID_W83627THF:
+	case WBSIO_ID_W83627UHG:
 	case WBSIO_ID_W83637HF:
+	case WBSIO_ID_W83667HG:
+	case WBSIO_ID_W83667HGB:
+	case WBSIO_ID_W83687THF:
 	case WBSIO_ID_W83697HF:
+	case WBSIO_ID_W83697UG:
+	case WBSIO_ID_NCT5104D:
+	case WBSIO_ID_NCT6775:
 	case WBSIO_ID_NCT6776F:
+	case WBSIO_ID_NCT6779:
+	case WBSIO_ID_NCT6791:
+	case WBSIO_ID_NCT6792:
 		ia->ia_nio = 1;
 		ia->ia_io[0].ir_size = WBSIO_IOSIZE;
 		ia->ia_niomem = 0;
@@ -190,14 +172,23 @@ wbsio_attach(device_t parent, device_t s
 	case WBSIO_ID_W83627HF:
 		desc = "W83627HF";
 		break;
-	case WBSIO_ID_W83627THF:
-		desc = "W83627THF";
+	case WBSIO_ID_W83627DHG:
+		desc = "W83627DHG";
+		break;
+	case WBSIO_ID_W83627DHGP:
+		printf("W83627DHG-P");
 		break;
 	case WBSIO_ID_W83627EHF:
 		desc = "W83627EHF";
 		break;
-	case WBSIO_ID_W83627DHG:
-		desc = "W83627DHG";
+	case WBSIO_ID_W83627SF:
+		desc = "W83627SF";
+		break;
+	case WBSIO_ID_W83627THF:
+		desc = "W83627THF";
+		break;
+	case WBSIO_ID_W83627UHG:
+		printf("W83627UHG");
 		break;
 	case WBSIO_ID_W83637HF:
 		desc = "W83637HF";
@@ -205,13 +196,46 @@ wbsio_attach(device_t parent, device_t s
 	case WBSIO_ID_W83667HG:
 		desc = "W83667HG";
 		break;
+	case WBSIO_ID_W83667HGB:
+		desc = "W83667HGB";
+		break;
+	case WBSIO_ID_W83687THF:
+		desc = "W83687THF";
+		break;
 	case WBSIO_ID_W83697HF:
 		desc = "W83697HF";
 		break;
+	case WBSIO_ID_W83697UG:
+		desc = "W83697UG";
+		break;
+	case WBSIO_ID_NCT5104D:
+		vendor = "Nuvoton";
+		printf("NCT5104D");
+		break;
+	case WBSIO_ID_NCT6775:
+		vendor = "Nuvoton";
+		desc = "NCT6775";
+		break;
 	case WBSIO_ID_NCT6776F:
 		vendor = "Nuvoton";
 		desc = "NCT6776F";
 		break;
+	case WBSIO_ID_NCT6779:
+		vendor = "Nuvoton";
+		desc = "NCT6779";
+		break;
+	case WBSIO_ID_NCT6791:
+		vendor = "Nuvoton";
+		desc = "NCT6791";
+		break;
+	case WBSIO_ID_NCT6792:
+		vendor = "Nuvoton";
+		desc = "NCT6792";
+		break;
+	case WBSIO_ID_NCT6793:
+		vendor = "Nuvoton";
+		desc = "NCT6793";
+		break;
 	}
 	/* Read device revision */
 	reg = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_REV);

Added files:

Index: src/sys/dev/isa/wbsioreg.h
diff -u /dev/null src/sys/dev/isa/wbsioreg.h:1.1
--- /dev/null	Fri Jul  7 08:42:16 2017
+++ src/sys/dev/isa/wbsioreg.h	Fri Jul  7 08:42:15 2017
@@ -0,0 +1,64 @@
+/* $Id */
+/* $OpenBSD: wbsioreg.h,v 1.4 2015/01/02 23:02:54 chris Exp $ */
+/*
+ * 

CVS commit: src/sys/dev/isa

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 08:42:16 UTC 2017

Modified Files:
src/sys/dev/isa: wbsio.c
Added Files:
src/sys/dev/isa: wbsioreg.h

Log Message:
 Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/isa/wbsio.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/isa/wbsioreg.h

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



CVS commit: src/libexec/httpd

2017-07-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jul  7 07:05:49 UTC 2017

Modified Files:
src/libexec/httpd: bozohttpd.8

Log Message:
fix ordering of a couple of words.  from Edgar Pettijohn in PR#52375.
thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/libexec/httpd/bozohttpd.8

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



CVS commit: src/libexec/httpd

2017-07-07 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Jul  7 07:05:49 UTC 2017

Modified Files:
src/libexec/httpd: bozohttpd.8

Log Message:
fix ordering of a couple of words.  from Edgar Pettijohn in PR#52375.
thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/libexec/httpd/bozohttpd.8

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

Modified files:

Index: src/libexec/httpd/bozohttpd.8
diff -u src/libexec/httpd/bozohttpd.8:1.66 src/libexec/httpd/bozohttpd.8:1.67
--- src/libexec/httpd/bozohttpd.8:1.66	Mon Jul  3 21:35:48 2017
+++ src/libexec/httpd/bozohttpd.8	Fri Jul  7 07:05:49 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: bozohttpd.8,v 1.66 2017/07/03 21:35:48 wiz Exp $
+.\"	$NetBSD: bozohttpd.8,v 1.67 2017/07/07 07:05:49 mrg Exp $
 .\"
 .\"	$eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $
 .\"
@@ -488,7 +488,7 @@ will redirect to
 .Em http://NetBSD.org/
 Otherwise provided schema will be used i.e. symbolic link to
 .Em ftp://NetBSD.org/
-will redirect to provided the URL.
+will redirect to the provided URL.
 .Sh EXAMPLES
 To configure set of virtual hosts, one would use an
 .Xr inetd.conf 5



CVS commit: src/sys/dev/pci

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 06:53:04 UTC 2017

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1285 -r1.1286 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1284 -r1.1285 src/sys/dev/pci/pcidevs_data.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/pci

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 06:52:24 UTC 2017

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add Atom Z8000 devices from "Intel Atom Z8000 Processor Series Datasheet
(Volume 2 of 2)".


To generate a diff of this commit:
cvs rdiff -u -r1.1292 -r1.1293 src/sys/dev/pci/pcidevs

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



CVS commit: xsrc/external/mit/xorg-server.old/dist/Xi

2017-07-07 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Fri Jul  7 06:52:17 UTC 2017

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi: sendexev.c

Log Message:
add missing } from the previous. apparently i mis-tested and it didn't compile.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
diff -u xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.2 xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.3
--- xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.2	Fri Jul  7 06:08:45 2017
+++ xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c	Fri Jul  7 06:52:17 2017
@@ -154,6 +154,7 @@ ProcXSendExtensionEvent(ClientPtr client
 client->errorValue = first[i].u.u.type;
 return BadValue;
 }
+}
 
 list = (XEventClass *) (first + stuff->num_events);
 if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,



CVS commit: src/sys/dev/pci

2017-07-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Jul  7 06:52:24 UTC 2017

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add Atom Z8000 devices from "Intel Atom Z8000 Processor Series Datasheet
(Volume 2 of 2)".


To generate a diff of this commit:
cvs rdiff -u -r1.1292 -r1.1293 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1292 src/sys/dev/pci/pcidevs:1.1293
--- src/sys/dev/pci/pcidevs:1.1292	Tue Jul  4 05:02:47 2017
+++ src/sys/dev/pci/pcidevs	Fri Jul  7 06:52:24 2017
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1292 2017/07/04 05:02:47 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1293 2017/07/07 06:52:24 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3356,8 +3356,12 @@ product INTEL C2000_25GBE	0x1f45	C2000 E
 product INTEL BSW_HB		0x2280	Braswell Soc Transaction Router
 product INTEL BSW_HDA		0x2284	Braswell HD Audio
 product INTEL BSW_SIO_DMA_2	0x2286	Braswell SIO DMA
+product INTEL Z8K_LPIO1_PWM_1	0x2288	Atom Z8000 LPIO1 PWM1
+product INTEL Z8K_LPIO1_PWM_2	0x2289	Atom Z8000 LPIO1 PWM2
 product INTEL BSW_SIO_HSUART_1	0x228a	Braswell Serial
 product INTEL BSW_SIO_HSUART_2	0x228c	Braswell Serial
+product INTEL Z8K_LPIO1_SPI_1	0x228e	Atom Z8000 LPIO1 SPI1
+product INTEL Z8K_LPIO1_SPI_2	0x2290	Atom Z8000 LPIO1 SPI2
 product INTEL BSW_PCU_SMB	0x2292	Braswell PCU SMBus
 product INTEL BSW_SSC_MMC	0x2294	Braswell SCC MMC Port
 product INTEL BSW_SSC_SDIO	0x2295	Braswell SCC SDIO Port
@@ -3366,11 +3370,13 @@ product INTEL BSW_TXE		0x2298	Braswell T
 product INTEL BSW_PCU_LPC	0x229c	Braswell PCU LPC
 product INTEL BSW_AHCI		0x22a3	Braswell AHCI
 product INTEL BSW_LPE_AUDIO	0x22a8	Braswell Low Power Engine Audio
+product INTEL Z8K_LPIO1_SPI_3	0x22ac	Atom Z8000 LPIO1 SPI3
 product INTEL CHV_IGD_1		0x22b0	HD Graphics
 product INTEL CHV_IGD_2		0x22b1	HD Graphics
 product INTEL CHV_IGD_3		0x22b2	HD Graphics
 product INTEL CHV_IGD_4		0x22b3	HD Graphics
 product INTEL BSW_XHCI		0x22b5	Braswell xHCI
+product INTEL Z8K_USBOTG	0x22b7	Atom Z8000 USB (OTG)
 product INTEL BSW_ISP_CAMERA	0x22b8	Braswell ISP Camera
 product INTEL BSW_SIO_DMA_1	0x22c0	Braswell SIO DMA
 product INTEL BSW_SIO_I2C_1	0x22c1	Braswell SIO I2C
@@ -3384,6 +3390,7 @@ product INTEL BSW_PCIE_1	0x22c8	Braswell
 product INTEL BSW_PCIE_2	0x22ca	Braswell PCIe
 product INTEL BSW_PCIE_3	0x22cc	Braswell PCIe
 product INTEL BSW_PCIE_4	0x22ce	Braswell PCIe
+product INTEL Z8K_IOSF2OCP	0x22d8	Atom Z8000 IOSF2OCP
 product INTEL BSW_PUINT		0x22dc	Braswell Power Management
 product INTEL DH89XXCC_LPC	0x2310	DH89xxCC LPC Controller
 product INTEL DH89XXCC_SATA_1	0x2323	DH89xxCC SATA Controller



CVS commit: xsrc/external/mit/xorg-server.old/dist/Xi

2017-07-07 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Fri Jul  7 06:52:17 UTC 2017

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi: sendexev.c

Log Message:
add missing } from the previous. apparently i mis-tested and it didn't compile.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c

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



CVS commit: xsrc/external/mit/xorg-server.old/dist

2017-07-07 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Fri Jul  7 06:08:45 UTC 2017

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi: sendexev.c
xsrc/external/mit/xorg-server.old/dist/dix: events.c swapreq.c

Log Message:
CVE-2017-10971 and CVE-2017-10972: apply fixes to the event loop from

   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=ba336b24052122b136486961c82deac76bbde455
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=8caed4df36b1f802b4992edcfd282cbeeec35d9d
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=215f894965df5fb0bb45b107d84524e700d2073c
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=05442de962d3dc624f79fc1a00eca3ffc5489ced

XXX: pullup-[678] (6/7 also need xfree port.)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/dix/events.c \
xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c

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



CVS commit: xsrc/external/mit/xorg-server.old/dist

2017-07-07 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Fri Jul  7 06:08:45 UTC 2017

Modified Files:
xsrc/external/mit/xorg-server.old/dist/Xi: sendexev.c
xsrc/external/mit/xorg-server.old/dist/dix: events.c swapreq.c

Log Message:
CVE-2017-10971 and CVE-2017-10972: apply fixes to the event loop from

   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=ba336b24052122b136486961c82deac76bbde455
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=8caed4df36b1f802b4992edcfd282cbeeec35d9d
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=215f894965df5fb0bb45b107d84524e700d2073c
   
https://cgit.freedesktop.org/xorg/xserver/commit/?id=05442de962d3dc624f79fc1a00eca3ffc5489ced

XXX: pullup-[678] (6/7 also need xfree port.)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
xsrc/external/mit/xorg-server.old/dist/dix/events.c \
xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c

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

Modified files:

Index: xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c
diff -u xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.2
--- xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/Xi/sendexev.c	Fri Jul  7 06:08:45 2017
@@ -79,7 +79,7 @@ SProcXSendExtensionEvent(ClientPtr clien
 char n;
 CARD32 *p;
 int i;
-xEvent eventT;
+xEvent eventT = { .u.u.type = 0 };
 xEvent *eventP;
 EventSwapPtr proc;
 
@@ -95,9 +95,17 @@ SProcXSendExtensionEvent(ClientPtr clien
 
 eventP = (xEvent *) & stuff[1];
 for (i = 0; i < stuff->num_events; i++, eventP++) {
+if (eventP->u.u.type == GenericEvent) {
+client->errorValue = eventP->u.u.type;
+return BadValue;
+}
+
 	proc = EventSwapVector[eventP->u.u.type & 0177];
-	if (proc == NotImplemented)	/* no swapping proc; invalid event type? */
+/* no swapping proc; invalid event type? */
+if (proc == NotImplemented) {
+client->errorValue = eventP->u.u.type;
 	return BadValue;
+}
 	(*proc) (eventP, );
 	*eventP = eventT;
 }
@@ -117,7 +125,7 @@ SProcXSendExtensionEvent(ClientPtr clien
 int
 ProcXSendExtensionEvent(ClientPtr client)
 {
-int ret;
+int ret, i;
 DeviceIntPtr dev;
 xEvent *first;
 XEventClass *list;
@@ -140,11 +148,12 @@ ProcXSendExtensionEvent(ClientPtr client
 /* The client's event type must be one defined by an extension. */
 
 first = ((xEvent *) & stuff[1]);
-if (!((EXTENSION_EVENT_BASE <= first->u.u.type) &&
-	  (first->u.u.type < lastEvent))) {
-	client->errorValue = first->u.u.type;
-	return BadValue;
-}
+for (i = 0; i < stuff->num_events; i++) {
+if (!((EXTENSION_EVENT_BASE <= first[i].u.u.type) &&
+(first[i].u.u.type < lastEvent))) {
+client->errorValue = first[i].u.u.type;
+return BadValue;
+}
 
 list = (XEventClass *) (first + stuff->num_events);
 if ((ret = CreateMaskFromList(client, list, stuff->count, tmp, dev,

Index: xsrc/external/mit/xorg-server.old/dist/dix/events.c
diff -u xsrc/external/mit/xorg-server.old/dist/dix/events.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/dix/events.c:1.2
--- xsrc/external/mit/xorg-server.old/dist/dix/events.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/dix/events.c	Fri Jul  7 06:08:45 2017
@@ -5021,6 +5021,12 @@ ProcSendEvent(ClientPtr client)
 	client->errorValue = stuff->event.u.u.type;
 	return BadValue;
 }
+/* Generic events can have variable size, but SendEvent request holds
+   exactly 32B of event data. */
+if (stuff->event.u.u.type == GenericEvent) {
+client->errorValue = stuff->event.u.u.type;
+return BadValue;
+}
 if (stuff->event.u.u.type == ClientMessage &&
 	stuff->event.u.u.detail != 8 &&
 	stuff->event.u.u.detail != 16 &&
Index: xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c
diff -u xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c:1.1.1.1 xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c:1.2
--- xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c:1.1.1.1	Thu Jun  9 09:07:56 2016
+++ xsrc/external/mit/xorg-server.old/dist/dix/swapreq.c	Fri Jul  7 06:08:45 2017
@@ -315,6 +315,13 @@ SProcSendEvent(ClientPtr client)
 swapl(>destination, n);
 swapl(>eventMask, n);
 
+/* Generic events can have variable size, but SendEvent request holds
+   exactly 32B of event data. */
+if (stuff->event.u.u.type == GenericEvent) {
+client->errorValue = stuff->event.u.u.type;
+return BadValue;
+}
+
 /* Swap event */
 proc = EventSwapVector[stuff->event.u.u.type & 0177];
 if (!proc ||  proc ==