CVS commit: [netbsd-7] src/sys/dev/usb

2020-06-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Jun 16 10:34:49 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-7]: if_run.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1735):
sys/dev/usb/if_run.c: revision 1.41
Better bounds checking for oversized packets, to avoid kernel memory
corruption. Pointed out by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.10.4.4 -r1.10.4.5 src/sys/dev/usb/if_run.c

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

Modified files:

Index: src/sys/dev/usb/if_run.c
diff -u src/sys/dev/usb/if_run.c:1.10.4.4 src/sys/dev/usb/if_run.c:1.10.4.5
--- src/sys/dev/usb/if_run.c:1.10.4.4	Wed Aug  8 10:17:11 2018
+++ src/sys/dev/usb/if_run.c	Tue Jun 16 10:34:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_run.c,v 1.10.4.4 2018/08/08 10:17:11 martin Exp $	*/
+/*	$NetBSD: if_run.c,v 1.10.4.5 2020/06/16 10:34:49 bouyer Exp $	*/
 /*	$OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.10.4.4 2018/08/08 10:17:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.10.4.5 2020/06/16 10:34:49 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2067,7 +2067,8 @@ run_rx_frame(struct run_softc *sc, uint8
 		return;
 	}
 	if (len > MHLEN) {
-		MCLGET(m, M_DONTWAIT);
+		if (__predict_true(len <= MCLBYTES))
+			MCLGET(m, M_DONTWAIT);
 		if (__predict_false(!(m->m_flags & M_EXT))) {
 			ifp->if_ierrors++;
 			m_freem(m);



CVS commit: [netbsd-7] src/sys/dev/usb

2020-06-16 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Jun 16 10:33:38 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-7]: if_otus.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1734):
sys/dev/usb/if_otus.c: revision 1.45 via patch
Stricter bounds check for some packet length we get from the usb chip,
to make sure we do not corrupt kernel memory.
Pointed out by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25.4.3 -r1.25.4.4 src/sys/dev/usb/if_otus.c

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

Modified files:

Index: src/sys/dev/usb/if_otus.c
diff -u src/sys/dev/usb/if_otus.c:1.25.4.3 src/sys/dev/usb/if_otus.c:1.25.4.4
--- src/sys/dev/usb/if_otus.c:1.25.4.3	Wed Aug  8 10:17:11 2018
+++ src/sys/dev/usb/if_otus.c	Tue Jun 16 10:33:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_otus.c,v 1.25.4.3 2018/08/08 10:17:11 martin Exp $	*/
+/*	$NetBSD: if_otus.c,v 1.25.4.4 2020/06/16 10:33:38 bouyer Exp $	*/
 /*	$OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.4.3 2018/08/08 10:17:11 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.4.4 2020/06/16 10:33:38 bouyer Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1750,6 +1750,10 @@ otus_sub_rxeof(struct otus_softc *sc, ui
 	}
 	/* Compute MPDU's length. */
 	mlen = len - AR_PLCP_HDR_LEN - sizeof(*tail);
+	if (__predict_false(mlen < IEEE80211_CRC_LEN)) {
+		ifp->if_ierrors++;
+		return;
+	}
 	mlen -= IEEE80211_CRC_LEN;	/* strip 802.11 FCS */
 	/* Make sure there's room for an 802.11 header. */
 	/*
@@ -1770,7 +1774,8 @@ otus_sub_rxeof(struct otus_softc *sc, ui
 		return;
 	}
 	if (align + mlen > MHLEN) {
-		MCLGET(m, M_DONTWAIT);
+		if (__predict_true(align + mlen <= MCLBYTES))
+			MCLGET(m, M_DONTWAIT);
 		if (__predict_false(!(m->m_flags & M_EXT))) {
 			ifp->if_ierrors++;
 			m_freem(m);



CVS commit: [netbsd-7] src/sys/dev/sysmon

2020-06-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jun  7 16:43:40 UTC 2020

Modified Files:
src/sys/dev/sysmon [netbsd-7]: sysmon_envsys.c

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

sys/dev/sysmon/sysmon_envsys.c: revision 1.145

Don't queue sysmon refresh until the rndsource is attached.

Using the rndsource, as refreshing the sensors will do, is not
allowed until _after_ rnd_source_attach.

XXX pullup-7
XXX pullup-8
XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.127.2.3 -r1.127.2.4 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.3 src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.4
--- src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.3	Tue Oct 24 09:25:26 2017
+++ src/sys/dev/sysmon/sysmon_envsys.c	Sun Jun  7 16:43:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.127.2.3 2017/10/24 09:25:26 snj Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.127.2.4 2020/06/07 16:43:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.3 2017/10/24 09:25:26 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.4 2020/06/07 16:43:40 martin Exp $");
 
 #include 
 #include 
@@ -765,16 +765,6 @@ out:
 		nevent = 0;
 		sysmon_task_queue_init();
 
-		if (sme->sme_flags & SME_INIT_REFRESH) {
-			sysmon_task_queue_sched(0, sme_initial_refresh, sme);
-			DPRINTF(("%s: scheduled initial refresh for '%s'\n",
-__func__, sme->sme_name));
-		}
-		SLIST_FOREACH(evdv, _evdrv_list, evdrv_head) {
-			sysmon_task_queue_sched(0,
-			sme_event_drvadd, evdv->evdrv);
-			nevent++;
-		}
 		/*
 		 * Hook the sensor into rnd(4) entropy pool if requested
 		 */
@@ -830,6 +820,17 @@ out:
 rnd_type, rnd_flag);
 			}
 		}
+
+		if (sme->sme_flags & SME_INIT_REFRESH) {
+			sysmon_task_queue_sched(0, sme_initial_refresh, sme);
+			DPRINTF(("%s: scheduled initial refresh for '%s'\n",
+__func__, sme->sme_name));
+		}
+		SLIST_FOREACH(evdv, _evdrv_list, evdrv_head) {
+			sysmon_task_queue_sched(0,
+			sme_event_drvadd, evdv->evdrv);
+			nevent++;
+		}
 		DPRINTF(("%s: driver '%s' registered (nsens=%d nevent=%d)\n",
 		__func__, sme->sme_name, sme->sme_nsensors, nevent));
 	}



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

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

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

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

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.12.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.12.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:15:34 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.12.1 2020/03/08 09:15:34 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.12.1 2020/03/08 09:15:34 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-7] src/sys/dev/ic

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

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

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

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.116 -r1.116.4.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.116 src/sys/dev/ic/ath.c:1.116.4.1
--- src/sys/dev/ic/ath.c:1.116	Thu Sep 12 12:17:53 2013
+++ src/sys/dev/ic/ath.c	Tue Dec 17 16:32:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ath.c,v 1.116 2013/09/12 12:17:53 martin Exp $	*/
+/*	$NetBSD: ath.c,v 1.116.4.1 2019/12/17 16:32:51 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.116 2013/09/12 12:17:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.116.4.1 2019/12/17 16:32:51 martin Exp $");
 #endif
 
 /*
@@ -69,6 +69,7 @@ __KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.11
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -5362,6 +5363,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-7] src/sys/dev

2019-12-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  8 10:25:38 UTC 2019

Modified Files:
src/sys/dev [netbsd-7]: cons.c

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

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.


To generate a diff of this commit:
cvs rdiff -u -r1.72.2.1 -r1.72.2.2 src/sys/dev/cons.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/cons.c
diff -u src/sys/dev/cons.c:1.72.2.1 src/sys/dev/cons.c:1.72.2.2
--- src/sys/dev/cons.c:1.72.2.1	Mon Mar  9 08:00:46 2015
+++ src/sys/dev/cons.c	Sun Dec  8 10:25:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $	*/
+/*	$NetBSD: cons.c,v 1.72.2.2 2019/12/08 10:25:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.1 2015/03/09 08:00:46 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cons.c,v 1.72.2.2 2019/12/08 10:25:38 martin Exp $");
 
 #include 
 #include 
@@ -150,6 +150,7 @@ cnclose(dev_t dev, int flag, int mode, s
 	if (error == 0) {
 		error = VOP_CLOSE(vp, flag, kauth_cred_get());
 		VOP_UNLOCK(vp);
+		vrele(vp);
 	}
 	return error;
 }



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

2019-05-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed May  1 09:47:05 UTC 2019

Added Files:
src/sys/dev [netbsd-7]: veriexec.config

Log Message:
Pull up following revision(s), via patch as options
differ on the branch (requested by sevan in ticket #1691):

sys/dev/veriexec.config: revision 1.1

Add a configuration file for enabling Veriexec in kernel config(5) files.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.4.2 src/sys/dev/veriexec.config

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

Added files:

Index: src/sys/dev/veriexec.config
diff -u /dev/null src/sys/dev/veriexec.config:1.1.4.2
--- /dev/null	Wed May  1 09:47:05 2019
+++ src/sys/dev/veriexec.config	Wed May  1 09:47:05 2019
@@ -0,0 +1,21 @@
+# $NetBSD: veriexec.config,v 1.1.4.2 2019/05/01 09:47:05 martin Exp $
+#
+# This file contains all Veriexec related configuration.
+# It is suitable for inclusion in a kernel config(5) file.
+#
+
+options 	FILEASSOC		# fileassoc(9) - needed by Veriexec
+	# and PAX_SEGVGUARD
+
+# a pseudo device needed for veriexec
+pseudo-device	veriexec
+#
+# Note that removing fingerprint methods will have almost no impact on the
+# kernel code size.
+#
+options VERIFIED_EXEC_FP_MD5
+options VERIFIED_EXEC_FP_RMD160
+options VERIFIED_EXEC_FP_SHA1
+options VERIFIED_EXEC_FP_SHA256
+options VERIFIED_EXEC_FP_SHA384
+options VERIFIED_EXEC_FP_SHA512



CVS commit: [netbsd-7] src/sys/dev/scsipi

2019-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar  7 16:49:10 UTC 2019

Modified Files:
src/sys/dev/scsipi [netbsd-7]: files.scsipi st.c

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

sys/dev/scsipi/st.c: revision 1.236 (patch)
sys/dev/scsipi/st.c: revision 1.237
sys/dev/scsipi/files.scsipi: revision 1.42

Fix PR kern/53949:
Fix inconsistent/incomplete file mark handling to conform again
to mtio(4) at close(2) time. This was necessary as the PREVENT/ALLOW
bracket was reduced from a whole mount session to cover only the
open(2)/close(2) time on ~2002-03-22. The rationale was to allow
robots and humans to change the media during a mount session.

Unfortunately this lead to file marks being written to potentially other
media at the beginning on drives that used the two file marks as EOM
pattern. In order for that to happen the media had to be removed after
data and at most one file mark had been written before removal.

The mount error message has been clarified and a warning about
potential data/file mark lossage on UNIT ATTENTION
during an active mount session with unfinished file marks has been
added.

While there, fix, but disable the commented SUN compatibility to write
final file marks by opening and immediately closing the device
in O_WRONLY mode. That code has not been working since around 1998.

It can now be enabled with options ST_SUNCOMPAT.

Additionally debug output coverage has been extended.

Correct printing type of b_blkno (int64_t) in st.c

Fixes build with kUBSan on NetBSD/i386.

Fix, but disable the commented SUN compatibility in st.c to write
final file marks by opening and immediately closing the device
in O_WRONLY mode. That code has not been working since around 1998.
It can now be enabled with options ST_SUNCOMPAT.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.41.138.1 src/sys/dev/scsipi/files.scsipi
cvs rdiff -u -r1.226 -r1.226.2.1 src/sys/dev/scsipi/st.c

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

Modified files:

Index: src/sys/dev/scsipi/files.scsipi
diff -u src/sys/dev/scsipi/files.scsipi:1.41 src/sys/dev/scsipi/files.scsipi:1.41.138.1
--- src/sys/dev/scsipi/files.scsipi:1.41	Sun Dec 11 12:23:50 2005
+++ src/sys/dev/scsipi/files.scsipi	Thu Mar  7 16:49:10 2019
@@ -1,11 +1,12 @@
-#	$NetBSD: files.scsipi,v 1.41 2005/12/11 12:23:50 christos Exp $
+#	$NetBSD: files.scsipi,v 1.41.138.1 2019/03/07 16:49:10 martin Exp $
 #
 # Config file and device description for machine-independent SCSI code.
 # Included by ports that need it.  Ports that use it must provide
 # their own "major" declarations for the appropriate devices.
 
 defflag	opt_scsi.h		SCSIVERBOSE ST_ENABLE_EARLYWARN
-SES_ENABLE_PASSTHROUGH SCSI_OLD_NOINQUIRY
+ST_SUNCOMPAT SES_ENABLE_PASSTHROUGH
+SCSI_OLD_NOINQUIRY
 defparam opt_scsi.h		ST_MOUNT_DELAY SDRETRIES SD_IO_TIMEOUT
 
 defflag	opt_scsipi_debug.h	SCSIPI_DEBUG

Index: src/sys/dev/scsipi/st.c
diff -u src/sys/dev/scsipi/st.c:1.226 src/sys/dev/scsipi/st.c:1.226.2.1
--- src/sys/dev/scsipi/st.c:1.226	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/scsipi/st.c	Thu Mar  7 16:49:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: st.c,v 1.226 2014/08/10 16:44:36 tls Exp $ */
+/*	$NetBSD: st.c,v 1.226.2.1 2019/03/07 16:49:10 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.226 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.226.2.1 2019/03/07 16:49:10 martin Exp $");
 
 #include "opt_scsi.h"
 
@@ -605,6 +605,30 @@ stopen(dev_t dev, int flags, int mode, s
 		 */
 		if ((st->flags & ST_MOUNTED) || ST_MOUNT_DELAY == 0 ||
 		(st->mt_key != SKEY_NOT_READY)) {
+			device_printf(st->sc_dev,
+  "mount error (sense key=%d) - "
+  "terminating mount session\n",
+  st->mt_key);
+			/*
+			 * the following should not trigger unless
+			 * something serious happened while the device
+			 * was open (PREVENT MEDIUM REMOVAL in effect)
+			 */
+			if (st->flags & ST_WRITTEN &&
+			st->mt_key == SKEY_UNIT_ATTENTION) {
+/*
+ * device / media state may have changed
+ * refrain from writing missing file marks
+ * onto potentially newly inserted/formatted
+ * media (e. g. emergency EJECT/RESET/etc.)
+ */
+st->flags &= ~(ST_WRITTEN|ST_FM_WRITTEN);
+
+device_printf(st->sc_dev,
+"CAUTION: file marks/data may be missing"
+" - ASC = 0x%02x, ASCQ = 0x%02x\n",
+	  st->asc, st->ascq);
+			}
 			goto bad;
 		}
 
