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

2022-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 12 15:13:46 UTC 2022

Modified Files:
src/sys/dev/ic [netbsd-8]: dwc_gmac.c

Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1755):

sys/dev/ic/dwc_gmac.c: revision 1.76-1.77

Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS
bytes.
ether_input() can now trust M_HASFCS to accurately represent the packet
contents.

Discussed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.40.6.4 -r1.40.6.5 src/sys/dev/ic/dwc_gmac.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/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.40.6.4 src/sys/dev/ic/dwc_gmac.c:1.40.6.5
--- src/sys/dev/ic/dwc_gmac.c:1.40.6.4	Mon Jun 18 15:39:49 2018
+++ src/sys/dev/ic/dwc_gmac.c	Fri Aug 12 15:13:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.40.6.4 2018/06/18 15:39:49 martin Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.40.6.5 2022/08/12 15:13:45 martin Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40.6.4 2018/06/18 15:39:49 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40.6.5 2022/08/12 15:13:45 martin Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -722,7 +722,6 @@ dwc_gmac_miibus_statchg(struct ifnet *if
 	conf |= AWIN_GMAC_MAC_CONF_FRAMEBURST
 	| AWIN_GMAC_MAC_CONF_DISABLERXOWN
 	| AWIN_GMAC_MAC_CONF_DISABLEJABBER
-	| AWIN_GMAC_MAC_CONF_ACS
 	| AWIN_GMAC_MAC_CONF_RXENABLE
 	| AWIN_GMAC_MAC_CONF_TXENABLE;
 	switch (IFM_SUBTYPE(mii->mii_media_active)) {



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

2022-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 12 15:13:46 UTC 2022

Modified Files:
src/sys/dev/ic [netbsd-8]: dwc_gmac.c

Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1755):

sys/dev/ic/dwc_gmac.c: revision 1.76-1.77

Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS
bytes.
ether_input() can now trust M_HASFCS to accurately represent the packet
contents.

Discussed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.40.6.4 -r1.40.6.5 src/sys/dev/ic/dwc_gmac.c

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



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

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:05:36 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1633):

sys/dev/ic/nvme.c: revision 1.53

PR kern/55839:

handle multiple nvme_rescan()s correctly by doing the
name-space identify only once per nsid.
fixes issue where modloading triggers multiple
rescans.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.8 -r1.30.2.9 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.8 src/sys/dev/ic/nvme.c:1.30.2.9
--- src/sys/dev/ic/nvme.c:1.30.2.8	Sun Sep 27 10:33:45 2020
+++ src/sys/dev/ic/nvme.c	Mon Dec  7 20:05:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.8 2020/09/27 10:33:45 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.9 2020/12/07 20:05:36 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.8 2020/09/27 10:33:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.9 2020/12/07 20:05:36 martin Exp $");
 
 #include 
 #include 
@@ -625,6 +625,12 @@ nvme_ns_identify(struct nvme_softc *sc, 
 
 	KASSERT(nsid > 0);
 
+	ns = nvme_ns_get(sc, nsid);
+	KASSERT(ns);
+
+	if (ns->ident != NULL)
+		return 0;
+
 	ccb = nvme_ccb_get(sc->sc_admin_q, false);
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
@@ -662,9 +668,6 @@ nvme_ns_identify(struct nvme_softc *sc, 
 	/* Convert data to host endian */
 	nvme_identify_namespace_swapbytes(identify);
 
-	ns = nvme_ns_get(sc, nsid);
-	KASSERT(ns);
-	KASSERT(ns->ident == NULL);
 	ns->ident = identify;
 
 done:



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

2020-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec  7 20:05:36 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1633):

sys/dev/ic/nvme.c: revision 1.53

PR kern/55839:

handle multiple nvme_rescan()s correctly by doing the
name-space identify only once per nsid.
fixes issue where modloading triggers multiple
rescans.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.8 -r1.30.2.9 src/sys/dev/ic/nvme.c

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



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

2020-09-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 27 10:33:45 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: ld_nvme.c nvme.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1610):

sys/dev/ic/ld_nvme.c: revision 1.24 (patch)
sys/dev/ic/nvme.c: revision 1.50 (patch)

PR kern/55674:
move name space availability check from ld_nvme.c:ld_nvme_attach()
to nvme.c:nvme_rescan().
this avoids allocation of ld(4) instances for every possible
name space, even if it is not usable. it also reduces the device
node flood generated from that strategy.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.4 -r1.16.2.5 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.30.2.7 -r1.30.2.8 src/sys/dev/ic/nvme.c

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



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

2020-09-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 27 10:33:45 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: ld_nvme.c nvme.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1610):

sys/dev/ic/ld_nvme.c: revision 1.24 (patch)
sys/dev/ic/nvme.c: revision 1.50 (patch)

PR kern/55674:
move name space availability check from ld_nvme.c:ld_nvme_attach()
to nvme.c:nvme_rescan().
this avoids allocation of ld(4) instances for every possible
name space, even if it is not usable. it also reduces the device
node flood generated from that strategy.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.4 -r1.16.2.5 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.30.2.7 -r1.30.2.8 src/sys/dev/ic/nvme.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/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.16.2.4 src/sys/dev/ic/ld_nvme.c:1.16.2.5
--- src/sys/dev/ic/ld_nvme.c:1.16.2.4	Mon Oct 28 18:27:47 2019
+++ src/sys/dev/ic/ld_nvme.c	Sun Sep 27 10:33:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.16.2.4 2019/10/28 18:27:47 martin Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.16.2.5 2020/09/27 10:33:45 martin Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.4 2019/10/28 18:27:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.5 2020/09/27 10:33:45 martin Exp $");
 
 #include 
 #include 
