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

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

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

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

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.87.2.1 -r1.87.2.2 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.87.2.1 src/sys/dev/ic/hme.c:1.87.2.2
--- src/sys/dev/ic/hme.c:1.87.2.1	Wed Jul  4 19:43:10 2012
+++ src/sys/dev/ic/hme.c	Mon May 14 16:07:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hme.c,v 1.87.2.1 2012/07/04 19:43:10 riz Exp $	*/
+/*	$NetBSD: hme.c,v 1.87.2.2 2018/05/14 16:07:06 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.87.2.1 2012/07/04 19:43:10 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.87.2.2 2018/05/14 16:07:06 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-6] src/sys/dev/ic

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 19 04:29:14 UTC 2017

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.27.8.1 -r1.27.8.2 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.27.8.1 src/sys/dev/ic/ciss.c:1.27.8.2
--- src/sys/dev/ic/ciss.c:1.27.8.1	Thu Nov 22 17:24:52 2012
+++ src/sys/dev/ic/ciss.c	Sat Aug 19 04:29:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.27.8.1 2012/11/22 17:24:52 riz Exp $	*/
+/*	$NetBSD: ciss.c,v 1.27.8.2 2017/08/19 04:29:14 snj Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.14 2006/03/13 16:02:23 mickey Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.27.8.1 2012/11/22 17:24:52 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.27.8.2 2017/08/19 04:29:14 snj Exp $");
 
 #include "bio.h"
 
@@ -1198,12 +1198,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;
 		}
@@ -1304,7 +1304,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-6] src/sys/dev/ic

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 19 04:27:39 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1485):
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.85.2.1 -r1.85.2.2 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.85.2.1 src/sys/dev/ic/isp_netbsd.c:1.85.2.2
--- src/sys/dev/ic/isp_netbsd.c:1.85.2.1	Mon Sep  3 18:38:34 2012
+++ src/sys/dev/ic/isp_netbsd.c	Sat Aug 19 04:27:38 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.85.2.1 2012/09/03 18:38:34 riz Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.85.2.2 2017/08/19 04:27:38 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.85.2.1 2012/09/03 18:38:34 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.85.2.2 2017/08/19 04:27:38 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 = &ua->wwns[0];



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

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug 19 03:15:57 UTC 2017

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

Log Message:
`cat ~/releng/r-commit`


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

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

Modified files:

Index: src/sys/dev/ic/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.18 src/sys/dev/ic/bwi.c:1.18.8.1
--- src/sys/dev/ic/bwi.c:1.18	Mon Oct 10 11:15:24 2011
+++ src/sys/dev/ic/bwi.c	Sat Aug 19 03:15:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.18 2011/10/10 11:15:24 njoly Exp $	*/
+/*	$NetBSD: bwi.c,v 1.18.8.1 2017/08/19 03:15:56 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.18 2011/10/10 11:15:24 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.18.8.1 2017/08/19 03:15:56 snj Exp $");
 
 #include 
 #include 
@@ -8315,7 +8315,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-6] src/sys/dev/ic

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug 18 15:08:21 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1477):
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 -r1.4.2.1 src/sys/dev/ic/dm9000.c

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

Modified files:

Index: src/sys/dev/ic/dm9000.c
diff -u src/sys/dev/ic/dm9000.c:1.4 src/sys/dev/ic/dm9000.c:1.4.2.1
--- src/sys/dev/ic/dm9000.c:1.4	Sat Jan 28 08:29:55 2012
+++ src/sys/dev/ic/dm9000.c	Fri Aug 18 15:08:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.4 2012/01/28 08:29:55 nisimura Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.4.2.1 2017/08/18 15:08:21 snj Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -1123,8 +1123,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-6] src/sys/dev/ic

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug 18 15:04:58 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1476):
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.35 -r1.35.14.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.35 src/sys/dev/ic/dp83932.c:1.35.14.1
--- src/sys/dev/ic/dp83932.c:1.35	Sat Nov 13 13:52:00 2010
+++ src/sys/dev/ic/dp83932.c	Fri Aug 18 15:04:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp83932.c,v 1.35 2010/11/13 13:52:00 uebayasi Exp $	*/
+/*	$NetBSD: dp83932.c,v 1.35.14.1 2017/08/18 15:04:58 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.35 2010/11/13 13:52:00 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.35.14.1 2017/08/18 15:04:58 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-6] src/sys/dev/ic

2017-08-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Aug 18 15:03:22 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1475):
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.29 -r1.29.14.1 src/sys/dev/ic/i82596.c

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

Modified files:

Index: src/sys/dev/ic/i82596.c
diff -u src/sys/dev/ic/i82596.c:1.29 src/sys/dev/ic/i82596.c:1.29.14.1
--- src/sys/dev/ic/i82596.c:1.29	Mon Apr  5 07:19:35 2010
+++ src/sys/dev/ic/i82596.c	Fri Aug 18 15:03:22 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.29 2010/04/05 07:19:35 joerg Exp $ */
+/* $NetBSD: i82596.c,v 1.29.14.1 2017/08/18 15:03:22 snj Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.29 2010/04/05 07:19:35 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.29.14.1 2017/08/18 15:03:22 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-6] src/sys/dev/ic

2016-08-27 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Aug 27 14:04:25 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by jdc in ticket #1384):
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.98.2.1 -r1.98.2.2 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.98.2.1 src/sys/dev/ic/gem.c:1.98.2.2
--- src/sys/dev/ic/gem.c:1.98.2.1	Thu Jul  5 17:59:12 2012
+++ src/sys/dev/ic/gem.c	Sat Aug 27 14:04:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.98.2.1 2012/07/05 17:59:12 riz Exp $ */
+/*	$NetBSD: gem.c,v 1.98.2.2 2016/08/27 14:04:25 bouyer Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.98.2.1 2012/07/05 17:59:12 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.98.2.2 2016/08/27 14:04:25 bouyer Exp $");
 
 #include "opt_inet.h"
 
@@ -1359,6 +1359,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)
@@ -1369,10 +1372,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
@@ -1477,7 +1482,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)) {
 
@@ -1599,7 +1605,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-6] src/sys/dev/ic

2015-11-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Nov 15 16:47:26 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1316):
sys/dev/ic/mpt_netbsd.c: revision 1.32
Adapter leaks requests when mpt_event_notify_reply() has to acknowledge
an event leading to "adapter resource shortage" messages when the scsipi
subsystem tries to use all adapt_openings.
Change mpt_ctlop() to free the request on event MPI_FUNCTION_EVENT_ACK.
Tested on a SunFire X4275 with Symbios Logic SAS1068E (1000:0058, rev. 4).


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

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

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.17.2.2 src/sys/dev/ic/mpt_netbsd.c:1.17.2.3
--- src/sys/dev/ic/mpt_netbsd.c:1.17.2.2	Mon Nov  3 22:05:37 2014
+++ src/sys/dev/ic/mpt_netbsd.c	Sun Nov 15 16:47:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.17.2.2 2014/11/03 22:05:37 msaitoh Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.17.2.3 2015/11/15 16:47:26 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17.2.2 2014/11/03 22:05:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17.2.3 2015/11/15 16:47:26 bouyer Exp $");
 
 #include "bio.h"
 
@@ -1117,8 +1117,16 @@ mpt_ctlop(mpt_softc_t *mpt, void *vmsg, 
 		break;
 
 	case MPI_FUNCTION_EVENT_ACK:
+	{
+		MSG_EVENT_ACK_REPLY *msg = vmsg;
+		int index = le32toh(msg->MsgContext) & ~0x8000;
 		mpt_free_reply(mpt, (reply << 1));
+		if (index >= 0 && index < MPT_MAX_REQUESTS(mpt)) {
+			request_t *req = &mpt->request_pool[index];
+			mpt_free_request(mpt, req);
+		}
 		break;
+	}
 
 	case MPI_FUNCTION_PORT_ENABLE:
 	{



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

2015-03-05 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar  5 22:21:02 UTC 2015

Modified Files:
src/sys/dev/ic [netbsd-6]: tulip.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1262):
sys/dev/ic/tulip.c: revision 1.185
Stop the interface before detaching to avoid the race between
tlp_detach() and tlp_intr().
While there, add missing callout_destroy()s.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.180.2.1 src/sys/dev/ic/tulip.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/tulip.c
diff -u src/sys/dev/ic/tulip.c:1.180 src/sys/dev/ic/tulip.c:1.180.2.1
--- src/sys/dev/ic/tulip.c:1.180	Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/tulip.c	Thu Mar  5 22:21:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tulip.c,v 1.180 2012/02/02 19:43:03 tls Exp $	*/
+/*	$NetBSD: tulip.c,v 1.180.2.1 2015/03/05 22:21:02 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.180 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.180.2.1 2015/03/05 22:21:02 riz Exp $");
 
 
 #include 
@@ -595,7 +595,7 @@ tlp_detach(struct tulip_softc *sc)
 	struct tulip_rxsoft *rxs;
 	struct tulip_txsoft *txs;
 	device_t self = sc->sc_dev;
-	int i;
+	int i, s;
 
 	/*
 	 * Succeed now if there isn't any work to do.
@@ -603,9 +603,14 @@ tlp_detach(struct tulip_softc *sc)
 	if ((sc->sc_flags & TULIPF_ATTACHED) == 0)
 		return (0);
 
-	/* Unhook our tick handler. */
-	if (sc->sc_tick)
-		callout_stop(&sc->sc_tick_callout);
+	s = splnet();
+	/* Stop the interface. Callouts are stopped in it. */
+	tlp_stop(ifp, 1);
+	splx(s);
+
+	/* Destroy our callouts. */
+	callout_destroy(&sc->sc_nway_callout);
+	callout_destroy(&sc->sc_tick_callout);
 
 	if (sc->sc_flags & TULIPF_HAS_MII) {
 		/* Detach all PHYs */



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

2014-12-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 14 14:24:56 UTC 2014

Modified Files:
src/sys/dev/ic [netbsd-6]: rtl8169.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #1212):
sys/dev/ic/rtl8169.c: revision 1.142
RealTek 8139C+ incorrectly identifies UDP checksum 0x as bad.
Force software recalculation of UDP checksum if bad checksum is
reported by the hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.134.4.3 -r1.134.4.4 src/sys/dev/ic/rtl8169.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/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.134.4.3 src/sys/dev/ic/rtl8169.c:1.134.4.4
--- src/sys/dev/ic/rtl8169.c:1.134.4.3	Wed Sep 18 20:00:53 2013
+++ src/sys/dev/ic/rtl8169.c	Sun Dec 14 14:24:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.134.4.3 2013/09/18 20:00:53 bouyer Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.134.4.4 2014/12/14 14:24:56 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.134.4.3 2013/09/18 20:00:53 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.134.4.4 2014/12/14 14:24:56 martin Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -1298,9 +1298,19 @@ re_rxeof(struct rtk_softc *sc)
 		M_CSUM_TCP_UDP_BAD;
 } else if (RE_UDPPKT(rxstat)) {
 	m->m_pkthdr.csum_flags |= M_CSUM_UDPv4;
-	if (rxstat & RE_RDESC_STAT_UDPSUMBAD)
-		m->m_pkthdr.csum_flags |=
-		M_CSUM_TCP_UDP_BAD;
+	if (rxstat & RE_RDESC_STAT_UDPSUMBAD) {
+		/*
+		 * XXX: 8139C+ thinks UDP csum
+		 * 0x is bad, force software
+		 * calculation.
+		 */
+		if (sc->sc_quirk & RTKQ_8139CPLUS)
+			m->m_pkthdr.csum_flags
+			&= ~M_CSUM_UDPv4;
+		else
+			m->m_pkthdr.csum_flags
+			|= M_CSUM_TCP_UDP_BAD;
+	}
 }
 			}
 		} else {



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

2014-02-07 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb  7 11:15:37 UTC 2014

Modified Files:
src/sys/dev/ic [netbsd-6]: pckbc.c

Log Message:
Pull up the following revisions(s) (requested by skrll in ticket #1014):
sys/dev/ic/pckbc.c: revision 1.56

Do not take data from the keyboard controller in interrupt handler if
we are polling. Fixes PR/47406


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.2.1 src/sys/dev/ic/pckbc.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/pckbc.c
diff -u src/sys/dev/ic/pckbc.c:1.53 src/sys/dev/ic/pckbc.c:1.53.2.1
--- src/sys/dev/ic/pckbc.c:1.53	Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/pckbc.c	Fri Feb  7 11:15:37 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: pckbc.c,v 1.53 2012/02/02 19:43:03 tls Exp $ */
+/* $NetBSD: pckbc.c,v 1.53.2.1 2014/02/07 11:15:37 sborrill Exp $ */
 
 /*
  * Copyright (c) 2004 Ben Harris.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.53 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.53.2.1 2014/02/07 11:15:37 sborrill Exp $");
 
 #include 
 #include 
@@ -583,12 +583,14 @@ pckbcintr(void *vsc)
 		if (!(stat & KBS_DIB))
 			break;
 
-		served = 1;
-
 		slot = (t->t_haveaux && (stat & 0x20)) ?
 		PCKBC_AUX_SLOT : PCKBC_KBD_SLOT;
 		q = t->t_slotdata[slot];
 
+		if (q != NULL && q->polling)
+			return 0;
+
+		served = 1;
 		KBD_DELAY;
 		data = bus_space_read_1(t->t_iot, t->t_ioh_d, 0);
 



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

2013-11-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Nov 17 18:14:47 UTC 2013

Modified Files:
src/sys/dev/ic [netbsd-6]: esiop.c

Log Message:
Apply patch, requested by gson in ticket #981:
sys/dev/ic/esiop.c  1.57 via patch
Turn the "siop_intr: I shouldn't be there !" panic message in the
esiop driver into a printf followed by a return from the interrupt
handler.  The condition is triggered on some KVM virtual hosts,
apparently harmlessly, and not panicing makes it possible to boot a
NetBSD GENERIC kernel on those hosts. Fixes PR kern/48277.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.14.1 src/sys/dev/ic/esiop.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/esiop.c
diff -u src/sys/dev/ic/esiop.c:1.55 src/sys/dev/ic/esiop.c:1.55.14.1
--- src/sys/dev/ic/esiop.c:1.55	Sat Nov 13 13:52:01 2010
+++ src/sys/dev/ic/esiop.c	Sun Nov 17 18:14:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: esiop.c,v 1.55 2010/11/13 13:52:01 uebayasi Exp $	*/
+/*	$NetBSD: esiop.c,v 1.55.14.1 2013/11/17 18:14:47 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2002 Manuel Bouyer.
@@ -28,7 +28,7 @@
 /* SYM53c7/8xx PCI-SCSI I/O Processors driver */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.55 2010/11/13 13:52:01 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.55.14.1 2013/11/17 18:14:47 bouyer Exp $");
 
 #include 
 #include 
@@ -1100,8 +1100,12 @@ scintr:
 		}
 		return 1;
 	}