@@ -713,15 +737,30 @@ stclose(dev_t dev, int flags, int mode, 
 	 */
 
 	stxx = st->flags & (ST_WRITTEN | ST_FM_WRITTEN);
-	if (((flags & FWRITE) && stxx == ST_WRITTEN) ||
-	((flags & O_ACCMODE) == FWRITE && stxx == 0)) {
-		int nm;
+	if ((flags & FWRITE) != 0) {
+		int nm 

CVS commit: [netbsd-7] src/sys/dev/usb

2019-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Jan 11 15:58:23 UTC 2019

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdi.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1671):

sys/dev/usb/usbdi.c: revision 1.181

Avoid use after free when closing interrupt pipe transfer by calling
upm_close before destroying the interupt pipe xfer.

Found by kasan on wiz's machine.


To generate a diff of this commit:
cvs rdiff -u -r1.161.2.3 -r1.161.2.4 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.161.2.3 src/sys/dev/usb/usbdi.c:1.161.2.4
--- src/sys/dev/usb/usbdi.c:1.161.2.3	Sat Aug 25 14:57:35 2018
+++ src/sys/dev/usb/usbdi.c	Fri Jan 11 15:58:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.161.2.3 2018/08/25 14:57:35 martin Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.3 2018/08/25 14:57:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -254,13 +254,14 @@ usbd_close_pipe(struct usbd_pipe *pipe)
 	LIST_REMOVE(pipe, up_next);
 	pipe->up_endpoint->ue_refcnt--;
 
+	pipe->up_methods->upm_close(pipe);
+
 	if (pipe->up_intrxfer != NULL) {
 		usbd_unlock_pipe(pipe);
 		usbd_destroy_xfer(pipe->up_intrxfer);
 		usbd_lock_pipe(pipe);
 	}
 
-	pipe->up_methods->upm_close(pipe);
 	usbd_unlock_pipe(pipe);
 	kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
 



CVS commit: [netbsd-7] src/sys/dev/pci

2018-11-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 28 16:26:31 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c

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

sys/dev/pci/if_wm.c: revision 1.599

- Fix a bug that i82578 PHY can't detect correctly.
- Print PHY OUI and model number if a PHY's can't be identified.

XXX pullup-[78]


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.17 -r1.289.2.18 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.17 src/sys/dev/pci/if_wm.c:1.289.2.18
--- src/sys/dev/pci/if_wm.c:1.289.2.17	Fri Nov  9 11:28:39 2018
+++ src/sys/dev/pci/if_wm.c	Wed Nov 28 16:26:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.17 2018/11/09 11:28:39 sborrill Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.18 2018/11/28 16:26:31 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.17 2018/11/09 11:28:39 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.18 2018/11/28 16:26:31 martin Exp $");
 
 #include 
 #include 
@@ -7300,7 +7300,7 @@ wm_gmii_setup_phytype(struct wm_softc *s
 	} else {
 		/* It's not the first call. Use PHY OUI and model */
 		switch (phy_oui) {
-		case MII_OUI_ATHEROS: /* XXX ??? */
+		case MII_OUI_ATTANSIC: /* XXX ??? */
 			switch (phy_model) {
 			case 0x0004: /* XXX */
 new_phytype = WMPHY_82578;
@@ -7377,8 +7377,9 @@ wm_gmii_setup_phytype(struct wm_softc *s
 			break;
 		}
 		if (new_phytype == WMPHY_UNKNOWN)
-			aprint_verbose_dev(dev, "%s: unknown PHY model\n",
-			__func__);
+			aprint_verbose_dev(dev,
+			"%s: unknown PHY model. OUI=%06x, model=%04x\n",
+			__func__, phy_oui, phy_model);
 
 		if ((sc->sc_phytype != WMPHY_UNKNOWN)
 		&& (sc->sc_phytype != new_phytype )) {



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

2018-11-09 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Nov  9 11:28:39 UTC 2018

Modified Files:
src/sys/dev/mii [netbsd-7]: inbmphyreg.h
src/sys/dev/pci [netbsd-7]: if_wm.c if_wmreg.h

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1648):
sys/dev/mii/inbmphyreg.h1.11
sys/dev/pci/if_wm.c 1.586-1.588, 1.590-1.596 via 
patch
sys/dev/pci/if_wmreg.h  1.108

- rename tu event counter to txunderrun.
- Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
   returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
   incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
   event counter is incremented.
- Reduce the max number of DMA segments from 256 to 64 (it's the same value
   as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
   value (40)) because we do m_defrag() now.
- 82574 and newer document says the status field has neither EC
   (Excessive Collision) bit nor LC (Late Collision) bit (reserved), so
   don't check the bit.
- Add workaround for DMA hang problem which result in TX device timeout
   on PCH_LPT with I218. Same as FreeBSD and Linux. This workaround is
   only for device ID 0x155a, 0x15a2, 0x1559 and 0x15a3.
- Fix a PCH2 specific bug that wrong PHY register value can be read
   when boot. Same as FreeBSD and Linux.
- After writing MDIC register, don't read quickly the same register but
   do delay(50). Same as other OSes.
- Add missing wm_gate_hw_phy_config_ich8lan(false) in
   wm_phy_post_reset() on PCH2. wm_gate_hw_phy_config_ich8lan(true) is
   called in wm_reset(), so wm_gate_hw_phy_config_ich8lan(false) should
   be called after reset in wm_phy_post_reset().
- On PCH2, set the phy config counter to 50msec after (PHY) reset.
- KNF & Use macro.


To generate a diff of this commit:
cvs rdiff -u -r1.3.30.2 -r1.3.30.3 src/sys/dev/mii/inbmphyreg.h
cvs rdiff -u -r1.289.2.16 -r1.289.2.17 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.9 -r1.60.2.10 src/sys/dev/pci/if_wmreg.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/mii/inbmphyreg.h
diff -u src/sys/dev/mii/inbmphyreg.h:1.3.30.2 src/sys/dev/mii/inbmphyreg.h:1.3.30.3
--- src/sys/dev/mii/inbmphyreg.h:1.3.30.2	Sat Aug 11 13:34:21 2018
+++ src/sys/dev/mii/inbmphyreg.h	Fri Nov  9 11:28:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: inbmphyreg.h,v 1.3.30.2 2018/08/11 13:34:21 martin Exp $	*/
+/*	$NetBSD: inbmphyreg.h,v 1.3.30.3 2018/11/09 11:28:39 sborrill Exp $	*/
 /***
 Copyright (c) 2001-2005, Intel Corporation 
 All rights reserved.
@@ -104,6 +104,10 @@ POSSIBILITY OF SUCH DAMAGE.
 #define	HV_PM_CTRL		BME1000_REG(770, 17)
 #define	HV_PM_CTRL_K1_ENA	__BIT(14)
 
+#define	I217_INBAND_CTRL	BME1000_REG(770, 18)
+#define	I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_MASK	0x3f00
+#define	I217_INBAND_CTRL_LINK_STAT_TX_TIMEOUT_SHIFT	8
+
 #define	IGP3_KMRN_DIAG		BME1000_REG(770, 19)
 #define	IGP3_KMRN_DIAG_PCS_LOCK_LOSS	(1 << 1)
 

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.16 src/sys/dev/pci/if_wm.c:1.289.2.17
--- src/sys/dev/pci/if_wm.c:1.289.2.16	Tue Oct 30 08:35:56 2018
+++ src/sys/dev/pci/if_wm.c	Fri Nov  9 11:28:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.16 2018/10/30 08:35:56 sborrill Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.17 2018/11/09 11:28:39 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.16 2018/10/30 08:35:56 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.17 2018/11/09 11:28:39 sborrill Exp $");
 
 #include 
 #include 
@@ -163,11 +163,12 @@ int	wm_debug = WM_DEBUG_TX | WM_DEBUG_RX
  * of packets, and we go ahead and manage up to 64 (16 for the i82547)
  * of them at a time.
  *
- * We allow up to 256 (!) DMA segments per packet.  Pathological packet
+ * We allow up to 64 (!) DMA segments per packet.  Pathological packet
  * chains containing many small mbufs have been observed in zero-copy
- * situations with jumbo frames.
+ * situations with jumbo frames. If a mbuf chain has more than 64 DMA segments,
+ * m_defrag() is called to reduce it.
  */
-#define	WM_NTXSEGS		256
+#define	WM_NTXSEGS		64
 #define	WM_IFQUEUELEN		256
 #define	WM_TXQUEUELEN_MAX	64
 #define	WM_TXQUEUELEN_MAX_82547	16
@@ -366,9 +367,10 @@ struct wm_softc {
 	struct evcnt sc_ev_txtsopain;	/* painful header manip. for TSO */
 
 	struct evcnt sc_ev_txseg[WM_NTXSEGS]; /* Tx packets w/ N segments */
-	struct evcnt sc_ev_txdrop;	/* Tx packets dropped(too many segs) */
-
-	struct evcnt sc_ev_tu;		/* Tx underrun */
+	struct evcnt sc_ev_txdrop;	/* Tx packets dropped(other than txtoomanysegs) */
+	struct evcnt sc_ev_txtoomanysegs; /* Tx 

CVS commit: [netbsd-7] src/sys/dev/hpc

2018-10-30 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Oct 30 09:56:41 UTC 2018

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up the following revisions(s) (requested by rin in ticket #1638):
sys/dev/hpc/hpckbd.c:   revision 1.33-1.35

Fix kernel crash on hpcmips when console is attached.


To generate a diff of this commit:
cvs rdiff -u -r1.30.12.2 -r1.30.12.3 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30.12.2 src/sys/dev/hpc/hpckbd.c:1.30.12.3
--- src/sys/dev/hpc/hpckbd.c:1.30.12.2	Wed Aug  9 06:48:57 2017
+++ src/sys/dev/hpc/hpckbd.c	Tue Oct 30 09:56:41 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.3 2018/10/30 09:56:41 sborrill Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.3 2018/10/30 09:56:41 sborrill Exp $");
 
 #include 
 #include 
@@ -261,10 +261,11 @@ hpckbd_getevent(struct hpckbd_core* hc, 
 }
 
 
-#ifdef hpcsh
+#if defined(hpcsh) || defined(hpcmips)
 /*
- * XXX: Use the old wrong code for now as hpcsh attaches console very
- * early and it's convenient to be able to do early DDB on wscons.
+ * XXX: Use the old wrong code for now as hpcsh and hpcmips attach
+ * console very early when malloc(9) is not yet available.  It is
+ * convenient to be able to do early DDB on wscons.
  */
 void
 hpckbd_keymap_setup(struct hpckbd_core *hc,
@@ -278,8 +279,9 @@ hpckbd_keymap_setup(struct hpckbd_core *
 	 * XXX The way this is done is really wrong.  The __UNCONST()
 	 * is a hint as to what is wrong.  This actually ends up modifying
 	 * initialized data which is marked "const".
-	 * The reason we get away with it here is that on sh3 kernel
-	 * is directly mapped.
+	 *
+	 * The reason we get away with it here is that on sh3 and mips
+	 * the kernel is directly mapped.
 	 */
 	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
 	for (i = 0; desc[i].name != 0; i++) {



CVS commit: [netbsd-7] src/sys/dev/pci

2018-10-30 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Tue Oct 30 08:35:56 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c

Log Message:
Pull up the following revisions(s) (requested by msaitoh in ticket #1647):
sys/dev/pci/if_wm.c:revision 1.589

Fix KASSERT to prevent panic on CNP (Intel 300 series + I219) with INTx
interrupt (Xen dom0 or pre netbsd-8)


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.15 -r1.289.2.16 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.15 src/sys/dev/pci/if_wm.c:1.289.2.16
--- src/sys/dev/pci/if_wm.c:1.289.2.15	Sat Aug 11 13:34:20 2018
+++ src/sys/dev/pci/if_wm.c	Tue Oct 30 08:35:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.15 2018/08/11 13:34:20 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.16 2018/10/30 08:35:56 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.15 2018/08/11 13:34:20 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.16 2018/10/30 08:35:56 sborrill Exp $");
 
 #include 
 #include 
@@ -12523,7 +12523,8 @@ wm_legacy_irq_quirk_spt(struct wm_softc 
 
 	DPRINTF(WM_DEBUG_INIT, ("%s: %s called\n",
 		device_xname(sc->sc_dev), __func__));
-	KASSERT(sc->sc_type == WM_T_PCH_SPT);
+	KASSERT((sc->sc_type == WM_T_PCH_SPT)
+	|| (sc->sc_type == WM_T_PCH_CNP));
 
 	reg = CSR_READ(sc, WMREG_FEXTNVM7);
 	reg |= FEXTNVM7_SIDE_CLK_UNGATE;



CVS commit: [netbsd-7] src/sys/dev/usb

2018-08-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 25 17:00:14 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: ugen.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1632):

sys/dev/usb/usbdivar.h: revision 1.117
sys/external/bsd/dwc2/dwc2.c: revision 1.52
sys/dev/usb/xhcivar.h: revision 1.10
sys/dev/usb/motg.c: revision 1.22
sys/dev/usb/ehci.c: revision 1.260
sys/dev/usb/ehci.c: revision 1.261
sys/dev/usb/xhci.c: revision 1.96
sys/dev/usb/ohci.c: revision 1.282
sys/dev/usb/ohci.c: revision 1.283
sys/dev/usb/ehcivar.h: revision 1.45
sys/dev/usb/uhci.c: revision 1.281
sys/dev/usb/uhci.c: revision 1.282
sys/dev/usb/usbdi.c: revision 1.177
sys/dev/usb/ohcivar.h: revision 1.60
sys/dev/usb/uhcivar.h: revision 1.55
(all via patch)

pull across abort fixes from nick-nhusb.  add more abort fixes, using
ideas from Taylor and Nick, and myself.  special thanks to both who
inspired much of the code here, if not wrote it directly.

among other problems, this assert should no longer trigger:

   panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: 
file "/current/src/sys/dev/usb/usbdi.c", line 914

using usbhist i was able to track down my instance of it being related
to userland close() beginning, dropping the sc_lock, and then the usb
softintr completes the transfer normally, and when it is done, the
abort path attempts to re-complete the transfer, and the above assert
is tripped.

changes from nhusb were commited with these logs:
--
Move the struct usb_task to struct usbd_xfer for everyone to use.
--
Set device transfer status to USBD_IN_PROGRESS if start methods succeeds
--
Actually set the transfer status on transfers in ohci_abort_xfer and
the controller is dying
--
Don't supply the lock to callout_halt when polling as it won't be held
--
Improve transfer abort
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--

additional changes include:
- initialise the usb abort task in the HCI allocx routine, so that it
  can be safely usb_rem_task()'d.
- rework the handling of softintr vs cancellation vs timeout abort based
  upon a scheme from Taylor:
  when completing a transfer normally:
  - if the status is not in progress, it must be cancelled or timed out,
and we should not process this xfer.
  - set the status as normal.
  - unconditionallly callout_stop() and usb_rem_task().  they're safe and
either aren't running, or will run and do nothing.
  - finally call usb_transfer_complete().
  when aborting a transfer:
  - status should be cancelled or timed out.
  - if cancelling, callout_halt and usb_rem_task_wait() to make sure the
timer is either done or cancelled.
  - at this point, the ux_status must not be cancelled or timed out, and
if it is not in progress we're done.
  - set the status.
  - if the controller is dying, just return.
  - perform HCI-specific tasks to abort this xfer.
  - finally call usb_transfer_complete().
  for the timeout and timeout task:
  - if the HCI is not dying, and the ux_status is in progress, then
trigger the usb abort task.
- remove UXFER_ABORTWAIT and UXFER_ABORTING.

tested on:
- multiple PC systems with several types of devices: ugen/UPS, ucom,
  umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci
  and xhci.
- erlite3: sd@umass on dwc2.
- sunblade2000: kbd/ms and umass disk on ohci.

untested:
- motg, slhci and ahci.  motg has some portion of the new scheme
  applied, but slhci and ahci require more study.

future work includes pushing a lot of the common abort handling into
usbdi.c and leaving upm_abort() for HC specific tasks, but this change
is pullup-able to netbsd-7 and netbsd-8 as it does not change any
external API, as well as removing over 100 lines of code while adding
over 30 new asserts.

XXX: pullup-7, pullup-8.

fix DIAGNOSTIC build by not copying ub_usepolling to stack before use

Sprinkle __diagused


To generate a diff of this commit:
cvs rdiff -u -r1.124.2.4 -r1.124.2.5 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.124.2.4 src/sys/dev/usb/ugen.c:1.124.2.5
--- src/sys/dev/usb/ugen.c:1.124.2.4	Mon Feb 19 19:33:06 2018
+++ src/sys/dev/usb/ugen.c	Sat Aug 25 17:00:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.124.2.4 2018/02/19 19:33:06 snj Exp $	*/
+/*	$NetBSD: ugen.c,v 1.124.2.5 2018/08/25 17:00:14 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.4 2018/02/19 19:33:06 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.5 

CVS commit: [netbsd-7] src/sys/dev/pci

2018-08-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 14 14:29:04 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-7]: pcidevs.h pcidevs_data.h

Log Message:
Regen for ticket #1628


To generate a diff of this commit:
cvs rdiff -u -r1.1192.2.11 -r1.1192.2.12 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1191.2.11 -r1.1191.2.12 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1192.2.11 src/sys/dev/pci/pcidevs.h:1.1192.2.12
--- src/sys/dev/pci/pcidevs.h:1.1192.2.11	Wed Jan  3 21:40:28 2018
+++ src/sys/dev/pci/pcidevs.h	Tue Aug 14 14:28:34 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1192.2.11 2018/01/03 21:40:28 snj Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1192.2.12 2018/08/14 14:28:34 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1199.2.11 2018/01/03 21:37:36 snj Exp
+ *	NetBSD: pcidevs,v 1.1199.2.12 2018/08/11 13:34:21 martin Exp
  */
 
 /*
@@ -3061,6 +3061,10 @@
 #define	PCI_PRODUCT_INTEL_I219_LM2	0x15b7		/* I219-LM Ethernet Connection */
 #define	PCI_PRODUCT_INTEL_I219_V2	0x15b8		/* I219-V Ethernet Connection */
 #define	PCI_PRODUCT_INTEL_I219_LM3	0x15b9		/* I219-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I219_LM7	0x15bb		/* I219-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I219_V7	0x15bc		/* I219-V Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I219_LM6	0x15bd		/* I219-LM Ethernet Connection */
+#define	PCI_PRODUCT_INTEL_I219_V6	0x15be		/* I219-V Ethernet Connection */
 #define	PCI_PRODUCT_INTEL_X550T1	0x15d1		/* X550 10G Ethernet */
 #define	PCI_PRODUCT_INTEL_I219_V5	0x15d6		/* I219-V Ethernet Connection */
 #define	PCI_PRODUCT_INTEL_I219_LM4	0x15d7		/* I219-LM Ethernet Connection */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1191.2.11 src/sys/dev/pci/pcidevs_data.h:1.1191.2.12
--- src/sys/dev/pci/pcidevs_data.h:1.1191.2.11	Wed Jan  3 21:40:28 2018
+++ src/sys/dev/pci/pcidevs_data.h	Tue Aug 14 14:28:35 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1191.2.11 2018/01/03 21:40:28 snj Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1191.2.12 2018/08/14 14:28:35 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1199.2.11 2018/01/03 21:37:36 snj Exp
+ *	NetBSD: pcidevs,v 1.1199.2.12 2018/08/11 13:34:21 martin Exp
  */
 
 /*
@@ -4858,6 +4858,14 @@ static const uint16_t pci_products[] = {
 	19671, , 18507, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM3, 
 	19663, , 18507, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM7, 
+	19663, , 18507, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V7, 
+	19671, , 18507, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_LM6, 
+	19663, , 18507, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V6, 
+	19671, , 18507, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_X550T1, 
 	10326, 18711, , 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_I219_V5, 
@@ -12234,7 +12242,7 @@ static const char pci_words[] = { "." 
 	"ID\0" /* 1 refs @ 5538 */
 	"3c985\0" /* 1 refs @ 5541 */
 	"Gigabit\0" /* 119 refs @ 5547 */
-	"Ethernet\0" /* 463 refs @  */
+	"Ethernet\0" /* 467 refs @  */
 	"3c996\0" /* 1 refs @ 5564 */
 	"10/100/1000\0" /* 48 refs @ 5570 */
 	"3c556\0" /* 2 refs @ 5582 */
@@ -14049,7 +14057,7 @@ static const char pci_words[] = { "." 
 	"(AMT)\0" /* 3 refs @ 18484 */
 	"(IFE)\0" /* 1 refs @ 18490 */
 	"82801EB/ER\0" /* 10 refs @ 18496 */
-	"Connection\0" /* 37 refs @ 18507 */
+	"Connection\0" /* 41 refs @ 18507 */
 	"M\0" /* 1 refs @ 18518 */
 	"i82571EB\0" /* 7 refs @ 18520 */
 	"82801FB\0" /* 4 refs @ 18529 */
@@ -14198,8 +14206,8 @@ static const char pci_words[] = { "." 
 	"I218-V\0" /* 3 refs @ 19641 */
 	"I218-LM\0" /* 3 refs @ 19648 */
 	"Bypass\0" /* 2 refs @ 19656 */
-	"I219-LM\0" /* 5 refs @ 19663 */
-	"I219-V\0" /* 4 refs @ 19671 */
+	"I219-LM\0" /* 7 refs @ 19663 */
+	"I219-V\0" /* 6 refs @ 19671 */
 	"SFP+\0" /* 2 refs @ 19678 */
 	"KX\0" /* 3 refs @ 19683 */
 	"40GbE\0" /* 3 refs @ 19686 */



CVS commit: [netbsd-7] src/sys/dev/usb

2018-08-08 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Aug  8 10:17:11 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: if_athn_usb.c if_atu.c if_aue.c if_axe.c
if_axen.c if_cue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c
if_upgt.c if_ural.c if_url.c if_urtw.c if_urtwn.c if_zyd.c uatp.c
umcs.c usb.c usb_subr.c usbdi.h

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

sys/dev/usb/if_cue.c: revision 1.80
sys/dev/usb/umcs.c: revision 1.11
sys/dev/usb/umcs.c: revision 1.12
sys/dev/usb/if_ural.c: revision 1.56
sys/dev/usb/if_run.c: revision 1.28
sys/dev/usb/if_ural.c: revision 1.57
sys/dev/usb/if_run.c: revision 1.29
sys/dev/usb/uatp.c: revision 1.16
sys/dev/usb/uatp.c: revision 1.17
sys/dev/usb/if_axe.c: revision 1.91
sys/dev/usb/if_axe.c: revision 1.92
sys/dev/usb/if_zyd.c: revision 1.49
sys/dev/usb/if_axen.c: revision 1.15
sys/dev/usb/if_url.c: revision 1.60
sys/dev/usb/if_udav.c: revision 1.54
sys/dev/usb/if_axen.c: revision 1.16
sys/dev/usb/if_udav.c: revision 1.55
sys/dev/usb/if_athn_usb.c: revision 1.28
sys/dev/usb/if_athn_usb.c: revision 1.29
sys/dev/usb/if_urtw.c: revision 1.16
sys/dev/usb/if_urtw.c: revision 1.17
sys/dev/usb/if_cue.c: revision 1.79
sys/dev/usb/if_rum.c: revision 1.62
sys/dev/usb/if_urtwn.c: revision 1.61
sys/dev/usb/if_rum.c: revision 1.63
sys/dev/usb/if_urtwn.c: revision 1.63
sys/dev/usb/usb.c: revision 1.170
sys/dev/usb/usb.c: revision 1.171
sys/dev/usb/if_smsc.c: revision 1.35
sys/dev/usb/if_smsc.c: revision 1.36
sys/dev/usb/if_zyd.c: revision 1.50
sys/dev/usb/if_aue.c: revision 1.144
sys/dev/usb/if_aue.c: revision 1.145
sys/dev/usb/usb_subr.c: revision 1.225
sys/dev/usb/usb_subr.c: revision 1.226
sys/dev/usb/if_upgt.c: revision 1.21
sys/dev/usb/usbdi.h: revision 1.93
sys/dev/usb/if_upgt.c: revision 1.22
sys/dev/usb/if_url.c: revision 1.59
sys/dev/usb/usbdi.h: revision 1.95
sys/dev/usb/if_otus.c: revision 1.34
sys/dev/usb/if_atu.c: revision 1.62
sys/dev/usb/if_otus.c: revision 1.35
sys/dev/usb/if_atu.c: revision 1.63

New function usb_rem_task_wait(dev, task, queue).

If task is scheduled to run, removes it from the queue.  If it may
have already begun to run, waits for it to complete.  Caller must
guarantee it will not switch to another queue.  If caller guarantees
it will not be scheduled again, then usb_rem_task_wait guarantees it
is not running on return.

This will enable us to fix a litany of bugs in detach where we
currently fail to wait for a pending task.

Use usb_rem_task_wait in various drivers.


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.3 -r1.6.6.4 src/sys/dev/usb/if_athn_usb.c
cvs rdiff -u -r1.49.10.2 -r1.49.10.3 src/sys/dev/usb/if_atu.c
cvs rdiff -u -r1.132.2.2 -r1.132.2.3 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.67.2.3 -r1.67.2.4 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.68.2.2 -r1.68.2.3 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.25.4.2 -r1.25.4.3 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.48.4.2 -r1.48.4.3 src/sys/dev/usb/if_rum.c
cvs rdiff -u -r1.10.4.3 -r1.10.4.4 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.19.2.4 -r1.19.2.5 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.43.2.2 -r1.43.2.3 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/dev/usb/if_upgt.c
cvs rdiff -u -r1.44.12.3 -r1.44.12.4 src/sys/dev/usb/if_ural.c
cvs rdiff -u -r1.48.2.2 -r1.48.2.3 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.6.4.2 -r1.6.4.3 src/sys/dev/usb/if_urtw.c
cvs rdiff -u -r1.34.2.4 -r1.34.2.5 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.36.12.2 -r1.36.12.3 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.10.2.2 -r1.10.2.3 src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.7.6.2 -r1.7.6.3 src/sys/dev/usb/umcs.c
cvs rdiff -u -r1.154.2.3 -r1.154.2.4 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.196.4.4 -r1.196.4.5 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sys/dev/usb/usbdi.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/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.6.6.3 src/sys/dev/usb/if_athn_usb.c:1.6.6.4
--- src/sys/dev/usb/if_athn_usb.c:1.6.6.3	Mon Feb 19 19:33:06 2018
+++ src/sys/dev/usb/if_athn_usb.c	Wed Aug  8 10:17:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.6.6.3 2018/02/19 19:33:06 snj Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.6.6.4 2018/08/08 10:17:11 martin Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.3 

CVS commit: [netbsd-7] src/sys/dev/pci

2018-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  6 15:46:16 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-7]: mpii.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1614):

sys/dev/pci/mpii.c: revision 1.9

PR/52330: Jia-Ju Bai: mpii driver: a sleep-in-interrupt bug in mpii_intr
Since the enclosing routime mpii_event_raid already calls malloc with
M_NOWAIT, fix the cache routine to do the same. While there check the
result of the cache routine and change some error prints to aprint.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/dev/pci/mpii.c

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

Modified files:

Index: src/sys/dev/pci/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.5 src/sys/dev/pci/mpii.c:1.5.4.1
--- src/sys/dev/pci/mpii.c:1.5	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/mpii.c	Wed Jun  6 15:46:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.5 2014/03/29 19:28:25 christos Exp $ */
+/* $NetBSD: mpii.c,v 1.5.4.1 2018/06/06 15:46:16 martin Exp $ */
 /*	OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.5 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.5.4.1 2018/06/06 15:46:16 martin Exp $");
 
 #include "bio.h"
 
@@ -3434,26 +3434,34 @@ mpii_event_raid(struct mpii_softc *sc, s
 			case MPII_EVT_IR_CFG_ELEMENT_RC_VOLUME_CREATED:
 if (mpii_find_dev(sc,
 le16toh(ce->vol_dev_handle))) {
-	printf("%s: device %#x is already "
-	"configured\n", DEVNAME(sc),
+	aprint_error_dev(sc->sc_dev,
+	"device %#x is already "
+	"configured\n",
 	le16toh(ce->vol_dev_handle));
 	break;
 }
 dev = malloc(sizeof(*dev), M_DEVBUF,
 M_NOWAIT | M_ZERO);
 if (!dev) {
-	printf("%s: failed to allocate a "
-	"device structure\n", DEVNAME(sc));
+	aprint_error_dev(sc->sc_dev,
+	"can't allocate device structure\n");
 	break;
 }
 SET(dev->flags, MPII_DF_VOLUME);
 dev->slot = sc->sc_vd_id_low;
 dev->dev_handle = le16toh(ce->vol_dev_handle);
 if (mpii_insert_dev(sc, dev)) {
+	aprint_error_dev(sc->sc_dev,
+	"can't insert device structure\n");
+	free(dev, M_DEVBUF);
+	break;
+}
+if (mpii_cache_enable(sc, dev)) {
+	aprint_error_dev(sc->sc_dev,
+	"can't enable device cache\n");
 	free(dev, M_DEVBUF);
 	break;
 }
-mpii_cache_enable(sc, dev);
 sc->sc_vd_count++;
 break;
 			case MPII_EVT_IR_CFG_ELEMENT_RC_REMOVED:
@@ -3515,15 +3523,15 @@ mpii_event_sas(struct mpii_softc *sc, st
 		switch (pe->phy_status & MPII_EVENT_SAS_TOPO_PS_RC_MASK) {
 		case MPII_EVENT_SAS_TOPO_PS_RC_ADDED:
 			if (mpii_find_dev(sc, le16toh(pe->dev_handle))) {
-printf("%s: device %#x is already "
-"configured\n", DEVNAME(sc),
+aprint_error_dev(sc->sc_dev,
+"device %#x is already configured\n",
 le16toh(pe->dev_handle));
 break;
 			}
 			dev = malloc(sizeof(*dev), M_DEVBUF, M_NOWAIT | M_ZERO);
 			if (!dev) {
-printf("%s: failed to allocate a "
-"device structure\n", DEVNAME(sc));
+aprint_error_dev(sc->sc_dev, "can't allocate "
+"device structure\n");
 break;
 			}
 			dev->slot = sc->sc_pd_id_start + tcl->start_phy_num + i;
@@ -3534,6 +3542,8 @@ mpii_event_sas(struct mpii_softc *sc, st
 			dev->enclosure = le16toh(tcl->enclosure_handle);
 			dev->expander = le16toh(tcl->expander_handle);
 			if (mpii_insert_dev(sc, dev)) {
+aprint_error_dev(sc->sc_dev, "can't insert "
+"device structure\n");
 free(dev, M_DEVBUF);
 break;
 			}
@@ -3550,9 +3560,9 @@ mpii_event_sas(struct mpii_softc *sc, st
 DVACT_DEACTIVATE);
 if (scsi_task(mpii_event_defer, sc,
 dev, 0) != 0)
-	printf("%s: unable to run device "
-	"detachment routine\n",
-	DEVNAME(sc));
+	aprint_error_dev(sc->sc_dev, 
+	"unable to run device "
+	"detachment routine\n");
 			}
 #else
 			mpii_event_defer(sc, dev);
@@ -4981,7 +4991,7 @@ mpii_cache_enable(struct mpii_softc *sc,
 		return (EINVAL);
 
 	pagelen = hdr.page_length * 4;
-	vpg = malloc(pagelen, M_TEMP, M_WAITOK | M_CANFAIL | M_ZERO);
+	vpg = malloc(pagelen, M_TEMP, M_NOWAIT | M_ZERO);
 	if (vpg == NULL)
 		return (ENOMEM);
 



CVS commit: [netbsd-7] src/sys/dev/usb

2018-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  6 15:42:31 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h

Log Message:
regen (ticket #1613)


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.8 -r1.672.2.9 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.8 -r1.673.2.9 src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.672.2.8 src/sys/dev/usb/usbdevs.h:1.672.2.9
--- src/sys/dev/usb/usbdevs.h:1.672.2.8	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/usbdevs.h	Wed Jun  6 15:42:28 2018
@@ -4,7 +4,7 @@
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp
+ *	NetBSD: usbdevs,v 1.680.2.9 2018/06/06 15:41:47 martin Exp
  */
 
 /*
@@ -3261,6 +3261,7 @@
 
 /* TP-Link products */
 #define	USB_PRODUCT_TPLINK_RTL8192CU	0x0100		/* RTL8192CU */
+#define	USB_PRODUCT_TPLINK_RTL8188EU	0x010c		/* RTL8188EU */
 
 /* Trek Technology products */
 #define	USB_PRODUCT_TREK_THUMBDRIVE	0x		/* ThumbDrive */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.8 src/sys/dev/usb/usbdevs_data.h:1.673.2.9
--- src/sys/dev/usb/usbdevs_data.h:1.673.2.8	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/usbdevs_data.h	Wed Jun  6 15:42:28 2018
@@ -4,7 +4,7 @@
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp
+ *	NetBSD: usbdevs,v 1.680.2.9 2018/06/06 15:41:47 martin Exp
  */
 
 /*
@@ -9923,6 +9923,10 @@ const struct usb_product usb_products[] 
 	"RTL8192CU",
 	},
 	{
+	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8188EU,
+	"RTL8188EU",
+	},
+	{
 	USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE,
 	"ThumbDrive",
 	},
@@ -10567,4 +10571,4 @@ const struct usb_product usb_products[] 
 	"Prestige",
 	},
 };
-const int usb_nproducts = 2092;
+const int usb_nproducts = 2093;



CVS commit: [netbsd-7] src/sys/dev/usb

2018-06-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun  6 15:41:47 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: if_urtwn.c usbdevs

Log Message:
Pull up following revision(s) (requested by maya in ticket #1613):

sys/dev/usb/if_urtwn.c: revision 1.53
sys/dev/usb/usbdevs: revision 1.733

PR/52212 - Kai-Uwe Eckhardt -- add TP-Link TL-WN722N v2


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.3 -r1.34.2.4 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.680.2.8 -r1.680.2.9 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.34.2.3 src/sys/dev/usb/if_urtwn.c:1.34.2.4
--- src/sys/dev/usb/if_urtwn.c:1.34.2.3	Mon Feb 19 19:33:06 2018
+++ src/sys/dev/usb/if_urtwn.c	Wed Jun  6 15:41:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.34.2.3 2018/02/19 19:33:06 snj Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.34.2.4 2018/06/06 15:41:47 martin Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.3 2018/02/19 19:33:06 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.4 2018/06/06 15:41:47 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -191,6 +191,7 @@ static const struct urtwn_dev {
 	URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV),
 	URTWN_RTL8188E_DEV(REALTEK, RTL8188EU),
 	URTWN_RTL8188E_DEV(ABOCOM, RTL8188EU),
+	URTWN_RTL8188E_DEV(TPLINK, RTL8188EU),
 
 	/* URTWN_RTL8192EU */
 	URTWN_RTL8192EU_DEV(REALTEK,	RTL8192EU),

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.680.2.8 src/sys/dev/usb/usbdevs:1.680.2.9
--- src/sys/dev/usb/usbdevs:1.680.2.8	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/usbdevs	Wed Jun  6 15:41:47 2018
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.680.2.8 2017/04/05 19:54:20 snj Exp $
+$NetBSD: usbdevs,v 1.680.2.9 2018/06/06 15:41:47 martin Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -3254,6 +3254,7 @@ product TOSHIBA HSDPA_MODEM_EU870DT1	0x1
 
 /* TP-Link products */
 product TPLINK RTL8192CU	0x0100	RTL8192CU
+product TPLINK RTL8188EU	0x010c	RTL8188EU
 
 /* Trek Technology products */
 product TREK THUMBDRIVE		0x	ThumbDrive



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

2018-05-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon May 14 16:11:09 UTC 2018

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

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

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.90 -r1.90.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.90 src/sys/dev/ic/hme.c:1.90.2.1
--- src/sys/dev/ic/hme.c:1.90	Sun Aug 10 16:44:35 2014
+++ src/sys/dev/ic/hme.c	Mon May 14 16:11:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hme.c,v 1.90 2014/08/10 16:44:35 tls Exp $	*/
+/*	$NetBSD: hme.c,v 1.90.2.1 2018/05/14 16:11:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.90 2014/08/10 16:44:35 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.90.2.1 2018/05/14 16:11:09 martin Exp $");
 
 /* #define HMEDEBUG */
 
@@ -752,7 +752,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-7] src/sys/dev

2018-03-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Mar 21 12:04:35 UTC 2018

Modified Files:
src/sys/dev/ic [netbsd-7]: cs4215reg.h
src/sys/dev/sbus [netbsd-7]: dbri.c dbrivar.h

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1586):
sys/dev/sbus/dbrivar.h: revision 1.14
sys/dev/sbus/dbrivar.h: revision 1.15
sys/dev/ic/cs4215reg.h: revision 1.5
sys/dev/sbus/dbri.c: revision 1.36
sys/dev/sbus/dbri.c: revision 1.37
sys/dev/sbus/dbri.c: revision 1.38

fix audiomp bugs:
- switch from tsleep/wakeup to condvar
- fix locking in a bunch of places.  there were several locking
  against myself issues.
also:
- don't let dbri_process_interrupt_buffer() loop more than once
  over the array of intrs.

this fixes hangs when using audio on ss20 in -current, but does
not make audio work.  it eventually times out with eg:
dbri0: switching to control mode timed out (0 f6)
and may leave a sample in the audio buffer repeating.

overhaul the dbri driver and make it work again in the New Order Of Things
- fix switching between control and data mode
- make sure interrupts can happen in control mode
- implement audioif.commit_settings()
- switch to control mode only if needed - for changes in sample rate or format
  but not for things like volume control
should fix PR 52786

fix several KASSERT()s and locking in a few places.

fixes DIAGNOSTIC kernels and still plays.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.62.1 src/sys/dev/ic/cs4215reg.h
cvs rdiff -u -r1.35 -r1.35.4.1 src/sys/dev/sbus/dbri.c
cvs rdiff -u -r1.13 -r1.13.24.1 src/sys/dev/sbus/dbrivar.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/cs4215reg.h
diff -u src/sys/dev/ic/cs4215reg.h:1.4 src/sys/dev/ic/cs4215reg.h:1.4.62.1
--- src/sys/dev/ic/cs4215reg.h:1.4	Mon May  5 00:21:47 2008
+++ src/sys/dev/ic/cs4215reg.h	Wed Mar 21 12:04:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4215reg.h,v 1.4 2008/05/05 00:21:47 jmcneill Exp $	*/
+/*	$NetBSD: cs4215reg.h,v 1.4.62.1 2018/03/21 12:04:35 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Jared D. McNeill 
@@ -30,7 +30,7 @@
 /* time slot 1: status register */
 #define	CS4215_CLB	(1<<2)	/* control latch bit */
 #define	CS4215_MLB	(1<<4)	/* 1: mic: 20 dB gain disabled */
-#define	CS4215_RSRVD_1	(1<<5)
+#define	CS4215_ONE	(1<<5)	/* always one */
 
 /* time slot 2: data format register */
 #define	CS4215_DFR_LINEAR16	0

Index: src/sys/dev/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.35 src/sys/dev/sbus/dbri.c:1.35.4.1
--- src/sys/dev/sbus/dbri.c:1.35	Sat Oct 19 21:00:32 2013
+++ src/sys/dev/sbus/dbri.c	Wed Mar 21 12:04:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbri.c,v 1.35 2013/10/19 21:00:32 mrg Exp $	*/
+/*	$NetBSD: dbri.c,v 1.35.4.1 2018/03/21 12:04:35 martin Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.35 2013/10/19 21:00:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.35.4.1 2018/03/21 12:04:35 martin Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -165,6 +165,7 @@ static void	dbri_set_power(struct dbri_s
 static void	dbri_bring_up(struct dbri_softc *);
 static bool	dbri_suspend(device_t, const pmf_qual_t *);
 static bool	dbri_resume(device_t, const pmf_qual_t *);
+static int	dbri_commit(void *);
 
 /* stupid support routines */
 static uint32_t	reverse_bytes(uint32_t, int);
@@ -195,6 +196,7 @@ struct audio_hw_if dbri_hw_if = {
 	.trigger_output		= dbri_trigger_output,
 	.trigger_input		= dbri_trigger_input,
 	.get_locks		= dbri_get_locks,
+	.commit_settings	= dbri_commit,
 };
 
 CFATTACH_DECL_NEW(dbri, sizeof(struct dbri_softc),
@@ -277,6 +279,8 @@ dbri_attach_sbus(device_t parent, device
 	sc->sc_dmat = sa->sa_dmatag;
 	sc->sc_powerstate = 1;
 
+	sc->sc_whack_codec = 0;
+
 	pwr = prom_getpropint(sa->sa_node,"pwr-on-auxio",0);
 	aprint_normal(": rev %s\n", ver);
 
@@ -365,9 +369,13 @@ dbri_attach_sbus(device_t parent, device
 	sc->sc_bufsiz = size;
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
+
+#ifndef DBRI_SPIN
+	cv_init(>sc_cv, "dbricv");
+#endif
 
-	bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_SCHED, dbri_intr,
+	bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_AUDIO, dbri_intr,
 	sc);
 
 	sc->sc_locked = 0;
@@ -444,23 +452,32 @@ dbri_config_interrupts(device_t dev)
 {
 	struct dbri_softc *sc = device_private(dev);
 
-	if (sc->sc_init_done != 0)
+	mutex_spin_enter(>sc_intr_lock);
+	if (sc->sc_init_done != 0) {
+		mutex_spin_exit(>sc_intr_lock);
 		return 0;
-
+	}
 	sc->sc_init_done = 1;
 
 	dbri_init(sc);
+
+	/* talking to the codec needs working interrupts */
 	if (mmcodec_init(sc) == -1) {
+		mutex_spin_exit(>sc_intr_lock);
 		

CVS commit: [netbsd-7] src/sys/dev/ppbus

2018-03-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 20 17:32:08 UTC 2018

Modified Files:
src/sys/dev/ppbus [netbsd-7]: if_plip.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1579):
sys/dev/ppbus/if_plip.c: revision 1.28
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.25 src/sys/dev/ppbus/if_plip.c:1.25.2.1
--- src/sys/dev/ppbus/if_plip.c:1.25	Thu Jun  5 23:48:16 2014
+++ src/sys/dev/ppbus/if_plip.c	Tue Mar 20 17:32:08 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.25 2014/06/05 23:48:16 rmind Exp $ */
+/* $NetBSD: if_plip.c,v 1.25.2.1 2018/03/20 17:32:08 martin Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.25 2014/06/05 23:48:16 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.25.2.1 2018/03/20 17:32:08 martin Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -445,6 +445,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, v
 		case AF_INET:
 			break;
 		default:
+			splx(s);
 			return EAFNOSUPPORT;
 		}
 		break;



CVS commit: [netbsd-7] src/sys/dev/sbus

2018-03-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Mar  3 20:14:20 UTC 2018

Modified Files:
src/sys/dev/sbus [netbsd-7]: be.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1575):
sys/dev/sbus/be.c: 1.86
spl leak, found by Mootja a long time ago


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.80.8.1 src/sys/dev/sbus/be.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/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.80 src/sys/dev/sbus/be.c:1.80.8.1
--- src/sys/dev/sbus/be.c:1.80	Sun Jun  9 09:23:35 2013
+++ src/sys/dev/sbus/be.c	Sat Mar  3 20:14:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: be.c,v 1.80 2013/06/09 09:23:35 msaitoh Exp $	*/
+/*	$NetBSD: be.c,v 1.80.8.1 2018/03/03 20:14:20 snj Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.80 2013/06/09 09:23:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.80.8.1 2018/03/03 20:14:20 snj Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -1126,6 +1126,7 @@ beinit(struct ifnet *ifp)
 
 	callout_reset(>sc_tick_ch, hz, be_tick, sc);
 
+	splx(s);
 	return 0;
 out:
 	splx(s);



CVS commit: [netbsd-7] src/sys/dev/usb

2018-02-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Feb 19 19:33:06 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: if_athn_usb.c if_atu.c if_aue.c if_axe.c
if_axen.c if_cdce.c if_cue.c if_kue.c if_otus.c if_rum.c if_run.c
if_smsc.c if_udav.c if_upgt.c if_upl.c if_ural.c if_url.c
if_urndis.c if_urtw.c if_urtwn.c if_zyd.c irmce.c pseye.c ubt.c
ucom.c udsir.c ugen.c uhso.c uirda.c ulpt.c umass.c umidi.c
uscanner.c usscanner.c ustir.c utoppy.c uvideo.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1556):
sys/dev/usb/if_athn_usb.c: 1.25
sys/dev/usb/if_atu.c: 1.56
sys/dev/usb/if_aue.c: 1.142
sys/dev/usb/if_axe.c: 1.84
sys/dev/usb/if_axen.c: 1.12
sys/dev/usb/if_cdce.c: 1.45
sys/dev/usb/if_cue.c: 1.77
sys/dev/usb/if_kue.c: 1.91
sys/dev/usb/if_otus.c: 1.32
sys/dev/usb/if_rum.c: 1.59
sys/dev/usb/if_run.c: 1.25
sys/dev/usb/if_smsc.c: 1.33
sys/dev/usb/if_udav.c: 1.52
sys/dev/usb/if_upgt.c: 1.18
sys/dev/usb/if_upl.c: 1.61
sys/dev/usb/if_ural.c: 1.53
sys/dev/usb/if_url.c: 1.57
sys/dev/usb/if_urndis.c: 1.17
sys/dev/usb/if_urtw.c: 1.14
sys/dev/usb/if_urtwn.c: 1.56
sys/dev/usb/if_zyd.c: 1.45
sys/dev/usb/irmce.c: 1.4
sys/dev/usb/pseye.c: 1.24
sys/dev/usb/ubt.c: 1.60
sys/dev/usb/ucom.c: 1.120
sys/dev/usb/udsir.c: 1.6
sys/dev/usb/ugen.c: 1.137
sys/dev/usb/uhso.c: 1.27
sys/dev/usb/uirda.c: 1.43
sys/dev/usb/ulpt.c: 1.99
sys/dev/usb/umass.c: 1.163
sys/dev/usb/umidi.c: 1.74
sys/dev/usb/uscanner.c: 1.82
sys/dev/usb/usscanner.c: 1.43
sys/dev/usb/ustir.c: 1.39
sys/dev/usb/utoppy.c: 1.30
sys/dev/usb/uvideo.c: 1.46
PR kern/52931 Kernel panics with Atheros usb wireless interface
Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is
supplied wherever such a transfer is setup.  We can drop
USBD_SHORT_XFER_OK as it has not bearing on number of TDs


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.2 -r1.6.6.3 src/sys/dev/usb/if_athn_usb.c
cvs rdiff -u -r1.49.10.1 -r1.49.10.2 src/sys/dev/usb/if_atu.c
cvs rdiff -u -r1.132.2.1 -r1.132.2.2 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.38.12.1 -r1.38.12.2 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.68.2.1 -r1.68.2.2 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.81.2.1 -r1.81.2.2 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.48.4.1 -r1.48.4.2 src/sys/dev/usb/if_rum.c
cvs rdiff -u -r1.10.4.2 -r1.10.4.3 src/sys/dev/usb/if_run.c
cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.43.2.1 -r1.43.2.2 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/dev/usb/if_upgt.c
cvs rdiff -u -r1.47.2.1 -r1.47.2.2 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.44.12.2 -r1.44.12.3 src/sys/dev/usb/if_ural.c
cvs rdiff -u -r1.48.2.1 -r1.48.2.2 src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.9.2.1 -r1.9.2.2 src/sys/dev/usb/if_urndis.c
cvs rdiff -u -r1.6.4.1 -r1.6.4.2 src/sys/dev/usb/if_urtw.c
cvs rdiff -u -r1.34.2.2 -r1.34.2.3 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.36.12.1 -r1.36.12.2 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.1.30.1 -r1.1.30.2 src/sys/dev/usb/irmce.c
cvs rdiff -u -r1.21.32.1 -r1.21.32.2 src/sys/dev/usb/pseye.c
cvs rdiff -u -r1.51.2.1 -r1.51.2.2 src/sys/dev/usb/ubt.c
cvs rdiff -u -r1.107.2.2 -r1.107.2.3 src/sys/dev/usb/ucom.c
cvs rdiff -u -r1.1.12.1 -r1.1.12.2 src/sys/dev/usb/udsir.c
cvs rdiff -u -r1.124.2.3 -r1.124.2.4 src/sys/dev/usb/ugen.c
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/usb/uhso.c
cvs rdiff -u -r1.38.4.1 -r1.38.4.2 src/sys/dev/usb/uirda.c \
src/sys/dev/usb/usscanner.c
cvs rdiff -u -r1.95.2.1 -r1.95.2.2 src/sys/dev/usb/ulpt.c
cvs rdiff -u -r1.148.4.1 -r1.148.4.2 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.65.12.2 -r1.65.12.3 src/sys/dev/usb/umidi.c
cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/usb/uscanner.c
cvs rdiff -u -r1.33.8.1 -r1.33.8.2 src/sys/dev/usb/ustir.c
cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/sys/dev/usb/utoppy.c
cvs rdiff -u -r1.40.4.1 -r1.40.4.2 src/sys/dev/usb/uvideo.c

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

Modified files:

Index: src/sys/dev/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.6.6.2 src/sys/dev/usb/if_athn_usb.c:1.6.6.3
--- src/sys/dev/usb/if_athn_usb.c:1.6.6.2	Mon Oct 23 19:15:09 2017
+++ src/sys/dev/usb/if_athn_usb.c	Mon Feb 19 19:33:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.6.6.3 2018/02/19 19:33:06 snj Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 

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

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 21:47:45 UTC 2018

Modified Files:
src/sys/dev [netbsd-7]: fss.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1549):
sys/dev/fss.c: revision 1.101-1.103
Bounds check against media size for non-persistent snapshots.
--
Treat partial read from backing store as I/O error.
--
Pass residual back to b_resid for persistent snapshots.


To generate a diff of this commit:
cvs rdiff -u -r1.91.2.1 -r1.91.2.2 src/sys/dev/fss.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/fss.c
diff -u src/sys/dev/fss.c:1.91.2.1 src/sys/dev/fss.c:1.91.2.2
--- src/sys/dev/fss.c:1.91.2.1	Sat Aug 27 15:09:22 2016
+++ src/sys/dev/fss.c	Wed Jan  3 21:47:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.91.2.1 2016/08/27 15:09:22 bouyer Exp $	*/
+/*	$NetBSD: fss.c,v 1.91.2.2 2018/01/03 21:47:45 snj Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.91.2.1 2016/08/27 15:09:22 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.91.2.2 2018/01/03 21:47:45 snj Exp $");
 
 #include 
 #include 
@@ -89,7 +89,7 @@ static void fss_softc_free(struct fss_so
 static int fss_read_cluster(struct fss_softc *, u_int32_t);
 static void fss_bs_thread(void *);
 static int fss_bs_io(struct fss_softc *, fss_io_type,
-u_int32_t, off_t, int, void *);
+u_int32_t, off_t, int, void *, size_t *);
 static u_int32_t *fss_bs_indir(struct fss_softc *, u_int32_t);
 
 static kmutex_t fss_device_lock;	/* Protect all units. */
@@ -281,20 +281,26 @@ fss_strategy(struct buf *bp)
 	mutex_enter(>sc_slock);
 
 	if (write || !FSS_ISVALID(sc)) {
-
-		mutex_exit(>sc_slock);
-
 		bp->b_error = (write ? EROFS : ENXIO);
-		bp->b_resid = bp->b_bcount;
-		biodone(bp);
-		return;
+		goto done;
 	}
+	/* Check bounds for non-persistent snapshots. */
+	if ((sc->sc_flags & FSS_PERSISTENT) == 0 &&
+	bounds_check_with_mediasize(bp, DEV_BSIZE,
+	btodb(FSS_CLTOB(sc, sc->sc_clcount - 1) + sc->sc_clresid)) <= 0)
+		goto done;
 
 	bp->b_rawblkno = bp->b_blkno;
 	bufq_put(sc->sc_bufq, bp);
 	cv_signal(>sc_work_cv);
 
 	mutex_exit(>sc_slock);
+	return;
+
+done:
+	mutex_exit(>sc_slock);
+	bp->b_resid = bp->b_bcount;
+	biodone(bp);
 }
 
 int
@@ -991,6 +997,8 @@ restart:
 		todo -= len;
 	}
 	error = biowait(mbp);
+	if (error == 0 && mbp->b_resid != 0)
+		error = EIO;
 	putiobuf(mbp);
 
 	mutex_enter(>sc_slock);
@@ -1012,7 +1020,7 @@ restart:
  */
 static int
 fss_bs_io(struct fss_softc *sc, fss_io_type rw,
-u_int32_t cl, off_t off, int len, void *data)
+u_int32_t cl, off_t off, int len, void *data, size_t *resid)
 {
 	int error;
 
@@ -1023,7 +1031,7 @@ fss_bs_io(struct fss_softc *sc, fss_io_t
 	error = vn_rdwr((rw == FSS_READ ? UIO_READ : UIO_WRITE), sc->sc_bs_vp,
 	data, len, off, UIO_SYSSPACE,
 	IO_ADV_ENCODE(POSIX_FADV_NOREUSE) | IO_NODELOCKED,
-	sc->sc_bs_lwp->l_cred, NULL, NULL);
+	sc->sc_bs_lwp->l_cred, resid, NULL);
 	if (error == 0) {
 		mutex_enter(sc->sc_bs_vp->v_interlock);
 		error = VOP_PUTPAGES(sc->sc_bs_vp, trunc_page(off),
@@ -1052,7 +1060,7 @@ fss_bs_indir(struct fss_softc *sc, u_int
 
 	if (sc->sc_indir_dirty) {
 		if (fss_bs_io(sc, FSS_WRITE, sc->sc_indir_cur, 0,
-		FSS_CLSIZE(sc), (void *)sc->sc_indir_data) != 0)
+		FSS_CLSIZE(sc), (void *)sc->sc_indir_data, NULL) != 0)
 			return NULL;
 		setbit(sc->sc_indir_valid, sc->sc_indir_cur);
 	}
@@ -1062,7 +1070,7 @@ fss_bs_indir(struct fss_softc *sc, u_int
 
 	if (isset(sc->sc_indir_valid, sc->sc_indir_cur)) {
 		if (fss_bs_io(sc, FSS_READ, sc->sc_indir_cur, 0,
-		FSS_CLSIZE(sc), (void *)sc->sc_indir_data) != 0)
+		FSS_CLSIZE(sc), (void *)sc->sc_indir_data, NULL) != 0)
 			return NULL;
 	} else
 		memset(sc->sc_indir_data, 0, FSS_CLSIZE(sc));
@@ -1083,6 +1091,7 @@ fss_bs_thread(void *arg)
 	long off;
 	char *addr;
 	u_int32_t c, cl, ch, *indirp;
+	size_t resid;
 	struct buf *bp, *nbp;
 	struct fss_softc *sc;
 	struct fss_cache *scp, *scl;
@@ -1119,14 +1128,18 @@ fss_bs_thread(void *arg)
 disk_busy(sc->sc_dkdev);
 error = fss_bs_io(sc, FSS_READ, 0,
 dbtob(bp->b_blkno), bp->b_bcount,
-bp->b_data);
+bp->b_data, );
+if (error)
+	resid = bp->b_bcount;
 disk_unbusy(sc->sc_dkdev,
 (error ? 0 : bp->b_bcount), is_read);
-			} else
+			} else {
 error = ENXIO;
+resid = bp->b_bcount;
+			}
 
 			bp->b_error = error;
-			bp->b_resid = (error ? bp->b_bcount : 0);
+			bp->b_resid = resid;
 			biodone(bp);
 
 			mutex_enter(>sc_slock);
@@ -1147,7 +1160,7 @@ fss_bs_thread(void *arg)
 			indirp = fss_bs_indir(sc, scp->fc_cluster);
 			if (indirp != NULL) {
 error = fss_bs_io(sc, FSS_WRITE, sc->sc_clnext,
-0, FSS_CLSIZE(sc), scp->fc_data);
+0, FSS_CLSIZE(sc), scp->fc_data, NULL);
 			} else
 error = EIO;
 
@@ 

CVS commit: [netbsd-7] src/sys/dev/pci

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 21:37:36 UTC 2018

Modified Files:
src/sys/dev/pci [netbsd-7]: pcidevs pucdata.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1547):
sys/dev/pci/pucdata.c: revision 1.99-1.100
sys/dev/pci/pcidevs: revision 1.1278
Add Intel 200 series chipset devices from "Table 2-2. PCH-H Device and
Revision ID Table, Intel 200 Series Chipset Family Platform Controller
Hub(PCI) Datasheet Volume 1 of 2 (335192-001)".
--
Add Intel 200 series devices.
--
PR/52868: Petar Bogdanovic: Add support for Manhattan 158220 card


To generate a diff of this commit:
cvs rdiff -u -r1.1199.2.10 -r1.1199.2.11 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.93.4.2 -r1.93.4.3 src/sys/dev/pci/pucdata.c

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1199.2.10 src/sys/dev/pci/pcidevs:1.1199.2.11
--- src/sys/dev/pci/pcidevs:1.1199.2.10	Tue Jul 25 19:43:03 2017
+++ src/sys/dev/pci/pcidevs	Wed Jan  3 21:37:36 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.10 2017/07/25 19:43:03 snj Exp $
+$NetBSD: pcidevs,v 1.1199.2.11 2018/01/03 21:37:36 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3567,10 +3567,10 @@ product INTEL 82801HO_LPC 	0x2814	82801H
 product INTEL 82801HBM_LPC  0x2815  82801HBM LPC Interface Bridge
 product INTEL 82801H_SATA_1	0x2820	82801H SATA Controller
 product INTEL 82801H_SATA_AHCI6	0x2821	82801H AHCI SATA Controller w/ 6 ports
-product INTEL 82801H_SATA_RAID	0x2822	82801H/C61x/X99/Z170 RAID SATA Controller
+product INTEL 82801H_SATA_RAID	0x2822	82801H/C61x/X99/Z170/[ZQH]270 RAID SATA Controller
 product INTEL 82801H_SATA_AHCI4	0x2824	82801H AHCI SATA Controller w/ 4 ports
 product INTEL 82801H_SATA_2	0x2825	82801H SATA Controller
-product INTEL C610_SATA_RAID_3	0x2826	C61x/X99 SATA Controller (RAID)
+product INTEL C610_SATA_RAID_3	0x2826	C61x/X99/[ZQH]270 SATA Controller (RAID)
 product INTEL C610_SSATA_RAID_2	0x2827	C61x/X99 sSATA Controller (RAID)
 product INTEL 82801HEM_SATA	0x2828	82801HEM SATA Controller
 product INTEL 82801HBM_SATA_AHCI 0x2829  82801HBM AHCI SATA Controller
@@ -4531,6 +4531,62 @@ product INTEL 100SERIES_PCIE_18	0xa168	1
 product INTEL 100SERIES_PCIE_19	0xa169	100 Series PCIE
 product INTEL 100SERIES_PCIE_20	0xa16a	100 Series PCIE
 product INTEL 100SERIES_HDA	0xa170	100 Series HD Audio
+product INTEL 2HS_AHCI		0xa282	200 Series SATA (AHCI)
+product INTEL 2HS_RAID		0xa286	200 Series SATA (RAID)
+product INTEL 2HS_RAID_RST_OPTANE 0xa28e 200 Series SATA (Acceleration with Optane)
+product INTEL 2HS_PCIE_1	0xa290	200 Series PCIE
+product INTEL 2HS_PCIE_2	0xa291	200 Series PCIE
+product INTEL 2HS_PCIE_3	0xa292	200 Series PCIE
+product INTEL 2HS_PCIE_4	0xa293	200 Series PCIE
+product INTEL 2HS_PCIE_5	0xa294	200 Series PCIE
+product INTEL 2HS_PCIE_6	0xa295	200 Series PCIE
+product INTEL 2HS_PCIE_7	0xa296	200 Series PCIE
+product INTEL 2HS_PCIE_8	0xa297	200 Series PCIE
+product INTEL 2HS_PCIE_9	0xa298	200 Series PCIE
+product INTEL 2HS_PCIE_10	0xa299	200 Series PCIE
+product INTEL 2HS_PCIE_11	0xa29a	200 Series PCIE
+product INTEL 2HS_PCIE_12	0xa29b	200 Series PCIE
+product INTEL 2HS_PCIE_13	0xa29c	200 Series PCIE
+product INTEL 2HS_PCIE_14	0xa29d	200 Series PCIE
+product INTEL 2HS_PCIE_15	0xa29e	200 Series PCIE
+product INTEL 2HS_PCIE_16	0xa29f	200 Series PCIE
+product INTEL 2HS_P2SB		0xa2a0	200 Series P2SB
+product INTEL 2HS_PMC		0xa2a1	200 Series PMC
+product INTEL 2HS_SMB		0xa2a3	200 Series SMBus
+product INTEL 2HS_SPI		0xa2a4	200 Series SPI
+product INTEL 2HS_TRACE		0xa2a6	200 Series Trace Hub
+product INTEL 2HS_UART_0	0xa2a7	200 Series UART 0
+product INTEL 2HS_UART_1	0xa2a8	200 Series UART 1
+product INTEL 2HS_GSPI_0	0xa2a9	200 Series GSPI 0
+product INTEL 2HS_GSPI_1	0xa2aa	200 Series GSPI 1
+product INTEL 2HS_XHCI		0xa2af	200 Series xHCI
+product INTEL 2HS_USBOTG	0xa2b0	200 Series USB (OTG)
+product INTEL 2HS_THERM		0xa2b1	200 Series Thermal
+product INTEL 2HS_ISH		0xa2b5	200 Series ISH
+product INTEL 2HS_MEI_1		0xa2ba	200 Series MEI
+product INTEL 2HS_MEI_2		0xa2bb	200 Series MEI
+product INTEL 2HS_IDER		0xa2bc	200 Series IDER
+product INTEL 2HS_KT		0xa2bd	200 Series KT
+product INTEL 2HS_MEI_3		0xa2be	200 Series MEI
+product INTEL 2HS_LPC_H27	0xa2c4	H270 LPC
+product INTEL 2HS_LPC_Z27	0xa2c5	Z270 LPC
+product INTEL 2HS_LPC_Q27	0xa2c6	Q270 LPC
+product INTEL 2HS_LPC_Q25	0xa2c7	Q250 LPC
+product INTEL 2HS_LPC_B25	0xa2c8	B250 LPC
+product INTEL 2HS_I2C_0		0xa2e0	200 Series I2C 0
+product INTEL 2HS_I2C_1		0xa2e1	200 Series I2C 1
+product INTEL 2HS_I2C_2		0xa2e2	200 Series I2C 2
+product INTEL 2HS_I2C_3		0xa2e3	200 Series I2C 3
+product INTEL 2HS_UART_2	0xa2e6	200 Series UART 2
+product INTEL 2HS_PCIE_17	0xa2e7	200 Series PCIE
+product INTEL 2HS_PCIE_18	0xa2e8	200 Series PCIE
+product INTEL 2HS_PCIE_19	0xa2e9	200 Series 

CVS commit: [netbsd-7] src/sys/dev/usb

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 21:18:03 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: usb_subr.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #1541):
sys/dev/usb/usb_subr.c: revision 1.222
Be more defensive towards malicious USB devices
This avoids potential panics due to 0-sized memory allocation attempts,
which could be triggered by malicious USB devices.
Tested on NetBSD/amd64 with a Sony Xperia X (SailfishOS).
Based on an initial patch by Nick Hudson , thanks!
Fixes PR kern/52383.


To generate a diff of this commit:
cvs rdiff -u -r1.196.4.3 -r1.196.4.4 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.196.4.3 src/sys/dev/usb/usb_subr.c:1.196.4.4
--- src/sys/dev/usb/usb_subr.c:1.196.4.3	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/usb_subr.c	Wed Jan  3 21:18:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.196.4.3 2017/04/05 19:54:20 snj Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.196.4.4 2018/01/03 21:18:03 snj Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.3 2017/04/05 19:54:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.4 2018/01/03 21:18:03 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -644,6 +644,10 @@ usbd_set_config_index(struct usbd_device
 		return err;
 	}
 	len = UGETW(cd.wTotalLength);
+	if (len == 0) {
+		DPRINTF("empty short descriptor", 0, 0, 0, 0);
+		return USBD_INVAL;
+	}
 	cdp = kmem_alloc(len, KM_SLEEP);
 	if (cdp == NULL)
 		return USBD_NOMEM;
@@ -672,6 +676,11 @@ usbd_set_config_index(struct usbd_device
 		err = usbd_get_bos_desc(dev, index, );
 		if (!err) {
 			int blen = UGETW(bd.wTotalLength);
+			if (blen == 0) {
+DPRINTF("empty bos descriptor", 0, 0, 0, 0);
+err = USBD_INVAL;
+goto bad;
+			}
 			bdp = kmem_alloc(blen, KM_SLEEP);
 			if (bdp == NULL) {
 err = USBD_NOMEM;
@@ -765,6 +774,11 @@ usbd_set_config_index(struct usbd_device
 
 	/* Allocate and fill interface data. */
 	nifc = cdp->bNumInterface;
+	if (nifc == 0) {
+		DPRINTF("no interfaces", 0, 0, 0, 0);
+		err = USBD_INVAL;
+		goto bad;
+	}
 	dev->ud_ifaces = kmem_alloc(nifc * sizeof(struct usbd_interface),
 	KM_SLEEP);
 	if (dev->ud_ifaces == NULL) {



CVS commit: [netbsd-7] src/sys/dev/usb

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 20:00:23 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: if_urtwn.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1528):
sys/dev/usb/if_urtwn.c: revision 1.55
PR/52702 Malicious USB devices attaching as urtwn(4) can corrupt kernel memory
Patch from PR slighly updated by me


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.1 -r1.34.2.2 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.34.2.1 src/sys/dev/usb/if_urtwn.c:1.34.2.2
--- src/sys/dev/usb/if_urtwn.c:1.34.2.1	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/usb/if_urtwn.c	Wed Jan  3 20:00:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.34.2.1 2017/04/05 19:54:19 snj Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.34.2.2 2018/01/03 20:00:23 snj Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.2 2018/01/03 20:00:23 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -588,8 +588,8 @@ static int
 urtwn_open_pipes(struct urtwn_softc *sc)
 {
 	/* Bulk-out endpoints addresses (from highest to lowest prio). */
-	static uint8_t epaddr[3];
-	static uint8_t rxepaddr[3];
+	static uint8_t epaddr[R92C_MAX_EPOUT];
+	static uint8_t rxepaddr[R92C_MAX_EPIN];
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
 	size_t i, ntx = 0, nrx = 0;
@@ -601,26 +601,32 @@ urtwn_open_pipes(struct urtwn_softc *sc)
 	id = usbd_get_interface_descriptor(sc->sc_iface);
 	for (i = 0; i < id->bNumEndpoints; i++) {
 		ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
-		if (ed != NULL &&
-		UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK &&
-		UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) {
-			epaddr[ntx] = ed->bEndpointAddress;
+		if (ed == NULL || UE_GET_XFERTYPE(ed->bmAttributes) != UE_BULK) {
+			continue;
+		}
+		if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) {
+			if (ntx < sizeof(epaddr))
+epaddr[ntx] = ed->bEndpointAddress;
 			ntx++;
 		}
-		if (ed != NULL &&
-		UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK &&
-		UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) {
-			rxepaddr[nrx] = ed->bEndpointAddress;
+		if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) {
+			if (nrx < sizeof(rxepaddr))
+rxepaddr[nrx] = ed->bEndpointAddress;
 			nrx++;
 		}
 	}
-	DPRINTFN(DBG_INIT, ("%s: %s: found %zd bulk-out pipes\n",
-	device_xname(sc->sc_dev), __func__, ntx));
+	if (nrx == 0 || nrx > R92C_MAX_EPIN) {
+		aprint_error_dev(sc->sc_dev,
+		"%zd: invalid number of Rx bulk pipes\n", nrx);
+		return EIO;
+	}
 	if (ntx == 0 || ntx > R92C_MAX_EPOUT) {
 		aprint_error_dev(sc->sc_dev,
 		"%zd: invalid number of Tx bulk pipes\n", ntx);
 		return EIO;
 	}
+	DPRINTFN(DBG_INIT, ("%s: %s: found %zd/%zd bulk-in/out pipes\n",
+	device_xname(sc->sc_dev), __func__, nrx, ntx));
 	sc->rx_npipe = nrx;
 	sc->tx_npipe = ntx;
 



CVS commit: [netbsd-7] src/sys/dev/usb

2018-01-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan  3 19:48:46 UTC 2018

Modified Files:
src/sys/dev/usb [netbsd-7]: xhci.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1526):
sys/dev/usb/xhci.c: revision 1.76
Wait 1ms first. Existing Intel xHCI requies 1ms delay to prevent system hang
(Errata).


To generate a diff of this commit:
cvs rdiff -u -r1.23.2.5 -r1.23.2.6 src/sys/dev/usb/xhci.c

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.23.2.5 src/sys/dev/usb/xhci.c:1.23.2.6
--- src/sys/dev/usb/xhci.c:1.23.2.5	Wed Apr  5 19:54:21 2017
+++ src/sys/dev/usb/xhci.c	Wed Jan  3 19:48:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.23.2.5 2017/04/05 19:54:21 snj Exp $	*/
+/*	$NetBSD: xhci.c,v 1.23.2.6 2018/01/03 19:48:45 snj Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.5 2017/04/05 19:54:21 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.6 2018/01/03 19:48:45 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -689,10 +689,14 @@ xhci_hc_reset(struct xhci_softc * const 
 	usbcmd = XHCI_CMD_HCRST;
 	xhci_op_write_4(sc, XHCI_USBCMD, usbcmd);
 	for (i = 0; i < XHCI_WAIT_HCRST; i++) {
+		/*
+		 * Wait 1ms first. Existing Intel xHCI requies 1ms delay to
+		 * prevent system hang (Errata).
+		 */
+		usb_delay_ms(>sc_bus, 1);
 		usbcmd = xhci_op_read_4(sc, XHCI_USBCMD);
 		if ((usbcmd & XHCI_CMD_HCRST) == 0)
 			break;
-		usb_delay_ms(>sc_bus, 1);
 	}
 	if (i >= XHCI_WAIT_HCRST) {
 		aprint_error_dev(sc->sc_dev, "host controller reset timeout\n");



CVS commit: [netbsd-7] src/sys/dev/sysmon

2017-10-24 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Oct 24 09:25:26 UTC 2017

Modified Files:
src/sys/dev/sysmon [netbsd-7]: sysmon_envsys.c

Log Message:
Fix fallout from ticket #1511:
It's rnd_detach_source, not rnd_detach_sources.


To generate a diff of this commit:
cvs rdiff -u -r1.127.2.2 -r1.127.2.3 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.2 src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.3
--- src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.2	Mon Oct 23 18:57:12 2017
+++ src/sys/dev/sysmon/sysmon_envsys.c	Tue Oct 24 09:25:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.127.2.2 2017/10/23 18:57:12 snj Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.127.2.3 2017/10/24 09:25:26 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.2 2017/10/23 18:57:12 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.3 2017/10/24 09:25:26 snj Exp $");
 
 #include 
 #include 
@@ -1210,7 +1210,7 @@ sme_remove_userprops(void)
 			 * Detach from entropy collection
 			 */
 			if (edata->flags & ENVSYS_FHAS_ENTROPY)
-rnd_detach_sources(>rnd_src);
+rnd_detach_source(>rnd_src);
 
 			/*
 			 * Finally, remove any old limits event, then



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

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:27:45 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: cgd.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #1518):
sys/dev/cgd.c: revision 1.113
PR kern/52630: The cgd(4) module requires des and blowfish symbols
This has been exposed with the MODULAR kernel.
kobj_checksyms, 979: [cgd]: linker error: symbol `BF_set_key' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_key_sched' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_ede3_cbc_encrypt' not 
found
WARNING: module error: unable to affix module `cgd', error 8
Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.90.2.2 -r1.90.2.3 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.90.2.2 src/sys/dev/cgd.c:1.90.2.3
--- src/sys/dev/cgd.c:1.90.2.2	Sat Jul  8 16:14:19 2017
+++ src/sys/dev/cgd.c	Mon Oct 23 19:27:44 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.90.2.2 2017/07/08 16:14:19 snj Exp $ */
+/* $NetBSD: cgd.c,v 1.90.2.3 2017/10/23 19:27:44 snj Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.2 2017/07/08 16:14:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.3 2017/10/23 19:27:44 snj Exp $");
 
 #include 
 #include 
@@ -998,7 +998,7 @@ hexprint(const char *start, void *buf, i
 }
 #endif
 
-MODULE(MODULE_CLASS_DRIVER, cgd, "dk_subr");
+MODULE(MODULE_CLASS_DRIVER, cgd, "blowfish,des,dk_subr");
 
 #ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);



CVS commit: [netbsd-7] src/sys/dev/usb

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:15:09 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: if_athn_usb.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1515):
sys/dev/usb/if_athn_usb.c: revision 1.23
PR/52553 Panic on "ifconfig athn0 up"
Don't race for a transfer in athn_usb_init on the free list for beacons.
Instead pre-assign a transfer to beacons in athn_usb_alloc_tx_list


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/dev/usb/if_athn_usb.c

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

Modified files:

Index: src/sys/dev/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.6.6.1 src/sys/dev/usb/if_athn_usb.c:1.6.6.2
--- src/sys/dev/usb/if_athn_usb.c:1.6.6.1	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/usb/if_athn_usb.c	Mon Oct 23 19:15:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.6.6.1 2017/04/05 19:54:19 snj Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -733,9 +733,15 @@ athn_usb_alloc_tx_list(struct athn_usb_s
 		/* Append this Tx buffer to our free list. */
 		TAILQ_INSERT_TAIL(>usc_tx_free_list, data, next);
 	}
-	if (error != 0)
+	if (error == 0) {
+		/* Steal one buffer for beacons. */
+		usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list);
+		TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next);
+	} else {
 		athn_usb_free_tx_list(usc);
+	}
 	mutex_exit(>usc_tx_mtx);
+
 	return error;
 }
 
@@ -754,6 +760,10 @@ athn_usb_free_tx_list(struct athn_usb_so
 		if (xfer != NULL)
 			usbd_destroy_xfer(xfer);
 	}
+	if (usc->usc_tx_bcn) {
+		usbd_destroy_xfer(usc->usc_tx_bcn->xfer);
+		usc->usc_tx_bcn = NULL;
+	}
 }
 
 Static int
@@ -2761,12 +2771,6 @@ athn_usb_init_locked(struct ifnet *ifp)
 	usc->usc_cmdq.cur = usc->usc_cmdq.next = usc->usc_cmdq.queued = 0;
 	mutex_spin_exit(>usc_task_mtx);
 
-	/* Steal one buffer for beacons. */
-	mutex_enter(>usc_tx_mtx);
-	usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list);
-	TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next);
-	mutex_exit(>usc_tx_mtx);
-
 	curchan = ic->ic_curchan;
 	extchan = NULL;
 



CVS commit: [netbsd-7] src/sys/dev/sysmon

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:57:12 UTC 2017

Modified Files:
src/sys/dev/sysmon [netbsd-7]: sysmon_envsys.c

Log Message:
Apply patch (requested by pgoyette in ticket #1511):
Detach the rndsrc before re-attaching it.


To generate a diff of this commit:
cvs rdiff -u -r1.127.2.1 -r1.127.2.2 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1 src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.2
--- src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1	Mon Apr  6 18:45:30 2015
+++ src/sys/dev/sysmon/sysmon_envsys.c	Mon Oct 23 18:57:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.127.2.2 2017/10/23 18:57:12 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.2 2017/10/23 18:57:12 snj Exp $");
 
 #include 
 #include 
@@ -1207,6 +1207,12 @@ sme_remove_userprops(void)
 			}
 
 			/*
+			 * Detach from entropy collection
+			 */
+			if (edata->flags & ENVSYS_FHAS_ENTROPY)
+rnd_detach_sources(>rnd_src);
+
+			/*
 			 * Finally, remove any old limits event, then
 			 * install a new event (which will update the
 			 * dictionary)



CVS commit: [netbsd-7] src/sys/dev/usb

2017-10-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Oct 13 08:11:20 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: uhidev.c ukbd.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1503):
sys/dev/usb/uhidev.c: revision 1.71
sys/dev/usb/ukbd.c: revision 1.137-1.138
Fix memory leak in report parsing error paths.
--
Support more varieties of USB keyboard reports.
The previous code asssumed reports would closely match the Bootstrap
Keyboard Protocol.  This is no longer always the case, particularly
with higher-end keyboards.
--
Always try to set USB HID devices into Report Protocol.  (Unless the
device is known to be quirky.)
Some of the most-widely-compatible methods of implementing USB Keyboard
NKRO depend on this Request to function as designed.
Issuing this Request is recommended by the HID 1.11 spec (7.2.6):
... "the host should not make any assumptions about the device's state
and should set the desired protocol whenever initializing a device."


To generate a diff of this commit:
cvs rdiff -u -r1.61.2.3 -r1.61.2.4 src/sys/dev/usb/uhidev.c
cvs rdiff -u -r1.129.4.2 -r1.129.4.3 src/sys/dev/usb/ukbd.c

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

Modified files:

Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.61.2.3 src/sys/dev/usb/uhidev.c:1.61.2.4
--- src/sys/dev/usb/uhidev.c:1.61.2.3	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/uhidev.c	Fri Oct 13 08:11:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhidev.c,v 1.61.2.3 2017/04/05 19:54:20 snj Exp $	*/
+/*	$NetBSD: uhidev.c,v 1.61.2.4 2017/10/13 08:11:20 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.61.2.3 2017/04/05 19:54:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.61.2.4 2017/10/13 08:11:20 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -152,12 +152,9 @@ uhidev_attach(device_t parent, device_t 
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
 	(void)usbd_set_idle(iface, 0, 0);
-#if 0
 
-	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0 &&
-	id->bInterfaceSubClass != UISUBCLASS_BOOT)
+	if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0)
 		(void)usbd_set_protocol(iface, 1);
-#endif
 
 	maxinpktsize = 0;
 	sc->sc_iep_addr = sc->sc_oep_addr = -1;

Index: src/sys/dev/usb/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.129.4.2 src/sys/dev/usb/ukbd.c:1.129.4.3
--- src/sys/dev/usb/ukbd.c:1.129.4.2	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/ukbd.c	Fri Oct 13 08:11:20 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: ukbd.c,v 1.129.4.2 2017/04/05 19:54:20 snj Exp $*/
+/*  $NetBSD: ukbd.c,v 1.129.4.3 2017/10/13 08:11:20 snj Exp $*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.129.4.2 2017/04/05 19:54:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.129.4.3 2017/10/13 08:11:20 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -83,12 +83,11 @@ int	ukbddebug = 0;
 #define DPRINTFN(n,x)
 #endif
 
-#define MAXKEYCODE 6
-#define MAXMOD 8		/* max 32 */
+#define MAXKEYCODE 32
+#define MAXKEYS 256
 
 struct ukbd_data {
-	uint32_t	modifiers;
-	uint8_t		keycode[MAXKEYCODE];
+	uint8_t		keys[MAXKEYS/NBBY];
 };
 
 #define PRESS0x000
@@ -234,19 +233,14 @@ Static const uint8_t ukbd_trtab[256] = {
 
 #define KEY_ERROR 0x01
 
-#define MAXKEYS (MAXMOD+2*MAXKEYCODE)
-
 struct ukbd_softc {
 	struct uhidev sc_hdev;
 
 	struct ukbd_data sc_ndata;
 	struct ukbd_data sc_odata;
-	struct hid_location sc_modloc[MAXMOD];
-	u_int sc_nmod;
-	struct {
-		uint32_t mask;
-		uint8_t key;
-	} sc_mods[MAXMOD];
+	struct hid_location sc_keyloc[MAXKEYS];
+	uint8_t sc_keyuse[MAXKEYS];
+	u_int sc_nkeyloc;
 
 	struct hid_location sc_keycodeloc;
 	u_int sc_nkeycode;
@@ -307,15 +301,17 @@ void ukbdtracedump(void);
 void
 ukbdtracedump(void)
 {
-	int i;
+	size_t i, j;
 	for (i = 0; i < UKBDTRACESIZE; i++) {
 		struct ukbdtraceinfo *p =
 		[(i+ukbdtraceindex)%UKBDTRACESIZE];
-		printf("%"PRIu64".%06"PRIu64": mod=0x%02x key0=0x%02x key1=0x%02x "
-		   "key2=0x%02x key3=0x%02x\n",
-		   p->tv.tv_sec, (uint64_t)p->tv.tv_usec,
-		   p->ud.modifiers, p->ud.keycode[0], p->ud.keycode[1],
-		   p->ud.keycode[2], p->ud.keycode[3]);
+		printf("%"PRIu64".%06"PRIu64":", p->tv.tv_sec,
+		(uint64_t)p->tv.tv_usec);
+		for (j = 0; j < MAXKEYS; j++) {
+			if (isset(p->ud.keys, j))
+printf(" %zu", j);
+		}
+		printf(".\n");
 	}
 }
 #endif
@@ -438,7 +434,7 @@ ukbd_attach(device_t parent, device_t se
 #endif
 
 #ifdef DIAGNOSTIC
-	aprint_normal(": %d modifier keys, %d key codes", sc->sc_nmod,
+	aprint_normal(": %d Variable keys, %d Array codes", sc->sc_nkeyloc,
 	   sc->sc_nkeycode);
 	if (sc->sc_flags & FLAG_APPLE_FN)
 		aprint_normal(", apple fn key");

CVS commit: [netbsd-7] src/sys/dev/usb

2017-10-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Oct  1 17:12:41 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: usb.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1502):
sys/dev/usb/usb.c: revision 1.166
Add a missing break that should have been included in revision 1.163.
Spotted by "sc dying" and reported on current-users


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

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

Modified files:

Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.154.2.2 src/sys/dev/usb/usb.c:1.154.2.3
--- src/sys/dev/usb/usb.c:1.154.2.2	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/usb.c	Sun Oct  1 17:12:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.154.2.2 2017/04/05 19:54:20 snj Exp $	*/
+/*	$NetBSD: usb.c,v 1.154.2.3 2017/10/01 17:12:41 snj Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.154.2.2 2017/04/05 19:54:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.154.2.3 2017/10/01 17:12:41 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -775,6 +775,7 @@ usbioctl(dev_t devt, u_long cmd, void *d
 			len = UGETW(ur->ucr_request.wLength);
 			kmem_free(ptr, len);
 		}
+		break;
 	}
 
 	case USB_DEVICEINFO:



CVS commit: [netbsd-7] src/sys/dev/pci/hdaudio

2017-09-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Sep  4 06:10:30 UTC 2017

Modified Files:
src/sys/dev/pci/hdaudio [netbsd-7]: hdafg.c hdafg_dd.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1492):
sys/dev/hdaudio/hdafg.c: revision 1.13 (s,hdaudio,pci/hdaudio,)
sys/dev/hdaudio/hdafg_dd.c: revision 1.2 (s,hdaudio,pci/hdaudio,)
put all the ELD debugging messages under #ifdef HDAFG_HDMI_DEBUG.
this silences a frequent and largely useless series of messages
in my dmesg.  ok jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/sys/dev/pci/hdaudio/hdafg.c
cvs rdiff -u -r1.2 -r1.2.14.1 src/sys/dev/pci/hdaudio/hdafg_dd.c

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdafg.c
diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.21.2.1 src/sys/dev/pci/hdaudio/hdafg.c:1.21.2.2
--- src/sys/dev/pci/hdaudio/hdafg.c:1.21.2.1	Fri Sep  4 15:07:08 2015
+++ src/sys/dev/pci/hdaudio/hdafg.c	Mon Sep  4 06:10:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.21.2.1 2015/09/04 15:07:08 martin Exp $ */
+/* $NetBSD: hdafg.c,v 1.21.2.2 2017/09/04 06:10:30 snj Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21.2.1 2015/09/04 15:07:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21.2.2 2017/09/04 06:10:30 snj Exp $");
 
 #include 
 #include 
@@ -874,15 +874,19 @@ hdafg_assoc_dump_dd(struct hdafg_softc *
 			res = (*cmd)(sc->sc_codec, as->as_pins[pin],
 			CORB_GET_HDMI_ELD_DATA, i);
 			if (!(res & COP_ELD_VALID)) {
+#ifdef HDAFG_HDMI_DEBUG
 hda_error(sc, "bad ELD size (%u/%u)\n",
 i, elddatalen);
+#endif
 break;
 			}
 			elddata[i] = COP_ELD_DATA(res);
 		}
 
 		if (hdafg_dd_parse_info(elddata, elddatalen, ) != 0) {
+#ifdef HDAFG_HDMI_DEBUG
 			hda_error(sc, "failed to parse ELD data\n");
+#endif
 			return;
 		}
 
@@ -4260,7 +4264,9 @@ hdafg_unsol(device_t self, uint8_t tag)
 
 	switch (tag) {
 	case HDAUDIO_UNSOLTAG_EVENT_DD:
+#ifdef HDAFG_HDMI_DEBUG
 		hda_print(sc, "unsol: display device hotplug\n");
+#endif
 		for (i = 0; i < sc->sc_nassocs; i++) {
 			if (as[i].as_displaydev == false)
 continue;
@@ -4272,7 +4278,9 @@ hdafg_unsol(device_t self, uint8_t tag)
 		}
 		break;
 	default:
+#ifdef HDAFG_HDMI_DEBUG
 		hda_print(sc, "unsol: tag=%u\n", tag);
+#endif
 		break;
 	}
 

Index: src/sys/dev/pci/hdaudio/hdafg_dd.c
diff -u src/sys/dev/pci/hdaudio/hdafg_dd.c:1.2 src/sys/dev/pci/hdaudio/hdafg_dd.c:1.2.14.1
--- src/sys/dev/pci/hdaudio/hdafg_dd.c:1.2	Wed Aug 29 18:52:31 2012
+++ src/sys/dev/pci/hdaudio/hdafg_dd.c	Mon Sep  4 06:10:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg_dd.c,v 1.2 2012/08/29 18:52:31 dholland Exp $ */
+/* $NetBSD: hdafg_dd.c,v 1.2.14.1 2017/09/04 06:10:30 snj Exp $ */
 
 /*
  * Copyright (c) 2011 Jared D. McNeill 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg_dd.c,v 1.2 2012/08/29 18:52:31 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg_dd.c,v 1.2.14.1 2017/09/04 06:10:30 snj Exp $");
 
 #include 
 #include 
@@ -51,12 +51,16 @@ hdafg_dd_parse_info(uint8_t *data, size_
 	struct eld_baseline_block *block = >eld;
 	unsigned int i;
 
+#ifdef HDAFG_HDMI_DEBUG
 	printf("hdafg_dd_parse_info: datalen=%u\n", (unsigned int)datalen);
+#endif
 
 	memset(hdi, 0, sizeof(*hdi));
 
 	if (datalen < sizeof(block->header)) {
+#ifdef HDAFG_HDMI_DEBUG
 		printf(" no room for header\n");
+#endif
 		return EINVAL;
 	}
 
@@ -66,7 +70,9 @@ hdafg_dd_parse_info(uint8_t *data, size_
 
 	if (datalen < block->header.baseline_eld_len * 4 ||
 	datalen < sizeof(*block) - sizeof(block->header)) {
+#ifdef HDAFG_HDMI_DEBUG
 		printf(" ack!\n");
+#endif
 		return EINVAL;
 	}
 
@@ -77,7 +83,9 @@ hdafg_dd_parse_info(uint8_t *data, size_
 	datalen -= sizeof(*block) - sizeof(block->header);
 
 	if (datalen < ELD_MNL(block)) {
+#ifdef HDAFG_HDMI_DEBUG
 		printf(" MNL=%u\n", ELD_MNL(block));
+#endif
 		return EINVAL;
 	}
 
@@ -86,10 +94,12 @@ hdafg_dd_parse_info(uint8_t *data, size_
 	datalen -= ELD_MNL(block);
 
 	if (datalen != ELD_SAD_COUNT(block) * sizeof(hdi->sad[0])) {
+#ifdef HDAFG_HDMI_DEBUG
 		printf(" datalen %u sadcount %u sizeof sad %u\n",
 		(unsigned int)datalen,
 		ELD_SAD_COUNT(block),
 		(unsigned int)sizeof(hdi->sad[0]));
+#endif
 		return EINVAL;
 	}
 	hdi->nsad = ELD_SAD_COUNT(block);
@@ -99,7 +109,9 @@ hdafg_dd_parse_info(uint8_t *data, size_
 		datalen -= sizeof(hdi->sad[i]);
 	}
 
+#ifdef HDAFG_HDMI_DEBUG
 	printf("datalen = %u\n", (unsigned int)datalen);
+#endif
 	KASSERT(datalen == 0);
 
 	return 0;



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

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 19 05:19:32 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: vnd.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1476):
sys/dev/vnd.c: revision 1.260, 1.262 via patch
Put in a litany of judicious bounds checks around vnd headers.
Thought I was done with this crap after I rewrote vndcompress(1)!
>From Ilja Van Sprundel.
--
Appease toxic bullshit warning from gcc.
If you have a better way to write a useful bounds check that happens
to always pass on LP64 but doesn't always on LP32, without making it
fail to compile on LP64 or making it an #ifdef conditional on LP32,
please put it in here instead.


To generate a diff of this commit:
cvs rdiff -u -r1.232.2.4 -r1.232.2.5 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.232.2.4 src/sys/dev/vnd.c:1.232.2.5
--- src/sys/dev/vnd.c:1.232.2.4	Wed Nov 18 08:48:46 2015
+++ src/sys/dev/vnd.c	Sat Aug 19 05:19:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.232.2.4 2015/11/18 08:48:46 msaitoh Exp $	*/
+/*	$NetBSD: vnd.c,v 1.232.2.5 2017/08/19 05:19:31 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.232.2.4 2015/11/18 08:48:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.232.2.5 2017/08/19 05:19:31 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1238,6 +1238,13 @@ vndioctl(dev_t dev, u_long cmd, void *da
 VOP_UNLOCK(nd.ni_vp);
 goto close_and_exit;
 			}
+
+			if (ntohl(ch->block_size) == 0 ||
+			ntohl(ch->num_blocks) > UINT32_MAX - 1) {
+free(ch, M_TEMP);
+VOP_UNLOCK(nd.ni_vp);
+goto close_and_exit;
+			}
  
 			/* save some header info */
 			vnd->sc_comp_blksz = ntohl(ch->block_size);
@@ -1249,20 +1256,40 @@ vndioctl(dev_t dev, u_long cmd, void *da
 error = EINVAL;
 goto close_and_exit;
 			}
-			if (sizeof(struct vnd_comp_header) +
-			  sizeof(u_int64_t) * vnd->sc_comp_numoffs >
-			  vattr.va_size) {
+			KASSERT(0 < vnd->sc_comp_blksz);
+			KASSERT(0 < vnd->sc_comp_numoffs);
+			/*
+			 * @#^@!$& gcc -Wtype-limits refuses to let me
+			 * write SIZE_MAX/sizeof(uint64_t) < numoffs,
+			 * because the range of the type on amd64 makes
+			 * the comparisons always false.
+			 */
+#if SIZE_MAX <= UINT32_MAX*(64/CHAR_BIT)
+			if (SIZE_MAX/sizeof(uint64_t) < vnd->sc_comp_numoffs) {
+VOP_UNLOCK(nd.ni_vp);
+error = EINVAL;
+goto close_and_exit;
+			}
+#endif
+			if ((vattr.va_size < sizeof(struct vnd_comp_header)) ||
+			(vattr.va_size - sizeof(struct vnd_comp_header) <
+sizeof(uint64_t)*vnd->sc_comp_numoffs) ||
+			(UQUAD_MAX/vnd->sc_comp_blksz <
+vnd->sc_comp_numoffs - 1)) {
 VOP_UNLOCK(nd.ni_vp);
 error = EINVAL;
 goto close_and_exit;
 			}
  
 			/* set decompressed file size */
+			KASSERT(vnd->sc_comp_numoffs - 1 <=
+			UQUAD_MAX/vnd->sc_comp_blksz);
 			vattr.va_size =
 			((u_quad_t)vnd->sc_comp_numoffs - 1) *
 			 (u_quad_t)vnd->sc_comp_blksz;
  
 			/* allocate space for all the compressed offsets */
+			__CTASSERT(UINT32_MAX <= UQUAD_MAX/sizeof(uint64_t));
 			vnd->sc_comp_offsets =
 			malloc(sizeof(u_int64_t) * vnd->sc_comp_numoffs,
 			M_DEVBUF, M_WAITOK);



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

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 04:29:22 UTC 2017

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.32.4.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.32 src/sys/dev/ic/ciss.c:1.32.4.1
--- src/sys/dev/ic/ciss.c:1.32	Thu Oct 17 21:24:24 2013
+++ src/sys/dev/ic/ciss.c	Sat Aug 12 04:29:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.32 2013/10/17 21:24:24 christos Exp $	*/
+/*	$NetBSD: ciss.c,v 1.32.4.1 2017/08/12 04:29:22 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.32 2013/10/17 21:24:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.32.4.1 2017/08/12 04:29:22 snj Exp $");
 
 #include "bio.h"
 
@@ -1274,12 +1274,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;
 		}
@@ -1380,7 +1380,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-7] src/sys/dev/ic

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 04:23:41 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1482):
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.86 -r1.86.14.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.86 src/sys/dev/ic/isp_netbsd.c:1.86.14.1
--- src/sys/dev/ic/isp_netbsd.c:1.86	Tue Aug 21 15:53:07 2012
+++ src/sys/dev/ic/isp_netbsd.c	Sat Aug 12 04:23:41 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.86 2012/08/21 15:53:07 bouyer Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.86.14.1 2017/08/12 04:23:41 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.86 2012/08/21 15:53:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.86.14.1 2017/08/12 04:23:41 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-7] src/sys/dev/ic

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 03:48:49 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1474):
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.24.4.1 -r1.24.4.2 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.24.4.1 src/sys/dev/ic/bwi.c:1.24.4.2
--- src/sys/dev/ic/bwi.c:1.24.4.1	Tue Apr 21 04:55:15 2015
+++ src/sys/dev/ic/bwi.c	Sat Aug 12 03:48:49 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.24.4.1 2015/04/21 04:55:15 snj Exp $	*/
+/*	$NetBSD: bwi.c,v 1.24.4.2 2017/08/12 03:48:49 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.24.4.1 2015/04/21 04:55:15 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.24.4.2 2017/08/12 03:48:49 snj Exp $");
 
 #include 
 #include 
@@ -8292,7 +8292,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-7] src/sys/dev/ic

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 03:45:15 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1473):
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.4.22.1 -r1.4.22.2 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.4.22.1 src/sys/dev/ic/dm9000.c:1.4.22.2
--- src/sys/dev/ic/dm9000.c:1.4.22.1	Fri Jan  2 20:24:14 2015
+++ src/sys/dev/ic/dm9000.c	Sat Aug 12 03:45:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.4.22.1 2015/01/02 20:24:14 martin Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.4.22.2 2017/08/12 03:45:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -1122,8 +1122,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-7] src/sys/dev/ic

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 03:42:52 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1472):
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.36 -r1.36.4.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.36 src/sys/dev/ic/dp83932.c:1.36.4.1
--- src/sys/dev/ic/dp83932.c:1.36	Fri Oct 25 21:29:28 2013
+++ src/sys/dev/ic/dp83932.c	Sat Aug 12 03:42:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp83932.c,v 1.36 2013/10/25 21:29:28 martin Exp $	*/
+/*	$NetBSD: dp83932.c,v 1.36.4.1 2017/08/12 03:42:52 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.36 2013/10/25 21:29:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.36.4.1 2017/08/12 03:42:52 snj Exp $");
 
 
 #include 
@@ -785,8 +785,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-7] src/sys/dev/ic

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 03:30:30 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1471):
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.31.4.1 -r1.31.4.2 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.31.4.1 src/sys/dev/ic/i82596.c:1.31.4.2
--- src/sys/dev/ic/i82596.c:1.31.4.1	Sat Feb 21 19:27:49 2015
+++ src/sys/dev/ic/i82596.c	Sat Aug 12 03:30:30 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.31.4.1 2015/02/21 19:27:49 martin Exp $ */
+/* $NetBSD: i82596.c,v 1.31.4.2 2017/08/12 03:30:30 snj Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.31.4.1 2015/02/21 19:27:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.31.4.2 2017/08/12 03:30:30 snj Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -754,6 +754,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;
 			}
@@ -763,6 +764,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;
@@ -778,6 +780,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;
 			}
@@ -927,6 +930,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;
 			}
@@ -940,6 +944,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;
 			}
@@ -949,6 +954,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-7] src/sys/dev/pci

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 03:27:49 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: if_et.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.8.4.1 -r1.8.4.2 src/sys/dev/pci/if_et.c

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

Modified files:

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.8.4.1 src/sys/dev/pci/if_et.c:1.8.4.2
--- src/sys/dev/pci/if_et.c:1.8.4.1	Tue Aug  4 21:16:43 2015
+++ src/sys/dev/pci/if_et.c	Sat Aug 12 03:27:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.8.4.1 2015/08/04 21:16:43 snj Exp $	*/
+/*	$NetBSD: if_et.c,v 1.8.4.2 2017/08/12 03:27:48 snj Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.8.4.1 2015/08/04 21:16:43 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.8.4.2 2017/08/12 03:27:48 snj Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -2028,6 +2028,10 @@ et_newbuf(struct et_rxbuf_data *rbd, int
 		if (m == NULL)
 			return (ENOBUFS);
 		MCLGET(m, init ? M_WAITOK : M_DONTWAIT);
+		if ((m->m_flags & M_EXT) == 0) {
+			m_freem(m);
+			return (ENOBUFS);
+		}
 		len = MCLBYTES;
 	} else {
 		MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA);



CVS commit: [netbsd-7] src/sys/dev/pci

2017-08-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 12 03:24:03 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: if_ipw.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1469):
sys/dev/pci/if_ipw.c: revision 1.65
Null out sbuf->m on failure to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sbuf->map out of paranoia.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.4.1 src/sys/dev/pci/if_ipw.c

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

Modified files:

Index: src/sys/dev/pci/if_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.57 src/sys/dev/pci/if_ipw.c:1.57.4.1
--- src/sys/dev/pci/if_ipw.c:1.57	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_ipw.c	Sat Aug 12 03:24:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.57 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.57.4.1 2017/08/12 03:24:03 snj Exp $	*/
 /*	FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp 	*/
 
 /*-
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.57 2014/03/29 19:28:24 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.57.4.1 2017/08/12 03:24:03 snj Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -592,6 +592,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		MCLGET(sbuf->m, M_DONTWAIT);
 		if (!(sbuf->m->m_flags & M_EXT)) {
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf cluster\n");
 			error = ENOMEM;
 			goto fail;
@@ -604,6 +605,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		if (error != 0) {
 			aprint_error_dev(sc->sc_dev, "could not create rxbuf dma map\n");
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			goto fail;
 		}
 
@@ -611,7 +613,9 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		sbuf->m, BUS_DMA_READ | BUS_DMA_NOWAIT);
 		if (error != 0) {
 			bus_dmamap_destroy(sc->sc_dmat, sbuf->map);
+			sbuf->map = NULL;
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			aprint_error_dev(sc->sc_dev, "could not map rxbuf dma memory\n");
 			goto fail;
 		}



CVS commit: [netbsd-7] src/sys/dev/hpc

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:48:57 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1465):
sys/dev/hpc/hpckbd.c: revision 1.32
XXX: On hpcsh only - bring back old incorrect hpckbd_keymap_setup()
fixed in 1.31.  The old one with UNCONST does work on hpcsh b/c the
kernel is directly mapped.  The new one does not work on hpcsh b/c it
calls consinit() very early when malloc() is not yet available.
The real fix for this is to fix the constness of wscons keymap
structures that is self-contradictory.


To generate a diff of this commit:
cvs rdiff -u -r1.30.12.1 -r1.30.12.2 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30.12.1 src/sys/dev/hpc/hpckbd.c:1.30.12.2
--- src/sys/dev/hpc/hpckbd.c:1.30.12.1	Sun Jul 23 06:05:36 2017
+++ src/sys/dev/hpc/hpckbd.c	Wed Aug  9 06:48:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.2 2017/08/09 06:48:57 snj Exp $");
 
 #include 
 #include 
@@ -260,6 +260,40 @@ hpckbd_getevent(struct hpckbd_core* hc, 
 	return (1);
 }
 
+
+#ifdef hpcsh
+/*
+ * XXX: Use the old wrong code for now as hpcsh attaches console very
+ * early and it's convenient to be able to do early DDB on wscons.
+ */
+void
+hpckbd_keymap_setup(struct hpckbd_core *hc,
+		const keysym_t *map, int mapsize)
+{
+	int i;
+	struct wscons_keydesc *desc;
+
+	/* fix keydesc table */
+	/* 
+	 * XXX The way this is done is really wrong.  The __UNCONST()
+	 * is a hint as to what is wrong.  This actually ends up modifying
+	 * initialized data which is marked "const".
+	 * The reason we get away with it here is that on sh3 kernel
+	 * is directly mapped.
+	 */
+	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+	for (i = 0; desc[i].name != 0; i++) {
+		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
+			desc[i].map = map;
+			desc[i].map_size = mapsize;
+		}
+	}
+
+	return;
+}
+
+#else
+
 void
 hpckbd_keymap_setup(struct hpckbd_core *hc,
 		const keysym_t *map, int mapsize)
@@ -294,6 +328,7 @@ hpckbd_keymap_setup(struct hpckbd_core *
 
 	return;
 }
+#endif
 
 void
 hpckbd_keymap_lookup(struct hpckbd_core *hc)



CVS commit: [netbsd-7] src/sys/dev/usb

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:34:53 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: if_ural.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1462):
sys/dev/usb/if_ural.c: revision 1.52
Free the RX list if ural_alloc_rx_list fails part way through.
Reported by Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.44.12.1 -r1.44.12.2 src/sys/dev/usb/if_ural.c

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

Modified files:

Index: src/sys/dev/usb/if_ural.c
diff -u src/sys/dev/usb/if_ural.c:1.44.12.1 src/sys/dev/usb/if_ural.c:1.44.12.2
--- src/sys/dev/usb/if_ural.c:1.44.12.1	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/usb/if_ural.c	Wed Aug  9 06:34:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ural.c,v 1.44.12.1 2017/04/05 19:54:19 snj Exp $ */
+/*	$NetBSD: if_ural.c,v 1.44.12.2 2017/08/09 06:34:53 snj Exp $ */
 /*	$FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $	*/
 
 /*-
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.12.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.12.2 2017/08/09 06:34:53 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -652,7 +652,7 @@ ural_alloc_rx_list(struct ural_softc *sc
 
 	return 0;
 
-fail:	ural_free_tx_list(sc);
+fail:	ural_free_rx_list(sc);
 	return error;
 }
 



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

2017-08-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Aug  9 06:22:07 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: auconv.c
src/sys/dev/ic [netbsd-7]: ac97.c
src/sys/dev/pci [netbsd-7]: azalia_codec.c

Log Message:
Pull up following revision(s) (requested by nat in ticket #1460):
sys/dev/auconv.c: revision 1.30 via patch
sys/dev/ic/ac97.c: revision 1.97 via patch
sys/dev/pci/azalia_codec.c: revision 1.81 via patch
Mixer device bounds checking.
Analysis by Ilja van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.24.1 src/sys/dev/auconv.c
cvs rdiff -u -r1.95.12.1 -r1.95.12.2 src/sys/dev/ic/ac97.c
cvs rdiff -u -r1.79 -r1.79.24.1 src/sys/dev/pci/azalia_codec.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/auconv.c
diff -u src/sys/dev/auconv.c:1.25 src/sys/dev/auconv.c:1.25.24.1
--- src/sys/dev/auconv.c:1.25	Wed Nov 23 23:07:31 2011
+++ src/sys/dev/auconv.c	Wed Aug  9 06:22:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $	*/
+/*	$NetBSD: auconv.c,v 1.25.24.1 2017/08/09 06:22:06 snj Exp $	*/
 
 /*
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25 2011/11/23 23:07:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auconv.c,v 1.25.24.1 2017/08/09 06:22:06 snj Exp $");
 
 #include 
 #include 
@@ -1162,7 +1162,7 @@ int
 auconv_query_encoding(const struct audio_encoding_set *encodings,
 		  audio_encoding_t *aep)
 {
-	if (aep->index >= encodings->size)
+	if (aep->index < 0 || aep->index >= encodings->size)
 		return EINVAL;
 	strlcpy(aep->name, encodings->items[aep->index].name,
 		MAX_AUDIO_DEV_LEN);

Index: src/sys/dev/ic/ac97.c
diff -u src/sys/dev/ic/ac97.c:1.95.12.1 src/sys/dev/ic/ac97.c:1.95.12.2
--- src/sys/dev/ic/ac97.c:1.95.12.1	Sun Jul  5 20:37:01 2015
+++ src/sys/dev/ic/ac97.c	Wed Aug  9 06:22:06 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $ */
+/*  $NetBSD: ac97.c,v 1.95.12.2 2017/08/09 06:22:06 snj Exp $ */
 /*	$OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $	*/
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.1 2015/07/05 20:37:01 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.95.12.2 2017/08/09 06:22:06 snj Exp $");
 
 #include 
 #include 
@@ -1677,7 +1677,7 @@ ac97_query_devinfo(struct ac97_codec_if 
 	const char *name;
 
 	as = (struct ac97_softc *)codec_if;
-	if (dip->index < as->num_source_info) {
+	if (dip->index >= 0 && dip->index < as->num_source_info) {
 		si = >source_info[dip->index];
 		dip->type = si->type;
 		dip->mixer_class = si->mixer_class;

Index: src/sys/dev/pci/azalia_codec.c
diff -u src/sys/dev/pci/azalia_codec.c:1.79 src/sys/dev/pci/azalia_codec.c:1.79.24.1
--- src/sys/dev/pci/azalia_codec.c:1.79	Wed Nov 23 23:07:35 2011
+++ src/sys/dev/pci/azalia_codec.c	Wed Aug  9 06:22:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $	*/
+/*	$NetBSD: azalia_codec.c,v 1.79.24.1 2017/08/09 06:22:07 snj Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79 2011/11/23 23:07:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: azalia_codec.c,v 1.79.24.1 2017/08/09 06:22:07 snj Exp $");
 
 #include 
 #include 
@@ -2074,7 +2074,7 @@ generic_set_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2089,7 +2089,7 @@ generic_get_port(codec_t *this, mixer_ct
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2328,7 +2328,7 @@ alc260_set_port(codec_t *this, mixer_ctr
 	uint32_t value;
 	int err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2386,7 +2386,7 @@ alc260_get_port(codec_t *this, mixer_ctr
 {
 	const mixer_item_t *m;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	mc->type = m->devinfo.type;
@@ -2895,7 +2895,7 @@ alc882_set_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	if (mc->type != m->devinfo.type)
@@ -2929,7 +2929,7 @@ alc882_get_port(codec_t *this, mixer_ctr
 	uint32_t mask, bit, result;
 	int i, err;
 
-	if (mc->dev >= this->nmixers)
+	if (mc->dev < 0 || mc->dev >= this->nmixers)
 		return ENXIO;
 	m = >mixers[mc->dev];
 	

CVS commit: [netbsd-7] src/sys/dev/pci

2017-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jul 26 15:58:58 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: if_iwm.c

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1459):
sys/dev/pci/if_iwm.c: revision 1.72
iwm(4): match Wireless 8265 device.


To generate a diff of this commit:
cvs rdiff -u -r1.75.2.2 -r1.75.2.3 src/sys/dev/pci/if_iwm.c

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

Modified files:

Index: src/sys/dev/pci/if_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.75.2.2 src/sys/dev/pci/if_iwm.c:1.75.2.3
--- src/sys/dev/pci/if_iwm.c:1.75.2.2	Tue Jul 25 19:43:03 2017
+++ src/sys/dev/pci/if_iwm.c	Wed Jul 26 15:58:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.75.2.2 2017/07/25 19:43:03 snj Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.75.2.3 2017/07/26 15:58:58 snj Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -106,7 +106,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.75.2.2 2017/07/25 19:43:03 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.75.2.3 2017/07/26 15:58:58 snj Exp $");
 
 #include 
 #include 
@@ -7784,6 +7784,7 @@ static const pci_product_id_t iwm_device
 	PCI_PRODUCT_INTEL_WIFI_LINK_8260_2,
 	PCI_PRODUCT_INTEL_WIFI_LINK_4165_1,
 	PCI_PRODUCT_INTEL_WIFI_LINK_4165_2,
+	PCI_PRODUCT_INTEL_WIFI_LINK_8265,
 };
 
 static int



CVS commit: [netbsd-7] src/sys/dev/pci

2017-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jul 26 15:57:53 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: aceride.c pciide_acer_reg.h

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1458):
sys/dev/pci/aceride.c: revision 1.37
sys/dev/pci/pciide_acer_reg.h: revision 1.13
Apply workaround from FreeBSD to fix read data corruption observed
on Fire V100 and mSATA-SSD with mSATA to IDE adapter.
The patch is from port-sparc64@.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/dev/pci/aceride.c
cvs rdiff -u -r1.12 -r1.12.38.1 src/sys/dev/pci/pciide_acer_reg.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/pci/aceride.c
diff -u src/sys/dev/pci/aceride.c:1.36 src/sys/dev/pci/aceride.c:1.36.4.1
--- src/sys/dev/pci/aceride.c:1.36	Mon Oct  7 19:51:55 2013
+++ src/sys/dev/pci/aceride.c	Wed Jul 26 15:57:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aceride.c,v 1.36 2013/10/07 19:51:55 jakllsch Exp $	*/
+/*	$NetBSD: aceride.c,v 1.36.4.1 2017/07/26 15:57:53 snj Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.36 2013/10/07 19:51:55 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.36.4.1 2017/07/26 15:57:53 snj Exp $");
 
 #include 
 #include 
@@ -194,8 +194,13 @@ acer_chip_map(struct pciide_softc *sc, c
 	interface = PCI_INTERFACE(pci_conf_read(sc->sc_pc, sc->sc_tag,
 	PCI_CLASS_REG));
 
-	/* From linux: enable "Cable Detection" */
 	if (rev >= 0xC2) {
+		/* From FreeBSD: use device interrupt as byte count end */
+		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_0x4A,
+		pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x4A)
+		| ACER_0x4A_BCEINT);
+
+		/* From linux: enable "Cable Detection" */
 		pciide_pci_write(sc->sc_pc, sc->sc_tag, ACER_0x4B,
 		pciide_pci_read(sc->sc_pc, sc->sc_tag, ACER_0x4B)
 		| ACER_0x4B_CDETECT);

Index: src/sys/dev/pci/pciide_acer_reg.h
diff -u src/sys/dev/pci/pciide_acer_reg.h:1.12 src/sys/dev/pci/pciide_acer_reg.h:1.12.38.1
--- src/sys/dev/pci/pciide_acer_reg.h:1.12	Mon Oct 19 18:41:15 2009
+++ src/sys/dev/pci/pciide_acer_reg.h	Wed Jul 26 15:57:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciide_acer_reg.h,v 1.12 2009/10/19 18:41:15 bouyer Exp $	*/
+/*	$NetBSD: pciide_acer_reg.h,v 1.12.38.1 2017/07/26 15:57:53 snj Exp $	*/
 
 /*
  * Copyright (c) 1999 Manuel Bouyer.
@@ -37,6 +37,8 @@
  * bit 1 is 0 -> secondary has 80 pin cable
  */
 #define ACER_0x4A_80PIN(chan)	(0x1 << (chan))
+/* From FreeBSD, use device interrupt as byte count end */
+#define ACER_0x4A_BCEINT	0x20
 
 /* From FreeBSD, for UDMA mode > 2 */
 #define ACER_0x4B	0x4b



CVS commit: [netbsd-7] src/sys/dev/usb

2017-07-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jul 23 06:11:47 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: uhci.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1456):
sys/dev/usb/uhci.c: revision 1.276
Only call uhci_free_stds if there are TDs to free.
In uhci_alloc_std_chain ensure we fill the TD array correctly and note
the number of allocated TDs so that uhci_free_stds will do the right thing
Fixes a problem seen by anon


To generate a diff of this commit:
cvs rdiff -u -r1.264.2.1 -r1.264.2.2 src/sys/dev/usb/uhci.c

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

Modified files:

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.264.2.1 src/sys/dev/usb/uhci.c:1.264.2.2
--- src/sys/dev/usb/uhci.c:1.264.2.1	Wed Apr  5 19:54:20 2017
+++ src/sys/dev/usb/uhci.c	Sun Jul 23 06:11:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.264.2.1 2017/04/05 19:54:20 snj Exp $	*/
+/*	$NetBSD: uhci.c,v 1.264.2.2 2017/07/23 06:11:47 snj Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.2.1 2017/04/05 19:54:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.2.2 2017/07/23 06:11:47 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1995,7 +1995,6 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s
 
 	uxfer->ux_stds = NULL;
 	uxfer->ux_nstd = ntd;
-	p = NULL;
 	if (ntd == 0) {
 		*sp = NULL;
 		DPRINTF("ntd=0", 0, 0, 0, 0);
@@ -2004,11 +2003,13 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s
 	uxfer->ux_stds = kmem_alloc(sizeof(uhci_soft_td_t *) * ntd,
 	KM_SLEEP);
 
-	ntd--;
-	for (int i = ntd; i >= 0; i--) {
+	for (int i = 0; i < ntd; i++) {
 		p = uhci_alloc_std(sc);
 		if (p == NULL) {
-			uhci_free_stds(sc, uxfer);
+			if (i != 0) {
+uxfer->ux_nstd = i;
+uhci_free_stds(sc, uxfer);
+			}
 			kmem_free(uxfer->ux_stds,
 			sizeof(uhci_soft_td_t *) * ntd);
 			return ENOMEM;
@@ -2212,9 +2213,10 @@ uhci_device_bulk_fini(struct usbd_xfer *
 
 	KASSERT(ux->ux_type == UX_BULK);
 
-	uhci_free_stds(sc, ux);
-	if (ux->ux_nstd)
+	if (ux->ux_nstd) {
+		uhci_free_stds(sc, ux);
 		kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd);
+	}
 }
 
 usbd_status
@@ -2482,9 +2484,10 @@ uhci_device_ctrl_fini(struct usbd_xfer *
 
 	KASSERT(ux->ux_type == UX_CTRL);
 
-	uhci_free_stds(sc, ux);
-	if (ux->ux_nstd)
+	if (ux->ux_nstd) {
+		uhci_free_stds(sc, ux);
 		kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd);
+	}
 }
 
 usbd_status
@@ -2687,9 +2690,10 @@ uhci_device_intr_fini(struct usbd_xfer *
 
 	KASSERT(ux->ux_type == UX_INTR);
 
-	uhci_free_stds(sc, ux);
-	if (ux->ux_nstd)
+	if (ux->ux_nstd) {
+		uhci_free_stds(sc, ux);
 		kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd);
+	}
 }
 
 usbd_status



CVS commit: [netbsd-7] src/sys/dev/sdmmc

2017-07-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jul 23 06:09:53 UTC 2017

Modified Files:
src/sys/dev/sdmmc [netbsd-7]: ld_sdmmc.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1447):
sys/dev/sdmmc/ld_sdmmc.c: revision 1.29
The config_* APIs are not MPSAFE, so make sure the deferred attach
thread holds KERNEL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.1 -r1.12.4.2 src/sys/dev/sdmmc/ld_sdmmc.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/sdmmc/ld_sdmmc.c
diff -u src/sys/dev/sdmmc/ld_sdmmc.c:1.12.4.1 src/sys/dev/sdmmc/ld_sdmmc.c:1.12.4.2
--- src/sys/dev/sdmmc/ld_sdmmc.c:1.12.4.1	Tue May 26 01:29:53 2015
+++ src/sys/dev/sdmmc/ld_sdmmc.c	Sun Jul 23 06:09:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_sdmmc.c,v 1.12.4.1 2015/05/26 01:29:53 msaitoh Exp $	*/
+/*	$NetBSD: ld_sdmmc.c,v 1.12.4.2 2017/07/23 06:09:53 snj Exp $	*/
 
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.12.4.1 2015/05/26 01:29:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.12.4.2 2017/07/23 06:09:53 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -136,7 +136,7 @@ ld_sdmmc_attach(device_t parent, device_
 	 * when wedge is supported.
 	 */
 	config_pending_incr(self);
-	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
+	if (kthread_create(PRI_NONE, 0, NULL,
 	ld_sdmmc_doattach, sc, , "%sattach", device_xname(self))) {
 		aprint_error_dev(self, "couldn't create thread\n");
 	}



CVS commit: [netbsd-7] src/sys/dev/hpc

2017-07-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jul 23 06:05:36 UTC 2017

Modified Files:
src/sys/dev/hpc [netbsd-7]: hpckbd.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1438):
sys/dev/hpc/hpckbd.c: revision 1.31
Restore wscons keymaps feature on hpcarm
hpc ports need to alter keydesc data at runtime in order to load
alternate keymaps. But since keydesc is const initialized data, it
is mapped read only and the operation should fail.
It seems older compiler failed to enforce the read-only mapping and
this is why it used to work, but on recent NetBSD releases, the
feature is broken.
We fix it by duplicating the keydesc data once into a malloc'ed area
that can be modified.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.30.12.1 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30 src/sys/dev/hpc/hpckbd.c:1.30.12.1
--- src/sys/dev/hpc/hpckbd.c:1.30	Sat Oct 27 17:18:17 2012
+++ src/sys/dev/hpc/hpckbd.c	Sun Jul 23 06:05:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,11 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30.12.1 2017/07/23 06:05:36 snj Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -264,22 +265,30 @@ hpckbd_keymap_setup(struct hpckbd_core *
 		const keysym_t *map, int mapsize)
 {
 	int i;
-	struct wscons_keydesc *desc;
+	const struct wscons_keydesc *desc;
+	static struct wscons_keydesc *ndesc = NULL;
 
-	/* fix keydesc table */
 	/* 
-	 * XXX The way this is done is really wrong.  The __UNCONST()
-	 * is a hint as to what is wrong.  This actually ends up modifying
-	 * initialized data which is marked "const".
-	 * The reason we get away with it here is apparently that text
-	 * and read-only data gets mapped read/write on the platforms
-	 * using this code.
+	 * fix keydesc table. Since it is const data, we must 
+	 * copy it once before changingg it.
 	 */
-	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+
+	if (ndesc == NULL) {
+		size_t sz;
+
+		for (sz = 0; hpckbd_keymapdata.keydesc[sz].name != 0; sz++);
+
+		ndesc = malloc(sz * sizeof(*ndesc), M_DEVBUF, M_WAITOK);
+		memcpy(ndesc, hpckbd_keymapdata.keydesc, sz * sizeof(*ndesc));
+
+		hpckbd_keymapdata.keydesc = ndesc;
+	}
+
+	desc = hpckbd_keymapdata.keydesc;
 	for (i = 0; desc[i].name != 0; i++) {
 		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
-			desc[i].map = map;
-			desc[i].map_size = mapsize;
+			ndesc[i].map = map;
+			ndesc[i].map_size = mapsize;
 		}
 	}
 



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

2017-07-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jul  8 16:37:54 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: audio.c

Log Message:
Apply patch (requested by nat in ticket #1433):
Fix occasional stuttering that can be caused by ringbuffer overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.263.2.1 -r1.263.2.2 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.263.2.1 src/sys/dev/audio.c:1.263.2.2
--- src/sys/dev/audio.c:1.263.2.1	Sun Nov 23 13:07:05 2014
+++ src/sys/dev/audio.c	Sat Jul  8 16:37:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.263.2.1 2014/11/23 13:07:05 martin Exp $	*/
+/*	$NetBSD: audio.c,v 1.263.2.2 2017/07/08 16:37:54 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.263.2.1 2014/11/23 13:07:05 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.263.2.2 2017/07/08 16:37:54 snj Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -2960,6 +2960,9 @@ audio_pint(void *v)
 		return;
 	}
 
+	if (audio_stream_get_used(>s) > (cb->usedhigh - cb->blksize))
+		goto done;
+
 #ifdef AUDIO_INTR_TIME
 	{
 		struct timeval tv;
@@ -3038,6 +3041,7 @@ audio_pint(void *v)
 	}
 
 	DPRINTFN(5, ("audio_pint: outp=%p cc=%d\n", cb->s.outp, blksize));
+done:
 	if (hw->trigger_output == NULL) {
 		error = hw->start_output(sc->hw_hdl, __UNCONST(cb->s.outp),
 		blksize, audio_pint, (void *)sc);



CVS commit: [netbsd-7] src/sys/dev/pci

2017-07-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jul  8 16:34:35 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: ehci_pci.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1431):
sys/dev/pci/ehci_pci.c: revision 1.65
Deal with broken BIOSes that leave PCI interrupts disabled.
Thanks to nick@


To generate a diff of this commit:
cvs rdiff -u -r1.58.4.1 -r1.58.4.2 src/sys/dev/pci/ehci_pci.c

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

Modified files:

Index: src/sys/dev/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.58.4.1 src/sys/dev/pci/ehci_pci.c:1.58.4.2
--- src/sys/dev/pci/ehci_pci.c:1.58.4.1	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/pci/ehci_pci.c	Sat Jul  8 16:34:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.58.4.1 2017/04/05 19:54:19 snj Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.58.4.2 2017/07/08 16:34:35 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.58.4.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.58.4.2 2017/07/08 16:34:35 snj Exp $");
 
 #include 
 #include 
@@ -163,10 +163,14 @@ ehci_pci_attach(device_t parent, device_
 		break;
 	}
 
+	pcireg_t intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
+	int pin = PCI_INTERRUPT_PIN(intr);
+
 	/* Enable the device. */
 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
-	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
-		   csr | PCI_COMMAND_MASTER_ENABLE);
+	csr |= PCI_COMMAND_MASTER_ENABLE;
+	csr &= ~(pin ? PCI_COMMAND_INTERRUPT_DISABLE : 0);
+	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
 
 	/* Map and establish the interrupt. */
 	if (pci_intr_map(pa, )) {



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

2017-07-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jul  8 16:14:19 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: cgd.c

Log Message:
Apply patch (requested by chs in ticket #1429):
Avoid crashes by checking if a cgd device has been configured before
processing most ioctls, and failing with ENXIO if the device is not
configured.


To generate a diff of this commit:
cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.90.2.1 src/sys/dev/cgd.c:1.90.2.2
--- src/sys/dev/cgd.c:1.90.2.1	Wed Nov  4 16:25:17 2015
+++ src/sys/dev/cgd.c	Sat Jul  8 16:14:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.90.2.1 2015/11/04 16:25:17 riz Exp $ */
+/* $NetBSD: cgd.c,v 1.90.2.2 2017/07/08 16:14:19 snj Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.1 2015/11/04 16:25:17 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.2 2017/07/08 16:14:19 snj Exp $");
 
 #include 
 #include 
@@ -586,12 +586,16 @@ cgdioctl(dev_t dev, u_long cmd, void *da
 		 */
 		if ((flag & FWRITE) == 0)
 			return (EBADF);
+		if ((dksc->sc_flags & DKF_INITED) == 0)
+			return ENXIO;
 
 		/*
 		 * We pass this call down to the underlying disk.
 		 */
 		return VOP_IOCTL(cs->sc_tvn, cmd, data, flag, l->l_cred);
 	default:
+		if ((dksc->sc_flags & DKF_INITED) == 0)
+			return ENXIO;
 		return dk_ioctl(di, dksc, dev, cmd, data, flag, l);
 	}
 }



CVS commit: [netbsd-7] src/sys/dev/usb

2017-06-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jun  3 17:03:02 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: files.usb

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1421):
sys/dev/usb/files.usb: revision 1.144
Fix the USBVERBOSE stuff so it does not get included in the build if
there are no USB devices or controllers.
Without this change, a kernel with no USB devices but with USBVERBOSE
defined in the configuration file will include the usb_verbose.c file,
but will fail to link due to undefined symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.132.2.2 -r1.132.2.3 src/sys/dev/usb/files.usb

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

Modified files:

Index: src/sys/dev/usb/files.usb
diff -u src/sys/dev/usb/files.usb:1.132.2.2 src/sys/dev/usb/files.usb:1.132.2.3
--- src/sys/dev/usb/files.usb:1.132.2.2	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/usb/files.usb	Sat Jun  3 17:03:02 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.usb,v 1.132.2.2 2017/04/05 19:54:19 snj Exp $
+#	$NetBSD: files.usb,v 1.132.2.3 2017/06/03 17:03:02 snj Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
@@ -103,8 +103,7 @@ file	dev/usb/usb_quirks.c		usb
 define	usb_dma: usb
 file	dev/usb/usb_mem.c		usb_dma			needs-flag
 
-define	usbverbose: usb
-file	dev/usb/usb_verbose.c		usbverbose
+file	dev/usb/usb_verbose.c		usbverbose & usb
 
 # Hub driver
 device	uhub: usbdevif, usbifif



CVS commit: [netbsd-7] src/sys/dev/pci/hdaudio

2017-05-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri May 12 04:59:12 UTC 2017

Modified Files:
src/sys/dev/pci/hdaudio [netbsd-7]: hdaudio_pci.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #1369):
sys/dev/pci/hdaudio/hdaudio_pci.c: patch based on revision 1.6 of 
sys/dev/pci/hdaudio_pci.c
Always allow hdaudio(4) to suspend
Sometimes hdaudio(4) can fail to attach, but the device remains in the
tree. Even though the PMF registration is performed, it is explicitly
de-registered in the code path for errors - therefore preventing suspending
later. This patch makes sure PMF registration is performed accordingly upon
errors as well.
No objection on tech-kern@.
Tested on a Lenovo ThinkPad T440s (amd64).


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.2 -r1.12.4.3 src/sys/dev/pci/hdaudio/hdaudio_pci.c

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.2 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.3
--- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.2	Fri Jul 17 04:44:41 2015
+++ src/sys/dev/pci/hdaudio/hdaudio_pci.c	Fri May 12 04:59:12 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.12.4.2 2015/07/17 04:44:41 snj Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.12.4.3 2017/05/12 04:59:12 snj Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.12.4.2 2015/07/17 04:44:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.12.4.3 2017/05/12 04:59:12 snj Exp $");
 
 #include 
 #include 
@@ -156,9 +156,6 @@ hdaudio_pci_attach(device_t parent, devi
 	}
 	aprint_normal_dev(self, "interrupting at %s\n", intrstr);
 
-	if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
-		aprint_error_dev(self, "couldn't establish power handler\n");
-
 	hdaudio_pci_reinit(sc);
 
 	/* Attach bus-independent HD audio layer */
@@ -172,8 +169,11 @@ hdaudio_pci_attach(device_t parent, devi
 		csr = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG);
 		csr &= ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE);
 		pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG, csr);
-		pmf_device_deregister(self);
+		if (!pmf_device_register(self, NULL, NULL))
+			aprint_error_dev(self, "couldn't establish power handler\n");
 	}
