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

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

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

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

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

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

XXX pullup-[78]


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

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

Modified files:

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



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

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

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

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

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


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

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

Modified files:

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



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

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

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

Log Message:
Regen for ticket #1628


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

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

Modified files:

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

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



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

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

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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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

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

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

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

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


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

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

Modified files:

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

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/dev/pci/aceride.c
cvs rdiff -u -r1.12 -r1.12.38.1 src/sys/dev/pci/pciide_acer_reg.h

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

Modified files:

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

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.12 -r1.289.2.13 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.7 -r1.60.2.8 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/sys/dev/pci/if_wmvar.h

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

Modified files:

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

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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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

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



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

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

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.11 -r1.289.2.12 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.6 -r1.60.2.7 src/sys/dev/pci/if_wmreg.h

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

Modified files:

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

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

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

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

Log Message:
regen for ticket 1300


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

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

Modified files:

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

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



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

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

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

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


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

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

Modified files:

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

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



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

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

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

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


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

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

Modified files:

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

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

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

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

Log Message:
regen for ticket 1291


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

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

diffs are larger than 1MB and have been omitted


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

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

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

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


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

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

Modified files:

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

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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

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

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

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


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

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

Modified files:

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



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

2016-01-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jan 27 00:26:18 UTC 2016

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1078):
sys/dev/pci/agp_i810.c: revision 1.120
sys/dev/pci/agp_i810.c: revision 1.121
CID 1328433: Anding with 0 and comparing != 0 will not work very will.
Fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.112.2.4 -r1.112.2.5 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.112.2.4 src/sys/dev/pci/agp_i810.c:1.112.2.5
--- src/sys/dev/pci/agp_i810.c:1.112.2.4	Fri Nov  6 22:55:10 2015
+++ src/sys/dev/pci/agp_i810.c	Wed Jan 27 00:26:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.112.2.4 2015/11/06 22:55:10 riz Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.112.2.5 2016/01/27 00:26:18 snj Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.112.2.4 2015/11/06 22:55:10 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.112.2.5 2016/01/27 00:26:18 snj Exp $");
 
 #include 
 #include 
@@ -445,7 +445,7 @@ agp_i810_attach(device_t parent, device_
 	 */
 	mmadr_type = pci_mapreg_type(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag,
 	mmadr_bar);
-	if ((mmadr_type & PCI_MAPREG_TYPE_MEM) != PCI_MAPREG_TYPE_MEM) {
+	if (PCI_MAPREG_TYPE(mmadr_type) != PCI_MAPREG_TYPE_MEM) {
 		aprint_error_dev(self, "non-memory device MMIO registers\n");
 		error = ENXIO;
 		goto fail1;



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

2015-11-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov  6 22:52:55 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #995):
sys/dev/pci/viornd.c: revision 1.3
disable debug print by default


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/dev/pci/viornd.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/viornd.c
diff -u src/sys/dev/pci/viornd.c:1.1.2.2 src/sys/dev/pci/viornd.c:1.1.2.3
--- src/sys/dev/pci/viornd.c:1.1.2.2	Sun Nov  2 10:09:44 2014
+++ src/sys/dev/pci/viornd.c	Fri Nov  6 22:52:55 2015
@@ -1,4 +1,4 @@
-/* 	$NetBSD: viornd.c,v 1.1.2.2 2014/11/02 10:09:44 martin Exp $ */
+/* 	$NetBSD: viornd.c,v 1.1.2.3 2015/11/06 22:52:55 riz Exp $ */
 /*	$OpenBSD: viornd.c,v 1.1 2014/01/21 21:14:58 sf Exp $	*/
 
 /*
@@ -61,7 +61,7 @@
 
 #define	VIORND_BUFSIZE			32
 
-#define VIORND_DEBUG 1
+#define VIORND_DEBUG 0
 
 struct viornd_softc {
 	device_t		sc_dev;



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

2015-11-06 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov  6 22:55:10 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1000):
sys/dev/pci/agp_i810.c: revision 1.119
Fix mapping Intel graphics device registers.
- Accept either 32-bit or 64-bit mappings for all devices.
- Let the device always dictate size of the mapping.
- Explain why we don't have a statically fixed mapping size.
Fixes the main part of PR kern/50060.  Still a display mode issue
from one submitter, but it is almost certainly an unrelated issue.


To generate a diff of this commit:
cvs rdiff -u -r1.112.2.3 -r1.112.2.4 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.112.2.3 src/sys/dev/pci/agp_i810.c:1.112.2.4
--- src/sys/dev/pci/agp_i810.c:1.112.2.3	Thu Apr 23 07:31:16 2015
+++ src/sys/dev/pci/agp_i810.c	Fri Nov  6 22:55:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.112.2.3 2015/04/23 07:31:16 snj Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.112.2.4 2015/11/06 22:55:10 riz Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.112.2.3 2015/04/23 07:31:16 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: agp_i810.c,v 1.112.2.4 2015/11/06 22:55:10 riz Exp $");
 
 #include 
 #include 
@@ -407,47 +407,91 @@ agp_i810_attach(device_t parent, device_
 	}
 	aprint_naive("\n");
 
-	mmadr_type = PCI_MAPREG_TYPE_MEM;
+	/* Discriminate on the chipset to choose the relevant BARs.  */
 	switch (isc->chiptype) {
 	case CHIP_I915:
 	case CHIP_G33:
 		apbase = AGP_I915_GMADR;
 		mmadr_bar = AGP_I915_MMADR;
-		isc->size = 512*1024;
 		gtt_bar = AGP_I915_GTTADR;
 		gtt_off = ~(bus_size_t)0; /* XXXGCC */
 		break;
 	case CHIP_I965:
 		apbase = AGP_I965_GMADR;
 		mmadr_bar = AGP_I965_MMADR;
-		mmadr_type |= PCI_MAPREG_MEM_TYPE_64BIT;
-		if (pci_mapreg_info(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag,
-			AGP_I965_MMADR, mmadr_type, NULL, >size, NULL))
-			isc->size = 512*1024; /* XXX */
 		gtt_bar = 0;
 		gtt_off = AGP_I965_GTT;
 		break;
 	case CHIP_G4X:
 		apbase = AGP_I965_GMADR;
 		mmadr_bar = AGP_I965_MMADR;
-		mmadr_type |= PCI_MAPREG_MEM_TYPE_64BIT;
-		if (pci_mapreg_info(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag,
-			AGP_I965_MMADR, mmadr_type, NULL, >size, NULL))
-			isc->size = 512*1024; /* XXX */
 		gtt_bar = 0;
 		gtt_off = AGP_G4X_GTT;
 		break;
 	default:
 		apbase = AGP_I810_GMADR;
 		mmadr_bar = AGP_I810_MMADR;
-		if (pci_mapreg_info(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag,
-			AGP_I810_MMADR, mmadr_type, NULL, >size, NULL))
-			isc->size = 512*1024; /* XXX */
 		gtt_bar = 0;
 		gtt_off = AGP_I810_GTT;
 		break;
 	}
 
+	/*
+	 * Ensure the MMIO BAR is, in fact, a memory BAR.
+	 *
+	 * XXX This is required because we use pa_memt below.  It is
+	 * not a priori clear to me there is any other reason to
+	 * require this.
+	 */
+	mmadr_type = pci_mapreg_type(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag,
+	mmadr_bar);
+	if ((mmadr_type & PCI_MAPREG_TYPE_MEM) != PCI_MAPREG_TYPE_MEM) {
+		aprint_error_dev(self, "non-memory device MMIO registers\n");
+		error = ENXIO;
+		goto fail1;
+	}
+
+	/*
+	 * Determine the size of the MMIO registers.
+	 *
+	 * XXX The size of the MMIO registers we use is statically
+	 * determined, as a function of the chipset, by the driver's
+	 * implementation.
+	 *
+	 * On some chipsets, the GTT is part of the MMIO register BAR.
+	 * We would like to map the GTT separately, so that we can map
+	 * it prefetchable, which we can't do with the MMIO registers.
+	 * Consequently, we would especially like to map a fixed size
+	 * of MMIO registers, not just whatever size the BAR says.
+	 *
+	 * However, old drm assumes that the combined GTT/MMIO register
+	 * space is a single bus space mapping, so mapping them
+	 * separately breaks that.  Once we rip out old drm, we can
+	 * replace the pci_mapreg_info call by the chipset switch.
+	 */
+#if notyet
+	switch (isc->chiptype) {
+	case CHIP_I810:
+	case CHIP_I830:
+	case CHIP_I855:
+	case CHIP_I915:
+	case CHIP_G33:
+	case CHIP_I965:
+	case CHIP_G4X:
+		isc->size = 512*1024;
+		break;
+	case CHIP_SANDYBRIDGE:
+	case CHIP_IVYBRIDGE:
+	case CHIP_HASWELL:
+		isc->size = 2*1024*1024;
+		break;
+	}
+#else
+	if (pci_mapreg_info(isc->vga_pa.pa_pc, isc->vga_pa.pa_tag,
+		mmadr_bar, mmadr_type, NULL, >size, NULL))
+		isc->size = 512*1024;
+#endif	/* notyet */
+
 	/* Map (or, rather, find the address and size of) the aperture.  */
 	if (isc->chiptype == CHIP_I965 || isc->chiptype == CHIP_G4X)
 		error = agp_i965_map_aperture(>vga_pa, sc, apbase);



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

2015-11-05 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Fri Nov  6 00:50:52 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #987):
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.71.4.1 -r1.71.4.2 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.15.4.1 -r1.15.4.2 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.71.4.1 src/sys/dev/pci/if_iwn.c:1.71.4.2
--- src/sys/dev/pci/if_iwn.c:1.71.4.1	Wed Jan 28 19:00:28 2015
+++ src/sys/dev/pci/if_iwn.c	Fri Nov  6 00:50:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwn.c,v 1.71.4.1 2015/01/28 19:00:28 martin Exp $	*/
+/*	$NetBSD: if_iwn.c,v 1.71.4.2 2015/11/06 00:50:52 riz Exp $	*/
 /*	$OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  * adapters.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.71.4.1 2015/01/28 19:00:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.71.4.2 2015/11/06 00:50:52 riz Exp $");
 
 #define IWN_USE_RBUF	/* Use local storage for RX */
 #undef IWN_HWCRYPTO	/* XXX does not even compile yet */
@@ -330,7 +330,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)
@@ -1860,7 +1861,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);
@@ -2083,7 +2084,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;
@@ -2514,6 +2515,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;
 			}
