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

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

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1474):
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.3.2.1 -r1.3.2.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.3.2.1 src/sys/dev/pci/if_et.c:1.3.2.2
--- src/sys/dev/pci/if_et.c:1.3.2.1	Mon Nov 19 18:41:59 2012
+++ src/sys/dev/pci/if_et.c	Fri Aug 18 15:00:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.3.2.1 2012/11/19 18:41:59 riz Exp $	*/
+/*	$NetBSD: if_et.c,v 1.3.2.2 2017/08/18 15:00:53 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.3.2.1 2012/11/19 18:41:59 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.3.2.2 2017/08/18 15:00:53 snj Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -2048,6 +2048,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-6] src/sys/dev/pci

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

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1473):
sys/dev/pci/if_ipw.c: revision 1.65 via patch
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.53 -r1.53.2.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.53 src/sys/dev/pci/if_ipw.c:1.53.2.1
--- src/sys/dev/pci/if_ipw.c:1.53	Mon Jan 30 19:41:20 2012
+++ src/sys/dev/pci/if_ipw.c	Fri Aug 18 14:58:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.53 2012/01/30 19:41:20 drochner Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.53.2.1 2017/08/18 14:58:15 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.53 2012/01/30 19:41:20 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.53.2.1 2017/08/18 14:58:15 snj Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -590,6 +590,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_dev, "could not allocate rx mbuf cluster\n");
 			error = ENOMEM;
 			goto fail;
@@ -602,6 +603,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		if (error != 0) {
 			aprint_error_dev(>sc_dev, "could not create rxbuf dma map\n");
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			goto fail;
 		}
 
@@ -609,7 +611,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_dev, "could not map rxbuf dma memory\n");
 			goto fail;
 		}



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

2017-07-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jul 23 14:27:24 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1463):
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.30 -r1.30.10.1 src/sys/dev/pci/aceride.c
cvs rdiff -u -r1.12 -r1.12.18.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.30 src/sys/dev/pci/aceride.c:1.30.10.1
--- src/sys/dev/pci/aceride.c:1.30	Mon Apr  4 20:37:56 2011
+++ src/sys/dev/pci/aceride.c	Sun Jul 23 14:27:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aceride.c,v 1.30 2011/04/04 20:37:56 dyoung Exp $	*/
+/*	$NetBSD: aceride.c,v 1.30.10.1 2017/07/23 14:27:24 snj Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.30 2011/04/04 20:37:56 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aceride.c,v 1.30.10.1 2017/07/23 14:27:24 snj Exp $");
 
 #include 
 #include 
@@ -193,8 +193,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.18.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	Sun Jul 23 14:27:24 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.18.1 2017/07/23 14:27:24 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-6] src/sys/dev/pci/ixgbe

2017-03-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Mar 25 17:35:56 UTC 2017

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1439):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.60 via patch
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.2 -r1.2.4.1 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.2 src/sys/dev/pci/ixgbe/ixgbe.c:1.2.4.1
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.2	Sat Nov 19 22:51:24 2011
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Mar 25 17:35:56 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.c,v 1.51 2011/04/25 23:34:21 jfv Exp $*/
-/*$NetBSD: ixgbe.c,v 1.2 2011/11/19 22:51:24 tls Exp $*/
+/*$NetBSD: ixgbe.c,v 1.2.4.1 2017/03/25 17:35:56 snj Exp $*/
 
 #include "opt_inet.h"
 
@@ -475,6 +475,10 @@ ixgbe_attach(device_t parent, device_t d
 	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;
 
 	ent = ixgbe_lookup(pa);
 



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

2016-09-24 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep 24 13:14:57 UTC 2016

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

Log Message:
Apply patch, requested by martin in ticket #1407:
sys/dev/pci/if_wm.c patch
fix evbppc build, where the older gcc wrongly warns about uninitialized
variable.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.19 -r1.227.2.20 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.227.2.19 src/sys/dev/pci/if_wm.c:1.227.2.20
--- src/sys/dev/pci/if_wm.c:1.227.2.19	Fri May  6 18:43:34 2016
+++ src/sys/dev/pci/if_wm.c	Sat Sep 24 13:14:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.19 2016/05/06 18:43:34 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.20 2016/09/24 13:14:57 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.19 2016/05/06 18:43:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227.2.20 2016/09/24 13:14:57 bouyer Exp $");
 
 #include 
 #include 
@@ -6003,7 +6003,7 @@ wm_nvm_version_invm(struct wm_softc *sc)
 static void
 wm_nvm_version(struct wm_softc *sc)
 {
-	uint16_t major, minor, build, patch;
+	uint16_t major, minor, patch, build = 0; /* XXX old gcc */
 	uint16_t uid0, uid1;
 	uint16_t nvm_data;
 	uint16_t off;



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

2016-09-24 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep 24 12:56:16 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1401):
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.2.8.2 -r1.2.8.3 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.2.8.2 src/sys/dev/pci/if_vioif.c:1.2.8.3
--- src/sys/dev/pci/if_vioif.c:1.2.8.2	Thu Aug  7 09:31:09 2014
+++ src/sys/dev/pci/if_vioif.c	Sat Sep 24 12:56:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.2.8.2 2014/08/07 09:31:09 msaitoh Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.2.8.3 2016/09/24 12:56:16 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.2.8.2 2014/08/07 09:31:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.2.8.3 2016/09/24 12:56:16 bouyer Exp $");
 
 #include 
 #include 
@@ -378,7 +378,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-6] src/sys/dev/pci

2015-11-15 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Nov 15 20:27:35 UTC 2015

Modified Files:
src/sys/dev/pci [netbsd-6]: if_iwn.c if_iwnvar.h

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #1330):
sys/dev/pci/if_iwnvar.h: revision 1.17
sys/dev/pci/if_iwn.c: revision 1.76
PR/50187: Don't use DS parameter set when 5GHz channel is scanning.
XXX: pullup-7


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.62.2.1 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.13 -r1.13.10.1 src/sys/dev/pci/if_iwnvar.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_iwn.c
diff -u src/sys/dev/pci/if_iwn.c:1.62 src/sys/dev/pci/if_iwn.c:1.62.2.1
--- src/sys/dev/pci/if_iwn.c:1.62	Mon Jan 30 19:41:20 2012
+++ src/sys/dev/pci/if_iwn.c	Sun Nov 15 20:27:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.62 2012/01/30 19:41:20 drochner Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.62.2.1 2015/11/15 20:27:34 bouyer Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.96 2010/05/13 09:25:03 damien Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.62 2012/01/30 19:41:20 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.62.2.1 2015/11/15 20:27:34 bouyer Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -301,7 +301,8 @@ static u_int8_t	*ieee80211_add_rates(u_i
 static u_int8_t	*ieee80211_add_xrates(u_int8_t *,
 const struct ieee80211_rateset *);
 
-static void	iwn_fix_channel(struct ieee80211com *, struct mbuf *);
+static void	iwn_fix_channel(struct ieee80211com *, struct mbuf *,
+		struct iwn_rx_stat *);
 
 #ifdef IWN_DEBUG
 #define DPRINTF(x)	do { if (iwn_debug > 0) printf x; } while (0)
@@ -1782,7 +1783,7 @@ iwn_newstate(struct ieee80211com *ic, en
 		/* XXX Not sure if call and flags are needed. */
 		ieee80211_node_table_reset(>ic_scan);
 		ic->ic_flags |= IEEE80211_F_SCAN | IEEE80211_F_ASCAN;
-		sc->sc_flags |= IWN_FLAG_SCANNING;
+		sc->sc_flags |= IWN_FLAG_SCANNING_2GHZ;
 
 		/* Make the link LED blink while we're scanning. */
 		iwn_set_led(sc, IWN_LED_LINK, 10, 10);
@@ -2005,7 +2006,7 @@ iwn_rx_done(struct iwn_softc *sc, struct
 
 	/* XXX Added for NetBSD: scans never stop without it */
 	if (ic->ic_state == IEEE80211_S_SCAN)
-		iwn_fix_channel(ic, m);
+		iwn_fix_channel(ic, m, stat);
 
 	if (sc->sc_drvbpf != NULL) {
 		struct iwn_rx_radiotap_header *tap = >sc_rxtap;
@@ -2432,6 +2433,8 @@ iwn_notif_intr(struct iwn_softc *sc)
  * We just finished scanning 2GHz channels,
  * start scanning 5GHz ones.
  */
+sc->sc_flags &= ~IWN_FLAG_SCANNING_2GHZ;
+sc->sc_flags |= IWN_FLAG_SCANNING_5GHZ;
 if (iwn_scan(sc, IEEE80211_CHAN_5GHZ) == 0)
 	break;
 			}
@@ -6078,8 +6081,10 @@ ieee80211_add_xrates(u_int8_t *frm, cons
  * XXX: Duplicated from if_iwi.c
  */
 static void
-iwn_fix_channel(struct ieee80211com *ic, struct mbuf *m)
+iwn_fix_channel(struct ieee80211com *ic, struct mbuf *m,
+struct iwn_rx_stat *stat)
 {
+	struct iwn_softc *sc = ic->ic_ifp->if_softc;
 	struct ieee80211_frame *wh;
 	uint8_t subtype;
 	uint8_t *frm, *efrm;
@@ -6095,6 +6100,13 @@ iwn_fix_channel(struct ieee80211com *ic,
 	subtype != IEEE80211_FC0_SUBTYPE_PROBE_RESP)
 		return;
 
+	if (sc->sc_flags & IWN_FLAG_SCANNING_5GHZ) {
+		int chan = le16toh(stat->chan);
+		if (chan < __arraycount(ic->ic_channels))
+			ic->ic_curchan = >ic_channels[chan];
+		return;
+	}
+
 	frm = (uint8_t *)(wh + 1);
 	efrm = mtod(m, uint8_t *) + m->m_len;
 

Index: src/sys/dev/pci/if_iwnvar.h
diff -u src/sys/dev/pci/if_iwnvar.h:1.13 src/sys/dev/pci/if_iwnvar.h:1.13.10.1
--- src/sys/dev/pci/if_iwnvar.h:1.13	Sun May 15 13:56:20 2011
+++ src/sys/dev/pci/if_iwnvar.h	Sun Nov 15 20:27:34 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwnvar.h,v 1.13 2011/05/15 13:56:20 christos Exp $	*/
+/*	$NetBSD: if_iwnvar.h,v 1.13.10.1 2015/11/15 20:27:34 bouyer Exp $	*/
 /*	$OpenBSD: if_iwnvar.h,v 1.19 2010/05/05 19:47:43 damien Exp $	*/
 
 /*-
@@ -220,8 +220,10 @@ struct iwn_softc {
 #define IWN_FLAG_HAS_11N	(1 << 6)
 #define IWN_FLAG_ENH_SENS	(1 << 7)
 /* Added for NetBSD */
-#define IWN_FLAG_SCANNING	(1 << 8)
-#define IWN_FLAG_HW_INITED	(1 << 9)
+#define IWN_FLAG_HW_INITED	(1 << 8)
+#define IWN_FLAG_SCANNING_2GHZ	(1 << 9)
+#define IWN_FLAG_SCANNING_5GHZ	(1 << 10)
+#define IWN_FLAG_SCANNING	(IWN_FLAG_SCANNING_2GHZ|IWN_FLAG_SCANNING_5GHZ)
 
 	uint8_t 		hw_type;
 



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

2015-04-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 30 19:53:28 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1296):
sys/dev/pci/pcidevs: revision 1.1195 via patch
sys/dev/pci/if_wm.c: revisions 1.290, 1.304 via patch
sys/dev/pci/if_wmvar.h: revision 1.20 via patch
- Set the WM_F_ATTACHED flag if wm_attach() finished succesfully and
  check the flag in wm_detach(). It will avoid to panic in wm_detach().
  Fixes PR#49102.
- Support DH89xxCC device.
- Add extra delay for 82580 and newer devices except DH89XXCC SGMII device.
  Same as FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.17 -r1.227.2.18 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.12.10.5 -r1.12.10.6 src/sys/dev/pci/if_wmvar.h
cvs rdiff -u -r1.1102.2.17 -r1.1102.2.18 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.227.2.17 src/sys/dev/pci/if_wm.c:1.227.2.18
--- src/sys/dev/pci/if_wm.c:1.227.2.17	Sun Apr 19 17:01:50 2015
+++ src/sys/dev/pci/if_wm.c	Thu Apr 30 19:53:28 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.17 2015/04/19 17:01:50 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.18 2015/04/30 19:53:28 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.17 2015/04/19 17:01:50 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.18 2015/04/30 19:53:28 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -264,6 +264,7 @@ struct wm_softc {
 	int sc_pcixe_capoff;		/* PCI[Xe] capability register offset */
 
 	const struct wm_product *sc_wmp; /* Pointer to the wm_product entry */
+	uint16_t sc_pcidevid;		/* PCI device ID */
 	wm_chip_type sc_type;		/* MAC type */
 	int sc_rev;			/* MAC revision */
 	wm_phy_type sc_phytype;		/* PHY type */
@@ -854,14 +855,14 @@ static const struct wm_product {
 	  Intel PRO/1000 QT (82571EB),
 	  WM_T_82571,		WMP_F_1000T },
 
-	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82572EI_COPPER,
-	  Intel i82572EI 1000baseT Ethernet,
-	  WM_T_82572,		WMP_F_1000T },
-
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82571GB_QUAD_COPPER,
 	  Intel PRO/1000 PT Quad Port Server Adapter,
 	  WM_T_82571,		WMP_F_1000T, },
 
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82572EI_COPPER,
+	  Intel i82572EI 1000baseT Ethernet,
+	  WM_T_82572,		WMP_F_1000T },
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82572EI_FIBER,
 	  Intel i82572EI 1000baseX Ethernet,
 	  WM_T_82572,		WMP_F_1000X },
@@ -1069,6 +1070,11 @@ static const struct wm_product {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82580_QUAD_FIBER,
 	  82580 quad-1000BaseX Ethernet,
 	  WM_T_82580,		WMP_F_1000X },
+
+	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_DH89XXCC_SGMII,
+	  DH89XXCC Gigabit Ethernet (SGMII),
+	  WM_T_82580,		WMP_F_1000T },
+
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_I350_COPPER,
 	  I350 Gigabit Network Connection,
 	  WM_T_I350,		WMP_F_1000T },
@@ -1338,6 +1344,7 @@ wm_attach(device_t parent, device_t self
 	else
 		sc-sc_dmat = pa-pa_dmat;
 
+	sc-sc_pcidevid = PCI_PRODUCT(pa-pa_id);
 	sc-sc_rev = PCI_REVISION(pci_conf_read(pc, pa-pa_tag, PCI_CLASS_REG));
 	pci_aprint_devinfo_fancy(pa, Ethernet controller, wmp-wmp_name, 1);
 
@@ -1779,7 +1786,7 @@ wm_attach(device_t parent, device_t self
 		sc-sc_flasht, sc-sc_flashh, NULL, NULL)) {
 			aprint_error_dev(sc-sc_dev,
 			can't map FLASH registers\n);
-			return;
+			goto fail_5;
 		}
 		reg = ICH8_FLASH_READ32(sc, ICH_FLASH_GFPREG);
 		sc-sc_ich8_flash_base = (reg  ICH_GFPREG_BASE_MASK) *
@@ -1902,7 +1909,7 @@ wm_attach(device_t parent, device_t self
 		if (wm_read_mac_addr(sc, enaddr) != 0) {
 			aprint_error_dev(sc-sc_dev,
 			unable to read Ethernet address\n);
-			return;
+			goto fail_5;
 		}
 	}
 
@@ -1920,7 +1927,7 @@ wm_attach(device_t parent, device_t self
 	} else {
 		if (wm_nvm_read(sc, NVM_OFF_CFG1, 1, cfg1)) {
 			aprint_error_dev(sc-sc_dev, unable to read CFG1\n);
-			return;
+			goto fail_5;
 		}
 	}
 
@@ -1931,7 +1938,7 @@ wm_attach(device_t parent, device_t self
 	} else {
 		if (wm_nvm_read(sc, NVM_OFF_CFG2, 1, cfg2)) {
 			aprint_error_dev(sc-sc_dev, unable to read CFG2\n);
-			return;
+			goto fail_5;
 		}
 	}
 
@@ -2000,7 +2007,7 @@ wm_attach(device_t parent, device_t self
 			if (wm_nvm_read(sc, NVM_OFF_SWDPIN, 1, swdpin)) {
 aprint_error_dev(sc-sc_dev,
 unable to read SWDPIN\n);
-return;
+goto fail_5;
 			}
 		}
 	}
@@ -2308,6 +2315,7 @@ wm_attach(device_t parent, device_t self
 	else
 		aprint_error_dev(self, couldn't establish power handler\n);
 
+	sc-sc_flags |= WM_F_ATTACHED;
 	return;
 
 	/*
@@ -2346,6 +2354,9 @@ wm_detach(device_t self, int flags __unu
 	struct ifnet *ifp = sc-sc_ethercom.ec_if;
 	int i, s;
 
+	if 

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

2015-04-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 19 17:01:50 UTC 2015

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

Log Message:
Apply patch (requested by msaitoh in ticket #1292):
sys/dev/pci/if_wm.c 1.313-1.314 and 1.316 via patch

Fix a bug that the first access to NVM is failed on 8254[17] which use
SPI EEPROM. Observed on Dell PowerEdge [12]850.
Thanks Tom Ivar Helbekkmo for debugging.

Fix a bug that wm_sgmii_writereg() function doesn't pass the val
argument to the I2CCMD register. Reported by Bernard Merindol
in PR#49789.

Fix a bug that newer revision of I218-{LM,V} use wrong PHY access
functions. The problem only occured on devices that the PCI device ID
was 0x15a[0123].
[msaitoh, ticket #1292]


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.16 -r1.227.2.17 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.227.2.16 src/sys/dev/pci/if_wm.c:1.227.2.17
--- src/sys/dev/pci/if_wm.c:1.227.2.16	Thu Apr 16 06:20:08 2015
+++ src/sys/dev/pci/if_wm.c	Sun Apr 19 17:01:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.16 2015/04/16 06:20:08 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.17 2015/04/19 17:01:50 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.16 2015/04/16 06:20:08 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.17 2015/04/19 17:01:50 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1713,6 +1713,7 @@ wm_attach(device_t parent, device_t self
 	case WM_T_82541_2:
 	case WM_T_82547:
 	case WM_T_82547_2:
+		sc-sc_flags |= WM_F_EEPROM_HANDSHAKE;
 		reg = CSR_READ(sc, WMREG_EECD);
 		if (reg  EECD_EE_TYPE) {
 			/* SPI */
@@ -1728,7 +1729,6 @@ wm_attach(device_t parent, device_t self
 sc-sc_nvm_addrbits = 6;
 			}
 		}
-		sc-sc_flags |= WM_F_EEPROM_HANDSHAKE;
 		break;
 	case WM_T_82571:
 	case WM_T_82572:
@@ -6842,8 +6842,9 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 	 *  For some devices, we can determine the PHY access method
 	 * from sc_type.
 	 *
-	 *  For ICH8 variants, it's difficult to determine the PHY access
-	 * method by sc_type, so use the PCI product ID for some devices.
+	 *  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.
 	 * For other ICH8 variants, try to use igp's method. If the PHY
 	 * can't detect, then use bm's method.
 	 */
@@ -6852,30 +6853,16 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 	case PCI_PRODUCT_INTEL_PCH_M_LC:
 		/* 82577 */
 		sc-sc_phytype = WMPHY_82577;
-		mii-mii_readreg = wm_gmii_hv_readreg;
-		mii-mii_writereg = wm_gmii_hv_writereg;
 		break;
 	case PCI_PRODUCT_INTEL_PCH_D_DM:
 	case PCI_PRODUCT_INTEL_PCH_D_DC:
 		/* 82578 */
 		sc-sc_phytype = WMPHY_82578;
-		mii-mii_readreg = wm_gmii_hv_readreg;
-		mii-mii_writereg = wm_gmii_hv_writereg;
 		break;
 	case PCI_PRODUCT_INTEL_PCH2_LV_LM:
 	case PCI_PRODUCT_INTEL_PCH2_LV_V:
 		/* 82579 */
 		sc-sc_phytype = WMPHY_82579;
-		mii-mii_readreg = wm_gmii_hv_readreg;
-		mii-mii_writereg = wm_gmii_hv_writereg;
-		break;
-	case PCI_PRODUCT_INTEL_I217_LM:
-	case PCI_PRODUCT_INTEL_I217_V:
-	case PCI_PRODUCT_INTEL_I218_LM:
-	case PCI_PRODUCT_INTEL_I218_V:
-		/* I21[78] */
-		mii-mii_readreg = wm_gmii_hv_readreg;
-		mii-mii_writereg = wm_gmii_hv_writereg;
 		break;
 	case PCI_PRODUCT_INTEL_82801I_BM:
 	case PCI_PRODUCT_INTEL_82801J_R_BM_LM:
@@ -6912,6 +6899,11 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 		}
 		break;
 	}
+	if ((sc-sc_type = WM_T_PCH)  (sc-sc_type = WM_T_PCH_LPT)) {
+		/* All PCH* use _hv_ */
+		mii-mii_readreg = wm_gmii_hv_readreg;
+		mii-mii_writereg = wm_gmii_hv_writereg;
+	}
 	mii-mii_statchg = wm_gmii_statchg;
 
 	wm_gmii_reset(sc);
@@ -7644,16 +7636,18 @@ wm_sgmii_writereg(device_t self, int phy
 	struct wm_softc *sc = device_private(self);
 	uint32_t i2ccmd;
 	int i;
+	int val_swapped;
 
 	if (wm_get_swfw_semaphore(sc, swfwphysem[sc-sc_funcid])) {
 		aprint_error_dev(sc-sc_dev, %s: failed to get semaphore\n,
 		__func__);
 		return;
 	}
-
+	/* Swap the data bytes for the I2C interface */
+	val_swapped = ((val  8)  0x00FF) | ((val  8)  0xFF00);
 	i2ccmd = (reg  I2CCMD_REG_ADDR_SHIFT)
 	| (phy  I2CCMD_PHY_ADDR_SHIFT)
-	| I2CCMD_OPCODE_WRITE;
+	| I2CCMD_OPCODE_WRITE | val_swapped;
 	CSR_WRITE(sc, WMREG_I2CCMD, i2ccmd);
 
 	/* Poll the ready bit */



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

2015-04-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 19 17:06:27 UTC 2015

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

Log Message:
sys/dev/pci/pcidevs 1.1208-1.1220 via patch
sys/dev/pci/pcidevs.h   regen
sys/dev/pci/pcidevs_data.h  regen

- Add Intel QuickAssist Virtual Function Device IDs
- Add some Intel 10/40G devices.
- Add Some Intel E7520 devices
- Add Some Intel IOP332 devices
- Add Xeon E5 v3 and C61x devices.
- Add Mobile 5th Generation Intel Core devices.
- Add Intel 63xxESB AC'97 Audio Controller
- Fix product ID of INTEL 5000_PCIE_4.
- Add some Intel devices.
- Sort VIATECH's entries in the device ID's order.
- Add some VIATECH devices.
- Add COMPAQ iLOs.
- Add HP IPMI device.
- Add another HP vendor ID (was 3PAR)
- Add AR816x/AR817x chips (part of PR/49584)
- Add two PLX PCI Bridges.
- Add Radeon HD 54xx Audio
- Add Dell DARC 4 devices
- Add nForce Host Bridges.
- Add MegaRAID SAS3108
[msaitoh, ticket #1293]


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.16 -r1.1102.2.17 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.1102.2.16 src/sys/dev/pci/pcidevs:1.1102.2.17
--- src/sys/dev/pci/pcidevs:1.1102.2.16	Sun Dec  7 16:36:46 2014
+++ src/sys/dev/pci/pcidevs	Sun Apr 19 17:06:27 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.16 2014/12/07 16:36:46 martin Exp $
+$NetBSD: pcidevs,v 1.1102.2.17 2015/04/19 17:06:27 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -585,6 +585,7 @@ vendor ENE		0x1524	ENE Technology
 vendor TERRATEC		0x153b	TerraTec Electronic
 vendor PERLE		0x155f	Perle Systems
 vendor SOLIDUM		0x1588	Solidum Systems
+vendor HP2		0x1590	Hewlett-Packard
 vendor SYBA		0x1592	Syba
 vendor FARADAY		0x159b	Faraday Technology
 vendor GEOCAST		0x15a1	Geocast Network Systems
@@ -1164,6 +1165,7 @@ product ATTANSIC AR8171		0x10a1	AR8171
 product ATTANSIC ETHERNET_100	0x2048	L2 100 Mbit Ethernet Adapter
 product ATTANSIC AR8152_B	0x2060	AR8152 v1.1 Fast Ethernet Adapter
 product ATTANSIC AR8152_B2	0x2062	AR8152 v2.0 Fast Ethernet Adapter
+product ATTANSIC E2200		0xe091	E2200
 
 /* ATI products */
 /* See http://www.x.org/wiki/Radeon%20ASICs */
@@ -1477,6 +1479,7 @@ product ATI RADEON_HD6320	0x9806	Radeon 
 product ATI RADEON_HD7340	0x9808	Radeon HD7340 Graphics
 product ATI RADEON_HD2600_HD	0xaa08	Radeon HD2600 HD Audio Controller
 product ATI RADEON_HD5600_HDMI	0xaa60	Redwood HDMI Audio
+product ATI RADEON_HD54XX_HDA	0xaa68	Radeon HD 54xx Audio
 
 /* Auravision products */
 product AURAVISION VXP524	0x01f7	VxP524 PCI Video Processor
@@ -1844,6 +1847,8 @@ product COMPAQ CSA5300_2	0xb060	Smart Ar
 product COMPAQ PRESARIO56XX	0xb0b8	Presario 56xx
 product COMPAQ M700		0xb112	Armada M700
 product COMPAQ CSA5i_2		0xb178	Smart Array 5i/532 rev. 2
+product COMPAQ ILO_1		0xb203	iLO
+product COMPAQ ILO_2		0xb204	iLO
 product COMPAQ NF3P_BNC		0xf150	NetFlex 3/P w/ BNC
 product COMPAQ NF3P		0xf130	NetFlex 3/P
 
@@ -1974,7 +1979,10 @@ product DELL PERC_3DI_2		0x0008	PERC 3/D
 product DELL PERC_3DI_3		0x000a	PERC 3/Di
 product DELL PERC_4DI		0x000e	PERC 4/Di
 product DELL PERC_4DI_2		0x000f	PERC 4/Di
+product DELL DRAC_4		0x0011	DRAC 4
+product DELL DRAC_4_VUART	0x0012	DRAC 4 Virtual UART
 product DELL PERC_4ESI		0x0013	PERC 4e/Si
+product DELL DRAC_4_SMIC	0x0014	DRAC 4 SMIC
 product DELL PERC_5		0x0015	PERC 5
 product DELL PERC_6 		0x0060	PERC 6
 product DELL PERC_3DI_2_SUB	0x00cf	PERC 3/Di
@@ -2339,6 +2347,7 @@ product HP HPSA_11		0x323a	Smart Array
 product HP HPSA_12		0x323b	Smart Array
 product HP HPSA_13		0x323c	Smart Array
 product HP USB			0x3300	iLO3 Virtual USB
+product HP IPMI			0x3302	IPMI
 product HP ILO3_SLAVE		0x3306	iLO3 Slave
 product HP ILO3_MGMT		0x3307	iLO3 Management
 
@@ -2498,11 +2507,15 @@ product INTEL IOP333_A		0x0370	IOP333 PC
 product INTEL IOP333_B		0x0372	IOP333 PCI Express-to-PCI Bridge #1
 product INTEL 6700PXH_PCIE0	0x0329	6700PXH PCI Express-to-PCI Bridge #0
 product INTEL 6700PXH_PCIE1	0x032a	6700PXH PCI Express-to-PCI Bridge #1
+product INTEL IOP332_A		0x0330	IOP332 PCI Express-to-PCI Bridge #0
+product INTEL IOP332_B		0x0332	IOP332 PCI Express-to-PCI Bridge #1
 product INTEL SRCZCRX		0x0407	RAID Controller
 product INTEL SRCU42E		0x0408	SCSI RAID Controller
 product INTEL SRCS28X		0x0409	SATA RAID Controller
 product INTEL HASWELL_IGD	0x0402	Haswell Integrated Graphics Device
 product INTEL HASWELL_IGD_1	0x0412	Haswell Integrated Graphics Device
+product INTEL DH89XXCC_IQIA_VF	0x0442	DH89XXCC QuickAssist Virtual Function
+product INTEL DH89XXCL_IQIA_VF	0x0443	DH89XXCL QuickAssist Virtual Function
 

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

2015-04-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Apr 16 06:20:08 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1277):
sys/dev/pci/if_wm.c: revision 1.312 via patch
sys/dev/pci/if_wmreg.h: revision 1.66 via patch
- Initialize some hardware bits for 8257[1234], 82583, 80003, ICH* and PCH*.
  Some of them are workaround code. From other *BSDs, Linux and documents.
- Add comment.
- Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.15 -r1.227.2.16 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.46.2.7 -r1.46.2.8 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.227.2.15 src/sys/dev/pci/if_wm.c:1.227.2.16
--- src/sys/dev/pci/if_wm.c:1.227.2.15	Wed Feb  4 10:55:00 2015
+++ src/sys/dev/pci/if_wm.c	Thu Apr 16 06:20:08 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.15 2015/02/04 10:55:00 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.16 2015/04/16 06:20:08 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.15 2015/02/04 10:55:00 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.16 2015/04/16 06:20:08 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -530,6 +530,7 @@ static void	wm_set_pcie_completion_timeo
 static void	wm_get_auto_rd_done(struct wm_softc *);
 static void	wm_lan_init_done(struct wm_softc *);
 static void	wm_get_cfg_done(struct wm_softc *);
+static void	wm_initialize_hardware_bits(struct wm_softc *);
 static void	wm_reset(struct wm_softc *);
 static int	wm_add_rxbuf(struct wm_softc *, int);
 static void	wm_rxdrain(struct wm_softc *);
@@ -4209,6 +4210,200 @@ wm_tick(void *arg)
 	callout_reset(sc-sc_tick_ch, hz, wm_tick, sc);
 }
 