+	else if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
 static int



CVS commit: [netbsd-7] src/sys/dev/pci

2017-04-19 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Apr 19 17:06:21 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c

Log Message:
Pull up following revision(s) (requested by kardel in ticket #1385):
sys/dev/pci/if_wm.c: revision 1.497
PR kern/52039: use same safeguard as for the 82578


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.13 -r1.289.2.14 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.13 src/sys/dev/pci/if_wm.c:1.289.2.14
--- src/sys/dev/pci/if_wm.c:1.289.2.13	Thu Mar  9 06:28:36 2017
+++ src/sys/dev/pci/if_wm.c	Wed Apr 19 17:06:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.13 2017/03/09 06:28:36 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.14 2017/04/19 17:06:21 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.13 2017/03/09 06:28:36 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.14 2017/04/19 17:06:21 snj Exp $");
 
 #include 
 #include 
@@ -11153,7 +11153,7 @@ wm_enable_wakeup(struct wm_softc *sc)
 
 			/* Assume that the PHY is copper */
 			child = LIST_FIRST(>sc_mii.mii_phys);
-			if (child->mii_mpd_rev <= 2)
+			if ((child != NULL) && (child->mii_mpd_rev <= 2))
 sc->sc_mii.mii_writereg(sc->sc_dev, 1,
 (768 << 5) | 25, 0x0444); /* magic num */
 		}



