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

2017-09-15 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Sep 16 01:40:44 UTC 2017

Modified Files:
src/sys/external/bsd/drm2/include/linux: sysrq.h

Log Message:
include linux/kernel.h (and thus sys/cdefs.h) for __unused


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/include/linux/sysrq.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/sysrq.h
diff -u src/sys/external/bsd/drm2/include/linux/sysrq.h:1.2 src/sys/external/bsd/drm2/include/linux/sysrq.h:1.3
--- src/sys/external/bsd/drm2/include/linux/sysrq.h:1.2	Tue Mar 18 18:20:43 2014
+++ src/sys/external/bsd/drm2/include/linux/sysrq.h	Sat Sep 16 01:40:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysrq.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $	*/
+/*	$NetBSD: sysrq.h,v 1.3 2017/09/16 01:40:44 maya Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -32,6 +32,8 @@
 #ifndef _LINUX_SYSRQ_H_
 #define _LINUX_SYSRQ_H_
 
+#include 
+
 struct sysrq_key_op {
 	char sko_blahdittyblahblah;
 };



CVS commit: src/sys/arch/arm

2017-09-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sat Sep 16 00:47:16 UTC 2017

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

Log Message:
Add Cortex-A35 CPU ID.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/arm/include/armreg.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/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.115 src/sys/arch/arm/arm32/cpu.c:1.116
--- src/sys/arch/arm/arm32/cpu.c:1.115	Thu Jun  1 02:45:05 2017
+++ src/sys/arch/arm/arm32/cpu.c	Sat Sep 16 00:47:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.115 2017/06/01 02:45:05 chs Exp $	*/
+/*	$NetBSD: cpu.c,v 1.116 2017/09/16 00:47:16 matt Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.115 2017/06/01 02:45:05 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.116 2017/09/16 00:47:16 matt Exp $");
 
 #include 
 #include 
@@ -514,6 +514,8 @@ const struct cpuidtab cpuids[] = {
 	  pN_steppings, "7A" },
 	{ CPU_ID_CORTEXA17R1,	CPU_CLASS_CORTEX,	"Cortex-A17 r1",
 	  pN_steppings, "7A" },
+	{ CPU_ID_CORTEXA35R0,	CPU_CLASS_CORTEX,	"Cortex-A35 r0",
+	  pN_steppings, "8A" },
 	{ CPU_ID_CORTEXA53R0,	CPU_CLASS_CORTEX,	"Cortex-A53 r0",
 	  pN_steppings, "8A" },
 	{ CPU_ID_CORTEXA57R0,	CPU_CLASS_CORTEX,	"Cortex-A57 r0",

Index: src/sys/arch/arm/include/armreg.h
diff -u src/sys/arch/arm/include/armreg.h:1.111 src/sys/arch/arm/include/armreg.h:1.112
--- src/sys/arch/arm/include/armreg.h:1.111	Tue May 17 08:27:24 2016
+++ src/sys/arch/arm/include/armreg.h	Sat Sep 16 00:47:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: armreg.h,v 1.111 2016/05/17 08:27:24 msaitoh Exp $	*/
+/*	$NetBSD: armreg.h,v 1.112 2017/09/16 00:47:16 matt Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Ben Harris
@@ -227,6 +227,7 @@
 #define CPU_ID_CORTEXA15R2	0x412fc0f0
 #define CPU_ID_CORTEXA15R3	0x413fc0f0
 #define CPU_ID_CORTEXA17R1	0x411fc0e0
+#define CPU_ID_CORTEXA35R0	0x410fd040
 #define CPU_ID_CORTEXA53R0	0x410fd030
 #define CPU_ID_CORTEXA57R0	0x410fd070
 #define CPU_ID_CORTEXA57R1	0x411fd070
@@ -238,6 +239,7 @@
 #define CPU_ID_CORTEX_A8_P(n)	((n & 0xff0ff0f0) == 0x410fc080)
 #define CPU_ID_CORTEX_A9_P(n)	((n & 0xff0ff0f0) == 0x410fc090)
 #define CPU_ID_CORTEX_A15_P(n)	((n & 0xff0ff0f0) == 0x410fc0f0)
+#define CPU_ID_CORTEX_A35_P(n)	((n & 0xff0ff0f0) == 0x410fd040)
 #define CPU_ID_CORTEX_A53_P(n)	((n & 0xff0ff0f0) == 0x410fd030)
 #define CPU_ID_CORTEX_A57_P(n)	((n & 0xff0ff0f0) == 0x410fd070)
 #define CPU_ID_CORTEX_A72_P(n)	((n & 0xff0ff0f0) == 0x410fd080)



CVS commit: src/share/misc

2017-09-15 Thread Brian Ginsbach
Module Name:src
Committed By:   ginsbach
Date:   Fri Sep 15 23:08:12 UTC 2017

Modified Files:
src/share/misc: acronyms

Log Message:
PR misc/52542: Nikolai Lifanov: add definitions for HME, DME, DMEPOS


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.257 src/share/misc/acronyms:1.258
--- src/share/misc/acronyms:1.257	Tue Aug 22 02:36:48 2017
+++ src/share/misc/acronyms	Fri Sep 15 23:08:11 2017
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.257 2017/08/22 02:36:48 pgoyette Exp $
+$NetBSD: acronyms,v 1.258 2017/09/15 23:08:11 ginsbach Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -107,6 +107,8 @@ DIAFYO	did I ask for your opinion?
 DIY	do it yourself
 DKDC	don't know, don't care
 DM	dungeon master
+DME	durable medical equipment
+DMEPOS	durable medical equipment, prosthetics, orthotics and supplies
 DMZ	demilitarized zone
 DND	do not disturb
 DNF	did not finish
@@ -203,6 +205,7 @@ HF	have fun
 HHIS	hanging head in shame
 HHOS	ha ha, only serious
 HICA	here it comes again
+HME	home medical equipment
 HNY	happy new year
 HOAS	hold on a second
 HOPS	half-operator status



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

2017-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 15 21:34:42 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: ki2c.c ki2cvar.h

Log Message:
bus_space-ify


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/macppc/dev/ki2c.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/macppc/dev/ki2cvar.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/macppc/dev/ki2c.c
diff -u src/sys/arch/macppc/dev/ki2c.c:1.20 src/sys/arch/macppc/dev/ki2c.c:1.21
--- src/sys/arch/macppc/dev/ki2c.c:1.20	Tue Sep  5 17:21:09 2017
+++ src/sys/arch/macppc/dev/ki2c.c	Fri Sep 15 21:34:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2c.c,v 1.20 2017/09/05 17:21:09 macallan Exp $	*/
+/*	$NetBSD: ki2c.c,v 1.21 2017/09/15 21:34:42 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -45,8 +45,8 @@
 
 int ki2c_match(device_t, cfdata_t, void *);
 void ki2c_attach(device_t, device_t, void *);
-inline u_int ki2c_readreg(struct ki2c_softc *, int);
-inline void ki2c_writereg(struct ki2c_softc *, int, u_int);
+inline uint8_t ki2c_readreg(struct ki2c_softc *, int);
+inline void ki2c_writereg(struct ki2c_softc *, int, uint8_t);
 u_int ki2c_getmode(struct ki2c_softc *);
 void ki2c_setmode(struct ki2c_softc *, u_int);
 u_int ki2c_getspeed(struct ki2c_softc *);
@@ -95,6 +95,7 @@ ki2c_attach(device_t parent, device_t se
 	u_int reg[20];
 
 	sc->sc_dev = self;
+	sc->sc_tag = ca->ca_tag;
 	ca->ca_reg[0] += ca->ca_baseaddr;
 
 	if (OF_getprop(node, "AAPL,i2c-rate", , 4) != 4) {
@@ -105,7 +106,11 @@ ki2c_attach(device_t parent, device_t se
 		aprint_error(": unable to find i2c address\n");
 		return;
 	}
-	sc->sc_reg = mapiodev(addr, PAGE_SIZE, false);
+	if (bus_space_map(sc->sc_tag, addr, PAGE_SIZE, 0, >sc_bh) != 0) {
+		aprint_error_dev(sc->sc_dev, "failed to map registers\n");
+		return;
+	}
+
 	if (OF_getprop(node, "AAPL,address-step", >sc_regstep, 4) != 4) {
 		aprint_error(": unable to find i2c address step\n");
 		return;
@@ -200,21 +205,18 @@ ki2c_print(void *aux, const char *ki2c)
 	return UNCONF;
 }
 
-u_int
+uint8_t
 ki2c_readreg(struct ki2c_softc *sc, int reg)
 {
-	u_char *addr = sc->sc_reg + sc->sc_regstep * reg;
 
-	return *addr;
+	return bus_space_read_1(sc->sc_tag, sc->sc_bh, sc->sc_regstep * reg);
 }
 
 void
-ki2c_writereg(struct ki2c_softc *sc, int reg, u_int val)
+ki2c_writereg(struct ki2c_softc *sc, int reg, uint8_t val)
 {
-	u_char *addr = sc->sc_reg + sc->sc_regstep * reg;
-
-	*addr = val;
-	__asm volatile ("eieio");
+	
+	bus_space_write_1(sc->sc_tag, sc->sc_bh, reg * sc->sc_regstep, val);
 	delay(10);
 }
 

Index: src/sys/arch/macppc/dev/ki2cvar.h
diff -u src/sys/arch/macppc/dev/ki2cvar.h:1.4 src/sys/arch/macppc/dev/ki2cvar.h:1.5
--- src/sys/arch/macppc/dev/ki2cvar.h:1.4	Tue Jul 26 08:36:02 2011
+++ src/sys/arch/macppc/dev/ki2cvar.h	Fri Sep 15 21:34:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ki2cvar.h,v 1.4 2011/07/26 08:36:02 macallan Exp $	*/
+/*	$NetBSD: ki2cvar.h,v 1.5 2017/09/15 21:34:42 macallan Exp $	*/
 /*	Id: ki2c.c,v 1.7 2002/10/05 09:56:05 tsubai Exp	*/
 
 /*-
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -84,7 +85,8 @@
 
 struct ki2c_softc {
 	device_t sc_dev;
-	u_char *sc_reg;
+	bus_space_tag_t sc_tag;
+	bus_space_handle_t sc_bh;
 	int sc_regstep;
 	
 	struct i2c_controller sc_i2c;



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

2017-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 15 21:33:52 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: uni-n.c

Log Message:
provide a bus_space to child devices


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/macppc/dev/uni-n.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/uni-n.c
diff -u src/sys/arch/macppc/dev/uni-n.c:1.6 src/sys/arch/macppc/dev/uni-n.c:1.7
--- src/sys/arch/macppc/dev/uni-n.c:1.6	Wed Oct 26 13:54:18 2011
+++ src/sys/arch/macppc/dev/uni-n.c	Fri Sep 15 21:33:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uni-n.c,v 1.6 2011/10/26 13:54:18 macallan Exp $	*/
+/*	$NetBSD: uni-n.c,v 1.7 2017/09/15 21:33:52 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz.
@@ -31,7 +31,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.6 2011/10/26 13:54:18 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.7 2017/09/15 21:33:52 macallan Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: uni-n.c,v 1.
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -48,6 +49,7 @@ static int uni_n_print(void *, const cha
 
 struct uni_n_softc {
 	device_t sc_dev;
+	struct powerpc_bus_space sc_memt;
 	int sc_node;
 };
 
@@ -59,14 +61,16 @@ uni_n_match(device_t parent, cfdata_t cf
 {
 	struct confargs *ca = aux;
 	char compat[32];
-	if (strcmp(ca->ca_name, "uni-n") != 0)
+	if ((strcmp(ca->ca_name, "uni-n") != 0) &&
+	(strcmp(ca->ca_name, "u4") != 0))
 		return 0;
 
 	memset(compat, 0, sizeof(compat));
+#if 0
 	OF_getprop(ca->ca_node, "compatible", compat, sizeof(compat));
 	if (strcmp(compat, "uni-north") != 0)
 		return 0;
-
+#endif
 	return 1;
 }
 
@@ -85,10 +89,17 @@ uni_n_attach(device_t parent, device_t s
 	char name[32];
 
 	sc->sc_dev = self;
-	node = OF_finddevice("/uni-n");
+	node = our_ca->ca_node;
 	sc->sc_node = node;
 	printf(" address 0x%08x\n",our_ca->ca_reg[0]);
-	
+
+	memset(>sc_memt, 0, sizeof(struct powerpc_bus_space));
+	sc->sc_memt.pbs_flags = _BUS_SPACE_LITTLE_ENDIAN|_BUS_SPACE_MEM_TYPE;
+	if (ofwoea_map_space(RANGE_TYPE_MACIO, RANGE_MEM, node, >sc_memt,
+	"uni-n mem-space") != 0) {
+		panic("Can't init uni-n mem tag");
+	}
+
 	for (child = OF_child(node); child; child = OF_peer(child)) {
 		namelen = OF_getprop(child, "name", name, sizeof(name));
 		if (namelen < 0)
@@ -99,7 +110,7 @@ uni_n_attach(device_t parent, device_t s
 		name[namelen] = 0;
 		ca.ca_name = name;
 		ca.ca_node = child;
-
+		ca.ca_tag = >sc_memt;
 		ca.ca_nreg  = OF_getprop(child, "reg", reg, sizeof(reg));
 		ca.ca_nintr = OF_getprop(child, "AAPL,interrupts", intr,
 sizeof(intr));
@@ -109,7 +120,6 @@ uni_n_attach(device_t parent, device_t s
 
 		ca.ca_reg = reg;
 		ca.ca_intr = intr;
-
 		config_found(self, , uni_n_print);
 	}
 }



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

2017-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 15 21:31:25 UTC 2017

Modified Files:
src/sys/arch/macppc/dev: dbcool_ki2c.c deq.c

Log Message:
ki2c uses i2c addresses with the direction bit shifted out now, adjust
masking accordingly


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/macppc/dev/dbcool_ki2c.c \
src/sys/arch/macppc/dev/deq.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/dbcool_ki2c.c
diff -u src/sys/arch/macppc/dev/dbcool_ki2c.c:1.8 src/sys/arch/macppc/dev/dbcool_ki2c.c:1.9
--- src/sys/arch/macppc/dev/dbcool_ki2c.c:1.8	Tue Dec 13 08:16:40 2011
+++ src/sys/arch/macppc/dev/dbcool_ki2c.c	Fri Sep 15 21:31:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbcool_ki2c.c,v 1.8 2011/12/13 08:16:40 riastradh Exp $ */
+/*	$NetBSD: dbcool_ki2c.c,v 1.9 2017/09/15 21:31:25 macallan Exp $ */
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbcool_ki2c.c,v 1.8 2011/12/13 08:16:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbcool_ki2c.c,v 1.9 2017/09/15 21:31:25 macallan Exp $");
 
 #include 
 #include 