+/* Init hardware bits */
+void
+wm_initialize_hardware_bits(struct wm_softc *sc)
+{
+	uint32_t tarc0, tarc1, reg;
+	
+	/* For 82571 variant, 80003 and ICHs */
+	if (((sc-sc_type = WM_T_82571)  (sc-sc_type = WM_T_82583))
+	|| (sc-sc_type = WM_T_80003)) {
+
+		/* Transmit Descriptor Control 0 */
+		reg = CSR_READ(sc, WMREG_TXDCTL(0));
+		reg |= TXDCTL_COUNT_DESC;
+		CSR_WRITE(sc, WMREG_TXDCTL(0), reg);
+
+		/* Transmit Descriptor Control 1 */
+		reg = CSR_READ(sc, WMREG_TXDCTL(1));
+		reg |= TXDCTL_COUNT_DESC;
+		CSR_WRITE(sc, WMREG_TXDCTL(1), reg);
+
+		/* TARC0 */
+		tarc0 = CSR_READ(sc, WMREG_TARC0);
+		switch (sc-sc_type) {
+		case WM_T_82571:
+		case WM_T_82572:
+		case WM_T_82573:
+		case WM_T_82574:
+		case WM_T_82583:
+		case WM_T_80003:
+			/* Clear bits 30..27 */
+			tarc0 = ~__BITS(30, 27);
+			break;
+		default:
+			break;
+		}
+
+		switch (sc-sc_type) {
+		case WM_T_82571:
+		case WM_T_82572:
+			tarc0 |= __BITS(26, 23); /* TARC0 bits 23-26 */
+
+			tarc1 = CSR_READ(sc, WMREG_TARC1);
+			tarc1 = ~__BITS(30, 29); /* Clear bits 30 and 29 */
+			tarc1 |= __BITS(26, 24); /* TARC1 bits 26-24 */
+			/* 8257[12] Errata No.7 */
+			tarc1 |= __BIT(22); /* TARC1 bits 22 */
+
+			/* TARC1 bit 28 */
+			if ((CSR_READ(sc, WMREG_TCTL)  TCTL_MULR) != 0)
+tarc1 = ~__BIT(28);
+			else
+tarc1 |= __BIT(28);
+			CSR_WRITE(sc, WMREG_TARC1, tarc1);
+
+			/*
+			 * 8257[12] Errata No.13
+			 * Disable Dyamic Clock Gating.
+			 */
+			reg = CSR_READ(sc, WMREG_CTRL_EXT);
+			reg = ~CTRL_EXT_DMA_DYN_CLK;
+			CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
+			break;
+		case WM_T_82573:
+		case WM_T_82574:
+		case WM_T_82583:
+			if ((sc-sc_type == WM_T_82574)
+			|| (sc-sc_type == WM_T_82583))
+tarc0 |= __BIT(26); /* TARC0 bit 26 */
+
+			/* Extended Device Control */
+			reg = CSR_READ(sc, WMREG_CTRL_EXT);
+			reg = ~__BIT(23);	/* Clear bit 23 */
+			reg |= __BIT(22);	/* Set bit 22 */
+			CSR_WRITE(sc, WMREG_CTRL_EXT, reg);
+
+			/* Device Control */
+			sc-sc_ctrl = ~__BIT(29);	/* Clear bit 29 */
+			CSR_WRITE(sc, WMREG_CTRL, sc-sc_ctrl);
+
+			/* PCIe Control Register */
+			if ((sc-sc_type == WM_T_82574)
+			|| (sc-sc_type == WM_T_82583)) {
+/*
+ * Document says this bit must be set for
+ * proper operation.
+ */
+reg = CSR_READ(sc, WMREG_GCR);
+reg |= __BIT(22);
+CSR_WRITE(sc, WMREG_GCR, reg);
+
+/*
+ * Apply workaround for hardware errata
+ * documented in errata docs Fixes issue where
+ * some error prone or unreliable PCIe
+ * completions are occurring, particularly
+ * with ASPM enabled. Without fix, issue can
+ * cause Tx timeouts.
+ */
+reg = CSR_READ(sc, WMREG_GCR2);
+reg |= __BIT(0);
+CSR_WRITE(sc, WMREG_GCR2, reg);
+			}
+			break;
+		case WM_T_80003:
+			/* TARC0 */
+			if ((sc-sc_wmp-wmp_flags == WMP_F_1000X)
+			|| (sc-sc_wmp-wmp_flags == WMP_F_SERDES))
+tarc0 = ~__BIT(20); /* Clear bits 20 */
+
+			/* 

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

2015-02-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Feb 16 08:32:33 UTC 2015

Modified Files:
src/sys/dev/pci [netbsd-6]: if_bge.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1256):
sys/dev/pci/if_bge.c: revision 1.278
Fix three bugs reported by enami@:
  - bge_miibus_writereg(): Fix a bug that BCM5906 may leave an APE lock.
  - Fix hwcfg4 isn't printed correctly.
  - Fix a bug that BGE_PHY_TEST_CTRL_REG isn't set correctly on some PCIe 
devices.


To generate a diff of this commit:
cvs rdiff -u -r1.200.2.4 -r1.200.2.5 src/sys/dev/pci/if_bge.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.200.2.4 src/sys/dev/pci/if_bge.c:1.200.2.5
--- src/sys/dev/pci/if_bge.c:1.200.2.4	Sun Dec  7 16:39:55 2014
+++ src/sys/dev/pci/if_bge.c	Mon Feb 16 08:32:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.200.2.4 2014/12/07 16:39:55 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.200.2.5 2015/02/16 08:32:33 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.200.2.4 2014/12/07 16:39:55 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.200.2.5 2015/02/16 08:32:33 martin Exp $);
 
 #include vlan.h
 
@@ -1399,13 +1399,13 @@ bge_miibus_writereg(device_t dev, int ph
 	uint32_t autopoll;
 	int i;
 
-	if (bge_ape_lock(sc, sc-bge_phy_ape_lock) != 0)
-		return;
-
 	if (BGE_ASICREV(sc-bge_chipid) == BGE_ASICREV_BCM5906 
 	(reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL))
 		return;
 
+	if (bge_ape_lock(sc, sc-bge_phy_ape_lock) != 0)
+		return;
+
 	/* Reading with autopolling on may trigger PCI errors */
 	autopoll = CSR_READ_4(sc, BGE_MI_MODE);
 	if (autopoll  BGE_MIMODE_AUTOPOLL) {
@@ -3743,7 +3743,7 @@ bge_attach(device_t parent, device_t sel
 			hwcfg2 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_2);
 		if (sc-bge_flags  BGEF_PCIE)
 			hwcfg3 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_3);
-		if (BGE_ASICREV(sc-bge_chipid == BGE_ASICREV_BCM5785))
+		if (BGE_ASICREV(sc-bge_chipid) == BGE_ASICREV_BCM5785)
 			hwcfg4 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_4);
 		if (BGE_IS_5717_PLUS(sc))
 			hwcfg5 = bge_readmem_ind(sc, BGE_SRAM_DATA_CFG_5);
@@ -4171,7 +4171,7 @@ bge_reset(struct bge_softc *sc)
 	 * XXX: from FreeBSD/Linux; no documentation
 	 */
 	if (sc-bge_flags  BGEF_PCIE) {
-		if (BGE_ASICREV(sc-bge_chipid != BGE_ASICREV_BCM5785) 
+		if ((BGE_ASICREV(sc-bge_chipid) != BGE_ASICREV_BCM5785) 
 		!BGE_IS_57765_PLUS(sc) 
 		(CSR_READ_4(sc, BGE_PHY_TEST_CTRL_REG) ==
 			(BGE_PHY_PCIE_LTASS_MODE | BGE_PHY_PCIE_SCRAM_MODE))) {



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

2015-02-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb  4 10:55:00 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1244):
sys/dev/pci/if_wm.c: revision 1.310
  Fix a bug that a workaround for SWSM.SMBI bit doesn't work correctly.
This problem was only occured with old boot ROM on 8257[12].
XXX pullup to netbsd-[67]


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.14 -r1.227.2.15 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.227.2.14 src/sys/dev/pci/if_wm.c:1.227.2.15
--- src/sys/dev/pci/if_wm.c:1.227.2.14	Thu Dec  4 06:04:07 2014
+++ src/sys/dev/pci/if_wm.c	Wed Feb  4 10:55:00 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.14 2014/12/04 06:04:07 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.15 2015/02/04 10:55:00 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.14 2014/12/04 06:04:07 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.15 2015/02/04 10:55:00 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1805,7 +1805,7 @@ wm_attach(device_t parent, device_t self
 	case WM_T_82571:
 	case WM_T_82572:
 		reg = CSR_READ(sc, WMREG_SWSM2);
-		if ((reg  SWSM2_LOCK) != 0) {
+		if ((reg  SWSM2_LOCK) == 0) {
 			CSR_WRITE(sc, WMREG_SWSM2, reg | SWSM2_LOCK);
 			force_clear_smbi = true;
 		} else



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

2014-12-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec  7 16:36:46 UTC 2014

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

Log Message:
Pull up the following, requested by msaitoh in #1207:
sys/dev/pci/pcidevs 1.1148-1.1149 via patch


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.15 -r1.1102.2.16 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.1102.2.15 src/sys/dev/pci/pcidevs:1.1102.2.16
--- src/sys/dev/pci/pcidevs:1.1102.2.15	Thu Dec  4 05:54:03 2014
+++ src/sys/dev/pci/pcidevs	Sun Dec  7 16:36:46 2014
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.15 2014/12/04 05:54:03 snj Exp $
+$NetBSD: pcidevs,v 1.1102.2.16 2014/12/07 16:36:46 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1587,18 +1587,23 @@ product BROADCOM BCM5704S_ALT	0x1649	BCM
 product BROADCOM BCM5706	0x164a	BCM5706 NetXtreme II 1000baseT Ethernet
 product BROADCOM BCM5708	0x164c	BCM5708 NetXtreme II 1000baseT Ethernet
 product BROADCOM BCM5702FE	0x164d	BCM5702FE 10/100 Ethernet
+product BROADCOM BCM57710	0x164e	BCM57710 NetXtreme II 10Gb Ethernet
+product BROADCOM BCM57711	0x164f	BCM57711 NetXtreme II 10Gb Ethernet
+product BROADCOM BCM57711E	0x1650	BCM57711E NetXtreme II 10Gb Ethernet
 product BROADCOM BCM5705	0x1653	BCM5705 10/100/1000 Ethernet
 product BROADCOM BCM5705K	0x1654	BCM5705K 10/100/1000 Ethernet
 product BROADCOM BCM5717	0x1655	BCM5717 10/100/1000 Ethernet
 product BROADCOM BCM5718	0x1656	BCM5718 10/100/1000 Ethernet
 product BROADCOM BCM5719	0x1657	BCM5719 NetXtreme 1000baseT Ethernet
-product BROADCOM BCM5720	0x1658	BCM5720 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5721	0x1659	BCM5721 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5722	0x165a	BCM5722 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5723	0x165b	BCM5723 NetXtreme 1000baseT Ethernet
 product BROADCOM BCM5724	0x165c	BCM5724 10/100/1000 Ethernet
 product BROADCOM BCM5705M	0x165d	BCM5705M 10/100/1000 Ethernet
 product BROADCOM BCM5705M_ALT	0x165e	BCM5705M 10/100/1000 Ethernet
+product BROADCOM BCM5720	0x165f	BCM5720 NetXtreme 1000baseT Ethernet
+product BROADCOM BCM57712	0x1662	BCM57712 NetXtreme II 10Gb Ethernet
+product BROADCOM BCM57712E	0x1663	BCM57712E NetXtreme II 10Gb Ethernet
 product BROADCOM BCM5714	0x1668	BCM5714 1000baseT Ethernet
 product BROADCOM BCM5714S	0x1669	BCM5714S 1000baseSX Ethernet
 product BROADCOM BCM5780	0x166a	BCM5780 NetXtreme 1000baseT Ethernet



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

2014-12-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  4 05:54:04 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1202):
sys/dev/pci/pcidevs: revisions 1.1160-1.1161, 1.1163-1.1171,
   1.1173-1.1177, 1.1183-1.1194,
   1.1196, 1.1198-1.1205 via patch
Add some PCI devices to pcidevs:
- PR/48180: Christian Groessler: Add Oxford Semi OXuPCI952 dual serial
  PCI card.
- Add DIGI Neo 8-port serial(PCIe) and OXFORD OXPCIe952 Parallel.
- Add some Intel devices mainly taken from Mobile 4th Generation Intel Core
  Processor Family I/O datasheet.
- Add some Intel Core internal devices.
- Add Intel Quark X1000 devices.
- Add devices of Intel Atom S1200 series from the datasheet.
- Add some Intel E600 and EG20T devices.
- Add some Intel X38 devices.
- Add some Intel devices (Sandy Bridge, 6702PXH, X38 and Pineview)
- Add some Intel Ivy Bridge devices.
- Add Intel 3200 Host and PCIe.
- Add Intel EP80579 devices from OpenBSD.
- Add Intel Bay Trail devices.
- Add Intel Atom Z36xx and Z37xx devices.
- Add Intel Xeon E3-1200 v3 Host Bridge, DRAM.
- Add Intel DH89xx's SMBus controller.
- Add Intel Z68 LPC.
- Add yet another Intel 82599 device.
- Add Intel X540-AT2.
- Add some Intel gigabit Ethernet devices.
- PR/48150: Noriyuki Koizumi: Add Intel Centrino Advanced-N 6235 Wi-Fi
  controller.
- Add some Intel Wi-Fi devices.
- Add entries for Atheros AR9462 and a new flavour of Intel Haswell
  Integrated Graphics Device.
- Add Radeon HD6320 Graphics.
- Add ASMedia ASM1042 xHCI USB3 controller.
- Add Realtek RTL8402 PCI-E Card Reader.
- Add some Realtek devices.
- Add DIGI Neo 8-port serial(PCIe) and OXFORD OXPCIe952 Parallel.
- Add ASPEED Graphics family.
- Add ASPEED AST1150 PCIe-to-PCI bridge.
- Add GeForce 210 High Definition Audio Controller.
- Add GeForce GT 640M.
- Add some Armada 370 IDs.
- Add some new Attansic ethernet devices.
- Add ITE IT8213.
- Add some HP iLO devices.
- Add Matrox MGA G200eH.
- Add Samsung Electronics XP941 M.2 SSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.14 -r1.1102.2.15 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.1102.2.14 src/sys/dev/pci/pcidevs:1.1102.2.15
--- src/sys/dev/pci/pcidevs:1.1102.2.14	Sun Nov  9 12:03:18 2014
+++ src/sys/dev/pci/pcidevs	Thu Dec  4 05:54:03 2014
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.14 2014/11/09 12:03:18 martin Exp $
+$NetBSD: pcidevs,v 1.1102.2.15 2014/12/04 05:54:03 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -625,6 +625,7 @@ vendor RENESAS		0x1912	Renesas Technolog
 vendor FREESCALE	0x1957	Freescale Semiconductor
 vendor ATTANSIC		0x1969	Attansic Technologies
 vendor JMICRON		0x197b	JMicron Technology
+vendor ASPEED		0x1a03	ASPEED Technology
 vendor EVE		0x1adb	EVE
 vendor QUMRANET		0x1af4	Qumranet
 vendor ASMEDIA		0x1b21  ASMedia
@@ -1144,6 +1145,7 @@ product ASMEDIA ASM1061_01	0x0601	ASM106
 product ASMEDIA ASM1061_02	0x0602	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_11	0x0611	ASM1061 AHCI SATA III Controller
 product ASMEDIA ASM1061_12	0x0612	ASM1061 AHCI SATA III Controller
+product	ASMEDIA	ASM1042		0x1042	ASM1042 xHCI USB 3.0
 
 /* Asustek products */
 product ASUSTEK HFCPCI		0x0675	ISDN
@@ -1155,6 +1157,10 @@ product ATTANSIC AR8132		0x1062	AR8132 F
 product ATTANSIC AR8131		0x1063	AR8131 Gigabit Ethernet Adapter
 product ATTANSIC AR8151		0x1073	AR8151 v1.0 Gigabit Ethernet Adapter
 product ATTANSIC AR8151_V2	0x1083	AR8151 v2.0 Gigabit Ethernet Adapter
+product ATTANSIC AR8162		0x1090	AR8162
+product ATTANSIC AR8161		0x1091	AR8161
+product ATTANSIC AR8172		0x10a0	AR8172
+product ATTANSIC AR8171		0x10a1	AR8171
 product ATTANSIC ETHERNET_100	0x2048	L2 100 Mbit Ethernet Adapter
 product ATTANSIC AR8152_B	0x2060	AR8152 v1.1 Fast Ethernet Adapter
 product ATTANSIC AR8152_B2	0x2062	AR8152 v2.0 Fast Ethernet Adapter
@@ -1467,6 +1473,7 @@ product ATI RADEON_HD6520G	0x9647	Radeon
 product ATI RADEON_HD4200	0x9712	Radeon HD4200 Mobility
 product ATI RADEON_HD4250	0x9715	Radeon HD4250 GPU (RS880)
 product ATI RADEON_HD6310	0x9802	Radeon HD6310 Graphics
+product ATI RADEON_HD6320	0x9806	Radeon HD6320 Graphics
 product ATI RADEON_HD7340	0x9808	Radeon HD7340 Graphics
 product ATI RADEON_HD2600_HD	0xaa08	Radeon HD2600 HD Audio Controller
 product ATI RADEON_HD5600_HDMI	0xaa60	Redwood HDMI Audio
@@ -1486,6 +1493,11 @@ product AMCIRCUITS PCISYNC	0x812f	FZJ/ZE
 product AMCIRCUITS ADDI7800	0x818e	ADDI-DATA APCI-7800 8-port Serial
 product AMCIRCUITS S5920	0x5920	S5920 PCI Target
 
+/* ASPEED Technology products */
+product ASPEED AST1150		0x1150	AST1150 PCIe-to-PCI bridge
+product ASPEED AST1180		0x1180	AST1180
+product ASPEED AST2000		0x2000	

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

2014-12-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Dec  4 06:04:07 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1203):
sys/dev/pci/if_wm.c: revisions 1.271, 1.273-1.274, 1.277-1.278,
   1.280, 1.282, 1.284-1.285, 1.287,
   1.293-1.294, 1.297-1.298,
   1.300-1.301, 1.305-1.307 via patch
sys/dev/pci/if_wmreg.h: revisions 1.57-1.62, 1.64-1.65 via patch
sys/dev/pci/if_wmvar.h: revisions 1.19, 1.21 via patch
- Acquire SW semaphore in wm_get_swsm_semaphore().
- Fix some bugs realted to semaphore. This change fixes a problem which
  was exposed in if_wm.c rev. 1.271. Tested by riastradh@.
  - Clear the SMBI bit in SWSM register before accessing NVM and PHY in
wm_attach(). Same as FreeBSD.
  - Fix a bug that 82573 doesn't put the hardware semaphore. Same as
FreeBSD r256200.
- Call wm_set_pcie_completion_timeout() on I350, I354, I210 and I211, too.
  Same as FreeBSD and OpenBSD.
- Drop PHPM_GO_LINK_D bit in WMREG_PHPM on some chips. From FreeBSD.
- Fix fiber link problem (PR#44776 and PR#30880). Tested with 82543GC, 82544EI,
  82545EM, 82546GB 82571EB and 82572EI fiber cards.
  - Don't use the RXCFG interrupt. It's not required and the interrupt is very
heavy (a lot of interrupts). Same as {Free,Open}BSD.
  - Modify wm_tbi_mediachange() to be close to em_setup_fiber_serdes_link()
of {Free,Open}BSD. At least, don't forget to set duplex setting.
  - WM_T_82545 is not 1000base-SX but 1000base-LX. Same as FreeBSD.
- Don't check SWSM_SMBI bit if WM_F_LOCK_SWSM isn't set. Fix a problem when
  using vmware with e1000e. With e1000e which is regarded as 82574L,
  wm_gmii_init() fails with could not acquire SWSM SMBI message without
  this change. This problem doesn't occur with real 82574L card.
- Fix a bug that wm_get_swsm_semaphore() timed out when attaching device on
  some machines.
  - Calculate NVM word size correctly.
  - Determine timeout value based on the NVM word size.
- It's not required to print failed to detect NVM bank message.
  Only print while debugging. Same as {Free,Open}BSD.
- Add some new I218 devices.
- Delete 82580ER related code. It was from FreeBSD and was removed in r203049.
- Fix a bug that the offset of alt MAC address is wrongly calculated to 0
  when alt MAC address function is really used. This bug does not appear
  as real bug if the same MAC address is written in the default location
  and alt MAC address's location.
- Move some NVM related macros from if_wm.c to if_wmreg.h.
- Sort definitions in if_wmreg.h
  - move NVM related values to the bottom.
  - sort in register's address' order.
- Simplify wm_read_mac_addr().
- Fix debug message.
- Add missing prototypes.
- Rename some functions for consistency and clarify.
- Rename some macros for consistency.
- Remove a duplicated error message.
- Fix typo in comment.
- Cleanup comments.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.13 -r1.227.2.14 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.46.2.6 -r1.46.2.7 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.12.10.4 -r1.12.10.5 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.227.2.13 src/sys/dev/pci/if_wm.c:1.227.2.14
--- src/sys/dev/pci/if_wm.c:1.227.2.13	Sun Nov  9 12:13:15 2014
+++ src/sys/dev/pci/if_wm.c	Thu Dec  4 06:04:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.13 2014/11/09 12:13:15 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.14 2014/12/04 06:04:07 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.13 2014/11/09 12:13:15 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.14 2014/12/04 06:04:07 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -276,7 +276,8 @@ struct wm_softc {
 	void *sc_ih;			/* interrupt cookie */
 	callout_t sc_tick_ch;		/* tick callout */
 
-	int sc_ee_addrbits;		/* EEPROM address bits */
+	int sc_nvm_addrbits;		/* NVM address bits */
+	unsigned int sc_nvm_wordsize;		/* NVM word size */
 	int sc_ich8_flash_base;
 	int sc_ich8_flash_bank_size;
 	int sc_nvm_k1_enabled;
@@ -374,8 +375,6 @@ struct wm_softc {
 	int sc_tbi_linkup;		/* TBI link status */
 	int sc_tbi_anegticks;		/* autonegotiation ticks */
 	int sc_tbi_ticks;		/* tbi ticks */
-	int sc_tbi_nrxcfg;		/* count of ICR_RXCFG */
-	int sc_tbi_lastnrxcfg;		/* count of ICR_RXCFG (on last tick) */
 
 	int sc_mchash_type;		/* multicast filter offset */
 
@@ -494,43 +493,78 @@ do {	\
 	CSR_WRITE((sc), (sc)-sc_rdt_reg, (x));\
 } while (/*CONSTCOND*/0)
 
-static void	wm_start(struct ifnet *);

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

2014-09-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Sep 29 18:33:21 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1123):
sys/dev/pci/ichsmb.c: revision 1.37
Register a null pmf handler even if we failed to attach.
Keeps ichsmb(4) from preventing suspend even if it's broken because
of ichlpcib(4) grodiness.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.2.1 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.27 src/sys/dev/pci/ichsmb.c:1.27.2.1
--- src/sys/dev/pci/ichsmb.c:1.27	Tue Feb 14 15:08:07 2012
+++ src/sys/dev/pci/ichsmb.c	Mon Sep 29 18:33:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ichsmb.c,v 1.27 2012/02/14 15:08:07 pgoyette Exp $	*/
+/*	$NetBSD: ichsmb.c,v 1.27.2.1 2014/09/29 18:33:21 msaitoh Exp $	*/
 /*	$OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ichsmb.c,v 1.27 2012/02/14 15:08:07 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: ichsmb.c,v 1.27.2.1 2014/09/29 18:33:21 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -135,14 +135,14 @@ ichsmb_attach(device_t parent, device_t 
 
 	if ((conf  LPCIB_SMB_HOSTC_HSTEN) == 0) {
 		aprint_error_dev(self, SMBus disabled\n);
-		return;
+		goto out;
 	}
 
 	/* Map I/O space */
 	if (pci_mapreg_map(pa, LPCIB_SMB_BASE, PCI_MAPREG_TYPE_IO, 0,
 	sc-sc_iot, sc-sc_ioh, NULL, iosize)) {
 		aprint_error_dev(self, can't map I/O space\n);
-		return;
+		goto out;
 	}
 
 	sc-sc_poll = 1;
@@ -177,7 +177,7 @@ ichsmb_attach(device_t parent, device_t 
 	iba.iba_tag = sc-sc_i2c_tag;
 	config_found(self, iba, iicbus_print);
 
-	if (!pmf_device_register(self, NULL, NULL))
+out:	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, couldn't establish power handler\n);
 }
 



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

2014-09-13 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Sep 13 17:53:15 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-6]: pci_usrreq.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1124):
sys/dev/pci/pci_usrreq.c: revision 1.26
Reject unaligned PCI config register ioctl requests before we kassert.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.10.1 src/sys/dev/pci/pci_usrreq.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_usrreq.c
diff -u src/sys/dev/pci/pci_usrreq.c:1.23 src/sys/dev/pci/pci_usrreq.c:1.23.10.1
--- src/sys/dev/pci/pci_usrreq.c:1.23	Thu Feb 10 12:37:58 2011
+++ src/sys/dev/pci/pci_usrreq.c	Sat Sep 13 17:53:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_usrreq.c,v 1.23 2011/02/10 12:37:58 jmcneill Exp $	*/
+/*	$NetBSD: pci_usrreq.c,v 1.23.10.1 2014/09/13 17:53:15 snj Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_usrreq.c,v 1.23 2011/02/10 12:37:58 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_usrreq.c,v 1.23.10.1 2014/09/13 17:53:15 snj Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -83,7 +83,7 @@ pciioctl(dev_t dev, u_long cmd, void *da
 	case PCI_IOC_BDF_CFGWRITE:
 		bdfr = data;
 		if (bdfr-bus  255 || bdfr-device = sc-sc_maxndevs ||
-		bdfr-function  7)
+		bdfr-function  7 || ISSET(bdfr-cfgreg.reg, 3))
 			return EINVAL;
 		tag = pci_make_tag(sc-sc_pc, bdfr-bus, bdfr-device,
 		bdfr-function);



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

2014-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Aug  7 08:13:44 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-6]: piixpm.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1096):
sys/dev/pci/piixpm.c: revision 1.45
Consistently pass a struct piixpm_softc to piixpm_intr.
Prevents a crash on hardware interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.40.2.1 -r1.40.2.2 src/sys/dev/pci/piixpm.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/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.40.2.1 src/sys/dev/pci/piixpm.c:1.40.2.2
--- src/sys/dev/pci/piixpm.c:1.40.2.1	Fri Sep 20 03:49:00 2013
+++ src/sys/dev/pci/piixpm.c	Thu Aug  7 08:13:44 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.40.2.1 2013/09/20 03:49:00 riz Exp $ */
+/* $NetBSD: piixpm.c,v 1.40.2.2 2014/08/07 08:13:44 msaitoh Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.20 2006/02/27 08:25:02 grange Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: piixpm.c,v 1.40.2.1 2013/09/20 03:49:00 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: piixpm.c,v 1.40.2.2 2014/08/07 08:13:44 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -500,7 +500,7 @@ piixpm_i2c_exec(void *cookie, i2c_op_t o
 		}
 		if (st  PIIX_SMB_HS_BUSY)
 			goto timeout;
-		piixpm_intr(smbus);
+		piixpm_intr(sc);
 	} else {
 		/* Wait for interrupt */
 		if (tsleep(sc, PRIBIO, iicexec, PIIXPM_TIMEOUT * hz))
@@ -535,8 +535,7 @@ timeout:
 static int
 piixpm_intr(void *arg)
 {
-	struct piixpm_smbus *smbus = arg;
-	struct piixpm_softc *sc = smbus-softc;
+	struct piixpm_softc *sc = arg;
 	u_int8_t st;
 	u_int8_t *b;
 	size_t len;



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

2014-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Aug  7 09:31:09 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #1102):
sys/dev/pci/if_vioif.c: revision 1.5
Don't set SOFTINT_MPSAFE to vioif_rx_softint
vioif_rx_softint calls vioif_populate_rx_mbufs that is not MPSAFE.
vioif_populate_rx_mbufs is also called via vioif_ioctl and so can
be called by two LWPs simultaneously, resulting in kernel panic.
PR kern/49007


To generate a diff of this commit:
cvs rdiff -u -r1.2.8.1 -r1.2.8.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.2.8.1 src/sys/dev/pci/if_vioif.c:1.2.8.2
--- src/sys/dev/pci/if_vioif.c:1.2.8.1	Sun May 12 16:38:06 2013
+++ src/sys/dev/pci/if_vioif.c	Thu Aug  7 09:31:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.2.8.1 2013/05/12 16:38:06 riz Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.2.8.2 2014/08/07 09:31:09 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.2.8.1 2013/05/12 16:38:06 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.2.8.2 2014/08/07 09:31:09 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -557,7 +557,7 @@ vioif_attach(device_t parent, device_t s
 		}
 	}
 
-	sc-sc_rx_softint = softint_establish(SOFTINT_NET|SOFTINT_MPSAFE,
+	sc-sc_rx_softint = softint_establish(SOFTINT_NET,
 	  vioif_rx_softint, sc);
 	if (sc-sc_rx_softint == NULL) {
 		aprint_error_dev(self, cannot establish softint\n);



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

2014-08-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Aug  8 03:47:21 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-6]: agp_i810.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1105):
src/sys/dev/pci/agp_i810.c  1.108-1.110 via patch.
Bind i810 dcache pages at the requested offset, not at VA start.
From John D Baker in PR xsrc/48344.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.10.1 src/sys/dev/pci/agp_i810.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/agp_i810.c
diff -u src/sys/dev/pci/agp_i810.c:1.73 src/sys/dev/pci/agp_i810.c:1.73.10.1
--- src/sys/dev/pci/agp_i810.c:1.73	Mon Apr  4 20:37:56 2011
+++ src/sys/dev/pci/agp_i810.c	Fri Aug  8 03:47:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.73 2011/04/04 20:37:56 dyoung Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.73.10.1 2014/08/08 03:47:21 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.73 2011/04/04 20:37:56 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.73.10.1 2014/08/08 03:47:21 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1028,7 +1028,8 @@ agp_i810_bind_memory(struct agp_softc *s
 		return EINVAL;
 
 	for (i = 0; i  mem-am_size; i += AGP_PAGE_SIZE)
-		agp_i810_write_gtt_entry(isc, i, i | 3);
+		agp_i810_write_gtt_entry(isc, offset + i, i | 3);
+	mem-am_offset = offset;
 	mem-am_is_bound = 1;
 	return 0;
 }
@@ -1057,7 +1058,8 @@ agp_i810_unbind_memory(struct agp_softc 
 		return EINVAL;
 
 	for (i = 0; i  mem-am_size; i += AGP_PAGE_SIZE)
-		agp_i810_write_gtt_entry(isc, i, 0);
+		agp_i810_write_gtt_entry(isc, mem-am_offset + i, 0);
+	mem-am_offset = 0;
 	mem-am_is_bound = 0;
 	return 0;
 }



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

2014-06-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun  3 14:31:13 UTC 2014

Modified Files:
src/sys/dev/pci [netbsd-6]: siside.c

Log Message:
Pull up following revision(s) (requested by abs in ticket #1069):
sys/dev/pci/siside.c: revision 1.35

Add in missing space after 96X UDMA%d. Changes 96X UDMA6746 to
96X UDMA6 746


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.28.10.1 src/sys/dev/pci/siside.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/siside.c
diff -u src/sys/dev/pci/siside.c:1.28 src/sys/dev/pci/siside.c:1.28.10.1
--- src/sys/dev/pci/siside.c:1.28	Tue May 24 16:42:10 2011
+++ src/sys/dev/pci/siside.c	Tue Jun  3 14:31:13 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: siside.c,v 1.28 2011/05/24 16:42:10 joerg Exp $	*/
+/*	$NetBSD: siside.c,v 1.28.10.1 2014/06/03 14:31:13 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: siside.c,v 1.28 2011/05/24 16:42:10 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: siside.c,v 1.28.10.1 2014/06/03 14:31:13 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -241,7 +241,7 @@ sis_chip_map(struct pciide_softc *sc, co
 			SIS_REG_57)  0x7f);
 			if (PCI_PRODUCT(pci_conf_read(sc-sc_pc, sc-sc_tag,
 			PCI_ID_REG)) == SIS_PRODUCT_5518) {
-aprint_normal(96X UDMA%d,
+aprint_normal(96X UDMA%d ,
 sis_hostbr_type_match-udma_mode);
 sc-sis_type = SIS_TYPE_133NEW;
 sc-sc_wdcdev.sc_atac.atac_udma_cap =



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

2014-06-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jun  3 14:57:09 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by tls in ticket #1070):
sys/dev/pci/if_wm.c: revision 1.269
From dyoung@ -- bump max TX DMA size to avoid pathological condition with TSO.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.10 -r1.227.2.11 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.227.2.10 src/sys/dev/pci/if_wm.c:1.227.2.11
--- src/sys/dev/pci/if_wm.c:1.227.2.10	Mon Jul 29 20:24:04 2013
+++ src/sys/dev/pci/if_wm.c	Tue Jun  3 14:57:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.10 2013/07/29 20:24:04 jdc Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.11 2014/06/03 14:57:09 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.10 2013/07/29 20:24:04 jdc Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.11 2014/06/03 14:57:09 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -167,7 +167,7 @@ int	wm_debug = WM_DEBUG_TX | WM_DEBUG_RX
 #define	WM_NEXTTX(sc, x)	(((x) + 1)  WM_NTXDESC_MASK(sc))
 #define	WM_NEXTTXS(sc, x)	(((x) + 1)  WM_TXQUEUELEN_MASK(sc))
 
-#define	WM_MAXTXDMA		round_page(IP_MAXPACKET) /* for TSO */
+#define	WM_MAXTXDMA		 (2 * round_page(IP_MAXPACKET)) /* for TSO */
 
 /*
  * Receive descriptor list size.  We have one Rx buffer for normal



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

2013-09-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Sep 20 03:49:00 UTC 2013

Modified Files:
src/sys/dev/pci [netbsd-6]: piixpm.c piixpmreg.h

Log Message:
Pull up following revision(s) (requested by fair in ticket #936):
sys/dev/pci/piixpmreg.h: revision 1.6
sys/dev/pci/piixpm.c: revision 1.42
The SB800 SMBus controller has four selectable SDA lines.
Expose them as four iic busses.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/pci/piixpm.c
cvs rdiff -u -r1.5 -r1.5.10.1 src/sys/dev/pci/piixpmreg.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/piixpm.c
diff -u src/sys/dev/pci/piixpm.c:1.40 src/sys/dev/pci/piixpm.c:1.40.2.1
--- src/sys/dev/pci/piixpm.c:1.40	Tue Feb 14 15:08:07 2012
+++ src/sys/dev/pci/piixpm.c	Fri Sep 20 03:49:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: piixpm.c,v 1.40 2012/02/14 15:08:07 pgoyette Exp $ */
+/* $NetBSD: piixpm.c,v 1.40.2.1 2013/09/20 03:49:00 riz Exp $ */
 /*	$OpenBSD: piixpm.c,v 1.20 2006/02/27 08:25:02 grange Exp $	*/
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: piixpm.c,v 1.40 2012/02/14 15:08:07 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: piixpm.c,v 1.40.2.1 2013/09/20 03:49:00 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -55,40 +55,37 @@ __KERNEL_RCSID(0, $NetBSD: piixpm.c,v 1
 #define PIIXPM_DELAY	200
 #define PIIXPM_TIMEOUT	1
 
-#define PIIXPM_INDIRECTIO_BASE	0xcd6
-#define PIIXPM_INDIRECTIO_SIZE	2
-#define PIIXPM_INDIRECTIO_INDEX	0
-#define PIIXPM_INDIRECTIO_DATA	1
-
-#define SB800_PM_SMBUS0EN_LO	0x2c
-#define SB800_PM_SMBUS0EN_HI	0x2d
-
-#define SB800_PM_SMBUS0EN_ENABLE	0x0001
-#define SB800_PM_SMBUS0EN_BADDR		0xffe0
+struct piixpm_smbus {
+	int			sda;
+	struct			piixpm_softc *softc;
+};
 
 struct piixpm_softc {
 	device_t		sc_dev;
 
-	bus_space_tag_t		sc_smb_iot;
+	bus_space_tag_t		sc_iot;
+#define	sc_pm_iot sc_iot
+#define sc_smb_iot sc_iot
+	bus_space_handle_t	sc_pm_ioh;
+	bus_space_handle_t	sc_sb800_ioh;
 	bus_space_handle_t	sc_smb_ioh;
 	void *			sc_smb_ih;
 	int			sc_poll;
 
-	bus_space_tag_t		sc_pm_iot;
-	bus_space_handle_t	sc_pm_ioh;
-
 	pci_chipset_tag_t	sc_pc;
 	pcitag_t		sc_pcitag;
 	pcireg_t		sc_id;
 
-	struct i2c_controller	sc_i2c_tag;
+	struct piixpm_smbus	sc_busses[4];
+	struct i2c_controller	sc_i2c_tags[4];
+
 	kmutex_t		sc_i2c_mutex;
 	struct {
-		i2c_op_t op;
-		void *  buf;
-		size_t   len;
-		int  flags;
-		volatile int error;
+		i2c_op_t	op;
+		void *		buf;
+		size_t		len;
+		int		flags;
+		volatile int	error;
 	}			sc_i2c_xfer;
 
 	pcireg_t		sc_devact[2];
@@ -100,8 +97,7 @@ static void	piixpm_attach(device_t, devi
 static bool	piixpm_suspend(device_t, const pmf_qual_t *);
 static bool	piixpm_resume(device_t, const pmf_qual_t *);
 
-static int	piixpm_sb800_init(struct piixpm_softc *,
-struct pci_attach_args *);
+static int	piixpm_sb800_init(struct piixpm_softc *);
 static void	piixpm_csb5_reset(void *);
 static int	piixpm_i2c_acquire_bus(void *, int);
 static void	piixpm_i2c_release_bus(void *, int);
@@ -159,8 +155,10 @@ piixpm_attach(device_t parent, device_t 
 	pcireg_t pmmisc;
 	pci_intr_handle_t ih;
 	const char *intrstr = NULL;
+	int i, numbusses = 1;
 
 	sc-sc_dev = self;
+	sc-sc_iot = pa-pa_iot;
 	sc-sc_id = pa-pa_id;
 	sc-sc_pc = pa-pa_pc;
 	sc-sc_pcitag = pa-pa_tag;
@@ -183,7 +181,6 @@ piixpm_attach(device_t parent, device_t 
 	if (!(pmmisc  1))
 		goto nopowermanagement;
 
-	sc-sc_pm_iot = pa-pa_iot;
 	/* Map I/O space */
 	base = pci_conf_read(pa-pa_pc, pa-pa_tag, PIIX_PM_BASE);
 	if (bus_space_map(sc-sc_pm_iot, PCI_MAPREG_IO_ADDR(base),
@@ -207,8 +204,10 @@ nopowermanagement:
 	if (PCI_VENDOR(pa-pa_id) == PCI_VENDOR_ATI 
 	PCI_PRODUCT(pa-pa_id) == PCI_PRODUCT_ATI_SB600_SMB 
 	PCI_REVISION(pa-pa_class) = 0x40) {
-		if (piixpm_sb800_init(sc, pa) == 0)
+		if (piixpm_sb800_init(sc) == 0) {
+			numbusses = 4;
 			goto attach_i2c;
+		}
 		aprint_normal_dev(self, SMBus disabled\n);
 		return;
 	}
@@ -219,7 +218,6 @@ nopowermanagement:
 	}
 
 	/* Map I/O space */
-	sc-sc_smb_iot = pa-pa_iot;
 	base = pci_conf_read(pa-pa_pc, pa-pa_tag, PIIX_SMB_BASE)  0x;
 	if (bus_space_map(sc-sc_smb_iot, PCI_MAPREG_IO_ADDR(base),
 	PIIX_SMB_SIZE, 0, sc-sc_smb_ioh)) {
@@ -252,17 +250,20 @@ nopowermanagement:
 attach_i2c:
 	/* Attach I2C bus */
 	mutex_init(sc-sc_i2c_mutex, MUTEX_DEFAULT, IPL_NONE);
-	sc-sc_i2c_tag.ic_cookie = sc;
-	sc-sc_i2c_tag.ic_acquire_bus = piixpm_i2c_acquire_bus;
-	sc-sc_i2c_tag.ic_release_bus = piixpm_i2c_release_bus;
-	sc-sc_i2c_tag.ic_exec = piixpm_i2c_exec;
-
-	memset(iba, 0, sizeof(iba));
-	iba.iba_type = I2C_TYPE_SMBUS;
-	iba.iba_tag = sc-sc_i2c_tag;
-	config_found_ia(self, i2cbus, iba, iicbus_print);
 
-	return;
+	for (i = 0; i  numbusses; i++) {
+		sc-sc_busses[i].sda = i;
+		sc-sc_busses[i].softc = sc;
+		sc-sc_i2c_tags[i].ic_cookie = sc-sc_busses[i];
+		

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

2013-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep  7 16:01:03 UTC 2013

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

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #931):
sys/dev/pci/virtio.c: revision 1.4
Make sure to check if the driver has a valid intr handler in virtio_detach().
Fixes a panic during shutdown on KVM under ubuntu 13.04 with virtio,
as reported in PR kern/48105 by Richard Hansen.
Should be pulled up to netbsd-6 branches.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.8.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/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.3 src/sys/dev/pci/virtio.c:1.3.8.1
--- src/sys/dev/pci/virtio.c:1.3	Wed Nov  2 23:05:52 2011
+++ src/sys/dev/pci/virtio.c	Sat Sep  7 16:01:03 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $	*/
+/*	$NetBSD: virtio.c,v 1.3.8.1 2013/09/07 16:01:03 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: virtio.c,v 1.3 2011/11/02 23:05:52 njoly Exp $);
+__KERNEL_RCSID(0, $NetBSD: virtio.c,v 1.3.8.1 2013/09/07 16:01:03 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -199,8 +199,10 @@ virtio_detach(device_t self, int flags)
 	}
 	KASSERT(sc-sc_child == 0 || sc-sc_child == (void*)1);
 	KASSERT(sc-sc_vqs == 0);
-	pci_intr_disestablish(sc-sc_pc, sc-sc_ih);
-	sc-sc_ih = 0;
+	if (sc-sc_ih != NULL) {
+		pci_intr_disestablish(sc-sc_pc, sc-sc_ih);
+		sc-sc_ih = NULL;
+	}
 	if (sc-sc_iosize)
 		bus_space_unmap(sc-sc_iot, sc-sc_ioh, sc-sc_iosize);
 	sc-sc_iosize = 0;



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

2013-09-07 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep  7 16:05:59 UTC 2013

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

Log Message:
Pull up following revision(s) (requested by kardel in ticket #932):
sys/dev/pci/mpii.c: revision 1.2
sys/dev/pci/mpii.c: revision 1.3
Allow 8 luns instead of 1. This enables access to the changer device on
a Dell PV-124T:
ch0 at scsibus0 target 9 lun 1: DELL, PV-124T, 0086 changer removable
ch0: 16 slots, 1 drive, 1 picker, 0 portals
fix issues when reading variable block sized tapes.
symptoms:
 generic HBA error on console when reading
 with a larger blocksize. blocks read
 are padded to requested block size with
 a 5a... a5... pattern.
problems fixed:
 - controller scsi_status values did not match
   the ones used by the spsipi layer.
   a mapping function was introduced.
 - when experiencing an underrun (read 64k and
   get a 63k block) the controller posted
   not a SUCCESS status but CHECK status. handle
   that like SUCCESS adjusting xs-resid and set
   XS_SENSE.
   now the correct data amount is returned and
   nothing is 'added' and no 'generic HBA error'
   occurs.
 - make decisions using variables and constants
   from the controller domain.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 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.1.2.2 src/sys/dev/pci/mpii.c:1.1.2.3
--- src/sys/dev/pci/mpii.c:1.1.2.2	Mon Apr 23 16:31:36 2012
+++ src/sys/dev/pci/mpii.c	Sat Sep  7 16:05:59 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.1.2.2 2012/04/23 16:31:36 riz Exp $ */
+/* $NetBSD: mpii.c,v 1.1.2.3 2013/09/07 16:05:59 bouyer Exp $ */
 /*	OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov m...@crypt.org.ru
@@ -20,7 +20,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mpii.c,v 1.1.2.2 2012/04/23 16:31:36 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: mpii.c,v 1.1.2.3 2013/09/07 16:05:59 bouyer Exp $);
 
 #include bio.h
 
@@ -790,18 +790,18 @@ struct mpii_msg_scsi_io_error {
 	u_int16_t		reserved3;
 
 	u_int8_t		scsi_status;
-	/* XXX JPG validate this */
-#if notyet
-#define MPII_SCSIIO_ERR_STATUS_SUCCESS
-#define MPII_SCSIIO_ERR_STATUS_CHECK_COND
-#define MPII_SCSIIO_ERR_STATUS_BUSY
-#define MPII_SCSIIO_ERR_STATUS_INTERMEDIATE
-#define MPII_SCSIIO_ERR_STATUS_INTERMEDIATE_CONDMET
-#define MPII_SCSIIO_ERR_STATUS_RESERVATION_CONFLICT
-#define MPII_SCSIIO_ERR_STATUS_CMD_TERM
-#define MPII_SCSIIO_ERR_STATUS_TASK_SET_FULL
-#define MPII_SCSIIO_ERR_STATUS_ACA_ACTIVE
-#endif
+
+#define MPII_SCSIIO_ERR_STATUS_SUCCESS			(0x00)
+#define MPII_SCSIIO_ERR_STATUS_CHECK_COND		(0x02)
+#define MPII_SCSIIO_ERR_STATUS_BUSY			(0x04)
+#define MPII_SCSIIO_ERR_STATUS_INTERMEDIATE		(0x08)
+#define MPII_SCSIIO_ERR_STATUS_INTERMEDIATE_CONDMET	(0x10)
+#define MPII_SCSIIO_ERR_STATUS_RESERVATION_CONFLICT	(0x14)
+#define MPII_SCSIIO_ERR_STATUS_CMD_TERM			(0x22)
+#define MPII_SCSIIO_ERR_STATUS_TASK_SET_FULL		(0x28)
+#define MPII_SCSIIO_ERR_STATUS_ACA_ACTIVE		(0x30)
+#define MPII_SCSIIO_ERR_STATUS_TASK_ABORTED		(0x40)
+
 	u_int8_t		scsi_state;
 #define MPII_SCSIIO_ERR_STATE_AUTOSENSE_VALID		(10)
 #define MPII_SCSIIO_ERR_STATE_AUTOSENSE_FAILED		(11)
@@ -2296,7 +2296,7 @@ mpii_attach(device_t parent, device_t se
 	chan-chan_bustype = scsi_sas_bustype;
 	chan-chan_channel = 0;
 	chan-chan_flags = 0;
-	chan-chan_nluns = 1;
+	chan-chan_nluns = 8;
 	chan-chan_ntargets = sc-sc_max_devices;
 	chan-chan_id = -1;
 
@@ -4682,6 +4682,58 @@ mpii_scsi_cmd_tmo_done(struct mpii_ccb *
 mpii_put_ccb(tccb-ccb_sc, tccb);
 }
 
+static u_int8_t
+map_scsi_status(u_int8_t mpii_scsi_status)
+{
+	u_int8_t scsi_status;
+	
+	switch (mpii_scsi_status) 
+	{
+	case MPII_SCSIIO_ERR_STATUS_SUCCESS:
+		scsi_status = SCSI_OK;
+		break;
+		
+	case MPII_SCSIIO_ERR_STATUS_CHECK_COND:
+		scsi_status = SCSI_CHECK;
+		break;
+		
+	case MPII_SCSIIO_ERR_STATUS_BUSY:
+		scsi_status = SCSI_BUSY;
+		break;
+		
+	case MPII_SCSIIO_ERR_STATUS_INTERMEDIATE:
+		scsi_status = SCSI_INTERM;
+		break;
+		
+	case MPII_SCSIIO_ERR_STATUS_INTERMEDIATE_CONDMET:
+		scsi_status = SCSI_INTERM;
+		break;
+		
+	case MPII_SCSIIO_ERR_STATUS_RESERVATION_CONFLICT:
+		scsi_status = SCSI_RESV_CONFLICT;
+		break;
+		
+	case MPII_SCSIIO_ERR_STATUS_CMD_TERM:
+	case MPII_SCSIIO_ERR_STATUS_TASK_ABORTED:
+		scsi_status = SCSI_TERMINATED;
+		break;
+
+	case MPII_SCSIIO_ERR_STATUS_TASK_SET_FULL:
+		scsi_status = SCSI_QUEUE_FULL;
+		break;
+
+	case MPII_SCSIIO_ERR_STATUS_ACA_ACTIVE:
+		scsi_status = SCSI_ACA_ACTIVE;
+		break;
+
+	default:
+		/* XXX: for the lack of anything better and other than OK */
+		scsi_status = 0xFF;
+		break;
+	}
+
+	return scsi_status;
+}

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

2013-07-29 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Mon Jul 29 20:24:04 UTC 2013

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

Log Message:
Pull up revisions:
  src/sys/dev/pci/if_wm.c revisions 1.259,1.260,1.261,1.262
  src/sys/dev/pci/if_wmreg.h revision 1.54
(requested by msaitoh in ticket #918).

 Fix MDIC write error bug for 82574 and 82583. For those chips, the semaphore
must be released after chip reset. Found and tested by Mark Davies.

 Sync the wm_enable_mng_pass_thru() function with FreeBSD. Don't check
MANC_EN_MAC_ADDR_FILTER bit. Add 82574 and 82583 specific check. This
modification may change the setting of WM_F_HAS_MANAGE flag on some machines.

 Sync the wm_release_manageablilty() fucntion with FreeBSD. Set MANC_ARP_EN.
This change enables HW ARP function when entering suspend.

 When the chip is 82580(ER) or I350, set WM_F_ASF_FIRMWARE_PRES flag and
check for the WM_F_ARC_SUBSYS_VALID flag. Same as FreeBSD.

 Move the location of wm_check_mng_mode() and wm_get_wakeup() in wm_attach().
Those functions access EEPROM, so they have to call after identifying EEPROM
access type. This modification may change the behavior of BMC(IPMI).

 Fix yet another NVM bank detect problem in wm(4). Use bank 0 if the detect
function failed. It's the same as FreeBSD. Observed and tested with Asus P8P67
Deluxe motherboard and tested by jnemeth.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.9 -r1.227.2.10 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.46.2.4 -r1.46.2.5 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.227.2.9 src/sys/dev/pci/if_wm.c:1.227.2.10
--- src/sys/dev/pci/if_wm.c:1.227.2.9	Sun Jul 14 20:39:13 2013
+++ src/sys/dev/pci/if_wm.c	Mon Jul 29 20:24:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.9 2013/07/14 20:39:13 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.10 2013/07/29 20:24:04 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.9 2013/07/14 20:39:13 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.10 2013/07/29 20:24:04 jdc Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -570,6 +570,8 @@ static int	wm_get_swfw_semaphore(struct 
 static void	wm_put_swfw_semaphore(struct wm_softc *, uint16_t);
 static int	wm_get_swfwhw_semaphore(struct wm_softc *);
 static void	wm_put_swfwhw_semaphore(struct wm_softc *);
+static int	wm_get_hw_semaphore_82573(struct wm_softc *);
+static void	wm_put_hw_semaphore_82573(struct wm_softc *);
 
 static int	wm_read_eeprom_ich8(struct wm_softc *, int, int, uint16_t *);
 static int32_t	wm_ich8_cycle_init(struct wm_softc *);
@@ -1242,8 +1244,6 @@ wm_attach(device_t parent, device_t self
 		return;
 	}
 
-	wm_get_wakeup(sc);
-
 	/*
 	 * In addition, i82544 and later support I/O mapped indirect
 	 * register access.  It is not desirable (nor supported in
@@ -1538,26 +1538,6 @@ wm_attach(device_t parent, device_t self
 	 */
 	wm_reset(sc);
 
-	switch (sc-sc_type) {
-	case WM_T_82571:
-	case WM_T_82572:
-	case WM_T_82573:
-	case WM_T_82574:
-	case WM_T_82583:
-	case WM_T_80003:
-	case WM_T_ICH8:
-	case WM_T_ICH9:
-	case WM_T_ICH10:
-	case WM_T_PCH:
-	case WM_T_PCH2:
-	case WM_T_PCH_LPT:
-		if (wm_check_mng_mode(sc) != 0)
-			wm_get_hw_control(sc);
-		break;
-	default:
-		break;
-	}
-
 	/*
 	 * Get some information about the EEPROM.
 	 */
@@ -1694,6 +1674,28 @@ wm_attach(device_t parent, device_t self
 		sc-sc_ee_addrbits, eetype);
 	}
 
+	switch (sc-sc_type) {
+	case WM_T_82571:
+	case WM_T_82572:
+	case WM_T_82573:
+	case WM_T_82574:
+	case WM_T_82583:
+	case WM_T_80003:
+	case WM_T_ICH8:
+	case WM_T_ICH9:
+	case WM_T_ICH10:
+	case WM_T_PCH:
+	case WM_T_PCH2:
+	case WM_T_PCH_LPT:
+		if (wm_check_mng_mode(sc) != 0) {
+			printf (get hw control (1)\n);
+			wm_get_hw_control(sc);
+		}
+		break;
+	default:
+		break;
+	}
+	wm_get_wakeup(sc);
 	/*
 	 * Read the Ethernet address from the EEPROM, if not first found
 	 * in device properties.
@@ -4018,7 +4020,6 @@ wm_reset(struct wm_softc *sc)
 {
 	int phy_reset = 0;
 	uint32_t reg, mask;
-	int i;
 
 	/*
 	 * Allocate on-chip memory according to the MTU size.
@@ -4118,19 +4119,7 @@ wm_reset(struct wm_softc *sc)
 	case WM_T_82573:
 	case WM_T_82574:
 	case WM_T_82583:
-		i = 0;
-		reg = CSR_READ(sc, WMREG_EXTCNFCTR)
-		| EXTCNFCTR_MDIO_SW_OWNERSHIP;
-		do {
-			CSR_WRITE(sc, WMREG_EXTCNFCTR,
-			reg | EXTCNFCTR_MDIO_SW_OWNERSHIP);
-			reg = CSR_READ(sc, WMREG_EXTCNFCTR);
-			if ((reg  EXTCNFCTR_MDIO_SW_OWNERSHIP) != 0)
-break;
-			reg |= EXTCNFCTR_MDIO_SW_OWNERSHIP;
-			delay(2*1000);
-			i++;
-		} while (i  WM_MDIO_OWNERSHIP_TIMEOUT);
+		wm_get_hw_semaphore_82573(sc);
 		break;
 	default:
 		break;
@@ -4231,6 +4220,16 @@ wm_reset(struct wm_softc *sc)
 		break;
 	

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

2013-07-14 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Jul 14 20:33:07 UTC 2013

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

Log Message:
Apply changes from msaitoh in ticket #906:
sys/dev/pci/pcidevs 1.1145, 1.1147, 1.1150-1.1158
sys/dev/pci/pcidevs.h   regen
sys/dev/pci/pcidevs_data.h  regen

Pull up pcidevs changes:
Intel Atom E600 PCI-LPC bridge, adds a watchdog + HPET support.
Update some Intel LPC devices.
Change from 3400 USB to 3400 USB EHCI for EHCI devices.
Fix BCM5785F entry. That is not gigabit Ethernet.
Add ALTIMA AC1003, BROADCOM BCM57782 and BCM57786.
Add Intel I21[0178] Ethernet.
Add IDs for Marvell Armada XP. Obtained from Marvell, Semihalf.
Add some Intel devices from document (Intel 8 Series / C220 Chipset
Family Platform Controller Hub (PCH) Datasheet).
Add some Intel devices from datasheets (4th Generation Intel Core
Processor, Intel Xeon Processor E3-1200 v3).
Add ATI RADEON_HD7340.
[msaitoh, ticket #906]


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.11 -r1.1102.2.12 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.1102.2.11 src/sys/dev/pci/pcidevs:1.1102.2.12
--- src/sys/dev/pci/pcidevs:1.1102.2.11	Thu Nov 22 17:46:09 2012
+++ src/sys/dev/pci/pcidevs	Sun Jul 14 20:33:07 2013
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.11 2012/11/22 17:46:09 riz Exp $
+$NetBSD: pcidevs,v 1.1102.2.12 2013/07/14 20:33:07 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -924,6 +924,7 @@ product ALTERA EP4CGX15BF14C8N	0x4c15	EP
 product ALTIMA AC1000	0x03e8	AC1000 Gigabit Ethernet
 product ALTIMA AC1001	0x03e9	AC1001 Gigabit Ethernet
 product ALTIMA AC9100	0x03ea	AC9100 Gigabit Ethernet
+product ALTIMA AC1003	0x03eb	AC1003 Gigabit Ethernet
 
 /* AMD products */
 product AMD AMD64_HT	0x1100	K8 AMD64 HyperTransport Configuration
@@ -1465,6 +1466,7 @@ product ATI RADEON_HD6520G	0x9647	Radeon
 product ATI RADEON_HD4200	0x9712	Radeon HD4200 Mobility
 product ATI RADEON_HD4250	0x9715	Radeon HD4250 GPU (RS880)
 product ATI RADEON_HD6310	0x9802	Radeon HD6310 Graphics
+product ATI RADEON_HD7340	0x9808	Radeon HD7340 Graphics
 product ATI RADEON_HD2600_HD	0xaa08	Radeon HD2600 HD Audio Controller
 product ATI RADEON_HD5600_HDMI	0xaa60	Redwood HDMI Audio
 
@@ -1618,7 +1620,7 @@ product BROADCOM BCM5786	0x169a	BCM5786 
 product BROADCOM BCM5787	0x169b	BCM5787 NetLink 1000baseT Ethernet
 product BROADCOM BCM5788	0x169c	BCM5788 10/100/1000 Ethernet
 product BROADCOM BCM5789	0x169d	BCM5789 NetLink 1000baseT Ethernet
-product BROADCOM BCM5785F	0x16a0	BCM5785F 10/100/1000 Ethernet
+product BROADCOM BCM5785F	0x16a0	BCM5785F 10/100 Ethernet
 product BROADCOM BCM5702X	0x16a6	BCM5702X 10/100/1000 Ethernet
 product BROADCOM BCM5703X	0x16a7	BCM5703X 10/100/1000 Ethernet
 product BROADCOM BCM5704S	0x16a8	BCM5704S 1000baseSX Ethernet
@@ -1627,9 +1629,11 @@ product BROADCOM BCM5708S	0x16ac	BCM5708
 product BROADCOM BCM57761	0x16b0	BCM57761 10/100/1000 Ethernet
 product BROADCOM BCM57781	0x16b1	BCM57781 10/100/1000 Ethernet
 product BROADCOM BCM57791	0x16b2	BCM57791 10/100/1000 Ethernet
+product BROADCOM BCM57786	0x16b3	BCM57786 10/100/1000 Ethernet
 product BROADCOM BCM57765	0x16b4	BCM57765 Integrated Gigabit Ethernet
 product BROADCOM BCM57785	0x16b5	BCM57785 Integrated Gigabit Ethernet
 product BROADCOM BCM57795	0x16b6	BCM57795 10/100/1000 Ethernet
+product BROADCOM BCM57782	0x16b7	BCM57782 10/100/1000 Ethernet
 product BROADCOM BCM5702_ALT	0x16c6	BCM5702 10/100/1000 Ethernet
 product BROADCOM BCM5703_ALT	0x16c7	BCM5703 10/100/1000 Ethernet
 product BROADCOM BCM5781	0x16dd	BCM5781 Integrated Gigabit Ethernet
@@ -2232,7 +2236,12 @@ product MARVELL MV64360		0x6460	MV6436x 
 product MARVELL MV64460		0x6480	MV6446x System Controller
 product MARVELL 88SX7042	0x7042	88SX7042 SATA IIe
 product MARVELL MV78100		0x7810	MV78100 SoC Discovery Innovation
+product MARVELL MV78130		0x7813	MV78130 SoC Armada XP
+product MARVELL MV78160		0x7816	MV78160 SoC Armada XP
 product MARVELL MV78200		0x7820	MV78200 SoC Discovery Innovation
+product MARVELL MV78230		0x7823	MV78230 SoC Armada XP
+product MARVELL MV78260		0x7826	MV78260 SoC Armada XP
+product MARVELL MV78460		0x7846	MV78460 SoC Armada XP
 product MARVELL 88W8660		0x8660	88W8660 SoC Orion1
 
 product MARVELL2 88SE9123	0x9123	88SE9123 SATA II PCI-E AHCI Controller
@@ -2447,6 +2456,7 @@ product INTEL 6700PXH_PCIE1	0x032a	6700P
 product INTEL SRCZCRX		0x0407	RAID Controller
 product INTEL SRCU42E		0x0408	SCSI RAID Controller
 product INTEL SRCS28X		0x0409	SATA RAID Controller
+product INTEL HASWELL_IGD	0x0402	Haswell Integrated Graphics Device
 product INTEL PCEB		0x0482	82375EB/SB 

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

2013-07-14 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Jul 14 20:39:13 UTC 2013

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

Log Message:
Apply changes (requested by msaitoh in ticket #907):

sys/dev/pci/if_wm.c 1.238, 1.244-1.247, 1.249-1.258
sys/dev/pci/if_wmreg.h  1.50-1.51, 1.53
sys/dev/pci/if_wmvar.h  1.15-1.16

Various fixes to wm(4):
Add I21[0178] support.
Fix a bug that wm_attach() may fail on some PCH2 or newer system.
wm_valid_nvm_bank_detect_ich8lan() misunderstood the NVM's bank
number. Fixes PR#47878.
Fix a bug that the check of reset complete fails on Intel 8 series
with wm_lan_init_done: lan_init_done failed to complete message.
The broken code was used for ICH8, 9... and PCH2.
The wm_linkintr_gmii() function is called from interrupt. That's
not tick, so call mii_pollstat() instead of mii_tick().
Add ECC support for the packet buffer. Only 82571 and I21[78] support
ECC.
Fix a bug that wrong semaphore is used in wm_gmii_hv_{read,write}reg.
Change style, add comments, fix some comments, use macros and
remove trailing whitespaces.
[msaitoh, ticket #907]


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.8 -r1.227.2.9 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.46.2.3 -r1.46.2.4 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.12.10.2 -r1.12.10.3 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.227.2.8 src/sys/dev/pci/if_wm.c:1.227.2.9
--- src/sys/dev/pci/if_wm.c:1.227.2.8	Mon Feb 18 18:05:29 2013
+++ src/sys/dev/pci/if_wm.c	Sun Jul 14 20:39:13 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.8 2013/02/18 18:05:29 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.9 2013/07/14 20:39:13 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -37,32 +37,32 @@
 
 /***
 
-  Copyright (c) 2001-2005, Intel Corporation 
+  Copyright (c) 2001-2005, Intel Corporation
   All rights reserved.
-  
-  Redistribution and use in source and binary forms, with or without 
+ 
+  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, 
+ 
+   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 
+ 
+   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.
-  
-   3. Neither the name of the Intel Corporation nor the names of its 
-  contributors may be used to endorse or promote products derived from 
+ 
+   3. Neither the name of the Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.
-  
+ 
   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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) 
+  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 COPYRIGHT OWNER 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.
 
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h

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

2013-06-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 13 07:40:24 UTC 2013

Modified Files:
src/sys/dev/pci [netbsd-6]: if_alc.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #898):
sys/dev/pci/if_alc.c: revision 1.7
avoid illegal sleeps in the softint routine.
XXX could probably do better by creating a watchdog thread.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.8.1 src/sys/dev/pci/if_alc.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_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.5 src/sys/dev/pci/if_alc.c:1.5.8.1
--- src/sys/dev/pci/if_alc.c:1.5	Mon Aug 29 14:47:08 2011
+++ src/sys/dev/pci/if_alc.c	Thu Jun 13 07:40:24 2013
@@ -103,6 +103,7 @@ static void	alc_attach(device_t, device_
 static int	alc_detach(device_t, int);
 
 static int	alc_init(struct ifnet *);
+static int	alc_init_backend(struct ifnet *, bool);
 static void	alc_start(struct ifnet *);
 static int	alc_ioctl(struct ifnet *, u_long, void *);
 static void	alc_watchdog(struct ifnet *);
@@ -119,7 +120,7 @@ static struct alc_ident *
 static void	alc_get_macaddr(struct alc_softc *);
 static void	alc_init_cmb(struct alc_softc *);
 static void	alc_init_rr_ring(struct alc_softc *);
-static int	alc_init_rx_ring(struct alc_softc *);
+static int	alc_init_rx_ring(struct alc_softc *, bool);
 static void	alc_init_smb(struct alc_softc *);
 static void	alc_init_tx_ring(struct alc_softc *);
 static int	alc_intr(void *);
@@ -127,7 +128,7 @@ static void	alc_mac_config(struct alc_so
 static int	alc_miibus_readreg(device_t, int, int);
 static void	alc_miibus_statchg(device_t);
 static void	alc_miibus_writereg(device_t, int, int, int);
-static int	alc_newbuf(struct alc_softc *, struct alc_rxdesc *, int);
+static int	alc_newbuf(struct alc_softc *, struct alc_rxdesc *, bool);
 static void	alc_phy_down(struct alc_softc *);
 static void	alc_phy_reset(struct alc_softc *);
 static void	alc_reset(struct alc_softc *);
@@ -1445,13 +1446,13 @@ alc_watchdog(struct ifnet *ifp)
 		printf(%s: watchdog timeout (missed link)\n,
 		device_xname(sc-sc_dev));
 		ifp-if_oerrors++;
-		alc_init(ifp);
+		alc_init_backend(ifp, false);
 		return;
 	}
 
 	printf(%s: watchdog timeout\n, device_xname(sc-sc_dev));
 	ifp-if_oerrors++;
-	alc_init(ifp);
+	alc_init_backend(ifp, false);
 
 	if (!IFQ_IS_EMPTY(ifp-if_snd))
 		 alc_start(ifp);
@@ -1681,7 +1682,7 @@ alc_intr(void *arg)
 
 			error = alc_rxintr(sc);
 			if (error) {
-alc_init(ifp);
+alc_init_backend(ifp, false);
 return (0);
 			}
 		}
@@ -1697,7 +1698,7 @@ alc_intr(void *arg)
 			if (status  INTR_TXQ_TO_RST)
 printf(%s: TxQ reset! -- resetting\n,
 device_xname(sc-sc_dev));
-			alc_init(ifp);
+			alc_init_backend(ifp, false);
 			return (0);
 		}
 
@@ -1768,7 +1769,7 @@ alc_txeof(struct alc_softc *sc)
 }
 
 static int
-alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, int init)
+alc_newbuf(struct alc_softc *sc, struct alc_rxdesc *rxd, bool init)
 {
 	struct mbuf *m;
 	bus_dmamap_t map;
@@ -1923,7 +1924,7 @@ alc_rxeof(struct alc_softc *sc, struct r
 		rxd = sc-alc_cdata.alc_rxdesc[rx_cons];
 		mp = rxd-rx_m;
 		/* Add a new receive buffer to the ring. */
-		if (alc_newbuf(sc, rxd, 0) != 0) {
+		if (alc_newbuf(sc, rxd, false) != 0) {
 			ifp-if_iqdrops++;
 			/* Reuse Rx buffers. */
 			if (sc-alc_cdata.alc_rxhead != NULL)
@@ -2047,6 +2048,13 @@ alc_reset(struct alc_softc *sc)
 static int
 alc_init(struct ifnet *ifp)
 {
+	
+	return alc_init_backend(ifp, true);
+}
+
+static int
+alc_init_backend(struct ifnet *ifp, bool init)
+{
 	struct alc_softc *sc = ifp-if_softc;
 	struct mii_data *mii;
 	uint8_t eaddr[ETHER_ADDR_LEN];
@@ -2064,7 +2072,7 @@ alc_init(struct ifnet *ifp)
 	alc_reset(sc);
 
 	/* Initialize Rx descriptors. */
-	error = alc_init_rx_ring(sc);
+	error = alc_init_rx_ring(sc, init);
 	if (error != 0) {
 		printf(%s: no memory for Rx buffers.\n, device_xname(sc-sc_dev));
 		alc_stop(ifp, 0);
@@ -2517,7 +2525,7 @@ alc_init_tx_ring(struct alc_softc *sc)
 }
 
 static int
-alc_init_rx_ring(struct alc_softc *sc)
+alc_init_rx_ring(struct alc_softc *sc, bool init)
 {
 	struct alc_ring_data *rd;
 	struct alc_rxdesc *rxd;
@@ -2530,7 +2538,7 @@ alc_init_rx_ring(struct alc_softc *sc)
 		rxd = sc-alc_cdata.alc_rxdesc[i];
 		rxd-rx_m = NULL;
 		rxd-rx_desc = rd-alc_rx_ring[i];
-		if (alc_newbuf(sc, rxd, 1) != 0)
+		if (alc_newbuf(sc, rxd, init) != 0)
 			return (ENOBUFS);
 	}
 



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

2013-05-12 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun May 12 16:38:06 UTC 2013

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

Log Message:
Pull up following revision(s) (requested by minoura in ticket #890):
sys/dev/pci/if_vioif.c: revision 1.4
Fix a typo, and remove an unused member.
This should fix the problem that recent Qemu dies during configuring a vioif.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 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.2 src/sys/dev/pci/if_vioif.c:1.2.8.1
--- src/sys/dev/pci/if_vioif.c:1.2	Sat Nov 19 12:32:54 2011
+++ src/sys/dev/pci/if_vioif.c	Sun May 12 16:38:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.2 2011/11/19 12:32:54 jmcneill Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.2.8.1 2013/05/12 16:38:06 riz Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.2 2011/11/19 12:32:54 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.2.8.1 2013/05/12 16:38:06 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -151,7 +151,6 @@ struct vioif_softc {
 
 	uint8_t			sc_mac[ETHER_ADDR_LEN];
 	struct ethercom		sc_ethercom;
-	uint32_t		sc_features;
 	short			sc_ifflags;
 
 	/* bus_dmamem */
@@ -654,7 +653,7 @@ vioif_stop(struct ifnet *ifp, int disabl
 		vioif_rx_drain(sc);
 	
 	virtio_reinit_start(vsc);
-	virtio_negotiate_features(vsc, sc-sc_features);
+	virtio_negotiate_features(vsc, vsc-sc_features);
 	virtio_start_vq_intr(vsc, sc-sc_vq[0]);
 	virtio_stop_vq_intr(vsc, sc-sc_vq[1]);
 	if (vsc-sc_nvqs = 3)



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

2013-02-18 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Feb 18 17:57:58 UTC 2013

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

Log Message:
sys/dev/pci/if_wm.c 1.235-1.236 via patch

Use PRIx64 and explicitly cast to uint64_t to print a DMA address.
This fixes a problem that if_wm.c can't compile with WM_DEBUG on
non-64bit platforms.
[msaitoh, ticket #823]


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.6 -r1.227.2.7 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.227.2.6 src/sys/dev/pci/if_wm.c:1.227.2.7
--- src/sys/dev/pci/if_wm.c:1.227.2.6	Thu Feb 14 22:08:28 2013
+++ src/sys/dev/pci/if_wm.c	Mon Feb 18 17:57:57 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.6 2013/02/14 22:08:28 jdc Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.7 2013/02/18 17:57:57 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.6 2013/02/14 22:08:28 jdc Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.7 2013/02/18 17:57:57 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -2695,10 +2695,10 @@ wm_start(struct ifnet *ifp)
 lasttx = nexttx;
 
 DPRINTF(WM_DEBUG_TX,
-(%s: TX: desc %d: low %# PRIxPADDR , 
+(%s: TX: desc %d: low %# PRIx64 , 
  len %#04zx\n,
 device_xname(sc-sc_dev), nexttx,
-curaddr  0xUL, curlen));
+(uint64_t)curaddr, curlen));
 			}
 		}
 
@@ -3158,7 +3158,7 @@ wm_nq_start(struct ifnet *ifp)
 			DPRINTF(WM_DEBUG_TX,
 			(%s: TX: adv data desc %d 0x% PRIx64 \n,
 			device_xname(sc-sc_dev), nexttx, 
-			dmamap-dm_segs[0].ds_addr));
+			(uint64_t)dmamap-dm_segs[0].ds_addr));
 			DPRINTF(WM_DEBUG_TX,
 			(\t 0x%08x%08x\n, fields,
 			(uint32_t)dmamap-dm_segs[0].ds_len | cmdlen));
@@ -3182,10 +3182,10 @@ wm_nq_start(struct ifnet *ifp)
 			lasttx = nexttx;
 
 			DPRINTF(WM_DEBUG_TX,
-			(%s: TX: desc %d: %# PRIxPADDR , 
+			(%s: TX: desc %d: %# PRIx64 , 
 			 len %#04zx\n,
 			device_xname(sc-sc_dev), nexttx,
-			dmamap-dm_segs[seg].ds_addr,
+			(uint64_t)dmamap-dm_segs[seg].ds_addr,
 			dmamap-dm_segs[seg].ds_len));
 		}
 



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

2013-02-18 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Feb 18 18:05:30 UTC 2013

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #824):
sys/dev/pci/if_wm.c: revision 1.240
sys/dev/pci/if_wm.c: revision 1.241
sys/dev/pci/if_wm.c: revision 1.242
sys/dev/pci/if_wmreg.h: revision 1.49
- Add WM_DEBUG_NVM.
- If WM_DEBUG_NVM is enabled, dump the FLASH ROM data.
Skip 64bit BAR correctly. I don't know if this bug causes a real problem.
Fix RAL_TABSIZE for ICH8, 82576, 82580 and I350.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.7 -r1.227.2.8 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.46.2.2 -r1.46.2.3 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.227.2.7 src/sys/dev/pci/if_wm.c:1.227.2.8
--- src/sys/dev/pci/if_wm.c:1.227.2.7	Mon Feb 18 17:57:57 2013
+++ src/sys/dev/pci/if_wm.c	Mon Feb 18 18:05:29 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.7 2013/02/18 17:57:57 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.8 2013/02/18 18:05:29 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.7 2013/02/18 17:57:57 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.8 2013/02/18 18:05:29 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -132,8 +132,9 @@ __KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.
 #define	WM_DEBUG_RX		0x04
 #define	WM_DEBUG_GMII		0x08
 #define	WM_DEBUG_MANAGE		0x10
+#define	WM_DEBUG_NVM		0x20
 int	wm_debug = WM_DEBUG_TX | WM_DEBUG_RX | WM_DEBUG_LINK | WM_DEBUG_GMII
-| WM_DEBUG_MANAGE;
+| WM_DEBUG_MANAGE | WM_DEBUG_NVM;
 
 #define	DPRINTF(x, y)	if (wm_debug  (x)) printf y
 #else
@@ -1218,11 +1219,14 @@ wm_attach(device_t parent, device_t self
 	if (sc-sc_type = WM_T_82544) {
 		/* First we have to find the I/O BAR. */
 		for (i = PCI_MAPREG_START; i  PCI_MAPREG_END; i += 4) {
-			if (pci_mapreg_type(pa-pa_pc, pa-pa_tag, i) ==
-			PCI_MAPREG_TYPE_IO)
+			memtype = pci_mapreg_type(pa-pa_pc, pa-pa_tag, i);
+			if (memtype == PCI_MAPREG_TYPE_IO)
 break;
+			if (PCI_MAPREG_MEM_TYPE(memtype) ==
+			PCI_MAPREG_MEM_TYPE_64BIT)
+i += 4;	/* skip high bits, too */
 		}
-		if (i != PCI_MAPREG_END) {
+		if (i  PCI_MAPREG_END) {
 			/*
 			 * We found PCI_MAPREG_TYPE_IO. Note that 82580
 			 * (and newer?) chip has no PCI_MAPREG_TYPE_IO.
@@ -5261,6 +5265,32 @@ wm_validate_eeprom_checksum(struct wm_so
 
 	checksum = 0;
 
+#ifdef WM_DEBUG
+	/* Dump EEPROM image for debug */
+	if ((sc-sc_type == WM_T_ICH8) || (sc-sc_type == WM_T_ICH9)
+	|| (sc-sc_type == WM_T_ICH10) || (sc-sc_type == WM_T_PCH)
+	|| (sc-sc_type == WM_T_PCH2)) {
+		wm_read_eeprom(sc, 0x19, 1, eeprom_data);
+		if ((eeprom_data  0x40) == 0) {
+			DPRINTF(WM_DEBUG_NVM,(%s: NVM need to be updated\n,
+device_xname(sc-sc_dev)));
+		}
+	}
+
+	if ((wm_debug  WM_DEBUG_NVM) != 0) {
+		printf(%s: NVM dump:\n, device_xname(sc-sc_dev));
+		for (i = 0; i  EEPROM_SIZE; i++) {
+			if (wm_read_eeprom(sc, i, 1, eeprom_data))
+printf(XX );
+			else
+printf(%04x , eeprom_data);
+			if (i % 8 == 7)
+printf(\n);
+		}
+	}
+
+#endif /* WM_DEBUG */
+
 	for (i = 0; i  EEPROM_SIZE; i++) {
 		if (wm_read_eeprom(sc, i, 1, eeprom_data))
 			return 1;
@@ -5614,10 +5644,17 @@ wm_set_filter(struct wm_softc *sc)
 	 * Set the station address in the first RAL slot, and
 	 * clear the remaining slots.
 	 */
-	if ((sc-sc_type == WM_T_ICH8) || (sc-sc_type == WM_T_ICH9)
-	|| (sc-sc_type == WM_T_ICH10) || (sc-sc_type == WM_T_PCH)
-	|| (sc-sc_type == WM_T_PCH2))
-		size = WM_ICH8_RAL_TABSIZE;
+	if (sc-sc_type == WM_T_ICH8)
+		size = WM_RAL_TABSIZE_ICH8 -1;
+	else if ((sc-sc_type == WM_T_ICH9) || (sc-sc_type == WM_T_ICH10)
+	|| (sc-sc_type == WM_T_PCH) || (sc-sc_type == WM_T_PCH2))
+		size = WM_RAL_TABSIZE_ICH8;
+	else if (sc-sc_type == WM_T_82575)
+		size = WM_RAL_TABSIZE_82575;
+	else if ((sc-sc_type == WM_T_82576) || (sc-sc_type == WM_T_82580))
+		size = WM_RAL_TABSIZE_82576;
+	else if (sc-sc_type == WM_T_I350)
+		size = WM_RAL_TABSIZE_I350;
 	else
 		size = WM_RAL_TABSIZE;
 	wm_set_ral(sc, CLLADDR(ifp-if_sadl), 0);

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.46.2.2 src/sys/dev/pci/if_wmreg.h:1.46.2.3
--- src/sys/dev/pci/if_wmreg.h:1.46.2.2	Mon Sep  3 19:09:41 2012
+++ src/sys/dev/pci/if_wmreg.h	Mon Feb 18 18:05:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.46.2.2 2012/09/03 19:09:41 riz Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.46.2.3 2013/02/18 18:05:30 riz Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -420,8 +420,11 @@ struct livengood_tcpip_ctxdesc {
 #define	RAL_RDR1	(1U  30)	/* put packet in alt. rx ring */
 #define	RAL_AV		(1U  31)	/* 

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

2013-02-14 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu Feb 14 22:08:28 UTC 2013

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

Log Message:
Pull up revisions:
  src/sys/dev/pci/if_wm.c revision 1.243
  src/sys/dev/pci/if_wmvar.h revision 1.14
(requested by msaitoh in ticket #820).

Use 82580(and I350) specific PHY read/write functions.
Fixes PR#47542.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.5 -r1.227.2.6 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.12.10.1 -r1.12.10.2 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.227.2.5 src/sys/dev/pci/if_wm.c:1.227.2.6
--- src/sys/dev/pci/if_wm.c:1.227.2.5	Mon Dec 17 00:30:05 2012
+++ src/sys/dev/pci/if_wm.c	Thu Feb 14 22:08:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.5 2012/12/17 00:30:05 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.6 2013/02/14 22:08:28 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.5 2012/12/17 00:30:05 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.6 2013/02/14 22:08:28 jdc Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -542,6 +542,8 @@ static int	wm_gmii_bm_readreg(device_t, 
 static void	wm_gmii_bm_writereg(device_t, int, int, int);
 static int	wm_gmii_hv_readreg(device_t, int, int);
 static void	wm_gmii_hv_writereg(device_t, int, int, int);
+static int	wm_gmii_82580_readreg(device_t, int, int);
+static void	wm_gmii_82580_writereg(device_t, int, int, int);
 static int	wm_sgmii_readreg(device_t, int, int);
 static void	wm_sgmii_writereg(device_t, int, int, int);
 
@@ -6277,6 +6279,10 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 		} else if (sc-sc_type = WM_T_80003) {
 			sc-sc_mii.mii_readreg = wm_gmii_i80003_readreg;
 			sc-sc_mii.mii_writereg = wm_gmii_i80003_writereg;
+		} else if (sc-sc_type = WM_T_82580) {
+			sc-sc_phytype = WMPHY_82580;
+			sc-sc_mii.mii_readreg = wm_gmii_82580_readreg;
+			sc-sc_mii.mii_writereg = wm_gmii_82580_writereg;
 		} else if (sc-sc_type = WM_T_82544) {
 			sc-sc_mii.mii_readreg = wm_gmii_i82544_readreg;
 			sc-sc_mii.mii_writereg = wm_gmii_i82544_writereg;
@@ -6980,6 +6986,58 @@ wm_sgmii_writereg(device_t self, int phy
 }
 
 /*
+ * wm_gmii_82580_readreg:	[mii interface function]
+ *
+ *	Read a PHY register on the 82580 and I350.
+ * This could be handled by the PHY layer if we didn't have to lock the
+ * ressource ...
+ */
+static int
+wm_gmii_82580_readreg(device_t self, int phy, int reg)
+{
+	struct wm_softc *sc = device_private(self);
+	int sem;
+	int rv;
+
+	sem = swfwphysem[sc-sc_funcid];
+	if (wm_get_swfw_semaphore(sc, sem)) {
+		aprint_error_dev(sc-sc_dev, %s: failed to get semaphore\n,
+		__func__);
+		return 0;
+	}
+
+	rv = wm_gmii_i82544_readreg(self, phy, reg);
+
+	wm_put_swfw_semaphore(sc, sem);
+	return rv;
+}
+
+/*
+ * wm_gmii_82580_writereg:	[mii interface function]
+ *
+ *	Write a PHY register on the 82580 and I350.
+ * This could be handled by the PHY layer if we didn't have to lock the
+ * ressource ...
+ */
+static void
+wm_gmii_82580_writereg(device_t self, int phy, int reg, int val)
+{
+	struct wm_softc *sc = device_private(self);
+	int sem;
+
+	sem = swfwphysem[sc-sc_funcid];
+	if (wm_get_swfw_semaphore(sc, sem)) {
+		aprint_error_dev(sc-sc_dev, %s: failed to get semaphore\n,
+		__func__);
+		return;
+	}
+
+	wm_gmii_i82544_writereg(self, phy, reg, val);
+
+	wm_put_swfw_semaphore(sc, sem);
+}
+
+/*
  * wm_gmii_statchg:	[mii interface function]
  *
  *	Callback from MII layer when media changes.

Index: src/sys/dev/pci/if_wmvar.h
diff -u src/sys/dev/pci/if_wmvar.h:1.12.10.1 src/sys/dev/pci/if_wmvar.h:1.12.10.2
--- src/sys/dev/pci/if_wmvar.h:1.12.10.1	Thu Jun 28 16:06:36 2012
+++ src/sys/dev/pci/if_wmvar.h	Thu Feb 14 22:08:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmvar.h,v 1.12.10.1 2012/06/28 16:06:36 riz Exp $	*/
+/*	$NetBSD: if_wmvar.h,v 1.12.10.2 2013/02/14 22:08:28 jdc Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -140,7 +140,8 @@ typedef enum {
 	WMPHY_BM,
 	WMPHY_82577,
 	WMPHY_82578,
-	WMPHY_82579
+	WMPHY_82579,
+	WMPHY_82580
 } wm_phy_type;
 
 



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

2013-02-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Feb  8 19:35:24 UTC 2013

Modified Files:
src/sys/dev/pci [netbsd-6]: if_vr.c

Log Message:
Pull up following revision(s) (requested by taca in ticket #783):
sys/dev/pci/if_vr.c: revision 1.112
- reset the chip if the tx engine gets stuck after a link state change,
  from OpenBSD
- no need to do a full reset of the chip when enabling or disabling
  promiscuous mode


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.110.2.1 src/sys/dev/pci/if_vr.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_vr.c
diff -u src/sys/dev/pci/if_vr.c:1.110 src/sys/dev/pci/if_vr.c:1.110.2.1
--- src/sys/dev/pci/if_vr.c:1.110	Thu Feb  2 19:43:05 2012
+++ src/sys/dev/pci/if_vr.c	Fri Feb  8 19:35:23 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vr.c,v 1.110 2012/02/02 19:43:05 tls Exp $	*/
+/*	$NetBSD: if_vr.c,v 1.110.2.1 2013/02/08 19:35:23 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vr.c,v 1.110 2012/02/02 19:43:05 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vr.c,v 1.110.2.1 2013/02/08 19:35:23 riz Exp $);
 
 
 
@@ -231,6 +231,11 @@ struct vr_softc {
 	uint32_t	vr_save_membase;
 	uint32_t	vr_save_irq;
 
+	bool		vr_link;
+	int		vr_flags;
+#define VR_F_RESTART	0x1		/* restart on next tick */
+	int		vr_if_flags;
+
 	krndsource_t rnd_source;	/* random source */
 };
 
@@ -399,21 +404,44 @@ static void
 vr_mii_statchg(device_t self)
 {
 	struct vr_softc *sc = device_private(self);
+	int i;
 
 	/*
 	 * In order to fiddle with the 'full-duplex' bit in the netconfig
 	 * register, we first have to put the transmit and/or receive logic
 	 * in the idle state.
 	 */
-	VR_CLRBIT16(sc, VR_COMMAND, (VR_CMD_TX_ON|VR_CMD_RX_ON));
+	if ((sc-vr_mii.mii_media_status  IFM_ACTIVE) 
+	IFM_SUBTYPE(sc-vr_mii.mii_media_active) != IFM_NONE) {
+		sc-vr_link = true;
+
+		if (CSR_READ_2(sc, VR_COMMAND)  (VR_CMD_TX_ON|VR_CMD_RX_ON))
+			VR_CLRBIT16(sc, VR_COMMAND,
+			(VR_CMD_TX_ON|VR_CMD_RX_ON));
 
-	if (sc-vr_mii.mii_media_active  IFM_FDX)
-		VR_SETBIT16(sc, VR_COMMAND, VR_CMD_FULLDUPLEX);
-	else
-		VR_CLRBIT16(sc, VR_COMMAND, VR_CMD_FULLDUPLEX);
+		if (sc-vr_mii.mii_media_active  IFM_FDX)
+			VR_SETBIT16(sc, VR_COMMAND, VR_CMD_FULLDUPLEX);
+		else
+			VR_CLRBIT16(sc, VR_COMMAND, VR_CMD_FULLDUPLEX);
 
-	if (sc-vr_ec.ec_if.if_flags  IFF_RUNNING)
 		VR_SETBIT16(sc, VR_COMMAND, VR_CMD_TX_ON|VR_CMD_RX_ON);
+	} else {
+		sc-vr_link = false;
+		VR_CLRBIT16(sc, VR_COMMAND, VR_CMD_TX_ON|VR_CMD_RX_ON);
+		for (i = VR_TIMEOUT; i  0; i--) {
+			delay(10);
+			if (!(CSR_READ_2(sc, VR_COMMAND) 
+			(VR_CMD_TX_ON|VR_CMD_RX_ON)))
+break;
+		}
+		if (i == 0) {
+#ifdef VR_DEBUG
+			printf(%s: rx shutdown error!\n,
+			device_xname(sc-vr_dev));
+#endif
+			sc-vr_flags |= VR_F_RESTART;
+		}
+	}
 }
 
 #define	vr_calchash(addr) \
@@ -979,6 +1007,11 @@ vr_start(struct ifnet *ifp)
 	struct vr_descsoft *ds;
 	int error, firsttx, nexttx, opending;
 
+	if ((ifp-if_flags  (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING)
+		return;
+	if (sc-vr_link == false)
+		return;
+
 	/*
 	 * Remember the previous txpending and the first transmit
 	 * descriptor we use.
@@ -1228,6 +1261,7 @@ vr_init(struct ifnet *ifp)
 	CSR_WRITE_4(sc, VR_TXADDR, VR_CDTXADDR(sc, VR_NEXTTX(sc-vr_txlast)));
 
 	/* Set current media. */
+	sc-vr_link = true;
 	if ((error = ether_mediachange(ifp)) != 0)
 		goto out;
 
@@ -1263,19 +1297,37 @@ vr_ioctl(struct ifnet *ifp, u_long comma
 
 	s = splnet();
 
-	error = ether_ioctl(ifp, command, data);
-	if (error == ENETRESET) {
-		/*
-		 * Multicast list has changed; set the hardware filter
-		 * accordingly.
-		 */
-		if (ifp-if_flags  IFF_RUNNING)
-			vr_setmulti(sc);
+	switch (command) {
+	case SIOCSIFFLAGS:
+		if ((error = ifioctl_common(ifp, command, data)) != 0)
+			break;
+
+		switch (ifp-if_flags  (IFF_UP | IFF_RUNNING)) {
+		case IFF_RUNNING:
+			vr_stop(ifp, 1);
+			break;
+		case IFF_UP:
+			vr_init(ifp);
+			break;
+		case IFF_UP | IFF_RUNNING:
+			if ((ifp-if_flags ^ sc-vr_if_flags) == IFF_PROMISC)
+vr_setmulti(sc);
+			else
+vr_init(ifp);
+			break;
+		}
+		sc-vr_if_flags = ifp-if_flags;
+		break;
+	default:
+		if ((error = ether_ioctl(ifp, command, data)) != ENETRESET)
+			break;
 		error = 0;
+		if (command == SIOCADDMULTI || command == SIOCDELMULTI)
+			vr_setmulti(sc);
 	}
-
 	splx(s);
-	return (error);
+
+	return error;
 }
 
 static void
@@ -1299,6 +1351,11 @@ vr_tick(void *arg)
 	int s;
 
 	s = splnet();
+	if (sc-vr_flags  VR_F_RESTART) {
+		printf(%s: restarting\n, device_xname(sc-vr_dev));
+		vr_init(sc-vr_ec.ec_if);
+		sc-vr_flags = ~VR_F_RESTART;
+	}
 	mii_tick(sc-vr_mii);
 	splx(s);
 



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

2013-02-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Feb  8 19:37:37 UTC 2013

Modified Files:
src/sys/dev/pci [netbsd-6]: if_wpi.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #784):
sys/dev/pci/if_wpi.c: revision 1.54
Rework firmware reference counting and error messages in wpi(4).
. Clarify the shared firmware abstraction in wpi_cached_firmware
  and its new sibling wpi_release_firmware.
. Fix typo in wpa_cache_firmware error branch leading to free NULL.
. Fix leak in wpi_load_firmware error branch.
. Sprinkle some kasserts to executably document invariants.
. A little KNF here and there.
Based on a patch from dh in PR kern/44144.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.3 -r1.50.2.4 src/sys/dev/pci/if_wpi.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_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.50.2.3 src/sys/dev/pci/if_wpi.c:1.50.2.4
--- src/sys/dev/pci/if_wpi.c:1.50.2.3	Sun Aug 12 18:55:10 2012
+++ src/sys/dev/pci/if_wpi.c	Fri Feb  8 19:37:37 2013
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_wpi.c,v 1.50.2.3 2012/08/12 18:55:10 martin Exp $*/
+/*  $NetBSD: if_wpi.c,v 1.50.2.4 2013/02/08 19:37:37 riz Exp $*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.3 2012/08/12 18:55:10 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.4 2013/02/08 19:37:37 riz Exp $);
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -91,6 +91,7 @@ static const struct ieee80211_rateset wp
 static const struct ieee80211_rateset wpi_rateset_11g =
 	{ 12, { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 } };
 
+static const char wpi_firmware_name[] = iwlwifi-3945.ucode;
 static once_t wpi_firmware_init;
 static kmutex_t wpi_firmware_mutex;
 static size_t wpi_firmware_users;
@@ -131,6 +132,8 @@ static void wpi_mem_write_region_4(struc
    const uint32_t *, int);
 static int  wpi_read_prom_data(struct wpi_softc *, uint32_t, void *, int);
 static int  wpi_load_microcode(struct wpi_softc *,  const uint8_t *, int);
+static int  wpi_cache_firmware(struct wpi_softc *);
+static void wpi_release_firmware(void);
 static int  wpi_load_firmware(struct wpi_softc *);
 static void wpi_calib_timeout(void *);
 static void wpi_iter_func(void *, struct ieee80211_node *);
@@ -197,6 +200,7 @@ wpi_match(device_t parent, cfdata_t matc
 static int
 wpi_attach_once(void)
 {
+
 	mutex_init(wpi_firmware_mutex, MUTEX_DEFAULT, IPL_NONE);
 	return 0;
 }
@@ -416,10 +420,8 @@ wpi_detach(device_t self, int flags __un
 	bus_space_unmap(sc-sc_st, sc-sc_sh, sc-sc_sz);
 
 	if (sc-fw_used) {
-		mutex_enter(wpi_firmware_mutex);
-		if (--wpi_firmware_users == 0)
-			firmware_free(wpi_firmware_image, wpi_firmware_size);
-		mutex_exit(wpi_firmware_mutex);
+		sc-fw_used = false;
+		wpi_release_firmware();
 	}
 
 	return 0;
@@ -1133,21 +1135,32 @@ wpi_load_microcode(struct wpi_softc *sc,
 static int
 wpi_cache_firmware(struct wpi_softc *sc)
 {
+	const char *const fwname = wpi_firmware_name;
 	firmware_handle_t fw;
 	int error;
 
-	if (sc-fw_used)
-		return 0;
+	/* sc is used here only to report error messages.  */
 
 	mutex_enter(wpi_firmware_mutex);
+
+	if (wpi_firmware_users == SIZE_MAX) {
+		mutex_exit(wpi_firmware_mutex);
+		return ENFILE;	/* Too many of something in the system...  */
+	}
 	if (wpi_firmware_users++) {
+		KASSERT(wpi_firmware_image != NULL);
+		KASSERT(wpi_firmware_size  0);
 		mutex_exit(wpi_firmware_mutex);
-		return 0;
+		return 0;	/* Already good to go.  */
 	}
 
+	KASSERT(wpi_firmware_image == NULL);
+	KASSERT(wpi_firmware_size == 0);
+
 	/* load firmware image from disk */
-	if ((error = firmware_open(if_wpi,iwlwifi-3945.ucode, fw)) != 0) {
-		aprint_error_dev(sc-sc_dev, could not read firmware file\n);
+	if ((error = firmware_open(if_wpi, fwname, fw)) != 0) {
+		aprint_error_dev(sc-sc_dev,
+		could not open firmware file %s: %d\n, fwname, error);
 		goto fail0;
 	}
 
@@ -1157,48 +1170,76 @@ wpi_cache_firmware(struct wpi_softc *sc)
 	WPI_FW_MAIN_TEXT_MAXSZ + WPI_FW_MAIN_DATA_MAXSZ +
 	WPI_FW_INIT_TEXT_MAXSZ + WPI_FW_INIT_DATA_MAXSZ +
 	WPI_FW_BOOT_TEXT_MAXSZ) {
-		aprint_error_dev(sc-sc_dev, invalid firmware file\n);
+		aprint_error_dev(sc-sc_dev,
+		firmware file %s too large: %zu bytes\n,
+		fwname, wpi_firmware_size);
 		error = EFBIG;
 		goto fail1;
 	}
 
 	if (wpi_firmware_size  sizeof (struct wpi_firmware_hdr)) {
 		aprint_error_dev(sc-sc_dev,
-		truncated firmware header: %zu bytes\n,
-		wpi_firmware_size);
+		firmware file %s too small: %zu bytes\n,
+		fwname, wpi_firmware_size);
 		error = EINVAL;
-		goto fail2;
+		goto fail1;
 	}
 
 	wpi_firmware_image = firmware_malloc(wpi_firmware_size);
 	if (wpi_firmware_image == NULL) {
-		aprint_error_dev(sc-sc_dev, not enough memory to stock firmware\n);
+		

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

2012-12-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Dec 17 00:30:05 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #755):
sys/dev/pci/if_wm.c: revision 1.239
- 82578DC is not PCH2 but PCH. 82579V is not PCH but PCH2. This bug was
   introduced in rev. 1.221. Reported by FUKAUMI Naoki.
- Fix comment.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.4 -r1.227.2.5 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.227.2.4 src/sys/dev/pci/if_wm.c:1.227.2.5
--- src/sys/dev/pci/if_wm.c:1.227.2.4	Fri Nov 23 16:35:21 2012
+++ src/sys/dev/pci/if_wm.c	Mon Dec 17 00:30:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.4 2012/11/23 16:35:21 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.5 2012/12/17 00:30:05 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.4 2012/11/23 16:35:21 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.5 2012/12/17 00:30:05 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -931,13 +931,13 @@ static const struct wm_product {
 	  WM_T_PCH,		WMP_F_1000T },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_PCH_D_DC,
 	  PCH LAN (82578DC) Controller,
-	  WM_T_PCH2,		WMP_F_1000T },
+	  WM_T_PCH,		WMP_F_1000T },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_PCH2_LV_LM,
 	  PCH2 LAN (82579LM) Controller,
 	  WM_T_PCH2,		WMP_F_1000T },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_PCH2_LV_V,
 	  PCH2 LAN (82579V) Controller,
-	  WM_T_PCH,		WMP_F_1000T },
+	  WM_T_PCH2,		WMP_F_1000T },
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82575EB_COPPER,
 	  82575EB dual-1000baseT Ethernet,
 	  WM_T_82575,		WMP_F_1000T },
@@ -4125,7 +4125,7 @@ wm_reset(struct wm_softc *sc)
 		if (wm_check_reset_block(sc) == 0) {
 			/*
 			 * Gate automatic PHY configuration by hardware on
-			 * manaed 82579
+			 * non-managed 82579
 			 */
 			if ((sc-sc_type == WM_T_PCH2)
 			 ((CSR_READ(sc, WMREG_FWSM)  FWSM_FW_VALID)



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

2012-11-23 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov 23 16:35:21 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #697):
sys/dev/pci/if_wm.c: revision 1.237
Fix a bug that PHY isn't set to low-power mode on PCH and PCH2.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.3 -r1.227.2.4 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.227.2.3 src/sys/dev/pci/if_wm.c:1.227.2.4
--- src/sys/dev/pci/if_wm.c:1.227.2.3	Mon Sep  3 19:09:41 2012
+++ src/sys/dev/pci/if_wm.c	Fri Nov 23 16:35:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.3 2012/09/03 19:09:41 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.4 2012/11/23 16:35:21 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.3 2012/09/03 19:09:41 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.4 2012/11/23 16:35:21 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -4372,7 +4372,7 @@ wm_init(struct ifnet *ifp)
 
 	reg = CSR_READ(sc, WMREG_CTRL_EXT);
 	/* Enable PHY low-power state when MAC is at D3 w/o WoL */
-	if ((sc-sc_type == WM_T_PCH)  (sc-sc_type == WM_T_PCH2))
+	if ((sc-sc_type == WM_T_PCH) || (sc-sc_type == WM_T_PCH2))
 		CSR_WRITE(sc, WMREG_CTRL_EXT, reg | CTRL_EXT_PHYPDEN);
 
 	/* Initialize the transmit descriptor ring. */



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

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

Modified Files:
src/sys/dev/pci [netbsd-6]: twa.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #688):
sys/dev/pci/twa.c: revision 1.43
fix autoconf output (don't print from the match routine).


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/pci/twa.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/twa.c
diff -u src/sys/dev/pci/twa.c:1.40 src/sys/dev/pci/twa.c:1.40.2.1
--- src/sys/dev/pci/twa.c:1.40	Mon Jan 30 19:41:23 2012
+++ src/sys/dev/pci/twa.c	Thu Nov 22 17:28:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: twa.c,v 1.40 2012/01/30 19:41:23 drochner Exp $ */
+/*	$NetBSD: twa.c,v 1.40.2.1 2012/11/22 17:28:46 riz Exp $ */
 /*	$wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $	*/
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: twa.c,v 1.40 2012/01/30 19:41:23 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: twa.c,v 1.40.2.1 2012/11/22 17:28:46 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -84,9 +84,6 @@ __KERNEL_RCSID(0, $NetBSD: twa.c,v 1.40
 #include sys/disk.h
 #include sys/sysctl.h
 #include sys/syslog.h
-#if 1
-#include sys/ktrace.h
-#endif
 
 #include sys/bus.h
 
@@ -386,7 +383,7 @@ struct twa_pci_identity {
 	const char	*name;
 };
 
-static const struct twa_pci_identity pci_twa_products[] = {
+static const struct twa_pci_identity twa_pci_products[] = {
 	{ PCI_VENDOR_3WARE,
 	  PCI_PRODUCT_3WARE_9000,
 	  3ware 9000 series,
@@ -434,24 +431,32 @@ twa_request_wait_handler(struct twa_requ
 	wakeup(tr);
 }
 
-static int
-twa_match(device_t parent, cfdata_t cfdata,
-void *aux)
+static const struct twa_pci_identity *
+twa_lookup(pcireg_t id)
 {
+	const struct twa_pci_identity *entry;
 	int i;
-	struct pci_attach_args *pa = aux;
-	const struct twa_pci_identity *entry = 0;
 
-	if (PCI_VENDOR(pa-pa_id) == PCI_VENDOR_3WARE) {
-		for (i = 0; (pci_twa_products[i].product_id); i++) {
-			entry = pci_twa_products[i];
-			if (entry-product_id == PCI_PRODUCT(pa-pa_id)) {
-aprint_normal(%s: (rev. 0x%02x)\n,
-entry-name, PCI_REVISION(pa-pa_class));
-return (1);
-			}
+	for (i = 0; i  __arraycount(twa_pci_products); i++) {
+		entry = twa_pci_products[i];
+		if (entry-vendor_id == PCI_VENDOR(id) 
+		entry-product_id == PCI_PRODUCT(id)) {
+			return entry;
 		}
 	}
+	return NULL;
+}
+
+static int
+twa_match(device_t parent, cfdata_t cfdata, void *aux)
+{
+	struct pci_attach_args *pa = aux;
+	const struct twa_pci_identity *entry;
+
+	entry = twa_lookup(pa-pa_id);
+	if (entry != NULL) {
+		return 1;
+	}
 	return (0);
 }
 
@@ -713,7 +718,6 @@ twa_inquiry(struct twa_request *tr, int 
 		SID_QUAL_LU_NOTPRESENT;
 
 	error = twa_immediate_request(tr, TWA_REQUEST_TIMEOUT_PERIOD);
-
 	if (error != 0)
 		return (error);
 
@@ -1495,6 +1499,7 @@ twa_attach(device_t parent, device_t sel
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	const struct sysctlnode *node; 
+	const struct twa_pci_identity *entry;
 	int i;
 	bool use_64bit;
 
@@ -1505,7 +1510,8 @@ twa_attach(device_t parent, device_t sel
 	sc-pc = pa-pa_pc;
 	sc-tag = pa-pa_tag;
 
-	pci_aprint_devinfo_fancy(pa, RAID controller, 3ware Apache, 0);
+	entry = twa_lookup(pa-pa_id);
+	pci_aprint_devinfo_fancy(pa, RAID controller, entry-name, 1);
 
 	sc-sc_quirks = 0;
 		



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

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

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

Log Message:
Add some device IDs for ticket 691.


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.10 -r1.1102.2.11 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.1102.2.10 src/sys/dev/pci/pcidevs:1.1102.2.11
--- src/sys/dev/pci/pcidevs:1.1102.2.10	Sun Nov 18 17:53:15 2012
+++ src/sys/dev/pci/pcidevs	Thu Nov 22 17:46:09 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.10 2012/11/18 17:53:15 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1102.2.11 2012/11/22 17:46:09 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -866,6 +866,8 @@ product ADP2 ASR2200S_SUB2M	0x0287	ASR-2
 product ADP2 ASR2410SA		0x0290	ASR-2410SA
 product ADP2 AAR2810SA		0x0292	AAR-2810SA
 product ADP2 3405		0x02bb	RAID 3405
+product ADP2 3805		0x02bc	RAID 3805
+product ADP2 2405		0x02d5	RAID 2405
 product ADP2 AAC364		0x0364	AAC-364
 product ADP2 ASR5400S		0x0365	ASR-5400S
 product ADP2 PERC_2QC		0x1364	Dell PERC 2/QC



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

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

Modified Files:
src/sys/dev/pci [netbsd-6]: aac_pci.c if_an_pci.c if_sip.c if_tlp_pci.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #691):
sys/dev/pci/aac_pci.c: revision 1.34
sys/dev/pci/if_sip.c: revision 1.155
sys/dev/pci/if_tlp_pci.c: revision 1.122
sys/dev/pci/if_an_pci.c: revision 1.34
match some more devices.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.8.1 src/sys/dev/pci/aac_pci.c
cvs rdiff -u -r1.33 -r1.33.2.1 src/sys/dev/pci/if_an_pci.c
cvs rdiff -u -r1.153 -r1.153.2.1 src/sys/dev/pci/if_sip.c
cvs rdiff -u -r1.121 -r1.121.6.1 src/sys/dev/pci/if_tlp_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/aac_pci.c
diff -u src/sys/dev/pci/aac_pci.c:1.33 src/sys/dev/pci/aac_pci.c:1.33.8.1
--- src/sys/dev/pci/aac_pci.c:1.33	Thu Sep 29 12:51:28 2011
+++ src/sys/dev/pci/aac_pci.c	Thu Nov 22 17:48:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: aac_pci.c,v 1.33 2011/09/29 12:51:28 is Exp $	*/
+/*	$NetBSD: aac_pci.c,v 1.33.8.1 2012/11/22 17:48:15 riz Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aac_pci.c,v 1.33 2011/09/29 12:51:28 is Exp $);
+__KERNEL_RCSID(0, $NetBSD: aac_pci.c,v 1.33.8.1 2012/11/22 17:48:15 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -356,11 +356,27 @@ static struct aac_ident {
 	{	PCI_VENDOR_ADP2,
 		PCI_PRODUCT_ADP2_ASR2200S,
 		PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_2405,
+		AAC_HWIF_I960RX,
+		0,
+		Adaptec RAID 2405
+	},
+	{	PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_ASR2200S,
+		PCI_VENDOR_ADP2,
 		PCI_PRODUCT_ADP2_3405,
 		AAC_HWIF_I960RX,
 		0,
 		Adaptec RAID 3405
 	},
+	{	PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_ASR2200S,
+		PCI_VENDOR_ADP2,
+		PCI_PRODUCT_ADP2_3805,
+		AAC_HWIF_I960RX,
+		0,
+		Adaptec RAID 3805
+	},
 	{
 		PCI_VENDOR_DEC,
 		PCI_PRODUCT_DEC_21554,

Index: src/sys/dev/pci/if_an_pci.c
diff -u src/sys/dev/pci/if_an_pci.c:1.33 src/sys/dev/pci/if_an_pci.c:1.33.2.1
--- src/sys/dev/pci/if_an_pci.c:1.33	Mon Jan 30 19:41:19 2012
+++ src/sys/dev/pci/if_an_pci.c	Thu Nov 22 17:48:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_an_pci.c,v 1.33 2012/01/30 19:41:19 drochner Exp $	*/
+/*	$NetBSD: if_an_pci.c,v 1.33.2.1 2012/11/22 17:48:18 riz Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_an_pci.c,v 1.33 2012/01/30 19:41:19 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_an_pci.c,v 1.33.2.1 2012/11/22 17:48:18 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -95,6 +95,7 @@ static const struct an_pci_product {
 	{ PCI_VENDOR_AIRONET,		PCI_PRODUCT_AIRONET_PC4500 },
 	{ PCI_VENDOR_AIRONET,		PCI_PRODUCT_AIRONET_PC4800 },
 	{ PCI_VENDOR_AIRONET,		PCI_PRODUCT_AIRONET_PCI350 },
+	{ PCI_VENDOR_AIRONET,		PCI_PRODUCT_AIRONET_MPI350 },
 	{ 0,0			   }
 };
 

Index: src/sys/dev/pci/if_sip.c
diff -u src/sys/dev/pci/if_sip.c:1.153 src/sys/dev/pci/if_sip.c:1.153.2.1
--- src/sys/dev/pci/if_sip.c:1.153	Thu Feb  2 19:43:05 2012
+++ src/sys/dev/pci/if_sip.c	Thu Nov 22 17:48:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sip.c,v 1.153 2012/02/02 19:43:05 tls Exp $	*/
+/*	$NetBSD: if_sip.c,v 1.153.2.1 2012/11/22 17:48:16 riz Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_sip.c,v 1.153 2012/02/02 19:43:05 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_sip.c,v 1.153.2.1 2012/11/22 17:48:16 riz Exp $);
 
 
 
@@ -737,10 +737,13 @@ sipcom_check_64bit(const struct pci_atta
 		/* Accton EN1407-T, Planex GN-1000TE */
 		{ 0x1113,	0x1407 },
 
-		/* Netgear GA-621 */
+		/* Netgear GA621 */
 		{ 0x1385,	0x621a },
 
-		/* SMC EZ Card */
+		/* Netgear GA622 */
+		{ 0x1385,	0x622a },
+
+		/* SMC EZ Card 1000 (9462TX) */
 		{ 0x10b8,	0x9462 },
 
 		{ 0, 0}

Index: src/sys/dev/pci/if_tlp_pci.c
diff -u src/sys/dev/pci/if_tlp_pci.c:1.121 src/sys/dev/pci/if_tlp_pci.c:1.121.6.1
--- src/sys/dev/pci/if_tlp_pci.c:1.121	Fri Nov 11 23:01:59 2011
+++ src/sys/dev/pci/if_tlp_pci.c	Thu Nov 22 17:48:17 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tlp_pci.c,v 1.121 2011/11/11 23:01:59 jakllsch Exp $	*/
+/*	$NetBSD: if_tlp_pci.c,v 1.121.6.1 2012/11/22 17:48:17 riz Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tlp_pci.c,v 1.121 2011/11/11 23:01:59 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tlp_pci.c,v 1.121.6.1 2012/11/22 17:48:17 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1544,6 +1544,13 @@ tlp_pci_adaptec_quirks(struct tulip_pci_
 			sc-sc_mediasw = tlp_cogent_em1x0_mediasw;
 			break;
 
+		case 0x13:
+			strcpy(psc-sc_tulip.sc_name, 

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

2012-11-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Nov 22 00:43:00 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_nfe.c

Log Message:
Pull up following revision(s) (requested by chs in ticket #685):
sys/dev/pci/if_nfe.c: revision 1.57
use 64-bit DMA where possible.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/dev/pci/if_nfe.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_nfe.c
diff -u src/sys/dev/pci/if_nfe.c:1.55 src/sys/dev/pci/if_nfe.c:1.55.2.1
--- src/sys/dev/pci/if_nfe.c:1.55	Mon Jan 30 19:41:20 2012
+++ src/sys/dev/pci/if_nfe.c	Thu Nov 22 00:42:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_nfe.c,v 1.55 2012/01/30 19:41:20 drochner Exp $	*/
+/*	$NetBSD: if_nfe.c,v 1.55.2.1 2012/11/22 00:42:59 riz Exp $	*/
 /*	$OpenBSD: if_nfe.c,v 1.77 2008/02/05 16:52:50 brad Exp $	*/
 
 /*-
@@ -21,7 +21,7 @@
 /* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_nfe.c,v 1.55 2012/01/30 19:41:20 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_nfe.c,v 1.55.2.1 2012/11/22 00:42:59 riz Exp $);
 
 #include opt_inet.h
 #include vlan.h
@@ -255,8 +255,6 @@ nfe_attach(device_t parent, device_t sel
 	}
 	aprint_normal_dev(self, interrupting at %s\n, intrstr);
 
-	sc-sc_dmat = pa-pa_dmat;
-
 	csr = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG);
 	csr |= PCI_COMMAND_MASTER_ENABLE;
 	pci_conf_write(pa-pa_pc, pa-pa_tag, PCI_COMMAND_STATUS_REG, csr);
@@ -324,6 +322,11 @@ nfe_attach(device_t parent, device_t sel
 		break;
 	}
 
+	if (pci_dma64_available(pa)  (sc-sc_flags  NFE_40BIT_ADDR) != 0)
+		sc-sc_dmat = pa-pa_dmat64;
+	else
+		sc-sc_dmat = pa-pa_dmat;
+
 	nfe_poweron(self);
 
 #ifndef NFE_NO_JUMBO



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

2012-11-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Nov 19 18:42:00 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #655):
sys/dev/pci/if_et.c: revision 1.5
Don't use old NBPFILTER macro and use new bpf_mtap() API.
It fixes a bug that et(4) can't use bpf.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.2.1 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.3 src/sys/dev/pci/if_et.c:1.3.2.1
--- src/sys/dev/pci/if_et.c:1.3	Mon Jan 30 19:41:20 2012
+++ src/sys/dev/pci/if_et.c	Mon Nov 19 18:41:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.3 2012/01/30 19:41:20 drochner Exp $	*/
+/*	$NetBSD: if_et.c,v 1.3.2.1 2012/11/19 18:41:59 riz 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 sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.3 2012/01/30 19:41:20 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.3.2.1 2012/11/19 18:41:59 riz Exp $);
 
 #include opt_inet.h
 #include vlan.h
@@ -70,9 +70,7 @@ __KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.
 #include netinet/if_inarp.h
 #endif
 
-#if NBPFILTER  0
 #include net/bpf.h
-#endif
  
 #include dev/mii/mii.h
 #include dev/mii/miivar.h
@@ -1121,10 +1119,7 @@ et_start(struct ifnet *ifp)
 
 		trans = 1;
 
-#if NBPFILTER  0
-		if (ifp-if_bpf != NULL)
-			bpf_mtap(ifp-if_bpf, m);
-#endif
+		bpf_mtap(ifp, m);
 	}
 
 	if (trans) {
@@ -1779,10 +1774,7 @@ et_rxeof(struct et_softc *sc)
 ETHER_CRC_LEN;
 m-m_pkthdr.rcvif = ifp;
 
-#if NBPFILTER  0
-if (ifp-if_bpf != NULL)
-	bpf_mtap(ifp-if_bpf, m);
-#endif
+bpf_mtap(ifp, m);
 
 ifp-if_ipackets++;
 (*ifp-if_input)(ifp, m);



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

2012-11-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Nov 18 17:53:16 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by matt in ticket #658):
sys/dev/pci/pcidevs: revision 1.1143
Add more ASMEDIA 1061 variants.


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.9 -r1.1102.2.10 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.1102.2.9 src/sys/dev/pci/pcidevs:1.1102.2.10
--- src/sys/dev/pci/pcidevs:1.1102.2.9	Wed Oct 31 17:27:01 2012
+++ src/sys/dev/pci/pcidevs	Sun Nov 18 17:53:15 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.9 2012/10/31 17:27:01 riz Exp $
+$NetBSD: pcidevs,v 1.1102.2.10 2012/11/18 17:53:15 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1136,7 +1136,10 @@ product ARECA ARC1681		0x1681	ARC-1681
 product ASIX AX88140A	0x1400	AX88140A 10/100 Ethernet
 
 /* ASMedia products */
-product ASMEDIA ASM1061		0x0612	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM1061_01	0x0601	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM1061_02	0x0602	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM1061_11	0x0611	ASM1061 AHCI SATA III Controller
+product ASMEDIA ASM1061_12	0x0612	ASM1061 AHCI SATA III Controller
 
 /* Asustek products */
 product ASUSTEK HFCPCI		0x0675	ISDN



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

2012-11-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Nov 18 17:54:15 UTC 2012

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

Log Message:
Regen for ticket #658


To generate a diff of this commit:
cvs rdiff -u -r1.1097.2.9 -r1.1097.2.10 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1096.2.9 -r1.1096.2.10 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.1097.2.9 src/sys/dev/pci/pcidevs.h:1.1097.2.10
--- src/sys/dev/pci/pcidevs.h:1.1097.2.9	Wed Oct 31 17:27:27 2012
+++ src/sys/dev/pci/pcidevs.h	Sun Nov 18 17:54:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs.h,v 1.1097.2.9 2012/10/31 17:27:27 riz Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1097.2.10 2012/11/18 17:54:01 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -1143,7 +1143,10 @@
 #define	PCI_PRODUCT_ASIX_AX88140A	0x1400		/* AX88140A 10/100 Ethernet */
 
 /* ASMedia products */
-#define	PCI_PRODUCT_ASMEDIA_ASM1061	0x0612		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_01	0x0601		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_02	0x0602		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_11	0x0611		/* ASM1061 AHCI SATA III Controller */
+#define	PCI_PRODUCT_ASMEDIA_ASM1061_12	0x0612		/* ASM1061 AHCI SATA III Controller */
 
 /* Asustek products */
 #define	PCI_PRODUCT_ASUSTEK_HFCPCI	0x0675		/* ISDN */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1096.2.9 src/sys/dev/pci/pcidevs_data.h:1.1096.2.10
--- src/sys/dev/pci/pcidevs_data.h:1.1096.2.9	Wed Oct 31 17:27:27 2012
+++ src/sys/dev/pci/pcidevs_data.h	Sun Nov 18 17:54:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1096.2.9 2012/10/31 17:27:27 riz Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1096.2.10 2012/11/18 17:54:01 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -1461,7 +1461,13 @@ static const uint16_t pci_products[] = {
 	8602, 0,
 	PCI_VENDOR_ASIX, PCI_PRODUCT_ASIX_AX88140A, 
 	8611, 5554, 5452, 0,
-	PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061, 
+	PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_01, 
+	8620, 8154, 8149, 8628, 6190, 0,
+	PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_02, 
+	8620, 8154, 8149, 8628, 6190, 0,
+	PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_11, 
+	8620, 8154, 8149, 8628, 6190, 0,
+	PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_12, 
 	8620, 8154, 8149, 8628, 6190, 0,
 	PCI_VENDOR_ASUSTEK, PCI_PRODUCT_ASUSTEK_HFCPCI, 
 	8632, 0,
@@ -9492,7 +9498,7 @@ static const char pci_words[] = { . 
 	Escalade\0 /* 2 refs @ 6172 */
 	ATA\0 /* 51 refs @ 6181 */
 	RAID\0 /* 40 refs @ 6185 */
-	Controller\0 /* 824 refs @ 6190 */
+	Controller\0 /* 827 refs @ 6190 */
 	7000/8000\0 /* 1 refs @ 6201 */
 	Series\0 /* 83 refs @ 6211 */
 	9000\0 /* 5 refs @ 6218 */
@@ -9758,8 +9764,8 @@ static const char pci_words[] = { . 
 	MC97\0 /* 1 refs @ 8132 */
 	756b\0 /* 1 refs @ 8137 */
 	Hudson\0 /* 12 refs @ 8142 */
-	SATA\0 /* 111 refs @ 8149 */
-	AHCI\0 /* 71 refs @ 8154 */
+	SATA\0 /* 114 refs @ 8149 */
+	AHCI\0 /* 74 refs @ 8154 */
 	SD\0 /* 5 refs @ 8159 */
 	HD\0 /* 10 refs @ 8162 */
 	xHCI\0 /* 2 refs @ 8165 */
@@ -9824,8 +9830,8 @@ static const char pci_words[] = { . 
 	ARC-1680\0 /* 1 refs @ 8593 */
 	ARC-1681\0 /* 1 refs @ 8602 */
 	AX88140A\0 /* 1 refs @ 8611 */
-	ASM1061\0 /* 1 refs @ 8620 */
-	III\0 /* 5 refs @ 8628 */
+	ASM1061\0 /* 4 refs @ 8620 */
+	III\0 /* 8 refs @ 8628 */
 	ISDN\0 /* 8 refs @ 8632 */
 	L1E\0 /* 1 refs @ 8637 */
 	L1\0 /* 1 refs @ 8641 */



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

2012-11-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Nov 18 18:06:00 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: ahcisata_pci.c

Log Message:
Pull up following revision(s) (requested by matt in ticket #659):
sys/dev/pci/ahcisata_pci.c: revision 1.31
Add FORCE quirks for ASMEDIA ASM1061


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.27.2.1 src/sys/dev/pci/ahcisata_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/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.27 src/sys/dev/pci/ahcisata_pci.c:1.27.2.1
--- src/sys/dev/pci/ahcisata_pci.c:1.27	Mon Jan 30 19:41:18 2012
+++ src/sys/dev/pci/ahcisata_pci.c	Sun Nov 18 18:06:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.27 2012/01/30 19:41:18 drochner Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.27.2.1 2012/11/18 18:06:00 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_pci.c,v 1.27 2012/01/30 19:41:18 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_pci.c,v 1.27.2.1 2012/11/18 18:06:00 msaitoh Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -97,6 +97,14 @@ static const struct ahci_pci_quirk ahci_
 	/* ATI SB600 AHCI 64-bit DMA only works on some boards/BIOSes */
 	{ PCI_VENDOR_ATI, PCI_PRODUCT_ATI_SB600_SATA_1,
 	AHCI_PCI_QUIRK_BAD64 },
+	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_01,
+	AHCI_PCI_QUIRK_FORCE },
+	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_02,
+	AHCI_PCI_QUIRK_FORCE },
+	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_11,
+	AHCI_PCI_QUIRK_FORCE },
+	{ PCI_VENDOR_ASMEDIA, PCI_PRODUCT_ASMEDIA_ASM1061_12,
+	AHCI_PCI_QUIRK_FORCE },
 };
 
 struct ahci_pci_softc {



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

2012-10-23 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 24 03:20:07 UTC 2012

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

Log Message:
Regen for ticket 628.


To generate a diff of this commit:
cvs rdiff -u -r1.1097.2.6 -r1.1097.2.7 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1096.2.6 -r1.1096.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.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1097.2.6 src/sys/dev/pci/pcidevs.h:1.1097.2.7
--- src/sys/dev/pci/pcidevs.h:1.1097.2.6	Thu Jun 28 16:07:16 2012
+++ src/sys/dev/pci/pcidevs.h	Wed Oct 24 03:19:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs.h,v 1.1097.2.6 2012/06/28 16:07:16 riz Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1097.2.7 2012/10/24 03:19:51 riz Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -3410,6 +3410,7 @@
 #define	PCI_PRODUCT_SYMBIOS_SAS1068E	0x0058		/* SAS1068E */
 #define	PCI_PRODUCT_SYMBIOS_SAS1068E_2	0x0059		/* SAS1068E */
 #define	PCI_PRODUCT_SYMBIOS_SAS1066E	0x005A		/* SAS1066E */
+#define	PCI_PRODUCT_SYMBIOS_MEGARAID_2208	0x005B		/* MegaRAID SAS2208 */
 #define	PCI_PRODUCT_SYMBIOS_SAS1064A	0x005C		/* SAS1064A */
 #define	PCI_PRODUCT_SYMBIOS_SAS1066	0x005E		/* SAS1066 */
 #define	PCI_PRODUCT_SYMBIOS_SAS1078	0x0060		/* SAS1078 PCI */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1096.2.6 src/sys/dev/pci/pcidevs_data.h:1.1096.2.7
--- src/sys/dev/pci/pcidevs_data.h:1.1096.2.6	Thu Jun 28 16:07:17 2012
+++ src/sys/dev/pci/pcidevs_data.h	Wed Oct 24 03:19:52 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1096.2.6 2012/06/28 16:07:17 riz Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1096.2.7 2012/10/24 03:19:52 riz Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -5440,54 +5440,56 @@ static const uint16_t pci_products[] = {
 	20596, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1066E, 
 	20605, 0,
+	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_2208, 
+	8156, 20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1064A, 
-	20614, 0,
+	20622, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1066, 
-	20623, 0,
+	20631, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078, 
-	20631, 615, 0,
+	20639, 615, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078_PCIE, 
-	20631, 615, 4329, 0,
+	20639, 615, 4329, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2116_1, 
-	20639, 0,
+	20647, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2116_2, 
-	20639, 0,
-	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_3, 
 	20647, 0,
-	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2004, 
+	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_3, 
 	20655, 0,
-	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2008, 
+	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2004, 
 	20663, 0,
+	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2008, 
+	20671, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2008_1, 
-	8156, 20663, 0,
+	8156, 20671, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_3, 
-	20671, 0,
+	20679, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_4, 
-	20671, 0,
+	20679, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_5, 
-	20671, 0,
+	20679, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_1, 
-	8156, 20671, 20679, 20686, 0,
+	8156, 20679, 20687, 20694, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2108_2, 
-	8156, 20671, 20686, 0,
+	8156, 20679, 20694, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS1078DE, 
-	20691, 0,
+	20699, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_1, 
-	20701, 0,
+	20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_2, 
-	20701, 0,
+	20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_3, 
-	20701, 0,
+	20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_4, 
-	20701, 0,
+	20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_5, 
-	20701, 0,
+	20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2208_6, 
-	20701, 0,
+	20614, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_1, 
-	20647, 0,
+	20655, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_SAS2308_2, 
-	20647, 0,
+	20655, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_875J, 
 	20709, 0,
 	PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_FC909, 
@@ -9059,7 +9061,7 @@ static const char pci_words[] = { . 
 	(port\0 /* 3 refs @ 8144 */
 	1)\0 /* 1 refs @ 8150 */
 	2)\0 /* 1 refs @ 8153 */
-	MegaRAID\0 /* 8 refs @ 8156 */
+	MegaRAID\0 /* 9 refs @ 8156 */
 	Crypto\0 /* 2 refs @ 8165 */
 	Accelerator\0 /* 17 refs @ 8172 */
 	ADSP-2141\0 /* 1 refs @ 8184 */
@@ 

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

2012-10-23 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Oct 24 03:35:42 UTC 2012

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

Log Message:
Apply patch (requested by msaitoh in ticket #631):

 This patch doesn't include any changes that rename ID.

==
sys/dev/pci/pcidevs 1.1103,1.1105,1.1109-1.1112,1.1114,1.1119-1.1124,
1.1126-1.1128,1.1130-1.1136,1.1138-1.1142

Added Ricoh 5CE823.
Added some AMD/ATI devices.
Add Marvell Yukon 88e8040 ethernet.
More broadcom stuff.
Add IDs for Fresco Logic and their FL1000 and FL1009 xHCI chips.
NEC uPD720100A is USB2.
Add NEC uPD720200, a USB3 Host Controller.
Add Intel Sandybridge integrated graphics.
Add Marvell SoC 88F6282.
Add XGI Technology's devices.
Add some Intel's devices.
Add more FREESCALE devices.
Fix RICOH RU5230 description.
Add some Intel 7 series devices.
Add some ATI and SIS devices. Fixes PR#39580.
Add VirtualBox ids.
Add EG20T PCH.  Closes PR/45567.
Add LSI MegaRAID SAS2208.
Add 82GM45_KT for puc(4).
Add some Intel's KT (Serial over LAN) devices.
Add some PCI AHCI controllers, from linux.
Added ALTERA EP4CGX15BF14C8N entry.
Add Broadcom BCM57762 Gigabit Ethernet, per PR kern/46961.
Add ASMEDIA ASM1061.
Add Lava Computers SSERIAL-PCI single serial port adapter.
Add Intel Ivy Bridge host bridge and integrated graphics device IDs.
Add Intel Centrino Wireless-N 2230.
Pull in changes from matt-nb5-mips64 (RMI  NETLOGIC).
Add SB600_USB_OHCI0 again. This was (accidentally) removed in
rev. 1.1105.


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.7 -r1.1102.2.8 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.1102.2.7 src/sys/dev/pci/pcidevs:1.1102.2.8
--- src/sys/dev/pci/pcidevs:1.1102.2.7	Wed Oct 24 03:19:19 2012
+++ src/sys/dev/pci/pcidevs	Wed Oct 24 03:35:41 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.7 2012/10/24 03:19:19 riz Exp $
+$NetBSD: pcidevs,v 1.1102.2.8 2012/10/24 03:35:41 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -617,14 +617,18 @@ vendor S2IO		0x17d5	S2io Technologies
 vendor RDC		0x17F3  RDC Semiconductor
 vendor LINKSYS2		0x17fe	Linksys
 vendor RALINK		0x1814	Ralink Technologies
-vendor RMI		0x182e	Raza Microelectronics Inc. (NetLogic)
+vendor RMI		0x182e	Raza Microelectronics Inc. (Broadcom)
+vendor NETLOGIC		0x184e	Netlogic Microsystems (Broadcom)
 vendor BBELEC		0x1896	B  B Electronics
+vendor XGI		0x18ca	XGI Technology
 vendor RENESAS		0x1912	Renesas Technologies
 vendor FREESCALE	0x1957	Freescale Semiconductor
 vendor ATTANSIC		0x1969	Attansic Technologies
 vendor JMICRON		0x197b	JMicron Technology
 vendor EVE		0x1adb	EVE
 vendor QUMRANET		0x1af4	Qumranet
+vendor ASMEDIA		0x1b21  ASMedia
+vendor FRESCO		0x1b73	Fresco Logic
 vendor SYMPHONY2	0x1c1c	Symphony Labs (2nd PCI Vendor ID)
 vendor TEKRAM2		0x1de1	Tekram Technology (2nd PCI Vendor ID)
 vendor SUNIX2		0x1fd4	SUNIX Co
@@ -649,6 +653,7 @@ vendor KURUSUGAWA	0x6809	Kurusugawa Elec
 vendor PCHDTV		0x7063	pcHDTV
 vendor QUANCOM		0x8008	QUANCOM Electronic GmbH
 vendor INTEL		0x8086	Intel
+vendor VIRTUALBOX	0x80ee	VirtualBox
 vendor TRIGEM2		0x8800	Trigem Computer (2nd PCI Vendor ID)
 vendor PROLAN		0x8c4a	ProLAN
 vendor COMPUTONE	0x8e0e	Computone
@@ -910,6 +915,9 @@ product ALTEON ACENIC_COPPER	0x0002	ACEn
 product ALTEON BCM5700		0x0003	ACEnic BCM5700 10/100/1000 Ethernet
 product ALTEON BCM5701		0x0004	ACEnic BCM5701 10/100/1000 Ethernet
 
+/* Altera products */
+product ALTERA EP4CGX15BF14C8N	0x4c15	EP4CGX15BF14C8N
+
 /* Altima products */
 product ALTIMA AC1000	0x03e8	AC1000 Gigabit Ethernet
 product ALTIMA AC1001	0x03e9	AC1001 Gigabit Ethernet
@@ -1008,8 +1016,18 @@ product AMD PBC8111_ACPI	0x746b	AMD8111 
 product AMD PBC8111_AC		0x746d	AMD8111 AC97 Audio
 product AMD PBC8111_MC97	0x746e	AMD8111 MC97 Modem
 product AMD PBC8111_AC_756b	0x756b	AMD8111 756b ACPI Controller
-product AMD HUDSON2_IDE		0x780c	HUDSON-2 IDE Controller
-product AMD HUDSON2_SATA	0x7800	HUDSON-2 SATA Controller
+product AMD HUDSON_SATA		0x7800	Hudson SATA Controller
+product AMD HUDSON_SATA_AHCI	0x7801	Hudson AHCI SATA Controller
+product AMD HUDSON_SDHC		0x7806	Hudson SD Flash Controller
+product AMD HUDSON_OHCI		0x7807	Hudson USB OHCI Controller
+product AMD HUDSON_EHCI		0x7808	Hudson USB EHCI Controller
+product AMD HUDSON_OHCI_2	0x7809	Hudson USB OHCI Controller
+product AMD HUDSON_SMB		0x780b	Hudson SMBus Controller
+product AMD HUDSON_IDE		0x780c	Hudson IDE Controller
+product AMD HUDSON_HDAUDIO	0x780d	Hudson HD Audio Controller
+product AMD 

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

2012-10-01 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Oct  1 17:37:28 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by tstsui in ticket #569):
sys/dev/pci/ehci_pci.c: revision 1.57
Fix PR kern/46828 (6.0_BETA2 and 6.0_RC1 won't start on DL320/G5p):
 In ehci_get_ownership(), don't explicitly clear EHCI_LEG_HC_BIOS_OWNED
 semaphore bit in the driver before asking BIOS to give up ownership.
 The EHCI spec implies that the semaphore should not be changed by
 the other agent and actually the previous one (introduced in rev 1.53
 after 5.x) caused hangup during probe on at least two HP machines
 as mentioned in the PR.  Analyzed and patch provided by Ryo ONODERA.
Should be pulled up to netbsd-6 (fatal hangup during boot).


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.54.2.1 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.54 src/sys/dev/pci/ehci_pci.c:1.54.2.1
--- src/sys/dev/pci/ehci_pci.c:1.54	Mon Jan 30 19:41:19 2012
+++ src/sys/dev/pci/ehci_pci.c	Mon Oct  1 17:37:28 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.54 2012/01/30 19:41:19 drochner Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.54.2.1 2012/10/01 17:37:28 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci_pci.c,v 1.54 2012/01/30 19:41:19 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci_pci.c,v 1.54.2.1 2012/10/01 17:37:28 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -386,10 +386,8 @@ ehci_get_ownership(ehci_softc_t *sc, pci
 		legsup = pci_conf_read(pc, tag, addr + PCI_EHCI_USBLEGSUP);
 		if (legsup  EHCI_LEG_HC_BIOS_OWNED) {
 			/* Ask BIOS to give up ownership */
-			legsup = ~EHCI_LEG_HC_BIOS_OWNED;
-			legsup |= EHCI_LEG_HC_OS_OWNED;
 			pci_conf_write(pc, tag, addr + PCI_EHCI_USBLEGSUP,
-			legsup);
+			legsup | EHCI_LEG_HC_OS_OWNED);
 			for (ms = 0; ms  EHCI_MAX_BIOS_WAIT; ms++) {
 legsup = pci_conf_read(pc, tag,
 addr + PCI_EHCI_USBLEGSUP);



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

2012-09-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Sep  3 19:09:41 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #534):
sys/dev/pci/if_wmreg.h: revision 1.48
sys/dev/pci/if_wm.c: revision 1.232
sys/dev/pci/if_wm.c: revision 1.233
sys/dev/pci/if_wm.c: revision 1.234
Make vlan and all ip/ip6 checksum offload work for the I350.
On newer devices, when using the legacy TX descriptors, vlan-related flags
that were set on the last descriptor of a packet have to be set on the
first one.
For tso/checksum offloads, a new advanced descriptor format has to be
used.
Change wcd_txdescs to a union defining all types of descriptors (they
are all 16-bytes wide).
Define a new tx function wm_nq_start(), which handle newer devices.
There is some code duplication with wm_start(), but adding support to
the existing wm_start() would make it a if () {} else {} maze. This also
allows to get rid of some workaround for older chips that are not needed
here.
Use wm_nq_start() instead of wm_start() for the I350 (this should probably
be for all WM_F_NEWQUEUE devices, but I have no hardware but the I350 to
test). Call ifp-if_start() instead of wm_start() where is matters.
Tested on a I350, and a i80003 (which use the old format), both with and
without vlans, with and without checksum offloads.
Enable VLAN hardware tagging on all chips that have the new queue mechanism.
Tested with 82575{EB,GB}, 82576, 82580, I350 and ICH9.
Shut up gcc about some uninitialized variables.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.2 -r1.227.2.3 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.46.2.1 -r1.46.2.2 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.227.2.2 src/sys/dev/pci/if_wm.c:1.227.2.3
--- src/sys/dev/pci/if_wm.c:1.227.2.2	Thu Aug  9 08:00:55 2012
+++ src/sys/dev/pci/if_wm.c	Mon Sep  3 19:09:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.2 2012/08/09 08:00:55 martin Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.3 2012/09/03 19:09:41 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.2 2012/08/09 08:00:55 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.3 2012/09/03 19:09:41 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -194,7 +194,10 @@ struct wm_control_data_82544 {
 	 * The transmit descriptors.  Put these at the end, because
 	 * we might use a smaller number of them.
 	 */
-	wiseman_txdesc_t wcd_txdescs[WM_NTXDESC_82544];
+	union {
+		wiseman_txdesc_t wcdu_txdescs[WM_NTXDESC_82544];
+		nq_txdesc_t  wcdu_nq_txdescs[WM_NTXDESC_82544];
+	} wdc_u;
 };
 
 struct wm_control_data_82542 {
@@ -203,7 +206,7 @@ struct wm_control_data_82542 {
 };
 
 #define	WM_CDOFF(x)	offsetof(struct wm_control_data_82544, x)
-#define	WM_CDTXOFF(x)	WM_CDOFF(wcd_txdescs[(x)])
+#define	WM_CDTXOFF(x)	WM_CDOFF(wdc_u.wcdu_txdescs[(x)])
 #define	WM_CDRXOFF(x)	WM_CDOFF(wcd_rxdescs[(x)])
 
 /*
@@ -294,7 +297,8 @@ struct wm_softc {
 	int sc_cd_rseg;			/* real number of control segment */
 	size_t sc_cd_size;		/* control data size */
 #define	sc_cddma	sc_cddmamap-dm_segs[0].ds_addr
-#define	sc_txdescs	sc_control_data-wcd_txdescs
+#define	sc_txdescs	sc_control_data-wdc_u.wcdu_txdescs
+#define	sc_nq_txdescs	sc_control_data-wdc_u.wcdu_nq_txdescs
 #define	sc_rxdescs	sc_control_data-wcd_rxdescs
 
 #ifdef WM_EVENT_COUNTERS
@@ -490,6 +494,7 @@ do {	\
 } while (/*CONSTCOND*/0)
 
 static void	wm_start(struct ifnet *);
+static void	wm_nq_start(struct ifnet *);
 static void	wm_watchdog(struct ifnet *);
 static int	wm_ifflags_cb(struct ethercom *);
 static int	wm_ioctl(struct ifnet *, u_long, void *);
@@ -1877,7 +1882,10 @@ wm_attach(device_t parent, device_t self
 	ifp-if_softc = sc;
 	ifp-if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp-if_ioctl = wm_ioctl;
-	ifp-if_start = wm_start;
+	if ((sc-sc_flags  WM_F_NEWQUEUE) != 0)
+		ifp-if_start = wm_nq_start;
+	else
+		ifp-if_start = wm_start;
 	ifp-if_watchdog = wm_watchdog;
 	ifp-if_init = wm_init;
 	ifp-if_stop = wm_stop;
@@ -1926,9 +1934,7 @@ wm_attach(device_t parent, device_t self
 	/*
 	 * If we're a i82543 or greater, we can support VLANs.
 	 */
-	if (sc-sc_type == WM_T_82575 || sc-sc_type == WM_T_82576)
-		sc-sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
-	else if (sc-sc_type = WM_T_82543)
+	if (sc-sc_type = WM_T_82543)
 		sc-sc_ethercom.ec_capabilities |=
 		ETHERCAP_VLAN_MTU | ETHERCAP_VLAN_HWTAGGING;
 
@@ -2761,6 +2767,483 @@ wm_start(struct ifnet *ifp)
 }
 
 /*
+ * wm_nq_tx_offload:
+ *
+ *	Set up TCP/IP checksumming parameters for the
+ *	specified packet, for NEWQUEUE devices
+ */
+static int
+wm_nq_tx_offload(struct 

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

2012-09-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Sep  3 19:13:35 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: mfi_pci.c

Log Message:
Pull up following revision(s) (requested by jnemeth in ticket #536):
sys/dev/pci/mfi_pci.c: revision 1.17
PR/46877 - Wolfgang Stukenbrock -- missing definition for Symbios SAS 9261-8i


To generate a diff of this commit:
cvs rdiff -u -r1.12.16.2 -r1.12.16.3 src/sys/dev/pci/mfi_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/mfi_pci.c
diff -u src/sys/dev/pci/mfi_pci.c:1.12.16.2 src/sys/dev/pci/mfi_pci.c:1.12.16.3
--- src/sys/dev/pci/mfi_pci.c:1.12.16.2	Sat May 19 15:06:03 2012
+++ src/sys/dev/pci/mfi_pci.c	Mon Sep  3 19:13:35 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi_pci.c,v 1.12.16.2 2012/05/19 15:06:03 riz Exp $ */
+/* $NetBSD: mfi_pci.c,v 1.12.16.3 2012/09/03 19:13:35 riz Exp $ */
 /* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 04:40:08 brad Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom ma...@peereboom.us
@@ -17,7 +17,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mfi_pci.c,v 1.12.16.2 2012/05/19 15:06:03 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: mfi_pci.c,v 1.12.16.3 2012/09/03 19:13:35 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -85,6 +85,7 @@ static const struct mfi_pci_subtype mfi_
 
 static const struct mfi_pci_subtype mfi_gen2_subtypes[] = {
 	{ PCI_VENDOR_SYMBIOS,	0x9261,		SAS 9260-8i },
+	{ PCI_VENDOR_SYMBIOS,	0x9263,		SAS 9261-8i },
 	{ PCI_VENDOR_IBM,	0x03c7,		IBM ServeRAID M5014 SAS/SATA },
 	{ 0x0,			0,		 }
 };



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

2012-08-13 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Aug 13 20:27:12 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: eso.c

Log Message:
Pull up following revision(s) (requested by gson in ticket #494):
sys/dev/pci/eso.c: revision 1.61
Add missing locking calls to eso_attach() to avoid panic on boot.
Partly based on a patch from mrg.  Fixes PR kern/46791.


To generate a diff of this commit:
cvs rdiff -u -r1.59.4.1 -r1.59.4.2 src/sys/dev/pci/eso.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/eso.c
diff -u src/sys/dev/pci/eso.c:1.59.4.1 src/sys/dev/pci/eso.c:1.59.4.2
--- src/sys/dev/pci/eso.c:1.59.4.1	Wed Jun 13 19:17:43 2012
+++ src/sys/dev/pci/eso.c	Mon Aug 13 20:27:11 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: eso.c,v 1.59.4.1 2012/06/13 19:17:43 riz Exp $	*/
+/*	$NetBSD: eso.c,v 1.59.4.2 2012/08/13 20:27:11 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: eso.c,v 1.59.4.1 2012/06/13 19:17:43 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: eso.c,v 1.59.4.2 2012/08/13 20:27:11 riz Exp $);
 
 #include mpu.h
 
@@ -260,13 +260,16 @@ eso_attach(device_t parent, device_t sel
 	pci_intr_handle_t ih;
 	bus_addr_t vcbase;
 	const char *intrstring;
-	int idx;
+	int idx, error;
 	uint8_t a2mode, mvctl;
 
 	sc = device_private(self);
 	pa = aux;
 	aprint_naive(: Audio controller\n);
 
+	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
+
 	sc-sc_revision = PCI_REVISION(pa-pa_class);
 	aprint_normal(: ESS Solo-1 PCI AudioDrive );
 	if (sc-sc_revision 
@@ -314,7 +317,10 @@ eso_attach(device_t parent, device_t sel
 	PCI_COMMAND_MASTER_ENABLE);
 
 	/* Reset the device; bail out upon failure. */
-	if (eso_reset(sc) != 0) {
+	mutex_spin_enter(sc-sc_intr_lock);
+	error = eso_reset(sc);
+	mutex_spin_exit(sc-sc_intr_lock);
+	if (error != 0) {
 		aprint_error_dev(sc-sc_dev, can't reset\n);
 		return;
 	}
@@ -329,6 +335,8 @@ eso_attach(device_t parent, device_t sel
 	ESO_IO_IRQCTL_A1IRQ | ESO_IO_IRQCTL_A2IRQ | ESO_IO_IRQCTL_HVIRQ |
 	ESO_IO_IRQCTL_MPUIRQ);
 
+	mutex_spin_enter(sc-sc_intr_lock);
+
 	/* Set up A1's sample rate generator for new-style parameters. */
 	a2mode = eso_read_mixreg(sc, ESO_MIXREG_A2MODE);
 	a2mode |= ESO_MIXREG_A2MODE_NEWA1 | ESO_MIXREG_A2MODE_ASYNC;
@@ -373,17 +381,17 @@ eso_attach(device_t parent, device_t sel
 		sc-sc_gain[idx][ESO_LEFT] = sc-sc_gain[idx][ESO_RIGHT] = v;
 		eso_set_gain(sc, idx);
 	}
+
 	eso_set_recsrc(sc, ESO_MIXREG_ERS_MIC);
 
+	mutex_spin_exit(sc-sc_intr_lock);
+
 	/* Map and establish the interrupt. */
 	if (pci_intr_map(pa, ih)) {
 		aprint_error_dev(sc-sc_dev, couldn't map interrupt\n);
 		return;
 	}
 
-	mutex_init(sc-sc_lock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(sc-sc_intr_lock, MUTEX_DEFAULT, IPL_AUDIO);
-
 	intrstring = pci_intr_string(pa-pa_pc, ih);
 	sc-sc_ih  = pci_intr_establish(pa-pa_pc, ih, IPL_AUDIO, eso_intr, sc);
 	if (sc-sc_ih == NULL) {



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

2012-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 12 18:55:11 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_wpi.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #478):
sys/dev/pci/if_wpi.c: revision 1.53
Fix error branch in wpi(4) firmware loading.
Fixes panic if firmware is not available.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.2 -r1.50.2.3 src/sys/dev/pci/if_wpi.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_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.50.2.2 src/sys/dev/pci/if_wpi.c:1.50.2.3
--- src/sys/dev/pci/if_wpi.c:1.50.2.2	Tue May 22 18:36:33 2012
+++ src/sys/dev/pci/if_wpi.c	Sun Aug 12 18:55:10 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_wpi.c,v 1.50.2.2 2012/05/22 18:36:33 riz Exp $*/
+/*  $NetBSD: if_wpi.c,v 1.50.2.3 2012/08/12 18:55:10 martin Exp $*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.2 2012/05/22 18:36:33 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.3 2012/08/12 18:55:10 martin Exp $);
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -1148,7 +1148,7 @@ wpi_cache_firmware(struct wpi_softc *sc)
 	/* load firmware image from disk */
 	if ((error = firmware_open(if_wpi,iwlwifi-3945.ucode, fw)) != 0) {
 		aprint_error_dev(sc-sc_dev, could not read firmware file\n);
-		goto fail1;
+		goto fail0;
 	}
 
 	wpi_firmware_size = firmware_get_size(fw);
@@ -1192,8 +1192,9 @@ fail2:
 	firmware_free(wpi_firmware_image, wpi_firmware_size);
 fail1:
 	firmware_close(fw);
-	if (--wpi_firmware_users == 0)
-		firmware_free(wpi_firmware_image, wpi_firmware_size);
+fail0:
+	wpi_firmware_users--;
+	KASSERT(wpi_firmware_users == 0);
 	mutex_exit(wpi_firmware_mutex);
 	return error;
 }



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

2012-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Aug 12 18:58:29 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_msk.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #480):
sys/dev/pci/if_msk.c: revision 1.42
Fix null pointer dereference in msk_rxeof.
This triggers when processing an RX interrupt that was queued while
stopping the interface, which caused my machine to panic last night.
In this case, just drop the packet.
From OpenBSD's if_msk.c rev. 1.71.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.39 src/sys/dev/pci/if_msk.c:1.39.2.1
--- src/sys/dev/pci/if_msk.c:1.39	Thu Feb  2 19:43:05 2012
+++ src/sys/dev/pci/if_msk.c	Sun Aug 12 18:58:28 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.39 2012/02/02 19:43:05 tls Exp $ */
+/* $NetBSD: if_msk.c,v 1.39.2.1 2012/08/12 18:58:28 martin Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_msk.c,v 1.39 2012/02/02 19:43:05 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_msk.c,v 1.39.2.1 2012/08/12 18:58:28 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1703,8 +1703,10 @@ msk_rxeof(struct sk_if_softc *sc_if, u_i
 	MSK_CDRXSYNC(sc_if, cur, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE);
 
 	cur_rx = sc_if-sk_cdata.sk_rx_chain[cur];
-	dmamap = sc_if-sk_cdata.sk_rx_jumbo_map;
+	if (cur_rx-sk_mbuf == NULL)
+		return;
 
+	dmamap = sc_if-sk_cdata.sk_rx_jumbo_map;
 	bus_dmamap_sync(sc_if-sk_softc-sc_dmatag, dmamap, 0,
 	dmamap-dm_mapsize, BUS_DMASYNC_POSTREAD);
 



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

2012-08-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Aug  9 08:00:55 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #471):
sys/dev/pci/if_wm.c: revision 1.230
sys/dev/pci/if_wm.c: revision 1.231
  Add workaround for QEMU and the variants that fail on EEPROM access.
  This problem was discovered a few years ago, but some variants and
cloud services still have the bug. This problem is not NetBSD's bug
but qemus's bug. For NetBSD users, existence of buggy virtual machines
s sad thing, so we add a workaroud.
Fix the check of the device type in last commit.
Reported by Thomas Klausner.


To generate a diff of this commit:
cvs rdiff -u -r1.227.2.1 -r1.227.2.2 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.227.2.1 src/sys/dev/pci/if_wm.c:1.227.2.2
--- src/sys/dev/pci/if_wm.c:1.227.2.1	Thu Jun 28 16:06:36 2012
+++ src/sys/dev/pci/if_wm.c	Thu Aug  9 08:00:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.227.2.1 2012/06/28 16:06:36 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.227.2.2 2012/08/09 08:00:55 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.1 2012/06/28 16:06:36 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.227.2.2 2012/08/09 08:00:55 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -4628,6 +4628,22 @@ wm_read_eeprom_uwire(struct wm_softc *sc
 		reg = CSR_READ(sc, WMREG_EECD)  ~(EECD_SK | EECD_DI);
 		CSR_WRITE(sc, WMREG_EECD, reg);
 
+		/*
+		 * XXX: workaround for a bug in qemu-0.12.x and prior
+		 * and Xen.
+		 *
+		 * We use this workaround only for 82540 because qemu's
+		 * e1000 act as 82540.
+		 */
+		if (sc-sc_type == WM_T_82540) {
+			reg |= EECD_SK;
+			CSR_WRITE(sc, WMREG_EECD, reg);
+			reg = ~EECD_SK;
+			CSR_WRITE(sc, WMREG_EECD, reg);
+			delay(2);
+		}
+		/* XXX: end of workaround */
+		
 		/* Set CHIP SELECT. */
 		reg |= EECD_CS;
 		CSR_WRITE(sc, WMREG_EECD, reg);



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

2012-06-13 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Jun 13 19:17:43 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: eso.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #332):
sys/dev/pci/eso.c: revision 1.60
don't kassert that the sc_intr_lock is held in eso_reset().  it's only
called from attach and doesn't need to have it held, and PR 46451 shows
that it currently asserts.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.59.4.1 src/sys/dev/pci/eso.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/eso.c
diff -u src/sys/dev/pci/eso.c:1.59 src/sys/dev/pci/eso.c:1.59.4.1
--- src/sys/dev/pci/eso.c:1.59	Thu Nov 24 03:35:59 2011
+++ src/sys/dev/pci/eso.c	Wed Jun 13 19:17:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: eso.c,v 1.59 2011/11/24 03:35:59 mrg Exp $	*/
+/*	$NetBSD: eso.c,v 1.59.4.1 2012/06/13 19:17:43 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: eso.c,v 1.59 2011/11/24 03:35:59 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: eso.c,v 1.59.4.1 2012/06/13 19:17:43 riz Exp $);
 
 #include mpu.h
 
@@ -670,8 +670,6 @@ eso_reset(struct eso_softc *sc)
 {
 	int i;
 
-	KASSERT(mutex_owned(sc-sc_intr_lock));
-
 	bus_space_write_1(sc-sc_sb_iot, sc-sc_sb_ioh, ESO_SB_RESET,
 	ESO_SB_RESET_SW | ESO_SB_RESET_FIFO);
 	/* `Delay' suggested in the data sheet. */



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

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

Modified Files:
src/sys/dev/pci [netbsd-6]: machfb.c

Log Message:
Pull up following revision(s) (requested by macallan in ticket #322):
sys/dev/pci/machfb.c: revision 1.75
don't enable IO access - we don't use it and at least on some macppc machines
the IO BAR contains garbage
should probably be pulled into 6.0


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.2.1 src/sys/dev/pci/machfb.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/machfb.c
diff -u src/sys/dev/pci/machfb.c:1.73 src/sys/dev/pci/machfb.c:1.73.2.1
--- src/sys/dev/pci/machfb.c:1.73	Mon Jan 30 19:41:22 2012
+++ src/sys/dev/pci/machfb.c	Tue Jun 12 19:39:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machfb.c,v 1.73 2012/01/30 19:41:22 drochner Exp $	*/
+/*	$NetBSD: machfb.c,v 1.73.2.1 2012/06/12 19:39:49 riz Exp $	*/
 
 /*
  * Copyright (c) 2002 Bang Jun-Young
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 __KERNEL_RCSID(0, 
-	$NetBSD: machfb.c,v 1.73 2012/01/30 19:41:22 drochner Exp $);
+	$NetBSD: machfb.c,v 1.73.2.1 2012/06/12 19:39:49 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -513,7 +513,7 @@ mach64_attach(device_t parent, device_t 
 	int setmode, width, height;
 	pcireg_t screg;
 	uint32_t reg;
-	const pcireg_t enables = PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_IO_ENABLE;
+	const pcireg_t enables = PCI_COMMAND_MEM_ENABLE;
 
 	sc-sc_dev = self;
 	sc-sc_pc = pa-pa_pc;



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

2012-05-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue May 22 18:36:33 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_wpi.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #266):
sys/dev/pci/if_wpi.c: patch

Fix harmless typo which was previously pulled up.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.1 -r1.50.2.2 src/sys/dev/pci/if_wpi.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_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.50.2.1 src/sys/dev/pci/if_wpi.c:1.50.2.2
--- src/sys/dev/pci/if_wpi.c:1.50.2.1	Sat May 19 15:28:00 2012
+++ src/sys/dev/pci/if_wpi.c	Tue May 22 18:36:33 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_wpi.c,v 1.50.2.1 2012/05/19 15:28:00 riz Exp $*/
+/*  $NetBSD: if_wpi.c,v 1.50.2.2 2012/05/22 18:36:33 riz Exp $*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.1 2012/05/19 15:28:00 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.2 2012/05/22 18:36:33 riz Exp $);
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -310,7 +310,7 @@ wpi_attach(device_t parent __unused, dev
 
 	/* set device capabilities */
 	ic-ic_caps =
-#ifdef netyet
+#ifdef notyet
 		IEEE80211_C_IBSS |   /* IBSS mode support */
 #endif
 		IEEE80211_C_WPA |/* 802.11i */



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

2012-05-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sat May 19 15:28:01 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_wpi.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #266):
sys/dev/pci/if_wpi.c: revision 1.51
No longer wrongly advertise ad-hoc (IBSS) mode as being supported.
Fixes kern/46101
No objection from current-users@


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.50.2.1 src/sys/dev/pci/if_wpi.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_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.50 src/sys/dev/pci/if_wpi.c:1.50.2.1
--- src/sys/dev/pci/if_wpi.c:1.50	Mon Jan 30 19:41:21 2012
+++ src/sys/dev/pci/if_wpi.c	Sat May 19 15:28:00 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_wpi.c,v 1.50 2012/01/30 19:41:21 drochner Exp $*/
+/*  $NetBSD: if_wpi.c,v 1.50.2.1 2012/05/19 15:28:00 riz Exp $*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50 2012/01/30 19:41:21 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.50.2.1 2012/05/19 15:28:00 riz Exp $);
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -310,7 +310,9 @@ wpi_attach(device_t parent __unused, dev
 
 	/* set device capabilities */
 	ic-ic_caps =
+#ifdef netyet
 		IEEE80211_C_IBSS |   /* IBSS mode support */
+#endif
 		IEEE80211_C_WPA |/* 802.11i */
 		IEEE80211_C_MONITOR |/* monitor mode supported */
 		IEEE80211_C_TXPMGT | /* tx power management */



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

2012-05-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon May  7 03:10:28 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_bnxvar.h

Log Message:
Pull up following revision(s) (requested by gdt in ticket #208):
sys/dev/pci/if_bnxvar.h: revision 1.3
Use RX_PAGES for rx_bd_chain_{,r}seq.
Before, TX_PAGES was used, but no harm was done because TX_PAGES ==
RX_PAGES == 2.  Found by Frank Kastenholz of BBN.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 src/sys/dev/pci/if_bnxvar.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_bnxvar.h
diff -u src/sys/dev/pci/if_bnxvar.h:1.2 src/sys/dev/pci/if_bnxvar.h:1.2.8.1
--- src/sys/dev/pci/if_bnxvar.h:1.2	Fri Jul 15 11:29:31 2011
+++ src/sys/dev/pci/if_bnxvar.h	Mon May  7 03:10:28 2012
@@ -220,8 +220,8 @@ struct bnx_softc
 	bus_addr_t		tx_bd_chain_paddr[TX_PAGES];
 
 	/* H/W maintained RX buffer descriptor chain structure. */
-	bus_dma_segment_t	rx_bd_chain_seg[TX_PAGES];
-	int			rx_bd_chain_rseg[TX_PAGES];
+	bus_dma_segment_t	rx_bd_chain_seg[RX_PAGES];
+	int			rx_bd_chain_rseg[RX_PAGES];
 	bus_dmamap_t		rx_bd_chain_map[RX_PAGES];
 	struct rx_bd		*rx_bd_chain[RX_PAGES];
 	bus_addr_t		rx_bd_chain_paddr[RX_PAGES];



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

2012-04-23 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Apr 23 16:24:43 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #191):
sys/dev/pci/pcidevs: revision 1.1116
Add various newer LSI RAID/SAS controllers, from OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.4 -r1.1102.2.5 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.1102.2.4 src/sys/dev/pci/pcidevs:1.1102.2.5
--- src/sys/dev/pci/pcidevs:1.1102.2.4	Mon Apr 16 15:25:12 2012
+++ src/sys/dev/pci/pcidevs	Mon Apr 23 16:24:43 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.4 2012/04/16 15:25:12 riz Exp $
+$NetBSD: pcidevs,v 1.1102.2.5 2012/04/23 16:24:43 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3403,6 +3403,10 @@ product SYMBIOS SAS1064A		0x005C	SAS1064
 product SYMBIOS SAS1066			0x005E	SAS1066
 product SYMBIOS SAS1078			0x0060	SAS1078 PCI
 product SYMBIOS SAS1078_PCIE		0x0062	SAS1078 PCI Express
+product SYMBIOS SAS2116_1		0x0064	SAS2116
+product SYMBIOS SAS2116_2		0x0065	SAS2116
+product SYMBIOS SAS2308_3		0x006e	SAS2308
+product SYMBIOS SAS2004			0x0070	SAS2004
 product SYMBIOS SAS2008			0x0072	SAS2008
 product SYMBIOS SAS2008_1		0x0073	MegaRAID SAS2008
 product SYMBIOS SAS2108_3		0x0074	SAS2108
@@ -3411,6 +3415,14 @@ product SYMBIOS SAS2108_5		0x0077	SAS210
 product SYMBIOS SAS2108_1		0x0078	MegaRAID SAS2108 CRYPTO GEN2
 product SYMBIOS SAS2108_2		0x0079	MegaRAID SAS2108 GEN2
 product SYMBIOS SAS1078DE		0x007c	SAS1078DE
+product SYMBIOS SAS2208_1		0x0080	SAS2208
+product SYMBIOS SAS2208_2		0x0081	SAS2208
+product SYMBIOS SAS2208_3		0x0082	SAS2208
+product SYMBIOS SAS2208_4		0x0083	SAS2208
+product SYMBIOS SAS2208_5		0x0084	SAS2208
+product SYMBIOS SAS2208_6		0x0085	SAS2208
+product SYMBIOS SAS2308_1		0x0086	SAS2308
+product SYMBIOS SAS2308_2		0x0087	SAS2308
 product SYMBIOS 875J			0x008f	53c875J
 product SYMBIOS FC909			0x0620	FC909
 product SYMBIOS FC909A			0x0621	FC909A



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

2012-04-16 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Mon Apr 16 15:34:49 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: ohci_pci.c

Log Message:
Pull up following revision(s) (requested by macallan in ticket #182):
sys/dev/pci/ohci_pci.c: revision 1.49
abort attach if memory access is not enabled
this avoids a panic later on when trying to attach to an unconfigured ohci
found for example in later iBooks when DIAGNOSTIC is set


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/dev/pci/ohci_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/ohci_pci.c
diff -u src/sys/dev/pci/ohci_pci.c:1.48 src/sys/dev/pci/ohci_pci.c:1.48.2.1
--- src/sys/dev/pci/ohci_pci.c:1.48	Mon Jan 30 19:41:22 2012
+++ src/sys/dev/pci/ohci_pci.c	Mon Apr 16 15:34:49 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci_pci.c,v 1.48 2012/01/30 19:41:22 drochner Exp $	*/
+/*	$NetBSD: ohci_pci.c,v 1.48.2.1 2012/04/16 15:34:49 riz Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ohci_pci.c,v 1.48 2012/01/30 19:41:22 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: ohci_pci.c,v 1.48.2.1 2012/04/16 15:34:49 riz Exp $);
 
 #include ehci.h
 
@@ -96,6 +96,16 @@ ohci_pci_attach(device_t parent, device_
 
 	pci_aprint_devinfo(pa, USB Controller);
 
+	/* check if memory space access is enabled */
+	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+#ifdef DEBUG
+	printf(csr: %08x\n, csr);
+#endif
+	if ((csr  PCI_COMMAND_MEM_ENABLE) == 0) {
+		aprint_error_dev(self, memory access is disabled\n);
+		return;
+	}
+
 	/* Map I/O registers */
 	if (pci_mapreg_map(pa, PCI_CBMEM, PCI_MAPREG_TYPE_MEM, 0,
 			   sc-sc.iot, sc-sc.ioh, NULL, sc-sc.sc_size)) {
@@ -113,7 +123,6 @@ ohci_pci_attach(device_t parent, device_
 	sc-sc.sc_bus.dmatag = pa-pa_dmat;
 
 	/* 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);
 



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

2012-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Apr  3 15:38:31 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: jmide.c pcidevs

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #149):
sys/dev/pci/pcidevs: revision 1.1108
sys/dev/pci/jmide.c: revision 1.13
Add JMB 362 (as found on ASUS M5A99X motherboard)
Add match for JMB362 (with two SATA ports).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/dev/pci/jmide.c
cvs rdiff -u -r1.1102.2.1 -r1.1102.2.2 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/jmide.c
diff -u src/sys/dev/pci/jmide.c:1.12 src/sys/dev/pci/jmide.c:1.12.2.1
--- src/sys/dev/pci/jmide.c:1.12	Mon Jan 30 19:41:22 2012
+++ src/sys/dev/pci/jmide.c	Tue Apr  3 15:38:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: jmide.c,v 1.12 2012/01/30 19:41:22 drochner Exp $	*/
+/*	$NetBSD: jmide.c,v 1.12.2.1 2012/04/03 15:38:31 riz Exp $	*/
 
 /*
  * Copyright (c) 2007 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: jmide.c,v 1.12 2012/01/30 19:41:22 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: jmide.c,v 1.12.2.1 2012/04/03 15:38:31 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -68,6 +68,10 @@ static const struct jmide_product jm_pro
 	  1,
 	  1
 	},
+	{ PCI_PRODUCT_JMICRON_JMB362,
+	  0,
+	  2
+	},
 	{ PCI_PRODUCT_JMICRON_JMB363,
 	  1,
 	  2

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1102.2.1 src/sys/dev/pci/pcidevs:1.1102.2.2
--- src/sys/dev/pci/pcidevs:1.1102.2.1	Thu Mar 22 23:00:28 2012
+++ src/sys/dev/pci/pcidevs	Tue Apr  3 15:38:30 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.1 2012/03/22 23:00:28 riz Exp $
+$NetBSD: pcidevs,v 1.1102.2.2 2012/04/03 15:38:30 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3116,6 +3116,7 @@ product ITT ITT3204	0x0002	ITT3204 MPEG 
 /* JMicron products */
 product JMICRON	JMB360		0x2360 JMB360 SATA Controller
 product JMICRON	JMB361		0x2361 JMB361 SATA/PATA Controller
+product JMICRON	JMB362		0x2362 JMB362 SATA Controller
 product JMICRON	JMB363		0x2363 JMB363 SATA/PATA Controller
 product JMICRON	JMB365		0x2365 JMB365 SATA/PATA Controller
 product JMICRON	JMB366		0x2366 JMB366 SATA/PATA Controller



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

2012-04-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Apr  3 15:52:27 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: pcidevs viaide.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #151):
sys/dev/pci/viaide.c: revision 1.78
sys/dev/pci/pcidevs: revision 1.1106
Add VIA VX900 media system processor IDE controller.
PR/46166 from Hiroshi Tokuda.
Regen from pcidevs rev 1.1106:
Add VIA VX900 media system processor IDE controller.
PR/46166 from Hiroshi Tokuda.
Add UDMA support for VIA VX900 media system processor IDE controller.
PR/46166 from Hiroshi Tokuda.
This should be pulled up to netbsd-6, since ZOTAC ZBOX nano VD01
http://www.zotacusa.com/zbox-nano-vd01.html
exhibited at NetBSD booth in Open Source Conference 2012 Tokyo Spring
was favored by many people.


To generate a diff of this commit:
cvs rdiff -u -r1.1102.2.2 -r1.1102.2.3 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.77 -r1.77.2.1 src/sys/dev/pci/viaide.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.1102.2.2 src/sys/dev/pci/pcidevs:1.1102.2.3
--- src/sys/dev/pci/pcidevs:1.1102.2.2	Tue Apr  3 15:38:30 2012
+++ src/sys/dev/pci/pcidevs	Tue Apr  3 15:52:26 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102.2.2 2012/04/03 15:38:30 riz Exp $
+$NetBSD: pcidevs,v 1.1102.2.3 2012/04/03 15:52:26 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4682,6 +4682,7 @@ product VIATECH VT8501AGP	0x8501	VT8501 
 product VIATECH VT82C597AGP	0x8597	VT82C597 (Apollo VP3) CPU-AGP Bridge
 product VIATECH VT82C598AGP	0x8598	VT82C598 (Apollo MVP3) CPU-AGP Bridge
 product VIATECH VT8605AGP	0x8605	VT8605 (Apollo ProMedia 133) Host-AGP Bridge
+product VIATECH VX900_IDE	0x9001	VX900 IDE Controller
 product VIATECH K8T890_PPB_A238	0xa238	K8T890 PCI-PCI Bridge
 product VIATECH VT8633AGP	0xb091	VT8633 (Apollo Pro 266) CPU-AGP Bridge
 product VIATECH VT8366AGP	0xb099	VT8366 (Apollo KT266) CPU-AGP Bridge

Index: src/sys/dev/pci/viaide.c
diff -u src/sys/dev/pci/viaide.c:1.77 src/sys/dev/pci/viaide.c:1.77.2.1
--- src/sys/dev/pci/viaide.c:1.77	Wed Dec 28 20:28:04 2011
+++ src/sys/dev/pci/viaide.c	Tue Apr  3 15:52:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: viaide.c,v 1.77 2011/12/28 20:28:04 phx Exp $	*/
+/*	$NetBSD: viaide.c,v 1.77.2.1 2012/04/03 15:52:26 riz Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: viaide.c,v 1.77 2011/12/28 20:28:04 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: viaide.c,v 1.77.2.1 2012/04/03 15:52:26 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -310,6 +310,11 @@ static const struct pciide_product_desc 
 	  NULL,
 	  via_chip_map,
 	},
+	{ PCI_PRODUCT_VIATECH_VX900_IDE,
+	  0,
+	  NULL,
+	  via_chip_map,
+	},
 	{ PCI_PRODUCT_VIATECH_VT6410_RAID,
 	  0,
 	  NULL,
@@ -464,6 +469,11 @@ via_chip_map(struct pciide_softc *sc, co
 			interface = PCIIDE_INTERFACE_BUS_MASTER_DMA |
 			PCIIDE_INTERFACE_PCI(0) | PCIIDE_INTERFACE_PCI(1);
 			break;
+		case PCI_PRODUCT_VIATECH_VX900_IDE:
+			aprint_normal_dev(sc-sc_wdcdev.sc_atac.atac_dev,
+			VIA Technologies VX900 ATA133 controller\n);
+			sc-sc_wdcdev.sc_atac.atac_udma_cap = 6;
+			break;
 		default:
 			/*
 			 * get a PCI tag for the ISA bridge.



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

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

Modified Files:
src/sys/dev/pci [netbsd-6]: if_iwi.c

Log Message:
Pull up following revision(s) (requested by nisimura in ticket #134):
sys/dev/pci/if_iwi.c: revision 1.90
Unbreak the endian issue in firmware header decoding. Comfirmed good and
running by a powerpc machine.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.2.1 src/sys/dev/pci/if_iwi.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_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.89 src/sys/dev/pci/if_iwi.c:1.89.2.1
--- src/sys/dev/pci/if_iwi.c:1.89	Mon Jan 30 19:41:20 2012
+++ src/sys/dev/pci/if_iwi.c	Thu Mar 22 22:55:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.89 2012/01/30 19:41:20 drochner Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.89.2.1 2012/03/22 22:55:18 riz Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_iwi.c,v 1.89 2012/01/30 19:41:20 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_iwi.c,v 1.89.2.1 2012/03/22 22:55:18 riz Exp $);
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -2154,7 +2154,7 @@ iwi_cache_firmware(struct iwi_softc *sc)
 {
 	struct iwi_firmware *kfw = sc-fw;
 	firmware_handle_t fwh;
-	const struct iwi_firmware_hdr *hdr;
+	struct iwi_firmware_hdr *hdr;
 	off_t size;	
 	char *fw;
 	int error;
@@ -2192,8 +2192,12 @@ iwi_cache_firmware(struct iwi_softc *sc)
 	if (error != 0)
 		goto fail2;
 
+	hdr = (struct iwi_firmware_hdr *)sc-sc_blob;
+	hdr-version = le32toh(hdr-version);
+	hdr-bsize = le32toh(hdr-bsize);
+	hdr-usize = le32toh(hdr-usize);
+	hdr-fsize = le32toh(hdr-fsize);
 
-	hdr = (const struct iwi_firmware_hdr *)sc-sc_blob;
 	if (size  sizeof(struct iwi_firmware_hdr) + hdr-bsize + hdr-usize + hdr-fsize) {
 		aprint_error_dev(sc-sc_dev, image '%s' too small\n,
 		sc-sc_fwname);
@@ -2201,14 +2205,13 @@ iwi_cache_firmware(struct iwi_softc *sc)
 		goto fail2;
 	}
 
-	hdr = (const struct iwi_firmware_hdr *)sc-sc_blob;
-	DPRINTF((firmware version = %d\n, le32toh(hdr-version)));
-	if ((IWI_FW_GET_MAJOR(le32toh(hdr-version)) != IWI_FW_REQ_MAJOR) ||
-	(IWI_FW_GET_MINOR(le32toh(hdr-version)) != IWI_FW_REQ_MINOR)) {
+	DPRINTF((firmware version = %d\n, hdr-version));
+	if ((IWI_FW_GET_MAJOR(hdr-version) != IWI_FW_REQ_MAJOR) ||
+	(IWI_FW_GET_MINOR(hdr-version) != IWI_FW_REQ_MINOR)) {
 		aprint_error_dev(sc-sc_dev,
 		version for '%s' %d.%d != %d.%d\n, sc-sc_fwname,
-		IWI_FW_GET_MAJOR(le32toh(hdr-version)),
-		IWI_FW_GET_MINOR(le32toh(hdr-version)),
+		IWI_FW_GET_MAJOR(hdr-version),
+		IWI_FW_GET_MINOR(hdr-version),
 		IWI_FW_REQ_MAJOR, IWI_FW_REQ_MINOR);
 		error = EIO;
 		goto fail2;



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

2012-03-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar 22 23:00:29 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #137):
sys/dev/pci/pcidevs: revision 1.1107
Add some Symbios SAS2108 devices. Add new Symbios SAS2008 device (as used by
IBM ServeRAID M1015).


To generate a diff of this commit:
cvs rdiff -u -r1.1102 -r1.1102.2.1 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.1102 src/sys/dev/pci/pcidevs:1.1102.2.1
--- src/sys/dev/pci/pcidevs:1.1102	Wed Feb 15 16:26:00 2012
+++ src/sys/dev/pci/pcidevs	Thu Mar 22 23:00:28 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1102 2012/02/15 16:26:00 tsutsui Exp $
+$NetBSD: pcidevs,v 1.1102.2.1 2012/03/22 23:00:28 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -3395,6 +3395,10 @@ product SYMBIOS SAS1066			0x005E	SAS1066
 product SYMBIOS SAS1078			0x0060	SAS1078 PCI
 product SYMBIOS SAS1078_PCIE		0x0062	SAS1078 PCI Express
 product SYMBIOS SAS2008			0x0072	SAS2008
+product SYMBIOS SAS2008_1		0x0073	MegaRAID SAS2008
+product SYMBIOS SAS2108_3		0x0074	SAS2108
+product SYMBIOS SAS2108_4		0x0076	SAS2108
+product SYMBIOS SAS2108_5		0x0077	SAS2108
 product SYMBIOS SAS2108_1		0x0078	MegaRAID SAS2108 CRYPTO GEN2
 product SYMBIOS SAS2108_2		0x0079	MegaRAID SAS2108 GEN2
 product SYMBIOS SAS1078DE		0x007c	SAS1078DE



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

2012-03-21 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar 21 16:12:19 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: radeonfb.c radeonfbvar.h

Log Message:
Pull up following revision(s) (requested by macallan in ticket #132):
sys/dev/pci/radeonfb.c: revision 1.59
sys/dev/pci/radeonfbvar.h: revision 1.16
adjust the backlight control interface to match the other drivers ( genfb,
r128fb, voyagerfb etc. ) so the lid_switch script does the right thing
noticed by riz, I thought I fixed that a long time ago


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.53.2.1 src/sys/dev/pci/radeonfb.c
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/dev/pci/radeonfbvar.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/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.53 src/sys/dev/pci/radeonfb.c:1.53.2.1
--- src/sys/dev/pci/radeonfb.c:1.53	Mon Jan 30 19:41:23 2012
+++ src/sys/dev/pci/radeonfb.c	Wed Mar 21 16:12:18 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.53 2012/01/30 19:41:23 drochner Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.53.2.1 2012/03/21 16:12:18 riz Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: radeonfb.c,v 1.53 2012/01/30 19:41:23 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: radeonfb.c,v 1.53.2.1 2012/03/21 16:12:18 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -169,8 +169,9 @@ static void radeonfb_putchar(void *, int
 static void radeonfb_putchar_aa32(void *, int, int, unsigned, long);
 static void radeonfb_putchar_wrapper(void *, int, int, unsigned, long);
 
-static int radeonfb_get_backlight(struct radeonfb_display *);
 static int radeonfb_set_backlight(struct radeonfb_display *, int);
+static int radeonfb_get_backlight(struct radeonfb_display *);
+static void radeonfb_switch_backlight(struct radeonfb_display *, int);
 static void radeonfb_lvds_callout(void *);
 
 static void radeonfb_brightness_up(device_t);
@@ -900,11 +901,14 @@ radeonfb_attach(device_t parent, device_
 		config_found(sc-sc_dev, aa, wsemuldisplaydevprint);
 		
 		radeonfb_blank(dp, 0);
-		
+
 		/* Initialise delayed lvds operations for backlight. */
 		callout_init(dp-rd_bl_lvds_co, 0);
 		callout_setfunc(dp-rd_bl_lvds_co,
 radeonfb_lvds_callout, dp);
+		dp-rd_bl_on = 1;
+		dp-rd_bl_level = radeonfb_get_backlight(dp);
+		radeonfb_set_backlight(dp, dp-rd_bl_level);
 	}
 
 	/*
@@ -1051,18 +1055,29 @@ radeonfb_ioctl(void *v, void *vs,
 #endif
 	case WSDISPLAYIO_GETPARAM:
 		param = (struct wsdisplay_param *)d;
-		if (param-param == WSDISPLAYIO_PARAM_BACKLIGHT) {
+		switch (param-param) {
+		case WSDISPLAYIO_PARAM_BRIGHTNESS:
+			param-min = 0;
+			param-max = 255;
+			param-curval = dp-rd_bl_level;
+			return 0;
+		case WSDISPLAYIO_PARAM_BACKLIGHT:
 			param-min = 0;
 			param-max = RADEONFB_BACKLIGHT_MAX;
-			param-curval = radeonfb_get_backlight(dp);
+			param-curval = dp-rd_bl_on;
 			return 0;
 		}
 		return EPASSTHROUGH;
 
 	case WSDISPLAYIO_SETPARAM:
 		param = (struct wsdisplay_param *)d;
-		if (param-param == WSDISPLAYIO_PARAM_BACKLIGHT) {
-			return radeonfb_set_backlight(dp, param-curval);
+		switch (param-param) {
+		case WSDISPLAYIO_PARAM_BRIGHTNESS:
+			radeonfb_set_backlight(dp, param-curval);
+			return 0;
+		case WSDISPLAYIO_PARAM_BACKLIGHT:
+			radeonfb_switch_backlight(dp,  param-curval);
+			return 0;
 		}
 		return EPASSTHROUGH;
 
@@ -3578,6 +3593,14 @@ radeonfb_get_backlight(struct radeonfb_d
 }	
 
 /* Set the backlight to the given level for the display.  */
+static void 
+radeonfb_switch_backlight(struct radeonfb_display *dp, int on)
+{
+	if (dp-rd_bl_on == on)
+		return;
+	dp-rd_bl_on = on;
+	radeonfb_set_backlight(dp, dp-rd_bl_level);
+}
 
 static int 
 radeonfb_set_backlight(struct radeonfb_display *dp, int level)
@@ -3587,7 +3610,11 @@ radeonfb_set_backlight(struct radeonfb_d
 	uint32_t lvds;
 
 	s = spltty();
-	
+
+	dp-rd_bl_level = level;
+	if (dp-rd_bl_on == 0)
+		level = 0;
+
 	if (level  0)
 		level = 0;
 	else if (level = RADEONFB_BACKLIGHT_MAX)
@@ -3663,24 +3690,30 @@ static void
 radeonfb_brightness_up(device_t dev)
 {
 	struct radeonfb_softc *sc = device_private(dev);
+	struct radeonfb_display *dp = sc-sc_displays[0];
 	int level;
 
 	/* we assume the main display is the first one - need a better way */
 	if (sc-sc_ndisplays  1) return;
-	level = radeonfb_get_backlight(sc-sc_displays[0]);
+	/* make sure pushing the hotkeys always has an effect */
+	dp-rd_bl_on = 1;
+	level = dp-rd_bl_level;
 	level = min(RADEONFB_BACKLIGHT_MAX, level + 5);
-	radeonfb_set_backlight(sc-sc_displays[0], level);
+	radeonfb_set_backlight(dp, level);
 }
 
 static void
 radeonfb_brightness_down(device_t dev)
 {
 	struct radeonfb_softc *sc = device_private(dev);
+	struct radeonfb_display *dp = sc-sc_displays[0];
 	int level;
 
 	/* we assume the main display is the first one - need a better way 

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

2012-03-17 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Mar 17 17:26:07 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by lars in ticket #111):
sys/dev/pci/hdaudio/hdafg.c: revision 1.16
call kmem_free with the right address in hdafg_detach for sc_widgets
the former code let to memory corruption


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/dev/pci/hdaudio/hdafg.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.15 src/sys/dev/pci/hdaudio/hdafg.c:1.15.2.1
--- src/sys/dev/pci/hdaudio/hdafg.c:1.15	Wed Dec 21 02:16:57 2011
+++ src/sys/dev/pci/hdaudio/hdafg.c	Sat Mar 17 17:26:07 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.15.2.1 2012/03/17 17:26:07 bouyer Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.15 2011/12/21 02:16:57 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdafg.c,v 1.15.2.1 2012/03/17 17:26:07 bouyer Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -3733,7 +3733,7 @@ static int
 hdafg_detach(device_t self, int flags)
 {
 	struct hdafg_softc *sc = device_private(self);
-	struct hdaudio_widget *w = sc-sc_widgets;
+	struct hdaudio_widget *wl, *w = sc-sc_widgets;
 	struct hdaudio_assoc *as = sc-sc_assocs;
 	struct hdaudio_control *ctl = sc-sc_ctls;
 	struct hdaudio_mixer *mx = sc-sc_mixers;
@@ -3755,10 +3755,10 @@ hdafg_detach(device_t self, int flags)
 
 	/* restore bios pin widget configuration */
 	for (nid = sc-sc_startnode; nid  sc-sc_endnode; nid++) {
-		w = hdafg_widget_lookup(sc, nid);		
-		if (w == NULL || w-w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
+		wl = hdafg_widget_lookup(sc, nid);		
+		if (wl == NULL || wl-w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
 			continue;
-		hdafg_widget_setconfig(w, w-w_pin.biosconfig);
+		hdafg_widget_setconfig(wl, wl-w_pin.biosconfig);
 	}
 
 	if (w)



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

2012-03-08 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Mar  8 17:32:50 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: agp_amd64.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #95):
sys/dev/pci/agp_amd64.c: revision 1.7
- make agp_amd64_attach() also checks AMD64 Family 10h CPU's
  misc configuration devices
- print proper error message if no misc configuration device is found
Fixes kernel crash right after starting Xserver with radeondrm
on ASRock AM2NF3-VSTA (AM2 + nForce3 250 AGP) with Athlon II X2 CPU.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.14.1 src/sys/dev/pci/agp_amd64.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/agp_amd64.c
diff -u src/sys/dev/pci/agp_amd64.c:1.6 src/sys/dev/pci/agp_amd64.c:1.6.14.1
--- src/sys/dev/pci/agp_amd64.c:1.6	Sat Nov 13 13:52:04 2010
+++ src/sys/dev/pci/agp_amd64.c	Thu Mar  8 17:32:50 2012
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_amd64.c,v 1.6 2010/11/13 13:52:04 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_amd64.c,v 1.6.14.1 2012/03/08 17:32:50 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -224,13 +224,16 @@ agp_amd64_attach(device_t parent, device
 		tag = pci_make_tag(pa-pa_pc, 0, i, 3);
 		id = pci_conf_read(pa-pa_pc, tag, PCI_ID_REG);
 		if (PCI_VENDOR(id) == PCI_VENDOR_AMD 
-		PCI_PRODUCT(id) == PCI_PRODUCT_AMD_AMD64_MISC) {
+		(PCI_PRODUCT(id) == PCI_PRODUCT_AMD_AMD64_MISC ||
+		 PCI_PRODUCT(id) == PCI_PRODUCT_AMD_AMD64_F10_MISC)) {
 			asc-mctrl_tag[n] = tag;
 			n++;
 		}
 	}
-	if (n == 0)
+	if (n == 0) {
+		aprint_error(: No Miscellaneous Control unit found.\n);
 		return ENXIO;
+	}
 	asc-n_mctrl = n;
 
 	aprint_normal(: %d Miscellaneous Control unit(s) found.\n,



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

2012-03-07 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar  7 23:33:10 UTC 2012

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

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #98):
sys/dev/pci/piixide.c: revision 1.58
Add support for Intel 6 Series Serial ATA Controller


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.10.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/piixide.c
diff -u src/sys/dev/pci/piixide.c:1.57 src/sys/dev/pci/piixide.c:1.57.10.1
--- src/sys/dev/pci/piixide.c:1.57	Mon Apr  4 20:37:56 2011
+++ src/sys/dev/pci/piixide.c	Wed Mar  7 23:33:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: piixide.c,v 1.57 2011/04/04 20:37:56 dyoung Exp $	*/
+/*	$NetBSD: piixide.c,v 1.57.10.1 2012/03/07 23:33:10 riz Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: piixide.c,v 1.57 2011/04/04 20:37:56 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: piixide.c,v 1.57.10.1 2012/03/07 23:33:10 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -331,6 +331,30 @@ static const struct pciide_product_desc 
 	  Intel 3400 Serial ATA Controller,
 	  piixsata_chip_map,
 	},
+	{
+	  PCI_PRODUCT_INTEL_6SERIES_SATA_1,
+	  0,
+	  Intel 6 Series Serial ATA Controller,
+	  piixsata_chip_map,
+	},
+	{
+	  PCI_PRODUCT_INTEL_6SERIES_SATA_2,
+	  0,
+	  Intel 6 Series Serial ATA Controller,
+	  piixsata_chip_map,
+	},
+	{
+	  PCI_PRODUCT_INTEL_6SERIES_SATA_3,
+	  0,
+	  Intel 6 Series Serial ATA Controller,
+	  piixsata_chip_map,
+	},
+	{
+	  PCI_PRODUCT_INTEL_6SERIES_SATA_4,
+	  0,
+	  Intel 6 Series Serial ATA Controller,
+	  piixsata_chip_map,
+	},
 	{ 0,
 	  0,
 	  NULL,



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

2012-03-07 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar  7 23:36:10 UTC 2012

Modified Files:
src/sys/dev/pci [netbsd-6]: if_bnx.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #100):
sys/dev/pci/if_bnx.c: revision 1.46
bnx_start() is not MP-safe, so do not create the bnx_alloc_pkts()'s
workqueue MPSAFE. This could lead to bnx_start() being running at
the same time on 2 CPUs, with packets being sent twice.
Problem found and reported by Beverly Schwartz and Greg Troxel.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.8.1 src/sys/dev/pci/if_bnx.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_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.45 src/sys/dev/pci/if_bnx.c:1.45.8.1
--- src/sys/dev/pci/if_bnx.c:1.45	Thu Sep 22 08:42:53 2011
+++ src/sys/dev/pci/if_bnx.c	Wed Mar  7 23:36:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.45 2011/09/22 08:42:53 jym Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.45.8.1 2012/03/07 23:36:10 riz Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID($FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $);
 #endif
-__KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1.45 2011/09/22 08:42:53 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bnx.c,v 1.45.8.1 2012/03/07 23:36:10 riz Exp $);
 
 /*
  * The following controllers are supported by this driver:
@@ -707,7 +707,7 @@ bnx_attach(device_t parent, device_t sel
 
 	/* create workqueue to handle packet allocations */
 	if (workqueue_create(sc-bnx_wq, device_xname(self),
-	bnx_alloc_pkts, sc, PRI_NONE, IPL_NET, WQ_MPSAFE) != 0) {
+	bnx_alloc_pkts, sc, PRI_NONE, IPL_NET, 0) != 0) {
 		aprint_error_dev(self, failed to create workqueue\n);
 		goto bnx_attach_fail;
 	}