CVS commit: [netbsd-7] src/sys/dev/mii

2017-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 16:27:32 UTC 2017

Modified Files:
src/sys/dev/mii [netbsd-7]: miidevs.h miidevs_data.h

Log Message:
regen for ticket 1371


To generate a diff of this commit:
cvs rdiff -u -r1.123.2.2 -r1.123.2.3 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.111.2.2 -r1.111.2.3 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.123.2.2 src/sys/dev/mii/miidevs.h:1.123.2.3
--- src/sys/dev/mii/miidevs.h:1.123.2.2	Fri Dec  9 05:23:58 2016
+++ src/sys/dev/mii/miidevs.h	Thu Mar  9 16:27:32 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.123.2.2 2016/12/09 05:23:58 snj Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.123.2.3 2017/03/09 16:27:32 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp
+ *	NetBSD: miidevs,v 1.120.2.3 2017/03/09 06:26:04 snj Exp
  */
 
 /*-
@@ -322,6 +322,8 @@
 #define	MII_STR_yyINTEL_I82562ET	"i82562ET 10/100 media interface"
 #define	MII_MODEL_yyINTEL_I82553	0x0035
 #define	MII_STR_yyINTEL_I82553	"i82553 10/100 media interface"
+#define	MII_MODEL_yyINTEL_IGP01E1000	0x0038
+#define	MII_STR_yyINTEL_IGP01E1000	"Intel IGP01E1000 Gigabit PHY"
 #define	MII_MODEL_yyINTEL_I82566	0x0039
 #define	MII_STR_yyINTEL_I82566	"i82566 10/100/1000 media interface"
 #define	MII_MODEL_INTEL_I82577	0x0005
@@ -330,13 +332,17 @@
 #define	MII_STR_INTEL_I82579	"i82579 10/100/1000 media interface"
 #define	MII_MODEL_INTEL_I217	0x000a
 #define	MII_STR_INTEL_I217	"i217 10/100/1000 media interface"
+#define	MII_MODEL_INTEL_I82580	0x003a
+#define	MII_STR_INTEL_I82580	"82580 10/100/1000 media interface"
+#define	MII_MODEL_INTEL_I350	0x003b
+#define	MII_STR_INTEL_I350	"I350 10/100/1000 media interface"
 #define	MII_MODEL_xxMARVELL_I210	0x
 #define	MII_STR_xxMARVELL_I210	"I210 10/100/1000 media interface"
 #define	MII_MODEL_xxMARVELL_I82563	0x000a
 #define	MII_STR_xxMARVELL_I82563	"i82563 10/100/1000 media interface"
+#define	MII_MODEL_ATHEROS_I82578	0x0004
+#define	MII_STR_ATHEROS_I82578	"Intel 82578 10/100/1000 media interface"
 
-#define	MII_MODEL_yyINTEL_IGP01E1000	0x0038
-#define	MII_STR_yyINTEL_IGP01E1000	"Intel IGP01E1000 Gigabit PHY"
 
 /* JMicron PHYs */
 #define	MII_MODEL_JMICRON_JMC250	0x0021