@@ -86,7 +86,6 @@ ld_nvme_attach(device_t parent, device_t
 	struct nvme_attach_args *naa = aux;
 	struct nvme_namespace *ns;
 	struct nvm_namespace_format *f;
-	int error;
 
 	ld->sc_dv = self;
 	sc->sc_nvme = nsc;
@@ -95,28 +94,11 @@ ld_nvme_attach(device_t parent, device_t
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-	error = nvme_ns_identify(sc->sc_nvme, sc->sc_nsid);
-	if (error) {
-		aprint_error_dev(self, "couldn't identify namespace\n");
-		return;
-	}
-
 	ns = nvme_ns_get(sc->sc_nvme, sc->sc_nsid);
 	KASSERT(ns);
-	f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
 
-	/*
-	 * NVME1.0e 6.11 Identify command
-	 *
-	 * LBADS values smaller than 9 are not supported, a value
-	 * of zero means that the format is not used.
-	 */
-	if (f->lbads < 9) {
-		if (f->lbads > 0)
-			aprint_error_dev(self,
-			"unsupported logical data size %u\n", f->lbads);
-		return;
-	}
+	f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
+	KASSERT(f->lbads >= 9); /* only valid LBA data sizes allowed here */
 
 	ld->sc_secsize = 1 << f->lbads;
 	ld->sc_secperunit = ns->ident->nsze;

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.7 src/sys/dev/ic/nvme.c:1.30.2.8
--- src/sys/dev/ic/nvme.c:1.30.2.7	Mon Nov 11 17:17:22 2019
+++ src/sys/dev/ic/nvme.c	Sun Sep 27 10:33:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.7 2019/11/11 17:17:22 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.8 2020/09/27 10:33:45 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.7 2019/11/11 17:17:22 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.8 2020/09/27 10:33:45 martin Exp $");
 
 #include 
 #include 
@@ -469,23 +469,52 @@ nvme_rescan(device_t self, const char *a
 {
 	struct nvme_softc *sc = device_private(self);
 	struct nvme_attach_args naa;
+	struct nvm_namespace_format *f;
+	struct nvme_namespace *ns;
 	uint64_t cap;
 	int ioq_entries = nvme_ioq_size;
 	int i;
+	int error;
 
 	cap = nvme_read8(sc, NVME_CAP);
 	if (ioq_entries > NVME_CAP_MQES(cap))
 		ioq_entries = NVME_CAP_MQES(cap);
 
-	for (i = 0; i < sc->sc_nn; i++) {
-		if (sc->sc_namespaces[i].dev)
+	for (i = 1; i <= sc->sc_nn; i++) {
+		if (sc->sc_namespaces[i - 1].dev)
 			continue;
-		memset(, 0, sizeof(naa));
-		naa.naa_nsid = i + 1;
-		naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
-		naa.naa_maxphys = sc->sc_mdts;
-		sc->sc_namespaces[i].dev = config_found(sc->sc_dev, ,
-		nvme_print);
+
+		/* identify to check for availability */
+		error = nvme_ns_identify(sc, i);
+		if (error) {
+			aprint_error_dev(self, "couldn't identify namespace #%d\n", i);
+			continue;
+		}
+
+		ns = nvme_ns_get(sc, i);
+		KASSERT(ns);
+
+		f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
+
+		/*
+		 * NVME1.0e 6.11 Identify command
+		 *
+		 * LBADS values smaller than 9 are not supported, a value
+		 * of zero means that the format is not used.
+		 */
+		if (f->lbads < 9) {
+			if (f->lbads > 0)
+aprint_error_dev(self,
+		 "unsupported logical data size %u\n", f->lbads);
+ 			continue;
+		}
+
+ 		memset(, 0, sizeof(naa));
+		naa.naa_nsid = i;
+ 		naa.naa_qentries = (ioq_entries - 1) * sc->sc_nq;
+ 		naa.naa_maxphys = sc->sc_mdts;
+		sc->sc_namespaces[i - 1].dev = config_found(sc->sc_dev, ,
+ 		nvme_print);
 	}
 	return 0;
 }



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

2020-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 16 13:31:20 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: mpt_netbsd.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1605):

sys/dev/ic/mpt_netbsd.c: revision 1.37

max_devices is a 8bit value and zero is interpreted as 256. This value
can be reported by an mpt device emulated by VMware ESXi.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.10.1 src/sys/dev/ic/mpt_netbsd.c

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



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

2020-09-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 16 13:31:20 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: mpt_netbsd.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1605):

sys/dev/ic/mpt_netbsd.c: revision 1.37

max_devices is a 8bit value and zero is interpreted as 256. This value
can be reported by an mpt device emulated by VMware ESXi.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.10.1 src/sys/dev/ic/mpt_netbsd.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/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.33 src/sys/dev/ic/mpt_netbsd.c:1.33.10.1
--- src/sys/dev/ic/mpt_netbsd.c:1.33	Mon May  2 19:18:29 2016
+++ src/sys/dev/ic/mpt_netbsd.c	Wed Sep 16 13:31:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.33 2016/05/02 19:18:29 christos Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.33.10.1 2020/09/16 13:31:20 martin Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.33 2016/05/02 19:18:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.33.10.1 2020/09/16 13:31:20 martin Exp $");
 
 #include "bio.h"
 
@@ -151,7 +151,7 @@ mpt_scsipi_attach(mpt_softc_t *mpt)
 	chan->chan_channel = 0;
 	chan->chan_flags = 0;
 	chan->chan_nluns = 8;
-	chan->chan_ntargets = mpt->mpt_max_devices;
+	chan->chan_ntargets = mpt->mpt_max_devices ? mpt->mpt_max_devices : 256;
 	chan->chan_id = mpt->mpt_ini_id;
 
 	/*



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

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:39:28 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c spdmemvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1528):

sys/dev/ic/spdmemvar.h: revision 1.15
sys/dev/ic/spdmemvar.h: revision 1.16
sys/dev/ic/spdmem.c: revision 1.31
sys/dev/ic/spdmem.c: revision 1.32
sys/dev/ic/spdmem.c: revision 1.33
sys/dev/ic/spdmem.c: revision 1.34
sys/dev/ic/spdmem.c: revision 1.35

Fix spelling of symeti^Hric

  Print DDR3's row and column correctly.

KNF. No functional change.

- Define some new parameters of DDR3 SPD ROM.
- Use fine timebase parameters for time calculation on DDR3. This change
   makes PC3- value more correctly on newer DDR3.

Calculate DDR3's tRAS correctly.

  Fix unused area size found by pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.24.6.2 -r1.24.6.3 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.13.6.1 -r1.13.6.2 src/sys/dev/ic/spdmemvar.h

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



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

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:39:28 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c spdmemvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1528):

sys/dev/ic/spdmemvar.h: revision 1.15
sys/dev/ic/spdmemvar.h: revision 1.16
sys/dev/ic/spdmem.c: revision 1.31
sys/dev/ic/spdmem.c: revision 1.32
sys/dev/ic/spdmem.c: revision 1.33
sys/dev/ic/spdmem.c: revision 1.34
sys/dev/ic/spdmem.c: revision 1.35

Fix spelling of symeti^Hric

  Print DDR3's row and column correctly.

KNF. No functional change.

- Define some new parameters of DDR3 SPD ROM.
- Use fine timebase parameters for time calculation on DDR3. This change
   makes PC3- value more correctly on newer DDR3.

Calculate DDR3's tRAS correctly.

  Fix unused area size found by pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.24.6.2 -r1.24.6.3 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.13.6.1 -r1.13.6.2 src/sys/dev/ic/spdmemvar.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/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.24.6.2 src/sys/dev/ic/spdmem.c:1.24.6.3
--- src/sys/dev/ic/spdmem.c:1.24.6.2	Thu Jan  3 11:23:54 2019
+++ src/sys/dev/ic/spdmem.c	Tue Apr 14 17:39:28 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.24.6.2 2019/01/03 11:23:54 martin Exp $ */
+/* $NetBSD: spdmem.c,v 1.24.6.3 2020/04/14 17:39:28 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.2 2019/01/03 11:23:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.3 2020/04/14 17:39:28 martin Exp $");
 
 #include 
 #include 
@@ -340,12 +340,12 @@ spdmem_common_attach(struct spdmem_softc
 	device_xname(self), NULL, NULL, 0, NULL, 0,
 	CTL_HW, CTL_CREATE, CTL_EOL);
 	if (node != NULL && spd_len != 0)
-sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
-0,
-CTLTYPE_STRUCT, "spd_data",
+		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
+		0,
+		CTLTYPE_STRUCT, "spd_data",
 		SYSCTL_DESCR("raw spd data"), NULL,
-0, s, spd_len,
-CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
+		0, s, spd_len,
+		CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	/*
 	 * Decode and print key SPD contents
@@ -411,7 +411,7 @@ spdmem_common_attach(struct spdmem_softc
 			strlcat(sc->sc_type, " NVDIMM hybrid",
 			SPDMEM_TYPE_MAXLEN);
 	}
-	
+
 	if (node != NULL)
 		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
 		0,
@@ -615,7 +615,7 @@ decode_sdram(const struct sysctlnode *no
 		freq = 0;
 	switch (freq) {
 		/*
-		 * Must check cycle time since some PC-133 DIMMs 
+		 * Must check cycle time since some PC-133 DIMMs
 		 * actually report PC-100
 		 */
 	case 100:
@@ -756,6 +756,30 @@ print_part(const char *part, size_t pnsi
 	aprint_normal(": %.*s\n", (int)(p - part), part);
 }
 
+static u_int
+ddr3_value_pico(struct spdmem *s, uint8_t txx_mtb, uint8_t txx_ftb)
+{
+	u_int mtb, ftb; /* in picoseconds */
+	intmax_t signed_txx_ftb;
+	u_int val;
+
+	mtb = (u_int)s->sm_ddr3.ddr3_mtb_dividend * 1000 /
+	s->sm_ddr3.ddr3_mtb_divisor;
+	ftb = (u_int)s->sm_ddr3.ddr3_ftb_dividend * 1000 /
+	s->sm_ddr3.ddr3_ftb_divisor;
+
+	/* tXX_ftb is signed value */
+	signed_txx_ftb = (int8_t)txx_ftb;
+	val = txx_mtb * mtb +
+	((txx_ftb > 127) ? signed_txx_ftb : txx_ftb) * ftb / 1000;
+
+	return val;
+}
+
+#define __DDR3_VALUE_PICO(s, field)\
+	ddr3_value_pico(s, s->sm_ddr3.ddr3_##field##_mtb,	\
+	s->sm_ddr3.ddr3_##field##_ftb)
+
 static void
 decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
@@ -786,10 +810,7 @@ decode_ddr3(const struct sysctlnode *nod
 		(s->sm_ddr3.ddr3_chipwidth + 2);
 	dimm_size = (1 << dimm_size) * (s->sm_ddr3.ddr3_physbanks + 1);
 
-	cycle_time = (1000 * s->sm_ddr3.ddr3_mtb_dividend + 
-			(s->sm_ddr3.ddr3_mtb_divisor / 2)) /
-		 s->sm_ddr3.ddr3_mtb_divisor;
-	cycle_time *= s->sm_ddr3.ddr3_tCKmin;
+	cycle_time = __DDR3_VALUE_PICO(s, tCKmin);
 	bits = 1 << (s->sm_ddr3.ddr3_datawidth + 3);
 	decode_size_speed(self, node, dimm_size, cycle_time, 2, bits, FALSE,
 			  "PC3", 0);
@@ -797,17 +818,21 @@ decode_ddr3(const struct sysctlnode *nod
 	aprint_verbose_dev(self,
 	"%d rows, %d cols, %d log. banks, %d phys. banks, "
 	"%d.%03dns cycle time\n",
-	s->sm_ddr3.ddr3_rows + 9, s->sm_ddr3.ddr3_cols + 12,
+	s->sm_ddr3.ddr3_rows + 12, s->sm_ddr3.ddr3_cols + 9,
 	1 << (s->sm_ddr3.ddr3_logbanks + 3),
 	s->sm_ddr3.ddr3_physbanks + 1,
 	cycle_time/1000, cycle_time % 1000);
 
-#define	__DDR3_CYCLES(field) (s->sm_ddr3.field / s->sm_ddr3.ddr3_tCKmin)
+#define	__DDR3_CYCLES(val)		\
+	((val / cycle_time) + ((val % cycle_time) ? 1 : 0))
 
-	

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

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:57:50 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: tms320av110.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1516):

sys/dev/ic/tms320av110.c: revision 1.24

Make it compilable (remove unused variables).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.30.1 src/sys/dev/ic/tms320av110.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/tms320av110.c
diff -u src/sys/dev/ic/tms320av110.c:1.23 src/sys/dev/ic/tms320av110.c:1.23.30.1
--- src/sys/dev/ic/tms320av110.c:1.23	Sat Oct 27 17:18:23 2012
+++ src/sys/dev/ic/tms320av110.c	Sun Mar  8 09:57:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tms320av110.c,v 1.23 2012/10/27 17:18:23 chs Exp $	*/
+/*	$NetBSD: tms320av110.c,v 1.23.30.1 2020/03/08 09:57:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.23 2012/10/27 17:18:23 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tms320av110.c,v 1.23.30.1 2020/03/08 09:57:50 martin Exp $");
 
 #include 
 #include 
@@ -251,9 +251,7 @@ tav_drain(void *hdl)
 int
 tav_query_encoding(void *hdl, struct audio_encoding *ae)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	if (ae->index >= sizeof(tav_encodings)/sizeof(*ae))
 		return EINVAL;
 
@@ -473,9 +471,7 @@ tav_set_params(void *hdl, int setmode, i
 int
 tav_set_port(void *hdl, mixer_ctrl_t *mc)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	/* dummy */
 	return 0;
 }
@@ -483,9 +479,7 @@ tav_set_port(void *hdl, mixer_ctrl_t *mc
 int
 tav_get_port(void *hdl, mixer_ctrl_t *mc)
 {
-	struct tav_softc *sc;
 
-	sc = hdl;
 	/* dummy */
 	return 0;
 }



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

2020-03-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  8 09:57:50 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: tms320av110.c

Log Message:
Pull up following revision(s) (requested by is in ticket #1516):

sys/dev/ic/tms320av110.c: revision 1.24

Make it compilable (remove unused variables).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.30.1 src/sys/dev/ic/tms320av110.c

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



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

2020-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 11 08:44:11 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: elinkxl.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1501):

sys/dev/ic/elinkxl.c: revision 1.137

  Restore an register read for RX_FRAMES_OK which was removed in rev. 1.133.

All statistics registers should be read to ACK the interrupt. Fixes PR#54920.
XXX pullup-[89]


To generate a diff of this commit:
cvs rdiff -u -r1.121.6.2 -r1.121.6.3 src/sys/dev/ic/elinkxl.c

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



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

2020-02-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 11 08:44:11 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: elinkxl.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1501):

sys/dev/ic/elinkxl.c: revision 1.137

  Restore an register read for RX_FRAMES_OK which was removed in rev. 1.133.

All statistics registers should be read to ACK the interrupt. Fixes PR#54920.
XXX pullup-[89]


To generate a diff of this commit:
cvs rdiff -u -r1.121.6.2 -r1.121.6.3 src/sys/dev/ic/elinkxl.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/elinkxl.c
diff -u src/sys/dev/ic/elinkxl.c:1.121.6.2 src/sys/dev/ic/elinkxl.c:1.121.6.3
--- src/sys/dev/ic/elinkxl.c:1.121.6.2	Wed Nov  6 10:04:46 2019
+++ src/sys/dev/ic/elinkxl.c	Tue Feb 11 08:44:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: elinkxl.c,v 1.121.6.2 2019/11/06 10:04:46 martin Exp $	*/
+/*	$NetBSD: elinkxl.c,v 1.121.6.3 2020/02/11 08:44:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.121.6.2 2019/11/06 10:04:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.121.6.3 2020/02/11 08:44:11 martin Exp $");
 
 #include 
 #include 
@@ -1510,6 +1510,7 @@ ex_getstats(struct ex_softc *sc)
 	(void)bus_space_read_1(iot, ioh, TX_AFTER_1_COLLISION);
 	(void)bus_space_read_1(iot, ioh, TX_NO_SQE);
 	(void)bus_space_read_1(iot, ioh, TX_CD_LOST);
+	(void)bus_space_read_1(iot, ioh, RX_FRAMES_OK);
 	GO_WINDOW(4);
 	(void)bus_space_read_1(iot, ioh, ELINK_W4_BADSSD);
 	GO_WINDOW(1);



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

2019-12-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 17 16:18:50 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: ath.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1475):

sys/dev/ic/ath.c: revision 1.129

Protect network ioctls from non-authorized users. (Ilja Van Sprundel)


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.123.6.1 src/sys/dev/ic/ath.c

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



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

2019-12-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Dec 17 16:18:50 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: ath.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1475):

sys/dev/ic/ath.c: revision 1.129

Protect network ioctls from non-authorized users. (Ilja Van Sprundel)


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.123.6.1 src/sys/dev/ic/ath.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/ath.c
diff -u src/sys/dev/ic/ath.c:1.123 src/sys/dev/ic/ath.c:1.123.6.1
--- src/sys/dev/ic/ath.c:1.123	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/ic/ath.c	Tue Dec 17 16:18:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ath.c,v 1.123 2017/02/02 10:05:35 nonaka Exp $	*/
+/*	$NetBSD: ath.c,v 1.123.6.1 2019/12/17 16:18:50 martin Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -41,7 +41,7 @@
 __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.123 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.123.6.1 2019/12/17 16:18:50 martin Exp $");
 #endif
 
 /*
@@ -69,6 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.12
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -5435,6 +5436,12 @@ ath_ioctl(struct ifnet *ifp, u_long cmd,
 		return copyout(>sc_stats,
 ifr->ifr_data, sizeof (sc->sc_stats));
 	case SIOCGATHDIAG:
+		error = kauth_authorize_network(curlwp->l_cred,
+		KAUTH_NETWORK_INTERFACE,
+		KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd),
+		NULL);
+		if (error)
+			break;
 		error = ath_ioctl_diag(sc, (struct ath_diag *) ifr);
 		break;
 	default:



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

2019-11-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 11 17:17:22 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1432):

sys/dev/ic/nvme.c: revision 1.47

nvme(4): Use the SET_FEATURES command to get the number of allocated queues.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.6 -r1.30.2.7 src/sys/dev/ic/nvme.c

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



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

2019-11-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 11 17:17:22 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1432):

sys/dev/ic/nvme.c: revision 1.47

nvme(4): Use the SET_FEATURES command to get the number of allocated queues.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.6 -r1.30.2.7 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.6 src/sys/dev/ic/nvme.c:1.30.2.7
--- src/sys/dev/ic/nvme.c:1.30.2.6	Thu Sep 26 18:23:13 2019
+++ src/sys/dev/ic/nvme.c	Mon Nov 11 17:17:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.6 2019/09/26 18:23:13 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.7 2019/11/11 17:17:22 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.6 2019/09/26 18:23:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.7 2019/11/11 17:17:22 martin Exp $");
 
 #include 
 #include 
@@ -114,7 +114,8 @@ static void	nvme_pt_done(struct nvme_que
 static int	nvme_command_passthrough(struct nvme_softc *,
 		struct nvme_pt_command *, uint16_t, struct lwp *, bool);
 
-static int	nvme_get_number_of_queues(struct nvme_softc *, u_int *);
+static int	nvme_set_number_of_queues(struct nvme_softc *, u_int, u_int *,
+		u_int *);
 
 #define NVME_TIMO_QOP		5	/* queue create and delete timeout */
 #define NVME_TIMO_IDENT		10	/* probe identify timeout */
@@ -337,7 +338,7 @@ nvme_attach(struct nvme_softc *sc)
 	uint32_t reg;
 	u_int dstrd;
 	u_int mps = PAGE_SHIFT;
-	u_int ioq_allocated;
+	u_int ncq, nsq;
 	uint16_t adminq_entries = nvme_adminq_size;
 	uint16_t ioq_entries = nvme_ioq_size;
 	int i;
@@ -411,13 +412,15 @@ nvme_attach(struct nvme_softc *sc)
 
 	if (sc->sc_use_mq) {
 		/* Limit the number of queues to the number allocated in HW */
-		if (nvme_get_number_of_queues(sc, _allocated) != 0) {
+		if (nvme_set_number_of_queues(sc, sc->sc_nq, , ) != 0) {
 			aprint_error_dev(sc->sc_dev,
 			"unable to get number of queues\n");
 			goto disable;
 		}
-		if (sc->sc_nq > ioq_allocated)
-			sc->sc_nq = ioq_allocated;
+		if (sc->sc_nq > ncq)
+			sc->sc_nq = ncq;
+		if (sc->sc_nq > nsq)
+			sc->sc_nq = nsq;
 	}
 
 	sc->sc_q = kmem_zalloc(sizeof(*sc->sc_q) * sc->sc_nq, KM_SLEEP);
@@ -1471,20 +1474,21 @@ nvme_fill_identify(struct nvme_queue *q,
 }
 
 static int
-nvme_get_number_of_queues(struct nvme_softc *sc, u_int *nqap)
+nvme_set_number_of_queues(struct nvme_softc *sc, u_int nq, u_int *ncqa,
+u_int *nsqa)
 {
 	struct nvme_pt_state state;
 	struct nvme_pt_command pt;
 	struct nvme_ccb *ccb;
-	uint16_t ncqa, nsqa;
 	int rv;
 
 	ccb = nvme_ccb_get(sc->sc_admin_q, false);
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
 	memset(, 0, sizeof(pt));
-	pt.cmd.opcode = NVM_ADMIN_GET_FEATURES;
-	pt.cmd.cdw10 = NVM_FEATURE_NUMBER_OF_QUEUES;
+	pt.cmd.opcode = NVM_ADMIN_SET_FEATURES;
+	htolem32(, NVM_FEATURE_NUMBER_OF_QUEUES);
+	htolem32(, ((nq - 1) << 16) | (nq - 1));
 
 	memset(, 0, sizeof(state));
 	state.pt = 
@@ -1496,13 +1500,12 @@ nvme_get_number_of_queues(struct nvme_so
 	rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_pt_fill, NVME_TIMO_QOP);
 
 	if (rv != 0) {
-		*nqap = 0;
+		*ncqa = *nsqa = 0;
 		return EIO;
 	}
 
-	ncqa = pt.cpl.cdw0 >> 16;
-	nsqa = pt.cpl.cdw0 & 0x;
-	*nqap = MIN(ncqa, nsqa) + 1;
+	*ncqa = (pt.cpl.cdw0 >> 16) + 1;
+	*nsqa = (pt.cpl.cdw0 & 0x) + 1;
 
 	return 0;
 }



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

2019-10-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 28 18:27:47 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: ld_nvme.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1417):

sys/dev/ic/ld_nvme.c: revision 1.23

Don't attach an ld device if the format descriptor is unsupported/unused.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 src/sys/dev/ic/ld_nvme.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/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.16.2.3 src/sys/dev/ic/ld_nvme.c:1.16.2.4
--- src/sys/dev/ic/ld_nvme.c:1.16.2.3	Thu Apr 19 15:37:56 2018
+++ src/sys/dev/ic/ld_nvme.c	Mon Oct 28 18:27:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.16.2.3 2018/04/19 15:37:56 martin Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.16.2.4 2019/10/28 18:27:47 martin Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.3 2018/04/19 15:37:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.4 2019/10/28 18:27:47 martin Exp $");
 
 #include 
 #include 
@@ -105,6 +105,19 @@ ld_nvme_attach(device_t parent, device_t
 	KASSERT(ns);
 	f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
 
+	/*
+	 * NVME1.0e 6.11 Identify command
+	 *
+	 * LBADS values smaller than 9 are not supported, a value
+	 * of zero means that the format is not used.
+	 */
+	if (f->lbads < 9) {
+		if (f->lbads > 0)
+			aprint_error_dev(self,
+			"unsupported logical data size %u\n", f->lbads);
+		return;
+	}
+
 	ld->sc_secsize = 1 << f->lbads;
 	ld->sc_secperunit = ns->ident->nsze;
 	ld->sc_maxxfer = naa->naa_maxphys;



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

2019-10-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 28 18:27:47 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: ld_nvme.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1417):

sys/dev/ic/ld_nvme.c: revision 1.23

Don't attach an ld device if the format descriptor is unsupported/unused.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.3 -r1.16.2.4 src/sys/dev/ic/ld_nvme.c

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



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

2019-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 26 18:23:13 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1390):

sys/dev/ic/nvme.c: revision 1.46

nvme(4): Don't attach the device, if namespace not found.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.5 -r1.30.2.6 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.5 src/sys/dev/ic/nvme.c:1.30.2.6
--- src/sys/dev/ic/nvme.c:1.30.2.5	Wed Sep 25 15:49:16 2019
+++ src/sys/dev/ic/nvme.c	Thu Sep 26 18:23:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.5 2019/09/25 15:49:16 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.6 2019/09/26 18:23:13 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.5 2019/09/25 15:49:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.6 2019/09/26 18:23:13 martin Exp $");
 
 #include 
 #include 
@@ -397,6 +397,10 @@ nvme_attach(struct nvme_softc *sc)
 		aprint_error_dev(sc->sc_dev, "unable to identify controller\n");
 		goto disable;
 	}
+	if (sc->sc_nn == 0) {
+		aprint_error_dev(sc->sc_dev, "namespace not found\n");
+		goto disable;
+	}
 
 	/* we know how big things are now */
 	sc->sc_max_sgl = sc->sc_mdts / sc->sc_mps;



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

2019-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 26 18:23:13 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1390):