@@ -6505,8 +6508,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;
@@ -6522,6 +6527,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.15.4.1 src/sys/dev/pci/if_iwnvar.h:1.15.4.2
--- src/sys/dev/pci/if_iwnvar.h:1.15.4.1	Wed Jan 28 19:00:28 2015
+++ src/sys/dev/pci/if_iwnvar.h	Fri Nov  6 00:50:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwnvar.h,v 1.15.4.1 2015/01/28 19:00:28 martin Exp $	*/
+/*	$NetBSD: if_iwnvar.h,v 1.15.4.2 2015/11/06 00:50:52 riz Exp $	*/
 /*	$OpenBSD: if_iwnvar.h,v 1.28 2014/09/09 18:55:08 sthen Exp $	*/
 
 /*-
@@ -221,8 +221,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-7] src/sys/dev/pci/hdaudio

2015-11-04 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Nov  4 20:55:48 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #898):
sys/dev/pci/hdaudio/hdaudio.c: revision 1.2
Initialize dma.dma_sizereg to avoid copying uninitialized data later.
This field is not actually used here -- not clear it should be in
the hdaudio_dma structure at all.
Noted by Coverity, CID 979553.


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

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio.c
diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.22.2.1 src/sys/dev/pci/hdaudio/hdaudio.c:1.22.2.2
--- src/sys/dev/pci/hdaudio/hdaudio.c:1.22.2.1	Fri Sep  4 15:07:08 2015
+++ src/sys/dev/pci/hdaudio/hdaudio.c	Wed Nov  4 20:55:48 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.22.2.1 2015/09/04 15:07:08 martin Exp $ */
+/* $NetBSD: hdaudio.c,v 1.22.2.2 2015/11/04 20:55:48 riz Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22.2.1 2015/09/04 15:07:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22.2.2 2015/11/04 20:55:48 riz Exp $");
 
 #include 
 #include 
@@ -1027,6 +1027,7 @@ hdaudio_stream_establish(struct hdaudio_
 	int i, err;
 
 	dma.dma_size = sizeof(struct hdaudio_bdl_entry) * HDAUDIO_BDL_MAX;
+	dma.dma_sizereg = 0;
 	err = hdaudio_dma_alloc(sc, , BUS_DMA_COHERENT | BUS_DMA_NOCACHE);
 	if (err)
 		return NULL;



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

2015-09-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Sep  4 15:07:08 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #963):
sys/dev/pci/hdaudio/hdafg.c: revision 1.26
sys/dev/pci/hdaudio/hdaudiovar.h: revision 1.10
sys/dev/pci/hdaudio/hdaudio.c: revision 1.25
Fix locking against myself problem:
hdaudio_intr() ->
mutex_enter(>sc_corb_mtx);
hdaudio_rirb_dequeue() ->
hdaudio_rirb_unsol() ->
hdafg_unsol() ->
hdafg_assoc_dump_dd() ->
hdaudio_command() ->
mutex_enter(>sc_corb_mtx);
Should that be done differently?


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.2.1 src/sys/dev/pci/hdaudio/hdafg.c
cvs rdiff -u -r1.22 -r1.22.2.1 src/sys/dev/pci/hdaudio/hdaudio.c
cvs rdiff -u -r1.9 -r1.9.30.1 src/sys/dev/pci/hdaudio/hdaudiovar.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/hdaudio/hdafg.c
diff -u src/sys/dev/pci/hdaudio/hdafg.c:1.21 src/sys/dev/pci/hdaudio/hdafg.c:1.21.2.1
--- src/sys/dev/pci/hdaudio/hdafg.c:1.21	Fri May 23 13:57:04 2014
+++ src/sys/dev/pci/hdaudio/hdafg.c	Fri Sep  4 15:07:08 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $ */
+/* $NetBSD: hdafg.c,v 1.21.2.1 2015/09/04 15:07:08 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21.2.1 2015/09/04 15:07:08 martin Exp $");
 
 #include 
 #include 
@@ -834,21 +834,24 @@ hdafg_assoc_type_string(struct hdaudio_a
 }
 
 static void
-hdafg_assoc_dump_dd(struct hdafg_softc *sc, struct hdaudio_assoc *as, int pin)
+hdafg_assoc_dump_dd(struct hdafg_softc *sc, struct hdaudio_assoc *as, int pin,
+	int lock)
 {
 	struct hdafg_dd_info hdi;
 	struct hdaudio_widget *w;
 	uint8_t elddata[256];
 	unsigned int elddatalen = 0, i;
 	uint32_t res;
+	uint32_t (*cmd)(struct hdaudio_codec *, int, uint32_t, uint32_t) =
+	lock ? hdaudio_command : hdaudio_command_unlocked;
 
 	w = hdafg_widget_lookup(sc, as->as_pins[pin]);
 
 	if (w->w_pin.cap & COP_PINCAP_TRIGGER_REQD) {
-		hdaudio_command(sc->sc_codec, as->as_pins[pin],
+		(*cmd)(sc->sc_codec, as->as_pins[pin],
 		CORB_SET_PIN_SENSE, 0);
 	}
-	res = hdaudio_command(sc->sc_codec, as->as_pins[pin],
+	res = (*cmd)(sc->sc_codec, as->as_pins[pin],
 	CORB_GET_PIN_SENSE, 0);
 
 #ifdef HDAFG_HDMI_DEBUG
@@ -862,13 +865,13 @@ hdafg_assoc_dump_dd(struct hdafg_softc *
 	if ((res &
 	(COP_GET_PIN_SENSE_PRESENSE_DETECT|COP_GET_PIN_SENSE_ELD_VALID)) ==
 	(COP_GET_PIN_SENSE_PRESENSE_DETECT|COP_GET_PIN_SENSE_ELD_VALID)) {
-		res = hdaudio_command(sc->sc_codec, as->as_pins[pin],
+		res = (*cmd)(sc->sc_codec, as->as_pins[pin],
 		CORB_GET_HDMI_DIP_SIZE, COP_DIP_ELD_SIZE);
 		elddatalen = COP_DIP_BUFFER_SIZE(res);
 		if (elddatalen == 0)
 			elddatalen = sizeof(elddata); /* paranoid */
 		for (i = 0; i < elddatalen; i++) {
-			res = hdaudio_command(sc->sc_codec, as->as_pins[pin],
+			res = (*cmd)(sc->sc_codec, as->as_pins[pin],
 			CORB_GET_HDMI_ELD_DATA, i);
 			if (!(res & COP_ELD_VALID)) {
 hda_error(sc, "bad ELD size (%u/%u)\n",
@@ -1087,7 +1090,7 @@ hdafg_assoc_dump(struct hdafg_softc *sc)
 			for (j = 0; j < HDAUDIO_MAXPINS; j++) {
 if (as[i].as_pins[j] == 0)
 	continue;
-hdafg_assoc_dump_dd(sc, [i], j);
+hdafg_assoc_dump_dd(sc, [i], j, 1);
 			}
 		}
 	}
@@ -4264,7 +4267,7 @@ hdafg_unsol(device_t self, uint8_t tag)
 			for (j = 0; j < HDAUDIO_MAXPINS; j++) {
 if (as[i].as_pins[j] == 0)
 	continue;
-hdafg_assoc_dump_dd(sc, [i], j);
+hdafg_assoc_dump_dd(sc, [i], j, 0);
 			}
 		}
 		break;

Index: src/sys/dev/pci/hdaudio/hdaudio.c
diff -u src/sys/dev/pci/hdaudio/hdaudio.c:1.22 src/sys/dev/pci/hdaudio/hdaudio.c:1.22.2.1
--- src/sys/dev/pci/hdaudio/hdaudio.c:1.22	Fri Jul 25 08:10:38 2014
+++ src/sys/dev/pci/hdaudio/hdaudio.c	Fri Sep  4 15:07:08 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $ */
+/* $NetBSD: hdaudio.c,v 1.22.2.1 2015/09/04 15:07:08 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22.2.1 2015/09/04 15:07:08 martin Exp $");
 
 #include 
 #include 
@@ -326,15 +326,25 @@ uint32_t
 hdaudio_command(struct hdaudio_codec *co, int nid, uint32_t control,
 uint32_t param)
 {
+	uint32_t result;
+	struct hdaudio_softc *sc = co->co_host;
+	

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

2015-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug  4 21:14:49 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #913):
sys/dev/pci/if_ti.c: revisions 1.94, 1.95
fix mbuf leak on failure (Brainy)
--
Memory leak. Same as r1.93. I don't know why Brainy didn't detect it
earlier; or perhaps I forgot to report it.
Found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.93.4.1 src/sys/dev/pci/if_ti.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_ti.c
diff -u src/sys/dev/pci/if_ti.c:1.93 src/sys/dev/pci/if_ti.c:1.93.4.1
--- src/sys/dev/pci/if_ti.c:1.93	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/if_ti.c	Tue Aug  4 21:14:49 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ti.c,v 1.93 2014/03/29 19:28:25 christos Exp $ */
+/* $NetBSD: if_ti.c,v 1.93.4.1 2015/08/04 21:14:49 snj Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ti.c,v 1.93 2014/03/29 19:28:25 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ti.c,v 1.93.4.1 2015/08/04 21:14:49 snj Exp $);
 
 #include opt_inet.h
 
@@ -733,6 +733,7 @@ ti_newbuf_std(struct ti_softc *sc, int i
 BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
 			aprint_error_dev(sc-sc_dev, can't load recv map, error = %d\n,
 			   error);
+			m_freem(m_new);
 			return (ENOMEM);
 		}
 	} else {
@@ -799,6 +800,7 @@ ti_newbuf_mini(struct ti_softc *sc, int 
 BUS_DMA_READ|BUS_DMA_NOWAIT)) != 0) {
 			aprint_error_dev(sc-sc_dev, can't load recv map, error = %d\n,
 			   error);
+			m_freem(m_new);
 			return (ENOMEM);
 		}
 	} else {



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

2015-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Aug  4 21:16:43 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #914):
sys/dev/pci/if_et.c: revision 1.9
Use-after-free.
ok christos@
Found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.4.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.8 src/sys/dev/pci/if_et.c:1.8.4.1
--- src/sys/dev/pci/if_et.c:1.8	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_et.c	Tue Aug  4 21:16:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.8 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: if_et.c,v 1.8.4.1 2015/08/04 21:16:43 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 sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.8 2014/03/29 19:28:24 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.8.4.1 2015/08/04 21:16:43 snj Exp $);
 
 #include opt_inet.h
 #include vlan.h
@@ -1823,7 +1823,6 @@ et_encap(struct et_softc *sc, struct mbu
 
 		MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 		if (m_new == NULL) {
-			m_freem(m);
 			aprint_error_dev(sc-sc_dev, can't defrag TX mbuf\n);
 			error = ENOBUFS;
 			goto back;
@@ -1833,7 +1832,6 @@ et_encap(struct et_softc *sc, struct mbu
 		if (m-m_pkthdr.len  MHLEN) {
 			MCLGET(m_new, M_DONTWAIT);
 			if (!(m_new-m_flags  M_EXT)) {
-m_freem(m);
 m_freem(m_new);
 error = ENOBUFS;
 			}



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

2015-07-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Jul 30 15:19:07 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #887):
sys/dev/pci/oboe.c: revision 1.43
Pass the device, not the struct softc to config_found().
Avoids a crash at attach time, PR port-i386/50076.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/dev/pci/oboe.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/oboe.c
diff -u src/sys/dev/pci/oboe.c:1.42 src/sys/dev/pci/oboe.c:1.42.4.1
--- src/sys/dev/pci/oboe.c:1.42	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/oboe.c	Thu Jul 30 15:19:07 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: oboe.c,v 1.42 2014/03/29 19:28:25 christos Exp $	*/
+/*	$NetBSD: oboe.c,v 1.42.4.1 2015/07/30 15:19:07 snj Exp $	*/
 
 /*	FVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage	*/
 
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: oboe.c,v 1.42 2014/03/29 19:28:25 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: oboe.c,v 1.42.4.1 2015/07/30 15:19:07 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -238,7 +238,7 @@ oboe_attach(device_t parent, device_t se
 
 	oboe_alloc_taskfile(sc);
 
-	sc-sc_child = config_found((void *)sc, ia, ir_print);
+	sc-sc_child = config_found(self, ia, ir_print);
 }
 
 static int



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

2015-07-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jul 30 09:23:05 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #889):
sys/dev/pci/if_bge.c: revision 1.283
sys/dev/pci/if_pcn.c: revision 1.60
Fix mbuf leaks in error branches (found by the Brainy code scanner)


To generate a diff of this commit:
cvs rdiff -u -r1.277.2.2 -r1.277.2.3 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.58 -r1.58.2.1 src/sys/dev/pci/if_pcn.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.277.2.2 src/sys/dev/pci/if_bge.c:1.277.2.3
--- src/sys/dev/pci/if_bge.c:1.277.2.2	Sat May  9 08:37:53 2015
+++ src/sys/dev/pci/if_bge.c	Thu Jul 30 09:23:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.277.2.2 2015/05/09 08:37:53 snj Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.277.2.3 2015/07/30 09:23:05 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.277.2.2 2015/05/09 08:37:53 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.277.2.3 2015/07/30 09:23:05 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1744,8 +1744,10 @@ bge_newbuf_std(struct bge_softc *sc, int
 	if (!(sc-bge_flags  BGEF_RX_ALIGNBUG))
 	m_adj(m_new, ETHER_ALIGN);
 	if (bus_dmamap_load_mbuf(sc-bge_dmatag, dmamap, m_new,
-	BUS_DMA_READ|BUS_DMA_NOWAIT))
+	BUS_DMA_READ|BUS_DMA_NOWAIT)) {
+		m_freem(m_new);
 		return ENOBUFS;
+	}
 	bus_dmamap_sync(sc-bge_dmatag, dmamap, 0, dmamap-dm_mapsize,
 	BUS_DMASYNC_PREREAD);
 

Index: src/sys/dev/pci/if_pcn.c
diff -u src/sys/dev/pci/if_pcn.c:1.58 src/sys/dev/pci/if_pcn.c:1.58.2.1
--- src/sys/dev/pci/if_pcn.c:1.58	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/pci/if_pcn.c	Thu Jul 30 09:23:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_pcn.c,v 1.58 2014/08/10 16:44:36 tls Exp $	*/
+/*	$NetBSD: if_pcn.c,v 1.58.2.1 2015/07/30 09:23:05 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_pcn.c,v 1.58 2014/08/10 16:44:36 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_pcn.c,v 1.58.2.1 2015/07/30 09:23:05 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -982,6 +982,7 @@ pcn_start(struct ifnet *ifp)
 printf(%s: unable to load Tx buffer, 
 error = %d\n, device_xname(sc-sc_dev),
 error);
+m_freem(m);
 break;
 			}
 		}



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

2015-07-16 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Jul 17 04:44:42 UTC 2015

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

Log Message:
Apply patch (requested by nonaka in ticket #881):
Deregister pmf hook when attach failed.


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

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.1 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.2
--- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.1	Thu Oct 30 10:36:52 2014
+++ src/sys/dev/pci/hdaudio/hdaudio_pci.c	Fri Jul 17 04:44:41 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.12.4.1 2014/10/30 10:36:52 martin Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.12.4.2 2015/07/17 04:44:41 snj Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio_pci.c,v 1.12.4.1 2014/10/30 10:36:52 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio_pci.c,v 1.12.4.2 2015/07/17 04:44:41 snj Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -172,6 +172,7 @@ hdaudio_pci_attach(device_t parent, devi
 		csr = pci_conf_read(sc-sc_pc, sc-sc_tag, PCI_COMMAND_STATUS_REG);
 		csr = ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE);
 		pci_conf_write(sc-sc_pc, sc-sc_tag, PCI_COMMAND_STATUS_REG, csr);
+		pmf_device_deregister(self);
 	}
 }
 



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

2015-06-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Jun 10 16:43:51 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #833):
sys/dev/pci/if_wm.c: revisions 1.322, 1.323
sys/dev/pci/if_wmreg.h: revision 1.72
- Currently, WM_F_EEE bit is not set on all chips. It's intened to not
  to use all of EEE fuctions but wm_set_eee_i350() leaves IPCNFG_10BASE_TE
  bit and it causes link negotiation problem on some old switches. Disable
  10BASE-Te function, too.
- Call wm_set_eee_i350() on some chips, too.
--
Fix a bug that flags related to semaphore were incorrectly checked in
wm_kmrn_{readreg,writereg}. i80003, ICH* and PCH* had this problem.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.7 -r1.289.2.8 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.7 src/sys/dev/pci/if_wm.c:1.289.2.8
--- src/sys/dev/pci/if_wm.c:1.289.2.7	Tue May 19 05:09:02 2015
+++ src/sys/dev/pci/if_wm.c	Wed Jun 10 16:43:51 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.7 2015/05/19 05:09:02 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.8 2015/06/10 16:43:51 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.7 2015/05/19 05:09:02 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.8 2015/06/10 16:43:51 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3766,7 +3766,7 @@ wm_reset(struct wm_softc *sc)
 	/* reload sc_ctrl */
 	sc-sc_ctrl = CSR_READ(sc, WMREG_CTRL);
 