@@ -385,8 +391,12 @@
 #define	MII_STR_xxMARVELL_E1145	"Marvell 88E1145 Quad Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E6060	0x0010
 #define	MII_STR_xxMARVELL_E6060	"Marvell 88E6060 6-Port 10/100 Fast Ethernet Switch"
+#define	MII_MODEL_xxMARVELL_I347	0x001c
+#define	MII_STR_xxMARVELL_I347	"Intel I347-AT4 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1512	0x001d
 #define	MII_STR_xxMARVELL_E1512	"Marvell 88E1512 Gigabit PHY"
+#define	MII_MODEL_xxMARVELL_E1340M	0x001f
+#define	MII_STR_xxMARVELL_E1340M	"Marvell 88E1340 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1116	0x0021
 #define	MII_STR_xxMARVELL_E1116	"Marvell 88E1116 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1118	0x0022

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.111.2.2 src/sys/dev/mii/miidevs_data.h:1.111.2.3
--- src/sys/dev/mii/miidevs_data.h:1.111.2.2	Fri Dec  9 05:23:58 2016
+++ src/sys/dev/mii/miidevs_data.h	Thu Mar  9 16:27:32 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.111.2.2 2016/12/09 05:23:58 snj Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.111.2.3 2017/03/09 16:27:32 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp
+ *	NetBSD: miidevs,v 1.120.2.3 2017/03/09 06:26:04 snj Exp
  */
 
 /*-
@@ -125,13 +125,16 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82562EM, MII_STR_yyINTEL_I82562EM },
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82562ET, MII_STR_yyINTEL_I82562ET },
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82553, MII_STR_yyINTEL_I82553 },
+ { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_IGP01E1000, MII_STR_yyINTEL_IGP01E1000 },
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82566, MII_STR_yyINTEL_I82566 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82577, MII_STR_INTEL_I82577 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82579, MII_STR_INTEL_I82579 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I217, MII_STR_INTEL_I217 },
+ { MII_OUI_INTEL, MII_MODEL_INTEL_I82580, MII_STR_INTEL_I82580 },
+ { MII_OUI_INTEL, MII_MODEL_INTEL_I350, MII_STR_INTEL_I350 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I210, MII_STR_xxMARVELL_I210 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I82563, MII_STR_xxMARVELL_I82563 },
- { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_IGP01E1000, MII_STR_yyINTEL_IGP01E1000 },
+ { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_I82578, MII_STR_ATHEROS_I82578 },
  { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMC250, MII_STR_JMICRON_JMC250 },
  { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMC260, MII_STR_JMICRON_JMC260 

CVS commit: [netbsd-7] src/sys/dev/pci

2017-03-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 06:28:36 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1372):
sys/dev/pci/if_wm.c: revisions 1.462, 1.464-1.465 1.474 via patch
sys/dev/pci/if_wmreg.h: revision 1.97
sys/dev/pci/if_wmvar.h: revision 1.33
- Set IPV6EXDIS bit in RFCTL register because of an Errata on 82575 and
  newer devices.
- Linux and FreeBSD defines 0x10f5 as E1000_DEV_ID_ICH9_IGP_M_AMT. In
  reality, This is not IGP but BM. Add new case to identify PHY type
  device. Fixes PR#51924 reported byJarle Greipsland.
- Use new wm_gmii_setup_phytype() function to setup sc_phytype and
  mii_{read|write}reg. This change improves detection of PHY type.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.12 -r1.289.2.13 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.7 -r1.60.2.8 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/sys/dev/pci/if_wmvar.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.12 src/sys/dev/pci/if_wm.c:1.289.2.13
--- src/sys/dev/pci/if_wm.c:1.289.2.12	Sun Dec 18 07:53:08 2016
+++ src/sys/dev/pci/if_wm.c	Thu Mar  9 06:28:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.12 2016/12/18 07:53:08 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.13 2017/03/09 06:28:36 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.12 2016/12/18 07:53:08 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.13 2017/03/09 06:28:36 snj Exp $");
 
 #include 
 #include 
@@ -638,6 +638,7 @@ static int	wm_intr(void *);
 static void	wm_tbi_serdes_set_linkled(struct wm_softc *);
 /* GMII related */
 static void	wm_gmii_reset(struct wm_softc *);
+static void	wm_gmii_setup_phytype(struct wm_softc *sc, uint32_t, uint16_t);
 static int	wm_get_phy_id_82575(struct wm_softc *);
 static void	wm_gmii_mediainit(struct wm_softc *, pci_product_id_t);
 static int	wm_gmii_mediachange(struct ifnet *);
@@ -3670,11 +3671,11 @@ wm_initialize_hardware_bits(struct wm_so
 		}
 		CSR_WRITE(sc, WMREG_TARC0, tarc0);
 
+		switch (sc->sc_type) {
 		/*
-		 * 8257[12] Errata No.52 and some others.
+		 * 8257[12] Errata No.52, 82573 Errata No.43 and some others.
 		 * Avoid RSS Hash Value bug.
 		 */
-		switch (sc->sc_type) {
 		case WM_T_82571:
 		case WM_T_82572:
 		case WM_T_82573:
@@ -3687,6 +3688,20 @@ wm_initialize_hardware_bits(struct wm_so
 		default:
 			break;
 		}
+	} else if ((sc->sc_type >= WM_T_82575) && (sc->sc_type <= WM_T_I211)) {
+		/*
+		 * 82575 Errata XXX, 82576 Errata 46, 82580 Errata 24,
+		 * I350 Errata 37, I210 Errata No. 31 and I211 Errata No. 11:
+		 * "Certain Malformed IPv6 Extension Headers are Not Processed
+		 * Correctly by the Device"
+		 *
+		 * I354(C2000) Errata AVR53:
+		 * "Malformed IPv6 Extension Headers May Result in LAN Device
+		 * Hang"
+		 */
+		reg = CSR_READ(sc, WMREG_RFCTL);
+		reg |= WMREG_RFCTL_IPV6EXDIS;
+		CSR_WRITE(sc, WMREG_RFCTL, reg);
 	}
 }
 
@@ -6798,6 +6813,251 @@ wm_gmii_reset(struct wm_softc *sc)
 }
 
 /*
+ * Setup sc_phytype and mii_{read|write}reg.
+ *
+ *  To identify PHY type, correct read/write function should be selected.
+ * To select correct read/write function, PCI ID or MAC type are required
+ * without accessing PHY registers.
+ *
+ *  On the first call of this function, PHY ID is not known yet. Check
+ * PCI ID or MAC type. The list of the PCI ID may not be perfect, so the
+ * result might be incorrect.
+ *
+ *  In the second call, PHY OUI and model is used to identify PHY type.
+ * It might not be perfpect because of the lack of compared entry, but it
+ * would be better than the first call.
+ *
+ *  If the detected new result and previous assumption is different,
+ * diagnous message will be printed.
+ */
+static void
+wm_gmii_setup_phytype(struct wm_softc *sc, uint32_t phy_oui,
+uint16_t phy_model)
+{
+	device_t dev = sc->sc_dev;
+	struct mii_data *mii = >sc_mii;
+	uint16_t new_phytype = WMPHY_UNKNOWN;
+	uint16_t doubt_phytype = WMPHY_UNKNOWN;
+	mii_readreg_t new_readreg;
+	mii_writereg_t new_writereg;
+
+	if (mii->mii_readreg == NULL) {
+		/*
+		 *  This is the first call of this function. For ICH and PCH
+		 * variants, it's difficult to determine the PHY access method
+		 * by sc_type, so use the PCI product ID for some devices.
+		 */
+
+		switch (sc->sc_pcidevid) {
+		case PCI_PRODUCT_INTEL_PCH_M_LM:
+		case PCI_PRODUCT_INTEL_PCH_M_LC:
+			/* 82577 */
+			new_phytype = WMPHY_82577;
+			break;
+		case PCI_PRODUCT_INTEL_PCH_D_DM:
+		case PCI_PRODUCT_INTEL_PCH_D_DC:
+			/* 82578 */
+			new_phytype = WMPHY_82578;
+			break;
+		case PCI_PRODUCT_INTEL_PCH2_LV_LM:
+		case 

CVS commit: [netbsd-7] src/sys/dev/mii

2017-03-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 06:26:04 UTC 2017

Modified Files:
src/sys/dev/mii [netbsd-7]: miidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1371):
sys/dev/mii/miidevs: revision 1.125
Add some Intel devices.


To generate a diff of this commit:
cvs rdiff -u -r1.120.2.2 -r1.120.2.3 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.120.2.2 src/sys/dev/mii/miidevs:1.120.2.3
--- src/sys/dev/mii/miidevs:1.120.2.2	Fri Dec  9 05:23:31 2016
+++ src/sys/dev/mii/miidevs	Thu Mar  9 06:26:04 2017
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp $
+$NetBSD: miidevs,v 1.120.2.3 2017/03/09 06:26:04 snj Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -227,14 +227,17 @@ model yyINTEL I82562G		0x0031 i82562G 10
 model yyINTEL I82562EM		0x0032 i82562EM 10/100 media interface
 model yyINTEL I82562ET		0x0033 i82562ET 10/100 media interface
 model yyINTEL I82553		0x0035 i82553 10/100 media interface
+model yyINTEL IGP01E1000	0x0038 Intel IGP01E1000 Gigabit PHY
 model yyINTEL I82566		0x0039 i82566 10/100/1000 media interface
 model INTEL I82577		0x0005 i82577 10/100/1000 media interface
 model INTEL I82579		0x0009 i82579 10/100/1000 media interface
 model INTEL I217		0x000a i217 10/100/1000 media interface
+model INTEL I82580		0x003a 82580 10/100/1000 media interface
+model INTEL I350		0x003b I350 10/100/1000 media interface
 model xxMARVELL I210		0x I210 10/100/1000 media interface
 model xxMARVELL I82563		0x000a i82563 10/100/1000 media interface
+model ATHEROS I82578		0x0004 Intel 82578 10/100/1000 media interface
 
-model yyINTEL IGP01E1000	0x0038 Intel IGP01E1000 Gigabit PHY
 
 /* JMicron PHYs */
 model JMICRON JMC250		0x0021 JMC250 10/100/1000 media interface
@@ -262,7 +265,9 @@ model xxMARVELL E1149		0x000b Marvell 88
 model xxMARVELL E		0x000c Marvell 88E Gigabit PHY
 model xxMARVELL E1145		0x000d Marvell 88E1145 Quad Gigabit PHY
 model xxMARVELL E6060		0x0010 Marvell 88E6060 6-Port 10/100 Fast Ethernet Switch
+model xxMARVELL I347		0x001c Intel I347-AT4 Gigabit PHY
 model xxMARVELL E1512		0x001d Marvell 88E1512 Gigabit PHY
+model xxMARVELL E1340M		0x001f Marvell 88E1340 Gigabit PHY
 model xxMARVELL E1116		0x0021 Marvell 88E1116 Gigabit PHY
 model xxMARVELL E1118		0x0022 Marvell 88E1118 Gigabit PHY
 model xxMARVELL E1116R		0x0024 Marvell 88E1116R Gigabit PHY



CVS commit: [netbsd-7] src/sys/dev/pci/ixgbe

2017-03-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 06:19:37 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-7]: ixgbe.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1370):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.60
  Use 64bit DMA tag. If not, a lot of bounce buffer is allocated.
Fixes PR#49968 reported by Hauke.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.6 -r1.14.2.7 src/sys/dev/pci/ixgbe/ixgbe.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.6 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.7
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.6	Tue Jun 14 08:42:34 2016
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar  9 06:19:37 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe.c 279805 2015-03-09 10:29:15Z araujo $*/
-/*$NetBSD: ixgbe.c,v 1.14.2.6 2016/06/14 08:42:34 snj Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.7 2017/03/09 06:19:37 snj Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -522,7 +522,10 @@ ixgbe_attach(device_t parent, device_t d
 	hw = >hw;
 	adapter->osdep.pc = pa->pa_pc;
 	adapter->osdep.tag = pa->pa_tag;
-	adapter->osdep.dmat = pa->pa_dmat;
+	if (pci_dma64_available(pa))
+		adapter->osdep.dmat = pa->pa_dmat64;
+	else
+		adapter->osdep.dmat = pa->pa_dmat;
 	adapter->osdep.attached = false;
 
 	ent = ixgbe_lookup(pa);



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec 23 05:57:40 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: if_vioif.c virtio.c

Log Message:
Pull up following revision(s) (requested by bsiegert in ticket #1337):
sys/dev/pci/if_vioif.c: revision 1.21
sys/dev/pci/virtio.c: revision 1.14
PR/50636: Ryo ONODERA: Fix incorrect kmem_free()
--
PR/50636: Ryo ONODERA: Reduce memory use


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 src/sys/dev/pci/if_vioif.c
cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/pci/virtio.c

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

Modified files:

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.7.2.2 src/sys/dev/pci/if_vioif.c:1.7.2.3
--- src/sys/dev/pci/if_vioif.c:1.7.2.2	Sun Sep 18 05:57:00 2016
+++ src/sys/dev/pci/if_vioif.c	Fri Dec 23 05:57:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.7.2.2 2016/09/18 05:57:00 snj Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.7.2.3 2016/12/23 05:57:40 snj Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.7.2.2 2016/09/18 05:57:00 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.7.2.3 2016/12/23 05:57:40 snj Exp $");
 
 #include 
 #include 
@@ -397,7 +397,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 		C_L1(txhdr_dmamaps[i], tx_hdrs[i],
 		sizeof(struct virtio_net_hdr), 1,
 		WRITE, "tx header");
-		C(tx_dmamaps[i], NULL, ETHER_MAX_LEN, 256 /* XXX */, 0,
+		C(tx_dmamaps[i], NULL, ETHER_MAX_LEN, 16 /* XXX */, 0,
 		  "tx payload");
 	}
 

Index: src/sys/dev/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.6 src/sys/dev/pci/virtio.c:1.6.2.1
--- src/sys/dev/pci/virtio.c:1.6	Tue Jul 22 01:55:54 2014
+++ src/sys/dev/pci/virtio.c	Fri Dec 23 05:57:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $	*/
+/*	$NetBSD: virtio.c,v 1.6.2.1 2016/12/23 05:57:40 snj Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.6 2014/07/22 01:55:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.6.2.1 2016/12/23 05:57:40 snj Exp $");
 
 #include 
 #include 
@@ -686,7 +686,7 @@ virtio_free_vq(struct virtio_softc *sc, 
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh,
 			  VIRTIO_CONFIG_QUEUE_ADDRESS, 0);
 
-	kmem_free(vq->vq_entries, vq->vq_bytesize);
+	kmem_free(vq->vq_entries, sizeof(*vq->vq_entries) * vq->vq_num);
 	bus_dmamap_unload(sc->sc_dmat, vq->vq_dmamap);
 	bus_dmamap_destroy(sc->sc_dmat, vq->vq_dmamap);
 	bus_dmamem_unmap(sc->sc_dmat, vq->vq_vaddr, vq->vq_bytesize);



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 18 07:53:09 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c if_wmreg.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1327):
sys/dev/pci/if_wm.c: revision 1.457
sys/dev/pci/if_wmreg.h: revision 1.94
- Change to use 2500Base-KX correctly on C2000(I354). It worked, but the
output of ifconfig and if_baudrate was not good. Tested by nils@:
   - The STATUS_TBIMODE bit in the STATUS register is deleted since 82575,
 so check for 82575 and newer first and then check for old devices.
   - Check the 2P5_SKU and 2P5_SKU_OVER bit for KX.
   - Set IFM_2500_SX instead of IFM_1000_SX for 2.5G.
- Check SERDES's speed directly from the PCS layer (PCS_LSTS register) for old
   devices.
- Style fix.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.11 -r1.289.2.12 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.6 -r1.60.2.7 src/sys/dev/pci/if_wmreg.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/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.11 src/sys/dev/pci/if_wm.c:1.289.2.12
--- src/sys/dev/pci/if_wm.c:1.289.2.11	Mon Dec 12 07:18:29 2016
+++ src/sys/dev/pci/if_wm.c	Sun Dec 18 07:53:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.11 2016/12/12 07:18:29 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.12 2016/12/18 07:53:08 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.11 2016/12/12 07:18:29 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.12 2016/12/18 07:53:08 snj Exp $");
 
 #include 
 #include 
@@ -2312,100 +2312,91 @@ wm_attach(device_t parent, device_t self
 	|| sc->sc_type == WM_T_82574 || sc->sc_type == WM_T_82583) {
 		/* STATUS_TBIMODE reserved/reused, can't rely on it */
 		wm_gmii_mediainit(sc, wmp->wmp_product);