sys/dev/ic/nvme.c: revision 1.46

nvme(4): Don't attach the device, if namespace not found.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.5 -r1.30.2.6 src/sys/dev/ic/nvme.c

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



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

2019-09-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 25 15:49:17 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1386):

sys/dev/ic/nvme.c: revision 1.45

Don't set Phase Tag bit of Completion Queue entry at nvme_poll_done().

A new completion queue entry check incorrectly determined that there was
a Completion Queue entry for a command that was not submitted.

Fix PR kern/54275, PR kern/54503, PR kern/54532.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.4 -r1.30.2.5 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.4 src/sys/dev/ic/nvme.c:1.30.2.5
--- src/sys/dev/ic/nvme.c:1.30.2.4	Thu Apr 19 15:37:56 2018
+++ src/sys/dev/ic/nvme.c	Wed Sep 25 15:49:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.4 2018/04/19 15:37:56 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.5 2019/09/25 15:49:16 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.4 2018/04/19 15:37:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.5 2019/09/25 15:49:16 martin Exp $");
 
 #include 
 #include 
@@ -1202,8 +1202,8 @@ nvme_poll_done(struct nvme_queue *q, str
 {
 	struct nvme_poll_state *state = ccb->ccb_cookie;
 
-	SET(cqe->flags, htole16(NVME_CQE_PHASE));
 	state->c = *cqe;
+	SET(state->c.flags, htole16(NVME_CQE_PHASE));
 
 	ccb->ccb_cookie = state->cookie;
 	state->done(q, ccb, >c);



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

2019-09-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 25 15:49:17 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1386):

sys/dev/ic/nvme.c: revision 1.45

Don't set Phase Tag bit of Completion Queue entry at nvme_poll_done().

A new completion queue entry check incorrectly determined that there was
a Completion Queue entry for a command that was not submitted.

Fix PR kern/54275, PR kern/54503, PR kern/54532.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.4 -r1.30.2.5 src/sys/dev/ic/nvme.c

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



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

2019-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 30 19:00:10 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: mvsata.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1283):