-	/* We just should't get there */
-	panic("siop_intr: I shouldn't be there !");
+	/*
+	 * We just should't get there, but on some KVM virtual hosts,
+	 * we do - see PR 48277.
+	 */
+	printf("esiop_intr: I shouldn't be there !\n");
+	return 1;
 
 end:
 	/*



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

2013-03-14 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar 14 21:52:11 UTC 2013

Modified Files:
src/sys/dev/ic [netbsd-6]: isp.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #838):
sys/dev/ic/isp.c: revision 1.123
Disable ICBOPT_FAST_POST for ISP 2100.
Fixes PR kern/47302. From Matthew Jacob.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.122.10.1 src/sys/dev/ic/isp.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.c
diff -u src/sys/dev/ic/isp.c:1.122 src/sys/dev/ic/isp.c:1.122.10.1
--- src/sys/dev/ic/isp.c:1.122	Mon Feb 28 17:17:55 2011
+++ src/sys/dev/ic/isp.c	Thu Mar 14 21:52:10 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $ */
+/* $NetBSD: isp.c,v 1.122.10.1 2013/03/14 21:52:10 riz Exp $ */
 /*
  * Machine and OS Independent (well, as best as possible)
  * code for the Qlogic ISP SCSI adapters.
@@ -43,7 +43,7 @@
  */
 #ifdef	__NetBSD__
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.122 2011/02/28 17:17:55 mjacob Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp.c,v 1.122.10.1 2013/03/14 21:52:10 riz Exp $");
 #include 
 #endif
 #ifdef	__FreeBSD__