-	} else if (sc->sc_type < WM_T_82543 ||
-	(CSR_READ(sc, WMREG_STATUS) & STATUS_TBIMODE) != 0) {
-		if (sc->sc_mediatype == WM_MEDIATYPE_COPPER) {
-			aprint_error_dev(sc->sc_dev,
-			"WARNING: TBIMODE set on 1000BASE-T product!\n");
-			sc->sc_mediatype = WM_MEDIATYPE_FIBER;
-		}
-		wm_tbi_mediainit(sc);
-	} else {
-		switch (sc->sc_type) {
-		case WM_T_82575:
-		case WM_T_82576:
-		case WM_T_82580:
-		case WM_T_I350:
-		case WM_T_I354:
-		case WM_T_I210:
-		case WM_T_I211:
-			reg = CSR_READ(sc, WMREG_CTRL_EXT);
-			link_mode = reg & CTRL_EXT_LINK_MODE_MASK;
-			switch (link_mode) {
-			case CTRL_EXT_LINK_MODE_1000KX:
-aprint_verbose_dev(sc->sc_dev, "1000KX\n");
-sc->sc_mediatype = WM_MEDIATYPE_SERDES;
+	} else if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)
+	|| (sc->sc_type ==WM_T_82580) || (sc->sc_type ==WM_T_I350)
+	|| (sc->sc_type ==WM_T_I354) || (sc->sc_type ==WM_T_I210)
+	|| (sc->sc_type ==WM_T_I211)) {
+		reg = CSR_READ(sc, WMREG_CTRL_EXT);
+		link_mode = reg & CTRL_EXT_LINK_MODE_MASK;
+		switch (link_mode) {
+		case CTRL_EXT_LINK_MODE_1000KX:
+			aprint_verbose_dev(sc->sc_dev, "1000KX\n");
+			sc->sc_mediatype = WM_MEDIATYPE_SERDES;
+			break;
+		case CTRL_EXT_LINK_MODE_SGMII:
+			if (wm_sgmii_uses_mdio(sc)) {
+aprint_verbose_dev(sc->sc_dev,
+"SGMII(MDIO)\n");
+sc->sc_flags |= WM_F_SGMII;
+sc->sc_mediatype = WM_MEDIATYPE_COPPER;
 break;
-			case CTRL_EXT_LINK_MODE_SGMII:
-if (wm_sgmii_uses_mdio(sc)) {
-	aprint_verbose_dev(sc->sc_dev,
-	"SGMII(MDIO)\n");
-	sc->sc_flags |= WM_F_SGMII;
+			}
+			aprint_verbose_dev(sc->sc_dev, "SGMII(I2C)\n");
+			/*FALLTHROUGH*/
+		case CTRL_EXT_LINK_MODE_PCIE_SERDES:
+			sc->sc_mediatype = wm_sfp_get_media_type(sc);
+			if (sc->sc_mediatype == WM_MEDIATYPE_UNKNOWN) {
+if (link_mode
+== CTRL_EXT_LINK_MODE_SGMII) {
 	sc->sc_mediatype = WM_MEDIATYPE_COPPER;
-	break;
-}
-aprint_verbose_dev(sc->sc_dev, "SGMII(I2C)\n");
-/*FALLTHROUGH*/
-			case CTRL_EXT_LINK_MODE_PCIE_SERDES:
-sc->sc_mediatype = wm_sfp_get_media_type(sc);
-if (sc->sc_mediatype == WM_MEDIATYPE_UNKNOWN) {
-	if (link_mode
-	== CTRL_EXT_LINK_MODE_SGMII) {
-		sc->sc_mediatype
-		= WM_MEDIATYPE_COPPER;
-		sc->sc_flags |= WM_F_SGMII;
-	} else {
-		sc->sc_mediatype
-		= WM_MEDIATYPE_SERDES;
-		aprint_verbose_dev(sc->sc_dev,
-		"SERDES\n");
-	}
-	break;
-}
-if (sc->sc_mediatype == WM_MEDIATYPE_SERDES)
+	sc->sc_flags |= WM_F_SGMII;
+} else {
+	sc->sc_mediatype = WM_MEDIATYPE_SERDES;
 	aprint_verbose_dev(sc->sc_dev,
 	"SERDES\n");
-
-/* Change current link mode setting */
-reg &= ~CTRL_EXT_LINK_MODE_MASK;
-switch (sc->sc_mediatype) {
-case WM_MEDIATYPE_COPPER:
-	reg |= CTRL_EXT_LINK_MODE_SGMII;
-	break;
-case WM_MEDIATYPE_SERDES:
-	reg |= CTRL_EXT_LINK_MODE_PCIE_SERDES;
-	

CVS commit: [netbsd-7] src/sys/dev/usb

2016-12-14 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Dec 14 19:18:58 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: uchcom.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1321):
sys/dev/usb/uchcom.c: revision 1.17
Followling an advice in a linux forum, don't update LCR1/LCR2.
With this change this CH340 usb/serial based device:
https://www.olimex.com/Products/Breadboarding/BB-CH340T/open-source-hardware
(the chip is written H340T)
works as expected. As I'm not sure if this is needed for older device,
make this change for sc_version 0x30 or newer only.
While there, match USB_PRODUCT_WINCHIPHEAD2_CH341_2 too.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/dev/usb/uchcom.c

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

Modified files:

Index: src/sys/dev/usb/uchcom.c
diff -u src/sys/dev/usb/uchcom.c:1.13 src/sys/dev/usb/uchcom.c:1.13.4.1
--- src/sys/dev/usb/uchcom.c:1.13	Sat Mar 15 19:20:27 2014
+++ src/sys/dev/usb/uchcom.c	Wed Dec 14 19:18:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uchcom.c,v 1.13 2014/03/15 19:20:27 martin Exp $	*/
+/*	$NetBSD: uchcom.c,v 1.13.4.1 2016/12/14 19:18:58 snj Exp $	*/
 
 /*
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.13 2014/03/15 19:20:27 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.13.4.1 2016/12/14 19:18:58 snj Exp $");
 
 /*
  * driver for WinChipHead CH341/340, the worst USB-serial chip in the world.
@@ -91,6 +91,7 @@ int	uchcomdebug = 0;
 #define UCHCOM_REG_LCR2		0x25
 
 #define UCHCOM_VER_20		0x20
+#define UCHCOM_VER_30		0x30
 
 #define UCHCOM_BASE_UNKNOWN	0
 #define UCHCOM_BPS_MOD_BASE	2000
@@ -176,6 +177,7 @@ static const struct uchcom_divider_recor
 static const struct usb_devno uchcom_devs[] = {
 	{ USB_VENDOR_WINCHIPHEAD, USB_PRODUCT_WINCHIPHEAD_CH341SER },
 	{ USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341 },
+	{ USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341_2 },
 };
 #define uchcom_lookup(v, p)	usb_lookup(uchcom_devs, v, p)
 
@@ -570,6 +572,7 @@ update_version(struct uchcom_softc *sc)
 		usbd_errstr(err));
 		return EIO;
 	}
+	DPRINTF(("%s: update_version %d\n", device_xname(sc->sc_dev), sc->sc_version));
 
 	return 0;
 }
@@ -715,50 +718,52 @@ set_dte_rate(struct uchcom_softc *sc, ui
 static int
 set_line_control(struct uchcom_softc *sc, tcflag_t cflag)
 {
-	usbd_status err;
-	uint8_t lcr1val = 0, lcr2val = 0;
+	if (sc->sc_version < UCHCOM_VER_30) {
+		usbd_status err;
+		uint8_t lcr1val = 0, lcr2val = 0;
 
-	err = read_reg(sc, UCHCOM_REG_LCR1, , UCHCOM_REG_LCR2, );
-	if (err) {
-		aprint_error_dev(sc->sc_dev, "cannot get LCR: %s\n",
-		usbd_errstr(err));
-		return EIO;
-	}
+		err = read_reg(sc, UCHCOM_REG_LCR1, , UCHCOM_REG_LCR2, );
+		if (err) {
+			aprint_error_dev(sc->sc_dev, "cannot get LCR: %s\n",
+			usbd_errstr(err));
+			return EIO;
+		}
 
-	lcr1val &= ~UCHCOM_LCR1_MASK;
-	lcr2val &= ~UCHCOM_LCR2_MASK;
+		lcr1val &= ~UCHCOM_LCR1_MASK;
+		lcr2val &= ~UCHCOM_LCR2_MASK;
 
-	/*
-	 * XXX: it is difficult to handle the line control appropriately:
-	 *   - CS8, !CSTOPB and any parity mode seems ok, but
-	 *   - the chip doesn't have the function to calculate parity
-	 * in !CS8 mode.
-	 *   - it is unclear that the chip supports CS5,6 mode.
-	 *   - it is unclear how to handle stop bits.
-	 */
-
-	switch (ISSET(cflag, CSIZE)) {
-	case CS5:
-	case CS6:
-	case CS7:
-		return EINVAL;
-	case CS8:
-		break;
-	}
+		/*
+		 * XXX: it is difficult to handle the line control appropriately:
+		 *   - CS8, !CSTOPB and any parity mode seems ok, but
+		 *   - the chip doesn't have the function to calculate parity
+		 * in !CS8 mode.
+		 *   - it is unclear that the chip supports CS5,6 mode.
+		 *   - it is unclear how to handle stop bits.
+		 */
+
+		switch (ISSET(cflag, CSIZE)) {
+		case CS5:
+		case CS6:
+		case CS7:
+			return EINVAL;
+		case CS8:
+			break;
+		}
 
-	if (ISSET(cflag, PARENB)) {
-		lcr1val |= UCHCOM_LCR1_PARENB;
-		if (ISSET(cflag, PARODD))
-			lcr2val |= UCHCOM_LCR2_PARODD;
-		else
-			lcr2val |= UCHCOM_LCR2_PAREVEN;
-	}
+		if (ISSET(cflag, PARENB)) {
+			lcr1val |= UCHCOM_LCR1_PARENB;
+			if (ISSET(cflag, PARODD))
+lcr2val |= UCHCOM_LCR2_PARODD;
+			else
+lcr2val |= UCHCOM_LCR2_PAREVEN;
+		}
 
-	err = write_reg(sc, UCHCOM_REG_LCR1, lcr1val, UCHCOM_REG_LCR2, lcr2val);
-	if (err) {
-		aprint_error_dev(sc->sc_dev, "cannot set LCR: %s\n",
-		usbd_errstr(err));
-		return EIO;
+		err = write_reg(sc, UCHCOM_REG_LCR1, lcr1val, UCHCOM_REG_LCR2, lcr2val);
+		if (err) {
+			aprint_error_dev(sc->sc_dev, "cannot set LCR: %s\n",
+			usbd_errstr(err));
+			return EIO;
+		}
 	}
 
 	return 0;



CVS commit: [netbsd-7] src/sys/dev/usb

2016-12-14 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Dec 14 19:16:56 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket 1320


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.6 -r1.672.2.7 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.6 -r1.673.2.7 src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.672.2.6 src/sys/dev/usb/usbdevs.h:1.672.2.7
--- src/sys/dev/usb/usbdevs.h:1.672.2.6	Thu Dec  8 07:50:15 2016
+++ src/sys/dev/usb/usbdevs.h	Wed Dec 14 19:16:55 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.672.2.6 2016/12/08 07:50:15 snj Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.672.2.7 2016/12/14 19:16:55 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp
+ *	NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp
  */
 
 /*
@@ -3384,7 +3384,8 @@
 
 /* WinChipHead products */
 #define	USB_PRODUCT_WINCHIPHEAD_CH341SER	0x5523		/* CH341/CH340 USB-Serial Bridge */
-#define	USB_PRODUCT_WINCHIPHEAD2_CH341	0x7523		/* CH341 serial/parallel */
+#define	USB_PRODUCT_WINCHIPHEAD2_CH341	0x7523		/* CH341 USB-Serial Bridge */
+#define	USB_PRODUCT_WINCHIPHEAD2_CH341_2	0x5523		/* CH341 USB-Serial Bridge */
 
 /* Wistron NeWeb products */
 #define	USB_PRODUCT_WISTRONNEWEB_WNC0600	0x0326		/* WNC-0600USB */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.6 src/sys/dev/usb/usbdevs_data.h:1.673.2.7
--- src/sys/dev/usb/usbdevs_data.h:1.673.2.6	Thu Dec  8 07:50:15 2016
+++ src/sys/dev/usb/usbdevs_data.h	Wed Dec 14 19:16:55 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.673.2.6 2016/12/08 07:50:15 snj Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.673.2.7 2016/12/14 19:16:55 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp
+ *	NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp
  */
 
 /*
@@ -10184,7 +10184,11 @@ const struct usb_product usb_products[] 
 	},
 	{
 	USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341,
-	"CH341 serial/parallel",
+	"CH341 USB-Serial Bridge",
+	},
+	{
+	USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341_2,
+	"CH341 USB-Serial Bridge",
 	},
 	{
 	USB_VENDOR_WISTRONNEWEB, USB_PRODUCT_WISTRONNEWEB_WNC0600,
@@ -10535,4 +10539,4 @@ const struct usb_product usb_products[] 
 	"Prestige",
 	},
 };
-const int usb_nproducts = 2084;
+const int usb_nproducts = 2085;



CVS commit: [netbsd-7] src/sys/dev/usb

2016-12-14 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Dec 14 19:16:14 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdevs

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1320):
sys/dev/usb/usbdevs: revision 1.728
Rename "CH341 serial/parallel" to "CH341 USB-Serial Bridge", and
add a second device id for this chip.
>From FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.680.2.6 -r1.680.2.7 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.680.2.6 src/sys/dev/usb/usbdevs:1.680.2.7
--- src/sys/dev/usb/usbdevs:1.680.2.6	Thu Dec  8 07:49:42 2016
+++ src/sys/dev/usb/usbdevs	Wed Dec 14 19:16:14 2016
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp $
+$NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -3377,7 +3377,8 @@ product WESTERN EXTHDD		0x0400	External 
 
 /* WinChipHead products */
 product WINCHIPHEAD CH341SER	0x5523	CH341/CH340 USB-Serial Bridge
-product WINCHIPHEAD2 CH341	0x7523	CH341 serial/parallel
+product WINCHIPHEAD2 CH341	0x7523	CH341 USB-Serial Bridge
+product WINCHIPHEAD2 CH341_2	0x5523	CH341 USB-Serial Bridge
 
 /* Wistron NeWeb products */
 product WISTRONNEWEB WNC0600	0x0326	WNC-0600USB



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

2016-12-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Dec 12 07:18:29 UTC 2016

Modified Files:
src/sys/dev/mii [netbsd-7]: igphyreg.h ikphyreg.h inbmphyreg.h mii.h
src/sys/dev/pci [netbsd-7]: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1302):
sys/dev/mii/igphyreg.h: revisions 1.7-1.10
sys/dev/mii/ikphyreg.h: revisions 1.3
sys/dev/mii/inbmphyreg.h: revisions 1.4-1.9
sys/dev/mii/mii.h: revisions 1.19-1.20
sys/dev/pci/if_wm.c: revisions 1.390, 1.392-1.395, 1.397, 1.419-1.425, 
1.427-1.428, 1.430-1.435, 1.437-1.453 via patch
sys/dev/pci/if_wmreg.: revisions 1.89-1.93 via patch
sys/dev/pci/if_wmvar.h: revisions 1.31-1.32
Update wm(4) up to if_wm.c rev. 1.453 except MSI/MSI-X, multiqueue and
NET_MPSAFE:
- Add I219 support. It's not stable so it's disabled by default.
- wm_gate_hw_phy_config_ich8lan() is for younger than PCH2.
- Drop the host wakeup bit after resetting PHY on PCH and newer
  devices.
- Increase delay while toggling LANPHYPC
- Move call of wm_reset() in wm_attach() after setting PHY and NVM
  related flags because those flags are used in wm_reset().
- Use mutex for NVM access on ICH8 and newer devices. Same as FreeBSD.
- Rewrite PHY related lock stuff. Almost the same as FreeBSD.
  This change will fix a bug that PHY read/write fail on some cases.
- Increase delay in wm_phy_resetisblocked(). Same as FreeBSD.
- Use semaphore in wm_hv_phy_workaround_ich8lan() and
  wm_k1_gig_workaround_hv()
- Use wm_gii_mdic_readreg/writereg() in wm_access_phy_wakeup_reg_bm()
  because these functions are called with taking lock.
- 82567V_3 is BME1000_E_2(bm). Tested with Advantech AIMB-212 1st
  Ethernet port.
- Use wm_gmii_82544_{read,write}reg() on non-82567 ICH8, 9 and 10.
- Remove an 82578 workaround which was for PCH rev < 3. FreeBSD
  removed this workaround in r228386.
- Add an 82578 workaround which is for PHY rev < 2. From FreeBSD and
  Linux.
- Fix wm(4) input drop packet counter. WMREG_RNBC is incremented when
  there is no available buffers in host memory. However, ethernet
  controller can receive packets in such case if there is space in
  phy's FIFO. That is, ethernet controller drops packet only if there
  is no available buffers *and* there is no space in phy's FIFO. So,
  the number of dropped packets should be added WMREG_MPC only.
- Use MII_ADDRMASK.
- Define WMPHY_I217, WMPHY_VF and WMPHY_210.
- Use BME1000_PHY_PAGE_SELECT in wm_gmii_bm_{read,write}reg(). This
  change has no effect because GG82563_PHY_PAGE_SELECT and
  BME1000_PHY_PAGE_SELECT have the same value.
- Fix PHY access on  82567(ICH8 or ICH10), 82574 and 82583:
  - Use wm_gmii_bm_{read,write}reg() on 82574 and 82573.
  - Issue page select correctly on BM PHYs.
- Fix workaround which did dummy read BM_WUC register. This code was
  changed to drop BM_WUC_HOST_WU_BIT of BM_PROT_GEN_CFG register in
  FreeBSD r228386. The code was added rev. 1.149, but the location was
  not the best.
- wm_gmii_hv_{read/write}reg*(): USE PHY address 1 for some special
  registers.
- Add check code for an 82578 workaround. Not completed yet.
- wm_release_hw_control(): Remove extra line. No any effect.
- Add "10/100" into non-gigabit devices' name.
- Call wm_enable_wakeup() in wm_detach() and wm_suspend(). Now wake on
  lan works on Thinkpad X61(ICH8).
- Fix wm_access_phy_wakeup_reg_bm(). This change has no effect because
  this function is used for WUC register and our driver currenlty
  doesn't access to it.
- Call wm_enable_phy_wakeup() on PCH2 and newer, too. Now these devices
  can do WOL. Tested with Thinkpad X220(PCH2).
- Set CTRL_MEHE correctly (PCH_{LPT,SPT} only).
- Add three workarounds for PCH_{LPT,SPT}.
- Fix a bug that 8257[56], 82580, I35[04] and I21[01] didn't use
  wm_{get,release}_hw_control() correctly.
- Sync wm_smbustopci() with Linux and FreeBSD. This change effects PCH
  and newer devices.
- Move the location of wm_smbustopci() call.
- Fix flag check in wm_get_wakeup()
  - 8254[17]* and 8257[124] should not set WM_F_ARC_SUBSYS_VALID.
  - Add missing WM_T_82541_2 and WM_T_82547_2.
- Fix WOL related setting of the WUC register for other than PCH* in
  wm_enable_wakeup(). Tested with 82567V(ICH8) and 82583V.
- Use common MII_ADDRMASK.
- igphy(4): No binary change:
  - s/IGPPHY/IGPHY/
  - Fix the definition of PLHR_VALID_CHANNEL_*
  - Fix the definition of MSE_CHANNEL_*
  - Add MII_IGPHY_POWER_MGMT.
- Add some KASSERT.
- Add comment. Modify comment.
- Add debug code.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.36.1 src/sys/dev/mii/igphyreg.h
cvs rdiff -u -r1.2 -r1.2.34.1 src/sys/dev/mii/ikphyreg.h
cvs rdiff -u -r1.3 -r1.3.30.1 src/sys/dev/mii/inbmphyreg.h
cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/dev/mii/mii.h
cvs rdiff -u -r1.289.2.10 -r1.289.2.11 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.5 -r1.60.2.6 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.19.2.4 -r1.19.2.5 

CVS commit: [netbsd-7] src/sys/dev/mii

2016-12-11 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Dec 12 07:04:31 UTC 2016

Modified Files:
src/sys/dev/mii [netbsd-7]: atphy.c ihphy.c ikphy.c inphy.c makphy.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1301):
sys/dev/mii/inphy.c: revision 1.55
sys/dev/mii/makphy.c: revision 1.42
sys/dev/mii/ikphy.c: revision 1.12
sys/dev/mii/atphy.c: revision 1.18
sys/dev/mii/ihphy.c: revision 1.10
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,model,rev}.
--
Set mii_mpd_{oui,rev}.


To generate a diff of this commit:
cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/dev/mii/ihphy.c
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/dev/mii/ikphy.c
cvs rdiff -u -r1.53 -r1.53.2.1 src/sys/dev/mii/inphy.c
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/mii/makphy.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/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.16.2.1 src/sys/dev/mii/atphy.c:1.16.2.2
--- src/sys/dev/mii/atphy.c:1.16.2.1	Wed Nov  4 18:19:58 2015
+++ src/sys/dev/mii/atphy.c	Mon Dec 12 07:04:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.16.2.1 2015/11/04 18:19:58 riz Exp $ */
+/*	$NetBSD: atphy.c,v 1.16.2.2 2016/12/12 07:04:31 snj Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.16.2.1 2015/11/04 18:19:58 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.16.2.2 2016/12/12 07:04:31 snj Exp $");
 
 #include 
 #include 
@@ -146,6 +146,9 @@ atphy_attach(device_t parent, device_t s
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = MII_REV(ma->mii_id2);
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;

Index: src/sys/dev/mii/ihphy.c
diff -u src/sys/dev/mii/ihphy.c:1.8 src/sys/dev/mii/ihphy.c:1.8.2.1
--- src/sys/dev/mii/ihphy.c:1.8	Mon Jun 16 16:48:16 2014
+++ src/sys/dev/mii/ihphy.c	Mon Dec 12 07:04:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ihphy.c,v 1.8 2014/06/16 16:48:16 msaitoh Exp $	*/
+/*	$NetBSD: ihphy.c,v 1.8.2.1 2016/12/12 07:04:31 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.8 2014/06/16 16:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihphy.c,v 1.8.2.1 2016/12/12 07:04:31 snj Exp $");
 
 #include 
 #include 
@@ -132,6 +132,9 @@ ihphyattach(device_t parent, device_t se
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = MII_REV(ma->mii_id2);
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;

Index: src/sys/dev/mii/ikphy.c
diff -u src/sys/dev/mii/ikphy.c:1.10 src/sys/dev/mii/ikphy.c:1.10.2.1
--- src/sys/dev/mii/ikphy.c:1.10	Mon Jun 16 16:48:16 2014
+++ src/sys/dev/mii/ikphy.c	Mon Dec 12 07:04:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ikphy.c,v 1.10 2014/06/16 16:48:16 msaitoh Exp $	*/
+/*	$NetBSD: ikphy.c,v 1.10.2.1 2016/12/12 07:04:31 snj Exp $	*/
 
 /***
 Copyright (c) 2001-2005, Intel Corporation 
@@ -59,7 +59,7 @@ POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.10 2014/06/16 16:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ikphy.c,v 1.10.2.1 2016/12/12 07:04:31 snj Exp $");
 
 #include 
 #include 
@@ -125,6 +125,9 @@ ikphyattach(device_t parent, device_t se
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = ma->mii_phyno;
+	sc->mii_mpd_oui = MII_OUI(ma->mii_id1, ma->mii_id2);
+	sc->mii_mpd_model = MII_MODEL(ma->mii_id2);
+	sc->mii_mpd_rev = MII_REV(ma->mii_id2);
 	sc->mii_funcs = _funcs;
 	sc->mii_pdata = mii;
 	sc->mii_flags = ma->mii_flags;

Index: src/sys/dev/mii/inphy.c
diff -u src/sys/dev/mii/inphy.c:1.53 src/sys/dev/mii/inphy.c:1.53.2.1
--- src/sys/dev/mii/inphy.c:1.53	Mon Jun 16 16:48:16 2014
+++ src/sys/dev/mii/inphy.c	Mon Dec 12 07:04:31 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: inphy.c,v 1.53 2014/06/16 16:48:16 msaitoh Exp $	*/
+/*	$NetBSD: inphy.c,v 1.53.2.1 2016/12/12 07:04:31 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.53 2014/06/16 16:48:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: inphy.c,v 1.53.2.1 2016/12/12 07:04:31 snj Exp $");
 
 #include 
 #include 
@@ -137,6 +137,9 @@ inphyattach(device_t parent, device_t se
 	sc->mii_dev = self;
 	sc->mii_inst = mii->mii_instance;
 	sc->mii_phy = 

CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 05:28:26 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: pcidevs.h pcidevs_data.h

Log Message:
regen for ticket 1300


To generate a diff of this commit:
cvs rdiff -u -r1.1192.2.8 -r1.1192.2.9 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1191.2.8 -r1.1191.2.9 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1192.2.8 src/sys/dev/pci/pcidevs.h:1.1192.2.9
--- src/sys/dev/pci/pcidevs.h:1.1192.2.8	Fri Dec  9 05:16:34 2016
+++ src/sys/dev/pci/pcidevs.h	Fri Dec  9 05:28:12 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1192.2.8 2016/12/09 05:16:34 snj Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1192.2.9 2016/12/09 05:28:12 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1199.2.8 2016/12/09 05:15:18 snj Exp
+ *	NetBSD: pcidevs,v 1.1199.2.9 2016/12/09 05:27:30 snj Exp
  */
 
 /*
@@ -2975,7 +2975,7 @@
 #define	PCI_PRODUCT_INTEL_82870P2_PPB	0x1460		/* 82870P2 P64H2 PCI-PCI Bridge */
 #define	PCI_PRODUCT_INTEL_82870P2_IOxAPIC	0x1461		/* 82870P2 P64H2 IOxAPIC */
 #define	PCI_PRODUCT_INTEL_82870P2_HPLUG	0x1462		/* 82870P2 P64H2 Hot Plug Controller */
-#define	PCI_PRODUCT_INTEL_82801I_82567V_3	0x1501		/* i82567V-3 LAN Controller */
+#define	PCI_PRODUCT_INTEL_82801H_82567V_3	0x1501		/* i82567V-3 LAN Controller */
 #define	PCI_PRODUCT_INTEL_PCH2_LV_LM	0x1502		/* 82579LM Gigabit Network Connection */
 #define	PCI_PRODUCT_INTEL_PCH2_LV_V	0x1503		/* 82579V Gigabit Network Connection */
 #define	PCI_PRODUCT_INTEL_82599_SFP_EM	0x1507		/* 82599 10G Ethernet Express Module */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1191.2.8 src/sys/dev/pci/pcidevs_data.h:1.1191.2.9
--- src/sys/dev/pci/pcidevs_data.h:1.1191.2.8	Fri Dec  9 05:16:35 2016
+++ src/sys/dev/pci/pcidevs_data.h	Fri Dec  9 05:28:13 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1191.2.8 2016/12/09 05:16:35 snj Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1191.2.9 2016/12/09 05:28:13 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1199.2.8 2016/12/09 05:15:18 snj Exp
+ *	NetBSD: pcidevs,v 1.1199.2.9 2016/12/09 05:27:30 snj Exp
  */
 
 /*
@@ -4686,7 +4686,7 @@ static const uint16_t pci_products[] = {
 	19362, 19370, 17461, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82870P2_HPLUG, 
 	19362, 19370, 19376, 19380, 6293, 0,
-	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801I_82567V_3, 
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82801H_82567V_3, 
 	19385, 4534, 6293, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PCH2_LV_LM, 
 	19395, 5547, 3888, 18507, 0,



CVS commit: [netbsd-7] src/sys/dev/mii

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 05:23:31 UTC 2016

Modified Files:
src/sys/dev/mii [netbsd-7]: miidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1299):
sys/dev/mii/miidevs: revisions 1.123, 1.124
Add xxMarvell E6060 6-port 10/100 Fast Ethernet Switch
--
Add Marvell 88E1512.


To generate a diff of this commit:
cvs rdiff -u -r1.120.2.1 -r1.120.2.2 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.120.2.1 src/sys/dev/mii/miidevs:1.120.2.2
--- src/sys/dev/mii/miidevs:1.120.2.1	Sat Jan 17 13:46:39 2015
+++ src/sys/dev/mii/miidevs	Fri Dec  9 05:23:31 2016
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.120.2.1 2015/01/17 13:46:39 martin Exp $
+$NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -261,6 +261,8 @@ model xxMARVELL E1112		0x0009 Marvell 88
 model xxMARVELL E1149		0x000b Marvell 88E1149 Gigabit PHY
 model xxMARVELL E		0x000c Marvell 88E Gigabit PHY
 model xxMARVELL E1145		0x000d Marvell 88E1145 Quad Gigabit PHY
+model xxMARVELL E6060		0x0010 Marvell 88E6060 6-Port 10/100 Fast Ethernet Switch
+model xxMARVELL E1512		0x001d Marvell 88E1512 Gigabit PHY
 model xxMARVELL E1116		0x0021 Marvell 88E1116 Gigabit PHY
 model xxMARVELL E1118		0x0022 Marvell 88E1118 Gigabit PHY
 model xxMARVELL E1116R		0x0024 Marvell 88E1116R Gigabit PHY



CVS commit: [netbsd-7] src/sys/dev/mii

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 05:23:58 UTC 2016

Modified Files:
src/sys/dev/mii [netbsd-7]: miidevs.h miidevs_data.h

Log Message:
regen for ticket 1299


To generate a diff of this commit:
cvs rdiff -u -r1.123.2.1 -r1.123.2.2 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.111.2.1 -r1.111.2.2 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.123.2.1 src/sys/dev/mii/miidevs.h:1.123.2.2
--- src/sys/dev/mii/miidevs.h:1.123.2.1	Sat Jan 17 14:13:40 2015
+++ src/sys/dev/mii/miidevs.h	Fri Dec  9 05:23:58 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.123.2.1 2015/01/17 14:13:40 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.123.2.2 2016/12/09 05:23:58 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.120.2.1 2015/01/17 13:46:39 martin Exp
+ *	NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp
  */
 
 /*-
@@ -383,6 +383,10 @@
 #define	MII_STR_xxMARVELL_E	"Marvell 88E Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1145	0x000d
 #define	MII_STR_xxMARVELL_E1145	"Marvell 88E1145 Quad Gigabit PHY"
+#define	MII_MODEL_xxMARVELL_E6060	0x0010
+#define	MII_STR_xxMARVELL_E6060	"Marvell 88E6060 6-Port 10/100 Fast Ethernet Switch"
+#define	MII_MODEL_xxMARVELL_E1512	0x001d
+#define	MII_STR_xxMARVELL_E1512	"Marvell 88E1512 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1116	0x0021
 #define	MII_STR_xxMARVELL_E1116	"Marvell 88E1116 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1118	0x0022

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.111.2.1 src/sys/dev/mii/miidevs_data.h:1.111.2.2
--- src/sys/dev/mii/miidevs_data.h:1.111.2.1	Sat Jan 17 14:13:40 2015
+++ src/sys/dev/mii/miidevs_data.h	Fri Dec  9 05:23:58 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.111.2.1 2015/01/17 14:13:40 martin Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.111.2.2 2016/12/09 05:23:58 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.120.2.1 2015/01/17 13:46:39 martin Exp
+ *	NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp
  */
 
 /*-
@@ -152,6 +152,8 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1149, MII_STR_xxMARVELL_E1149 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E, MII_STR_xxMARVELL_E },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1145, MII_STR_xxMARVELL_E1145 },
+ { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E6060, MII_STR_xxMARVELL_E6060 },
+ { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1512, MII_STR_xxMARVELL_E1512 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1116, MII_STR_xxMARVELL_E1116 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1118, MII_STR_xxMARVELL_E1118 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_E1116R, MII_STR_xxMARVELL_E1116R },



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 05:27:30 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: if_wm.c pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1300):
sys/dev/pci/pcidevs: revision 1.1270
sys/dev/pci/if_wm.c: revision 1.426
i82567V-3 is not ICH9 but ICH8.
--
82567V-3 is not ICH9 but ICH8.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.9 -r1.289.2.10 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.1199.2.8 -r1.1199.2.9 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.9 src/sys/dev/pci/if_wm.c:1.289.2.10
--- src/sys/dev/pci/if_wm.c:1.289.2.9	Fri Feb 26 22:08:17 2016
+++ src/sys/dev/pci/if_wm.c	Fri Dec  9 05:27:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.9 2016/02/26 22:08:17 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.10 2016/12/09 05:27:30 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.9 2016/02/26 22:08:17 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.10 2016/12/09 05:27:30 snj Exp $");
 
 #include 
 #include 
@@ -1029,6 +1029,9 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82801H_IFE_G,
 	  "Intel i82801H IFE (G) LAN Controller",
 	  WM_T_ICH8,		WMP_F_COPPER },
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82801H_82567V_3,
+	  "82567V-3 LAN Controller",
+	  WM_T_ICH8,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82801I_IGP_AMT,
 	  "82801I (AMT) LAN Controller",
 	  WM_T_ICH9,		WMP_F_COPPER },
@@ -1056,9 +1059,6 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82801I_BM,
 	  "82567LM-4 LAN Controller",
 	  WM_T_ICH9,		WMP_F_COPPER },
-	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82801I_82567V_3,
-	  "82567V-3 LAN Controller",
-	  WM_T_ICH9,		WMP_F_COPPER },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82801J_R_BM_LM,
 	  "82567LM-2 LAN Controller",
 	  WM_T_ICH10,		WMP_F_COPPER },

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1199.2.8 src/sys/dev/pci/pcidevs:1.1199.2.9
--- src/sys/dev/pci/pcidevs:1.1199.2.8	Fri Dec  9 05:15:18 2016
+++ src/sys/dev/pci/pcidevs	Fri Dec  9 05:27:30 2016
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.8 2016/12/09 05:15:18 snj Exp $
+$NetBSD: pcidevs,v 1.1199.2.9 2016/12/09 05:27:30 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2968,7 +2968,7 @@ product INTEL 82439HX		0x1250	82439HX (T
 product INTEL 82870P2_PPB	0x1460	82870P2 P64H2 PCI-PCI Bridge
 product INTEL 82870P2_IOxAPIC	0x1461	82870P2 P64H2 IOxAPIC
 product INTEL 82870P2_HPLUG	0x1462	82870P2 P64H2 Hot Plug Controller
-product INTEL 82801I_82567V_3	0x1501	i82567V-3 LAN Controller
+product INTEL 82801H_82567V_3	0x1501	i82567V-3 LAN Controller
 product INTEL PCH2_LV_LM	0x1502	82579LM Gigabit Network Connection
 product INTEL PCH2_LV_V		0x1503	82579V Gigabit Network Connection
 product INTEL 82599_SFP_EM	0x1507	82599 10G Ethernet Express Module



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 05:15:18 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: pcidevs piixide.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1298):
sys/dev/pci/piixide.c: revision 1.65
sys/dev/pci/pcidevs: revision 1.1246
- s/82081/82801/ from OpenBSD.
- 0x2829 is SATA. 0x282a is RAID.
--
Rename macro (sync with pcidevs rev. 1.1246). No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.1199.2.7 -r1.1199.2.8 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.64 -r1.64.12.1 src/sys/dev/pci/piixide.c

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1199.2.7 src/sys/dev/pci/pcidevs:1.1199.2.8
--- src/sys/dev/pci/pcidevs:1.1199.2.7	Thu Dec  8 07:56:45 2016
+++ src/sys/dev/pci/pcidevs	Fri Dec  9 05:15:18 2016
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.7 2016/12/08 07:56:45 snj Exp $
+$NetBSD: pcidevs,v 1.1199.2.8 2016/12/09 05:15:18 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3571,8 +3571,8 @@ product INTEL 82801H_SATA_2	0x2825	82801
 product INTEL C610_SATA_RAID_3	0x2826	C61x/X99 SATA Controller (RAID)
 product INTEL C610_SSATA_RAID_2	0x2827	C61x/X99 sSATA Controller (RAID)
 product INTEL 82801HEM_SATA	0x2828	82801HEM SATA Controller
-product INTEL 82801HBM_SATA_1	0x2829  82801HBM SATA Controller
-product INTEL 82801HBM_SATA_2	0x282a	82081HBM SATA Controller
+product INTEL 82801HBM_SATA_AHCI 0x2829  82801HBM AHCI SATA Controller
+product INTEL 82801HBM_SATA_RAID 0x282a	82801HBM SATA RAID Controller
 product INTEL 82801H_USB_1	0x2830	82801H USB UHCI Controller
 product INTEL 82801H_USB_2	0x2831	82801H USB UHCI Controller
 product INTEL 82801H_USB_3	0x2832	82801H USB UHCI Controller

Index: src/sys/dev/pci/piixide.c
diff -u src/sys/dev/pci/piixide.c:1.64 src/sys/dev/pci/piixide.c:1.64.12.1
--- src/sys/dev/pci/piixide.c:1.64	Wed Nov 14 01:05:49 2012
+++ src/sys/dev/pci/piixide.c	Fri Dec  9 05:15:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: piixide.c,v 1.64 2012/11/14 01:05:49 jakllsch Exp $	*/
+/*	$NetBSD: piixide.c,v 1.64.12.1 2016/12/09 05:15:18 snj Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.64 2012/11/14 01:05:49 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.64.12.1 2016/12/09 05:15:18 snj Exp $");
 
 #include 
 #include 
@@ -203,14 +203,14 @@ static const struct pciide_product_desc 
 	  "Intel 82801HBM IDE Controller (ICH8M)",
 	  piix_chip_map,
 	},
-	{ PCI_PRODUCT_INTEL_82801HBM_SATA_1,
+	{ PCI_PRODUCT_INTEL_82801HBM_SATA_AHCI,
 	  0,
-	  "Intel 82801HBM Serial ATA Controller (ICH8M)",
+	  "Intel 82801HBM Serial ATA AHCI Controller (ICH8M)",
 	  piixsata_chip_map,
 	},
-	{ PCI_PRODUCT_INTEL_82801HBM_SATA_2,
+	{ PCI_PRODUCT_INTEL_82801HBM_SATA_RAID,
 	  0,
-	  "Intel 82801HBM Serial ATA Controller (ICH8M)",
+	  "Intel 82801HBM Serial ATA RAID Controller (ICH8M)",
 	  piixsata_chip_map,
 	},
 	{ PCI_PRODUCT_INTEL_82801HEM_SATA,



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 04:56:25 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: pci_subr.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1296):
sys/dev/pci/pci_subr.c: revision 1.155 via patch
Protect against buffer overflow.


To generate a diff of this commit:
cvs rdiff -u -r1.124.2.2 -r1.124.2.3 src/sys/dev/pci/pci_subr.c

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.124.2.2 src/sys/dev/pci/pci_subr.c:1.124.2.3
--- src/sys/dev/pci/pci_subr.c:1.124.2.2	Sun Dec 14 16:49:35 2014
+++ src/sys/dev/pci/pci_subr.c	Fri Dec  9 04:56:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.124.2.2 2014/12/14 16:49:35 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.124.2.3 2016/12/09 04:56:25 snj Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.124.2.2 2014/12/14 16:49:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.124.2.3 2016/12/09 04:56:25 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #else
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -618,6 +619,43 @@ pci_findproduct_stub(pcireg_t id_reg)
 }
 #endif
 
+/*
+ * Append a formatted string to dest without writing more than len
+ * characters (including the trailing NUL character).  dest and len
+ * are updated for use in subsequent calls to snappendf().
+ *
+ * Returns 0 on success, a negative value if vnsprintf() fails, or
+ * a positive value if the dest buffer would have overflowed.
+ */
+
+static int __printflike(3,4)
+snappendf(char **dest, size_t *len, const char * restrict fmt, ...)
+{
+	va_list	ap;
+	int count;
+
+	va_start(ap, fmt);
+	count = vsnprintf(*dest, *len, fmt, ap);
+	va_end(ap);
+
+	/* Let vsnprintf() errors bubble up to caller */
+	if (count < 0 || *len == 0)
+		return count;
+
+	/* Handle overflow */
+	if ((size_t)count >= *len) {
+		*dest += *len - 1;
+		*len = 1;
+		return 1;
+	}
+
+	/* Update dest & len to point at trailing NUL */
+	*dest += count;
+	*len -= count;
+		
+	return 0;
+}
+
 void
 pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, int showclass, char *cp,
 size_t l)