@@ -83,7 +83,7 @@ dbcool_ki2c_attach(device_t parent, devi
 	aprint_naive("\n");
 
 	sc->sc_dc.dc_tag = ka->ka_tag;
-	sc->sc_dc.dc_addr = ka->ka_addr & 0xfe;
+	sc->sc_dc.dc_addr = ka->ka_addr & 0x7f;
 	sc->sc_dc.dc_readreg = dbcool_ki2c_readreg;
 	sc->sc_dc.dc_writereg = dbcool_ki2c_writereg;
 
Index: src/sys/arch/macppc/dev/deq.c
diff -u src/sys/arch/macppc/dev/deq.c:1.8 src/sys/arch/macppc/dev/deq.c:1.9
--- src/sys/arch/macppc/dev/deq.c:1.8	Mon Dec 20 00:25:37 2010
+++ src/sys/arch/macppc/dev/deq.c	Fri Sep 15 21:31:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.8 2010/12/20 00:25:37 matt Exp $	*/
+/*	$NetBSD: deq.c,v 1.9 2017/09/15 21:31:25 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.8 2010/12/20 00:25:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.9 2017/09/15 21:31:25 macallan Exp $");
 
 #include 
 #include 
@@ -81,7 +81,7 @@ deq_attach(device_t parent, device_t sel
 	node = ka->ka_node;
 	sc->sc_node = node;
 	sc->sc_parent = parent;
-	sc->sc_address = ka->ka_addr & 0xfe;
+	sc->sc_address = (ka->ka_addr & 0x7f);
 	sc->sc_i2c = ka->ka_tag;
 	aprint_normal(" Apple Digital Equalizer, addr 0x%x\n", sc->sc_address);
 }



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

2017-09-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 15 21:27:46 UTC 2017

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

Log Message:
flesh out RANGE_TYPE_MACIO


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.39 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.40
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.39	Thu Dec 22 14:47:58 2016
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Sep 15 21:27:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.39 2016/12/22 14:47:58 cherry Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.39 2016/12/22 14:47:58 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.40 2017/09/15 21:27:46 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -551,7 +551,13 @@ find_ranges(int base, rangemap_t *region
 		goto rec;
 	if (type == RANGE_TYPE_ISA && strcmp("isa", tmp) != 0)
 		goto rec;
-	len = OF_getprop(node, "ranges", map, sizeof(map));
+	if (type == RANGE_TYPE_MACIO && strcmp("memory-controller", tmp) == 0) {
+		len = OF_getprop(node, "reg", map, sizeof(map));
+		acells = 1;
+		scells = 1;
+	} else {
+		len = OF_getprop(node, "ranges", map, sizeof(map));
+	}
 	if (len == -1)
 		goto rec;
 	if (OF_getprop(OF_parent(node), "#address-cells", _acells,
@@ -613,6 +619,12 @@ find_ranges(int base, rangemap_t *region
 (*cur)++;
 			}
 			break;
+		case RANGE_TYPE_MACIO:
+			regions[*cur].type = RANGE_MEM;
+			regions[*cur].size = map[1];
+			regions[*cur].addr = map[0];
+			(*cur)++;		
+			break;
 	}
 	DPRINTF("returning with CUR=%d\n", *cur);
 	return;
@@ -764,7 +776,7 @@ ofwoea_map_space(int rangetype, int iome
 		holes[i].size, holes[i].type);
 	/* AT THIS POINT WE MAP IT */
 
-	if (rangetype == RANGE_TYPE_PCI) {
+	if ((rangetype == RANGE_TYPE_PCI) || (rangetype == RANGE_TYPE_MACIO)) {
 		if (exmap == EXSTORAGE_MAX)
 			panic("Not enough ex_storage space. "
 			"Increase EXSTORAGE_MAX");



CVS commit: src/external/gpl2/xcvs/dist/src

2017-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 15 21:03:26 UTC 2017

Modified Files:
src/external/gpl2/xcvs/dist/src: cvs.h filesubr.c find_names.c import.c
rcs.c subr.c update.c vers_ts.c

Log Message:
1/2 the number of {l,s}stat(2) calls by exposing the stat data found
when calling islink()!


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/gpl2/xcvs/dist/src/cvs.h \
src/external/gpl2/xcvs/dist/src/subr.c
cvs rdiff -u -r1.5 -r1.6 src/external/gpl2/xcvs/dist/src/filesubr.c
cvs rdiff -u -r1.3 -r1.4 src/external/gpl2/xcvs/dist/src/find_names.c
cvs rdiff -u -r1.7 -r1.8 src/external/gpl2/xcvs/dist/src/import.c
cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/src/rcs.c
cvs rdiff -u -r1.11 -r1.12 src/external/gpl2/xcvs/dist/src/update.c
cvs rdiff -u -r1.2 -r1.3 src/external/gpl2/xcvs/dist/src/vers_ts.c

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

Modified files:

Index: src/external/gpl2/xcvs/dist/src/cvs.h
diff -u src/external/gpl2/xcvs/dist/src/cvs.h:1.4 src/external/gpl2/xcvs/dist/src/cvs.h:1.5
--- src/external/gpl2/xcvs/dist/src/cvs.h:1.4	Thu Mar  8 15:50:26 2012
+++ src/external/gpl2/xcvs/dist/src/cvs.h	Fri Sep 15 17:03:26 2017
@@ -516,7 +516,7 @@ typedef	RETSIGTYPE (*SIGCLEANUPPROC)	(in
 int SIG_register (int sig, SIGCLEANUPPROC sigcleanup);
 bool isdir (const char *file);
 bool isfile (const char *file);
-ssize_t islink (const char *file);
+ssize_t islink (const char *file, struct stat *stp);
 bool isdevice (const char *file);
 bool isreadable (const char *file);
 bool iswritable (const char *file);
Index: src/external/gpl2/xcvs/dist/src/subr.c
diff -u src/external/gpl2/xcvs/dist/src/subr.c:1.4 src/external/gpl2/xcvs/dist/src/subr.c:1.5
--- src/external/gpl2/xcvs/dist/src/subr.c:1.4	Mon May 30 13:49:51 2016
+++ src/external/gpl2/xcvs/dist/src/subr.c	Fri Sep 15 17:03:26 2017
@@ -13,7 +13,7 @@
  * Various useful functions for the CVS support code.
  */
 #include 
-__RCSID("$NetBSD: subr.c,v 1.4 2016/05/30 17:49:51 christos Exp $");
+__RCSID("$NetBSD: subr.c,v 1.5 2017/09/15 21:03:26 christos Exp $");
 
 #include "cvs.h"
 
@@ -719,7 +719,7 @@ resolve_symlink (char **filename)
 if (filename == NULL || *filename == NULL)
 	return;
 
-while ((rsize = islink (*filename)) > 0)
+while ((rsize = islink (*filename, NULL)) > 0)
 {
 #ifdef HAVE_READLINK
 	/* The clean thing to do is probably to have each filesubr.c

Index: src/external/gpl2/xcvs/dist/src/filesubr.c
diff -u src/external/gpl2/xcvs/dist/src/filesubr.c:1.5 src/external/gpl2/xcvs/dist/src/filesubr.c:1.6
--- src/external/gpl2/xcvs/dist/src/filesubr.c:1.5	Tue May 17 10:00:09 2016
+++ src/external/gpl2/xcvs/dist/src/filesubr.c	Fri Sep 15 17:03:26 2017
@@ -13,7 +13,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.  */
 #include 
-__RCSID("$NetBSD: filesubr.c,v 1.5 2016/05/17 14:00:09 christos Exp $");
+__RCSID("$NetBSD: filesubr.c,v 1.6 2017/09/15 21:03:26 christos Exp $");
 
 /* These functions were moved out of subr.c because they need different
definitions under operating systems (like, say, Windows NT) with different
@@ -25,6 +25,13 @@ __RCSID("$NetBSD: filesubr.c,v 1.5 2016/
 #include "xsize.h"
 
 static int deep_remove_dir (const char *path);
+#ifndef S_ISBLK
+#define S_ISBLK(a) 0
+#endif
+#ifndef S_ISCHR
+#define S_ISCHR(a) 0
+#endif
+#define IS_DEVICE(sbp) (S_ISBLK((sbp)->st_mode) || S_ISCHR((sbp)->st_mode))
 
 /*
  * Copies "from" to "to".
@@ -44,7 +51,7 @@ copy_file (const char *from, const char 
 
 /* If the file to be copied is a link or a device, then just create
the new link or device appropriately. */
-if ((rsize = islink (from)) > 0)
+if ((rsize = islink (from, )) > 0)
 {
 	char *source = Xreadlink (from, rsize);
 	if (symlink (source, to) == -1)
@@ -53,11 +60,9 @@ copy_file (const char *from, const char 
 	return;
 }
 
-if (isdevice (from))
+if (sb.st_ino != -1 && IS_DEVICE ())
 {
 #if defined(HAVE_MKNOD) && defined(HAVE_STRUCT_STAT_ST_RDEV)
-	if (stat (from, ) < 0)
-	error (1, errno, "cannot stat %s", from);
 	mknod (to, sb.st_mode, sb.st_rdev);
 #else
 	error (1, 0, "cannot copy device files on this system (%s)", from);
@@ -136,14 +141,22 @@ isdir (const char *file)
  * Returns size of the link if it is a symbolic link.
  */
 ssize_t
-islink (const char *file)
+islink (const char *file, struct stat *sbp)
 {
 ssize_t retsize = 0;
 #ifdef S_ISLNK
 struct stat sb;
+if (sbp == NULL)
+	sbp = 
 
-if ((lstat (file, ) >= 0) && S_ISLNK (sb.st_mode))
-	retsize = sb.st_size;
+if (lstat (file, sbp) < 0) {
+	sbp->st_ino = -1;
+	return 0;
+}
+if (S_ISLNK (sbp->st_mode))
+	retsize = sbp->st_size;
+#else
+sbp->st_ino = -1;
 #endif
 return retsize;
 }
@@ -161,15 +174,7 @@ isdevice (const char *file)
 
 if (lstat (file, ) < 0)
 	return false;

CVS commit: src/share/misc

2017-09-15 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Fri Sep 15 19:20:11 UTC 2017

Modified Files:
src/share/misc: airport

Log Message:
Fix COC.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/share/misc/airport

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

Modified files:

Index: src/share/misc/airport
diff -u src/share/misc/airport:1.66 src/share/misc/airport:1.67
--- src/share/misc/airport:1.66	Sun Jun  4 10:58:28 2017
+++ src/share/misc/airport	Fri Sep 15 19:20:11 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: airport,v 1.66 2017/06/04 10:58:28 mbalmer Exp $
+#	$NetBSD: airport,v 1.67 2017/09/15 19:20:11 mbalmer Exp $
 #	@(#)airport	8.1 (Berkeley) 6/8/93
 #
 # Some of this information is from http://www.mapping.com/airportcodes.html.
@@ -1424,7 +1424,7 @@ CNY:Moab (Canyonlands Field), UT, USA
 CNZ:Cangamba, Angola
 COA:Columbia Airport, CA, USA
 COB:Coolibah, Northern Territory, Australia
-COC:Concordia (Comodoro Pierres), Argentina
+COC:Concordia (Comodoro Pierrestegui), Entre Rios, Argentina
 COD:Cody (Yellowstone Regional Airport), WY, USA
 COE:Coeur d'Alene Terminal, ID, USA
 COF:Cocoa Beach (Patrick Air Force), FL, USA



CVS commit: src/sys/arch/sparc64/sparc64

2017-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 18:28:53 UTC 2017

Modified Files:
src/sys/arch/sparc64/sparc64: svr4_32_machdep.c

Log Message:
Make DEBUG code compile again.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/sparc64/sparc64/svr4_32_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/sparc64/sparc64/svr4_32_machdep.c
diff -u src/sys/arch/sparc64/sparc64/svr4_32_machdep.c:1.39 src/sys/arch/sparc64/sparc64/svr4_32_machdep.c:1.40
--- src/sys/arch/sparc64/sparc64/svr4_32_machdep.c:1.39	Thu Nov 26 13:15:34 2015
+++ src/sys/arch/sparc64/sparc64/svr4_32_machdep.c	Fri Sep 15 18:28:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_machdep.c,v 1.39 2015/11/26 13:15:34 martin Exp $	 */
+/*	$NetBSD: svr4_32_machdep.c,v 1.40 2017/09/15 18:28:53 martin Exp $	 */
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_machdep.c,v 1.39 2015/11/26 13:15:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_machdep.c,v 1.40 2017/09/15 18:28:53 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -226,7 +226,7 @@ svr4_32_setmcontext(struct lwp *l, struc
 #endif
 
 #ifdef DEBUG_SVR4
-	svr4_32_printmcontext("setmcontext", uc);
+	svr4_32_printmcontext("setmcontext", mc);
 #endif
 
 	write_user_windows();
@@ -503,9 +503,9 @@ svr4_32_sendsig(const ksiginfo_t *ksi, c
 	NETBSD32PTR32(frame.sf_ucp, >sf_uc);
 	frame.sf_handler = catcher;
 
-	DPRINTF(("svr4_32_sendsig signum=%d si = %p uc = %p handler = %p\n",
-	 frame.sf_signum, frame.sf_sip,
-		 frame.sf_ucp, frame.sf_handler));
+	DPRINTF(("svr4_32_sendsig signum=%d si = %x uc = %x handler = %p\n",
+	 frame.sf_signum, frame.sf_sip.i32,
+		 frame.sf_ucp.i32, frame.sf_handler));
 	/*
 	 * Modify the signal context to be used by sigreturn.
 	 */



CVS commit: src/sys/arch/amd64

2017-09-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 15 17:32:12 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S locore.S
src/sys/arch/amd64/include: frameasm.h

Log Message:
Declare INTRFASTEXIT as a function, so that there is only one iretq in the
kernel. Then, check %rip against the address of this iretq instead of
disassembling (%rip) - which could fault again, or point at some random
address which happens to contain the iretq opcode. The same is true for gs
below, but I'll fix that in another commit.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/include/frameasm.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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.10 src/sys/arch/amd64/amd64/amd64_trap.S:1.11
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.10	Sun Sep  3 08:52:18 2017
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Fri Sep 15 17:32:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.10 2017/09/03 08:52:18 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.11 2017/09/15 17:32:12 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.10 2017/09/03 08:52:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.11 2017/09/15 17:32:12 maxv Exp $");
 #endif
 
 /*
@@ -385,9 +385,9 @@ NENTRY(check_swapgs)
 	je	1b
 
 	/* Case 2: fault on iretq? */
-	movq	TF_RIP(%rsp),%rax
-	cmpw	$0xcf48,(%rax)		/* Faulting instruction is iretq ? */
-	jne	5f			/* Jump if not */
+	leaq	do_iret(%rip),%rdi
+	cmpq	%rdi,TF_RIP(%rsp)
+	jne	5f
 	movq	TF_RSP(%rsp),%rax	/* Must read %rsp, may be a pad word */
 	testb	$SEL_UPL,8(%rax)	/* Check %cs of outer iret frame */
 	je	2b			/* jump if iret was to kernel  */
@@ -395,6 +395,7 @@ NENTRY(check_swapgs)
 5:
 
 	/* Case 3: move to %gs? */
+	movq	TF_RIP(%rsp),%rax
 	movw	(%rax),%ax
 	andb	$070,%ah		/* mask mod/rm from mod/reg/rm */
 	cmpw	$0x8e+050*256,%ax	/* Any move to %gs (reg 5) */

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.128 src/sys/arch/amd64/amd64/locore.S:1.129
--- src/sys/arch/amd64/amd64/locore.S:1.128	Thu Aug 31 10:30:58 2017
+++ src/sys/arch/amd64/amd64/locore.S	Fri Sep 15 17:32:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.128 2017/08/31 10:30:58 maxv Exp $	*/
+/*	$NetBSD: locore.S,v 1.129 2017/09/15 17:32:12 maxv Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -329,6 +329,7 @@
 	.globl	_C_LABEL(biosbasemem)
 	.globl	_C_LABEL(biosextmem)
 	.globl	do_sysret
+	.globl	do_iret
 
 	.type	_C_LABEL(tablesize), @object
 _C_LABEL(tablesize):	.long	TABLESIZE
@@ -1304,12 +1305,19 @@ do_syscall:
 	jne	spl_error
 #endif
 
+	/*
+	 * If the syscall might have modified some registers, or we are a 32bit
+	 * process we must return to user with an 'iret' instruction.
+	 * If the iret faults in kernel (assumed due to illegal register values)
+	 * then a SIGSEGV will be signalled.
+	 */
 	testl	$(MDL_IRET|MDL_COMPAT32),L_MD_FLAGS(%r14)
 	INTR_RESTORE_GPRS
 	movw	TF_ES(%rsp),%es
 	movw	TF_DS(%rsp),%ds
 	SWAPGS
-	jnz	2f
+	jnz	.Lkexit
+
 #ifndef XEN
 	movq	TF_RIP(%rsp),%rcx	/* %rip for sysret */
 	movq	TF_RFLAGS(%rsp),%r11	/* %flags for sysret */
@@ -1322,16 +1330,6 @@ do_sysret:
 	jmp	HYPERVISOR_iret
 #endif
 
-/*
- * If the syscall might have modified some registers, or we are a 32bit
- * process we must return to user with an 'iret' instruction.
- * If the iret faults in kernel (assumed due to illegal register values)
- * then a SIGSEGV will be signalled.
- */
-2:
-	addq	$TF_RIP,%rsp
-	iretq
-
 #ifdef DIAGNOSTIC
 	/* Report SPL error */
 spl_error:
@@ -1441,7 +1439,6 @@ END(sse2_idlezero_page)
  *
  * Zero a page without polluting the cache.
  */
-
 ENTRY(pagezero)
 	movq	$-PAGE_SIZE,%rdx
 	subq	%rdx,%rdi
@@ -1460,3 +1457,21 @@ ENTRY(pagezero)
 	sfence
 	ret
 END(pagezero)
+
+ENTRY(intrfastexit)
+	INTR_RESTORE_GPRS
+	testq	$SEL_UPL,TF_CS(%rsp)	/* interrupted %cs */
+	jz	.Lkexit
+
+	/* Disable interrupts until the 'iret', user registers loaded. */
+	NOT_XEN(cli;)
+	movw	TF_ES(%rsp),%es
+	movw	TF_DS(%rsp),%ds
+	SWAPGS
+
+.Lkexit:
+	addq	$TF_REGSIZE+16,%rsp	/* + T_xxx and error code */
+do_iret:
+	iretq
+END(intrfastexit)
+

Index: src/sys/arch/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.20 src/sys/arch/amd64/include/frameasm.h:1.21
--- src/sys/arch/amd64/include/frameasm.h:1.20	Sun Jul 15 15:17:56 2012
+++ src/sys/arch/amd64/include/frameasm.h	Fri Sep 15 17:32:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.20 2012/07/15 15:17:56 dsl Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.21 2017/09/15 17:32:12 maxv Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H

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

2017-09-15 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 15 17:22:09 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: trap.c

Log Message:
Obviously, I was being absolutely dumb here; it's XEN, not Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/amd64/amd64/trap.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.99 src/sys/arch/amd64/amd64/trap.c:1.100
--- src/sys/arch/amd64/amd64/trap.c:1.99	Sun Sep  3 09:19:51 2017
+++ src/sys/arch/amd64/amd64/trap.c	Fri Sep 15 17:22:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.99 2017/09/03 09:19:51 maxv Exp $	*/
+/*	$NetBSD: trap.c,v 1.100 2017/09/15 17:22:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.99 2017/09/03 09:19:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.100 2017/09/15 17:22:09 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -230,7 +230,7 @@ nmitrap(struct trapframe *frame)
  * Such traps can be triggered when the kernel fails to return to userland,
  * because of incorrect segment registers.
  */
-#ifndef Xen
+#ifndef XEN
 static void trap_user_kernelmode(struct trapframe *, int, lwp_t *, proc_t *);
 
 static void



CVS commit: src/doc

2017-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 15 17:19:44 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
- new acpica
- obey the 80 character speed limit


To generate a diff of this commit:
cvs rdiff -u -r1.2316 -r1.2317 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.2316 src/doc/CHANGES:1.2317
--- src/doc/CHANGES:1.2316	Thu Sep 14 14:45:17 2017
+++ src/doc/CHANGES	Fri Sep 15 13:19:44 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2316 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2317 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -58,5 +58,7 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	tcpdump(8): Import 4.9.2. [christos 20170908]
 	veriexecgen(8): Drop support for MD5, SHA1, RMD160. [sevan 20170909]
 	itesio(4): Add support IT8728GF and IT877[12]E [hauke 20170814]
-	veriexec(4): Drop support for VERIFIED_EXEC_FP_MD5, VERIFIED_EXEC_FP_SHA1,
-		and VERIFIED_EXEC_FP_RMD160 options. [sevan 20170913]
+	veriexec(4): Drop support for VERIFIED_EXEC_FP_MD5,
+		VERIFIED_EXEC_FP_SHA1, and VERIFIED_EXEC_FP_RMD160 options.
+		[sevan 20170913]
+	acpi(4): Updated ACPICA to 20170831. [christos 20170915]



CVS commit: src/external/bsd/acpica/bin/iasl

2017-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 15 17:17:25 UTC 2017

Modified Files:
src/external/bsd/acpica/bin/iasl: Makefile

Log Message:
Adjust for acpica 20170831


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/acpica/bin/iasl/Makefile

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

Modified files:

Index: src/external/bsd/acpica/bin/iasl/Makefile
diff -u src/external/bsd/acpica/bin/iasl/Makefile:1.14 src/external/bsd/acpica/bin/iasl/Makefile:1.15
--- src/external/bsd/acpica/bin/iasl/Makefile:1.14	Sun Apr 30 19:18:07 2017
+++ src/external/bsd/acpica/bin/iasl/Makefile	Fri Sep 15 13:17:25 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.14 2017/04/30 23:18:07 christos Exp $
+# $NetBSD: Makefile,v 1.15 2017/09/15 17:17:25 christos Exp $
 
 .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64")
 PROG=	iasl
@@ -58,6 +58,7 @@ SRCS+= \
 	asloperands.c \
 	aslopt.c \
 	asloptions.c \
+	aslparseop.c \
 	aslpld.c \
 	aslpredef.c \
 	aslprepkg.c \
@@ -115,6 +116,7 @@ SRCS+= \
 	cmfsize.c \
 	dmextern.c \
 	dmrestag.c \
+	dmswitch.c \
 	dmtable.c \
 	dmtables.c \
 	dmtbdump.c \
@@ -145,6 +147,7 @@ SRCS+= \
 	dsfield.c \
 	dsobject.c \
 	dsopcode.c \
+	dspkginit.c \
 	dsutils.c \
 	dswexec.c \
 	dswload.c \
@@ -237,9 +240,11 @@ SRCS+= \
 	utosi.c \
 	utownerid.c \
 	utpredef.c \
+	utresdecode.c \
 	utresrc.c \
 	utstate.c \
 	utstring.c \
+	utstrsuppt.c \
 	utstrtoul64.c \
 	utuuid.c \
 	utxface.c \



CVS import: src/sys/external/bsd/acpica/dist

2017-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 15 16:50:49 UTC 2017

Update of /cvsroot/src/sys/external/bsd/acpica/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv11348

Log Message:

31 August 2017. Summary of changes for version 20170831:


1) ACPICA kernel-resident subsystem:

Implemented internal support for full 64-bit addresses that appear in all 
Generic Address Structure (GAS) structures. Previously, only the lower 32 
bits were used. Affects the use of GAS structures in the FADT and other 
tables, as well as the GAS structures passed to the AcpiRead and 
AcpiWrite public external interfaces that are used by drivers. Lv Zheng.

Added header support for the PDTT ACPI table (Processor Debug Trigger 
Table). Full support in the iASL Data Table Compiler and disassembler is 
forthcoming.


2) iASL Compiler/Disassembler and Tools:

iASL/Disassembler: Fixed a problem with the PPTT ACPI table (Processor 
Properties Topology Table) where a flag bit was specified in the wrong 
bit position ("Line Size Valid", bit 6).

iASL: Implemented support for Octal integer constants as defined by the 
ASL language grammar, per the ACPI specification. Any integer constant 
that starts with a zero is an octal constant. For example,
Store (03, Local0) /* Octal constant */
Store (0x3FFF, Local0) /* Hex equivalent */
Store (16383,  Local0) /* Decimal equivalent */

iASL: Improved overflow detection for 64-bit string conversions during 
compilation of integer constants. "Overflow" in this case means a string 
that represents an integer that is too large to fit into a 64-bit value. 
Any 64-bit constants within a 32-bit DSDT or SSDT are still truncated to 
the low-order 32 bits with a warning, as previously implemented. Several 
new exceptions are defined that indicate a 64-bit overflow, as well as 
the base (radix) that was used during the attempted conversion. Examples:
Local0 = 0x// AE_HEX_OVERFLOW
Local0 = 0 // AE_OCTAL_OVERFLOW
Local0 =   // AE_DECIMAL_OVERFLOW

iASL: Added a warning for the case where a ResourceTemplate is declared 
with no ResourceDescriptor entries (coded as "ResourceTemplate(){}"). In 
this case, the resulting template is created with a single END_TAG 
descriptor, which is essentially useless.

iASL: Expanded the -vw option (ignore specific warnings/remarks) to 
include compilation error codes as well.


28 July 2017. Summary of changes for version 20170728:


1) ACPICA kernel-resident subsystem:

Fixed a regression seen with small resource descriptors that could cause 
an inadvertent AE_AML_NO_RESOURCE_END_TAG exception.

AML interpreter: Implemented a new feature that allows forward references 
from individual named references within package objects that are 
contained within blocks of "module-level code". This provides 
compatibility with other ACPI implementations and supports existing 
firmware that depends on this feature. Example:

Name (ABCD, 1)
If (ABCD)   /* An If() at module-level */
{
Name (PKG1, Package()
{
INT1/* Forward reference to object INT1 
*/
})
Name (INT1, 0x1234)
}

AML Interpreter: Fixed a problem with the Alias() operator where aliases 
to some ASL objects were not handled properly. Objects affected are: 
Mutex, Event, and OperationRegion.

AML Debugger: Enhanced to properly handle AML Alias objects. These 
objects have one level of indirection which was not fully supported by 
the debugger.

Table Manager: Added support to detect and ignore duplicate SSDTs within 
the XSDT/RSDT. This error in the XSDT has been seen in the field.

EFI and EDK2 support:
Enabled /WX flag for MSVC builds
Added support for AcpiOsStall, AcpiOsSleep, and AcpiOsGetTimer
Added local support for 64-bit multiply and shift operations
Added support to compile acpidump.efi on Windows
Added OSL function stubs for interfaces not used under EFI

Added additional support for the _DMA predefined name. _DMA returns a 
buffer containing a resource template. This change add support within the 
resource manager (AcpiWalkResourceBuffer) to walk and parse this list of 
resource descriptors. Lorenzo Pieralisi 


2) iASL Compiler/Disassembler and Tools:

iASL: Fixed a problem where the internal input line buffer(s) could 
overflow if there are very long lines in the input ASL source code file. 
Implemented buffer management that automatically increases the size of 
the buffers as necessary.

iASL: Added an option (-vx) to "expect" particular remarks, warnings and 
errors. If the specified exception is not raised during compilation, the 
compiler emits an error. This is intended to support the ASL test suite, 
but may be useful in other contexts.


CVS commit: src/sys/dev/pci

2017-09-15 Thread Hikaru Abe
Module Name:src
Committed By:   hikaru
Date:   Fri Sep 15 14:24:32 UTC 2017

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

Log Message:
Add Intel QuickAssist devices.


To generate a diff of this commit:
cvs rdiff -u -r1.1297 -r1.1298 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.1297 src/sys/dev/pci/pcidevs:1.1298
--- src/sys/dev/pci/pcidevs:1.1297	Thu Aug 17 01:05:22 2017
+++ src/sys/dev/pci/pcidevs	Fri Sep 15 14:24:32 2017
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1297 2017/08/17 01:05:22 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1298 2017/09/15 14:24:32 hikaru Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3264,6 +3264,7 @@ product INTEL C3K_SMBUS_LEGACY	0x19df	C3
 product INTEL C3K_SPI		0x19e0	C3000 SPI
 product INTEL C3K_TRACE		0x19e1	C3000 Trace Hub
 product INTEL C3K_QAT		0x19e2	C3000 QAT
+product INTEL C3K_QAT_VF	0x19e3	C3000 QAT Virtual Function
 product INTEL C3K_IE_HECI_1	0x19e5	C3000 IE HECI 1
 product INTEL C3K_IE_HECI_2	0x19e6	C3000 IE HECI 2
 product INTEL C3K_IE_KT		0x19e8	C3000 IE KT
@@ -4087,6 +4088,8 @@ product INTEL E7520_PCIE_B1	0x3598	E7520
 product INTEL E7520_PCIE_C	0x3599	E7520 PCI Express Port C
 product INTEL E7520_PCIE_C1	0x359a	E7520 PCI Express Port C1
 product INTEL E7520_CFG		0x359b	E7520 Extended Configuration
+product INTEL C620_QAT		0x37c8	C620 QAT
+product INTEL C620_QAT_VF	0x37c9	C620 QAT Virtual Function
 product INTEL 82801JD_SATA_IDE	0x3a00	82801JD SATA Controller (IDE mode)
 product INTEL 82801JD_SATA_AHCI	0x3a02	82801JD SATA Controller (AHCI mode)
 product INTEL 82801JD_SATA_RAID	0x3a05	82801JD SATA Controller (RAID mode)
@@ -4341,6 +4344,8 @@ product INTEL XEOND_QD_1	0x6f50	Xeon-D Q
 product INTEL XEOND_QD_2	0x6f51	Xeon-D QuickData DMA Channel 1
 product INTEL XEOND_QD_3	0x6f52	Xeon-D QuickData DMA Channel 2
 product INTEL XEOND_QD_4	0x6f53	Xeon-D QuickData DMA Channel 3
+product INTEL XEOND_QAT		0x6f54	Xeon-D QAT
+product INTEL XEOND_QAT_VF	0x6f55	Xeon-D QAT Virtual Function
 product INTEL COREI76K_IMC_0	0x6f68	Core i7-6xxxK IMC
 product INTEL XEOND_HA0_DEBUG	0x6f70	Xeon-D Home Agent 0 Debug
 product INTEL XEOND_MEM_0_TTR_0	0x6f71	Core i7-6xxxK/Xeon-D Memory Controller (Target Address, Thermal, RAS)



CVS commit: src/sys/arch/sparc64/sparc64

2017-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 13:27:53 UTC 2017

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
If the bootloader passes us information about the boot device lun/target/
and wwn, use those to properly match the boot device.
If the new bootinfo is not available, fall back to the old heuristic
trying to match the pathname of the boot device (which is ugly, firmware
dependend and known to fail in some QEMU configurations).


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.212 src/sys/arch/sparc64/sparc64/autoconf.c:1.213
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.212	Mon Sep 11 19:25:07 2017
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Fri Sep 15 13:27:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.212 2017/09/11 19:25:07 palle Exp $ */
+/*	$NetBSD: autoconf.c,v 1.213 2017/09/15 13:27:53 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.212 2017/09/11 19:25:07 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.213 2017/09/15 13:27:53 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -855,6 +855,136 @@ dev_path_drive_match(device_t dev, int c
 		}
 	}
 }
+ 
+ /*
+ * Recursively check for a child node.
+ */
+static bool
+has_child_node(int parent, int search)
+{
+	int child;
+
+	for (child = prom_firstchild(parent); child != 0;
+	child = prom_nextsibling(child)) {
+		if (child == search)
+			return true;
+		if (has_child_node(child, search))
+			return true;
+	}
+
+	return false;
+}
+
+/*
+ * The interposed pseudo-parent node in OpenBIOS has a
+ * device_type = "ide" and no "vendor-id".
+ * It is the secondary bus if the name is "ide1".
+ */
+static bool
+openbios_secondary_ata_heuristic(int parent)
+{
+	char tmp[OFPATHLEN];
+
+	if (OF_getprop(parent, "device_type", tmp, sizeof(tmp)) <= 0)
+		return false;
+	if (strcmp(tmp, "ide") != 0)
+		return false;
+	DPRINTF(ACDB_BOOTDEV, ("parent device_type is ide\n"));
+
+	if (OF_getprop(parent, "vendor-id", tmp, sizeof(tmp)) > 0)
+		return false;
+	DPRINTF(ACDB_BOOTDEV, ("parent has no vendor-id\n"));
+
+	if (OF_getprop(parent, "name", tmp, sizeof(tmp)) <= 0)
+		return false;
+	if (strcmp(tmp, "ide1") != 0)
+		return false;
+	DPRINTF(ACDB_BOOTDEV, ("parent seems to be an OpenBIOS"
+	   " secondary ATA bus, applying workaround target+2\n"));
+
+	return true;
+}
+
+/*
+ * Match a device_t against the controller/target/lun/wwn
+ * info passed in from the bootloader (if available),
+ * otherwise fall back to old style string matching
+ * heuristics.
+ */
+static void
+dev_bi_unit_drive_match(device_t dev, int ctrlnode, int target,
+uint64_t wwn, int lun)
+{
+	static struct btinfo_bootdev_unit *bi_unit = NULL;
+	uint32_t off = 0;
+	static bool passed = false;
+#ifdef DEBUG
+	char ctrl_path[OFPATHLEN], parent_path[OFPATHLEN], dev_path[OFPATHLEN];
+#endif
+
+	if (!passed) {
+		bi_unit = lookup_bootinfo(BTINFO_BOOTDEV_UNIT);
+		passed = true;
+	}
+
+	if (bi_unit == NULL) {
+		dev_path_drive_match(dev, ctrlnode, target, wwn, lun);
+		return;
+	}
+
+#ifdef DEBUG
+	DPRINTF(ACDB_BOOTDEV, ("dev_bi_unit_drive_match: %s, controller %x, "
+	"target %d wwn %016" PRIx64 " lun %d\n", device_xname(dev),
+	ctrlnode, target, wwn, lun));
+
+	OF_package_to_path(ctrlnode, ctrl_path, sizeof(ctrl_path));
+	OF_package_to_path(bi_unit->phandle, dev_path, sizeof(dev_path));
+	OF_package_to_path(bi_unit->parent, parent_path, sizeof(parent_path));
+	DPRINTF(ACDB_BOOTDEV, ("controller %x : %s\n", ctrlnode, ctrl_path));
+	DPRINTF(ACDB_BOOTDEV, ("phandle %x : %s\n", bi_unit->phandle, dev_path));
+	DPRINTF(ACDB_BOOTDEV, ("parent %x : %s\n", bi_unit->parent, parent_path));
+#endif
+	if (ctrlnode != bi_unit->parent
+	&& !has_child_node(ctrlnode, bi_unit->phandle)) {
+		DPRINTF(ACDB_BOOTDEV, ("controller %x : %s does not match "
+		"bootinfo: %x : %s\n",
+		ctrlnode, ctrl_path, bi_unit->parent, parent_path));
+		return;
+	}
+	if (ctrlnode == bi_unit->parent) {
+		DPRINTF(ACDB_BOOTDEV, ("controller %x : %s is bootinfo"
+		" parent\n", ctrlnode, ctrl_path));
+	} else {
+		DPRINTF(ACDB_BOOTDEV, ("controller %x : %s is parent of"
+		" %x : %s\n", ctrlnode, ctrl_path, bi_unit->parent,
+		parent_path));
+
+		/*
+		 * Our kernel and "real" OpenFirmware use a 0 .. 3 numbering
+		 * scheme for IDE devices, but OpenBIOS splits it into
+		 * two "buses" and numbers each 0..1.
+		 * Check if we are on the secondary "bus" and adjust
+		 * if needed...
+		 */
+		if (openbios_secondary_ata_heuristic(bi_unit->parent))
+			off = 2;
+	}
+
+	if (bi_unit->wwn != wwn || (bi_unit->target+off) != target
+	|| bi_unit->lun != lun) {
+		

CVS commit: src/sys/arch

2017-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep 15 13:25:34 UTC 2017

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Locore.c boot.c boot.h ofdev.c
openfirm.h version
src/sys/arch/sparc64/include: bootinfo.h

Log Message:
Add more details about the boot device as a new bootinfo record type.
>From within the bootloader, when we have readily accessible instance
handles of the boot device, it is easy to query more details like SCSI
LUN, target, and FC-AL wwn from the firmware.
The kernel later would have a hard time getting theses, but can make good
use to match the boot device.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc/stand/ofwboot/Locore.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc/stand/ofwboot/boot.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sparc/stand/ofwboot/boot.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/sparc/stand/ofwboot/ofdev.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sparc/stand/ofwboot/openfirm.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/stand/ofwboot/version
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sparc64/include/bootinfo.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/sparc/stand/ofwboot/Locore.c
diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.15 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.16
--- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.15	Sat Oct 10 06:50:25 2015
+++ src/sys/arch/sparc/stand/ofwboot/Locore.c	Fri Sep 15 13:25:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: Locore.c,v 1.15 2015/10/10 06:50:25 martin Exp $	*/
+/*	$NetBSD: Locore.c,v 1.16 2017/09/15 13:25:34 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -35,6 +35,7 @@
 #include "openfirm.h"
 
 #include 
+#include 
 
 /*
  * We are trying to boot a sparc v9 cpu, so openfirmware has to be 64bit,
@@ -154,6 +155,26 @@ OF_instance_to_path(int ihandle, char *b
 }
 
 int
+OF_parent(int phandle)
+{
+	struct {
+		cell_t name;
+		cell_t nargs;
+		cell_t nreturns;
+		cell_t phandle;
+		cell_t parent;
+	} args;
+
+	args.name = ADR2CELL("parent");
+	args.nargs = 1;
+	args.nreturns = 1;
+	args.phandle = HDL2CELL(phandle);
+	if (openfirmware() == -1)
+		return 0;
+	return args.parent;
+}
+
+int
 OF_getprop(int handle, const char *prop, void *buf, int buflen)
 {
 	struct {
@@ -208,6 +229,66 @@ OF_setprop(u_int handle, char *prop, voi
 #endif
 
 int
+OF_interpret(const char *cmd, int nargs, int nreturns, ...)
+{
+	va_list ap;
+	struct {
+		cell_t name;
+		cell_t nargs;
+		cell_t nreturns;
+		cell_t slot[16];
+	} args;
+	cell_t status;
+	int i = 0;
+
+	args.name = ADR2CELL("interpret");
+	args.nargs = ++nargs;
+	args.nreturns = ++nreturns;
+	args.slot[i++] = ADR2CELL(cmd);
+	va_start(ap, nreturns);
+	while (i < nargs) {
+		args.slot[i++] = va_arg(ap, cell_t);
+	}
+	if (openfirmware() == -1) {
+		va_end(ap);
+		return (-1);
+	}
+	status = args.slot[i++];
+	while (i < nargs+nreturns) {
+		*va_arg(ap, cell_t *) = args.slot[i++];
+	}
+	va_end(ap);
+
+	return status;
+}
+
+int
+OF_package_to_path(int phandle, char *buf, int buflen)
+{
+	struct {
+		cell_t name;
+		cell_t nargs;
+		cell_t nreturns;
+		cell_t phandle;
+		cell_t buf;
+		cell_t buflen;
+		cell_t length;
+	} args;
+
+	if (buflen > PAGE_SIZE)
+		return -1;
+	args.name = ADR2CELL("package-to-path");
+	args.nargs = 3;
+	args.nreturns = 1;
+	args.phandle = HDL2CELL(phandle);
+	args.buf = ADR2CELL(buf);
+	args.buflen = buflen;
+	if (openfirmware() < 0)
+		return -1;
+	return args.length;
+}
+
+int
 OF_open(const char *dname)
 {
 	struct {

Index: src/sys/arch/sparc/stand/ofwboot/boot.c
diff -u src/sys/arch/sparc/stand/ofwboot/boot.c:1.34 src/sys/arch/sparc/stand/ofwboot/boot.c:1.35
--- src/sys/arch/sparc/stand/ofwboot/boot.c:1.34	Wed Aug 31 16:24:34 2016
+++ src/sys/arch/sparc/stand/ofwboot/boot.c	Fri Sep 15 13:25:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.34 2016/08/31 16:24:34 martin Exp $	*/
+/*	$NetBSD: boot.c,v 1.35 2017/09/15 13:25:34 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999 Eduardo E. Horvath.  All rights reserved.
@@ -284,6 +284,9 @@ jump_to_kernel(u_long *marks, char *kern
 	bi_add(_kend, BTINFO_KERNEND, sizeof(bi_kend));
 	bi_howto.boothowto = boothowto;
 	bi_add(_howto, BTINFO_BOOTHOWTO, sizeof(bi_howto));
+	if (bootinfo_pass_bootunit)
+		bi_add(_unit, BTINFO_BOOTDEV_UNIT,
+		sizeof(bi_unit));
 	if (bootinfo_pass_bootdev) {
 		struct {
 			struct btinfo_common common;

Index: src/sys/arch/sparc/stand/ofwboot/boot.h
diff -u src/sys/arch/sparc/stand/ofwboot/boot.h:1.10 src/sys/arch/sparc/stand/ofwboot/boot.h:1.11
--- src/sys/arch/sparc/stand/ofwboot/boot.h:1.10	Thu Feb 20 14:50:39 2014
+++ src/sys/arch/sparc/stand/ofwboot/boot.h	Fri Sep 15 13:25:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.h,v 1.10 2014/02/20 14:50:39 joerg Exp $	*/
+/*	$NetBSD: boot.h,v 1.11 2017/09/15 13:25:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ 

CVS commit: src/external/bsd/dhcpcd/sbin/dhcpcd

2017-09-15 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Sep 15 12:02:00 UTC 2017

Modified Files:
src/external/bsd/dhcpcd/sbin/dhcpcd: Makefile

Log Message:
build dhcpcd with ARPING support for non small builds.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile

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

Modified files:

Index: src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile
diff -u src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile:1.40 src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile:1.41
--- src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile:1.40	Fri Apr 14 10:00:06 2017
+++ src/external/bsd/dhcpcd/sbin/dhcpcd/Makefile	Fri Sep 15 12:02:00 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.40 2017/04/14 10:00:06 roy Exp $
+# $NetBSD: Makefile,v 1.41 2017/09/15 12:02:00 roy Exp $
 #
 
 WARNS?=		6
@@ -33,7 +33,7 @@ SRCS+=		auth.c hmac_md5.c
 CPPFLAGS+=	-DARP -DINET
 SRCS+=		arp.c bpf.c dhcp.c ipv4.c
 .if !defined(SMALLPROG)
-CPPFLAGS+=	-DIPV4LL
+CPPFLAGS+=	-DIPV4LL -DARPING
 SRCS+=		ipv4ll.c
 .endif
 .endif



CVS commit: src/sys/dev/pci/ixgbe

2017-09-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 15 08:31:32 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
xv(4) VLAN fixes:
- Dirty hack for VID mask bits. On ixg(4), VLAN filter is disabled. So any
  vlan ID's packet passes RX filter. On ixv(4), usually, PF driver uses
  VLAN filter enabled. There is no way to disable PF's VLAN filter function
  itself. NetBSD's Ethernet driver has currently no API to know which VLAN ID
  should be accepted. To avoid this proble, enable all VIDs... Yes, I know
  this is dirty hack. We should rethink.
- Call ixv_setup_vlan_support() in ixv_ifflags_cb().
- Don't use global ixv_shadow_vfta[].
- Use local variable (rxr->) to reduce diff against ixgbe.c. No functional
  change.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ixgbe/ixv.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/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.64 src/sys/dev/pci/ixgbe/ixv.c:1.65
--- src/sys/dev/pci/ixgbe/ixv.c:1.64	Fri Sep 15 04:52:32 2017
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Sep 15 08:31:32 2017
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.64 2017/09/15 04:52:32 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.65 2017/09/15 08:31:32 msaitoh Exp $*/
 
 /**
 
@@ -204,13 +204,6 @@ TUNABLE_INT("hw.ixv.rxd", _rxd);
 static int ixv_enable_legacy_tx = 0;
 TUNABLE_INT("hw.ixv.enable_legacy_tx", _enable_legacy_tx);
 
-/*
- * Shadow VFTA table, this is needed because
- * the real filter table gets cleared during
- * a soft reset and we need to repopulate it.
- */
-static u32 ixv_shadow_vfta[IXGBE_VFTA_SIZE];
-
 #ifdef NET_MPSAFE
 #define IXGBE_MPSAFE		1
 #define IXGBE_CALLOUT_FLAGS	CALLOUT_MPSAFE
@@ -1713,7 +1706,9 @@ ixv_initialize_receive_units(struct adap
 static void
 ixv_setup_vlan_support(struct adapter *adapter)
 {
+	struct ethercom *ec = >osdep.ec;
 	struct ixgbe_hw *hw = >hw;
+	struct rx_ring  *rxr;
 	u32		ctrl, vid, vfta, retry;
 
 	/*
@@ -1722,29 +1717,35 @@ ixv_setup_vlan_support(struct adapter *a
 	 * the VFTA and other state, so if there
 	 * have been no vlan's registered do nothing.
 	 */
-	if (!VLAN_ATTACHED(>osdep.ec))
+	if (!VLAN_ATTACHED(ec))
 		return;
 
 	/* Enable the queues */
 	for (int i = 0; i < adapter->num_queues; i++) {
-		ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
+		rxr = >rx_rings[i];
+		ctrl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(rxr->me));
 		ctrl |= IXGBE_RXDCTL_VME;
-		IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), ctrl);
+		IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(rxr->me), ctrl);
 		/*
 		 * Let Rx path know that it needs to store VLAN tag
 		 * as part of extra mbuf info.
 		 */
-		adapter->rx_rings[i].vtag_strip = TRUE;
+		rxr->vtag_strip = TRUE;
 	}
 
+#if 1
+	/* XXX dirty hack. Enable all VIDs */
+	for (int i = 0; i < IXGBE_VFTA_SIZE; i++)
+	  adapter->shadow_vfta[i] = 0x;
+#endif
 	/*
 	 * A soft reset zero's out the VFTA, so
 	 * we need to repopulate it now.
 	 */
 	for (int i = 0; i < IXGBE_VFTA_SIZE; i++) {
-		if (ixv_shadow_vfta[i] == 0)
+		if (adapter->shadow_vfta[i] == 0)
 			continue;
-		vfta = ixv_shadow_vfta[i];
+		vfta = adapter->shadow_vfta[i];
 		/*
 		 * Reconstruct the vlan id's
 		 * based on the bits set in each
@@ -1788,7 +1789,7 @@ ixv_register_vlan(void *arg, struct ifne
 	IXGBE_CORE_LOCK(adapter);
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
-	ixv_shadow_vfta[index] |= (1 << bit);
+	adapter->shadow_vfta[index] |= (1 << bit);
 	/* Re-init to load the changes */
 	ixv_init_locked(adapter);
 	IXGBE_CORE_UNLOCK(adapter);
@@ -1815,7 +1816,7 @@ ixv_unregister_vlan(void *arg, struct if
 	IXGBE_CORE_LOCK(adapter);
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
-	ixv_shadow_vfta[index] &= ~(1 << bit);
+	adapter->shadow_vfta[index] &= ~(1 << bit);
 	/* Re-init to load the changes */
 	ixv_init_locked(adapter);
 	IXGBE_CORE_UNLOCK(adapter);
@@ -2414,6 +2415,9 @@ ixv_ifflags_cb(struct ethercom *ec)
 	if ((change & ~(IFF_CANTCHANGE | IFF_DEBUG)) != 0)
 		rc = ENETRESET;
 
+	/* Set up VLAN support and filter */
+	ixv_setup_vlan_support(adapter);
+
 	IXGBE_CORE_UNLOCK(adapter);
 
 	return rc;