CVS commit: src

2018-10-21 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Oct 21 21:25:53 UTC 2018

Added Files:
src: README.md

Log Message:
Add a README.md.

This document attempts to describe some commonly needed use-cases.
The build.sh command is opinionated but it's for the sake of having
a command that can be copied and probably works without needing to
inform the user about what various options do.

Discussed in tech-toolchain. I've added some links suggested by kamil
and switched to calling arm64 'aarch64' as requested by richard earnshaw.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/README.md

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

Added files:

Index: src/README.md
diff -u /dev/null src/README.md:1.1
--- /dev/null	Sun Oct 21 21:25:53 2018
+++ src/README.md	Sun Oct 21 21:25:53 2018
@@ -0,0 +1,48 @@
+NetBSD
+--
+
+NetBSD is a complete operating system.  
+It supports a wide range of machines from recent aarch64 and amd64
+machines to VAX and M68k.
+
+Building
+
+
+Cross-building is possible from most UNIX-like operating systems.  
+To build for amd64 (x86_64), in the src directory:  
+./build.sh -U -u -j4 -m amd64 -O ~/obj release
+
+Additional build information available in the BUILDING file.
+
+Binaries
+
+
+- [Daily builds](https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/)  
+- [Releases](https://cdn.netbsd.org/pub/NetBSD/)
+
+Testing
+---
+
+On a running NetBSD system  
+cd /usr/tests; atf-run |atf-report
+
+Troubleshooting
+---
+
+- Bugs and patches can be sent [via web form](https://www.netbsd.org/cgi-bin/sendpr.cgi?gndb=netbsd).  
+- Several [mailing lists](https://www.netbsd.org/mailinglists/) exist.  
+  The netbsd-users list is a good choice for many problems.  
+- A community IRC channel exist on [#netbsd @ freenode](https://webchat.freenode.net/?channels=#netbsd)
+
+Latest sources
+--
+
+To fetch the main CVS repository:  
+cvs -d anon...@anoncvs.netbsd.org:/cvsroot checkout -P src
+
+Additional Links
+
+
+[The NetBSD Guide](https://www.netbsd.org/docs/guide/en/)
+[NetBSD manual pages](http://man.netbsd.org/)
+[NetBSD Cross-Reference](https://nxr.netbsd.org/)



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 21:18:59 UTC 2018

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

Log Message:
Add gicvthree at acpi


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.55 src/sys/arch/evbarm/conf/GENERIC64:1.56
--- src/sys/arch/evbarm/conf/GENERIC64:1.55	Sun Oct 21 18:32:23 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Oct 21 21:18:59 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.55 2018/10/21 18:32:23 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.56 2018/10/21 21:18:59 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -146,6 +146,7 @@ gic*		at fdt? pass 1		# ARM GICv2
 gic*		at acpi?
 armgic0		at gic?
 gicvthree*	at fdt? pass 1		# ARM GICv3
+gicvthree*	at acpi?
 sunxinmi*	at fdt? pass 2		# Allwinner NMI / R_INTC
 
 # Memory controller



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 21:18:41 UTC 2018

Modified Files:
src/sys/arch/arm/acpi: files.acpi
Added Files:
src/sys/arch/arm/acpi: gicv3_acpi.c

Log Message:
Add GICv3 ACPI attachment glue.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/acpi/files.acpi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/acpi/gicv3_acpi.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/acpi/files.acpi
diff -u src/sys/arch/arm/acpi/files.acpi:1.2 src/sys/arch/arm/acpi/files.acpi:1.3
--- src/sys/arch/arm/acpi/files.acpi:1.2	Mon Oct 15 11:35:03 2018
+++ src/sys/arch/arm/acpi/files.acpi	Sun Oct 21 21:18:41 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.2 2018/10/15 11:35:03 jmcneill Exp $
+#	$NetBSD: files.acpi,v 1.3 2018/10/21 21:18:41 jmcneill Exp $
 #
 # Configuration info for ACPI compliant ARM boards.
 #
@@ -21,6 +21,9 @@ file	arch/arm/acpi/cpu_acpi.c		cpu_acpi
 attach	gic at acpimadtbus with gic_acpi
 file	arch/arm/acpi/gic_acpi.c		gic_acpi
 
+attach	gicvthree at acpimadtbus with gicv3_acpi
+file	arch/arm/acpi/gicv3_acpi.c		gicv3_acpi
+
 attach	gtmr at acpisdtbus with gtmr_acpi
 file	arch/arm/acpi/gtmr_acpi.c		gtmr_acpi
 

Added files:

Index: src/sys/arch/arm/acpi/gicv3_acpi.c
diff -u /dev/null src/sys/arch/arm/acpi/gicv3_acpi.c:1.1
--- /dev/null	Sun Oct 21 21:18:41 2018
+++ src/sys/arch/arm/acpi/gicv3_acpi.c	Sun Oct 21 21:18:41 2018
@@ -0,0 +1,266 @@
+/* $NetBSD: gicv3_acpi.c,v 1.1 2018/10/21 21:18:41 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jared McNeill .
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#define	_INTR_PRIVATE
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: gicv3_acpi.c,v 1.1 2018/10/21 21:18:41 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#define	GICD_SIZE	0x1
+#define	GICR_SIZE	0x2
+
+extern struct bus_space arm_generic_bs_tag;
+
+struct gicv3_acpi_softc {
+	struct gicv3_softc	sc_gic;
+
+	ACPI_MADT_GENERIC_DISTRIBUTOR *sc_madt_gicd;
+};
+
+static int	gicv3_acpi_match(device_t, cfdata_t, void *);
+static void	gicv3_acpi_attach(device_t, device_t, void *);
+
+static int	gicv3_acpi_map_dist(struct gicv3_acpi_softc *);
+static int	gicv3_acpi_map_redist(struct gicv3_acpi_softc *);
+
+CFATTACH_DECL_NEW(gicv3_acpi, sizeof(struct gicv3_acpi_softc), gicv3_acpi_match, gicv3_acpi_attach, NULL, NULL);
+
+static int
+gicv3_acpi_match(device_t parent, cfdata_t cf, void *aux)
+{
+	ACPI_SUBTABLE_HEADER *hdrp = aux;
+	ACPI_MADT_GENERIC_DISTRIBUTOR *gicd;
+
+	if (hdrp->Type != ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR)
+		return 0;
+
+	gicd = (ACPI_MADT_GENERIC_DISTRIBUTOR *)hdrp;
+
+	switch (gicd->Version) {
+	case ACPI_MADT_GIC_VERSION_NONE:
+		return __SHIFTOUT(reg_id_aa64pfr0_el1_read(), ID_AA64PFR0_EL1_GIC) == 1;
+	case ACPI_MADT_GIC_VERSION_V3:
+	case ACPI_MADT_GIC_VERSION_V4:
+		return 1;
+	default:
+		return 0;
+	}
+}
+
+static void
+gicv3_acpi_attach(device_t parent, device_t self, void *aux)
+{
+	struct gicv3_acpi_softc * const sc = device_private(self);
+	ACPI_MADT_GENERIC_DISTRIBUTOR *gicd = aux;
+	int error;
+
+	sc->sc_gic.sc_dev = self;
+	sc->sc_gic.sc_bst = &arm_generic_bs_tag;
+	sc->sc_madt_gicd = gicd;
+
+	aprint_naive("\n");
+	aprint_normal(": GICv3\n");
+
+	error = gicv3_acpi_map_dist(sc);
+	if (error) {
+		aprint_error_dev(self, "failed to map distributor: %d\n", error);
+		return;
+	}
+
+	error = gicv3_acpi_

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

2018-10-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Oct 21 19:16:48 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
testing done (including PMP on siisata(4) and ATAPI cd(4) on ahcisata/siisata)


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.16 -r1.4.2.17 src/sys/dev/ata/TODO.ncq

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

Modified files:

Index: src/sys/dev/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4.2.16 src/sys/dev/ata/TODO.ncq:1.4.2.17
--- src/sys/dev/ata/TODO.ncq:1.4.2.16	Wed Oct 17 18:03:26 2018
+++ src/sys/dev/ata/TODO.ncq	Sun Oct 21 19:16:48 2018
@@ -1,7 +1,3 @@
-jdolecek-ncqfixes to finish:
-- re-check READ LOG EXT handling under native
-- recheck native working for ahcisata(4), siisata(4), mvsata(4) + PMP
-
 Bugs
 
 test wd* at umass?, confirm the ata_channel kludge works
@@ -29,7 +25,7 @@ add support for the NCQ TRIM if supporte
 
 implement DIOCGCACHE/DIOCCACHESYNC for ld@ataraid? just passthrough, like ccd
 
-MSI/MSI-X support for AHCI and mvsata(4)
+MSI/MSI-X support for ahcisata(4), siisata(4) and mvsata(4)
 
 mvsata - move pci-specific code to the pci attach code
 



CVS commit: src/sys/dev/acpi

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 18:31:58 UTC 2018

Modified Files:
src/sys/dev/acpi: plgpio_acpi.c

Log Message:
Add support for GPIO interrupt signaled ACPI events.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/plgpio_acpi.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/acpi/plgpio_acpi.c
diff -u src/sys/dev/acpi/plgpio_acpi.c:1.1 src/sys/dev/acpi/plgpio_acpi.c:1.2
--- src/sys/dev/acpi/plgpio_acpi.c:1.1	Mon Oct 15 23:59:16 2018
+++ src/sys/dev/acpi/plgpio_acpi.c	Sun Oct 21 18:31:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: plgpio_acpi.c,v 1.1 2018/10/15 23:59:16 jmcneill Exp $ */
+/* $NetBSD: plgpio_acpi.c,v 1.2 2018/10/21 18:31:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: plgpio_acpi.c,v 1.1 2018/10/15 23:59:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plgpio_acpi.c,v 1.2 2018/10/21 18:31:58 jmcneill Exp $");
 
 #include 
 #include 
@@ -43,11 +43,35 @@ __KERNEL_RCSID(0, "$NetBSD: plgpio_acpi.
 
 #include 
 #include 
+#include 
+
+struct plgpio_acpi_softc;
+
+struct plgpio_acpi_event {
+	struct plgpio_acpi_softc *ev_sc;
+	u_int			ev_pin;
+	ACPI_HANDLE		ev_method;
+	bool			ev_method_evt;
+};
+
+struct plgpio_acpi_softc {
+	struct plgpio_softc	sc_base;
+
+	ACPI_HANDLE		sc_handle;
+	uint32_t		sc_aei_pins;		/* bitmask */
+	ACPI_RESOURCE_GPIO	sc_aei_res[8];
+
+	struct plgpio_acpi_event sc_event[8];
+};
 
 static int	plgpio_acpi_match(device_t, cfdata_t, void *);
 static void	plgpio_acpi_attach(device_t, device_t, void *);
 
-CFATTACH_DECL_NEW(plgpio_acpi, sizeof(struct plgpio_softc), plgpio_acpi_match, plgpio_acpi_attach, NULL, NULL);
+static void	plgpio_acpi_init(struct plgpio_acpi_softc *);
+static void	plgpio_acpi_notify(void *);
+static int	plgpio_acpi_intr(void *);
+
+CFATTACH_DECL_NEW(plgpio_acpi, sizeof(struct plgpio_acpi_softc), plgpio_acpi_match, plgpio_acpi_attach, NULL, NULL);
 
 static const char * const compatible[] = {
 	"ARMH0061",
@@ -68,14 +92,18 @@ plgpio_acpi_match(device_t parent, cfdat
 static void
 plgpio_acpi_attach(device_t parent, device_t self, void *aux)
 {
-	struct plgpio_softc * const sc = device_private(self);
+	struct plgpio_acpi_softc * const asc = device_private(self);
+	struct plgpio_softc * const sc = &asc->sc_base;
 	struct acpi_attach_args *aa = aux;
 	struct acpi_resources res;
 	struct acpi_mem *mem;
+	struct acpi_irq *irq;
 	ACPI_STATUS rv;
 	int error;
+	void *ih;
 
 	sc->sc_dev = self;
+	asc->sc_handle = aa->aa_node->ad_handle;
 
 	rv = acpi_resource_parse(sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
 	&res, &acpi_resource_parse_ops_default);
@@ -88,6 +116,12 @@ plgpio_acpi_attach(device_t parent, devi
 		goto done;
 	}
 
+	irq = acpi_res_irq(&res, 0);
+	if (mem == NULL) {
+		aprint_error_dev(self, "couldn't find irq resource\n");
+		goto done;
+	}
+
 	sc->sc_dev = self;
 	sc->sc_bst = aa->aa_memt;
 	error = bus_space_map(sc->sc_bst, mem->ar_base, mem->ar_length, 0, &sc->sc_bsh);
@@ -98,6 +132,184 @@ plgpio_acpi_attach(device_t parent, devi
 
 	plgpio_attach(sc);
 
+	const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
+	ih = intr_establish(irq->ar_irq, IPL_VM, type, plgpio_acpi_intr, asc);
+	if (ih == NULL)
+		aprint_error_dev(self, "couldn't establish interrupt\n");
+
+	plgpio_acpi_init(asc);
+
 done:
 	acpi_resource_cleanup(&res);
 }
+
+static ACPI_STATUS
+plgpio_acpi_resource_cb(ACPI_RESOURCE *res, void *ctx)
+{
+	struct plgpio_acpi_softc * const asc = ctx;
+	ACPI_RESOURCE_GPIO *gpio;
+	UINT16 pin;
+
+	if (res->Type != ACPI_RESOURCE_TYPE_GPIO)
+		return AE_OK;
+
+	gpio = &res->Data.Gpio;
+	if (gpio->ConnectionType != ACPI_RESOURCE_GPIO_TYPE_INT ||
+	gpio->PinTableLength != 1)
+		return AE_OK;
+
+	pin = gpio->PinTable[0];
+	if (pin >= __arraycount(asc->sc_aei_res)) {
+		aprint_error_dev(asc->sc_base.sc_dev, "_AEI pin %u out of range\n", pin);
+		return AE_OK;
+	}
+
+	asc->sc_aei_pins |= __BIT(pin);
+	asc->sc_aei_res[pin] = *gpio;
+
+	return AE_OK;
+}
+
+static void
+plgpio_acpi_init(struct plgpio_acpi_softc *asc)
+{
+	struct plgpio_softc * const sc = &asc->sc_base;
+	ACPI_RESOURCE_GPIO *gpio;
+	ACPI_HANDLE handle;
+	char namebuf[5];
+	ACPI_STATUS rv;
+	uint32_t ibe, iev, is, ie;
+	int pin;
+
+	rv = AcpiWalkResources(asc->sc_handle, "_AEI", plgpio_acpi_resource_cb, asc);
+	if (ACPI_FAILURE(rv)) {
+		if (rv != AE_NOT_FOUND)
+			aprint_error_dev(asc->sc_base.sc_dev, "failed to parse _AEI: %s\n",
+			AcpiFormatException(rv));
+		return;
+	}
+
+	if (!asc->sc_aei_pins)
+		return;
+
+	aprint_verbose_dev(asc->sc_base.sc_dev, "ACPI event pins: %#x\n", asc->sc_aei_pins);
+
+	sc->sc_reserved_mask = asc->sc_aei_pins;
+
+	/*
+	 * For each event pin, find the corresponding event method (_Exx, _Lxx, or _EVT).
+	 */
+	for (pin = 0; pin < __arraycount(asc->sc_aei_res); pi

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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 18:32:23 UTC 2018

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

Log Message:
Add acpibut at acpi, acpilid at acpi


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.54 src/sys/arch/evbarm/conf/GENERIC64:1.55
--- src/sys/arch/evbarm/conf/GENERIC64:1.54	Sun Oct 21 12:26:59 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Oct 21 18:32:23 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.54 2018/10/21 12:26:59 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.55 2018/10/21 18:32:23 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -100,6 +100,8 @@ simplebus*	at fdt? pass 0
 # ACPI support
 acpifdt*	at fdt? pass 1
 acpi*		at acpifdt?
+acpibut*	at acpi?
+acpilid*	at acpi?
 
 # CPUs
 cpus*		at fdt? pass 0



CVS commit: src/sys/dev/ic

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 18:31:14 UTC 2018

Modified Files:
src/sys/dev/ic: pl061.c pl061var.h

Log Message:
Allow bus glue to reserve pins for private use


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/pl061.c src/sys/dev/ic/pl061var.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/ic/pl061.c
diff -u src/sys/dev/ic/pl061.c:1.1 src/sys/dev/ic/pl061.c:1.2
--- src/sys/dev/ic/pl061.c:1.1	Mon Oct 15 23:50:48 2018
+++ src/sys/dev/ic/pl061.c	Sun Oct 21 18:31:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pl061.c,v 1.1 2018/10/15 23:50:48 jmcneill Exp $ */
+/* $NetBSD: pl061.c,v 1.2 2018/10/21 18:31:14 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pl061.c,v 1.1 2018/10/15 23:50:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pl061.c,v 1.2 2018/10/21 18:31:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,7 +55,8 @@ plgpio_attach(struct plgpio_softc *sc)
 	sc->sc_gc.gp_pin_write = plgpio_pin_write;
 	sc->sc_gc.gp_pin_ctl = plgpio_pin_ctl;
 
-	const uint32_t cnf = PLGPIO_READ(sc, PL061_GPIOAFSEL_REG);
+	const uint32_t cnf = PLGPIO_READ(sc, PL061_GPIOAFSEL_REG) |
+	sc->sc_reserved_mask;
 
 	for (pin = 0; pin < 8; pin++) {
 		sc->sc_pins[pin].pin_num = pin;
Index: src/sys/dev/ic/pl061var.h
diff -u src/sys/dev/ic/pl061var.h:1.1 src/sys/dev/ic/pl061var.h:1.2
--- src/sys/dev/ic/pl061var.h:1.1	Mon Oct 15 23:50:48 2018
+++ src/sys/dev/ic/pl061var.h	Sun Oct 21 18:31:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pl061var.h,v 1.1 2018/10/15 23:50:48 jmcneill Exp $ */
+/* $NetBSD: pl061var.h,v 1.2 2018/10/21 18:31:14 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -36,6 +36,8 @@ struct plgpio_softc {
 
 	struct gpio_chipset_tag	sc_gc;
 	gpio_pin_t		sc_pins[8];
+
+	uint32_t		sc_reserved_mask;
 };
 
 void	plgpio_attach(struct plgpio_softc *);



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

2018-10-21 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Oct 21 18:13:14 UTC 2018

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

Log Message:
decouple siisata_reset_channel() from siisata_reinit_port(); the former
now needs channel lock, but we don't have it in siisata_init_port()
during attach

instead call siisata_reset_channel() when siisata_reinit_port() fails,
and ignore the error during attach


To generate a diff of this commit:
cvs rdiff -u -r1.35.6.10 -r1.35.6.11 src/sys/dev/ic/siisata.c

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

Modified files:

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.35.6.10 src/sys/dev/ic/siisata.c:1.35.6.11
--- src/sys/dev/ic/siisata.c:1.35.6.10	Mon Oct 15 21:18:53 2018
+++ src/sys/dev/ic/siisata.c	Sun Oct 21 18:13:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.35.6.10 2018/10/15 21:18:53 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.35.6.11 2018/10/21 18:13:14 jdolecek Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.10 2018/10/15 21:18:53 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.35.6.11 2018/10/21 18:13:14 jdolecek Exp $");
 
 #include 
 #include 
@@ -162,7 +162,7 @@ void siisata_bio_abort(struct ata_channe
 void siisata_bio_kill_xfer(struct ata_channel *, struct ata_xfer *, int);
 int siisata_exec_command(struct ata_drive_datas *, struct ata_xfer *);
 
-static void siisata_reinit_port(struct ata_channel *, int);
+static int siisata_reinit_port(struct ata_channel *, int);
 static void siisata_device_reset(struct ata_channel *);
 static void siisata_activate_prb(struct siisata_channel *, int);
 static void siisata_deactivate_prb(struct siisata_channel *, int);
@@ -261,11 +261,12 @@ siisata_enable_port_interrupt(struct ata
 	PR_PIS_CMDERRR | PR_PIS_CMDCMPL);
 }
 
-static void
+static int
 siisata_init_port(struct siisata_softc *sc, int port)
 {
 	struct siisata_channel *schp;
 	struct ata_channel *chp;
+	int error;
 
 	schp = &sc->sc_channels[port];
 	chp = (struct ata_channel *)schp;
@@ -277,11 +278,13 @@ siisata_init_port(struct siisata_softc *
 	PRWRITE(sc, PRX(chp->ch_channel, PRO_PCC),
 	PR_PC_32BA | PR_PC_INCOR | PR_PC_PORT_RESET);
 	/* initialize port */
-	siisata_reinit_port(chp, -1);
+	error = siisata_reinit_port(chp, -1);
 	/* enable CmdErrr+CmdCmpl interrupting */
 	siisata_enable_port_interrupt(chp);
 	/* enable port interrupt */
 	GRWRITE(sc, GR_GC, GRREAD(sc, GR_GC) | GR_GC_PXIE(chp->ch_channel));
+
+	return error;
 }
 
 static void
@@ -398,7 +401,7 @@ siisata_attach_port(struct siisata_softc
 		return;
 	}
 
-	siisata_init_port(sc, port);
+	(void)siisata_init_port(sc, port);
 
 	ata_channel_attach(chp);
 
@@ -450,15 +453,22 @@ siisata_detach(struct siisata_softc *sc,
 void
 siisata_resume(struct siisata_softc *sc)
 {
-	int i;
-
 	/* come out of reset state */
 	GRWRITE(sc, GR_GC, 0);
 
-	for (i = 0; i < sc->sc_atac.atac_nchannels; i++) {
-		siisata_init_port(sc, i);
-	}
+	for (int port = 0; port < sc->sc_atac.atac_nchannels; port++) {
+		int error;
+
+		error = siisata_init_port(sc, port);
+		if (error) {
+			struct siisata_channel *schp = &sc->sc_channels[port];
+			struct ata_channel *chp = (struct ata_channel *)schp;
 
+			ata_channel_lock(chp);
+			siisata_reset_channel(chp, AT_POLL);
+			ata_channel_unlock(chp);
+		}
+	}
 }
 
 int
@@ -625,7 +635,7 @@ siisata_channel_recover(struct ata_chann
 	}
 
 	KASSERT(drive >= 0);
-	siisata_reinit_port(chp, drive);
+	(void)siisata_reinit_port(chp, drive);
 
 	ata_recovery_resume(chp, drive, tfd, flags);
 
@@ -648,7 +658,8 @@ siisata_reset_drive(struct ata_drive_dat
 
 	ata_channel_lock_owned(chp);
 
-	siisata_reinit_port(chp, drvp->drive);
+	if (siisata_reinit_port(chp, drvp->drive))
+		siisata_reset_channel(chp, flags);
 
 	/* get a slot for running the command on */
 	if (!ata_queue_alloc_slot(chp, &c_slot, ATA_MAX_OPENINGS)) {
@@ -815,7 +826,8 @@ siisata_probe_drive(struct ata_channel *
 			aprint_error_dev(sc->sc_atac.atac_dev,
 			"timed out waiting for PORT_READY on port %d, " 
 			"reinitializing\n", chp->ch_channel);
-			siisata_reinit_port(chp, -1);
+			if (siisata_reinit_port(chp, -1))
+siisata_reset_channel(chp, AT_WAIT);
 		}
 
 		prb = schp->sch_prb[c_slot];
@@ -851,7 +863,8 @@ siisata_probe_drive(struct ata_channel *
 			PRREAD(sc, PRX(chp->ch_channel, PRO_PCE)),
 			PRREAD(sc, PRX(chp->ch_channel, PRO_PSS)),
 			PRREAD(sc, PRX(chp->ch_channel, PRO_PIS)));
-			siisata_reinit_port(chp, -1);
+			if (siisata_reinit_port(chp, -1))
+siisata_reset_channel(chp, AT_WAIT);
 			break;
 		}
 
@@ -1427,12 +1440,12 @@ siisata_deactivate_prb(struct siisata_ch
 	SIISATA_PRB_SYNC(sc, schp, slot, BUS_DMASYNC_POSTWRITE);
 }
 
-static void
+static int
 siisata_reinit_port(struct ata_channel *chp, int drive)
 {
 	struct siisata_softc *sc = (struct siisata_softc *)c

CVS commit: src/sys/dev/acpi

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 13:41:15 UTC 2018

Modified Files:
src/sys/dev/acpi: acpi.c

Log Message:
Add ACPI PCI link devices to ignored ids on arm64


To generate a diff of this commit:
cvs rdiff -u -r1.277 -r1.278 src/sys/dev/acpi/acpi.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/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.277 src/sys/dev/acpi/acpi.c:1.278
--- src/sys/dev/acpi/acpi.c:1.277	Tue Oct 16 22:29:43 2018
+++ src/sys/dev/acpi/acpi.c	Sun Oct 21 13:41:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.277 2018/10/16 22:29:43 jmcneill Exp $	*/
+/*	$NetBSD: acpi.c,v 1.278 2018/10/21 13:41:15 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.277 2018/10/16 22:29:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.278 2018/10/21 13:41:15 jmcneill Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -176,6 +176,7 @@ static const char * const acpi_ignored_i
 #endif
 #if defined(__aarch64__)
 	"ACPI0007",	/* ACPI CPUs are attached via MADT GICC subtables */
+	"PNP0C0F",	/* ACPI PCI link devices are handled internally */
 #endif
 	NULL
 };



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 13:34:33 UTC 2018

Modified Files:
src/sys/arch/arm/acpi: acpi_machdep.c

Log Message:
Don't make assumptions about the order of MADT subtables. Ensure that we
attach CPUs before the interrupt controller driver.


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

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_machdep.c:1.3 src/sys/arch/arm/acpi/acpi_machdep.c:1.4
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.3	Tue Oct 16 16:38:22 2018
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Sun Oct 21 13:34:33 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.3 2018/10/16 16:38:22 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.3 2018/10/16 16:38:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.4 2018/10/21 13:34:33 jmcneill Exp $");
 
 #include 
 #include 
@@ -216,11 +216,23 @@ acpi_md_ncpus(void)
 }
 
 static ACPI_STATUS
-acpi_md_madt_probe(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
+acpi_md_madt_probe_cpu(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
 {
 	struct acpi_softc * const sc = aux;
 
-	config_found_ia(sc->sc_dev, "acpimadtbus", hdrp, NULL);
+	if (hdrp->Type == ACPI_MADT_TYPE_GENERIC_INTERRUPT)
+		config_found_ia(sc->sc_dev, "acpimadtbus", hdrp, NULL);
+
+	return AE_OK;
+}
+
+static ACPI_STATUS
+acpi_md_madt_probe_gic(ACPI_SUBTABLE_HEADER *hdrp, void *aux)
+{
+	struct acpi_softc * const sc = aux;
+
+	if (hdrp->Type == ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR)
+		config_found_ia(sc->sc_dev, "acpimadtbus", hdrp, NULL);
 
 	return AE_OK;
 }
@@ -244,7 +256,8 @@ acpi_md_callback(struct acpi_softc *sc)
 
 	if (acpi_madt_map() != AE_OK)
 		panic("Failed to map MADT");
-	acpi_madt_walk(acpi_md_madt_probe, sc);
+	acpi_madt_walk(acpi_md_madt_probe_cpu, sc);
+	acpi_madt_walk(acpi_md_madt_probe_gic, sc);
 	acpi_madt_unmap();
 
 	if (acpi_gtdt_map() != AE_OK)



CVS commit: src/lib/libcurses

2018-10-21 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Oct 21 12:47:33 UTC 2018

Modified Files:
src/lib/libcurses: refresh.c

Log Message:
curses: ensure attributes are correctly set for each character

Another fix for PR# 30978.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/lib/libcurses/refresh.c

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

Modified files:

Index: src/lib/libcurses/refresh.c
diff -u src/lib/libcurses/refresh.c:1.90 src/lib/libcurses/refresh.c:1.91
--- src/lib/libcurses/refresh.c:1.90	Wed Oct 10 09:40:11 2018
+++ src/lib/libcurses/refresh.c	Sun Oct 21 12:47:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.90 2018/10/10 09:40:11 roy Exp $	*/
+/*	$NetBSD: refresh.c,v 1.91 2018/10/21 12:47:33 roy Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c	8.7 (Berkeley) 8/13/94";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.90 2018/10/10 09:40:11 roy Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.91 2018/10/21 12:47:33 roy Exp $");
 #endif
 #endif/* not lint */
 
@@ -46,6 +46,10 @@ __RCSID("$NetBSD: refresh.c,v 1.90 2018/
 #include "curses_private.h"
 
 static void	domvcur(const WINDOW *, int, int, int, int);
+static void	putattr(__LDATA *);
+static void	putattr_out(__LDATA *);
+static int	putch(__LDATA *, __LDATA *, int, int);
+static int	putchbr(__LDATA *, __LDATA *, __LDATA *, int, int);
 static int	makech(int);
 static void	quickch(void);
 static void	scrolln(int, int, int, int, int);
@@ -772,10 +776,210 @@ cleanup:
 	return fflush(_cursesi_screen->outfd) == EOF ? ERR : OK;
 }
 
+static void
+putattr(__LDATA *nsp)
+{
+	attr_t	off, on;
+
+#ifdef DEBUG
+	__CTRACE(__CTRACE_REFRESH,
+	"makech: have attr %08x, need attr %08x\n",
+	curscr->wattr
+#ifndef HAVE_WCHAR
+	& __ATTRIBUTES
+#else
+	& WA_ATTRIBUTES
+#endif
+	,  nsp->attr
+#ifndef HAVE_WCHAR
+	& __ATTRIBUTES
+#else
+	& WA_ATTRIBUTES
+#endif
+	);
+#endif
+
+	off = (~nsp->attr & curscr->wattr)
+#ifndef HAVE_WCHAR
+	& __ATTRIBUTES
+#else
+	& WA_ATTRIBUTES
+#endif
+	;
+
+	/*
+	 * Unset attributes as appropriate.  Unset first
+	 * so that the relevant attributes can be reset
+	 * (because 'me' unsets 'mb', 'md', 'mh', 'mk',
+	 * 'mp' and 'mr').  Check to see if we also turn off
+	 * standout, attributes and colour.
+	 */
+	if (off & __TERMATTR && exit_attribute_mode != NULL) {
+		tputs(exit_attribute_mode, 0, __cputchar);
+		curscr->wattr &= __mask_me;
+		off &= __mask_me;
+	}
+
+	/*
+	 * Exit underscore mode if appropriate.
+	 * Check to see if we also turn off standout,
+	 * attributes and colour.
+	 */
+	if (off & __UNDERSCORE && exit_underline_mode != NULL) {
+		tputs(exit_underline_mode, 0, __cputchar);
+		curscr->wattr &= __mask_ue;
+		off &= __mask_ue;
+	}
+
+	/*
+	 * Exit standout mode as appropriate.
+	 * Check to see if we also turn off underscore,
+	 * attributes and colour.
+	 * XXX
+	 * Should use uc if so/se not available.
+	 */
+	if (off & __STANDOUT && exit_standout_mode != NULL) {
+		tputs(exit_standout_mode, 0, __cputchar);
+		curscr->wattr &= __mask_se;
+		off &= __mask_se;
+	}
+
+	if (off & __ALTCHARSET && exit_alt_charset_mode != NULL) {
+		tputs(exit_alt_charset_mode, 0, __cputchar);
+		curscr->wattr &= ~__ALTCHARSET;
+	}
+
+	/* Set/change colour as appropriate. */
+	if (__using_color)
+		__set_color(curscr, nsp->attr & __COLOR);
+
+	on = (nsp->attr & ~curscr->wattr)
+#ifndef HAVE_WCHAR
+	& __ATTRIBUTES
+#else
+	& WA_ATTRIBUTES
+#endif
+	;
+
+	/*
+	 * Enter standout mode if appropriate.
+	 */
+	if (on & __STANDOUT &&
+	enter_standout_mode != NULL &&
+	exit_standout_mode != NULL)
+	{
+		tputs(enter_standout_mode, 0, __cputchar);
+		curscr->wattr |= __STANDOUT;
+	}
+
+	/*
+	 * Enter underscore mode if appropriate.
+	 * XXX
+	 * Should use uc if us/ue not available.
+	 */
+	if (on & __UNDERSCORE &&
+	enter_underline_mode != NULL &&
+	exit_underline_mode != NULL)
+	{
+		tputs(enter_underline_mode, 0, __cputchar);
+		curscr->wattr |= __UNDERSCORE;
+	}
+
+	/*
+	 * Set other attributes as appropriate.
+	 */
+	if (exit_attribute_mode != NULL) {
+		if (on & __BLINK && enter_blink_mode != NULL)
+		{
+			tputs(enter_blink_mode, 0, __cputchar);
+			curscr->wattr |= __BLINK;
+		}
+		if (on & __BOLD && enter_bold_mode != NULL)
+		{
+			tputs(enter_bold_mode, 0, __cputchar);
+			curscr->wattr |= __BOLD;
+		}
+		if (on & __DIM && enter_dim_mode != NULL)
+		{
+			tputs(enter_dim_mode, 0, __cputchar);
+			curscr->wattr |= __DIM;
+		}
+		if (on & __BLANK && enter_secure_mode != NULL)
+		{
+			tputs(enter_secure_mode, 0, __cputchar);
+			curscr->wattr |= __BLANK;
+		}
+		if (on & __PROTECT && enter_protected_mode != NULL)
+		{
+			tputs(enter_protected_mode, 0, __cputchar);
+			curscr->wattr |= __PROTECT;
+		}
+		if (on & __REVERSE && enter_reverse_mode != NULL)
+		{
+			tputs(enter_reverse_mode, 0, __cputchar);
+			c

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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 12:26:59 UTC 2018

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

Log Message:
Add virtio at acpi


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.53 src/sys/arch/evbarm/conf/GENERIC64:1.54
--- src/sys/arch/evbarm/conf/GENERIC64:1.53	Sun Oct 21 12:07:47 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Oct 21 12:26:59 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.53 2018/10/21 12:07:47 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.54 2018/10/21 12:26:59 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -385,6 +385,7 @@ midi*		at midibus?
 
 # Virtio devices
 virtio*		at fdt?			# Virtio MMIO device
+virtio*		at acpi?
 #viomb*		at virtio?		# Virtio memory balloon device
 ld*		at virtio?		# Virtio disk device
 vioif*		at virtio?		# Virtio network device



CVS commit: src/sys/dev/acpi

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 12:26:38 UTC 2018

Modified Files:
src/sys/dev/acpi: files.acpi
Added Files:
src/sys/dev/acpi: virtio_acpi.c

Log Message:
Add ACPI attach glue for virtio_mmio.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/acpi/files.acpi
cvs rdiff -u -r0 -r1.1 src/sys/dev/acpi/virtio_acpi.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/acpi/files.acpi
diff -u src/sys/dev/acpi/files.acpi:1.108 src/sys/dev/acpi/files.acpi:1.109
--- src/sys/dev/acpi/files.acpi:1.108	Fri Oct 19 21:09:10 2018
+++ src/sys/dev/acpi/files.acpi	Sun Oct 21 12:26:38 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.acpi,v 1.108 2018/10/19 21:09:10 jakllsch Exp $
+#	$NetBSD: files.acpi,v 1.109 2018/10/21 12:26:38 jmcneill Exp $
 
 include "dev/acpi/acpica/files.acpica"
 
@@ -245,4 +245,8 @@ file	dev/acpi/dwiic_acpi.c		dwiic_acpi
 attach	amdccp at acpinodebus with amdccp_acpi
 file	dev/acpi/amdccp_acpi.c		amdccp_acpi
 
+# QEMU Virtio
+attach	virtio at acpinodebus with virtio_acpi
+file	dev/acpi/virtio_acpi.c		virtio_acpi
+
 include	"dev/acpi/wmi/files.wmi"

Added files:

Index: src/sys/dev/acpi/virtio_acpi.c
diff -u /dev/null src/sys/dev/acpi/virtio_acpi.c:1.1
--- /dev/null	Sun Oct 21 12:26:38 2018
+++ src/sys/dev/acpi/virtio_acpi.c	Sun Oct 21 12:26:38 2018
@@ -0,0 +1,185 @@
+/* $NetBSD: virtio_acpi.c,v 1.1 2018/10/21 12:26:38 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jared McNeill .
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: virtio_acpi.c,v 1.1 2018/10/21 12:26:38 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define	VIRTIO_PRIVATE
+#include 
+
+struct virtio_acpi_softc {
+	struct virtio_mmio_softc	sc_msc;
+	intsc_irq;
+	intsc_irqtype;
+};
+
+static int	virtio_acpi_match(device_t, cfdata_t, void *);
+static void	virtio_acpi_attach(device_t, device_t, void *);
+static int	virtio_acpi_rescan(device_t, const char *, const int *);
+static int	virtio_acpi_detach(device_t, int);
+
+static int	virtio_acpi_setup_interrupts(struct virtio_mmio_softc *);
+static void	virtio_acpi_free_interrupts(struct virtio_mmio_softc *);
+
+CFATTACH_DECL3_NEW(virtio_acpi, sizeof(struct virtio_acpi_softc),
+virtio_acpi_match, virtio_acpi_attach, virtio_acpi_detach, NULL,
+virtio_acpi_rescan, (void *)voidop, DVF_DETACH_SHUTDOWN);
+
+static const char * const compatible[] = {
+	"LNRO0005",
+	NULL
+};
+
+static int
+virtio_acpi_match(device_t parent, cfdata_t cf, void *aux)
+{
+	struct acpi_attach_args *aa = aux;
+
+	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
+		return 0;
+
+	return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+}
+
+static void
+virtio_acpi_attach(device_t parent, device_t self, void *aux)
+{
+	struct virtio_acpi_softc * const sc = device_private(self);
+	struct virtio_mmio_softc * const msc = &sc->sc_msc;
+	struct virtio_softc * const vsc = &msc->sc_sc;
+	struct acpi_attach_args *aa = aux;
+	struct acpi_resources res;
+	struct acpi_mem *mem;
+	struct acpi_irq *irq;
+	ACPI_STATUS rv;
+	int error;
+
+	msc->sc_iot = aa->aa_memt;
+	vsc->sc_dev = self;
+	vsc->sc_dmat = aa->aa_dmat;
+
+	rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
+	&res, &acpi_resource_parse_ops_default);
+	if (ACPI_FAILURE(rv))
+		return;
+
+	mem = acpi_res_mem(&res, 0);
+	if (mem == NULL) {
+		aprint_error_dev(self, "couldn't find mem resource\n")

CVS commit: [netbsd-8] src/doc

2018-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 21 12:12:51 UTC 2018

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

Log Message:
Tickets #1066, #1067 and #1068


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

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.36 src/doc/CHANGES-8.1:1.1.2.37
--- src/doc/CHANGES-8.1:1.1.2.36	Wed Oct 17 13:51:53 2018
+++ src/doc/CHANGES-8.1	Sun Oct 21 12:12:51 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.36 2018/10/17 13:51:53 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.37 2018/10/21 12:12:51 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1424,3 +1424,52 @@ etc/mtree/NetBSD.dist.base			1.174
 	Add /var/chroot/nsd/var/run.
 	[hannken, ticket #1065]
 
+sys/net/if_gif.c1.144
+sys/net/if_gif.h1.32
+sys/net/if_ipsec.c1.18
+sys/net/if_ipsec.h1.4
+sys/net/if_l2tp.c1.30
+sys/net/if_l2tp.h1.6
+sys/net/if_vlan.c1.133
+
+	Fix panic when doing ioctl to multiple pseudo interfaces.
+	[knakahara, ticket #1066]
+
+bin/sh/mkinit.sh1.9
+
+	Dynamically detect the way the shell matches \ in a pattern,
+	and use whatever works for the sh running this script.
+	[kre, ticket #1067]
+
+external/public-domain/tz/dist/CONTRIBUTING up to 1.1.1.6
+external/public-domain/tz/dist/Makefile up to 1.1.1.22
+external/public-domain/tz/dist/NEWS up to 1.1.1.23
+external/public-domain/tz/dist/README   up to 1.1.1.7
+external/public-domain/tz/dist/TZDATA_VERSION   up to 1.13
+external/public-domain/tz/dist/africa   up to 1.1.1.16
+external/public-domain/tz/dist/antarctica   up to 1.1.1.11
+external/public-domain/tz/dist/asia up to 1.1.1.21
+external/public-domain/tz/dist/australasia  up to 1.1.1.16
+external/public-domain/tz/dist/backward up to 1.1.1.9
+external/public-domain/tz/dist/backzone up to 1.1.1.15
+external/public-domain/tz/dist/etcetera up to 1.1.1.3
+external/public-domain/tz/dist/europe   up to 1.1.1.22
+external/public-domain/tz/dist/factory  up to 1.1.1.3
+external/public-domain/tz/dist/leap-seconds.list up to 1.1.1.10
+external/public-domain/tz/dist/leapseconds  up to 1.1.1.11
+external/public-domain/tz/dist/leapseconds.awk  up to 1.1.1.7
+external/public-domain/tz/dist/northamerica up to 1.1.1.20
+external/public-domain/tz/dist/pacificnew   up to 1.1.1.2
+external/public-domain/tz/dist/southamerica up to 1.1.1.15
+external/public-domain/tz/dist/systemv  up to 1.1.1.2
+external/public-domain/tz/dist/theory.html  up to 1.1.1.5
+external/public-domain/tz/dist/version  up to 1.1.1.10
+external/public-domain/tz/dist/yearistype.shup to 1.1.1.2
+external/public-domain/tz/dist/zishrink.awk up to 1.1.1.4
+external/public-domain/tz/dist/zone.tab up to 1.1.1.15
+external/public-domain/tz/dist/zone1970.tab up to 1.1.1.17
+external/public-domain/tz/dist/zoneinfo2tdf.pl  up to 1.1.1.2
+doc/3RDPARTY	1.1568 (patch)
+
+	tzdata updated to 2018f.
+	[kre, ticket #1068]



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 12:07:47 UTC 2018

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

Log Message:
Add qemufwcfg at acpi


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.52 src/sys/arch/evbarm/conf/GENERIC64:1.53
--- src/sys/arch/evbarm/conf/GENERIC64:1.52	Fri Oct 19 21:09:09 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Oct 21 12:07:47 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.52 2018/10/19 21:09:09 jakllsch Exp $
+#	$NetBSD: GENERIC64,v 1.53 2018/10/21 12:07:47 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -153,6 +153,7 @@ tegramc*	at fdt?	pass 4		# NVIDIA Tegra 
 bcmmbox*	at fdt?			# Broadcom VideoCore IV mailbox
 vcmbox*		at bcmmbox?
 qemufwcfg*	at fdt?			# QEMU Firmware Configuration device
+qemufwcfg*	at acpi?
 
 # DMA controller
 bcmdmac*	at fdt?			# Broadcom BCM283x DMA controller



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 12:06:22 UTC 2018

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

Log Message:
Some parts of the ACPI subsystem depend on a valid PCI chipset tag in the
ACPI softc. Provide one here, and assume segment 0.


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

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

Modified files:

Index: src/sys/arch/arm/fdt/acpi_fdt.c
diff -u src/sys/arch/arm/fdt/acpi_fdt.c:1.4 src/sys/arch/arm/fdt/acpi_fdt.c:1.5
--- src/sys/arch/arm/fdt/acpi_fdt.c:1.4	Sun Oct 21 00:42:05 2018
+++ src/sys/arch/arm/fdt/acpi_fdt.c	Sun Oct 21 12:06:22 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_fdt.c,v 1.4 2018/10/21 00:42:05 jmcneill Exp $ */
+/* $NetBSD: acpi_fdt.c,v 1.5 2018/10/21 12:06:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.4 2018/10/21 00:42:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.5 2018/10/21 12:06:22 jmcneill Exp $");
 
 #include 
 #include 
@@ -53,6 +53,8 @@ static void	acpi_fdt_attach(device_t, de
 
 static void	acpi_fdt_poweroff(device_t);
 
+static struct acpi_pci_context acpi_fdt_pci_context;
+
 static const char * const compatible[] = {
 	"netbsd,acpi",
 	NULL
@@ -87,9 +89,13 @@ acpi_fdt_attach(device_t parent, device_
 	if (!acpi_probe())
 		aprint_error_dev(self, "failed to probe ACPI\n");
 
+	acpi_fdt_pci_context.ap_pc = arm_acpi_pci_chipset;
+	acpi_fdt_pci_context.ap_pc.pc_conf_v = &acpi_fdt_pci_context;
+	acpi_fdt_pci_context.ap_seg = 0;
+
 	aa.aa_iot = 0;
 	aa.aa_memt = faa->faa_bst;
-	aa.aa_pc = &arm_acpi_pci_chipset;
+	aa.aa_pc = &acpi_fdt_pci_context.ap_pc;
 	aa.aa_pciflags =
 	/*PCI_FLAGS_IO_OKAY |*/ PCI_FLAGS_MEM_OKAY |
 	PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY | 



CVS commit: [netbsd-8] src/bin/sh

2018-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 21 12:00:33 UTC 2018

Modified Files:
src/bin/sh [netbsd-8]: mkinit.sh

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

bin/sh/mkinit.sh: revision 1.9

Dynamically detect the way the shell matches \ in a pattern,
and use whatever works for the sh running this script.  Previously
we were using the (broken, and incorrect) method that worked in
old broken NetBSD sh's (and some others) and not the method that
works with the current (fixed) /bin/sh and other correct shells
(like bash).   (For an exotic reason, in the particular use case,
both methods work with ksh93, but it is also generally correct).

This hasn't really mattered, as the difference is only significant
(only causes actual issues - the build fails) when compiling with DEBUG
enabled, which is something that most sane humans would never do, if they
want to retain that sanity.

The problem was detected by Patrick Welche when looking for an
unrelated problem, which was once considered to be a possible sh
problem, but turned out to be something entirely different.

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.8.1 src/bin/sh/mkinit.sh

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

Modified files:

Index: src/bin/sh/mkinit.sh
diff -u src/bin/sh/mkinit.sh:1.7 src/bin/sh/mkinit.sh:1.7.8.1
--- src/bin/sh/mkinit.sh:1.7	Sun Mar 27 14:34:46 2016
+++ src/bin/sh/mkinit.sh	Sun Oct 21 12:00:32 2018
@@ -1,5 +1,5 @@
 #! /bin/sh
-#	$NetBSD: mkinit.sh,v 1.7 2016/03/27 14:34:46 christos Exp $
+#	$NetBSD: mkinit.sh,v 1.7.8.1 2018/10/21 12:00:32 martin Exp $
 
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -33,7 +33,37 @@ srcs="$*"
 nl='
 '
 openparen='('
-backslash='\'
+
+# shells have bugs (including older NetBSD sh) in how \ is
+# used in pattern matching.   So work out what the shell
+# running this script expects.   We could also just use a
+# literal \ in the pattern, which would need to be quoted
+# of course, but then we'd run into a whole host of potential
+# other shell bugs (both with the quoting in the pattern, and
+# with the matching that follows if that works as inended).
+# Far easier, and more reliable, is to just work out what works,
+# and then use it, which more or less mandates using a variable...
+backslash='\\'
+var='abc\'			# dummy test case.
+if [ "$var" = "${var%$backslash}" ]
+then
+	# buggy sh, try the broken way
+	backslash='\'
+	if [ "$var" = "${var%$backslash}" ]
+	then
+		printf >&2 "$0: %s\n" 'No pattern match with \ (broken shell)'
+		exit 1
+	fi
+fi
+# We know we can detect the presence of a trailing \, which is all we need.
+# Now to confirm we will not generate false matches.
+var='abc'
+if [ "$var" != "${var%$backslash}" ]
+then
+	printf >&2 "$0: %s\n" 'Bogus pattern match with \ (broken shell)'
+	exit 1
+fi
+unset var
 
 includes=' "shell.h" "mystring.h" "init.h" '
 defines=



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 11:56:26 UTC 2018

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c

Log Message:
Do not add PCI link references until the bus has been mapped


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

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_pci_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.3 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.4
--- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.3	Sun Oct 21 00:42:05 2018
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.c	Sun Oct 21 11:56:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.3 2018/10/21 00:42:05 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.4 2018/10/21 11:56:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.3 2018/10/21 00:42:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.4 2018/10/21 11:56:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -187,13 +187,6 @@ acpi_pci_md_attach_hook(device_t parent,
 			handle = ad->ad_handle;
 	}
 
-	if (ad != NULL) {
-		/*
-		 * This is a new ACPI managed bus. Add PCI link references.
-		 */
-		acpi_pci_md_pci_link(ad->ad_handle, pba->pba_bus);
-	}
-
 	if (handle != NULL) {
 		prt = kmem_alloc(sizeof(*prt), KM_SLEEP);
 		prt->prt_bus = pba->pba_bus;
@@ -202,6 +195,13 @@ acpi_pci_md_attach_hook(device_t parent,
 	}
 
 	acpimcfg_map_bus(self, pba->pba_pc, pba->pba_bus);
+
+	if (ad != NULL) {
+		/*
+		 * This is a new ACPI managed bus. Add PCI link references.
+		 */
+		acpi_pci_md_pci_link(ad->ad_handle, pba->pba_bus);
+	}
 }
 
 static int



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

2018-10-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 21 11:55:54 UTC 2018

Modified Files:
src/sys/net [netbsd-8]: if_gif.c if_gif.h if_ipsec.c if_ipsec.h
if_l2tp.c if_l2tp.h if_vlan.c

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #1066):

sys/net/if_vlan.c: revision 1.133
sys/net/if_gif.h: revision 1.32
sys/net/if_ipsec.c: revision 1.18
sys/net/if_ipsec.h: revision 1.4
sys/net/if_gif.c: revision 1.144
sys/net/if_l2tp.h: revision 1.6
sys/net/if_l2tp.c: revision 1.30

Fix panic when doing ioctl to multiple pseudo interfaces. Pointed out by 
k-goda@IIJ.

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.126.2.11 -r1.126.2.12 src/sys/net/if_gif.c
cvs rdiff -u -r1.25.8.3 -r1.25.8.4 src/sys/net/if_gif.h
cvs rdiff -u -r1.3.2.9 -r1.3.2.10 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/net/if_ipsec.h
cvs rdiff -u -r1.11.2.9 -r1.11.2.10 src/sys/net/if_l2tp.c
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 src/sys/net/if_l2tp.h
cvs rdiff -u -r1.97.2.14 -r1.97.2.15 src/sys/net/if_vlan.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/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.126.2.11 src/sys/net/if_gif.c:1.126.2.12
--- src/sys/net/if_gif.c:1.126.2.11	Thu Jun  7 17:42:25 2018
+++ src/sys/net/if_gif.c	Sun Oct 21 11:55:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.126.2.11 2018/06/07 17:42:25 martin Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.126.2.12 2018/10/21 11:55:54 martin Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.11 2018/06/07 17:42:25 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.126.2.12 2018/10/21 11:55:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -105,7 +105,6 @@ static struct {
 	kmutex_t lock;
 } gif_softcs __cacheline_aligned;
 
-pserialize_t gif_psz __read_mostly;
 struct psref_class *gv_psref_class __read_mostly;
 
 static void	gif_ro_init_pc(void *, void *, struct cpu_info *);
@@ -224,7 +223,6 @@ gifinit(void)
 	LIST_INIT(&gif_softcs.list);
 	if_clone_attach(&gif_cloner);
 
-	gif_psz = pserialize_create();
 	gv_psref_class = psref_class_create("gifvar", IPL_SOFTNET);
 
 	gif_sysctl_setup();
@@ -243,7 +241,6 @@ gifdetach(void)
 
 	if (error == 0) {
 		psref_class_destroy(gv_psref_class);
-		pserialize_destroy(gif_psz);
 
 		if_clone_detach(&gif_cloner);
 		sysctl_teardown(&gif_sysctl);
@@ -275,9 +272,10 @@ gif_clone_create(struct if_clone *ifc, i
 
 	sc->gif_var = var;
 	mutex_init(&sc->gif_lock, MUTEX_DEFAULT, IPL_NONE);
+	sc->gif_psz = pserialize_create();
+
 	sc->gif_ro_percpu = percpu_alloc(sizeof(struct gif_ro));
 	percpu_foreach(sc->gif_ro_percpu, gif_ro_init_pc, NULL);
-
 	mutex_enter(&gif_softcs.lock);
 	LIST_INSERT_HEAD(&gif_softcs.list, sc, gif_list);
 	mutex_exit(&gif_softcs.lock);
@@ -355,6 +353,7 @@ gif_clone_destroy(struct ifnet *ifp)
 	percpu_foreach(sc->gif_ro_percpu, gif_ro_fini_pc, NULL);
 	percpu_free(sc->gif_ro_percpu, sizeof(struct gif_ro));
 
+	pserialize_destroy(sc->gif_psz);
 	mutex_destroy(&sc->gif_lock);
 
 	var = sc->gif_var;
@@ -1173,7 +1172,7 @@ gif_update_variant(struct gif_softc *sc,
 	KASSERT(mutex_owned(&sc->gif_lock));
 
 	sc->gif_var = nvar;
-	pserialize_perform(gif_psz);
+	pserialize_perform(sc->gif_psz);
 	psref_target_destroy(&ovar->gv_psref, gv_psref_class);
 
 	if (nvar->gv_psrc != NULL && nvar->gv_pdst != NULL)

Index: src/sys/net/if_gif.h
diff -u src/sys/net/if_gif.h:1.25.8.3 src/sys/net/if_gif.h:1.25.8.4
--- src/sys/net/if_gif.h:1.25.8.3	Thu May 17 14:07:03 2018
+++ src/sys/net/if_gif.h	Sun Oct 21 11:55:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.h,v 1.25.8.3 2018/05/17 14:07:03 martin Exp $	*/
+/*	$NetBSD: if_gif.h,v 1.25.8.4 2018/10/21 11:55:54 martin Exp $	*/
 /*	$KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $	*/
 
 /*
@@ -40,6 +40,7 @@
 #include 
 #include 
 #ifdef _KERNEL
+#include 
 #include 
 #endif
 
@@ -78,6 +79,7 @@ struct gif_softc {
 	 * instead of direct dereference.
 	 */
 	kmutex_t gif_lock;		/* writer lock for gif_var */
+	pserialize_t gif_psz;
 
 	LIST_ENTRY(gif_softc) gif_list;	/* list of all gifs */
 };

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.3.2.9 src/sys/net/if_ipsec.c:1.3.2.10
--- src/sys/net/if_ipsec.c:1.3.2.9	Thu Jun  7 16:22:43 2018
+++ src/sys/net/if_ipsec.c	Sun Oct 21 11:55:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.3.2.9 2018/06/07 16:22:43 martin Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.3.2.10 2018/10/21 11:55:54 martin Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.9 2018/06/07 16:22:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.3.2.10 2018/10/21 11:55:54 martin Exp $");
 
 #ifdef _KERNEL

CVS commit: src/sys/dev/acpi

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 11:09:20 UTC 2018

Modified Files:
src/sys/dev/acpi: amdccp_acpi.c

Log Message:
Fix boot messages


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/amdccp_acpi.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/acpi/amdccp_acpi.c
diff -u src/sys/dev/acpi/amdccp_acpi.c:1.1 src/sys/dev/acpi/amdccp_acpi.c:1.2
--- src/sys/dev/acpi/amdccp_acpi.c:1.1	Fri Oct 19 21:09:10 2018
+++ src/sys/dev/acpi/amdccp_acpi.c	Sun Oct 21 11:09:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: amdccp_acpi.c,v 1.1 2018/10/19 21:09:10 jakllsch Exp $ */
+/* $NetBSD: amdccp_acpi.c,v 1.2 2018/10/21 11:09:20 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2018 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.1 2018/10/19 21:09:10 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdccp_acpi.c,v 1.2 2018/10/21 11:09:20 jmcneill Exp $");
 
 #include 
 #include 
@@ -85,21 +85,21 @@ amdccp_acpi_attach(device_t parent, devi
 
 	mem = acpi_res_mem(&res, 0);
 	if (mem == NULL) {
-		aprint_error(": couldn't find mem resource\n");
+		aprint_error_dev(self, "couldn't find mem resource\n");
 		goto done;
 	}
 
 #if notyet
 	irq = acpi_res_irq(&res, 0);
 	if (irq == NULL) {
-		aprint_error(": couldn't find irq resource\n");
+		aprint_error_dev(self, "couldn't find irq resource\n");
 		goto done;
 	}
 
 #endif
 	sc->sc_bst = aa->aa_memt;
 	if (bus_space_map(aa->aa_memt, mem->ar_base, mem->ar_length, 0, &sc->sc_bsh) != 0) {
-		aprint_error(": couldn't map registers\n");
+		aprint_error_dev(self, "couldn't map registers\n");
 		goto done;
 	}
 
@@ -113,9 +113,6 @@ amdccp_acpi_attach(device_t parent, devi
 
 #endif
 
-	aprint_naive("\n");
-	aprint_normal(": AMD CCP\n");
-
 	amdccp_common_attach(sc);
 
 done:



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

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 11:05:24 UTC 2018

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
Only configure PCI bus if _DSM rev 1 func 5 ("Ignore PCI boot configuration") 
returns 1


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/acpi/acpipchb.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/acpi/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.2 src/sys/arch/arm/acpi/acpipchb.c:1.3
--- src/sys/arch/arm/acpi/acpipchb.c:1.2	Fri Oct 19 11:40:27 2018
+++ src/sys/arch/arm/acpi/acpipchb.c	Sun Oct 21 11:05:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.2 2018/10/19 11:40:27 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.3 2018/10/21 11:05:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.2 2018/10/19 11:40:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.3 2018/10/21 11:05:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -132,9 +133,9 @@ acpipchb_attach(device_t parent, device_
 	sc->sc_ap.ap_pc.pc_conf_v = &sc->sc_ap;
 	sc->sc_ap.ap_seg = seg;
 
-	if (acpimcfg_configure_bus(self, &sc->sc_ap.ap_pc, sc->sc_handle, sc->sc_bus, PCIHOST_CACHELINE_SIZE) != 0) {
-		aprint_error_dev(self, "failed to configure PCI bus\n");
-		return;
+	if (acpi_pci_ignore_boot_config(sc->sc_handle)) {
+		if (acpimcfg_configure_bus(self, &sc->sc_ap.ap_pc, sc->sc_handle, sc->sc_bus, PCIHOST_CACHELINE_SIZE) != 0)
+			aprint_error_dev(self, "failed to configure bus\n");
 	}
 
 	memset(&pba, 0, sizeof(pba));



CVS commit: src/sys/dev/acpi

2018-10-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 21 11:04:26 UTC 2018

Modified Files:
src/sys/dev/acpi: acpi_pci.c acpi_pci.h

Log Message:
Add a function to report whether the operating system may ignore the boot
configuration of PCI resources for a given bus.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/acpi/acpi_pci.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/acpi/acpi_pci.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/acpi/acpi_pci.c
diff -u src/sys/dev/acpi/acpi_pci.c:1.23 src/sys/dev/acpi/acpi_pci.c:1.24
--- src/sys/dev/acpi/acpi_pci.c:1.23	Mon Oct 15 10:00:30 2018
+++ src/sys/dev/acpi/acpi_pci.c	Sun Oct 21 11:04:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.23 2018/10/15 10:00:30 jmcneill Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.24 2018/10/21 11:04:26 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.23 2018/10/15 10:00:30 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.24 2018/10/21 11:04:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -58,6 +58,14 @@ static ACPI_STATUS	  acpi_pcidev_pciroot
 			   void *);
 
 /*
+ * UUID for _DSM control method, from PCI Firmware Specification.
+ */
+static UINT8 acpi_pci_dsm_uuid[ACPI_UUID_LENGTH] = {
+	0xd0, 0x37, 0xc9, 0xe5, 0x53, 0x35, 0x7a, 0x4d,
+	0x91, 0x17, 0xea, 0x4d, 0x19, 0xc3, 0x43, 0x4d
+};
+
+/*
  * Regarding PCI Segment Groups (ACPI 4.0, p. 277):
  *
  * "The optional _SEG object is located under a PCI host bridge and
@@ -459,3 +467,54 @@ acpi_pcidev_find_dev(struct acpi_devnode
 
 	return dv;
 }
+
+/*
+ * acpi_pci_ignore_boot_config:
+ *
+ *	Returns 1 if the operating system may ignore the boot configuration
+ *	of PCI resources.
+ */
+ACPI_INTEGER
+acpi_pci_ignore_boot_config(ACPI_HANDLE handle)
+{
+	ACPI_OBJECT_LIST objs;
+	ACPI_OBJECT obj[4], *pobj;
+	ACPI_BUFFER buf;
+	ACPI_INTEGER ret;
+
+	objs.Count = 4;
+	objs.Pointer = obj;
+	obj[0].Type = ACPI_TYPE_BUFFER;
+	obj[0].Buffer.Length = ACPI_UUID_LENGTH;
+	obj[0].Buffer.Pointer = acpi_pci_dsm_uuid;
+	obj[1].Type = ACPI_TYPE_INTEGER;
+	obj[1].Integer.Value = 1;
+	obj[2].Type = ACPI_TYPE_INTEGER;
+	obj[2].Integer.Value = 5;
+	obj[3].Type = ACPI_TYPE_PACKAGE;
+	obj[3].Package.Count = 0;
+	obj[3].Package.Elements = NULL;
+
+	buf.Pointer = NULL;
+	buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+	if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_DSM", &objs, &buf)) || buf.Pointer == NULL)
+		return 0;
+
+	ret = 0;
+
+	pobj = buf.Pointer;
+	switch (pobj->Type) {
+	case ACPI_TYPE_INTEGER:
+		ret = pobj->Integer.Value;
+		break;
+	case ACPI_TYPE_PACKAGE:
+		if (pobj->Package.Count == 1 && pobj->Package.Elements[0].Type == ACPI_TYPE_INTEGER)
+			ret = pobj->Package.Elements[0].Integer.Value;
+		break;
+	}
+
+	ACPI_FREE(buf.Pointer);
+
+	return ret;
+}

Index: src/sys/dev/acpi/acpi_pci.h
diff -u src/sys/dev/acpi/acpi_pci.h:1.9 src/sys/dev/acpi/acpi_pci.h:1.10
--- src/sys/dev/acpi/acpi_pci.h:1.9	Mon Oct 15 10:00:30 2018
+++ src/sys/dev/acpi/acpi_pci.h	Sun Oct 21 11:04:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.h,v 1.9 2018/10/15 10:00:30 jmcneill Exp $ */
+/* $NetBSD: acpi_pci.h,v 1.10 2018/10/21 11:04:26 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -38,5 +38,6 @@ struct acpi_devnode	*acpi_pcidev_find(ui
 	  uint16_t, uint16_t);
 device_t		 acpi_pcidev_find_dev(struct acpi_devnode *);
 struct acpi_devnode	*acpi_pciroot_find(uint16_t, uint16_t);
+ACPI_INTEGER		 acpi_pci_ignore_boot_config(ACPI_HANDLE);
 
 #endif	/* !_SYS_DEV_ACPI_ACPI_PCI_H */



CVS commit: src/etc/etc.evbarm

2018-10-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 21 07:08:40 UTC 2018

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

Log Message:
Sort


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/etc/etc.evbarm/Makefile.inc

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

Modified files:

Index: src/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.94 src/etc/etc.evbarm/Makefile.inc:1.95
--- src/etc/etc.evbarm/Makefile.inc:1.94	Mon Aug 27 22:41:56 2018
+++ src/etc/etc.evbarm/Makefile.inc	Sun Oct 21 07:08:40 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.94 2018/08/27 22:41:56 jmcneill Exp $
+#	$NetBSD: Makefile.inc,v 1.95 2018/10/21 07:08:40 skrll Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -16,16 +16,18 @@ EVBARM_BOARDS.${i}=
 IMAGEENDIAN=	be
 # big endian boards
 KERNEL_SETS.armv4+=		IXM1200
+
 EVBARM_BOARDS.xscale+=		ADI_BRH
 KERNEL_SETS.xscale+=		NSLU2
-KERNEL_SETS.armv7+=		VEXPRESS_A15
-KERNEL_SETS.armv7hf+=		VEXPRESS_A15
+
 EVBARM_BOARDS.armv7+=		BCM5301X
 EVBARM_BOARDS.armv7hf+=		BCM5301X
 #EVBARM_BOARDS.armv7+=		BCM56340
 #EVBARM_BOARDS.armv7hf+= 	BCM56340
 KERNEL_SETS.armv7+=		SUNXI
 KERNEL_SETS.armv7hf+=		SUNXI
+KERNEL_SETS.armv7+=		VEXPRESS_A15
+KERNEL_SETS.armv7hf+=		VEXPRESS_A15
 .else
 IMAGEENDIAN=	le
 # little endian boards
@@ -41,6 +43,7 @@ KERNEL_SETS.armv4+=		IXM1200
 EVBARM_BOARDS.armv4+=		SMDK2410
 EVBARM_BOARDS.armv4+=		SMDK2800
 EVBARM_BOARDS.armv4+=		TS7200
+
 EVBARM_BOARDS.xscale+=		ADI_BRH
 EVBARM_BOARDS.xscale+=		CP3100
 EVBARM_BOARDS.xscale+=		GUMSTIX
@@ -52,6 +55,7 @@ EVBARM_BOARDS.xscale+=		TEAMASA_NPWR
 EVBARM_BOARDS.xscale+=		TWINTAIL
 #EVBARM_BOARDS.xscale+=		VIPER
 #EVBARM_BOARDS.xscale+=		ZAO425
+
 #EVBARM_BOARDS.armv5t+=		DNS323
 #EVBARM_BOARDS.armv5t+=		HPT5325
 #EVBARM_BOARDS.armv5t+=		IMX21_OLINUXINO
@@ -63,6 +67,7 @@ EVBARM_BOARDS.armv5t+=		MV2120
 EVBARM_BOARDS.armv5t+=		OPENRD
 #EVBARM_BOARDS.armv5t+=		OSK5912
 EVBARM_BOARDS.armv5t+=		SHEEVAPLUG
+
 #EVBARM_BOARDS.armv6+=		IMX31LITE
 #EVBARM_BOARDS.armv6hf+= 	IMX31LITE
 EVBARM_BOARDS.armv6+=		RPI
@@ -72,10 +77,11 @@ KERNEL_SETS.armv6hf+=	 	RPI2
 EVBARM_BOARDS.armv6+=		TISDP2420
 EVBARM_BOARDS.armv6hf+= 	TISDP2420
 #EVBARM_BOARDS.armv6+=		TISDP2430
-KERNEL_SETS.armv7+=		VEXPRESS_A15
-KERNEL_SETS.armv7hf+=		VEXPRESS_A15
+
 EVBARM_BOARDS.armv7+=		ARMADAXP
 EVBARM_BOARDS.armv7hf+=		ARMADAXP
+EVBARM_BOARDS.armv7+=		ARMADILLO-IOT-G3
+EVBARM_BOARDS.armv7hf+=		ARMADILLO-IOT-G3
 EVBARM_BOARDS.armv7+=		BCM5301X
 EVBARM_BOARDS.armv7hf+= 	BCM5301X
 #EVBARM_BOARDS.armv7+=		BCM56340
@@ -93,10 +99,6 @@ EVBARM_BOARDS.armv7hf+= 	CUBOX-I
 #EVBARM_BOARDS.armv7+=		IGEPV2
 EVBARM_BOARDS.armv7+=		IMX6UL-STARTER
 EVBARM_BOARDS.armv7hf+=		IMX6UL-STARTER
-KERNEL_SETS.armv7+=		TEGRA
-KERNEL_SETS.armv7hf+=		TEGRA
-EVBARM_BOARDS.armv7+=		ARMADILLO-IOT-G3
-EVBARM_BOARDS.armv7hf+=		ARMADILLO-IOT-G3
 EVBARM_BOARDS.armv7+=		KOBO
 EVBARM_BOARDS.armv7hf+= 	KOBO
 EVBARM_BOARDS.armv7+=		MIRABOX
@@ -116,6 +118,11 @@ EVBARM_BOARDS.armv7+=		RPI2
 EVBARM_BOARDS.armv7hf+=	 	RPI2
 KERNEL_SETS.armv7+=		SUNXI
 KERNEL_SETS.armv7hf+=		SUNXI
+KERNEL_SETS.armv7+=		TEGRA
+KERNEL_SETS.armv7hf+=		TEGRA
+KERNEL_SETS.armv7+=		VEXPRESS_A15
+KERNEL_SETS.armv7hf+=		VEXPRESS_A15
+
 KERNEL_SETS.arm64+=		GENERIC64
 .endif