@@ -631,9 +669,6 @@ pci_devinfo(pcireg_t id_reg, pcireg_t cl
 	const char *unmatched = pci_unmatched;
 	const char *vendor_namep, *product_namep;
 	const struct pci_class *classp, *subclassp, *interfacep;
-	char *ep;
-
-	ep = cp + l;
 
 	vendor = PCI_VENDOR(id_reg);
 	product = PCI_PRODUCT(id_reg);
@@ -669,39 +704,35 @@ pci_devinfo(pcireg_t id_reg, pcireg_t cl
 	}
 
 	if (vendor_namep == NULL)
-		cp += snprintf(cp, ep - cp, "%svendor 0x%04x product 0x%04x",
+		(void)snappendf(, , "%svendor 0x%04x product 0x%04x",
 		unmatched, vendor, product);
 	else if (product_namep != NULL)
-		cp += snprintf(cp, ep - cp, "%s %s", vendor_namep,
-		product_namep);
+		(void)snappendf(, , "%s %s", vendor_namep, product_namep);
 	else
-		cp += snprintf(cp, ep - cp, "%s product 0x%04x",
+		(void)snappendf(, , "%s product 0x%04x",
 		vendor_namep, product);
 	if (showclass) {
-		cp += snprintf(cp, ep - cp, " (");
+		(void)snappendf(, , " (");
 		if (classp->name == NULL)
-			cp += snprintf(cp, ep - cp,
+			(void)snappendf(, ,
 			"class 0x%02x, subclass 0x%02x", class, subclass);
 		else {
 			if (subclassp == NULL || subclassp->name == NULL)
-cp += snprintf(cp, ep - cp,
-"%s, subclass 0x%02x",
+(void)snappendf(, , "%s, subclass 0x%02x",
 classp->name, subclass);
 			else
-cp += snprintf(cp, ep - cp, "%s %s",
+(void)snappendf(, , "%s %s",
 subclassp->name, classp->name);
 		}
 		if ((interfacep == NULL) || (interfacep->name == NULL)) {
 			if (interface != 0)
-cp += snprintf(cp, ep - cp,
-", interface 0x%02x", interface);
+(void)snappendf(, , ", interface 0x%02x",
+interface);
 		} else if (strncmp(interfacep->name, "", 1) != 0)
-			cp += snprintf(cp, ep - cp, ", %s",
-			interfacep->name);
+			(void)snappendf(, , ", %s", interfacep->name);
 		if (revision != 0)
-			cp += snprintf(cp, ep - cp, ", revision 0x%02x",
-			revision);
-		cp += snprintf(cp, ep - cp, ")");
+			(void)snappendf(, , ", revision 0x%02x", revision);
+		(void)snappendf(, , ")");
 	}
 }
 



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Dec  9 04:43:08 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: ichsmb.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1294):
sys/dev/pci/ichsmb.c: revisions 1.43-1.44
ichsmb(4): Add Braswell PCU SMBus and Intel 100 Series SMBus.


To generate a diff of this commit:
cvs rdiff -u -r1.37.2.2 -r1.37.2.3 src/sys/dev/pci/ichsmb.c

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

Modified files:

Index: src/sys/dev/pci/ichsmb.c
diff -u src/sys/dev/pci/ichsmb.c:1.37.2.2 src/sys/dev/pci/ichsmb.c:1.37.2.3
--- src/sys/dev/pci/ichsmb.c:1.37.2.2	Thu Apr 30 19:27:20 2015
+++ src/sys/dev/pci/ichsmb.c	Fri Dec  9 04:43:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.37.2.2 2015/04/30 19:27:20 snj Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.37.2.3 2016/12/09 04:43:08 snj Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.37.2.2 2015/04/30 19:27:20 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.37.2.3 2016/12/09 04:43:08 snj Exp $");
 
 #include 
 #include 
@@ -111,9 +111,11 @@ ichsmb_match(device_t parent, cfdata_t m
 		case PCI_PRODUCT_INTEL_7SERIES_SMB:
 		case PCI_PRODUCT_INTEL_8SERIES_SMB:
 		case PCI_PRODUCT_INTEL_9SERIES_SMB:
+		case PCI_PRODUCT_INTEL_100SERIES_SMB:
 		case PCI_PRODUCT_INTEL_CORE4G_M_SMB:
 		case PCI_PRODUCT_INTEL_CORE5G_M_SMB:
 		case PCI_PRODUCT_INTEL_BAYTRAIL_PCU_SMB:
+		case PCI_PRODUCT_INTEL_BSW_PCU_SMB:
 		case PCI_PRODUCT_INTEL_C600_SMBUS:
 		case PCI_PRODUCT_INTEL_C600_SMB_0:
 		case PCI_PRODUCT_INTEL_C600_SMB_1:



CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 07:58:04 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: pcidevs.h pcidevs_data.h

Log Message:
regen for ticket 1291


To generate a diff of this commit:
cvs rdiff -u -r1.1192.2.6 -r1.1192.2.7 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1191.2.6 -r1.1191.2.7 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 07:56:45 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: pcidevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1291):
sys/dev/pci/pcidevs: revisions 1.1221-1.1245, 1.1247-1.1262, 
1.1264-1.1269, 1.1271-1.1273
- Add SystemBase SB16C1050 UARTs.
- Add D-Link DFE520TX (part of PR#49889 reported by Maxim Tsyplakov).
- Add Realtek RTL8188EE and RTL8192CE
- Add PLX Technology PEX 8111.
- Add some Red Hat devices.
- Add Samsung SM951.
- Add several NVIDIA geforce and NVS cards.
- Add some ATI/AMD devices.
- Add Radeon HD 2400 and TSB82AA2 IEEE 1394 Host Controller.
  Reported by T. M. Pederson (PR#40987).
- Add some Edimax, AWT, Fusion-io and Ralink devices of ral(4).
- Add MSI RT3090, Edimax RT3591, Ralink RT 536[02] and RT5390 of
  ral(4).
- Add vendor ID of Super Micro.
- Add MegaRAID SAS3008.
- Fix entries. The following problems were found while sorting entries:
  - Remove the following entries because the value is duplicated:
CMDTECH_240 (CMDTECH_AAR_1210SA has the same value)
INTEL_C610_SATA_RAID (INTEL_82801H_SATA_RAID has the same vaule)
INTEL_C610_PCIE_1_3 (82801BA_HPB has the same value)
GEFORCE_610M3   (GEFORCE_610M2 has the same value)
  - RADEON_RV350_NQ is not 0x4e41 but 0x4e51
  - 82801JD_SATA_RAID is not 0x3a02 but 0x3a05.
  - The following two entries have the same number. Fix one of them:
DH89XXCL_USB_2 to 0x23b5(was 0x23b4 (== DH89XXCL_USB_1))
5500_HB to 0x3404 and change the desc (was 0x3403 (== 3400_HB))
82X58_PCIE_0_1 to 0x3421(was 0x3420 (== 82X58_PCIE_0_0))
82801JI_THERMAL to 0x3a32   (was 0x3a30 (== 82801JI_SMB))
- Add the following Intel entries:
  - PCIe NVMe SSD.
  - Dual Band Wireless AC 3165.
  - I219 family Ethernet devices.
  - Dual Band Wireless AC 3165, 4165 and 8260 devices.
  - 82597EX_SR (part of PR#47750).
  - Braswell devices.
  - Core 6G devices.
  - 100 series chipset devices.
  - Xeon D devices.
  - Xeon 5[56]00 devices.
  - Xeon E7 v4 devices.
- Add "Core i7-6xxxK" to some Intel devices' description.
- Fix Intel XE5_V3_IMC1_DDRIO_[34]'s values.
- Add another ID for Intel 82Q45 KT.
- Add some entries of Intel 965 Express Chipset.
- Add some Intel Xeon E5 v3 devices.
- Add some Intel 1st gen Core PCI devices.
- Add some Intel Core 5G devices.
- Add some Intel Core i7-6xxxK devices.
- Add some Intel Core i7-800 and i5-700 devices.
- Add some Intel 10G devices.
- Add ASMedia ASM1042A USB 3.0 Host Controller.
- Add ASMEDIA ASM1083/1085/1142.
- Add Marvell Armada38x and 88AP510.
- Add Qualcomm Atheros QCA986x/988x.
- Add Atheros AR9565 Wireless LAN.
- Sort entries in device ID's order.
- Fix typo.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1199.2.6 src/sys/dev/pci/pcidevs:1.1199.2.7
--- src/sys/dev/pci/pcidevs:1.1199.2.6	Sun Apr 19 16:26:23 2015
+++ src/sys/dev/pci/pcidevs	Thu Dec  8 07:56:45 2016
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.6 2015/04/19 16:26:23 riz Exp $
+$NetBSD: pcidevs,v 1.1199.2.7 2016/12/08 07:56:45 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -529,10 +529,9 @@ vendor ITE		0x1283	Integrated Technology
 vendor ESSTECH2		0x1285	ESS Technology
 vendor TRITECH		0x1292	TriTech Microelectronics
 vendor KOFAX		0x1296	Kofax Image Products
-vendor ALTEON		0x12ae	Alteon
 vendor RISCOM		0x12aa	RISCom
+vendor ALTEON		0x12ae	Alteon
 vendor USR		0x12b9	US Robotics (3Com)
-vendor USR2		0x16ec	US Robotics
 vendor PICTUREEL	0x12c5	Picture Elements
 vendor NVIDIA_SGS	0x12d2	Nvidia & SGS-Thomson Microelectronics
 vendor PERICOM		0x12d8	Pericom Semiconductors
@@ -568,12 +567,13 @@ vendor ICENSEMBLE	0x1412	IC Ensemble / V
 vendor MICROSOFT	0x1414	Microsoft
 vendor OXFORDSEMI	0x1415	Oxford Semiconductor
 vendor CHELSIO		0x1425	Chelsio Communications
+vendor EDIMAX		0x1432	Edimax
 vendor TAMARACK		0x143d	Tamarack Microelectronics
 vendor SAMSUNGELEC3	0x144d	Samsung Electronics (3rd vendor ID)
 vendor ASKEY		0x144f	Askey Computer
 vendor AVERMEDIA	0x1461	Avermedia Technologies
+vendor MSI		0x1462 	Micro-star International Co Ltd
 vendor SYSTEMBASE	0x14a1	System Base
-vendor MARVELL2		0x1b4b	Marvell
 vendor AIRONET		0x14b9	Aironet Wireless Communications
 vendor COMPAL		0x14c0	COMPAL Electronics
 vendor MYRICOM		0x14c1	Myricom
@@ -584,6 +584,7 @@ vendor BROADCOM		0x14e4	Broadcom
 vendor PLANEX		0x14ea	Planex Communications
 vendor CONEXANT		0x14f1	Conexant Systems
 vendor DELTA		0x1500	Delta Electronics
+vendor MYSON		0x1516	Myson-Century Technology
 vendor ENE		0x1524	ENE Technology
 vendor TERRATEC		0x153b	TerraTec Electronic
 vendor PERLE		0x155f	Perle Systems
@@ -594,18 +595,19 @@ vendor FARADAY		0x159b	Faraday Technolog
 vendor 

CVS commit: [netbsd-7] src/sys/dev/pci

2016-12-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 07:52:51 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: satalink.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1290):
sys/dev/pci/satalink.c: revision 1.53
Remove PCI_PRODUCT_CMDTECH_240's entry because CMDTECH_AAR_1210SA has
the same ID.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.4.1 src/sys/dev/pci/satalink.c

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

Modified files:

Index: src/sys/dev/pci/satalink.c
diff -u src/sys/dev/pci/satalink.c:1.52 src/sys/dev/pci/satalink.c:1.52.4.1
--- src/sys/dev/pci/satalink.c:1.52	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/satalink.c	Thu Dec  8 07:52:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: satalink.c,v 1.52 2014/03/29 19:28:25 christos Exp $	*/
+/*	$NetBSD: satalink.c,v 1.52.4.1 2016/12/08 07:52:51 snj Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.52 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: satalink.c,v 1.52.4.1 2016/12/08 07:52:51 snj Exp $");
 
 #include 
 #include 
@@ -275,11 +275,6 @@ static const struct pciide_product_desc 
 	  "Silicon Image SATALink 3112",
 	  sii3112_chip_map,
 	},
-	{ PCI_PRODUCT_CMDTECH_240,
-	  0,
-	  "Silicon Image SATALink Sil240",
-	  sii3112_chip_map,
-	},
 	{ PCI_PRODUCT_CMDTECH_3512,
 	  0,
 	  "Silicon Image SATALink 3512",



CVS commit: [netbsd-7] src/sys/dev/usb

2016-12-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 07:50:17 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket 1289


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.5 -r1.672.2.6 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.5 -r1.673.2.6 src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.672.2.5 src/sys/dev/usb/usbdevs.h:1.672.2.6
--- src/sys/dev/usb/usbdevs.h:1.672.2.5	Sun Sep 18 06:01:05 2016
+++ src/sys/dev/usb/usbdevs.h	Thu Dec  8 07:50:15 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.672.2.5 2016/09/18 06:01:05 snj Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.672.2.6 2016/12/08 07:50:15 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp
+ *	NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp
  */
 
 /*
@@ -324,6 +324,7 @@
 #define	USB_VENDOR_ARASAN	0x07da		/* Arasan Chip Systems */
 #define	USB_VENDOR_ALLIEDCABLE	0x07e6		/* Allied Cable */
 #define	USB_VENDOR_STSN	0x07ef		/* STSN */
+#define	USB_VENDOR_CENTURY	0x07f7		/* CENTURY Corporation */
 #define	USB_VENDOR_BEWAN	0x07fa		/* Bewan */
 #define	USB_VENDOR_ZOOM	0x0803		/* Zoom Telephonics */
 #define	USB_VENDOR_BROADLOGIC	0x0827		/* BroadLogic */
@@ -493,6 +494,7 @@
 #define	USB_VENDOR_MOBILITY	0x1342		/* Mobility */
 #define	USB_VENDOR_DICKSMITH	0x1371		/* Dick Smith Electronics */
 #define	USB_VENDOR_NETGEAR3	0x1385		/* Netgear */
+#define	USB_VENDOR_VALIDITY	0x138a		/* Validity Sensors, Inc. */
 #define	USB_VENDOR_BALTECH	0x13ad		/* Baltech */
 #define	USB_VENDOR_CISCOLINKSYS	0x13b1		/* Cisco-Linksys */
 #define	USB_VENDOR_SHARK	0x13d2		/* Shark */
@@ -557,9 +559,12 @@
 #define	USB_VENDOR_PARA	0x20b8		/* PARA Industrial */
 #define	USB_VENDOR_TRENDNET	0x20f4		/* TRENDnet */
 #define	USB_VENDOR_DLINK3	0x2101		/* D-Link */
+#define	USB_VENDOR_VIALABS	0x2109		/* VIA Labs */
 #define	USB_VENDOR_ERICSSON	0x2282		/* Ericsson */
 #define	USB_VENDOR_MOTOROLA2	0x22b8		/* Motorola */
 #define	USB_VENDOR_PINNACLE	0x2304		/* Pinnacle Systems */
+#define	USB_VENDOR_ARDUINO	0x2341		/* Arduino SA */
+#define	USB_VENDOR_TPLINK	0x2357		/* TP-Link */
 #define	USB_VENDOR_TRIPPLITE	0x2478		/* Tripp-Lite */
 #define	USB_VENDOR_HIROSE	0x2631		/* Hirose Electric */
 #define	USB_VENDOR_NHJ	0x2770		/* NHJ */
@@ -580,6 +585,7 @@
 #define	USB_VENDOR_SWEEX	0x5173		/* Sweex */
 #define	USB_VENDOR_ONSPEC2	0x55aa		/* OnSpec Electronic Inc. */
 #define	USB_VENDOR_ZINWELL	0x5a57		/* Zinwell */
+#define	USB_VENDOR_INGENIC	0x601a		/* Ingenic Semiconductor Ltd. */
 #define	USB_VENDOR_SITECOM	0x6189		/* Sitecom */
 #define	USB_VENDOR_SPRINGERDESIGN	0x6400		/* Springer Design, Inc. */
 #define	USB_VENDOR_ARKMICROCHIPS	0x6547		/* ArkMicroChips */
@@ -592,6 +598,9 @@
 #define	USB_VENDOR_NETGEAR4	0x9846		/* Netgear */
 #define	USB_VENDOR_xxFTDI	0x9e88		/* FTDI */
 #define	USB_VENDOR_CACE	0xcace		/* CACE Technologies */
+#define	USB_VENDOR_COMPARE	0xcdab		/* Compare */
+#define	USB_VENDOR_DATAAPEX	0xdaae		/* DataApex */
+#define	USB_VENDOR_EVOLUTION	0xdeee		/* Evolution Robotics */
 #define	USB_VENDOR_EMPIA	0xeb1a		/* eMPIA Technology */
 #define	USB_VENDOR_HP2	0xf003		/* Hewlett Packard */
 #define	USB_VENDOR_USRP	0xfffe		/* GNU Radio USRP */
@@ -647,6 +656,7 @@
 #define	USB_PRODUCT_ABOCOM_UFE2000	0x420a		/* UFE2000 USB2.0 Fast Ethernet Adapter */
 #define	USB_PRODUCT_ABOCOM_WL54	0x6001		/* WL54 */
 #define	USB_PRODUCT_ABOCOM_RTL8192CU	0x8178		/* RTL8192CU */
+#define	USB_PRODUCT_ABOCOM_RTL8188EU	0x8179		/* RTL8188EU */
 #define	USB_PRODUCT_ABOCOM_RTL8188CU_1	0x8188		/* RTL8188CU */
 #define	USB_PRODUCT_ABOCOM_RTL8188CU_2	0x8189		/* RTL8188CU */
 #define	USB_PRODUCT_ABOCOM_XX10	0xabc1		/* XX10 */
@@ -863,7 +873,14 @@
 #define	USB_PRODUCT_APPLE_IPOD_TOUCH_4G	0x129e		/* iPod Touch 4G */
 #define	USB_PRODUCT_APPLE_IPHONE_3G	0x1292		/* iPhone 3G */
 #define	USB_PRODUCT_APPLE_IPHONE_3GS	0x1294		/* iPhone 3GS */
+#define	USB_PRODUCT_APPLE_IPHONE_4	0x1297		/* iPhone 4 */
+#define	USB_PRODUCT_APPLE_IPHONE_4_VZW	0x129c		/* iPhone 4 (VZW) */
+#define	USB_PRODUCT_APPLE_IPHONE_4S	0x12a0		/* iPhone 4S */
+#define	USB_PRODUCT_APPLE_IPHONE_5	0x12a8		/* iPhone 5 */
 #define	USB_PRODUCT_APPLE_IPAD	0x129a		/* Apple iPad */
+#define	USB_PRODUCT_APPLE_IPAD_2	0x12a2		/* Apple iPad 2 */
+#define	USB_PRODUCT_APPLE_IPAD_3	0x12a6		/* Apple iPad 3 */
+#define	USB_PRODUCT_APPLE_IPAD_MINI	0x12ab		/* Apple iPad Mini */
 #define	USB_PRODUCT_APPLE_ETHERNET	0x1402		/* Apple USB to Ethernet */
 #define	USB_PRODUCT_APPLE_BLUETOOTH2	0x8205		/* Bluetooth */
 #define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_C	0x821f		/* Bluetooth USB Host Controller */
@@ -912,8 +929,11 @@
 #define	USB_PRODUCT_ASUSTEK_USBN10	0x1786		/* USB-N10 */
 #define	

CVS commit: [netbsd-7] src/sys/dev/usb

2016-12-07 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  8 07:49:42 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdevs

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1289):
sys/dev/usb/usbdevs: revisions 1.683-1.684, 1.686-1.689, 1.691-1.695, 
1.697-1.700, 1.702-1.711, 1.713-1.715, 1.717-1.727
- Add Realtek RTL8152, RTL8153, RTL8192EU.
- Add Atheros AR3012.
- Add Validity Sensors, Inc. and their devices. PR#45732 from
  Greg A. Woods.
- Add some SMSC devices (PR#49484)
- Add Silicon Labs EC3 USB debug adapter.
- Add Xbox 360 Wireless Receiver.
- Add Arduino, TP-Link, Compare, DataApex, Evoluton Robotics devices.
- Add another RTL8192CU device of Asustek.
- Add Belkin Components RTL8192CPU, RTL8188CU and F7D2102.
- Add another RTL8188CUS. device of Chicony Electronics.
- Add another RTL8192CU and DWA-131 rev. B of D-Link.
- Add Guillemot RTL8192CU.
- Add Hawking RTL8192CU.
- Add IO-DATA WN-G150UM and RTL8192CU.
- Add another RTL8188RU of Realtek.
- Add Huawei U8150, E353_HiLink.
- Add vendor ID of Ingenic Semiconductor Ltd.
- Add Conexant USB Modem.
- Add TI TUSB3410, MSP-FET430UIF and MSP-FET430UIF JTAG.
  Part of PR#49814.
- Add Lenovo ThinkPad Compact USB keyboard with TrackPoint.
- Add Panasonic Lumix Camera DMC-FS45 from kern/49809.
- Add Asustek USB-N53 and USB-N66.
- Add D-Link DWA-1xx devices.
- Add Ralink RT3573 and RT5572.
- Add Sitecom Europe ET3072 and LN-031.
- Add Elecom WDC-433SU2M2.
- Add Apple iPhone[45], iPad[23] and iPad Mini.
- Add Century CT-USB1HUB.
- Add MosChip MCS7832 Ethernet Adapter.
- Add another RTL8188CU of Realtek.
- Add DisplayLink MIMO, Polaris2 USB dock, Plugable docking station,
  FY-DVI and FY-DVI2.
- Add a NetChip USB-IDE bridge.
- Add MS Confort Mouse 6000 from Martijn van Buul (PR#50701).
- Add NTT DOCOMO L-05A.
- Add Buffalo WI-U2-300D.
- Add Sandisk Cruzer (PR#46547).
- Add D-Link DWA 125 rev. D1 USB wireless network adapter
  from Jake Slazenger (part of PR#51529).
- Add C-Meida USB Pnp Sound.
- Add AboCom RTL8188EU.
- Add Intel Advanced-N 6235 Combo Bluetooth.
- Add Validity Sensors VFS491.
- Add Linksys HG20F9 Ethernet.


To generate a diff of this commit:
cvs rdiff -u -r1.680.2.5 -r1.680.2.6 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.680.2.5 src/sys/dev/usb/usbdevs:1.680.2.6
--- src/sys/dev/usb/usbdevs:1.680.2.5	Sun Sep 18 06:00:20 2016
+++ src/sys/dev/usb/usbdevs	Thu Dec  8 07:49:42 2016
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp $
+$NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -317,6 +317,7 @@ vendor APTIO		0x07d2	Aptio Products
 vendor ARASAN		0x07da	Arasan Chip Systems
 vendor ALLIEDCABLE	0x07e6	Allied Cable
 vendor STSN		0x07ef	STSN
+vendor CENTURY		0x07f7	CENTURY Corporation
 vendor BEWAN		0x07fa	Bewan
 vendor ZOOM		0x0803	Zoom Telephonics
 vendor BROADLOGIC	0x0827	BroadLogic
@@ -486,6 +487,7 @@ vendor AINCOMM		0x12fd	Aincomm
 vendor MOBILITY		0x1342	Mobility
 vendor DICKSMITH	0x1371	Dick Smith Electronics
 vendor NETGEAR3		0x1385	Netgear
+vendor VALIDITY		0x138a	Validity Sensors, Inc.
 vendor BALTECH		0x13ad	Baltech
 vendor CISCOLINKSYS	0x13b1	Cisco-Linksys
 vendor SHARK		0x13d2	Shark
@@ -550,9 +552,12 @@ vendor HAUPPAUGE2	0x2040	Hauppauge Compu
 vendor PARA		0x20b8	PARA Industrial
 vendor TRENDNET		0x20f4	TRENDnet
 vendor DLINK3		0x2101  D-Link
+vendor VIALABS		0x2109	VIA Labs
 vendor ERICSSON		0x2282	Ericsson
 vendor MOTOROLA2	0x22b8	Motorola
 vendor PINNACLE		0x2304	Pinnacle Systems
+vendor ARDUINO		0x2341	Arduino SA
+vendor TPLINK		0x2357	TP-Link
 vendor TRIPPLITE	0x2478	Tripp-Lite
 vendor HIROSE		0x2631	Hirose Electric
 vendor NHJ		0x2770	NHJ
@@ -573,6 +578,7 @@ vendor AVERATEC		0x50c2	Averatec
 vendor SWEEX		0x5173	Sweex
 vendor ONSPEC2		0x55aa	OnSpec Electronic Inc.
 vendor ZINWELL		0x5a57	Zinwell
+vendor INGENIC 		0x601a	Ingenic Semiconductor Ltd.
 vendor SITECOM		0x6189	Sitecom
 vendor SPRINGERDESIGN	0x6400	Springer Design, Inc.
 vendor ARKMICROCHIPS	0x6547	ArkMicroChips
@@ -585,6 +591,9 @@ vendor MOSCHIP		0x9710	MosChip Semicondu
 vendor NETGEAR4		0x9846	Netgear
 vendor xxFTDI		0x9e88  FTDI
 vendor CACE		0xcace	CACE Technologies
+vendor COMPARE		0xcdab	Compare
+vendor DATAAPEX		0xdaae	DataApex
+vendor EVOLUTION	0xdeee	Evolution Robotics
 vendor EMPIA		0xeb1a	eMPIA Technology
 vendor HP2		0xf003	Hewlett Packard
 vendor USRP		0xfffe	GNU Radio USRP
@@ -640,6 +649,7 @@ product ABOCOM XX9		0x4104	XX9
 product ABOCOM UFE2000		0x420a	UFE2000 USB2.0 Fast Ethernet Adapter
 product ABOCOM WL54		0x6001	WL54
 product ABOCOM RTL8192CU	0x8178	RTL8192CU
+product ABOCOM RTL8188EU	0x8179	RTL8188EU
 product ABOCOM RTL8188CU_1	0x8188	RTL8188CU
 product ABOCOM RTL8188CU_2	0x8189	RTL8188CU
 product ABOCOM XX10		0xabc1	XX10

CVS commit: [netbsd-7] src/sys/dev/usb

2016-09-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Sep 18 06:01:07 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h

Log Message:
regen for ticket 1245


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.4 -r1.672.2.5 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.4 -r1.673.2.5 src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.672.2.4 src/sys/dev/usb/usbdevs.h:1.672.2.5
--- src/sys/dev/usb/usbdevs.h:1.672.2.4	Sun Oct 18 09:03:22 2015
+++ src/sys/dev/usb/usbdevs.h	Sun Sep 18 06:01:05 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.672.2.4 2015/10/18 09:03:22 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.672.2.5 2016/09/18 06:01:05 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp
+ *	NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp
  */
 
 /*
@@ -1364,6 +1364,7 @@
 #define	USB_PRODUCT_DLINK2_AR9271	0x3a10		/* AR9271 */
 #define	USB_PRODUCT_DLINK2_DWLG122C1	0x3c03		/* DWL-G122 rev C1 */
 #define	USB_PRODUCT_DLINK2_WUA1340	0x3c04		/* WUA-1340 */
+#define	USB_PRODUCT_DLINK2_DUBE100B1	0x3c05		/* DUB-E100 rev B1 */
 #define	USB_PRODUCT_DLINK2_DWA111	0x3c06		/* DWA-111 */
 #define	USB_PRODUCT_DLINK2_DWA110	0x3c07		/* DWA-110 */
 #define	USB_PRODUCT_DLINK2_RT2870_1	0x3c09		/* RT2870 */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.4 src/sys/dev/usb/usbdevs_data.h:1.673.2.5
--- src/sys/dev/usb/usbdevs_data.h:1.673.2.4	Sun Oct 18 09:03:22 2015
+++ src/sys/dev/usb/usbdevs_data.h	Sun Sep 18 06:01:05 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.673.2.4 2015/10/18 09:03:22 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.673.2.5 2016/09/18 06:01:05 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp
+ *	NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp
  */
 
 /*
@@ -4419,6 +4419,10 @@ const struct usb_product usb_products[] 
 	"WUA-1340",
 	},
 	{
+	USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DUBE100B1,
+	"DUB-E100 rev B1",
+	},
+	{
 	USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DWA111,
 	"DWA-111",
 	},
@@ -10203,4 +10207,4 @@ const struct usb_product usb_products[] 
 	"Prestige",
 	},
 };
-const int usb_nproducts = 2010;
+const int usb_nproducts = 2011;



CVS commit: [netbsd-7] src/sys/dev/usb

2016-09-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Sep 18 06:00:20 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: if_axe.c usbdevs

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1245):
sys/dev/usb/if_axe.c: revision 1.73, 1.74
sys/dev/usb/usbdevs: revision 1.716
Add flxd's axe(4)
--
flxd's axe(4) - I think.
--
Fix harmless typo


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.67.2.1 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.680.2.4 -r1.680.2.5 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.67 src/sys/dev/usb/if_axe.c:1.67.2.1
--- src/sys/dev/usb/if_axe.c:1.67	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/usb/if_axe.c	Sun Sep 18 06:00:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.67 2014/08/10 16:44:36 tls Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.67.2.1 2016/09/18 06:00:20 snj Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,7 +89,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67.2.1 2016/09/18 06:00:20 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -155,6 +155,7 @@ static const struct axe_type axe_devs[] 
 	{ { USB_VENDOR_COREGA,		USB_PRODUCT_COREGA_FETHER_USB2_TX }, 0},
 	{ { USB_VENDOR_DLINK,		USB_PRODUCT_DLINK_DUBE100}, 0 },
 	{ { USB_VENDOR_DLINK,		USB_PRODUCT_DLINK_DUBE100B1 }, AX772 },
+	{ { USB_VENDOR_DLINK2,		USB_PRODUCT_DLINK2_DUBE100B1 }, AX772 },
 	{ { USB_VENDOR_DLINK,		USB_PRODUCT_DLINK_DUBE100C1 }, AX772 | AX772B },
 	{ { USB_VENDOR_GOODWAY,		USB_PRODUCT_GOODWAY_GWUSB2E}, 0 },
 	{ { USB_VENDOR_IODATA,		USB_PRODUCT_IODATA_ETGUS2 }, AX178 },

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.680.2.4 src/sys/dev/usb/usbdevs:1.680.2.5
--- src/sys/dev/usb/usbdevs:1.680.2.4	Sun Oct 18 09:01:58 2015
+++ src/sys/dev/usb/usbdevs	Sun Sep 18 06:00:20 2016
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp $
+$NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1357,6 +1357,7 @@ product DLINK2 DWA130D1		0x3a0f	DWA-130 
 product DLINK2 AR9271		0x3a10	AR9271
 product DLINK2 DWLG122C1	0x3c03	DWL-G122 rev C1
 product DLINK2 WUA1340		0x3c04	WUA-1340
+product DLINK2 DUBE100B1	0x3c05	DUB-E100 rev B1
 product DLINK2 DWA111		0x3c06	DWA-111
 product DLINK2 DWA110		0x3c07	DWA-110
 product DLINK2 RT2870_1		0x3c09	RT2870



CVS commit: [netbsd-7] src/sys/dev/pci

2016-09-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Sep 18 05:57:00 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: if_vioif.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1244):
sys/dev/pci/if_vioif.c: revision 1.25
Fix initializing wrong queues
Pointed out by Mike Larkin.
PR kern/51448


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 src/sys/dev/pci/if_vioif.c

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

Modified files:

Index: src/sys/dev/pci/if_vioif.c
diff -u src/sys/dev/pci/if_vioif.c:1.7.2.1 src/sys/dev/pci/if_vioif.c:1.7.2.2
--- src/sys/dev/pci/if_vioif.c:1.7.2.1	Mon Dec 29 17:01:01 2014
+++ src/sys/dev/pci/if_vioif.c	Sun Sep 18 05:57:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.7.2.1 2014/12/29 17:01:01 martin Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.7.2.2 2016/09/18 05:57:00 snj Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.7.2.1 2014/12/29 17:01:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.7.2.2 2016/09/18 05:57:00 snj Exp $");
 
 #include 
 #include 
@@ -394,7 +394,7 @@ vioif_alloc_mems(struct vioif_softc *sc)
 	}
 
 	for (i = 0; i < txqsize; i++) {
-		C_L1(txhdr_dmamaps[i], rx_hdrs[i],
+		C_L1(txhdr_dmamaps[i], tx_hdrs[i],
 		sizeof(struct virtio_net_hdr), 1,
 		WRITE, "tx header");
 		C(tx_dmamaps[i], NULL, ETHER_MAX_LEN, 256 /* XXX */, 0,



CVS commit: [netbsd-7] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 08:35:27 UTC 2016

Removed Files:
src/sys/dev/usb [netbsd-7]: usbroothub.c usbroothub.h

Log Message:
Wrong branch (for now)


To generate a diff of this commit:
cvs rdiff -u -r1.2.4.2 -r0 src/sys/dev/usb/usbroothub.c \
src/sys/dev/usb/usbroothub.h

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



CVS commit: [netbsd-7] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 08:29:49 UTC 2016

Added Files:
src/sys/dev/usb [netbsd-7]: usbroothub.c usbroothub.h

Log Message:
Add missing files


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.2.4.2 src/sys/dev/usb/usbroothub.c \
src/sys/dev/usb/usbroothub.h

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

Added files:

Index: src/sys/dev/usb/usbroothub.c
diff -u /dev/null src/sys/dev/usb/usbroothub.c:1.2.4.2
--- /dev/null	Wed Sep  7 08:29:49 2016
+++ src/sys/dev/usb/usbroothub.c	Wed Sep  7 08:29:49 2016
@@ -0,0 +1,491 @@
+/* $NetBSD: usbroothub.c,v 1.2.4.2 2016/09/07 08:29:49 skrll Exp $ */
+
+/*-
+ * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lenn...@augustsson.net) at
+ * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca),
+ * Matthew R. Green (m...@eterna.com.au) and Nick Hudson.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Copyright (c) 2008
+ *	Matthias Drochner.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+extern int usbdebug;
+
+/* helper functions for USB root hub emulation */
+
+static usbd_status	roothub_ctrl_transfer(struct usbd_xfer *);
+static usbd_status	roothub_ctrl_start(struct usbd_xfer *);
+static void		roothub_ctrl_abort(struct usbd_xfer *);
+static void		roothub_ctrl_close(struct usbd_pipe *);
+static void		roothub_ctrl_done(struct usbd_xfer *);
+static void		roothub_noop(struct usbd_pipe *pipe);
+
+const struct usbd_pipe_methods roothub_ctrl_methods = {
+	.upm_transfer =	roothub_ctrl_transfer,
+	.upm_start =	roothub_ctrl_start,
+	.upm_abort =	roothub_ctrl_abort,
+	.upm_close =	roothub_ctrl_close,
+	.upm_cleartoggle =	roothub_noop,
+	.upm_done =	roothub_ctrl_done,
+};
+
+int
+usb_makestrdesc(usb_string_descriptor_t *p, int l, const char *s)
+{
+	int i;
+
+	if (l == 0)
+		return 0;
+	p->bLength = 2 * strlen(s) + 2;
+	if (l == 1)
+		return 1;
+	p->bDescriptorType = UDESC_STRING;
+	l -= 2;
+	/* poor man's utf-16le conversion */
+	for (i = 0; s[i] && l > 1; i++, l -= 2)
+		USETW2(p->bString[i], 0, s[i]);
+	return 2 * i + 2;
+}
+
+int
+usb_makelangtbl(usb_string_descriptor_t *p, int l)
+{
+
+	if (l == 0)
+		return 0;
+	

CVS commit: [netbsd-7] src/sys/dev/splash

2016-08-27 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Aug 28 04:31:19 UTC 2016

Modified Files:
src/sys/dev/splash [netbsd-7]: splash.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #1238):
sys/dev/splash/splash.c: revision 1.13
Do not panic if the splash screen is bigger than the framebuffer
This fixes a kernel crash if the splash screen does not fit inside the
framebuffer. It should probably be truncated (and optionally centered)
instead, but this avoids a panic in the meantime.
Tested on NetBSD/amd64 with a vesa framebuffer.
 From Christian Koch (cfkoch@) of EdgeBSD; thanks!
XXX pull-up(s)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.14.1 src/sys/dev/splash/splash.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/splash/splash.c
diff -u src/sys/dev/splash/splash.c:1.12 src/sys/dev/splash/splash.c:1.12.14.1
--- src/sys/dev/splash/splash.c:1.12	Sat Jun  2 14:24:00 2012
+++ src/sys/dev/splash/splash.c	Sun Aug 28 04:31:19 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $ */
+/* $NetBSD: splash.c,v 1.12.14.1 2016/08/28 04:31:19 snj Exp $ */
 
 /*-
  * Copyright (c) 2006 Jared D. McNeill 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.12.14.1 2016/08/28 04:31:19 snj Exp $");
 
 #include "opt_splash.h"
 
@@ -195,6 +195,14 @@ splash_render(struct splash_info *si, in
 	aprint_debug("%s: splash loaded, width %d height %d comp %d\n",
 	__func__, width, height, comp);
 
+	if ((width > si->si_width) || (height > si->si_height)) {
+		aprint_error(
+			"WARNING: splash size (%dx%d) too big for framebuffer (%dx%d)\n",
+			width, height, si->si_width, si->si_height);
+		stbi_image_free(data);
+		return EINVAL;
+	}
+
 	/* XXX */
 	if (flg & SPLASH_F_CENTER) {
 		xoff = (si->si_width - width) / 2;



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

2016-08-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Aug 27 15:09:22 UTC 2016

Modified Files:
src/sys/dev [netbsd-7]: fss.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1239):
sys/dev/fss.c: revision 1.95
Disestablish COW handler on error.  No need to do further copies after
the snapshot device failed.
Should fix PR kern/51377: fss(4) panic if snapshot mounted read/write


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/sys/dev/fss.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/fss.c
diff -u src/sys/dev/fss.c:1.91 src/sys/dev/fss.c:1.91.2.1
--- src/sys/dev/fss.c:1.91	Fri Jul 25 08:10:35 2014
+++ src/sys/dev/fss.c	Sat Aug 27 15:09:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.91 2014/07/25 08:10:35 dholland Exp $	*/
+/*	$NetBSD: fss.c,v 1.91.2.1 2016/08/27 15:09:22 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.91 2014/07/25 08:10:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.91.2.1 2016/08/27 15:09:22 bouyer Exp $");
 
 #include 
 #include 
@@ -445,17 +445,20 @@ fss_dump(dev_t dev, daddr_t blkno, void 
 
 /*
  * An error occurred reading or writing the snapshot or backing store.
- * If it is the first error log to console.
+ * If it is the first error log to console and disestablish cow handler.
  * The caller holds the mutex.
  */
 static inline void
 fss_error(struct fss_softc *sc, const char *msg)
 {
 
-	if ((sc->sc_flags & (FSS_ACTIVE|FSS_ERROR)) == FSS_ACTIVE)
-		aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
-	if ((sc->sc_flags & FSS_ACTIVE) == FSS_ACTIVE)
-		sc->sc_flags |= FSS_ERROR;
+	if ((sc->sc_flags & (FSS_ACTIVE | FSS_ERROR)) != FSS_ACTIVE)
+		return;
+
+	aprint_error_dev(sc->sc_dev, "snapshot invalid: %s\n", msg);
+	if ((sc->sc_flags & FSS_PERSISTENT) == 0)
+		fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
+	sc->sc_flags |= FSS_ERROR;
 }
 
 /*
@@ -575,9 +578,8 @@ fss_unmount_hook(struct mount *mp)
 		if ((sc = device_lookup_private(_cd, i)) == NULL)
 			continue;
 		mutex_enter(>sc_slock);
-		if ((sc->sc_flags & FSS_ACTIVE) != 0 &&
-		sc->sc_mount == mp)
-			fss_error(sc, "forced unmount");
+		if ((sc->sc_flags & FSS_ACTIVE) != 0 && sc->sc_mount == mp)
+			fss_error(sc, "forced by unmount");
 		mutex_exit(>sc_slock);
 	}
 	mutex_exit(_device_lock);
@@ -886,7 +888,7 @@ static int
 fss_delete_snapshot(struct fss_softc *sc, struct lwp *l)
 {
 
-	if ((sc->sc_flags & FSS_PERSISTENT) == 0)
+	if ((sc->sc_flags & (FSS_PERSISTENT | FSS_ERROR)) == 0)
 		fscow_disestablish(sc->sc_mount, fss_copy_on_write, sc);
 
 	mutex_enter(>sc_slock);



CVS commit: [netbsd-7] src/sys/dev/pci

2016-07-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 11 10:39:42 UTC 2016

Modified Files:
src/sys/dev/pci [netbsd-7]: lynxfb.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1203):
sys/dev/pci/lynxfb.c: revision 1.5
fix inverted screen blanking logic


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.16.1 src/sys/dev/pci/lynxfb.c

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

Modified files:

Index: src/sys/dev/pci/lynxfb.c
diff -u src/sys/dev/pci/lynxfb.c:1.4 src/sys/dev/pci/lynxfb.c:1.4.16.1
--- src/sys/dev/pci/lynxfb.c:1.4	Wed Mar 14 13:41:07 2012
+++ src/sys/dev/pci/lynxfb.c	Mon Jul 11 10:39:42 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lynxfb.c,v 1.4 2012/03/14 13:41:07 nonaka Exp $	*/
+/*	$NetBSD: lynxfb.c,v 1.4.16.1 2016/07/11 10:39:42 martin Exp $	*/
 /*	$OpenBSD: smfb.c,v 1.13 2011/07/21 20:36:12 miod Exp $	*/
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lynxfb.c,v 1.4 2012/03/14 13:41:07 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lynxfb.c,v 1.4.16.1 2016/07/11 10:39:42 martin Exp $");
 
 #include "opt_wsemul.h"
 
@@ -824,11 +824,11 @@ lynxfb_vcons_eraserows(void *cookie, int
 }
 
 static void
-lynxfb_blank(struct lynxfb *fb, int blank)
+lynxfb_blank(struct lynxfb *fb, int enable)
 {
 
-	fb->blank = blank;
-	if (!blank) {
+	fb->blank = !enable;
+	if (enable) {
 		lynxfb_vgats_write(fb, 0x31,
 		lynxfb_vgats_read(fb, 0x31) | 0x01);
 	} else {



CVS commit: [netbsd-7] src/sys/dev/adb

2016-07-05 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Jul  5 19:14:59 UTC 2016

Modified Files:
src/sys/dev/adb [netbsd-7]: adb_kbd.c adb_keymap.h adb_usb_map.c

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1187):
sys/dev/adb/adb_kbd.c: revision 1.23
sys/dev/adb/adb_keymap.h: revisions 1.5, 1.6
sys/dev/adb/adb_usb_map.c: revision 1.2
nicely ask the keyboard to distinguish between left and right Control, Alt
and Shift keys.
Welcome to the world of accents and diacritics!
--
Add us.dvorak keymap variant for ADB keyboards.  Addresses PR 51255.
Tested by sevan@.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.4.1 src/sys/dev/adb/adb_kbd.c
cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/dev/adb/adb_keymap.h
cvs rdiff -u -r1.1 -r1.1.16.1 src/sys/dev/adb/adb_usb_map.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/adb/adb_kbd.c
diff -u src/sys/dev/adb/adb_kbd.c:1.22 src/sys/dev/adb/adb_kbd.c:1.22.4.1
--- src/sys/dev/adb/adb_kbd.c:1.22	Mon Nov 18 11:02:34 2013
+++ src/sys/dev/adb/adb_kbd.c	Tue Jul  5 19:14:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $	*/
+/*	$NetBSD: adb_kbd.c,v 1.22.4.1 2016/07/05 19:14:59 snj Exp $	*/
 
 /*
  * Copyright (C) 1998	Colin Wood
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.22 2013/11/18 11:02:34 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adb_kbd.c,v 1.22.4.1 2016/07/05 19:14:59 snj Exp $");
 
 #include 
 #include 
@@ -190,6 +190,7 @@ adbkbd_attach(device_t parent, device_t 
 #if NWSMOUSE > 0
 	struct wsmousedev_attach_args am;
 #endif
+	uint8_t buffer[2];
 
 	sc->sc_dev = self;
 	sc->sc_ops = aaa->ops;
@@ -333,6 +334,27 @@ adbkbd_attach(device_t parent, device_t 
 		break;
 	}
 
+	/*
+	 * try to switch to extended protocol
+	 * as in, tell the keyboard to distinguish between left and right
+	 * Shift, Control and Alt keys
+	 */
+	cmd = ADBLISTEN(sc->sc_adbdev->current_addr, 3);
+	buffer[0] = sc->sc_adbdev->current_addr;
+	buffer[1] = 3;
+	sc->sc_msg_len = 0;
+	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 2, buffer);
+	adbkbd_wait(sc, 10);
+
+	cmd = ADBTALK(sc->sc_adbdev->current_addr, 3);
+	sc->sc_msg_len = 0;
+	sc->sc_ops->send(sc->sc_ops->cookie, sc->sc_poll, cmd, 0, NULL);
+	adbkbd_wait(sc, 10);
+	if ((sc->sc_msg_len == 4) && (sc->sc_buffer[3] == 3)) {
+		printf("%s: extended protocol enabled\n",
+		device_xname(sc->sc_dev));
+	}
+
 	if (adbkbd_is_console && (adbkbd_console_attached == 0)) {
 		wskbd_cnattach(_consops, sc, _keymapdata);
 		adbkbd_console_attached = 1;

Index: src/sys/dev/adb/adb_keymap.h
diff -u src/sys/dev/adb/adb_keymap.h:1.4 src/sys/dev/adb/adb_keymap.h:1.4.14.1
--- src/sys/dev/adb/adb_keymap.h:1.4	Wed Aug 29 02:44:07 2012
+++ src/sys/dev/adb/adb_keymap.h	Tue Jul  5 19:14:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: adb_keymap.h,v 1.4 2012/08/29 02:44:07 macallan Exp $	*/
+/*	$NetBSD: adb_keymap.h,v 1.4.14.1 2016/07/05 19:14:59 snj Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -148,10 +148,56 @@ static const keysym_t akbd_keydesc_us[] 
 KC(120),KS_Cmd_Screen1,	KS_f2,
 KC(121),KS_Cmd_ScrollFastDown, KS_Next,
 KC(122),KS_Cmd_Screen0,	KS_f1,
-
+KC(123),			KS_Shift_R,
+KC(124),			KS_Alt_R,
+KC(125),			KS_Control_R,
 KC(127),  KS_Cmd_Debugger,
 };
 
+static const keysym_t akbd_keydesc_us_dvorak[] = {
+/*  pos  command		normal		shifted */
+KC(0),			KS_a,
+KC(1),			KS_o,
+KC(2),			KS_e,
+KC(3),			KS_u,
+KC(4),			KS_d,
+KC(5),			KS_i,
+KC(6),			KS_semicolon,	KS_colon,
+KC(7),			KS_q,
+KC(8),			KS_j,
+KC(9),			KS_k,
+
+KC(11),			KS_x,
+KC(12),			KS_apostrophe,	KS_quotedbl,
+KC(13),			KS_comma,	KS_less,
+KC(14),			KS_period,	KS_greater,
+KC(15),			KS_p,
+KC(16),			KS_f,
+KC(17),			KS_y,
+
+KC(24),			KS_bracketright, KS_braceright,
+KC(27),			KS_bracketleft,	KS_braceleft,
+
+KC(30),			KS_equal,	KS_plus,
+KC(31),			KS_r,
+KC(32),			KS_g,
+KC(33),			KS_slash,	KS_question,
+KC(34),			KS_c,
+KC(35),			KS_l,
+
+KC(37),			KS_n,
+KC(38),			KS_h,
+KC(39),			KS_minus,	KS_underscore,
+KC(40),			KS_t,
+KC(41),			KS_s,
+
+KC(43),			KS_w,
+KC(44),			KS_z,
+KC(45),			KS_b,
+KC(46),			KS_m,
+KC(47),			KS_v,
+};
+
 static const keysym_t akbd_keydesc_fr[] = {
 /*  pos		normal		shifted		altgr		shift-altgr */
 KC(0),	KS_q,
@@ -404,6 +450,7 @@ static const keysym_t akbd_keydesc_pt[] 
 
 static const struct wscons_keydesc akbd_keydesctab[] = {
 	KBD_MAP(KB_US,			0,	akbd_keydesc_us),
+	KBD_MAP(KB_US | KB_DVORAK,  KB_US,  akbd_keydesc_us_dvorak),
 	KBD_MAP(KB_FR,			KB_US,	akbd_keydesc_fr),
 	KBD_MAP(KB_JP,			KB_US,	akbd_keydesc_jp),
 	KBD_MAP(KB_FR | KB_NODEAD,	KB_FR,	akbd_keydesc_fr_nodead),

Index: src/sys/dev/adb/adb_usb_map.c
diff 

CVS commit: [netbsd-7] src/sys/dev/isapnp

2016-06-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jun 22 08:19:53 UTC 2016

Modified Files:
src/sys/dev/isapnp [netbsd-7]: isapnpdevs.c isapnpdevs.h

Log Message:
regen for ticket 1177


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.62.1 src/sys/dev/isapnp/isapnpdevs.c
cvs rdiff -u -r1.66 -r1.66.62.1 src/sys/dev/isapnp/isapnpdevs.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/isapnp/isapnpdevs.c
diff -u src/sys/dev/isapnp/isapnpdevs.c:1.71 src/sys/dev/isapnp/isapnpdevs.c:1.71.62.1
--- src/sys/dev/isapnp/isapnpdevs.c:1.71	Mon Apr 28 20:23:53 2008
+++ src/sys/dev/isapnp/isapnpdevs.c	Wed Jun 22 08:19:53 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: isapnpdevs.c,v 1.71 2008/04/28 20:23:53 martin Exp $	*/
+/*	$NetBSD: isapnpdevs.c,v 1.71.62.1 2016/06/22 08:19:53 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: isapnpdevs,v 1.66 2008/04/20 13:24:34 tsutsui Exp
+ *	NetBSD: isapnpdevs,v 1.68.40.1 2016/06/22 08:18:22 snj Exp
  */
 
 /*-
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isapnpdevs.c,v 1.71 2008/04/28 20:23:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isapnpdevs.c,v 1.71.62.1 2016/06/22 08:19:53 snj Exp $");
 
 #include 
 #include 
@@ -224,9 +224,10 @@ static const struct isapnp_matchinfo isa
 	{"ATK1500", 0},	/* Lance Ethernet on Allied Telesyn board */
 	{"CSI2203", 0},	/* Cabletron E22xx */
 	{"BUF0001", 0},	/* Melco Inc. LGY-IV */
+	{"SKD8000", 0},	/* SysKonnect SK-NET Flash */
 };
 const struct isapnp_devinfo isapnp_le_devinfo = {
-	isapnp_le_devlogic, 4,
+	isapnp_le_devlogic, 5,
 	NULL, 0,
 };
 

Index: src/sys/dev/isapnp/isapnpdevs.h
diff -u src/sys/dev/isapnp/isapnpdevs.h:1.66 src/sys/dev/isapnp/isapnpdevs.h:1.66.62.1
--- src/sys/dev/isapnp/isapnpdevs.h:1.66	Mon Apr 28 20:23:53 2008
+++ src/sys/dev/isapnp/isapnpdevs.h	Wed Jun 22 08:19:53 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: isapnpdevs.h,v 1.66 2008/04/28 20:23:53 martin Exp $	*/
+/*	$NetBSD: isapnpdevs.h,v 1.66.62.1 2016/06/22 08:19:53 snj Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: isapnpdevs,v 1.66 2008/04/20 13:24:34 tsutsui Exp
+ *	NetBSD: isapnpdevs,v 1.68.40.1 2016/06/22 08:18:22 snj Exp
  */
 
 
@@ -38,6 +38,11 @@
  */
 
 /*
+ * Use "make -f Makefile.isapnpdevs" to regenerate isapnpdevs.h and
+ * isapnpdevs.c
+ */
+
+/*
  * List of known drivers
  */
 struct isapnp_matchinfo {



CVS commit: [netbsd-7] src/sys/dev/isapnp

2016-06-22 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jun 22 08:18:22 UTC 2016

Modified Files:
src/sys/dev/isapnp [netbsd-7]: isapnpdevs

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #1177):
sys/dev/isapnp/isapnpdevs: revision 1.69
Add another le board.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.68.40.1 src/sys/dev/isapnp/isapnpdevs

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/isapnp/isapnpdevs
diff -u src/sys/dev/isapnp/isapnpdevs:1.68 src/sys/dev/isapnp/isapnpdevs:1.68.40.1
--- src/sys/dev/isapnp/isapnpdevs:1.68	Wed Jan 21 14:22:46 2009
+++ src/sys/dev/isapnp/isapnpdevs	Wed Jun 22 08:18:22 2016
@@ -1,4 +1,4 @@
-$NetBSD: isapnpdevs,v 1.68 2009/01/21 14:22:46 jnemeth Exp $
+$NetBSD: isapnpdevs,v 1.68.40.1 2016/06/22 08:18:22 snj Exp $
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -184,6 +184,7 @@ devlogic	le	TKN0010		0	Lance Ethernet on
 devlogic	le	ATK1500		0	Lance Ethernet on Allied Telesyn board
 devlogic	le	CSI2203		0	Cabletron E22xx
 devlogic	le	BUF0001		0	Melco Inc. LGY-IV
+devlogic	le	SKD8000		0	SysKonnect SK-NET Flash
 
 /*
  * mpu



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

2016-05-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May 22 10:24:50 UTC 2016

Modified Files:
src/sys/dev/ic [netbsd-7]: gem.c

Log Message:
Pull up following revision(s) (requested by jdc in ticket #1170):
sys/dev/ic/gem.c: revision 1.105
PR kern/46083
Track the start of each packet, so that we set the "Start of Frame" bit in
all the relevant transmit descriptors when enqueing multiple packets.
Patch from Valery Ushakov, slightly modified by me to handle debug output.
Tested on macppc/6.x and sparc64/7.99.x.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.2.1 src/sys/dev/ic/gem.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/gem.c
diff -u src/sys/dev/ic/gem.c:1.102 src/sys/dev/ic/gem.c:1.102.2.1
--- src/sys/dev/ic/gem.c:1.102	Sun Aug 10 16:44:35 2014
+++ src/sys/dev/ic/gem.c	Sun May 22 10:24:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.102 2014/08/10 16:44:35 tls Exp $ */
+/*	$NetBSD: gem.c,v 1.102.2.1 2016/05/22 10:24:50 martin Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.102 2014/08/10 16:44:35 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.102.2.1 2016/05/22 10:24:50 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -1360,6 +1360,9 @@ gem_start(struct ifnet *ifp)
 	struct gem_txsoft *txs;
 	bus_dmamap_t dmamap;
 	int error, firsttx, nexttx = -1, lasttx = -1, ofree, seg;
+#ifdef GEM_DEBUG
+	int otxnext;
+#endif
 	uint64_t flags = 0;
 
 	if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
@@ -1370,10 +1373,12 @@ gem_start(struct ifnet *ifp)
 	 * the first descriptor we'll use.
 	 */
 	ofree = sc->sc_txfree;
-	firsttx = sc->sc_txnext;
+#ifdef GEM_DEBUG
+	otxnext = sc->sc_txnext;
+#endif
 
 	DPRINTF(sc, ("%s: gem_start: txfree %d, txnext %d\n",
-	device_xname(sc->sc_dev), ofree, firsttx));
+	device_xname(sc->sc_dev), ofree, otxnext));
 
 	/*
 	 * Loop through the send queue, setting up transmit descriptors
@@ -1478,7 +1483,8 @@ gem_start(struct ifnet *ifp)
 		/*
 		 * Initialize the transmit descriptors.
 		 */
-		for (nexttx = sc->sc_txnext, seg = 0;
+		firsttx = sc->sc_txnext;
+		for (nexttx = firsttx, seg = 0;
 		 seg < dmamap->dm_nsegs;
 		 seg++, nexttx = GEM_NEXTTX(nexttx)) {
 
@@ -1600,7 +1606,7 @@ gem_start(struct ifnet *ifp)
 
 	if (sc->sc_txfree != ofree) {
 		DPRINTF(sc, ("%s: packets enqueued, IC on %d, OWN on %d\n",
-		device_xname(sc->sc_dev), lasttx, firsttx));
+		device_xname(sc->sc_dev), lasttx, otxnext));
 		/*
 		 * The entire packet chain is set up.
 		 * Kick the transmitter.



CVS commit: [netbsd-7] src/sys/dev/usb

2016-03-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar  8 09:52:39 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: if_smsc.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1135):
sys/dev/usb/if_smsc.c: revision 1.26
PR/50904: Fix variable assignment inside if-clause.


To generate a diff of this commit:
cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/dev/usb/if_smsc.c

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

Modified files:

Index: src/sys/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.19.2.1 src/sys/dev/usb/if_smsc.c:1.19.2.2
--- src/sys/dev/usb/if_smsc.c:1.19.2.1	Mon Sep 22 11:11:10 2014
+++ src/sys/dev/usb/if_smsc.c	Tue Mar  8 09:52:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.19.2.1 2014/09/22 11:11:10 martin Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.19.2.2 2016/03/08 09:52:39 snj Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -771,7 +771,7 @@ smsc_chip_init(struct smsc_softc *sc)
 	smsc_write_reg(sc, SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST);
 
 	if ((err = smsc_wait_for_bits(sc, SMSC_PM_CTRL,
-	SMSC_PM_CTRL_PHY_RST) != 0)) {
+	SMSC_PM_CTRL_PHY_RST)) != 0) {
 		smsc_warn_printf(sc, "timed-out waiting for phy reset to "
 		"complete\n");
 		goto init_failed;



CVS commit: [netbsd-7] src/sys/dev/usb

2016-03-08 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Mar  8 09:49:00 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: uhub.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1134):
sys/dev/usb/uhub.c: revision 1.130
Use the port status straight after the reset and not after the
usbd_clear_port_feature(dev, port, UHF_C_PORT_RESET)
The Gadget USB HUB in the IBM x3250 sborrill sent me returns the wrong
status and this would appear to leave the attached cdce(4) in the default
state.  The next device probed fails as a result.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.124.4.1 src/sys/dev/usb/uhub.c

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

Modified files:

Index: src/sys/dev/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.124 src/sys/dev/usb/uhub.c:1.124.4.1
--- src/sys/dev/usb/uhub.c:1.124	Sun Sep 15 15:33:47 2013
+++ src/sys/dev/usb/uhub.c	Tue Mar  8 09:49:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.124 2013/09/15 15:33:47 martin Exp $	*/
+/*	$NetBSD: uhub.c,v 1.124.4.1 2016/03/08 09:49:00 snj Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.124 2013/09/15 15:33:47 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.124.4.1 2016/03/08 09:49:00 snj Exp $");
 
 #include 
 #include 
@@ -513,6 +513,7 @@ uhub_explore(usbd_device_handle dev)
 			"port %d reset failed\n", port);
 			continue;
 		}
+#if 0
 		/* Get port status again, it might have changed during reset */
 		err = usbd_get_port_status(dev, port, >status);
 		if (err) {
@@ -520,6 +521,7 @@ uhub_explore(usbd_device_handle dev)
  "error=%s\n", usbd_errstr(err)));
 			continue;
 		}
+#endif
 		status = UGETW(up->status.wPortStatus);
 		change = UGETW(up->status.wPortChange);
 		if (!(status & UPS_CURRENT_CONNECT_STATUS)) {



CVS commit: [netbsd-7] src/sys/dev/usb

2016-03-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Mar  7 14:36:55 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: ugen.c

Log Message:
Additionally pull up r1.131 for ticket #1124 (requested by skrll)


To generate a diff of this commit:
cvs rdiff -u -r1.124.2.1 -r1.124.2.2 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.124.2.1 src/sys/dev/usb/ugen.c:1.124.2.2
--- src/sys/dev/usb/ugen.c:1.124.2.1	Sun Mar  6 18:08:04 2016
+++ src/sys/dev/usb/ugen.c	Mon Mar  7 14:36:55 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $	*/
+/*	$NetBSD: ugen.c,v 1.124.2.2 2016/03/07 14:36:55 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.2 2016/03/07 14:36:55 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -172,6 +172,7 @@ Static usb_config_descriptor_t *ugen_get
 	   int index, int *lenp);
 Static usbd_status ugen_set_interface(struct ugen_softc *, int, int);
 Static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx);
+Static void ugen_clear_endpoints(struct ugen_softc *);
 
 #define UGENUNIT(n) ((minor(n) >> 4) & 0xf)
 #define UGENENDPOINT(n) (minor(n) & 0xf)



CVS commit: [netbsd-7] src/sys/dev/usb

2016-03-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar  6 18:08:04 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: ugen.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1124):
sys/dev/usb/ugen.c: revision 1.127
sys/dev/usb/ugen.c: revision 1.128
sys/dev/usb/ugen.c: revision 1.129
sys/dev/usb/ugen.c: revision 1.130
s/0/NULL/
One more s/0/NULL/
Remove always true conditional
Only clear the endpoint information in ugen_set_interface only if setting
the new altno suceeds.
Avoids the null de-ref in PR/50597 and PR/50810


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.124.2.1 src/sys/dev/usb/ugen.c

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

Modified files:

Index: src/sys/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.124 src/sys/dev/usb/ugen.c:1.124.2.1
--- src/sys/dev/usb/ugen.c:1.124	Fri Jul 25 08:10:39 2014
+++ src/sys/dev/usb/ugen.c	Sun Mar  6 18:08:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.124 2014/07/25 08:10:39 dholland Exp $	*/
+/*	$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124 2014/07/25 08:10:39 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -267,6 +267,19 @@ ugen_attach(device_t parent, device_t se
 	return;
 }
 
+Static void
+ugen_clear_endpoints(struct ugen_softc *sc)
+{
+
+	/* Clear out the old info, but leave the selinfo and cv initialised. */
+	for (int i = 0; i < USB_MAX_ENDPOINTS; i++) {
+		for (int dir = OUT; dir <= IN; dir++) {
+			struct ugen_endpoint *sce = >sc_endpoints[i][dir];
+			memset(sce, 0, UGEN_ENDPOINT_NONZERO_CRUFT);
+		}
+	}
+}
+
 Static int
 ugen_set_config(struct ugen_softc *sc, int configno)
 {
@@ -278,7 +291,7 @@ ugen_set_config(struct ugen_softc *sc, i
 	u_int8_t niface, nendpt;
 	int ifaceno, endptno, endpt;
 	usbd_status err;
-	int dir, i;
+	int dir;
 
 	DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n",
 		device_xname(sc->sc_dev), configno, sc));
@@ -307,13 +320,7 @@ ugen_set_config(struct ugen_softc *sc, i
 	if (err)
 		return (err);
 
-	/* Clear out the old info, but leave the selinfo and cv initialised. */
-	for (i = 0; i < USB_MAX_ENDPOINTS; i++) {
-		for (dir = OUT; dir <= IN; dir++) {
-			sce = >sc_endpoints[i][dir];
-			memset(sce, 0, UGEN_ENDPOINT_NONZERO_CRUFT);
-		}
-	}
+	ugen_clear_endpoints(sc);
 
 	for (ifaceno = 0; ifaceno < niface; ifaceno++) {
 		DPRINTFN(1,("ugen_set_config: ifaceno %d\n", ifaceno));
@@ -378,7 +385,7 @@ ugenopen(dev_t dev, int flag, int mode, 
 	for (dir = OUT; dir <= IN; dir++) {
 		if (flag & (dir == OUT ? FWRITE : FREAD)) {
 			sce = >sc_endpoints[endpt][dir];
-			if (sce == 0 || sce->edesc == 0)
+			if (sce->edesc == NULL)
 return (ENXIO);
 		}
 	}
@@ -532,7 +539,7 @@ ugenclose(dev_t dev, int flag, int mode,
 		if (!(flag & (dir == OUT ? FWRITE : FREAD)))
 			continue;
 		sce = >sc_endpoints[endpt][dir];
-		if (sce == NULL || sce->pipeh == NULL)
+		if (sce->pipeh == NULL)
 			continue;
 		DPRINTFN(5, ("ugenclose: endpt=%d dir=%d sce=%p\n",
 			 endpt, dir, sce));
@@ -1032,7 +1039,7 @@ ugen_detach(device_t self, int flags)
 	for (i = 0; i < USB_MAX_ENDPOINTS; i++) {
 		for (dir = OUT; dir <= IN; dir++) {
 			sce = >sc_endpoints[i][dir];
-			if (sce && sce->pipeh)
+			if (sce->pipeh)
 usbd_abort_pipe(sce->pipeh);
 		}
 	}
@@ -1333,16 +1340,6 @@ ugen_set_interface(struct ugen_softc *sc
 	err = usbd_endpoint_count(iface, );
 	if (err)
 		return (err);
-	/* XXX should only do this after setting new altno has succeeded */
-	for (endptno = 0; endptno < nendpt; endptno++) {
-		ed = usbd_interface2endpoint_descriptor(iface,endptno);
-		endpt = ed->bEndpointAddress;
-		dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT;
-		sce = >sc_endpoints[UE_GET_ADDR(endpt)][dir];
-		sce->sc = 0;
-		sce->edesc = 0;
-		sce->iface = 0;
-	}
 
 	/* change setting */
 	err = usbd_set_interface(iface, altno);
@@ -1352,6 +1349,9 @@ ugen_set_interface(struct ugen_softc *sc
 	err = usbd_endpoint_count(iface, );
 	if (err)
 		return (err);
+
+	ugen_clear_endpoints(sc);
+
 	for (endptno = 0; endptno < nendpt; endptno++) {
 		ed = usbd_interface2endpoint_descriptor(iface,endptno);
 		KASSERT(ed != NULL);



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

2016-02-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 26 22:08:17 UTC 2016

Modified Files:
src/sys/dev/mii [netbsd-7]: igphy.c ukphy.c
src/sys/dev/pci [netbsd-7]: if_wm.c if_wmreg.h if_wmvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1102):
sys/dev/mii/igphy.c: 1.25
sys/dev/mii/ukphy.c: 1.48
sys/dev/pci/if_wm.c: revisions 1.308, 1.318, 1.320, 1.324-1.332, 1.334, 
1.336, 1.343-1.344, 1.347-1.348, 1.350, 1.376-1.382, 1.386-1.389 via patch
sys/dev/pci/if_wmreg.h: revisions 1.68-1.70, 1.73-1.77, 1.79-1.80, 
1.82, 1.86-1.88 via patch
sys/dev/pci/if_wmvar.h: revisions 1.22-1.23, 1.25-1.30 via patch
Sync wm(4) as of if_wm.c rev 1.389 except MSI/MSI-X, multiqueue and NET_MPSAFE:
- Add C2000 KX and 2.5G support.
- Set ICH9 and ICH10's PBA size to 14K if the RX buffer size is more than
  4096. Almost the same as other OSes.
- For 82576 and newer devices, the PBA register is deleted. Don't write PBA
  for those chips. Also change the calculation of RX packet buffer size in
  new way.
- Fix a lot of bugs to make 82575 and newer SERDES based systems work.
- Print NVM image version and option ROM version.
- Add workaround for I210 Errata 25 and I211 Errata 10 (PLL bug). This
  workaround is required if the NVM image version < 3.25.
- Fix a bug that wm_detach() didn't unmap the FHASH's area. Now
  "drvct -d wm0" -> "drvctl -r pci0" works on ICH* and PCH*.
- Add workaround for 82574 Errata 25 and 82583 Errata 12 "Dropped RX packets"
  and for 82573 (unknown). Set GCR_L1_ACT_WITHOUT_L0S_RX bit. The NVM Image
  version 2.1.4 and newer have this workaround.
- Check PHY type correctly. This change is required to use igphy(4) device
  correctly.
- Disable LPLU (Low Power Link Up) on D0 state on 82574, 82583 and ICH* too.
- Call wm_get_hw_control() correctly. This change fixes a bug that some AMT
  based systems doesn't linkup at 1000BaseT. The problem was observed on HP
  Compaq dc7700. A lot of fixes have been done for wm(4) and igphy(4), so now
  PR#44893 should be fixed.
- Call wm_get_wakeup(sc) before checking WM_F_HAS_AMT. It's required to
  check the existence of AMT correctly.
- Fix a problem that wm_gate_hw_phy_config_ich8lan() isn't called in
  wm_reset() on PCH2.
- Clear WMREG_WUC in wm_reset() if the chip >= 82544. This might fix the
  behavior on suspend/resume.
- Fix logic of wm_check_reset_block() on ICH* and PCH*. This change might fix
  a problem that PHY's read/write functions can't get semaphore.
- On ICH8, call wm_gig_downshift_workaround_ich8lan() when link changed down.
- Drop PHY_CTRL_GBE_DIS explicitly in wm_lplu_d0_disable() in case BIOS sets
  this bit.
- Fix two bugs in wm_kmrn_lock_loss_workaround_ich8lan(). Now the function
  checks the status correctly but it causes linkdown up to 10 times, so it's
  disabled for the time being.
- PR/50527: David Binderman: Fix impossible code. Odd offsets need special
  treatment.
- Fix RAL table's size of PCH2 and PCH_LPT.
- PCH_LPT (and newer device) is required to check FWSM_WLOCK_MAC bit to
  determine the range of the RAL.
- Use sc->sc_itr instead of hard-coded number.
- Rename wm_tbi_check_link() to wm_tbi_tick() because this function acts as
  mii_tick().
- ACK Accelerate Disable in the RFCTL register is not bit 13 but 12.
  No binary change because this definition has not used yet.
- Add ACK data Disable bit's definition (not used yet).
- PHY_CTRL_GBE_DIS is not bit 4 but bit 6. This change has no any effect by
  default because WM_WOL is not defined yet and
  m_kmrn_lock_loss_workaround_ich8lan() is broken.
- Fix wm_check_mng_mode_ich8lan(). This function is used only when WM_WOL is
  defined and it's disabled by default.
- Rename wm_check_reset_block() to wm_phy_resetisblocked() and make it returns
  bool. No functional change.
- Reorder function definitions and macro definitions. No functional change.
- Fix comment. Add comment. Update comment.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/dev/mii/igphy.c
cvs rdiff -u -r1.46 -r1.46.8.1 src/sys/dev/mii/ukphy.c
cvs rdiff -u -r1.289.2.8 -r1.289.2.9 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.4 -r1.60.2.5 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/dev/pci/if_wmvar.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/mii/igphy.c
diff -u src/sys/dev/mii/igphy.c:1.23 src/sys/dev/mii/igphy.c:1.23.2.1
--- src/sys/dev/mii/igphy.c:1.23	Mon Jun 16 16:48:16 2014
+++ src/sys/dev/mii/igphy.c	Fri Feb 26 22:08:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: igphy.c,v 1.23 2014/06/16 16:48:16 msaitoh Exp $	*/
+/*	$NetBSD: igphy.c,v 1.23.2.1 2016/02/26 22:08:17 snj Exp $	*/
 
 /*
  * The Intel copyright applies to the analog register setup, and the
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: igphy.c,v 1.23 2014/06/16 16:48:16 msaitoh Exp $");

CVS commit: [netbsd-7] src/sys/dev/usb

2016-02-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 26 21:34:27 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7]: hid.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1089):
sys/dev/usb/hid.c: revision 1.43
Convert unsigned char to wider type before left shift.
Avoids undefined behaviour if shifted quantity overflows int.
CID 980971


To generate a diff of this commit:
cvs rdiff -u -r1.35.14.1 -r1.35.14.2 src/sys/dev/usb/hid.c

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

Modified files:

Index: src/sys/dev/usb/hid.c
diff -u src/sys/dev/usb/hid.c:1.35.14.1 src/sys/dev/usb/hid.c:1.35.14.2
--- src/sys/dev/usb/hid.c:1.35.14.1	Mon Feb  9 09:43:09 2015
+++ src/sys/dev/usb/hid.c	Fri Feb 26 21:34:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hid.c,v 1.35.14.1 2015/02/09 09:43:09 martin Exp $	*/
+/*	$NetBSD: hid.c,v 1.35.14.2 2016/02/26 21:34:27 snj Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.35.14.1 2015/02/09 09:43:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.35.14.2 2016/02/26 21:34:27 snj Exp $");
 
 #include 
 #include 
@@ -455,7 +455,7 @@ hid_get_udata(const u_char *buf, const s
 	num = (hpos + hsize + 7) / 8 - off;
 
 	for (i = 0; i < num; i++)
-		data |= buf[off + i] << (i * 8);
+		data |= (unsigned long)buf[off + i] << (i * 8);
 
 	data >>= hpos % 8;
 	data &= (1 << hsize) - 1;



  1   2   3   >