-	if (sc-sc_type == WM_T_I350)
+	if ((sc-sc_type = WM_T_I350)  (sc-sc_type = WM_T_I211))
 		wm_set_eee_i350(sc);
 
 	/* dummy read from WUC */
@@ -7240,13 +7240,13 @@ wm_kmrn_readreg(struct wm_softc *sc, int
 {
 	int rv;
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW) {
+	if (sc-sc_flags  WM_F_LOCK_SWFW) {
 		if (wm_get_swfw_semaphore(sc, SWFW_MAC_CSR_SM)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
 			return 0;
 		}
-	} else if (sc-sc_flags == WM_F_LOCK_EXTCNF) {
+	} else if (sc-sc_flags  WM_F_LOCK_EXTCNF) {
 		if (wm_get_swfwhw_semaphore(sc)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
@@ -7262,9 +7262,9 @@ wm_kmrn_readreg(struct wm_softc *sc, int
 
 	rv = CSR_READ(sc, WMREG_KUMCTRLSTA)  KUMCTRLSTA_MASK;
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW)
+	if (sc-sc_flags  WM_F_LOCK_SWFW)
 		wm_put_swfw_semaphore(sc, SWFW_MAC_CSR_SM);
-	else if (sc-sc_flags == WM_F_LOCK_EXTCNF)
+	else if (sc-sc_flags  WM_F_LOCK_EXTCNF)
 		wm_put_swfwhw_semaphore(sc);
 
 	return rv;
@@ -7279,13 +7279,13 @@ static void
 wm_kmrn_writereg(struct wm_softc *sc, int reg, int val)
 {
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW) {
+	if (sc-sc_flags  WM_F_LOCK_SWFW) {
 		if (wm_get_swfw_semaphore(sc, SWFW_MAC_CSR_SM)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
 			return;
 		}
-	} else if (sc-sc_flags == WM_F_LOCK_EXTCNF) {
+	} else if (sc-sc_flags  WM_F_LOCK_EXTCNF) {
 		if (wm_get_swfwhw_semaphore(sc)) {
 			aprint_error_dev(sc-sc_dev,
 			%s: failed to get semaphore\n, __func__);
@@ -7297,9 +7297,9 @@ wm_kmrn_writereg(struct wm_softc *sc, in
 	((reg  KUMCTRLSTA_OFFSET_SHIFT)  KUMCTRLSTA_OFFSET) |
 	(val  KUMCTRLSTA_MASK));
 
-	if (sc-sc_flags == WM_F_LOCK_SWFW)
+	if (sc-sc_flags  WM_F_LOCK_SWFW)
 		wm_put_swfw_semaphore(sc, SWFW_MAC_CSR_SM);
-	else if (sc-sc_flags == WM_F_LOCK_EXTCNF)
+	else if (sc-sc_flags  WM_F_LOCK_EXTCNF)
 		wm_put_swfwhw_semaphore(sc);
 }
 
@@ -9535,6 +9535,7 @@ wm_set_eee_i350(struct wm_softc *sc)
 		| EEER_LPI_FC);
 	} else {
 		ipcnfg = ~(IPCNFG_EEE_1G_AN | IPCNFG_EEE_100M_AN);
+		ipcnfg = ~IPCNFG_10BASE_TE;
 		eeer = ~(EEER_TX_LPI_EN | EEER_RX_LPI_EN
 		| EEER_LPI_FC);
 	}

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.60.2.3 src/sys/dev/pci/if_wmreg.h:1.60.2.4
--- src/sys/dev/pci/if_wmreg.h:1.60.2.3	Tue May 19 05:09:02 2015
+++ src/sys/dev/pci/if_wmreg.h	Wed Jun 10 16:43:51 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.60.2.3 2015/05/19 05:09:02 snj Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.60.2.4 2015/06/10 16:43:51 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -642,6 +642,7 @@ struct livengood_tcpip_ctxdesc {
 #define EEER_EEER_TX_LPI_STATUS	0x8000 /* EEER Tx in LPI state */
 #define WMREG_EEE_SU	0x0e34	/* EEE Setup */
 #define WMREG_IPCNFG	0x0e38	/* Internal PHY Configuration */
+#define IPCNFG_10BASE_TE	0x0002 /* IPCNFG 10BASE-Te low power op. */
 #define IPCNFG_EEE_100M_AN	0x0004 /* IPCNFG EEE Ena 100M AN */
 #define IPCNFG_EEE_1G_AN	0x0008 /* IPCNFG EEE Ena 1G AN */
 



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

2015-05-18 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 19 05:09:02 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #784):
sys/dev/pci/if_wm.c: revision 1.321
sys/dev/pci/if_wmreg.h: revision 1.71
sys/dev/pci/if_wmvar.h: 1.24 via patch
Add support iNVM (integrated Non-Volatile Memory) for I21[01].
This change fixes a bug that a MAC address is wrongly set on
iNVM machines/NICs.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.6 -r1.289.2.7 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.19.2.2 -r1.19.2.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.289.2.6 src/sys/dev/pci/if_wm.c:1.289.2.7
--- src/sys/dev/pci/if_wm.c:1.289.2.6	Sun Apr 19 06:50:22 2015
+++ src/sys/dev/pci/if_wm.c	Tue May 19 05:09:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.6 2015/04/19 06:50:22 riz Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.7 2015/05/19 05:09:02 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.6 2015/04/19 06:50:22 riz Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.7 2015/05/19 05:09:02 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -658,10 +658,14 @@ static int32_t	wm_read_ich8_data(struct 
 static int32_t	wm_read_ich8_byte(struct wm_softc *, uint32_t, uint8_t *);
 static int32_t	wm_read_ich8_word(struct wm_softc *, uint32_t, uint16_t *);
 static int	wm_nvm_read_ich8(struct wm_softc *, int, int, uint16_t *);
+/* iNVM */
+static int	wm_nvm_read_word_invm(struct wm_softc *, uint16_t, uint16_t *);
+static int	wm_nvm_read_invm(struct wm_softc *, int, int, uint16_t *);
 /* Lock, detecting NVM type, validate checksum and read */
 static int	wm_nvm_acquire(struct wm_softc *);
 static void	wm_nvm_release(struct wm_softc *);
 static int	wm_nvm_is_onboard_eeprom(struct wm_softc *);
+static int	wm_nvm_get_flash_presence_i210(struct wm_softc *);
 static int	wm_nvm_validate_checksum(struct wm_softc *);
 static int	wm_nvm_read(struct wm_softc *, int, int, uint16_t *);
 
@@ -1823,9 +1827,15 @@ wm_attach(device_t parent, device_t self
 		break;
 	case WM_T_I210:
 	case WM_T_I211:
-		wm_nvm_set_addrbits_size_eecd(sc);
-		sc-sc_flags |= WM_F_EEPROM_FLASH_HW;
-		sc-sc_flags |= WM_F_EEPROM_EERDEEWR | WM_F_LOCK_SWFW;
+		if (wm_nvm_get_flash_presence_i210(sc)) {
+			wm_nvm_set_addrbits_size_eecd(sc);
+			sc-sc_flags |= WM_F_EEPROM_FLASH_HW;
+			sc-sc_flags |= WM_F_EEPROM_EERDEEWR | WM_F_LOCK_SWFW;
+		} else {
+			sc-sc_nvm_wordsize = INVM_SIZE;
+			sc-sc_flags |= WM_F_EEPROM_INVM;
+			sc-sc_flags |= WM_F_EEPROM_EERDEEWR | WM_F_LOCK_SWFW;
+		}
 		break;
 	default:
 		break;
@@ -1885,11 +1895,13 @@ wm_attach(device_t parent, device_t self
 	else {
 		aprint_verbose_dev(sc-sc_dev, %u words ,
 		sc-sc_nvm_wordsize);
-		if (sc-sc_flags  WM_F_EEPROM_FLASH_HW) {
+		if (sc-sc_flags  WM_F_EEPROM_INVM)
+			aprint_verbose(iNVM\n);
+		else if (sc-sc_flags  WM_F_EEPROM_FLASH_HW)
 			aprint_verbose(FLASH(HW)\n);
-		} else if (sc-sc_flags  WM_F_EEPROM_FLASH) {
+		else if (sc-sc_flags  WM_F_EEPROM_FLASH)
 			aprint_verbose(FLASH\n);
-		} else {
+		else {
 			if (sc-sc_flags  WM_F_EEPROM_SPI)
 eetype = SPI;
 			else
@@ -8511,6 +8523,102 @@ wm_nvm_read_ich8(struct wm_softc *sc, in
 	return error;
 }
 
+/* iNVM */
+
+static int
+wm_nvm_read_word_invm(struct wm_softc *sc, uint16_t address, uint16_t *data)
+{
+	int32_t  rv = 0;
+	uint32_t invm_dword;
+	uint16_t i;
+	uint8_t record_type, word_address;
+
+	for (i = 0; i  INVM_SIZE; i++) {
+		invm_dword = CSR_READ(sc, E1000_INVM_DATA_REG(i));
+		/* Get record type */
+		record_type = INVM_DWORD_TO_RECORD_TYPE(invm_dword);
+		if (record_type == INVM_UNINITIALIZED_STRUCTURE)
+			break;
+		if (record_type == INVM_CSR_AUTOLOAD_STRUCTURE)
+			i += INVM_CSR_AUTOLOAD_DATA_SIZE_IN_DWORDS;
+		if (record_type == INVM_RSA_KEY_SHA256_STRUCTURE)
+			i += INVM_RSA_KEY_SHA256_DATA_SIZE_IN_DWORDS;
+		if (record_type == INVM_WORD_AUTOLOAD_STRUCTURE) {
+			word_address = INVM_DWORD_TO_WORD_ADDRESS(invm_dword);
+			if (word_address == address) {
+*data = INVM_DWORD_TO_WORD_DATA(invm_dword);
+rv = 0;
+break;
+			}
+		}
+	}
+
+	return rv;
+}
+
+static int
+wm_nvm_read_invm(struct wm_softc *sc, int offset, int words, uint16_t *data)
+{
+	int rv = 0;
+	int i;
+
+	for (i = 0; i  words; i++) {
+		switch (offset + i) {
+		case NVM_OFF_MACADDR:
+		case NVM_OFF_MACADDR1:
+		case NVM_OFF_MACADDR2:
+			rv = wm_nvm_read_word_invm(sc, offset + i, data[i]);
+			if (rv != 0) {
+data[i] = 0x;
+rv = -1;
+			}
+			break;
+		case NVM_OFF_CFG2:
+			rv = wm_nvm_read_word_invm(sc, offset, 

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

2015-05-14 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri May 15 03:50:36 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #763):
sys/dev/pci/hifn7751.c: revisions 1.58, 1.61
fix mbuf leak on failure (Brainy)
--
Use-after-free. Found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.2 -r1.56.2.3 src/sys/dev/pci/hifn7751.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.56.2.2 src/sys/dev/pci/hifn7751.c:1.56.2.3
--- src/sys/dev/pci/hifn7751.c:1.56.2.2	Mon May 11 06:15:46 2015
+++ src/sys/dev/pci/hifn7751.c	Fri May 15 03:50:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.56.2.2 2015/05/11 06:15:46 msaitoh Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.56.2.3 2015/05/15 03:50:36 snj Exp $	*/
 /*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
 
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hifn7751.c,v 1.56.2.2 2015/05/11 06:15:46 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: hifn7751.c,v 1.56.2.3 2015/05/15 03:50:36 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3105,8 +3105,10 @@ hifn_mkmbuf_chain(int totlen, struct mbu
 	if (len == MHLEN)
 		M_DUP_PKTHDR(m0, mtemplate);
 	MCLGET(m0, M_DONTWAIT);
-	if (!(m0-m_flags  M_EXT))
-		m_freem(m0);
+	if (!(m0-m_flags  M_EXT)) {
+ 		m_freem(m0);
+		return (NULL);
+	}
 	len = MCLBYTES;
 
 	totlen -= len;
@@ -3121,6 +3123,7 @@ hifn_mkmbuf_chain(int totlen, struct mbu
 		}
 		MCLGET(m, M_DONTWAIT);
 		if (!(m-m_flags  M_EXT)) {
+			m_freem(m);
 			m_freem(m0);
 			return (NULL);
 		}



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

2015-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 11 06:15:47 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by mrg in ticket #750):
sys/dev/pci/hifn7751.c: revision 1.59
initialise sc_mtx slightly earlier, before it is used on systems with rng.
fixes problem reported by msaitoh@.


To generate a diff of this commit:
cvs rdiff -u -r1.56.2.1 -r1.56.2.2 src/sys/dev/pci/hifn7751.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.56.2.1 src/sys/dev/pci/hifn7751.c:1.56.2.2
--- src/sys/dev/pci/hifn7751.c:1.56.2.1	Mon May 11 03:14:29 2015
+++ src/sys/dev/pci/hifn7751.c	Mon May 11 06:15:46 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.56.2.1 2015/05/11 03:14:29 msaitoh Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.56.2.2 2015/05/11 06:15:46 msaitoh Exp $	*/
 /*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
 
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hifn7751.c,v 1.56.2.1 2015/05/11 03:14:29 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: hifn7751.c,v 1.56.2.2 2015/05/11 06:15:46 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -432,13 +432,13 @@ hifn_attach(device_t parent, device_t se
 	sc-sc_dmamap-dm_mapsize,
 	BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
+	mutex_init(sc-sc_mtx, MUTEX_DEFAULT, IPL_VM);
+
 	if (sc-sc_flags  (HIFN_HAS_PUBLIC | HIFN_HAS_RNG)) {
 		hifn_init_pubrng(sc);
 		sc-sc_rng_need = RND_POOLBITS / NBBY;
 	}
 
-	mutex_init(sc-sc_mtx, MUTEX_DEFAULT, IPL_VM);
-
 #ifdef	__OpenBSD__
 	timeout_set(sc-sc_tickto, hifn_tick, sc);
 	timeout_add(sc-sc_tickto, hz);



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

2015-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May 11 03:14:29 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #748):
sys/dev/pci/hifn7751.c: revision 1.60
Defer to a callout in hifn_rng_get.  Fixes lock-against-self.
Still can't call rnd_add_data directly from an rndsource callback.
(Still plan to fix this with further rnd rototilling.)
XXX pullup netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.56.2.1 src/sys/dev/pci/hifn7751.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/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.56 src/sys/dev/pci/hifn7751.c:1.56.2.1
--- src/sys/dev/pci/hifn7751.c:1.56	Sun Aug 10 16:44:35 2014
+++ src/sys/dev/pci/hifn7751.c	Mon May 11 03:14:29 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.56 2014/08/10 16:44:35 tls Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.56.2.1 2015/05/11 03:14:29 msaitoh Exp $	*/
 /*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
 
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hifn7751.c,v 1.56 2014/08/10 16:44:35 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: hifn7751.c,v 1.56.2.1 2015/05/11 03:14:29 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -537,8 +537,7 @@ hifn_rng_get(size_t bytes, void *priv)
 
 	mutex_enter(sc-sc_mtx);
 	sc-sc_rng_need = bytes;
-
-	hifn_rng_locked(sc);
+	callout_reset(sc-sc_rngto, 0, hifn_rng, sc);
 	mutex_exit(sc-sc_mtx);
 }
 



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

2015-05-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat May  9 08:37:53 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #740):
sys/dev/pci/if_bge.c: revision 1.285
sys/dev/pci/if_bgereg.h: revision 1.90
Use another firmware command in bge_asf_driver_up(). Same as Lunux.
This change fixes a bug that watchdog timeout occurs every 25-30 minutes
on HP ML110 G6 reported enami@ in PR#49657.


To generate a diff of this commit:
cvs rdiff -u -r1.277.2.1 -r1.277.2.2 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.88 -r1.88.2.1 src/sys/dev/pci/if_bgereg.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_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.277.2.1 src/sys/dev/pci/if_bge.c:1.277.2.2
--- src/sys/dev/pci/if_bge.c:1.277.2.1	Tue Feb 17 14:48:10 2015
+++ src/sys/dev/pci/if_bge.c	Sat May  9 08:37:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.277.2.1 2015/02/17 14:48:10 martin Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.277.2.2 2015/05/09 08:37:53 snj Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.277.2.1 2015/02/17 14:48:10 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.277.2.2 2015/05/09 08:37:53 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -4723,7 +4723,7 @@ bge_asf_driver_up(struct bge_softc *sc)
 			bge_wait_for_event_ack(sc);
 
 			bge_writemem_ind(sc, BGE_SRAM_FW_CMD_MB,
-			BGE_FW_CMD_DRV_ALIVE);
+			BGE_FW_CMD_DRV_ALIVE3);
 			bge_writemem_ind(sc, BGE_SRAM_FW_CMD_LEN_MB, 4);
 			bge_writemem_ind(sc, BGE_SRAM_FW_CMD_DATA_MB,
 			BGE_FW_HB_TIMEOUT_SEC);

Index: src/sys/dev/pci/if_bgereg.h
diff -u src/sys/dev/pci/if_bgereg.h:1.88 src/sys/dev/pci/if_bgereg.h:1.88.2.1
--- src/sys/dev/pci/if_bgereg.h:1.88	Tue Jun 17 17:37:08 2014
+++ src/sys/dev/pci/if_bgereg.h	Sat May  9 08:37:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bgereg.h,v 1.88 2014/06/17 17:37:08 msaitoh Exp $	*/
+/*	$NetBSD: if_bgereg.h,v 1.88.2.1 2015/05/09 08:37:53 snj Exp $	*/
 /*
  * Copyright (c) 2001 Wind River Systems
  * Copyright (c) 1997, 1998, 1999, 2001
@@ -100,6 +100,7 @@
 
 #define	BGE_FW_CMD_DRV_ALIVE		0x0001
 #define	BGE_FW_CMD_PAUSE		0x0002
+#define	BGE_FW_CMD_DRV_ALIVE3		0x000e
 
 #define	BGE_FW_HB_TIMEOUT_SEC		3
 



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

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

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #698):
sys/dev/pci/if_wm.c: revision 1.316
  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].


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.5 src/sys/dev/pci/if_wm.c:1.289.2.6
--- src/sys/dev/pci/if_wm.c:1.289.2.5	Thu Apr 16 06:10:43 2015
+++ src/sys/dev/pci/if_wm.c	Sun Apr 19 06:50:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.6 2015/04/19 06:50:22 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.6 2015/04/19 06:50:22 riz Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -6397,8 +6397,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.
 	 */
@@ -6407,30 +6408,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:
@@ -6467,6 +6454,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);



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

2015-04-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 19 14:42:15 UTC 2015

Added Files:
src/sys/dev/pci/ixgbe [netbsd-7]: ixgbe_82598.h ixgbe_82599.h
ixgbe_x540.c ixgbe_x540.h

Log Message:
Apply patch (requested by msaitoh in ticket #697):
sys/dev/pci/files.pci   1.375 via patch
sys/dev/pci/ixgbe/ixgbe.c   1.24-1.27 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_82598.c 1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_82598.h 1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_82599.c 1.6-1.8 via patch
sys/dev/pci/ixgbe/ixgbe_82599.h 1.1 via patch
sys/dev/pci/ixgbe/ixgbe_api.c   1.5-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_api.h   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_common.c1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_common.h1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_mbx.h   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.4-1.6 via patch
sys/dev/pci/ixgbe/ixgbe_phy.c   1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_phy.h   1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_type.h  1.8-1.9 via patch
sys/dev/pci/ixgbe/ixgbe_vf.c1.2-1.3 via patch
sys/dev/pci/ixgbe/ixgbe_vf.h1.3-1.4 via patch
sys/dev/pci/ixgbe/ixgbe_x540.c  1.1-1.2 via patch
sys/dev/pci/ixgbe/ixgbe_x540.h  1.1 via patch
sys/dev/pci/ixgbe/ixv.c 1.5-1.7 via patch
sys/dev/pci/ixgbe/ixv.h 1.4-1.5 via patch

Synchronize our ixg(4) driver up to FreeBSD r243716:
 - Add X540 support.
 - Add TSO6 support.
 - Add 100BaseTX support.
 - The max size in dma tag is changed from 65535 to 262140 
(IXGBE_TSO_SIZE).
   The value is the same as other *BSDs. The change might cause a 
address
   space shortage (ixgbe_dmamap_create() might fail) on some machines.
 - Show 1000Base-SX correctly.
 - Fix if_baudrate from 1G to 10G.
 - Fix a bug that ifconfig -z (SOICZIFDATA) doesn't work.
 - Fix a lot of bugs.
 - Improve performance.
[msaitoh, ticket #697]


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.2.4.2 src/sys/dev/pci/ixgbe/ixgbe_82598.h \
src/sys/dev/pci/ixgbe/ixgbe_x540.c
cvs rdiff -u -r0 -r1.1.4.2 src/sys/dev/pci/ixgbe/ixgbe_82599.h \
src/sys/dev/pci/ixgbe/ixgbe_x540.h

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

Added files:

Index: src/sys/dev/pci/ixgbe/ixgbe_82598.h
diff -u /dev/null src/sys/dev/pci/ixgbe/ixgbe_82598.h:1.2.4.2
--- /dev/null	Sun Apr 19 14:42:15 2015
+++ src/sys/dev/pci/ixgbe/ixgbe_82598.h	Sun Apr 19 14:42:14 2015
@@ -0,0 +1,52 @@
+/**
+
+  Copyright (c) 2001-2012, Intel Corporation 
+  All rights reserved.
+  
+  Redistribution and use in source and binary forms, with or without 
+  modification, are permitted provided that the following conditions are met:
+  
+   1. Redistributions of source code must retain the above copyright notice, 
+  this list of conditions and the following disclaimer.
+  
+   2. Redistributions in binary form must reproduce the above copyright 
+  notice, this list of conditions and the following disclaimer in the 
+  documentation and/or other materials provided with the distribution.
+  
+   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) 
+  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+  POSSIBILITY OF SUCH DAMAGE.
+
+**/
+/*$FreeBSD: head/sys/dev/ixgbe/ixgbe_82598.h 238149 2012-07-05 20:51:44Z jfv $*/
+
+#ifndef _IXGBE_82598_H_
+#define _IXGBE_82598_H_
+
+u32 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw);

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

2015-04-19 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Sun Apr 19 16:26:23 UTC 2015

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

Log Message:
Apply patch (requested by msaitoh in ticket #699):
sys/dev/pci/pcidevs 1.1200, 1.1203, 1.1208-1.1212, 
1.1214-1.1220 via patch

Sync pcidevs with rev. 1.1220:
- Add Samsung Electronics XP941 M.2 SSD
- Add Intel Atom Z36xx and Z37xx devices from the datasheet.
- 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 9 Series devices
- 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 two PLX PCI Bridges.
- Add Radeon HD 54xx Audio
- Add Dell DARC 4 devices
- Add nForce Host Bridges.
- Add MegaRAID SAS3108
[msaitoh, ticket #699]


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1199.2.5 src/sys/dev/pci/pcidevs:1.1199.2.6
--- src/sys/dev/pci/pcidevs:1.1199.2.5	Tue Feb 17 15:04:47 2015
+++ src/sys/dev/pci/pcidevs	Sun Apr 19 16:26:23 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.5 2015/02/17 15:04:47 martin Exp $
+$NetBSD: pcidevs,v 1.1199.2.6 2015/04/19 16:26:23 riz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -588,6 +588,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
@@ -1522,6 +1523,7 @@ product ATI RADEON_HD7340	0x9808	Radeon 
 product ATI RADEON_HD2600_HD	0xaa08	Radeon HD2600 HD Audio Controller
 product ATI RADEON_HD4350_HD	0xaa38	Radeon HD4350 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
@@ -1912,6 +1914,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
 
@@ -2047,7 +2051,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
@@ -2417,6 +2424,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
 product HP RS780_PPB_GFX	0x9602  (AMD) RS780 PCI-PCI Bridge (int gfx)
@@ -2575,6 +2583,8 @@ product INTEL 6700PXH_IOXAPIC	0x0326	670
 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 6702PXH_PCIX	0x032c	6702PXH PCI Express-to-PCIX
+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 80331		0x0335	Lindsay I/O Processor PCI-X Bridge
 product INTEL 41210A		0x0340	Serial to Parallel PCI Bridge A
 product INTEL 41210B		0x0341	Serial to Parallel PCI Bridge B
@@ -2591,6 +2601,8 @@ product INTEL DH89XXCC_SGMII	0x0438	DH89
 product INTEL DH89XXCC_SERDES	0x043a	DH89XXCC SerDes
 product INTEL DH89XXCC_BPLANE	0x043c	DH89XXCC backplane
 product INTEL DH89XXCC_SFP	0x0440	DH89XXCC SFP
+product INTEL DH89XXCC_IQIA_VF	0x0442	DH89XXCC QuickAssist Virtual Function
+product INTEL DH89XXCL_IQIA_VF	0x0443	DH89XXCL QuickAssist Virtual Function
 product INTEL PCEB		0x0482	82375EB/SB PCI-EISA Bridge
 product INTEL 

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

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

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #694):
sys/dev/pci/if_wm.c: revision 1.314
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.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.4 -r1.289.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.289.2.4 src/sys/dev/pci/if_wm.c:1.289.2.5
--- src/sys/dev/pci/if_wm.c:1.289.2.4	Wed Mar 18 04:39:15 2015
+++ src/sys/dev/pci/if_wm.c	Thu Apr 16 06:10:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.4 2015/03/18 04:39:15 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.4 2015/03/18 04:39:15 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -7390,16 +7390,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-7] src/sys/dev/pci

2015-03-17 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Mar 18 04:39:15 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #614):
sys/dev/pci/if_wm.c: revision 1.311-1.313
sys/dev/pci/if_wmreg.h: revision 1.66
Fix a bug that sc_mediatype is evaluated incorrectly. The real problem
might be occured only on fiber and serdes cases.
#
- 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.
#
 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.


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.3 -r1.289.2.4 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.60.2.1 -r1.60.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.289.2.3 src/sys/dev/pci/if_wm.c:1.289.2.4
--- src/sys/dev/pci/if_wm.c:1.289.2.3	Wed Feb  4 06:48:13 2015
+++ src/sys/dev/pci/if_wm.c	Wed Mar 18 04:39:15 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.3 2015/02/04 06:48:13 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.4 2015/03/18 04:39:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.3 2015/02/04 06:48:13 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.4 2015/03/18 04:39:15 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -277,6 +277,10 @@ struct wm_softc {
 	int sc_rev;			/* MAC revision */
 	wm_phy_type sc_phytype;		/* PHY type */
 	uint32_t sc_mediatype;		/* Media type (Copper, Fiber, SERDES)*/
+#define	WM_MEDIATYPE_UNKNOWN		0x00
+#define	WM_MEDIATYPE_FIBER		0x01
+#define	WM_MEDIATYPE_COPPER		0x02
+#define	WM_MEDIATYPE_SERDES		0x03 /* Internal SERDES */
 	int sc_funcid;			/* unit number of the chip (0 to 3) */
 	int sc_flags;			/* flags; see below */
 	int sc_if_flags;		/* last if_flags */
@@ -557,6 +561,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 *);
@@ -723,10 +728,10 @@ static const struct wm_product {
 	const char		*wmp_name;
 	wm_chip_type		wmp_type;
 	uint32_t		wmp_flags;
-#define	WMP_F_UNKNOWN		0x00
-#define	WMP_F_FIBER		0x01
-#define	WMP_F_COPPER		0x02
-#define	WMP_F_SERDES		0x03 /* Internal SERDES */
+#define	WMP_F_UNKNOWN		WM_MEDIATYPE_UNKNOWN
+#define	WMP_F_FIBER		WM_MEDIATYPE_FIBER
+#define	WMP_F_COPPER		WM_MEDIATYPE_COPPER
+#define	WMP_F_SERDES		WM_MEDIATYPE_SERDES
 #define WMP_MEDIATYPE(x)	((x)  0x03)
 } wm_products[] = {
 	{ PCI_VENDOR_INTEL,	PCI_PRODUCT_INTEL_82542,
@@ -1739,6 +1744,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_LOCK_EECD;
 		reg = CSR_READ(sc, WMREG_EECD);
 		if (reg  EECD_EE_TYPE) {
 			/* SPI */
@@ -1754,7 +1760,6 @@ wm_attach(device_t parent, device_t self
 sc-sc_nvm_addrbits = 6;
 			}
 		}
-		sc-sc_flags |= WM_F_LOCK_EECD;
 		break;
 	case WM_T_82571:
 	case WM_T_82572:
@@ -2106,10 +2111,10 @@ wm_attach(device_t parent, device_t self
 		wm_gmii_mediainit(sc, wmp-wmp_product);
 	} else if (sc-sc_type  WM_T_82543 ||
 	(CSR_READ(sc, WMREG_STATUS)  STATUS_TBIMODE) != 0) {
-		if (sc-sc_mediatype  WMP_F_COPPER) {
+		if (sc-sc_mediatype == WM_MEDIATYPE_COPPER) {
 			aprint_error_dev(sc-sc_dev,
 			WARNING: TBIMODE set on 1000BASE-T product!\n);
-			sc-sc_mediatype = WMP_F_FIBER;
+			sc-sc_mediatype = WM_MEDIATYPE_FIBER;
 		}
 		wm_tbi_mediainit(sc);
 	} else {
@@ -2126,45 +2131,45 @@ wm_attach(device_t parent, device_t self
 			switch (link_mode) {
 			case CTRL_EXT_LINK_MODE_1000KX:
 aprint_verbose_dev(sc-sc_dev, 1000KX\n);
-sc-sc_mediatype = WMP_F_SERDES;
+sc-sc_mediatype = WM_MEDIATYPE_SERDES;
 break;
 			case CTRL_EXT_LINK_MODE_SGMII:
 if (wm_sgmii_uses_mdio(sc)) {
 	aprint_verbose_dev(sc-sc_dev,
 	SGMII(MDIO)\n);
 	sc-sc_flags |= WM_F_SGMII;
-	sc-sc_mediatype = WMP_F_COPPER;
+	sc-sc_mediatype = WM_MEDIATYPE_COPPER;
 	break;
 }
 aprint_verbose_dev(sc-sc_dev, SGMII(I2C)\n);
 /*FALLTHROUGH*/
 			case CTRL_EXT_LINK_MODE_PCIE_SERDES:
 sc-sc_mediatype = wm_sfp_get_media_type(sc);
-if (sc-sc_mediatype == WMP_F_UNKNOWN) {
+if (sc-sc_mediatype == WM_MEDIATYPE_UNKNOWN) {
 	if (link_mode
 	== 

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

2015-02-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 24 10:41:09 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #545):
sys/dev/pci/ixgbe/ixgbe.h: revision 1.2
sys/dev/pci/ixgbe/ixgbe_netbsd.c: revision 1.3
sys/dev/pci/ixgbe/ixgbe.c: revision 1.16
sys/dev/pci/ixgbe/ixgbe.c: revision 1.17
sys/dev/pci/ixgbe/ixgbe.c: revision 1.18
sys/dev/pci/ixgbe/ixgbe.c: revision 1.19
 Add missing IXGBE_RX_LOCK_DESTROY() for the detach path.
 Remove extra IXGBE_TX_LOCK()/IXGBE_TX_UNLOCK() from
ixgbe_free_transmit_structures(). This function is called in the end of
the detach function. if_stop was called and almost all resources were
freed, so it's not required to block the TX stuff.
Fix mutex related problem reported by Uwe Toenjes in PR#49328:
 - Revert ixgbe_netbsd.c rev. 1.2
 - make CORE_LOCK adaptive
 - Release spin lock while reinitializing the jumb buffer structure.
disable preemption while scheduling the softint to configure the link.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.1 -r1.1.28.1 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.1 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.2
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.1	Tue Feb 17 14:54:37 2015
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb 24 10:41:09 2015
@@ -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.14.2.1 2015/02/17 14:54:37 martin Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.2 2015/02/24 10:41:09 martin Exp $*/
 
 #include opt_inet.h
 
@@ -2710,13 +2710,19 @@ ixgbe_config_link(struct adapter *adapte
 	sfp = ixgbe_is_sfp(hw);
 
 	if (sfp) { 
+		void *ip;
+
 		if (hw-phy.multispeed_fiber) {
 			hw-mac.ops.setup_sfp(hw);
 			ixgbe_enable_tx_laser(hw);
-			softint_schedule(adapter-msf_si);
+			ip = adapter-msf_si;
 		} else {
-			softint_schedule(adapter-mod_si);
+			ip = adapter-mod_si;
 		}
+
+		kpreempt_disable();
+		softint_schedule(ip);
+		kpreempt_enable();
 	} else {
 		if (hw-mac.ops.check_link)
 			err = ixgbe_check_link(hw, autoneg,
@@ -3180,10 +3186,8 @@ ixgbe_free_transmit_structures(struct ad
 	struct tx_ring *txr = adapter-tx_rings;
 
 	for (int i = 0; i  adapter-num_queues; i++, txr++) {
-		IXGBE_TX_LOCK(txr);
 		ixgbe_free_transmit_buffers(txr);
 		ixgbe_dma_free(adapter, txr-txdma);
-		IXGBE_TX_UNLOCK(txr);
 		IXGBE_TX_LOCK_DESTROY(txr);
 	}
 	free(adapter-tx_rings, M_DEVBUF);
@@ -3935,12 +3939,16 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	/* Free current RX buffer structs and their mbufs */
 	ixgbe_free_receive_ring(rxr);
 
+	IXGBE_RX_UNLOCK(rxr);
+
 	/* Now reinitialize our supply of jumbo mbufs.  The number
 	 * or size of jumbo mbufs may have changed.
 	 */
 	ixgbe_jcl_reinit(adapter-jcl_head, rxr-ptag-dt_dmat,
 	2 * adapter-num_rx_desc, adapter-rx_mbuf_sz);
 
+	IXGBE_RX_LOCK(rxr);
+
 	/* Configure header split? */
 	if (ixgbe_header_split)
 		rxr-hdr_split = TRUE;
@@ -4226,6 +4234,7 @@ ixgbe_free_receive_structures(struct ada
 #endif /* LRO */
 		/* Free the ring memory as well */
 		ixgbe_dma_free(adapter, rxr-rxdma);
+		IXGBE_RX_LOCK_DESTROY(rxr);
 	}
 
 	free(adapter-rx_rings, M_DEVBUF);

Index: src/sys/dev/pci/ixgbe/ixgbe.h
diff -u src/sys/dev/pci/ixgbe/ixgbe.h:1.1 src/sys/dev/pci/ixgbe/ixgbe.h:1.1.28.1
--- src/sys/dev/pci/ixgbe/ixgbe.h:1.1	Fri Aug 12 21:55:29 2011
+++ src/sys/dev/pci/ixgbe/ixgbe.h	Tue Feb 24 10:41:09 2015
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: src/sys/dev/ixgbe/ixgbe.h,v 1.24 2011/04/28 23:21:40 jfv Exp $*/
-/*$NetBSD: ixgbe.h,v 1.1 2011/08/12 21:55:29 dyoung Exp $*/
+/*$NetBSD: ixgbe.h,v 1.1.28.1 2015/02/24 10:41:09 martin Exp $*/
 
 
 #ifndef _IXGBE_H_
@@ -476,7 +476,7 @@ struct adapter {
 
 
 #define IXGBE_CORE_LOCK_INIT(_sc, _name) \
-mutex_init((_sc)-core_mtx, MUTEX_DEFAULT, IPL_NET)
+mutex_init((_sc)-core_mtx, MUTEX_DEFAULT, IPL_SOFTNET)
 #define IXGBE_CORE_LOCK_DESTROY(_sc)  mutex_destroy((_sc)-core_mtx)
 #define IXGBE_TX_LOCK_DESTROY(_sc)mutex_destroy((_sc)-tx_mtx)
 #define IXGBE_RX_LOCK_DESTROY(_sc)mutex_destroy((_sc)-rx_mtx)



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

2015-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 17 14:54:37 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #527):
sys/dev/pci/ixgbe/ixgbe.c: revision 1.15
  Fix a legacy interrupt problem. If the INTx line was shared with another
device, the ixgbe_legacy_irq() enabled the interrupt even if the interface
was down. Check the interface state and call functions appropriately.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.2.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.14 src/sys/dev/pci/ixgbe/ixgbe.c:1.14.2.1
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.14	Mon Apr 21 16:35:06 2014
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Feb 17 14:54:37 2015
@@ -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.14 2014/04/21 16:35:06 chs Exp $*/
+/*$NetBSD: ixgbe.c,v 1.14.2.1 2015/02/17 14:54:37 martin Exp $*/
 
 #include opt_inet.h
 
@@ -1478,30 +1478,33 @@ ixgbe_legacy_irq(void *arg)
 {
 	struct ix_queue *que = arg;
 	struct adapter	*adapter = que-adapter;
+	struct ifnet   *ifp = adapter-ifp;
 	struct ixgbe_hw	*hw = adapter-hw;
 	struct 		tx_ring *txr = adapter-tx_rings;
-	bool		more_tx, more_rx;
+	bool		more_tx = false, more_rx = false;
 	u32   	reg_eicr, loop = MAX_LOOP;
 
-
 	reg_eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
 
 	adapter-stats.legint.ev_count++;
 	++que-irqs;
 	if (reg_eicr == 0) {
 		adapter-stats.intzero.ev_count++;
-		ixgbe_enable_intr(adapter);
+		if ((ifp-if_flags  IFF_UP) != 0)
+			ixgbe_enable_intr(adapter);
 		return 0;
 	}
 
-	more_rx = ixgbe_rxeof(que, adapter-rx_process_limit);
+	if ((ifp-if_flags  IFF_RUNNING) != 0) {
+		more_rx = ixgbe_rxeof(que, adapter-rx_process_limit);
 
-	IXGBE_TX_LOCK(txr);
-	do {
-		adapter-txloops.ev_count++;
-		more_tx = ixgbe_txeof(txr);
-	} while (loop--  more_tx);
-	IXGBE_TX_UNLOCK(txr);
+		IXGBE_TX_LOCK(txr);
+		do {
+			adapter-txloops.ev_count++;
+			more_tx = ixgbe_txeof(txr);
+		} while (loop--  more_tx);
+		IXGBE_TX_UNLOCK(txr);
+	}
 
 	if (more_rx || more_tx) {
 		if (more_rx)



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

2015-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 17 14:48:10 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #526):
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.277 -r1.277.2.1 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.277 src/sys/dev/pci/if_bge.c:1.277.2.1
--- src/sys/dev/pci/if_bge.c:1.277	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/pci/if_bge.c	Tue Feb 17 14:48:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.277 2014/08/10 16:44:36 tls Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.277.2.1 2015/02/17 14:48:10 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.277 2014/08/10 16:44:36 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_bge.c,v 1.277.2.1 2015/02/17 14:48:10 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1397,13 +1397,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) {
@@ -3742,7 +3742,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);
@@ -4170,7 +4170,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-7] src/sys/dev/pci

2015-02-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Feb 17 15:04:47 UTC 2015

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

Log Message:
Pull up the following, requested by msaitoh in ticket 528:

sys/dev/pci/pcidevs: revision 1.1206-1.1207

- Rename DH89XX_QA to DH89XXCC_IQIA
- Modify the description to DH89xxCC PCIe Endpoint and QuickAssist
  (include typo fix)
- Rename DH89xxCC'''s names from DH89XX_ to DH89XXCC_.
- Add some DH89xxCC'''s devices.
- Add DH89XXCL'''s devices.
- Rename PCI_PRODUCT_INTEL_DH89XX_SMB to PCI_PRODUCT_INTEL_DH89XXCC_SMB
- Add PCI_PRODUCT_INTEL_DH89XXCL_SMB


To generate a diff of this commit:
cvs rdiff -u -r1.1199.2.4 -r1.1199.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.1199.2.4 src/sys/dev/pci/pcidevs:1.1199.2.5
--- src/sys/dev/pci/pcidevs:1.1199.2.4	Wed Feb  4 06:24:58 2015
+++ src/sys/dev/pci/pcidevs	Tue Feb 17 15:04:47 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.4 2015/02/04 06:24:58 snj Exp $
+$NetBSD: pcidevs,v 1.1199.2.5 2015/02/17 15:04:47 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2585,7 +2585,8 @@ product INTEL SRCU42E		0x0408	SCSI RAID 
 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 DH89XX_QA		0x0434	DH89xx QuiskAssit
+product INTEL DH89XXCC_IQIA	0x0434	DH89xxCC PCIe Endpoint and QuickAssist
+product INTEL DH89XXCL_IQIA	0x0435	DH89xxCL PCIe Endpoint and QuickAssist
 product INTEL DH89XXCC_SGMII	0x0438	DH89XXCC SGMII
 product INTEL DH89XXCC_SERDES	0x043a	DH89XXCC SerDes
 product INTEL DH89XXCC_BPLANE	0x043c	DH89XXCC backplane
@@ -3076,19 +3077,42 @@ product INTEL C2000_1000KX	0x1f40	C2000 
 product INTEL C2000_SGMII	0x1f41	C2000 Ethernet(SGMII)
 product INTEL C2000_DUMMYGBE	0x1f42	C2000 Ethernet(Dummy function)
 product INTEL C2000_25GBE	0x1f45	C2000 Ethernet(2.5Gbe)
-product INTEL DH89XX_LPC	0x2310	DH89xx LPC Controller
-product INTEL DH89XX_SATA_1	0x2323	DH89xx SATA Controller
-product INTEL DH89XX_SATA_2	0x2326	DH89xx SATA Controller
-product INTEL DH89XX_SMB	0x2330	DH89xx SMBus Host Controller
-product INTEL DH89XX_THERMAL	0x2332	DH89xx Thermal Subsystem
-product INTEL DH89XX_USB	0x2334	DH89xx USB EHCI
-product INTEL DH89XX_PCIE_1	0x2342	DH89xx PCIe Root Port
-product INTEL DH89XX_PCIE_2	0x2344	DH89xx PCIe Root Port
-product INTEL DH89XX_PCIE_3	0x2346	DH89xx PCIe Root Port
-product INTEL DH89XX_PCIE_4	0x2348	DH89xx PCIe Root Port
-product INTEL DH89XX_WDT	0x2360	DH89xx Watchdog Timer for Core Reset
-product INTEL DH89XX_MEI_1	0x2364	DH89xx MEI Controller
-product INTEL DH89XX_MEI_2	0x2365	DH89xx MEI Controller
+product INTEL DH89XXCC_LPC	0x2310	DH89xxCC LPC Controller
+product INTEL DH89XXCC_SATA_1	0x2323	DH89xxCC SATA Controller
+product INTEL DH89XXCC_SATA_2	0x2326	DH89xxCC SATA Controller
+product INTEL DH89XXCC_SMB	0x2330	DH89xxCC SMBus Host Controller
+product INTEL DH89XXCC_THERMAL	0x2332	DH89xxCC Thermal Subsystem
+product INTEL DH89XXCC_USB_1	0x2334	DH89xxCC USB EHCI
+product INTEL DH89XXCC_USB_2	0x2335	DH89xxCC USB EHCI
+product INTEL DH89XXCC_PCIE_1_1	0x2342	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_1_2	0x2343	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_2_1	0x2344	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_2_2	0x2345	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_3_1	0x2346	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_3_2	0x2347	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_4_1	0x2348	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_PCIE_4_2	0x2349	DH89xxCC PCIe Root Port
+product INTEL DH89XXCC_WDT	0x2360	DH89xxCC Watchdog Timer for Core Reset
+product INTEL DH89XXCC_MEI_1	0x2364	DH89xxCC MEI Controller
+product INTEL DH89XXCC_MEI_2	0x2365	DH89xxCC MEI Controller
+product INTEL DH89XXCL_LPC	0x2390	DH89xxCL LPC Controller
+product INTEL DH89XXCL_SATA_1	0x23a3	DH89xxCL SATA Controller
+product INTEL DH89XXCL_SATA_2	0x23a6	DH89xxCL SATA Controller
+product INTEL DH89XXCL_SMB	0x23b0	DH89xxCL SMBus Host Controller
+product INTEL DH89XXCL_THERMAL	0x23b2	DH89xxCL Thermal Subsystem
+product INTEL DH89XXCL_USB_1	0x23b4	DH89xxCL USB EHCI
+product INTEL DH89XXCL_USB_2	0x23b4	DH89xxCL USB EHCI
+product INTEL DH89XXCL_PCIE_1_1	0x23c2	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_1_2	0x23c3	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_2_1	0x23c4	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_2_2	0x23c5	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_3_1	0x23c6	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_3_2	0x23c7	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_4_1	0x23c8	DH89xxCL PCIe Root Port
+product INTEL DH89XXCL_PCIE_4_2	0x23c9	DH89xxCL PCIe Root Port
+product INTEL 

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

2015-02-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Wed Feb  4 06:48:13 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #490):
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].


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.2 src/sys/dev/pci/if_wm.c:1.289.2.3
--- src/sys/dev/pci/if_wm.c:1.289.2.2	Fri Nov  7 21:34:56 2014
+++ src/sys/dev/pci/if_wm.c	Wed Feb  4 06:48:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.2 2014/11/07 21:34:56 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.3 2015/02/04 06:48:13 snj Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.2 2014/11/07 21:34:56 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.3 2015/02/04 06:48:13 snj Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1831,7 +1831,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-7] src/sys/dev/pci

2015-01-30 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan 31 07:44:13 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by martin in ticket #469):
sys/dev/pci/if_fpa.c: revision 1.60
Fix obviously missing sc-sc_dev = self initialization.
Might help PR port-i386/49602.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.59.4.1 src/sys/dev/pci/if_fpa.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_fpa.c
diff -u src/sys/dev/pci/if_fpa.c:1.59 src/sys/dev/pci/if_fpa.c:1.59.4.1
--- src/sys/dev/pci/if_fpa.c:1.59	Sat Mar 29 19:28:24 2014
+++ src/sys/dev/pci/if_fpa.c	Sat Jan 31 07:44:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_fpa.c,v 1.59 2014/03/29 19:28:24 christos Exp $	*/
+/*	$NetBSD: if_fpa.c,v 1.59.4.1 2015/01/31 07:44:13 snj Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1996 Matt Thomas m...@3am-software.com
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_fpa.c,v 1.59 2014/03/29 19:28:24 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_fpa.c,v 1.59.4.1 2015/01/31 07:44:13 snj Exp $);
 
 #ifdef __NetBSD__
 #include opt_inet.h
@@ -410,6 +410,8 @@ pdq_pci_attach(device_t const parent, de
 
 aprint_naive(: FDDI controller\n);
 
+sc-sc_dev = self;
+
 data = pci_conf_read(pa-pa_pc, pa-pa_tag, PCI_CFLT);
 if ((data  0xFF00)  (DEFPA_LATENCY  8)) {
 	data = ~0xFF00;



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

2015-01-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 17 21:49:38 UTC 2015

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

Log Message:
regen (ticket #432)


To generate a diff of this commit:
cvs rdiff -u -r1.1192.2.1 -r1.1192.2.2 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1191.2.1 -r1.1191.2.2 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1192.2.1 src/sys/dev/pci/pcidevs.h:1.1192.2.2
--- src/sys/dev/pci/pcidevs.h:1.1192.2.1	Fri Nov  7 21:36:29 2014
+++ src/sys/dev/pci/pcidevs.h	Sat Jan 17 21:49:36 2015
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1192.2.1 2014/11/07 21:36:29 snj Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1192.2.2 2015/01/17 21:49:36 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1199.2.1 2014/11/07 21:34:56 snj Exp
+ *	NetBSD: pcidevs,v 1.1199.2.2 2015/01/17 21:48:05 martin Exp
  */
 
 /*
@@ -4925,6 +4925,7 @@
 #define	PCI_PRODUCT_REALTEK_RTS5227	0x5227		/* RTS5227 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTS5229	0x5229		/* RTS5229 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTS5249	0x5249		/* RTS5249 PCI-E Card Reader */
+#define	PCI_PRODUCT_REALTEK_RTL8402	0x5286		/* RTL8402 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8411B	0x5287		/* RTL8411B PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RTL8411	0x5289		/* RTL8411 PCI-E Card Reader */
 #define	PCI_PRODUCT_REALTEK_RT8029	0x8029		/* 8029 Ethernet */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1191.2.1 src/sys/dev/pci/pcidevs_data.h:1.1191.2.2
--- src/sys/dev/pci/pcidevs_data.h:1.1191.2.1	Fri Nov  7 21:36:29 2014
+++ src/sys/dev/pci/pcidevs_data.h	Sat Jan 17 21:49:36 2015
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1191.2.1 2014/11/07 21:36:29 snj Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1191.2.2 2015/01/17 21:49:36 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1199.2.1 2014/11/07 21:34:56 snj Exp
+ *	NetBSD: pcidevs,v 1.1199.2.2 2015/01/17 21:48:05 martin Exp
  */
 
 /*
@@ -8257,1358 +8257,1360 @@ static const uint16_t pci_products[] = {
 	25918, 15718, 10790, 14331, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTS5249, 
 	25926, 15718, 10790, 14331, 0,
-	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8402, 
 	25934, 15718, 10790, 14331, 0,
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411B, 
+	25942, 15718, 10790, 14331, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8411, 
-	25943, 15718, 10790, 14331, 0,
+	25951, 15718, 10790, 14331, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029, 
-	25951, 5501, 0,
+	25959, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139D, 
-	25956, 5603, 5501, 0,
+	25964, 5603, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8100, 
-	25962, 5603, 5501, 0,
+	25970, 5603, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129, 
-	25967, 5603, 5501, 0,
+	25975, 5603, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8101E, 
-	25972, 5603, 5501, 0,
+	25980, 5603, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8138, 
-	25990, 5603, 5501, 0,
+	25998, 5603, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139, 
 	7364, 5603, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169SC, 
-	25995, 5516, 5501, 0,
+	26003, 5516, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8168, 
-	26009, 5516, 5501, 0,
+	26017, 5516, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8169, 
-	26019, 5516, 5501, 0,
+	26027, 5516, 5501, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8188CE, 
-	26029, 4739, 4534, 26039, 15718, 16214, 0,
+	26037, 4739, 4534, 26047, 15718, 16214, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8180, 
-	26047, 7460, 0,
+	26055, 7460, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
-	26052, 26057, 0,
+	26060, 26065, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7780, 
-	26069, 615, 6239, 0,
+	26077, 615, 6239, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7785, 
-	26076, 615, 6239, 0,
+	26084, 615, 6239, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PBI, 
-	26083, 17156, 26090, 26100, 0,
+	26091, 17156, 26098, 26108, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PPB, 
-	26083, 15280, 6347, 26106, 0,
+	26091, 15280, 6347, 26114, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PS, 
-	26083, 17156, 26112, 26119, 0,
+	26091, 17156, 26120, 26127, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720201, 
-	

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

2015-01-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jan 17 21:48:05 UTC 2015

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

Log Message:
Pull up revision 1.1204 for ticket #432


To generate a diff of this commit:
cvs rdiff -u -r1.1199.2.1 -r1.1199.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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1199.2.1 src/sys/dev/pci/pcidevs:1.1199.2.2
--- src/sys/dev/pci/pcidevs:1.1199.2.1	Fri Nov  7 21:34:56 2014
+++ src/sys/dev/pci/pcidevs	Sat Jan 17 21:48:05 2015
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1199.2.1 2014/11/07 21:34:56 snj Exp $
+$NetBSD: pcidevs,v 1.1199.2.2 2015/01/17 21:48:05 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4918,6 +4918,7 @@ product REALTEK RTS5209		0x5209	RTS5209 
 product REALTEK RTS5227		0x5227	RTS5227 PCI-E Card Reader
 product REALTEK RTS5229		0x5229	RTS5229 PCI-E Card Reader
 product REALTEK RTS5249		0x5249	RTS5249 PCI-E Card Reader
+product REALTEK RTL8402		0x5286	RTL8402 PCI-E Card Reader
 product REALTEK RTL8411B	0x5287	RTL8411B PCI-E Card Reader
 product REALTEK RTL8411		0x5289	RTL8411 PCI-E Card Reader
 product REALTEK RT8029		0x8029	8029 Ethernet



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

2015-01-11 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan 11 13:05:13 UTC 2015

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

Log Message:
Pull up following revision(s) (requested by chs in ticket #406):
sys/dev/pci/if_dge.c: revision 1.39
fix device/softc split botch.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/dev/pci/if_dge.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_dge.c
diff -u src/sys/dev/pci/if_dge.c:1.38 src/sys/dev/pci/if_dge.c:1.38.2.1
--- src/sys/dev/pci/if_dge.c:1.38	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/pci/if_dge.c	Sun Jan 11 13:05:13 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_dge.c,v 1.38 2014/08/10 16:44:36 tls Exp $ */
+/*	$NetBSD: if_dge.c,v 1.38.2.1 2015/01/11 13:05:13 martin Exp $ */
 
 /*
  * Copyright (c) 2004, SUNET, Swedish University Computer Network.
@@ -80,7 +80,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_dge.c,v 1.38 2014/08/10 16:44:36 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_dge.c,v 1.38.2.1 2015/01/11 13:05:13 martin Exp $);
 
 
 
@@ -630,7 +630,7 @@ static uint16_t	dge_eeprom_word(struct d
 static int	dge_xgmii_mediachange(struct ifnet *);
 static void	dge_xgmii_mediastatus(struct ifnet *, struct ifmediareq *);
 static void	dge_xgmii_reset(struct dge_softc *);
-static void	dge_xgmii_writereg(device_t, int, int, int);
+static void	dge_xgmii_writereg(struct dge_softc *, int, int, int);
 
 
 CFATTACH_DECL_NEW(dge, sizeof(struct dge_softc),
@@ -2379,11 +2379,9 @@ phwait(struct dge_softc *sc, int p, int 
 return mdic;
 }
 
-
 static void
-dge_xgmii_writereg(device_t self, int phy, int reg, int val)
+dge_xgmii_writereg(struct dge_softc *sc, int phy, int reg, int val)
 {
-	struct dge_softc *sc = device_private(self);
 	int mdic;
 
 	CSR_WRITE(sc, DGE_MDIRW, val);
@@ -2393,7 +2391,7 @@ dge_xgmii_writereg(device_t self, int ph
 		return;
 	}
 	if (((mdic = phwait(sc, phy, reg, 1, MDIO_WRITE))  MDIO_CMD)) {
-		printf(%s: read cycle timeout; phy %d reg %d\n,
+		printf(%s: write cycle timeout; phy %d reg %d\n,
 		device_xname(sc-sc_dev), phy, reg);
 		return;
 	}
@@ -2402,7 +2400,7 @@ dge_xgmii_writereg(device_t self, int ph
 static void
 dge_xgmii_reset(struct dge_softc *sc)
 {
-	dge_xgmii_writereg((void *)sc, 0, 0, BMCR_RESET);
+	dge_xgmii_writereg(sc, 0, 0, BMCR_RESET);
 }
 
 static int



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

2014-12-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Dec 29 17:01:01 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #354):
sys/dev/pci/if_vioif.c: revision 1.14
Reuse mbuf when retrying in vioif_start
Otherwise, the old mbuf will leak.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.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.7 src/sys/dev/pci/if_vioif.c:1.7.2.1
--- src/sys/dev/pci/if_vioif.c:1.7	Tue Jul 22 02:21:50 2014
+++ src/sys/dev/pci/if_vioif.c	Mon Dec 29 17:01:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vioif.c,v 1.7 2014/07/22 02:21:50 ozaki-r Exp $	*/
+/*	$NetBSD: if_vioif.c,v 1.7.2.1 2014/12/29 17:01:01 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.7 2014/07/22 02:21:50 ozaki-r Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vioif.c,v 1.7.2.1 2014/12/29 17:01:01 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -735,12 +735,13 @@ vioif_start(struct ifnet *ifp)
 		if (m == NULL)
 			break;
 
+retry:
 		r = virtio_enqueue_prep(vsc, vq, slot);
 		if (r == EAGAIN) {
 			ifp-if_flags |= IFF_OACTIVE;
 			vioif_tx_vq_done_locked(vq);
 			if (retry++ == 0)
-continue;
+goto retry;
 			else
 break;
 		}
@@ -763,7 +764,7 @@ vioif_start(struct ifnet *ifp)
 			ifp-if_flags |= IFF_OACTIVE;
 			vioif_tx_vq_done_locked(vq);
 			if (retry++ == 0)
-continue;
+goto retry;
 			else
 break;
 		}



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

2014-12-21 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Dec 21 19:32:48 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #338):
sys/dev/pci/if_wpi.c: revision 1.69
Consistently take the interface down when the radio swicth is off.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.68.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.68 src/sys/dev/pci/if_wpi.c:1.68.2.1
--- src/sys/dev/pci/if_wpi.c:1.68	Fri Aug  8 10:17:07 2014
+++ src/sys/dev/pci/if_wpi.c	Sun Dec 21 19:32:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wpi.c,v 1.68 2014/08/08 10:17:07 jmcneill Exp $	*/
+/*	$NetBSD: if_wpi.c,v 1.68.2.1 2014/12/21 19:32:48 snj Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.68 2014/08/08 10:17:07 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wpi.c,v 1.68.2.1 2014/12/21 19:32:48 snj Exp $);
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -3170,6 +3170,7 @@ wpi_init(struct ifnet *ifp)
 	if (wpi_getrfkill(sc)) {
 		aprint_error_dev(sc-sc_dev,
 		radio is disabled by hardware switch\n);
+		ifp-if_flags = ~IFF_UP;
 		error = EBUSY;
 		goto fail1;
 	}



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

2014-12-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Dec 14 16:49:35 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #325):
sys/dev/pci/pcireg.h: revision 1.100
sys/dev/pci/pci_subr.c: revision 1.133
Add PCIe CRS Software Visibility bit.


To generate a diff of this commit:
cvs rdiff -u -r1.124.2.1 -r1.124.2.2 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.95.2.2 -r1.95.2.3 src/sys/dev/pci/pcireg.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.124.2.1 src/sys/dev/pci/pci_subr.c:1.124.2.2
--- src/sys/dev/pci/pci_subr.c:1.124.2.1	Fri Dec 12 19:03:17 2014
+++ src/sys/dev/pci/pci_subr.c	Sun Dec 14 16:49:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.124.2.1 2014/12/12 19:03:17 martin Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.124.2.2 2014/12/14 16:49:35 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.124.2.1 2014/12/12 19:03:17 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.124.2.2 2014/12/14 16:49:35 martin Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pci.h
@@ -1697,6 +1697,7 @@ pci_conf_print_pcie_cap(const pcireg_t *
 		/* Root Capability Register */
 		printf(Root Capability Register: %04x\n,
 		reg  16);
+		onoff(CRS Software Visibility, reg, PCIE_RCR_CRS_SV);
 
 		/* Root Status Register */
 		reg = regs[o2i(capoff + PCIE_RSR)];

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.95.2.2 src/sys/dev/pci/pcireg.h:1.95.2.3
--- src/sys/dev/pci/pcireg.h:1.95.2.2	Fri Dec 12 19:03:17 2014
+++ src/sys/dev/pci/pcireg.h	Sun Dec 14 16:49:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.95.2.2 2014/12/12 19:03:17 martin Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.95.2.3 2014/12/14 16:49:35 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -976,6 +976,7 @@ typedef u_int8_t pci_revision_t;
 #define PCIE_RCR_SERR_FER	__BIT(2)   /* SERR on Fatal Error Enable */
 #define PCIE_RCR_PME_IE		__BIT(3)   /* PME Interrupt Enable */
 #define PCIE_RCR_CRS_SVE	__BIT(4)   /* CRS Software Visibility En */
+#define PCIE_RCR_CRS_SV		__BIT(16)  /* CRS Software Visibility */
 #define PCIE_RSR	0x20	/* Root Status Register */
 #define PCIE_RSR_PME_REQESTER	__BITS(15, 0)  /* PME Requester ID */
 #define PCIE_RSR_PME_STAT	__BIT(16)  /* PME Status */



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

2014-12-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 12 18:56:16 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #311):
sys/dev/pci/ppb.c: revision 1.53
sys/dev/pci/ppb.c: revision 1.54
sys/dev/pci/pcireg.h: revision 1.96
- Modify message of PCIe capability version. This field (PCIE_XCAP_VER_MASK)
  is not specification's version number but the capability structure's version
  number. To avoid confusion, print PCI Express capability version x.
- The max number of PCIe lane is not 16 but 32. Fix the bug using with macro.
- Use macro instead of magic number.
- Gb/s - GT/s
Rename PCIE_XCAP_VER_* macros to avoid confusion.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.95.2.1 src/sys/dev/pci/pcireg.h
cvs rdiff -u -r1.52 -r1.52.10.1 src/sys/dev/pci/ppb.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/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.95 src/sys/dev/pci/pcireg.h:1.95.2.1
--- src/sys/dev/pci/pcireg.h:1.95	Mon Jun  9 11:08:05 2014
+++ src/sys/dev/pci/pcireg.h	Fri Dec 12 18:56:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.95 2014/06/09 11:08:05 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.95.2.1 2014/12/12 18:56:16 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -816,8 +816,8 @@ typedef u_int8_t pci_revision_t;
 #define	PCIE_XCAP_MASK		__BITS(31, 16)
 /* Capability Version */
 #define PCIE_XCAP_VER_MASK	__SHIFTIN(__BITS(3, 0), PCIE_XCAP_MASK)
-#define	 PCIE_XCAP_VER_1_0	__SHIFTIN(1, PCIE_XCAP_VER_MASK)
-#define	 PCIE_XCAP_VER_2_0	__SHIFTIN(2, PCIE_XCAP_VER_MASK)
+#define	 PCIE_XCAP_VER_1	__SHIFTIN(1, PCIE_XCAP_VER_MASK)
+#define	 PCIE_XCAP_VER_2	__SHIFTIN(2, PCIE_XCAP_VER_MASK)
 #define	PCIE_XCAP_TYPE_MASK	__SHIFTIN(__BITS(7, 4), PCIE_XCAP_MASK)
 #define	 PCIE_XCAP_TYPE_PCIE_DEV __SHIFTIN(0x0, PCIE_XCAP_TYPE_MASK)
 #define	 PCIE_XCAP_TYPE_PCI_DEV	__SHIFTIN(0x1, PCIE_XCAP_TYPE_MASK)

Index: src/sys/dev/pci/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.52 src/sys/dev/pci/ppb.c:1.52.10.1
--- src/sys/dev/pci/ppb.c:1.52	Sun Apr 21 19:59:41 2013
+++ src/sys/dev/pci/ppb.c	Fri Dec 12 18:56:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.52 2013/04/21 19:59:41 msaitoh Exp $	*/
+/*	$NetBSD: ppb.c,v 1.52.10.1 2014/12/12 18:56:16 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ppb.c,v 1.52 2013/04/21 19:59:41 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: ppb.c,v 1.52.10.1 2014/12/12 18:56:16 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -108,17 +108,17 @@ ppb_fix_pcie(device_t self)
 off, reg))
 		return; /* Not a PCIe device */
 
-	aprint_normal_dev(self, PCI Express );
+	aprint_normal_dev(self, PCI Express capability version );
 	switch (reg  PCIE_XCAP_VER_MASK) {
-	case PCIE_XCAP_VER_1_0:
-		aprint_normal(1.0);
+	case PCIE_XCAP_VER_1:
+		aprint_normal(1);
 		break;
-	case PCIE_XCAP_VER_2_0:
-		aprint_normal(2.0);
+	case PCIE_XCAP_VER_2:
+		aprint_normal(2);
 		break;
 	default:
 		aprint_normal_dev(self,
-		version unsupported (0x% PRIxMAX )\n,
+		unsupported (0x% PRIxMAX )\n,
 		__SHIFTOUT(reg, PCIE_XCAP_VER_MASK));
 		return;
 	}
@@ -155,29 +155,31 @@ ppb_fix_pcie(device_t self)
 	case PCIE_XCAP_TYPE_ROOT:
 	case PCIE_XCAP_TYPE_DOWN:
 	case PCIE_XCAP_TYPE_PCI2PCIE:
-		reg = pci_conf_read(sc-sc_pc, sc-sc_tag, off + 0x0c);
-		u_int mlw = (reg  4)  0x1f;
-		u_int mls = (reg  0)  0x0f;
+		reg = pci_conf_read(sc-sc_pc, sc-sc_tag, off + PCIE_LCAP);
+		u_int mlw = __SHIFTOUT(reg, PCIE_LCAP_MAX_WIDTH);
+		u_int mls = __SHIFTOUT(reg, PCIE_LCAP_MAX_SPEED);
+
 		if (mls  __arraycount(pcie_linkspeed_strings)) {
-			aprint_normal( x%d @ %sGb/s\n,
+			aprint_normal( x%d @ %sGT/s\n,
 			mlw, pcie_linkspeed_strings[mls]);
 		} else {
-			aprint_normal( x%d @ %d.%dGb/s\n,
+			aprint_normal( x%d @ %d.%dGT/s\n,
 			mlw, (mls * 25) / 10, (mls * 25) % 10);
 		}
 
-		reg = pci_conf_read(sc-sc_pc, sc-sc_tag, off + 0x10);
-		if (reg  __BIT(29)) {	/* DLLA */
-			u_int lw = (reg  20)  0x1f;
-			u_int ls = (reg  16)  0x0f;
+		reg = pci_conf_read(sc-sc_pc, sc-sc_tag, off + PCIE_LCSR);
+		if (reg  PCIE_LCSR_DLACTIVE) {	/* DLLA */
+			u_int lw = __SHIFTOUT(reg, PCIE_LCSR_NLW);
+			u_int ls = __SHIFTOUT(reg, PCIE_LCSR_LINKSPEED);
+
 			if (lw != mlw || ls != mls) {
 if (ls  __arraycount(pcie_linkspeed_strings)) {
 	aprint_normal_dev(self,
-	link is x%d @ %sGb/s\n,
+	link is x%d @ %sGT/s\n,
 	lw, pcie_linkspeed_strings[ls]);
 } else {
 	aprint_normal_dev(self,
-	link is x%d @ %d.%dGb/s\n,
+	link is x%d @ %d.%dGT/s\n,
 	lw, (ls * 25) / 10, (ls * 25) % 10);
 }
 			}



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

2014-12-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Dec 12 19:03:17 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #312):
sys/dev/pci/pci_subr.c: revision 1.130
sys/dev/pci/pci_subr.c: revision 1.131
sys/dev/pci/pci_subr.c: revision 1.132
sys/dev/pci/pcireg.h: revision 1.97
sys/dev/pci/pcireg.h: revision 1.98
sys/dev/pci/pcireg.h: revision 1.99
sys/dev/pci/pci_subr.c: revision 1.127
sys/dev/pci/pci_subr.c: revision 1.128
sys/dev/pci/pci_subr.c: revision 1.129
 Always print the Slot implemented bit in the PCIe Capabilities
Register using with onoff().
- Add some PCI subclass and interfaces.
- The interface of PCI_SUBCLASS_BRIDGE_RACEWAY is not decoded yet.
- Fix typo in a message.
- Add comment.
- Modify comment.
s/genric/generic/
Add comment.
Fix typo in comment.
 Fix a bug that the specification revision of the Power Management function
was incorrectly printed in the output of capability list.
The value is also printed in the detail output and it has no bug.
- Cleanup pci_conf_print_caplist. Use table. The reason why it loops twice
  is that some capabilities appear multiple times (e.g. HyperTransport cap).
- Print the specification revision of Power Management and AGP not in
  the capability list part but in the detail part.
 Add some HyperTransport related defines. It's required for the MSI.


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.124.2.1 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.95.2.1 -r1.95.2.2 src/sys/dev/pci/pcireg.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.124 src/sys/dev/pci/pci_subr.c:1.124.2.1
--- src/sys/dev/pci/pci_subr.c:1.124	Mon Jun  9 11:08:05 2014
+++ src/sys/dev/pci/pci_subr.c	Fri Dec 12 19:03:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.124 2014/06/09 11:08:05 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.124.2.1 2014/12/12 19:03:17 martin Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.124 2014/06/09 11:08:05 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_subr.c,v 1.124.2.1 2014/12/12 19:03:17 martin Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pci.h
@@ -88,7 +88,7 @@ static const struct pci_class pci_subcla
 
 /*
  * Class 0x01.
- * Mass strage controller
+ * Mass storage controller
  */
 
 /* ATA programming interface */
@@ -100,7 +100,16 @@ static const struct pci_class pci_interf
 
 /* SATA programming interface */
 static const struct pci_class pci_interface_sata[] = {
+	{ vendor specific,	PCI_INTERFACE_SATA_VND,		NULL,	},
 	{ AHCI 1.0,		PCI_INTERFACE_SATA_AHCI10,	NULL,	},
+	{ Serial Storage Bus Interface, PCI_INTERFACE_SATA_SSBI, NULL, },
+	{ NULL,			0,NULL,	},
+};
+
+/* Flash programming interface */
+static const struct pci_class pci_interface_nvm[] = {
+	{ vendor specific,	PCI_INTERFACE_NVM_VND,		NULL,	},
+	{ NVMHCI 1.0,		PCI_INTERFACE_NVM_NVMHCI10,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
 
@@ -116,7 +125,8 @@ static const struct pci_class pci_subcla
 	{ SATA,		PCI_SUBCLASS_MASS_STORAGE_SATA,
 	  pci_interface_sata, },
 	{ SAS,		PCI_SUBCLASS_MASS_STORAGE_SAS,	NULL,	},
-	{ NVM,		PCI_SUBCLASS_MASS_STORAGE_NVM,	NULL,	},
+	{ Flash,		PCI_SUBCLASS_MASS_STORAGE_NVM,
+	  pci_interface_nvm,	},
 	{ miscellaneous,	PCI_SUBCLASS_MASS_STORAGE_MISC,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
@@ -165,7 +175,7 @@ static const struct pci_class pci_subcla
 	{ video,		PCI_SUBCLASS_MULTIMEDIA_VIDEO,	NULL,	},
 	{ audio,		PCI_SUBCLASS_MULTIMEDIA_AUDIO,	NULL,	},
 	{ telephony,		PCI_SUBCLASS_MULTIMEDIA_TELEPHONY, NULL,},
-	{ HD audio,		PCI_SUBCLASS_MULTIMEDIA_HDAUDIO, NULL,	},
+	{ mixed mode,		PCI_SUBCLASS_MULTIMEDIA_HDAUDIO, NULL, },
 	{ miscellaneous,	PCI_SUBCLASS_MULTIMEDIA_MISC,	NULL,	},
 	{ NULL,			0,NULL,	},
 };
@@ -193,13 +203,20 @@ static const struct pci_class pci_interf
 	{ NULL,			0,NULL,	},
 };
 
-/* Semi-transparent PCI-toPCI bridge programming interface */
+/* Semi-transparent PCI-to-PCI bridge programming interface */
 static const struct pci_class pci_interface_stpci[] = {
 	{ primary side facing host,	PCI_INTERFACE_STPCI_PRIMARY, NULL, },
 	{ secondary side facing host,	PCI_INTERFACE_STPCI_SECONDARY, NULL, },
 	{ NULL,			0,NULL,	},
 };
 
+/* Advanced Switching programming interface */
+static const struct pci_class pci_interface_advsw[] = {
+	{ custom interface,	PCI_INTERFACE_ADVSW_CUSTOM, NULL, },
+	{ ASI-SIG,		PCI_INTERFACE_ADVSW_ASISIG, NULL, },
+	{ NULL,			0,NULL,	},
+};
+
 /* Subclasses */
 static const struct pci_class pci_subclass_bridge[] = {
 	{ host,		PCI_SUBCLASS_BRIDGE_HOST,	NULL,	},
@@ -215,6 +232,8 @@ static const struct pci_class pci_subcla
 	{ 

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

2014-10-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 30 10:36:52 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by nonaka in ticket #162):
sys/dev/pci/hdaudio/hdaudio_pci.c: revision 1.13
disestalish interrupt and unmap register when attach failed.


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

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

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12 src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12.4.1
--- src/sys/dev/pci/hdaudio/hdaudio_pci.c:1.12	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/hdaudio/hdaudio_pci.c	Thu Oct 30 10:36:52 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.12 2014/03/29 19:28:25 christos Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.12.4.1 2014/10/30 10:36:52 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd supp...@precedence.co.uk
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hdaudio_pci.c,v 1.12 2014/03/29 19:28:25 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: hdaudio_pci.c,v 1.12.4.1 2014/10/30 10:36:52 martin Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -162,7 +162,17 @@ hdaudio_pci_attach(device_t parent, devi
 	hdaudio_pci_reinit(sc);
 
 	/* Attach bus-independent HD audio layer */
-	hdaudio_attach(self, sc-sc_hdaudio);
+	if (hdaudio_attach(self, sc-sc_hdaudio)) {
+		pci_intr_disestablish(sc-sc_pc, sc-sc_ih);
+		sc-sc_ih = NULL;
+		bus_space_unmap(sc-sc_hdaudio.sc_memt,
+sc-sc_hdaudio.sc_memh,
+sc-sc_hdaudio.sc_memsize);
+		sc-sc_hdaudio.sc_memvalid = false;
+		csr = pci_conf_read(sc-sc_pc, sc-sc_tag, PCI_COMMAND_STATUS_REG);
+		csr = ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE);
+		pci_conf_write(sc-sc_pc, sc-sc_tag, PCI_COMMAND_STATUS_REG, csr);
+	}
 }
 
 static int



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

2014-09-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 18 10:25:33 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #94):
sys/dev/pci/agp_i810.c: revision 1.113
sys/dev/pci/agp_i810.c: revision 1.114
Revert to mapping the whole GTTMMADR region all at once for now and
use the right BAR for MMIO register sizing on i810.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.112.2.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.112 src/sys/dev/pci/agp_i810.c:1.112.2.1
--- src/sys/dev/pci/agp_i810.c:1.112	Fri Jul 25 23:05:54 2014
+++ src/sys/dev/pci/agp_i810.c	Thu Sep 18 10:25:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: agp_i810.c,v 1.112 2014/07/25 23:05:54 riastradh Exp $	*/
+/*	$NetBSD: agp_i810.c,v 1.112.2.1 2014/09/18 10:25:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.112 2014/07/25 23:05:54 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_i810.c,v 1.112.2.1 2014/09/18 10:25:33 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -405,7 +405,9 @@ agp_i810_attach(device_t parent, device_
 		apbase = AGP_I965_GMADR;
 		mmadr_bar = AGP_I965_MMADR;
 		mmadr_type |= PCI_MAPREG_MEM_TYPE_64BIT;
-		isc-size = 512*1024;
+		if (pci_mapreg_info(isc-vga_pa.pa_pc, isc-vga_pa.pa_tag,
+			AGP_I965_MMADR, mmadr_type, NULL, isc-size, NULL))
+			isc-size = 512*1024; /* XXX */
 		gtt_bar = 0;
 		gtt_off = AGP_I965_GTT;
 		break;
@@ -413,14 +415,18 @@ agp_i810_attach(device_t parent, device_
 		apbase = AGP_I965_GMADR;
 		mmadr_bar = AGP_I965_MMADR;
 		mmadr_type |= PCI_MAPREG_MEM_TYPE_64BIT;
-		isc-size = 512*1024;
+		if (pci_mapreg_info(isc-vga_pa.pa_pc, isc-vga_pa.pa_tag,
+			AGP_I965_MMADR, mmadr_type, NULL, isc-size, NULL))
+			isc-size = 512*1024; /* XXX */
 		gtt_bar = 0;
 		gtt_off = AGP_G4X_GTT;
 		break;
 	default:
 		apbase = AGP_I810_GMADR;
 		mmadr_bar = AGP_I810_MMADR;
-		isc-size = 512*1024;
+		if (pci_mapreg_info(isc-vga_pa.pa_pc, isc-vga_pa.pa_tag,
+			AGP_I810_MMADR, mmadr_type, NULL, isc-size, NULL))
+			isc-size = 512*1024; /* XXX */
 		gtt_bar = 0;
 		gtt_off = AGP_I810_GTT;
 		break;



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

2014-08-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 29 11:37:51 UTC 2014

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

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #61):
sys/dev/pci/if_wm.c: revision 1.290
sys/dev/pci/if_wmvar.h: revision 1.20
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.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.289.2.1 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.19 -r1.19.2.1 src/sys/dev/pci/if_wmvar.h

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289 src/sys/dev/pci/if_wm.c:1.289.2.1
--- src/sys/dev/pci/if_wm.c:1.289	Sun Aug 10 16:44:36 2014
+++ src/sys/dev/pci/if_wm.c	Fri Aug 29 11:37:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289 2014/08/10 16:44:36 tls Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.1 2014/08/29 11:37:51 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289 2014/08/10 16:44:36 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_wm.c,v 1.289.2.1 2014/08/29 11:37:51 martin Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1718,7 +1718,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) *
@@ -1838,7 +1838,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;
 		}
 	}
 
@@ -1856,7 +1856,7 @@ wm_attach(device_t parent, device_t self
 	} else {
 		if (wm_nvm_read(sc, EEPROM_OFF_CFG1, 1, cfg1)) {
 			aprint_error_dev(sc-sc_dev, unable to read CFG1\n);
-			return;
+			goto fail_5;
 		}
 	}
 
@@ -1867,7 +1867,7 @@ wm_attach(device_t parent, device_t self
 	} else {
 		if (wm_nvm_read(sc, EEPROM_OFF_CFG2, 1, cfg2)) {
 			aprint_error_dev(sc-sc_dev, unable to read CFG2\n);
-			return;
+			goto fail_5;
 		}
 	}
 
@@ -1937,7 +1937,7 @@ wm_attach(device_t parent, device_t self
 			if (wm_nvm_read(sc, EEPROM_OFF_SWDPIN, 1, swdpin)) {
 aprint_error_dev(sc-sc_dev,
 unable to read SWDPIN\n);
-return;
+goto fail_5;
 			}
 		}
 	}
@@ -2253,6 +2253,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;
 
 	/*
@@ -2292,7 +2293,12 @@ wm_detach(device_t self, int flags __unu
 	int i;
 #ifndef WM_MPSAFE
 	int s;
+#endif
 
+	if ((sc-sc_flags  WM_F_ATTACHED) == 0)
+		return 0;
+
+#ifndef WM_MPSAFE
 	s = splnet();
 #endif
 	/* Stop the interface. Callouts are stopped in it. */

Index: src/sys/dev/pci/if_wmvar.h
diff -u src/sys/dev/pci/if_wmvar.h:1.19 src/sys/dev/pci/if_wmvar.h:1.19.2.1
--- src/sys/dev/pci/if_wmvar.h:1.19	Mon Jul 14 05:00:18 2014
+++ src/sys/dev/pci/if_wmvar.h	Fri Aug 29 11:37:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmvar.h,v 1.19 2014/07/14 05:00:18 msaitoh Exp $	*/
+/*	$NetBSD: if_wmvar.h,v 1.19.2.1 2014/08/29 11:37:51 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -95,6 +95,7 @@
 #define WM_F_HAS_MANAGE		0x0010
 #define WM_F_WOL		0x0020
 #define WM_F_EEE		0x0040 /* Energy Efficiency Ethernet */
+#define WM_F_ATTACHED		0x0080 /* attach() fininsed successfully */
 
 typedef enum {
 	WM_T_unknown		= 0,