@@ -1580,7 +1580,13 @@ isp_fibre_init(ispsoftc_t *isp)
 	 *
 	 * NB: for the 2300, ICBOPT_EXTENDED is required.
 	 */
-	if (IS_2200(isp) || IS_23XX(isp)) {
+	if (IS_2100(isp)) {
+		/*
+		 * We can't have Fast Posting any more- we now
+		 * have 32 bit handles.
+		 */
+		icbp->icb_fwoptions &= ~ICBOPT_FAST_POST;
+	} else if (IS_2200(isp) || IS_23XX(isp)) {
 		icbp->icb_fwoptions |= ICBOPT_EXTENDED;
 		/*
 		 * Prefer or force Point-To-Point instead Loop?



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

2012-11-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 22 17:24:52 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #687):
sys/dev/ic/ciss.c: revision 1.28
don't try to handle sensors if there aren't any.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.8.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.27 src/sys/dev/ic/ciss.c:1.27.8.1
--- src/sys/dev/ic/ciss.c:1.27	Mon Jun 20 22:02:55 2011
+++ src/sys/dev/ic/ciss.c	Thu Nov 22 17:24:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ciss.c,v 1.27 2011/06/20 22:02:55 pgoyette Exp $	*/
+/*	$NetBSD: ciss.c,v 1.27.8.1 2012/11/22 17:24:52 riz Exp $	*/
 /*	$OpenBSD: ciss.c,v 1.14 2006/03/13 16:02:23 mickey Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.27 2011/06/20 22:02:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.27.8.1 2012/11/22 17:24:52 riz Exp $");
 
 #include "bio.h"
 
@@ -1411,6 +1411,10 @@ ciss_create_sensors(struct ciss_softc *s
 	int			i;
 	int nsensors = sc->maxunits;
 
+	if (nsensors == 0) {
+		return 0;
+	}
+
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sensor = malloc(sizeof(envsys_data_t) * nsensors,
 		M_DEVBUF, M_NOWAIT | M_ZERO);



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

2012-11-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 22 17:19:56 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #686):
sys/dev/ic/mpt_netbsd.c: revision 1.19
set chan_bustype correctly.


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

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

Modified files:

Index: src/sys/dev/ic/mpt_netbsd.c
diff -u src/sys/dev/ic/mpt_netbsd.c:1.17 src/sys/dev/ic/mpt_netbsd.c:1.17.2.1
--- src/sys/dev/ic/mpt_netbsd.c:1.17	Mon Jan 30 17:45:14 2012
+++ src/sys/dev/ic/mpt_netbsd.c	Thu Nov 22 17:19:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpt_netbsd.c,v 1.17 2012/01/30 17:45:14 mhitch Exp $	*/
+/*	$NetBSD: mpt_netbsd.c,v 1.17.2.1 2012/11/22 17:19:56 riz Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17 2012/01/30 17:45:14 mhitch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpt_netbsd.c,v 1.17.2.1 2012/11/22 17:19:56 riz Exp $");
 
 #include 			/* pulls in all headers */
 
@@ -118,7 +118,13 @@ mpt_scsipi_attach(mpt_softc_t *mpt)
 	/* Fill in the scsipi_channel. */
 	memset(chan, 0, sizeof(*chan));
 	chan->chan_adapter = adapt;
-	chan->chan_bustype = &scsi_bustype;
+	if (mpt->is_sas) {
+		chan->chan_bustype = &scsi_sas_bustype;
+	} else if (mpt->is_fc) {
+		chan->chan_bustype = &scsi_fc_bustype;
+	} else {
+		chan->chan_bustype = &scsi_bustype;
+	}
 	chan->chan_channel = 0;
 	chan->chan_flags = 0;
 	chan->chan_nluns = 8;



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

2012-11-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Nov 18 19:01:45 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: mfi.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #674):
sys/dev/ic/mfi.c: revision 1.48
MFI_STATE_BOOT_MESSAGE_PENDING also needs to be handed for non-TBOLT
controllers, from FreeBSD. tested by Hugo Silva against a GEN2 controller.


To generate a diff of this commit:
cvs rdiff -u -r1.36.8.4 -r1.36.8.5 src/sys/dev/ic/mfi.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/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.36.8.4 src/sys/dev/ic/mfi.c:1.36.8.5
--- src/sys/dev/ic/mfi.c:1.36.8.4	Wed Oct 24 03:23:44 2012
+++ src/sys/dev/ic/mfi.c	Sun Nov 18 19:01:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.36.8.4 2012/10/24 03:23:44 riz Exp $ */
+/* $NetBSD: mfi.c,v 1.36.8.5 2012/11/18 19:01:44 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.36.8.4 2012/10/24 03:23:44 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.36.8.5 2012/11/18 19:01:44 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -587,12 +587,14 @@ mfi_transition_firmware(struct mfi_softc
 			max_wait = 20;
 			break;
 		case MFI_STATE_BOOT_MESSAGE_PENDING:
-			if (sc->sc_ioptype == MFI_IOP_TBOLT) {
+			if (sc->sc_ioptype == MFI_IOP_SKINNY ||
+			sc->sc_ioptype == MFI_IOP_TBOLT) {
 mfi_write(sc, MFI_SKINNY_IDB, MFI_INIT_HOTPLUG);
-max_wait = 180;
-break;
+			} else {
+mfi_write(sc, MFI_IDB, MFI_INIT_HOTPLUG);
 			}
-			/* FALLTHROUGH */
+			max_wait = 180;
+			break;
 		default:
 			aprint_error_dev(sc->sc_dev,
 			"unknown firmware state %d\n", fw_state);



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

2012-09-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Sep  3 18:38:34 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #524):
sys/dev/ic/isp_netbsd.c: revision 1.86
Properly fill the struct timeval before using it: a timeout in microseconds has
to be converted to seconds and microseconds.
Fix KASSERT("usec >= 0 && usec < 100") in tvtohz().
While there, simplify computation of to (avoids a timersub() in tvhzto()
and directly call tvtohz() with the interval).


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.85.2.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.85 src/sys/dev/ic/isp_netbsd.c:1.85.2.1
--- src/sys/dev/ic/isp_netbsd.c:1.85	Mon Dec 12 18:28:34 2011
+++ src/sys/dev/ic/isp_netbsd.c	Mon Sep  3 18:38:34 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.85.2.1 2012/09/03 18:38:34 riz Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.85 2011/12/12 18:28:34 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.85.2.1 2012/09/03 18:38:34 riz Exp $");
 
 #include 
 #include 
@@ -1603,14 +1603,14 @@ isp_mbox_wait_complete(struct ispsoftc *
 		tv.tv_sec = 0;
 		tv.tv_usec = 0;
 		for (olim = 0; olim < maxc; olim++) {
-			utv.tv_sec = 0;
-			utv.tv_usec = usecs;
+			utv.tv_sec = usecs / 100;
+			utv.tv_usec = usecs % 100;
 			timeradd(&tv, &utv, &tv);
 		}
-		timeradd(&tv, &start, &tv);
-		to = tvhzto(&tv);
+		to = tvtohz(&tv);
 		if (to == 0)
 			to = 1;
+		timeradd(&tv, &start, &tv);
 
 		isp->isp_osinfo.mbox_sleep_ok = 0;
 		isp->isp_osinfo.mbox_sleeping = 1;



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

2012-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 12 13:27:44 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: vga.c

Log Message:
Pull up following revision(s) (requested by uwe in ticket #472):
sys/dev/ic/vga.c: revision 1.109
Reset flip/flop using dedicated vga_reset_state() macro we already have.
Explicit vga_raw_read() used here before was incorrect since it reads
from *wrong* io handle!
Fixes weird problem under VirtualBox where first switch to a different
VT caused text mode color 0 (normally black) to become something else.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.108.2.1 src/sys/dev/ic/vga.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/vga.c
diff -u src/sys/dev/ic/vga.c:1.108 src/sys/dev/ic/vga.c:1.108.2.1
--- src/sys/dev/ic/vga.c:1.108	Wed Jan 11 20:41:28 2012
+++ src/sys/dev/ic/vga.c	Sun Aug 12 13:27:43 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vga.c,v 1.108 2012/01/11 20:41:28 macallan Exp $ */
+/* $NetBSD: vga.c,v 1.108.2.1 2012/08/12 13:27:43 martin Exp $ */
 
 /*
  * Copyright (c) 1995, 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.108 2012/01/11 20:41:28 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vga.c,v 1.108.2.1 2012/08/12 13:27:43 martin Exp $");
 
 /* for WSCONS_SUPPORT_PCVTFONTS */
 #include "opt_wsdisplay_compat.h"
@@ -1565,7 +1565,7 @@ vga_save_palette(struct vga_config *vc)
 	for (i = 0; i < sizeof(vc->palette); i++)
 		*palette++ = vga_raw_read(vh, VGA_DAC_PALETTE);
 
-	vga_raw_read(vh, 0x0a);			/* reset flip/flop */
+	vga_reset_state(vh);			/* reset flip/flop */
 }
 
 void
@@ -1583,6 +1583,6 @@ vga_restore_palette(struct vga_config *v
 	for (i = 0; i < sizeof(vc->palette); i++)
 		vga_raw_write(vh, VGA_DAC_PALETTE, *palette++);
 
-	vga_raw_read(vh, 0x0a);			/* reset flip/flop */
+	vga_reset_state(vh);			/* reset flip/flop */
 	vga_enable(vh);
 }



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

2012-07-25 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Wed Jul 25 20:55:36 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: ncr53c9x.c

Log Message:
Pull up revision 1.145 (requested by ryoon in ticket #439).

When issuing a non-dma command, make sure to set the "remaining length of
command to be transfered via dma" (sc_cmdlen) to zero upfront, otherwise we
might get confused on command completition interrupt (no dma active but still
data left to transfer).


To generate a diff of this commit:
cvs rdiff -u -r1.143.8.1 -r1.143.8.2 src/sys/dev/ic/ncr53c9x.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/ncr53c9x.c
diff -u src/sys/dev/ic/ncr53c9x.c:1.143.8.1 src/sys/dev/ic/ncr53c9x.c:1.143.8.2
--- src/sys/dev/ic/ncr53c9x.c:1.143.8.1	Mon Mar 19 23:13:59 2012
+++ src/sys/dev/ic/ncr53c9x.c	Wed Jul 25 20:55:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ncr53c9x.c,v 1.143.8.1 2012/03/19 23:13:59 riz Exp $	*/
+/*	$NetBSD: ncr53c9x.c,v 1.143.8.2 2012/07/25 20:55:36 jdc Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.143.8.1 2012/03/19 23:13:59 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ncr53c9x.c,v 1.143.8.2 2012/07/25 20:55:36 jdc Exp $");
 
 #include 
 #include 
@@ -735,6 +735,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s
 		} else {
 			ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd,
 			ecb->clen);
+			sc->sc_cmdlen = 0;
 			NCRCMD(sc, NCRCMD_SELNATN);
 		}
 		return;
@@ -804,6 +805,7 @@ ncr53c9x_select(struct ncr53c9x_softc *s
 	 */
 
 	/* Now get the command into the FIFO */
+	sc->sc_cmdlen = 0;
 	ncr53c9x_wrfifo(sc, cmd, clen);
 
 	/* And get the targets attention */
@@ -2054,6 +2056,7 @@ ncr53c9x_msgout(struct ncr53c9x_softc *s
 		 */
 		ncr53c9x_flushfifo(sc);
 		ncr53c9x_wrfifo(sc, sc->sc_omp, sc->sc_omlen);
+		sc->sc_cmdlen = 0;
 		NCRCMD(sc, NCRCMD_TRANS);
 	} else {
 		/* (re)send the message */
@@ -2759,6 +2762,7 @@ msgin:
 		} else {
 			ncr53c9x_wrfifo(sc, (uint8_t *)&ecb->cmd.cmd,
 			ecb->clen);
+			sc->sc_cmdlen = 0;
 			NCRCMD(sc, NCRCMD_TRANS);
 		}
 		sc->sc_prevphase = COMMAND_PHASE;



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

2012-07-05 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Jul  5 17:59:13 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: gem.c gemreg.h gemvar.h

Log Message:
Pull up following revision(s) (requested by jdc in ticket #401):
sys/dev/ic/gem.c: revision 1.99
sys/dev/ic/gemvar.h: revision 1.24
sys/dev/ic/gemreg.h: revision 1.15
Apply lockup fixes from Havard Eidnes/OpenBSD in PR port-sparc64/46260:
- add an additional watchdog for RX overflow
- re-initialise the chip on device timeout
Also alter the interrupt blanking rate to 8 packets, as per OpenSolaris.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.98.2.1 src/sys/dev/ic/gem.c
cvs rdiff -u -r1.14 -r1.14.34.1 src/sys/dev/ic/gemreg.h
cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/dev/ic/gemvar.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/gem.c
diff -u src/sys/dev/ic/gem.c:1.98 src/sys/dev/ic/gem.c:1.98.2.1
--- src/sys/dev/ic/gem.c:1.98	Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/gem.c	Thu Jul  5 17:59:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: gem.c,v 1.98 2012/02/02 19:43:03 tls Exp $ */
+/*	$NetBSD: gem.c,v 1.98.2.1 2012/07/05 17:59:12 riz Exp $ */
 
 /*
  *
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.98 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.98.2.1 2012/07/05 17:59:12 riz Exp $");
 
 #include "opt_inet.h"
 
@@ -89,6 +89,7 @@ static void	gem_stop(struct ifnet *, int
 int		gem_ioctl(struct ifnet *, u_long, void *);
 void		gem_tick(void *);
 void		gem_watchdog(struct ifnet *);
+void		gem_rx_watchdog(void *);
 void		gem_pcs_start(struct gem_softc *sc);
 void		gem_pcs_stop(struct gem_softc *sc, int);
 int		gem_init(struct ifnet *);
@@ -177,6 +178,7 @@ gem_detach(struct gem_softc *sc, int fla
 		ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY);
 
 		callout_destroy(&sc->sc_tick_ch);
+		callout_destroy(&sc->sc_rx_watchdog);
 
 		/*FALLTHROUGH*/
 	case GEM_ATT_MII:
@@ -613,6 +615,8 @@ gem_attach(struct gem_softc *sc, const u
 #endif
 
 	callout_init(&sc->sc_tick_ch, 0);
+	callout_init(&sc->sc_rx_watchdog, 0);
+	callout_setfunc(&sc->sc_rx_watchdog, gem_rx_watchdog, sc);
 
 	sc->sc_att_stage = GEM_ATT_FINISHED;
 
@@ -764,6 +768,8 @@ gem_reset_rx(struct gem_softc *sc)
 	/* Wait till it finishes */
 	if (!gem_bitwait(sc, h, GEM_RX_CONFIG, 1, 0))
 		aprint_error_dev(sc->sc_dev, "cannot disable read dma\n");
+	/* Wait 5ms extra. */
+	delay(5000);
 
 	/* Finally, reset the ERX */
 	bus_space_write_4(t, h2, GEM_RESET, GEM_RESET_RX);
@@ -848,7 +854,7 @@ gem_rx_common(struct gem_softc *sc)
 	(3 * sc->sc_rxfifosize / 256) |
 	((sc->sc_rxfifosize / 256) << 12));
 	bus_space_write_4(t, h, GEM_RX_BLANKING,
-	(6 << GEM_RX_BLANKING_TIME_SHIFT) | 6);
+	(6 << GEM_RX_BLANKING_TIME_SHIFT) | 8);
 }
 
 /*
@@ -1824,6 +1830,8 @@ gem_rint(struct gem_softc *sc)
 		if (gem_add_rxbuf(sc, i) != 0) {
 			GEM_COUNTER_INCR(sc, sc_ev_rxnobuf);
 			ifp->if_ierrors++;
+			aprint_error_dev(sc->sc_dev,
+			"receive error: RX no buffer space\n");
 			GEM_INIT_RXDESC(sc, i);
 			bus_dmamap_sync(sc->sc_dmatag, rxs->rxs_dmamap, 0,
 			rxs->rxs_dmamap->dm_mapsize, BUS_DMASYNC_PREREAD);
@@ -2204,12 +2212,20 @@ gem_intr(void *v)
 		/*
 		 * At least with GEM_SUN_GEM and some GEM_SUN_ERI
 		 * revisions GEM_MAC_RX_OVERFLOW happen often due to a
-		 * silicon bug so handle them silently. Moreover, it's
-		 * likely that the receiver has hung so we reset it.
+		 * silicon bug so handle them silently.  So if we detect
+		 * an RX FIFO overflow, we fire off a timer, and check
+		 * whether we're still making progress by looking at the
+		 * RX FIFO write and read pointers.
 		 */
 		if (rxstat & GEM_MAC_RX_OVERFLOW) {
 			ifp->if_ierrors++;
-			gem_reset_rxdma(sc);
+			aprint_error_dev(sc->sc_dev,
+			"receive error: RX overflow sc->rxptr %d, complete %d\n", sc->sc_rxptr, bus_space_read_4(t, h, GEM_RX_COMPLETION));
+			sc->sc_rx_fifo_wr_ptr =
+bus_space_read_4(t, h, GEM_RX_FIFO_WR_PTR);
+			sc->sc_rx_fifo_rd_ptr =
+bus_space_read_4(t, h, GEM_RX_FIFO_RD_PTR);
+			callout_schedule(&sc->sc_rx_watchdog, 400);
 		} else if (rxstat & ~(GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT))
 			printf("%s: MAC rx fault, status 0x%02x\n",
 			device_xname(sc->sc_dev), rxstat);
@@ -2236,6 +2252,61 @@ gem_intr(void *v)
 	return (r);
 }
 
+void
+gem_rx_watchdog(void *arg)
+{
+	struct gem_softc *sc = arg;
+	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+	bus_space_tag_t t = sc->sc_bustag;
+	bus_space_handle_t h = sc->sc_h1;
+	u_int32_t rx_fifo_wr_ptr;
+	u_int32_t rx_fifo_rd_ptr;
+	u_int32_t state;
+
+	if ((ifp->if_flags & IFF_RUNNING) == 0) {
+		aprint_error_dev(sc->sc_dev, "receiver not running\n");
+		return;
+	}
+
+	rx_fifo_wr_ptr = bus_space_read_4(t, h, GEM_RX_FIFO_WR_PTR);
+	rx_fifo_rd_ptr = bus_space_read_4(t, h, GEM_RX_FIFO_RD_PTR);
+	state = bus_space_read_4(t, h, GEM_MA

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

2012-06-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Jun 12 19:44:46 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: seeq8005.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #325):
sys/dev/ic/seeq8005.c: revision 1.48
PR/46576: Robert Sprowson: Shutdown doesn't disable TX/RX interrupts in
SEEQ8005 driver, plus misc white-space and 0->NULL fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.46.2.1 src/sys/dev/ic/seeq8005.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/seeq8005.c
diff -u src/sys/dev/ic/seeq8005.c:1.46 src/sys/dev/ic/seeq8005.c:1.46.2.1
--- src/sys/dev/ic/seeq8005.c:1.46	Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/seeq8005.c	Tue Jun 12 19:44:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: seeq8005.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */
+/* $NetBSD: seeq8005.c,v 1.46.2.1 2012/06/12 19:44:46 riz Exp $ */
 
 /*
  * Copyright (c) 2000, 2001 Ben Harris
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.46 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.46.2.1 2012/06/12 19:44:46 riz Exp $");
 
 #include 
 #include 
@@ -476,7 +476,7 @@ ea_stop(struct ifnet *ifp, int disable)
 	ea_stoprx(sc);
 
 	/* Disable rx and tx interrupts */
-	sc->sc_command &= (SEEQ_CMD_RX_INTEN | SEEQ_CMD_TX_INTEN);
+	sc->sc_command &= ~(SEEQ_CMD_RX_INTEN | SEEQ_CMD_TX_INTEN);
 
 	/* Clear any pending interrupts */
 	SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
@@ -492,7 +492,7 @@ ea_stop(struct ifnet *ifp, int disable)
 	}
 
 	/* Cancel any watchdog timer */
-   	sc->sc_ethercom.ec_if.if_timer = 0;
+	sc->sc_ethercom.ec_if.if_timer = 0;
 }
 
 
@@ -832,7 +832,7 @@ ea_init(struct ifnet *ifp)
 	SEEQ_WRITE16(sc, iot, ioh, SEEQ_COMMAND,
 			  sc->sc_command | SEEQ_CMD_RX_ON);
 
-	/* TX_ON gets set by ea_txpacket when there's something to transmit. */
+	/* TX_ON gets set by eatxpacket when there's something to transmit. */
 
 
 	/* Set flags appropriately. */
@@ -887,7 +887,7 @@ ea_start(struct ifnet *ifp)
  * Called at splnet()
  */
 
-void
+static void
 eatxpacket(struct seeq8005_softc *sc)
 {
 	bus_space_tag_t iot = sc->sc_iot;
@@ -980,7 +980,7 @@ ea_writembuf(struct seeq8005_softc *sc, 
 	hdr[1] = nextpacket & 0xff;
 	hdr[2] = SEEQ_PKTCMD_TX | SEEQ_PKTCMD_DATA_FOLLOWS |
 		SEEQ_TXCMD_XMIT_SUCCESS_INT | SEEQ_TXCMD_COLLISION_INT;
-	hdr[3] = 0; /* Status byte -- will be update by hardware. */
+	hdr[3] = 0; /* Status byte -- will be updated by hardware. */
 	ea_writebuf(sc, hdr, 0x, 4);
 
 	return len;
@@ -,7 +,7 @@ ea_txint(struct seeq8005_softc *sc)
 	}
 }
 
-void
+static void
 ea_rxint(struct seeq8005_softc *sc)
 {
 	bus_space_tag_t iot = sc->sc_iot;
@@ -1160,7 +1160,7 @@ ea_rxint(struct seeq8005_softc *sc)
 		}
 
 		/* Get packet length */
-   		len = (ptr - addr) - 4;
+		len = (ptr - addr) - 4;
 
 		if (len < 0)
 			len += sc->sc_rx_bufsize;
@@ -1238,7 +1238,7 @@ ea_read(struct seeq8005_softc *sc, int a
 
 	/* Pull packet off interface. */
 	m = ea_get(sc, addr, len, ifp);
-	if (m == 0)
+	if (m == NULL)
 		return;
 
 	/*
@@ -1267,20 +1267,20 @@ ea_get(struct seeq8005_softc *sc, int ad
 epkt = cp + totlen;
 
 MGETHDR(m, M_DONTWAIT, MT_DATA);
-if (m == 0)
-return 0;
+if (m == NULL)
+return NULL;
 m->m_pkthdr.rcvif = ifp;
 m->m_pkthdr.len = totlen;
 m->m_len = MHLEN;
-top = 0;
+top = NULL;
 mp = ⊤
 
 while (totlen > 0) {
 if (top) {
 MGET(m, M_DONTWAIT, MT_DATA);
-if (m == 0) {
+if (m == NULL) {
 m_freem(top);
-return 0;
+return NULL;
 }
 m->m_len = MLEN;
 }
@@ -1296,13 +1296,13 @@ ea_get(struct seeq8005_softc *sc, int ad
  * Place initial small packet/header at end of mbuf.
  */
 if (len < m->m_len) {
-if (top == 0 && len + max_linkhdr <= m->m_len)
+if (top == NULL && len + max_linkhdr <= m->m_len)
 m->m_data += max_linkhdr;
 m->m_len = len;
 } else
 len = m->m_len;
 }
-		if (top == 0) {
+		if (top == NULL) {
 			/* Make sure the payload is aligned */
 			char *newdata = (char *)
 			ALIGN((char*)m->m_data + 
@@ -1485,4 +1485,4 @@ ea_watchdog(struct ifnet *ifp)
 	ifp->if_timer = 0;
 }
 
-/* End of if_ea.c */
+/* End of seeq8005.c */



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

2012-05-09 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed May  9 20:11:12 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: ld_cac.c

Log Message:
Pull up following revision(s) (requested by macallan in ticket #240):
sys/dev/ic/ld_cac.c: revision 1.27
Reserve a CCB for the driver.  Stops the annoying cac0: unable to alloc CCB
messages.


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

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

Modified files:

Index: src/sys/dev/ic/ld_cac.c
diff -u src/sys/dev/ic/ld_cac.c:1.26 src/sys/dev/ic/ld_cac.c:1.26.2.1
--- src/sys/dev/ic/ld_cac.c:1.26	Thu Feb  2 19:43:03 2012
+++ src/sys/dev/ic/ld_cac.c	Wed May  9 20:11:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_cac.c,v 1.26 2012/02/02 19:43:03 tls Exp $	*/
+/*	$NetBSD: ld_cac.c,v 1.26.2.1 2012/05/09 20:11:12 riz Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.26 2012/02/02 19:43:03 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.26.2.1 2012/05/09 20:11:12 riz Exp $");
 
 #include 
 #include 
@@ -103,7 +103,7 @@ ld_cac_attach(device_t parent, device_t 
 
 	ld->sc_secsize = CAC_GET2(dinfo.secsize);
 	ld->sc_maxxfer = CAC_MAX_XFER;
-	ld->sc_maxqueuecnt = CAC_MAX_CCBS / cac->sc_nunits;	/* XXX */
+	ld->sc_maxqueuecnt = (CAC_MAX_CCBS - 1) / cac->sc_nunits;
 	ld->sc_secperunit = CAC_GET2(dinfo.ncylinders) *
 	CAC_GET1(dinfo.nheads) * CAC_GET1(dinfo.nsectors);
 	ld->sc_start = ld_cac_start;



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

2012-04-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 22 17:01:44 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: com.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #190):
sys/dev/ic/com.c: revision 1.305
don't include  before we define cn_trap, because it might bring
in


To generate a diff of this commit:
cvs rdiff -u -r1.304 -r1.304.2.1 src/sys/dev/ic/com.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/com.c
diff -u src/sys/dev/ic/com.c:1.304 src/sys/dev/ic/com.c:1.304.2.1
--- src/sys/dev/ic/com.c:1.304	Thu Feb  2 19:43:02 2012
+++ src/sys/dev/ic/com.c	Sun Apr 22 17:01:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.304 2012/02/02 19:43:02 tls Exp $ */
+/* $NetBSD: com.c,v 1.304.2.1 2012/04/22 17:01:44 riz Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.304 2012/02/02 19:43:02 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.304.2.1 2012/04/22 17:01:44 riz Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -76,9 +76,6 @@ __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.30
 #include "opt_ntp.h"
 
 #include "rnd.h"
-#ifdef RND_COM
-#include 
-#endif
 
 /* The COM16650 option was renamed to COM_16650. */
 #ifdef COM16650
@@ -115,6 +112,10 @@ __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.30
 #include 
 #include 
 #include 
+#ifdef RND_COM
+#include 
+#endif
+
 
 #include 
 



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

2012-03-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar 22 22:58:24 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: mfi.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #136):
sys/dev/ic/mfi.c: revision 1.37
>From OpenBSD. Fixes a deadlock during autoconf.
scrub more fields in the ccb when returning them to the free list after
theyve been used, in particular the mfi header flags which has a bit
that specifies if a command should be completed via the interrupt path.
if we use a ccb during boot we set that bit, but it isnt necessarily
cleared by things that use it later on. this means a ccb we expected to
complete via an interrupt never actually generates an interrupt or appears
in the reply queue. this obviously stalls the io.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.8.1 src/sys/dev/ic/mfi.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/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.36 src/sys/dev/ic/mfi.c:1.36.8.1
--- src/sys/dev/ic/mfi.c:1.36	Mon Jun 20 22:02:55 2011
+++ src/sys/dev/ic/mfi.c	Thu Mar 22 22:58:23 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.36 2011/06/20 22:02:55 pgoyette Exp $ */
+/* $NetBSD: mfi.c,v 1.36.8.1 2012/03/22 22:58:23 riz Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.36 2011/06/20 22:02:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.36.8.1 2012/03/22 22:58:23 riz Exp $");
 
 #include "bio.h"
 
@@ -180,11 +180,13 @@ static void
 mfi_put_ccb(struct mfi_ccb *ccb)
 {
 	struct mfi_softc	*sc = ccb->ccb_sc;
+	struct mfi_frame_header	*hdr = &ccb->ccb_frame->mfr_header;
 	int			s;
 
 	DNPRINTF(MFI_D_CCB, "%s: mfi_put_ccb: %p\n", DEVNAME(sc), ccb);
 
-	s = splbio();
+	hdr->mfh_cmd_status = 0x0;
+	hdr->mfh_flags = 0x0;
 	ccb->ccb_state = MFI_CCB_FREE;
 	ccb->ccb_xs = NULL;
 	ccb->ccb_flags = 0;
@@ -195,6 +197,8 @@ mfi_put_ccb(struct mfi_ccb *ccb)
 	ccb->ccb_sgl = NULL;
 	ccb->ccb_data = NULL;
 	ccb->ccb_len = 0;
+
+	s = splbio();
 	TAILQ_INSERT_TAIL(&sc->sc_ccb_freeq, ccb, ccb_link);
 	splx(s);
 }



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

2012-03-05 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Mar  5 20:31:49 UTC 2012

Modified Files:
src/sys/dev/ic [netbsd-6]: rtl8169.c rtl81x9reg.h

Log Message:
Pull up the following revisions(s) (requested by nonaka in ticket #83):
sys/dev/ic/rtl8169.c:   revision 1.135
sys/dev/ic/rtl81x9reg.h:revision 1.43

Add RTL8168E/8111E-VL support.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.134.4.1 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/dev/ic/rtl81x9reg.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/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.134 src/sys/dev/ic/rtl8169.c:1.134.4.1
--- src/sys/dev/ic/rtl8169.c:1.134	Tue Nov 22 18:42:56 2011
+++ src/sys/dev/ic/rtl8169.c	Mon Mar  5 20:31:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.134 2011/11/22 18:42:56 garbled Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.134.4.1 2012/03/05 20:31:49 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.134 2011/11/22 18:42:56 garbled Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.134.4.1 2012/03/05 20:31:49 sborrill Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -606,6 +606,10 @@ re_attach(struct rtk_softc *sc)
 			RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_PHYWAKE_PM |
 			RTKQ_NOJUMBO;
 			break;
+		case RTK_HWREV_8168E_VL:
+			sc->sc_quirk |= RTKQ_DESCV2 | RTKQ_NOEECMD |
+			RTKQ_MACSTAT | RTKQ_CMDSTOP | RTKQ_NOJUMBO;
+			break;
 		case RTK_HWREV_8100E:
 		case RTK_HWREV_8100E_SPIN2:
 		case RTK_HWREV_8101E:

Index: src/sys/dev/ic/rtl81x9reg.h
diff -u src/sys/dev/ic/rtl81x9reg.h:1.42 src/sys/dev/ic/rtl81x9reg.h:1.42.4.1
--- src/sys/dev/ic/rtl81x9reg.h:1.42	Tue Nov 22 18:42:57 2011
+++ src/sys/dev/ic/rtl81x9reg.h	Mon Mar  5 20:31:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl81x9reg.h,v 1.42 2011/11/22 18:42:57 garbled Exp $	*/
+/*	$NetBSD: rtl81x9reg.h,v 1.42.4.1 2012/03/05 20:31:49 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998
@@ -163,6 +163,7 @@
 #define RTK_HWREV_8168D		0x2800
 #define RTK_HWREV_8168DP	0x2880
 #define RTK_HWREV_8168E		0x2C00
+#define RTK_HWREV_8168E_VL	0x2C80
 #define RTK_HWREV_8168_SPIN1	0x3000
 #define RTK_HWREV_8100E		0x3080
 #define RTK_HWREV_8101E		0x3400