sys/dev/ic/mvsata.c: revision 1.47
sys/dev/ic/mvsata.c: revision 1.48

Fix "mvsata:0:0:1: buffer load failed: error=27" failure.  PR/54205
Ok'ed by jdolecek@.
Should be pulled up to netbsd-8.

Add a missing newline in an error message.  Noticed in PR/54205


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.10.1 src/sys/dev/ic/mvsata.c

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



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

2019-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun 30 19:00:10 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: mvsata.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1283):

sys/dev/ic/mvsata.c: revision 1.47
sys/dev/ic/mvsata.c: revision 1.48

Fix "mvsata:0:0:1: buffer load failed: error=27" failure.  PR/54205
Ok'ed by jdolecek@.
Should be pulled up to netbsd-8.

Add a missing newline in an error message.  Noticed in PR/54205


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.35.10.1 src/sys/dev/ic/mvsata.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/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.35 src/sys/dev/ic/mvsata.c:1.35.10.1
--- src/sys/dev/ic/mvsata.c:1.35	Mon May  2 19:18:29 2016
+++ src/sys/dev/ic/mvsata.c	Sun Jun 30 19:00:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.35 2016/05/02 19:18:29 christos Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.35.10.1 2019/06/30 19:00:10 martin Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35 2016/05/02 19:18:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.10.1 2019/06/30 19:00:10 martin Exp $");
 
 #include "opt_mvsata.h"
 
@@ -103,7 +103,8 @@ int	mvsata_debug = 2;
 	   sending a cmd */
 #define ATAPI_MODE_DELAY	1000	/* 1s, timeout for SET_FEATURE cmds */
 
-#define MVSATA_EPRD_MAX_SIZE	(sizeof(struct eprd) * (MAXPHYS / PAGE_SIZE))
+#define MVSATA_MAX_SEGS		(MAXPHYS / PAGE_SIZE + 1)
+#define MVSATA_EPRD_MAX_SIZE	(sizeof(struct eprd) * MVSATA_MAX_SEGS)
 
 
 static void mvsata_probe_drive(struct ata_channel *);
@@ -2918,7 +2919,7 @@ mvsata_port_init(struct mvsata_hc *mvhc,
 	}
 	for (i = 0; i < MVSATA_EDMAQ_LEN; i++) {
 		rv = bus_dmamap_create(mvport->port_dmat, MAXPHYS,
-		MAXPHYS / PAGE_SIZE, MAXPHYS, 0, BUS_DMA_NOWAIT,
+		MVSATA_MAX_SEGS, MAXPHYS, 0, BUS_DMA_NOWAIT,
 		>port_reqtbl[i].data_dmamap);
 		if (rv != 0) {
 			aprint_error("%s:%d:%d:"
@@ -3125,7 +3126,7 @@ mvsata_dma_bufload(struct mvsata_port *m
 	rv = bus_dmamap_load(mvport->port_dmat, data_dmamap, databuf, datalen,
 	NULL, BUS_DMA_NOWAIT | lop);
 	if (rv) {
-		aprint_error("%s:%d:%d: buffer load failed: error=%d",
+		aprint_error("%s:%d:%d: buffer load failed: error=%d\n",
 		device_xname(MVSATA_DEV2(mvport)), mvport->port_hc->hc,
 		mvport->port, rv);
 		return rv;



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

2019-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr  7 10:55:24 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: msm6242b.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1227):

sys/dev/ic/msm6242b.c: revision 1.4

Remove misplaced semicolon, found by GCC 6.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/dev/ic/msm6242b.c

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



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

2019-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr  7 10:55:24 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: msm6242b.c

Log Message:
Pull up following revision(s) (requested by rin in ticket #1227):

sys/dev/ic/msm6242b.c: revision 1.4

Remove misplaced semicolon, found by GCC 6.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.22.1 src/sys/dev/ic/msm6242b.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/msm6242b.c
diff -u src/sys/dev/ic/msm6242b.c:1.3 src/sys/dev/ic/msm6242b.c:1.3.22.1
--- src/sys/dev/ic/msm6242b.c:1.3	Wed Dec  4 07:48:59 2013
+++ src/sys/dev/ic/msm6242b.c	Sun Apr  7 10:55:24 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: msm6242b.c,v 1.3 2013/12/04 07:48:59 rkujawa Exp $ */
+/*  $NetBSD: msm6242b.c,v 1.3.22.1 2019/04/07 10:55:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msm6242b.c,v 1.3 2013/12/04 07:48:59 rkujawa Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msm6242b.c,v 1.3.22.1 2019/04/07 10:55:24 martin Exp $");
 
 /* 
  * Driver for OKI MSM6242B Real Time Clock. Somewhat based on an ancient, amiga
@@ -123,7 +123,7 @@ msm6242b_gettime_ymdhms(todr_chip_handle
 		MSM6242B_PMAM_BIT) == 0 && dt->dt_hour == 12)
 			dt->dt_hour = 0;
 		else if ((msm6242b_read(sc, MSM6242B_10HOUR_PMAM) & 
-		MSM6242B_PMAM_BIT) && dt->dt_hour != 12);
+		MSM6242B_PMAM_BIT) && dt->dt_hour != 12)
 			dt->dt_hour += 12;
 	}
 



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

2019-01-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan  3 11:23:54 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c spdmemvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1153):

sys/dev/ic/spdmemvar.h: revision 1.14
sys/dev/ic/spdmem.c: revision 1.30
sys/dev/ic/spdmem.c: revision 1.29

- Fix DDR4's rows and columns value.
- Print "banks/group" instead of "banks" because it's not the total bank
   number.

 -

  Print rank on DDR4.


To generate a diff of this commit:
cvs rdiff -u -r1.24.6.1 -r1.24.6.2 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/dev/ic/spdmemvar.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/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.24.6.1 src/sys/dev/ic/spdmem.c:1.24.6.2
--- src/sys/dev/ic/spdmem.c:1.24.6.1	Wed Nov 22 14:33:23 2017
+++ src/sys/dev/ic/spdmem.c	Thu Jan  3 11:23:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.24.6.1 2017/11/22 14:33:23 martin Exp $ */
+/* $NetBSD: spdmem.c,v 1.24.6.2 2019/01/03 11:23:54 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.1 2017/11/22 14:33:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.2 2019/01/03 11:23:54 martin Exp $");
 
 #include 
 #include 
@@ -869,7 +869,7 @@ decode_fbdimm(const struct sysctlnode *n
 static void
 decode_ddr4(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
-	int dimm_size, cycle_time;
+	int dimm_size, cycle_time, ranks;
 	int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks;
 
 	aprint_naive("\n");
@@ -937,14 +937,17 @@ decode_ddr4(const struct sysctlnode *nod
 			  1 << (s->sm_ddr4.ddr4_primary_bus_width + 3),
 			  TRUE, "PC4", 0);
 
+	ranks = s->sm_ddr4.ddr4_package_ranks + 1;
 	aprint_verbose_dev(self,
-	"%d rows, %d cols, %d banks, %d bank groups, "
-	"%d.%03dns cycle time\n",
-	s->sm_ddr4.ddr4_rows + 9, s->sm_ddr4.ddr4_cols + 12,
+	"%d rows, %d cols, %d ranks%s, %d banks/group, %d bank groups\n",
+	s->sm_ddr4.ddr4_rows + 12, s->sm_ddr4.ddr4_cols + 9,
+	ranks, (ranks > 1) ? ((s->sm_ddr4.ddr4_rank_mix == 1)
+		? " (asymmetric)" : " (symmetiric)") : "",
 	1 << (2 + s->sm_ddr4.ddr4_logbanks),
-	1 << s->sm_ddr4.ddr4_bankgroups,
-	cycle_time / 1000, cycle_time % 1000);
+	1 << s->sm_ddr4.ddr4_bankgroups);
 
+	aprint_verbose_dev(self, "%d.%03dns cycle time\n",
+	cycle_time / 1000, cycle_time % 1000);
 
 	tAA_clocks =  __DDR4_VALUE(tAAmin)  * 1000 / cycle_time;
 	tRCD_clocks = __DDR4_VALUE(tRCDmin) * 1000 / cycle_time;

Index: src/sys/dev/ic/spdmemvar.h
diff -u src/sys/dev/ic/spdmemvar.h:1.13 src/sys/dev/ic/spdmemvar.h:1.13.6.1
--- src/sys/dev/ic/spdmemvar.h:1.13	Wed Jan 18 06:02:50 2017
+++ src/sys/dev/ic/spdmemvar.h	Thu Jan  3 11:23:54 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemvar.h,v 1.13 2017/01/18 06:02:50 msaitoh Exp $ */
+/* $NetBSD: spdmemvar.h,v 1.13.6.1 2019/01/03 11:23:54 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -768,7 +768,8 @@ struct spdmem_ddr4 {/* Dual Data Rat
 		uint8_t	ddr4_device_width:3,	\
 		/* number of package ranks is field value plus 1 */ \
 		uint8_t	ddr4_package_ranks:3,	\
-		uint8_t	ddr4_unused9:2,		\
+		uint8_t	ddr4_rank_mix:1,	\
+		uint8_t	ddr4_unused9:1		\
 	);
 	SPD_BITFIELD(	\
 		/* primary width is offset by 3, extension is offset by 2 */ \



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

2019-01-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan  3 11:23:54 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c spdmemvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1153):

sys/dev/ic/spdmemvar.h: revision 1.14
sys/dev/ic/spdmem.c: revision 1.30
sys/dev/ic/spdmem.c: revision 1.29

- Fix DDR4's rows and columns value.
- Print "banks/group" instead of "banks" because it's not the total bank
   number.

 -

  Print rank on DDR4.


To generate a diff of this commit:
cvs rdiff -u -r1.24.6.1 -r1.24.6.2 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/dev/ic/spdmemvar.h

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



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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 16:22:51 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: malo.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #952):

sys/dev/ic/malo.c: revision 1.11

bpf_mtap*() after ieee80211_encap() should be bpf_mtap3() rather than
bpf_mtap(). bpf_mtap3() is for raw bpf.


To generate a diff of this commit:
cvs rdiff -u -r1.9.6.1 -r1.9.6.2 src/sys/dev/ic/malo.c

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



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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 16:22:51 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: malo.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #952):

sys/dev/ic/malo.c: revision 1.11

bpf_mtap*() after ieee80211_encap() should be bpf_mtap3() rather than
bpf_mtap(). bpf_mtap3() is for raw bpf.


To generate a diff of this commit:
cvs rdiff -u -r1.9.6.1 -r1.9.6.2 src/sys/dev/ic/malo.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/malo.c
diff -u src/sys/dev/ic/malo.c:1.9.6.1 src/sys/dev/ic/malo.c:1.9.6.2
--- src/sys/dev/ic/malo.c:1.9.6.1	Sun Dec 10 10:10:23 2017
+++ src/sys/dev/ic/malo.c	Tue Jul 31 16:22:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: malo.c,v 1.9.6.1 2017/12/10 10:10:23 snj Exp $ */
+/*	$NetBSD: malo.c,v 1.9.6.2 2018/07/31 16:22:51 martin Exp $ */
 /*	$OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.9.6.1 2017/12/10 10:10:23 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.9.6.2 2018/07/31 16:22:51 martin Exp $");
 
 #include 
 #include 
@@ -1074,7 +1074,7 @@ malo_start(struct ifnet *ifp)
 			m0 = ieee80211_encap(ic, m0, ni);
 			if (m0 == NULL)
 continue;
-			bpf_mtap(ifp, m0);
+			bpf_mtap3(ic->ic_rawbpf, m0);
 
 			if (malo_tx_data(sc, m0, ni) != 0) {
 ieee80211_free_node(ni);



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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 16:20:33 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: rt2661.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #951):

sys/dev/ic/rt2661.c: revision 1.38

bpf_mtap*() before ieee80211_encap() should be bpf_mtap() rather than
bpf_mtap3(). bpf_mtap3() is for raw bpf and be used after ieee80211_encap().


To generate a diff of this commit:
cvs rdiff -u -r1.35.2.1 -r1.35.2.2 src/sys/dev/ic/rt2661.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/rt2661.c
diff -u src/sys/dev/ic/rt2661.c:1.35.2.1 src/sys/dev/ic/rt2661.c:1.35.2.2
--- src/sys/dev/ic/rt2661.c:1.35.2.1	Sun Dec 10 10:10:23 2017
+++ src/sys/dev/ic/rt2661.c	Tue Jul 31 16:20:33 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2661.c,v 1.35.2.1 2017/12/10 10:10:23 snj Exp $	*/
+/*	$NetBSD: rt2661.c,v 1.35.2.2 2018/07/31 16:20:33 martin Exp $	*/
 /*	$OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $	*/
 /*	$FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $	*/
 
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.35.2.1 2017/12/10 10:10:23 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.35.2.2 2018/07/31 16:20:33 martin Exp $");
 
 
 #include 
@@ -1890,7 +1890,7 @@ rt2661_start(struct ifnet *ifp)
 continue;
 			}
 
-			bpf_mtap3(ifp->if_bpf, m0);
+			bpf_mtap(ifp, m0);
 			m0 = ieee80211_encap(ic, m0, ni);
 			if (m0 == NULL) {
 ieee80211_free_node(ni);



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

2018-07-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jul 31 16:20:33 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: rt2661.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #951):

sys/dev/ic/rt2661.c: revision 1.38

bpf_mtap*() before ieee80211_encap() should be bpf_mtap() rather than
bpf_mtap3(). bpf_mtap3() is for raw bpf and be used after ieee80211_encap().


To generate a diff of this commit:
cvs rdiff -u -r1.35.2.1 -r1.35.2.2 src/sys/dev/ic/rt2661.c

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



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

2018-06-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 18 15:39:49 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: dwc_gmac.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #885):

sys/dev/ic/dwc_gmac.c: revision 1.47

Avoid calling bus_dmamap_sync with len=0


To generate a diff of this commit:
cvs rdiff -u -r1.40.6.3 -r1.40.6.4 src/sys/dev/ic/dwc_gmac.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/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.40.6.3 src/sys/dev/ic/dwc_gmac.c:1.40.6.4
--- src/sys/dev/ic/dwc_gmac.c:1.40.6.3	Sat Jan 13 04:44:29 2018
+++ src/sys/dev/ic/dwc_gmac.c	Mon Jun 18 15:39:49 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.40.6.3 2018/01/13 04:44:29 snj Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.40.6.4 2018/06/18 15:39:49 martin Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40.6.3 2018/01/13 04:44:29 snj Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40.6.4 2018/06/18 15:39:49 martin Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -636,11 +636,13 @@ dwc_gmac_txdesc_sync(struct dwc_gmac_sof
 	TX_DESC_OFFSET(start),
 	TX_DESC_OFFSET(AWGE_TX_RING_COUNT)-TX_DESC_OFFSET(start),
 	ops);
-	/* sync from start of ring to 'end' */
-	bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
-	TX_DESC_OFFSET(0),
-	TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0),
-	ops);
+	if (TX_DESC_OFFSET(end) - TX_DESC_OFFSET(0) > 0) {
+		/* sync from start of ring to 'end' */
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_dma_ring_map,
+		TX_DESC_OFFSET(0),
+		TX_DESC_OFFSET(end)-TX_DESC_OFFSET(0),
+		ops);
+	}
 }
 
 static void



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

2018-06-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jun 18 15:39:49 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: dwc_gmac.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #885):

sys/dev/ic/dwc_gmac.c: revision 1.47

Avoid calling bus_dmamap_sync with len=0


To generate a diff of this commit:
cvs rdiff -u -r1.40.6.3 -r1.40.6.4 src/sys/dev/ic/dwc_gmac.c

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



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

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:21:02 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #815):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.96.2.1 src/sys/dev/ic/hme.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/hme.c
diff -u src/sys/dev/ic/hme.c:1.96 src/sys/dev/ic/hme.c:1.96.2.1
--- src/sys/dev/ic/hme.c:1.96	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/hme.c	Wed May  9 15:21:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hme.c,v 1.96 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: hme.c,v 1.96.2.1 2018/05/09 15:21:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.96 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.96.2.1 2018/05/09 15:21:02 martin Exp $");
 
 /* #define HMEDEBUG */
 
@@ -753,7 +753,7 @@ hme_get(struct hme_softc *sc, int ri, ui
 			pktlen = m0->m_pkthdr.len - ETHER_HDR_LEN;
 		} else if (ntohs(eh->ether_type) == ETHERTYPE_VLAN) {
 			evh = (struct ether_vlan_header *)eh;
-			if (ntohs(evh->evl_proto != ETHERTYPE_IP))
+			if (ntohs(evh->evl_proto) != ETHERTYPE_IP)
 goto swcsum;
 			ip = (struct ip *)((char *)eh + ETHER_HDR_LEN +
 			ETHER_VLAN_ENCAP_LEN);



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

2018-05-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  9 15:21:02 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: hme.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #815):

sys/dev/ic/hme.c: revision 1.97

Fix mis-placed right paren.  kern/53271


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.96.2.1 src/sys/dev/ic/hme.c

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



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

2018-04-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Apr  9 13:23:29 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #718):
sys/dev/ic/nvme.c: revision 1.32
- don't leak ccb on alloc failure.
- KASSERT to prevent memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.2 -r1.30.2.3 src/sys/dev/ic/nvme.c

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



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

2018-04-09 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Apr  9 13:23:29 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #718):
sys/dev/ic/nvme.c: revision 1.32
- don't leak ccb on alloc failure.
- KASSERT to prevent memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.30.2.2 -r1.30.2.3 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30.2.2 src/sys/dev/ic/nvme.c:1.30.2.3
--- src/sys/dev/ic/nvme.c:1.30.2.2	Sun Mar 18 11:05:27 2018
+++ src/sys/dev/ic/nvme.c	Mon Apr  9 13:23:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30.2.2 2018/03/18 11:05:27 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.3 2018/04/09 13:23:29 bouyer Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.2 2018/03/18 11:05:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.3 2018/04/09 13:23:29 bouyer Exp $");
 
 #include 
 #include 
@@ -570,8 +570,10 @@ nvme_ns_identify(struct nvme_softc *sc, 
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
 	mem = nvme_dmamem_alloc(sc, sizeof(*identify));
-	if (mem == NULL)
+	if (mem == NULL) {
+		nvme_ccb_put(sc->sc_admin_q, ccb);
 		return ENOMEM;
+	}
 
 	memset(, 0, sizeof(sqe));
 	sqe.opcode = NVM_ADMIN_IDENTIFY;
@@ -601,6 +603,7 @@ nvme_ns_identify(struct nvme_softc *sc, 
 
 	ns = nvme_ns_get(sc, nsid);
 	KASSERT(ns);
+	KASSERT(ns->ident == NULL);
 	ns->ident = identify;
 
 done:



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

2018-03-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 18 11:05:27 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: ld_nvme.c nvme.c nvmevar.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #641):
sys/dev/ic/nvme.c: revision 1.34
sys/dev/ic/nvme.c: revision 1.35
sys/dev/ic/nvme.c: revision 1.36
sys/dev/ic/nvme.c: revision 1.37
sys/dev/ic/ld_nvme.c: revision 1.19
sys/dev/ic/nvmevar.h: revision 1.15

refactor the locking code around DIOCGCACHE handling to be reusable
for other infrequent commands,it uses single condvar for simplicity,
and uses it both when waiting for ccb or command completion - this
is fine, since usually there will be just one such command qeueued anyway
use this to finally properly implement DIOCCACHESYNC - return only after
the command is confirmed as completed by the controller.

switch handling of passthrough commands to use queue, instead of polling
should fix PR kern/53059 by Frank Kardel

fix passthrough command usage also in nvme_get_number_of_queues(), fixes
memory corruption and possible panic on boot

also remove now duplicate nvme_ccb_put() call from
nvme_get_number_of_queues()


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.30.2.1 -r1.30.2.2 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.13.6.1 -r1.13.6.2 src/sys/dev/ic/nvmevar.h

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



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

2018-03-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 18 11:05:27 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: ld_nvme.c nvme.c nvmevar.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #641):
sys/dev/ic/nvme.c: revision 1.34
sys/dev/ic/nvme.c: revision 1.35
sys/dev/ic/nvme.c: revision 1.36
sys/dev/ic/nvme.c: revision 1.37
sys/dev/ic/ld_nvme.c: revision 1.19
sys/dev/ic/nvmevar.h: revision 1.15

refactor the locking code around DIOCGCACHE handling to be reusable
for other infrequent commands,it uses single condvar for simplicity,
and uses it both when waiting for ccb or command completion - this
is fine, since usually there will be just one such command qeueued anyway
use this to finally properly implement DIOCCACHESYNC - return only after
the command is confirmed as completed by the controller.

switch handling of passthrough commands to use queue, instead of polling
should fix PR kern/53059 by Frank Kardel

fix passthrough command usage also in nvme_get_number_of_queues(), fixes
memory corruption and possible panic on boot

also remove now duplicate nvme_ccb_put() call from
nvme_get_number_of_queues()


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/ic/ld_nvme.c
cvs rdiff -u -r1.30.2.1 -r1.30.2.2 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.13.6.1 -r1.13.6.2 src/sys/dev/ic/nvmevar.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/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.16.2.1 src/sys/dev/ic/ld_nvme.c:1.16.2.2
--- src/sys/dev/ic/ld_nvme.c:1.16.2.1	Fri Sep  1 09:59:11 2017
+++ src/sys/dev/ic/ld_nvme.c	Sun Mar 18 11:05:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.16.2.1 2017/09/01 09:59:11 martin Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.16.2.2 2018/03/18 11:05:27 martin Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.1 2017/09/01 09:59:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.16.2.2 2018/03/18 11:05:27 martin Exp $");
 
 #include 
 #include 
@@ -49,14 +49,6 @@ struct ld_nvme_softc {
 	struct nvme_softc	*sc_nvme;
 
 	uint16_t		sc_nsid;
-
-	/* getcache handling */
-	kmutex_t		sc_getcache_lock;
-	kcondvar_t		sc_getcache_cv;
-	kcondvar_t		sc_getcache_ready_cv;
-	bool			sc_getcache_waiting;
-	bool			sc_getcache_ready;
-	int			sc_getcache_result;
 };
 
 static int	ld_nvme_match(device_t, cfdata_t, void *);
@@ -73,8 +65,6 @@ static int	ld_nvme_getcache(struct ld_so
 static int	ld_nvme_ioctl(struct ld_softc *, u_long, void *, int32_t, bool);
 
 static void	ld_nvme_biodone(void *, struct buf *, uint16_t, uint32_t);
-static void	ld_nvme_syncdone(void *, struct buf *, uint16_t, uint32_t);
-static void	ld_nvme_getcache_done(void *, struct buf *, uint16_t, uint32_t);
 
 static int
 ld_nvme_match(device_t parent, cfdata_t match, void *aux)
@@ -103,10 +93,6 @@ ld_nvme_attach(device_t parent, device_t
 	sc->sc_nvme = nsc;
 	sc->sc_nsid = naa->naa_nsid;
 
-	mutex_init(>sc_getcache_lock, MUTEX_DEFAULT, IPL_SOFTBIO);
-	cv_init(>sc_getcache_cv, "nvmegcq");
-	cv_init(>sc_getcache_ready_cv, "nvmegcr");
-
 	aprint_naive("\n");
 	aprint_normal("\n");
 
@@ -203,116 +189,16 @@ ld_nvme_flush(struct ld_softc *ld, bool 
 {
 	struct ld_nvme_softc *sc = device_private(ld->sc_dv);
 
-	if (!nvme_has_volatile_write_cache(sc->sc_nvme)) {
-		/* cache not present, no value in trying to flush it */
-		return 0;
-	}
-
-	return nvme_ns_sync(sc->sc_nvme, sc->sc_nsid, sc,
-	poll ? NVME_NS_CTX_F_POLL : 0,
-	ld_nvme_syncdone);
-}
-
-static void
-ld_nvme_syncdone(void *xc, struct buf *bp, uint16_t cmd_status, uint32_t cdw0)
-{
-	/* nothing to do */
+	return nvme_ns_sync(sc->sc_nvme, sc->sc_nsid,
+	poll ? NVME_NS_CTX_F_POLL : 0);
 }
 
 static int
 ld_nvme_getcache(struct ld_softc *ld, int *addr)
 {
-	int error;
 	struct ld_nvme_softc *sc = device_private(ld->sc_dv);
 
-	/*
-	 * DPO not supported, Dataset Management (DSM) field doesn't specify
-	 * the same semantics.
-	 */ 
-	*addr = DKCACHE_FUA;
-
-	if (!nvme_has_volatile_write_cache(sc->sc_nvme)) {
-		/* cache simply not present */
-		return 0;
-	}
-
-	/*
-	 * This is admin queue request. The queue is relatively limited in size,
-	 * and this is not performance critical call, so have at most one pending
-	 * cache request at a time to avoid spurious EWOULDBLOCK failures.
-	 */ 
-	mutex_enter(>sc_getcache_lock);
-	while (sc->sc_getcache_waiting) {
-		error = cv_wait_sig(>sc_getcache_cv, >sc_getcache_lock);
-		if (error)
-			goto out;
-	}
-	sc->sc_getcache_waiting = true;
-	sc->sc_getcache_ready = false;
-	mutex_exit(>sc_getcache_lock);
-
-	error = nvme_admin_getcache(sc->sc_nvme, sc, ld_nvme_getcache_done);
-	if (error) {
-		mutex_enter(>sc_getcache_lock);
-		goto out;
-	}
-
-	mutex_enter(>sc_getcache_lock);
-	while 

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

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 08:11:18 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c nvmevar.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #636):
sys/dev/ic/nvme.c: revision 1.33
sys/dev/ic/nvmevar.h: revision 1.14
stop using q_nccbs_avail for deciding whether there are available ccbs;
no need to maintain a counter _and_ q_ccb_list
this fixes deadlock when all ccbs happen to be taken before completion
interrupt - nvme_q_complete() increased q_nccbs_avail only after
processing all the completed commands, by then there was nothing
left to actually kick the disk queue again into action
this also fixes ccb leak on command errors e.g. with bus_dmamem_alloc()
or bus_dmamel_load() - q_nccbs_avail was never decreased on the error path
fixes PR kern/52769 by Martin Husemann, thanks to Paul Goyette
for testing


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/dev/ic/nvmevar.h

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



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

2018-03-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Mar 17 08:11:18 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: nvme.c nvmevar.h

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #636):
sys/dev/ic/nvme.c: revision 1.33
sys/dev/ic/nvmevar.h: revision 1.14
stop using q_nccbs_avail for deciding whether there are available ccbs;
no need to maintain a counter _and_ q_ccb_list
this fixes deadlock when all ccbs happen to be taken before completion
interrupt - nvme_q_complete() increased q_nccbs_avail only after
processing all the completed commands, by then there was nothing
left to actually kick the disk queue again into action
this also fixes ccb leak on command errors e.g. with bus_dmamem_alloc()
or bus_dmamel_load() - q_nccbs_avail was never decreased on the error path
fixes PR kern/52769 by Martin Husemann, thanks to Paul Goyette
for testing


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.2.1 src/sys/dev/ic/nvme.c
cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/dev/ic/nvmevar.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.30 src/sys/dev/ic/nvme.c:1.30.2.1
--- src/sys/dev/ic/nvme.c:1.30	Thu Jun  1 02:45:10 2017
+++ src/sys/dev/ic/nvme.c	Sat Mar 17 08:11:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.30 2017/06/01 02:45:10 chs Exp $	*/
+/*	$NetBSD: nvme.c,v 1.30.2.1 2018/03/17 08:11:18 martin Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.30.2.1 2018/03/17 08:11:18 martin Exp $");
 
 #include 
 #include 
@@ -1144,12 +1144,6 @@ nvme_q_complete(struct nvme_softc *sc, s
 
 	mutex_exit(>q_cq_mtx);
 
-	if (rv) {
-		mutex_enter(>q_ccb_mtx);
-		q->q_nccbs_avail += rv;
-		mutex_exit(>q_ccb_mtx);
-	}
-
 	return rv;
 }
 
@@ -1362,7 +1356,6 @@ nvme_ccbs_alloc(struct nvme_queue *q, ui
 	q->q_ccbs = kmem_alloc(sizeof(*ccb) * nccbs, KM_SLEEP);
 
 	q->q_nccbs = nccbs;
-	q->q_nccbs_avail = nccbs;
 	q->q_ccb_prpls = nvme_dmamem_alloc(sc,
 	sizeof(*prpl) * sc->sc_max_sgl * nccbs);
 
@@ -1402,11 +1395,8 @@ nvme_ccb_get(struct nvme_queue *q)
 	struct nvme_ccb *ccb = NULL;
 
 	mutex_enter(>q_ccb_mtx);
-	if (q->q_nccbs_avail > 0) {
-		ccb = SIMPLEQ_FIRST(>q_ccb_list);
-		KASSERT(ccb != NULL);
-		q->q_nccbs_avail--;
-
+	ccb = SIMPLEQ_FIRST(>q_ccb_list);
+	if (ccb != NULL) {
 		SIMPLEQ_REMOVE_HEAD(>q_ccb_list, ccb_entry);
 #ifdef DEBUG
 		ccb->ccb_cookie = NULL;

Index: src/sys/dev/ic/nvmevar.h
diff -u src/sys/dev/ic/nvmevar.h:1.13 src/sys/dev/ic/nvmevar.h:1.13.6.1
--- src/sys/dev/ic/nvmevar.h:1.13	Wed Apr  5 20:15:49 2017
+++ src/sys/dev/ic/nvmevar.h	Sat Mar 17 08:11:18 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmevar.h,v 1.13 2017/04/05 20:15:49 jdolecek Exp $	*/
+/*	$NetBSD: nvmevar.h,v 1.13.6.1 2018/03/17 08:11:18 martin Exp $	*/
 /*	$OpenBSD: nvmevar.h,v 1.8 2016/04/14 11:18:32 dlg Exp $ */
 
 /*
@@ -88,7 +88,6 @@ struct nvme_queue {
 
 	kmutex_t		q_ccb_mtx;
 	uint16_t		q_nccbs;	/* total number of ccbs */
-	uint16_t		q_nccbs_avail;	/* available ccbs */
 	struct nvme_ccb		*q_ccbs;
 	SIMPLEQ_HEAD(, nvme_ccb) q_ccb_list;
 	struct nvme_dmamem	*q_ccb_prpls;



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

2018-01-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan 13 04:44:29 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: dwc_gmac.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #456):
sys/dev/ic/dwc_gmac.c: 1.45
Don't KASSERT that we are MPSAFE if ! DWCGMAC_MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.40.6.2 -r1.40.6.3 src/sys/dev/ic/dwc_gmac.c

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



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

2018-01-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan 13 04:44:29 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-8]: dwc_gmac.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #456):
sys/dev/ic/dwc_gmac.c: 1.45
Don't KASSERT that we are MPSAFE if ! DWCGMAC_MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.40.6.2 -r1.40.6.3 src/sys/dev/ic/dwc_gmac.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/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.40.6.2 src/sys/dev/ic/dwc_gmac.c:1.40.6.3
--- src/sys/dev/ic/dwc_gmac.c:1.40.6.2	Tue Jan  2 10:20:32 2018
+++ src/sys/dev/ic/dwc_gmac.c	Sat Jan 13 04:44:29 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.40.6.2 2018/01/02 10:20:32 snj Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.40.6.3 2018/01/13 04:44:29 snj Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40.6.2 2018/01/02 10:20:32 snj Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40.6.3 2018/01/13 04:44:29 snj Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -838,7 +838,9 @@ static void
 dwc_gmac_start(struct ifnet *ifp)
 {
 	struct dwc_gmac_softc *sc = ifp->if_softc;
+#ifdef DWCGMAC_MPSAFE
 	KASSERT(if_is_mpsafe(ifp));
+#endif
 
 	mutex_enter(sc->sc_lock);
 	if (!sc->sc_stopping) {



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

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:33:23 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #369):
sys/dev/ic/spdmem.c: revision 1.25
sys/dev/ic/spdmem.c: revision 1.26
sys/dev/ic/spdmem.c: revision 1.27
sys/dev/ic/spdmem.c: revision 1.28
  A part number field of DDR3 and DDR4 is not NUL terminated. All unused chars
are filled by 0x20. Print it correctly.
Before:
spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1 E1M^@,DPAFEQZ021
spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9BA^AM^X
spdmem2 at iic0 addr 0x52: KP223C-ELDBA^BM-~
After:
spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1
spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9
spdmem2 at iic0 addr 0x52: KP223C-ELD
dedup
simplify previous.
  Print "ECC" or "no ECC" for DDR4.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.6.1 src/sys/dev/ic/spdmem.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/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.24 src/sys/dev/ic/spdmem.c:1.24.6.1
--- src/sys/dev/ic/spdmem.c:1.24	Wed Jan 18 06:02:50 2017
+++ src/sys/dev/ic/spdmem.c	Wed Nov 22 14:33:23 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.24 2017/01/18 06:02:50 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.24.6.1 2017/11/22 14:33:23 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24 2017/01/18 06:02:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.1 2017/11/22 14:33:23 martin Exp $");
 
 #include 
 #include 
@@ -748,12 +748,21 @@ decode_ddr2(const struct sysctlnode *nod
 }
 
 static void
+print_part(const char *part, size_t pnsize)
+{
+	const char *p = memchr(part, ' ', pnsize);
+	if (p == NULL)
+		p = part + pnsize;
+	aprint_normal(": %.*s\n", (int)(p - part), part);
+}
+
+static void
 decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
 	int dimm_size, cycle_time, bits;
 
 	aprint_naive("\n");
-	aprint_normal(": %18s\n", s->sm_ddr3.ddr3_part);
+	print_part(s->sm_ddr3.ddr3_part, sizeof(s->sm_ddr3.ddr3_part));
 	aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]);
 
 	if (s->sm_ddr3.ddr3_mod_type ==
@@ -864,13 +873,15 @@ decode_ddr4(const struct sysctlnode *nod
 	int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks;
 
 	aprint_naive("\n");
-	aprint_normal(": %20s\n", s->sm_ddr4.ddr4_part_number);
+	print_part(s->sm_ddr4.ddr4_part_number,
+	sizeof(s->sm_ddr4.ddr4_part_number));
 	aprint_normal_dev(self, "%s", spdmem_basic_types[s->sm_type]);
 	if (s->sm_ddr4.ddr4_mod_type < __arraycount(spdmem_ddr4_module_types))
 		aprint_normal(" (%s)", 
 		spdmem_ddr4_module_types[s->sm_ddr4.ddr4_mod_type]);
-	aprint_normal(", %stemp-sensor, ",
-		(s->sm_ddr4.ddr4_has_therm_sensor)?"":"no ");
+	aprint_normal(", %sECC, %stemp-sensor, ",
+		(s->sm_ddr4.ddr4_bus_width_extension) ? "" : "no ",
+		(s->sm_ddr4.ddr4_has_therm_sensor) ? "" : "no ");
 
 	/*
 	 * DDR4 size calculation from JEDEC spec



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

2017-11-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 22 14:33:23 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #369):
sys/dev/ic/spdmem.c: revision 1.25
sys/dev/ic/spdmem.c: revision 1.26
sys/dev/ic/spdmem.c: revision 1.27
sys/dev/ic/spdmem.c: revision 1.28
  A part number field of DDR3 and DDR4 is not NUL terminated. All unused chars
are filled by 0x20. Print it correctly.
Before:
spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1 E1M^@,DPAFEQZ021
spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9BA^AM^X
spdmem2 at iic0 addr 0x52: KP223C-ELDBA^BM-~
After:
spdmem0 at iic0 addr 0x50: 8KTF51264AZ-1G6E1
spdmem1 at iic0 addr 0x51: ACR256X64D3U1333C9
spdmem2 at iic0 addr 0x52: KP223C-ELD
dedup
simplify previous.
  Print "ECC" or "no ECC" for DDR4.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.6.1 src/sys/dev/ic/spdmem.c

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



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

2017-08-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 05:18:26 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: ciss.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #196):
sys/dev/ic/ciss.c: revision 1.37
Reject negative indices from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.10.1 src/sys/dev/ic/ciss.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/ciss.c
diff -u src/sys/dev/ic/ciss.c:1.36 src/sys/dev/ic/ciss.c:1.36.10.1
--- src/sys/dev/ic/ciss.c:1.36	Thu Jul 14 04:00:45 2016
+++ src/sys/dev/ic/ciss.c	Wed Aug  9 05:18:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.36 2016/07/14 04:00:45 msaitoh Exp $	*/
+/*	$NetBSD: ciss.c,v 1.36.10.1 2017/08/09 05:18:26 snj Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.68 2013/05/30 16:15:02 deraadt Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.36 2016/07/14 04:00:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.36.10.1 2017/08/09 05:18:26 snj Exp $");
 
 #include "bio.h"
 
@@ -1299,12 +1299,12 @@ ciss_ioctl(device_t dev, u_long cmd, voi
 		/* FALLTHROUGH */
 	case BIOCDISK:
 		bd = (struct bioc_disk *)addr;
-		if (bd->bd_volid > sc->maxunits) {
+		if (bd->bd_volid < 0 || bd->bd_volid > sc->maxunits) {
 			error = EINVAL;
 			break;
 		}
 		ldp = sc->sc_lds[0];
-		if (!ldp || (pd = bd->bd_diskid) > ldp->ndrives) {
+		if (!ldp || (pd = bd->bd_diskid) < 0 || pd > ldp->ndrives) {
 			error = EINVAL;
 			break;
 		}
@@ -1405,7 +1405,7 @@ ciss_ioctl_vol(struct ciss_softc *sc, st
 	int error = 0;
 	u_int blks;
 
-	if (bv->bv_volid > sc->maxunits) {
+	if (bv->bv_volid < 0 || bv->bv_volid > sc->maxunits) {
 		return EINVAL;
 	}
 	ldp = sc->sc_lds[bv->bv_volid];



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

2017-08-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 05:18:26 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: ciss.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #196):
sys/dev/ic/ciss.c: revision 1.37
Reject negative indices from userland.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.10.1 src/sys/dev/ic/ciss.c

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



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

2017-08-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 05:17:03 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: isp_netbsd.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #195):
sys/dev/ic/isp_netbsd.c: revision 1.89
Reject out-of-bounds channel index.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.88.10.1 src/sys/dev/ic/isp_netbsd.c

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



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

2017-08-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 05:17:03 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: isp_netbsd.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #195):
sys/dev/ic/isp_netbsd.c: revision 1.89
Reject out-of-bounds channel index.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.88.10.1 src/sys/dev/ic/isp_netbsd.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/isp_netbsd.c
diff -u src/sys/dev/ic/isp_netbsd.c:1.88 src/sys/dev/ic/isp_netbsd.c:1.88.10.1
--- src/sys/dev/ic/isp_netbsd.c:1.88	Wed Dec 31 17:10:45 2014
+++ src/sys/dev/ic/isp_netbsd.c	Wed Aug  9 05:17:03 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.88 2014/12/31 17:10:45 christos Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.88.10.1 2017/08/09 05:17:03 snj Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.88 2014/12/31 17:10:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.88.10.1 2017/08/09 05:17:03 snj Exp $");
 
 #include 
 #include 
@@ -475,6 +475,10 @@ ispioctl(struct scsipi_channel *chan, u_
 		}
 		lim = local.count;
 		channel = local.channel;
+		if (channel >= isp->isp_nchan) {
+			retval = EINVAL;
+			break;
+		}
 
 		ua = *(isp_dlist_t **)addr;
 		uptr = >wwns[0];



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 05:06:48 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: bwi.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #187):
sys/dev/ic/bwi.c: revision 1.32
Check for M_EXT in m->m_flags, whether m is NULL, after MCLGET.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.6.1 src/sys/dev/ic/bwi.c

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



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 05:06:48 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: bwi.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #187):
sys/dev/ic/bwi.c: revision 1.32
Check for M_EXT in m->m_flags, whether m is NULL, after MCLGET.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.6.1 src/sys/dev/ic/bwi.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/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.31 src/sys/dev/ic/bwi.c:1.31.6.1
--- src/sys/dev/ic/bwi.c:1.31	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/ic/bwi.c	Sat Aug  5 05:06:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.31 2017/02/02 10:05:35 nonaka Exp $	*/
+/*	$NetBSD: bwi.c,v 1.31.6.1 2017/08/05 05:06:48 snj Exp $	*/
 /*	$OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $	*/
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.31 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.31.6.1 2017/08/05 05:06:48 snj Exp $");
 
 #include 
 #include 
@@ -8328,7 +8328,7 @@ bwi_newbuf(struct bwi_softc *sc, int buf
 	if (m == NULL)
 		return (ENOBUFS);
 	MCLGET(m, init ? M_WAITOK : M_DONTWAIT);
-	if (m == NULL) {
+	if ((m->m_flags & M_EXT) == 0) {
 		error = ENOBUFS;
 
 		/*



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:53:35 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dm9000.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #186):
sys/dev/ic/dm9000.c: revision 1.12
Check for MCLGET failure in dme_alloc_receive_buffer.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/dev/ic/dm9000.c

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



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:53:35 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dm9000.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #186):
sys/dev/ic/dm9000.c: revision 1.12
Check for MCLGET failure in dme_alloc_receive_buffer.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/dev/ic/dm9000.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/dm9000.c
diff -u src/sys/dev/ic/dm9000.c:1.11 src/sys/dev/ic/dm9000.c:1.11.8.1
--- src/sys/dev/ic/dm9000.c:1.11	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/ic/dm9000.c	Sat Aug  5 04:53:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.11 2016/12/15 09:28:05 ozaki-r Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.11.8.1 2017/08/05 04:53:34 snj Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -1226,8 +1226,13 @@ dme_alloc_receive_buffer(struct ifnet *i
 		sizeof(struct ether_header);
 	/* All our frames have the CRC attached */
 	m->m_flags |= M_HASFCS;
-	if (m->m_pkthdr.len + pad > MHLEN )
+	if (m->m_pkthdr.len + pad > MHLEN) {
 		MCLGET(m, M_DONTWAIT);
+		if ((m->m_flags & M_EXT) == 0) {
+			m_freem(m);
+			return NULL;
+		}
+	}
 
 	m->m_data += pad;
 	m->m_len = frame_length + (frame_length % sc->sc_data_width);



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:45:30 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dp83932.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #185):
sys/dev/ic/dp83932.c: revision 1.41
Plug mbuf leak on MCLGET failure in sonic_rxintr.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/ic/dp83932.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/dp83932.c
diff -u src/sys/dev/ic/dp83932.c:1.40 src/sys/dev/ic/dp83932.c:1.40.2.1
--- src/sys/dev/ic/dp83932.c:1.40	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/dp83932.c	Sat Aug  5 04:45:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp83932.c,v 1.40 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: dp83932.c,v 1.40.2.1 2017/08/05 04:45:30 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.40 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.40.2.1 2017/08/05 04:45:30 snj Exp $");
 
 
 #include 
@@ -786,8 +786,10 @@ sonic_rxintr(struct sonic_softc *sc)
 goto dropit;
 			if (len > (MHLEN - 2)) {
 MCLGET(m, M_DONTWAIT);
-if ((m->m_flags & M_EXT) == 0)
+if ((m->m_flags & M_EXT) == 0) {
+	m_freem(m);
 	goto dropit;
+}
 			}
 			m->m_data += 2;
 			/*



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:45:30 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dp83932.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #185):
sys/dev/ic/dp83932.c: revision 1.41
Plug mbuf leak on MCLGET failure in sonic_rxintr.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/ic/dp83932.c

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



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:39:29 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: i82596.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #184):
sys/dev/ic/i82596.c: revision 1.37
Null out sc_rx_mbuf[i] after m_freem to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sc_tx_mbuf[i] after m_freem, out of paranoia.
XXX Not entirely clear to how tx mbufs are freed, but no way to test
this since it's ews4800mips- and hp700-only, so not keen to make any
more elaborate changes...


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.6.1 src/sys/dev/ic/i82596.c

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



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

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:39:29 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: i82596.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #184):
sys/dev/ic/i82596.c: revision 1.37
Null out sc_rx_mbuf[i] after m_freem to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sc_tx_mbuf[i] after m_freem, out of paranoia.
XXX Not entirely clear to how tx mbufs are freed, but no way to test
this since it's ews4800mips- and hp700-only, so not keen to make any
more elaborate changes...


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.6.1 src/sys/dev/ic/i82596.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/i82596.c
diff -u src/sys/dev/ic/i82596.c:1.36 src/sys/dev/ic/i82596.c:1.36.6.1
--- src/sys/dev/ic/i82596.c:1.36	Mon Feb 20 07:43:29 2017
+++ src/sys/dev/ic/i82596.c	Sat Aug  5 04:39:29 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.36 2017/02/20 07:43:29 ozaki-r Exp $ */
+/* $NetBSD: i82596.c,v 1.36.6.1 2017/08/05 04:39:29 snj Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.36 2017/02/20 07:43:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.36.6.1 2017/08/05 04:39:29 snj Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -753,6 +753,7 @@ iee_start(struct ifnet *ifp)
 printf("%s: iee_start: can't allocate mbuf\n",
 device_xname(sc->sc_dev));
 m_freem(sc->sc_tx_mbuf[t]);
+sc->sc_tx_mbuf[t] = NULL;
 t--;
 continue;
 			}
@@ -762,6 +763,7 @@ iee_start(struct ifnet *ifp)
 printf("%s: iee_start: can't allocate mbuf "
 "cluster\n", device_xname(sc->sc_dev));
 m_freem(sc->sc_tx_mbuf[t]);
+sc->sc_tx_mbuf[t] = NULL;
 m_freem(m);
 t--;
 continue;
@@ -777,6 +779,7 @@ iee_start(struct ifnet *ifp)
 printf("%s: iee_start: can't load TX DMA map\n",
 device_xname(sc->sc_dev));
 m_freem(sc->sc_tx_mbuf[t]);
+sc->sc_tx_mbuf[t] = NULL;
 t--;
 continue;
 			}
@@ -926,6 +929,7 @@ iee_init(struct ifnet *ifp)
 printf("%s: iee_init: can't allocate mbuf"
 " cluster\n", device_xname(sc->sc_dev));
 m_freem(sc->sc_rx_mbuf[r]);
+sc->sc_rx_mbuf[r] = NULL;
 err = 1;
 break;
 			}
@@ -939,6 +943,7 @@ iee_init(struct ifnet *ifp)
 printf("%s: iee_init: can't create RX "
 "DMA map\n", device_xname(sc->sc_dev));
 m_freem(sc->sc_rx_mbuf[r]);
+sc->sc_rx_mbuf[r] = NULL;
 err = 1;
 break;
 			}
@@ -948,6 +953,7 @@ iee_init(struct ifnet *ifp)
 			device_xname(sc->sc_dev));
 			bus_dmamap_destroy(sc->sc_dmat, sc->sc_rx_map[r]);
 			m_freem(sc->sc_rx_mbuf[r]);
+			sc->sc_rx_mbuf[r] = NULL;
 			err = 1;
 			break;
 		}



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

2017-07-24 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jul 25 02:08:31 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: rt2860.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #150):
sys/dev/ic/rt2860.c: revision 1.27
Use kmem_free for kmem_alloc'd memory
Fixes diagnostic crash on detach, tested by Riccardo Mottola


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/dev/ic/rt2860.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/rt2860.c
diff -u src/sys/dev/ic/rt2860.c:1.26 src/sys/dev/ic/rt2860.c:1.26.2.1
--- src/sys/dev/ic/rt2860.c:1.26	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/rt2860.c	Tue Jul 25 02:08:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rt2860.c,v 1.26 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: rt2860.c,v 1.26.2.1 2017/07/25 02:08:31 snj Exp $	*/
 /*	$OpenBSD: rt2860.c,v 1.90 2016/04/13 10:49:26 mpi Exp $	*/
 /*	$FreeBSD: head/sys/dev/ral/rt2860.c 306591 2016-10-02 20:35:55Z avos $ */
 
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.26 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rt2860.c,v 1.26.2.1 2017/07/25 02:08:31 snj Exp $");
 
 #include 
 #include 
@@ -466,7 +466,7 @@ rt2860_detach(void *xsc)
 	}
 
 	if (sc->ucode != NULL)
-		free(sc->ucode, M_DEVBUF);
+		firmware_free(sc->ucode, sc->ucsize);
 
 	return 0;
 }



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

2017-07-24 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jul 25 02:08:31 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: rt2860.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #150):
sys/dev/ic/rt2860.c: revision 1.27
Use kmem_free for kmem_alloc'd memory
Fixes diagnostic crash on detach, tested by Riccardo Mottola


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/dev/ic/rt2860.c

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



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

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:32:21 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: am7930.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #68):
sys/dev/ic/am7930.c: revision 1.54
sys/dev/ic/am7930.c: revision 1.55
rfill and pfill mixed up.
--
Set hw parameters for linear to ulaw filters.
Tested by flxd@.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.8.1 src/sys/dev/ic/am7930.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/am7930.c
diff -u src/sys/dev/ic/am7930.c:1.53 src/sys/dev/ic/am7930.c:1.53.8.1
--- src/sys/dev/ic/am7930.c:1.53	Wed Dec 28 10:04:53 2016
+++ src/sys/dev/ic/am7930.c	Fri Jun 30 06:32:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: am7930.c,v 1.53 2016/12/28 10:04:53 nat Exp $	*/
+/*	$NetBSD: am7930.c,v 1.53.8.1 2017/06/30 06:32:21 snj Exp $	*/
 
 /*
  * Copyright (c) 1995 Rolf Grossmann
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.53 2016/12/28 10:04:53 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.53.8.1 2017/06/30 06:32:21 snj Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -242,6 +242,12 @@ am7930_set_params(void *addr, int setmod
 			hw.precision *= sc->sc_glue->factor;
 			pfil->append(pfil, sc->sc_glue->output_conv, );
 		}
+		if (p->encoding == AUDIO_ENCODING_SLINEAR) {
+			hw = *p;
+			hw.encoding = AUDIO_ENCODING_ULAW;
+			pfil->append(pfil, linear8_to_mulaw, );
+		}
+
 	}
 	if ((usemode & AUMODE_RECORD) == AUMODE_RECORD) {
 		if (r->sample_rate < 7500 || r->sample_rate > 8500 ||
@@ -257,14 +263,11 @@ am7930_set_params(void *addr, int setmod
 			hw.precision *= sc->sc_glue->factor;
 			pfil->append(rfil, sc->sc_glue->input_conv, );
 		}
-	}
-
-	if (p->encoding == AUDIO_ENCODING_SLINEAR ||
-	r->encoding == AUDIO_ENCODING_SLINEAR) {
-		hw.encoding = AUDIO_ENCODING_ULAW;
-		pfil->req_size = rfil->req_size = 0;
-		pfil->append(rfil, mulaw_to_linear8, );
-		rfil->append(pfil, linear8_to_mulaw, );
+		if (r->encoding == AUDIO_ENCODING_SLINEAR) {
+			hw = *r;
+			hw.encoding = AUDIO_ENCODING_ULAW;
+			rfil->append(rfil, mulaw_to_linear8, );
+		}
 	}
 
 	return 0;



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

2017-06-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jun 30 06:32:21 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: am7930.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #68):
sys/dev/ic/am7930.c: revision 1.54
sys/dev/ic/am7930.c: revision 1.55
rfill and pfill mixed up.
--
Set hw parameters for linear to ulaw filters.
Tested by flxd@.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.8.1 src/sys/dev/ic/am7930.c

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