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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 14:04:38 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: esm.c

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

sys/dev/pci/esm.c: revision 1.64

add missing break.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/dev/pci/esm.c

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



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 14:04:38 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: esm.c

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

sys/dev/pci/esm.c: revision 1.64

add missing break.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/dev/pci/esm.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/esm.c
diff -u src/sys/dev/pci/esm.c:1.63 src/sys/dev/pci/esm.c:1.63.2.1
--- src/sys/dev/pci/esm.c:1.63	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/esm.c	Wed Nov 27 14:04:38 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: esm.c,v 1.63 2019/06/08 08:02:38 isaki Exp $  */
+/*  $NetBSD: esm.c,v 1.63.2.1 2019/11/27 14:04:38 martin Exp $  */
 
 /*-
  * Copyright (c) 2002, 2003 Matt Fredette
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.63 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.63.2.1 2019/11/27 14:04:38 martin Exp $");
 
 #include 
 #include 
@@ -1482,6 +1482,7 @@ esm_match(device_t dev, cfdata_t match, 
 		case PCI_PRODUCT_ESSTECH_MAESTRO2E:
 			return 1;
 		}
+		break;
 
 	case PCI_VENDOR_ESSTECH2:
 		switch (PCI_PRODUCT(pa->pa_id)) {



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 14:03:14 UTC 2019

Modified Files:
src/sys/dev/ieee1394 [netbsd-9]: fwohci.c
src/sys/dev/pci [netbsd-9]: eso.c sv.c

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

sys/dev/pci/sv.c: revision 1.57
sys/dev/pci/eso.c: revision 1.72
sys/dev/ieee1394/fwohci.c: revision 1.144

Fix operand priority of bit op vs ternary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.142.2.1 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/eso.c
cvs rdiff -u -r1.56 -r1.56.2.1 src/sys/dev/pci/sv.c

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



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 14:03:14 UTC 2019

Modified Files:
src/sys/dev/ieee1394 [netbsd-9]: fwohci.c
src/sys/dev/pci [netbsd-9]: eso.c sv.c

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

sys/dev/pci/sv.c: revision 1.57
sys/dev/pci/eso.c: revision 1.72
sys/dev/ieee1394/fwohci.c: revision 1.144

Fix operand priority of bit op vs ternary operator.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.142.2.1 src/sys/dev/ieee1394/fwohci.c
cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/eso.c
cvs rdiff -u -r1.56 -r1.56.2.1 src/sys/dev/pci/sv.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/ieee1394/fwohci.c
diff -u src/sys/dev/ieee1394/fwohci.c:1.142 src/sys/dev/ieee1394/fwohci.c:1.142.2.1
--- src/sys/dev/ieee1394/fwohci.c:1.142	Tue May 28 08:59:34 2019
+++ src/sys/dev/ieee1394/fwohci.c	Wed Nov 27 14:03:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwohci.c,v 1.142 2019/05/28 08:59:34 msaitoh Exp $	*/
+/*	$NetBSD: fwohci.c,v 1.142.2.1 2019/11/27 14:03:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.142 2019/05/28 08:59:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.142.2.1 2019/11/27 14:03:14 martin Exp $");
 
 #include 
 #include 
@@ -1746,8 +1746,8 @@ fwohci_db_init(struct fwohci_softc *sc, 
 	dbch->ndb, BUS_DMA_WAITOK);
 #else	/* Ooops, debugging now... */
 	dbch->ndb, BUS_DMA_WAITOK |
-		(dbch->off == OHCI_ARQOFF || dbch->off == OHCI_ARSOFF) ?
-			BUS_DMA_COHERENT : 0);
+		((dbch->off == OHCI_ARQOFF || dbch->off == OHCI_ARSOFF) ?
+			BUS_DMA_COHERENT : 0));
 #endif
 	if (dbch->am == NULL) {
 		aprint_error_dev(fc->dev, "fwdma_malloc_multiseg failed\n");

Index: src/sys/dev/pci/eso.c
diff -u src/sys/dev/pci/eso.c:1.71 src/sys/dev/pci/eso.c:1.71.2.1
--- src/sys/dev/pci/eso.c:1.71	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/eso.c	Wed Nov 27 14:03:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: eso.c,v 1.71 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: eso.c,v 1.71.2.1 2019/11/27 14:03:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.71 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eso.c,v 1.71.2.1 2019/11/27 14:03:14 martin Exp $");
 
 #include "mpu.h"
 
@@ -1489,7 +1489,7 @@ eso_allocmem(struct eso_softc *sc, size_
 
 	error = bus_dmamap_load(ed->ed_dmat, ed->ed_map, ed->ed_kva,
 	ed->ed_size, NULL, BUS_DMA_WAITOK |
-	(direction == AUMODE_RECORD) ? BUS_DMA_READ : BUS_DMA_WRITE);
+	((direction == AUMODE_RECORD) ? BUS_DMA_READ : BUS_DMA_WRITE));
 	if (error)
 		goto destroy;
 

Index: src/sys/dev/pci/sv.c
diff -u src/sys/dev/pci/sv.c:1.56 src/sys/dev/pci/sv.c:1.56.2.1
--- src/sys/dev/pci/sv.c:1.56	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/sv.c	Wed Nov 27 14:03:14 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: sv.c,v 1.56 2019/06/08 08:02:38 isaki Exp $ */
+/*  $NetBSD: sv.c,v 1.56.2.1 2019/11/27 14:03:14 martin Exp $ */
 /*  $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */
 
 /*
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.56 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.56.2.1 2019/11/27 14:03:14 martin Exp $");
 
 #include 
 #include 
@@ -530,7 +530,7 @@ sv_allocmem(struct sv_softc *sc, size_t 
 		goto unmap;
 
 	error = bus_dmamap_load(sc->sc_dmatag, p->map, p->addr, p->size, NULL,
-	BUS_DMA_WAITOK | (direction == AUMODE_RECORD) ? BUS_DMA_READ : BUS_DMA_WRITE);
+	BUS_DMA_WAITOK | ((direction == AUMODE_RECORD) ? BUS_DMA_READ : BUS_DMA_WRITE));
 	if (error)
 		goto destroy;
 	DPRINTF(("sv_allocmem: pa=%lx va=%lx pba=%lx\n",



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 11:19:46 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ipgphy.c

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

sys/dev/mii/ipgphy.c: revision 1.7

Print dmesg correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/mii/ipgphy.c

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



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 11:19:46 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ipgphy.c

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

sys/dev/mii/ipgphy.c: revision 1.7

Print dmesg correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.2 -r1.6.2.3 src/sys/dev/mii/ipgphy.c

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

Modified files:

Index: src/sys/dev/mii/ipgphy.c
diff -u src/sys/dev/mii/ipgphy.c:1.6.2.2 src/sys/dev/mii/ipgphy.c:1.6.2.3
--- src/sys/dev/mii/ipgphy.c:1.6.2.2	Mon Nov 25 16:44:31 2019
+++ src/sys/dev/mii/ipgphy.c	Wed Nov 27 11:19:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipgphy.c,v 1.6.2.2 2019/11/25 16:44:31 martin Exp $ */
+/*	$NetBSD: ipgphy.c,v 1.6.2.3 2019/11/27 11:19:46 martin Exp $ */
 /*	$OpenBSD: ipgphy.c,v 1.19 2015/07/19 06:28:12 yuo Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  * Driver for the IC Plus IP1000A/IP1001 10/100/1000 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.6.2.2 2019/11/25 16:44:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipgphy.c,v 1.6.2.3 2019/11/27 11:19:46 martin Exp $");
 
 #include 
 #include 
@@ -118,7 +118,8 @@ ipgphy_attach(device_t parent, device_t 
 	//sc->mii_capabilities &= ~BMSR_ANEG;
 	if (sc->mii_capabilities & BMSR_EXTSTAT)
 		PHY_READ(sc, MII_EXTSR, >mii_extcapabilities);
- 
+
+	aprint_normal_dev(self, "");
 	mii_phy_add_media(sc);
 	aprint_normal("\n");
 }



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

2019-11-27 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov 27 11:08:24 UTC 2019

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

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

sys/dev/pci/if_bge.c: revision 1.340
sys/dev/pci/if_bge.c: revision 1.341
sys/dev/pci/if_bge.c: revision 1.342
sys/dev/pci/if_bge.c: revision 1.336

- Avoid undefined behavior in bge_setmulti(). found by kUBSan.
- Avoid undefined behavior when setting the MAC address in bge_init().
  found by kUBSan.

 Fix a bug that SK-9D41 can't detect fiber media. Check the subsystem ID
correctly. This bug was added in if_bge.c rev. 1.161.

- Use *_FLUSH() more. The main purpose is to wait following delay() correctly.
- Add missing DELAY(80) after writing BGE_MI_MODE register.

 Modify PHY initialization code. This change fix a bug that SK-9D21 doesn't
detect MII PHY.
 - Add error check to bge_miibus_writereg().
 - Change return value of bge_miibus_readreg() when a read error occurred.
   It also add error message using with aprint_debug_dev(). This error occurs
   on some devices while detecting MII devices.
 - Move the location of BGE_MI_MODE register's initialization to next to
   bge_chipinit().
 - Set BGE_MAC_MODE before calling ifmedia_init() and/or mii_attach().
 - Add retry code for mii_attach() failed. Same as FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.335.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.335 src/sys/dev/pci/if_bge.c:1.335.2.1
--- src/sys/dev/pci/if_bge.c:1.335	Tue Jul  9 08:46:58 2019
+++ src/sys/dev/pci/if_bge.c	Wed Nov 27 11:08:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.335 2019/07/09 08:46:58 msaitoh Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.335.2.1 2019/11/27 11:08:24 martin Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.335 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.335.2.1 2019/11/27 11:08:24 martin Exp $");
 
 #include 
 #include 
@@ -1027,10 +1027,10 @@ bge_eeprom_getbyte(struct bge_softc *sc,
 	 * Enable use of auto EEPROM access so we can avoid
 	 * having to use the bitbang method.
 	 */
-	BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
+	BGE_SETBIT_FLUSH(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_AUTO_EEPROM);
 
 	/* Reset the EEPROM, load the clock period. */
-	CSR_WRITE_4(sc, BGE_EE_ADDR,
+	CSR_WRITE_4_FLUSH(sc, BGE_EE_ADDR,
 	BGE_EEADDR_RESET | BGE_EEHALFCLK(BGE_HALFCLK_384SCL));
 	DELAY(20);
 
@@ -1113,9 +1113,11 @@ bge_miibus_readreg(device_t dev, int phy
 	if (i == BGE_TIMEOUT) {
 		aprint_error_dev(sc->bge_dev, "PHY read timed out\n");
 		rv = ETIMEDOUT;
-	} else if ((data & BGE_MICOMM_READFAIL) != 0)
-		rv = -1;
-	else
+	} else if ((data & BGE_MICOMM_READFAIL) != 0) {
+		/* XXX This error occurs on some devices while attaching. */
+		aprint_debug_dev(sc->bge_dev, "PHY read I/O error\n");
+		rv = EIO;
+	} else
 		*val = data & BGE_MICOMM_DATA;
 
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -1133,7 +1135,8 @@ static int
 bge_miibus_writereg(device_t dev, int phy, int reg, uint16_t val)
 {
 	struct bge_softc *sc = device_private(dev);
-	uint32_t autopoll;
+	uint32_t data, autopoll;
+	int rv = 0;
 	int i;
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 &&
@@ -1156,13 +1159,22 @@ bge_miibus_writereg(device_t dev, int ph
 
 	for (i = 0; i < BGE_TIMEOUT; i++) {
 		delay(10);
-		if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) {
+		data = CSR_READ_4(sc, BGE_MI_COMM);
+		if (!(data & BGE_MICOMM_BUSY)) {
 			delay(5);
-			CSR_READ_4(sc, BGE_MI_COMM);
+			data = CSR_READ_4(sc, BGE_MI_COMM);
 			break;
 		}
 	}
 
+	if (i == BGE_TIMEOUT) {
+		aprint_error_dev(sc->bge_dev, "PHY write timed out\n");
+		rv = ETIMEDOUT;
+	} else if ((data & BGE_MICOMM_READFAIL) != 0) {
+		aprint_error_dev(sc->bge_dev, "PHY write I/O error\n");
+		rv = EIO;
+	}
+
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
 		BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL);
 		BGE_SETBIT_FLUSH(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL);
@@ -1176,7 +1188,7 @@ bge_miibus_writereg(device_t dev, int ph
 		return ETIMEDOUT;
 	}
 
-	return 0;
+	return rv;
 }
 
 static void
@@ -1827,7 +1839,7 @@ bge_setmulti(struct bge_softc *sc)
 		/* Just want the 7 least-significant bits. */
 		h &= 0x7f;
 
-		hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F);
+		hashes[(h & 0x60) >> 5] |= 1U << (h & 0x1F);
 		ETHER_NEXT_MULTI(step, enm);
 	}
 	ETHER_UNLOCK(ec);
@@ -2286,7 +2298,7 @@ bge_chipinit(struct bge_softc *sc)
 #endif
 
 	/* Set the timer prescaler (always 66MHz) */
-	CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
+	CSR_WRITE_4_FLUSH(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906) {
 		DELAY(40);	/* XXX */
@@ 

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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 18:30:57 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_mcx.c

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

sys/dev/pci/if_mcx.c: revision 1.7

Fix IFF_ALLMULTI handling.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/dev/pci/if_mcx.c

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



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 18:30:57 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_mcx.c

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

sys/dev/pci/if_mcx.c: revision 1.7

Fix IFF_ALLMULTI handling.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/dev/pci/if_mcx.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_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.1.2.5 src/sys/dev/pci/if_mcx.c:1.1.2.6
--- src/sys/dev/pci/if_mcx.c:1.1.2.5	Mon Nov 18 19:46:33 2019
+++ src/sys/dev/pci/if_mcx.c	Tue Nov 26 18:30:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.1.2.5 2019/11/18 19:46:33 martin Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.1.2.6 2019/11/26 18:30:57 martin Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -6205,8 +6205,11 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 {
 	struct mcx_softc *sc = (struct mcx_softc *)ifp->if_softc;
 	struct ifreq *ifr = (struct ifreq *)data;
+	struct ethercom *ec = >sc_ec;
 	uint8_t addrhi[ETHER_ADDR_LEN], addrlo[ETHER_ADDR_LEN];
-	int s, i, error = 0;
+	struct ether_multi *enm;
+	struct ether_multistep step;
+	int s, i, flags, error = 0;
 
 	s = splnet();
 	switch (cmd) {
@@ -6214,8 +6217,10 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 	case SIOCADDMULTI:
 		if (ether_addmulti(ifreq_getaddr(cmd, ifr), >sc_ec) == ENETRESET) {
 			error = ether_multiaddr(>ifr_addr, addrlo, addrhi);
-			if (error != 0)
+			if (error != 0) {
+splx(s);
 return (error);
+			}
 
 			for (i = 0; i < MCX_NUM_MCAST_FLOWS; i++) {
 if (sc->sc_mcast_flows[i][0] == 0) {
@@ -6238,7 +6243,7 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 	error = ENETRESET;
 }
 
-if (sc->sc_ec.ec_multicnt > 0) {
+if (memcmp(addrlo, addrhi, ETHER_ADDR_LEN)) {
 	SET(ifp->if_flags, IFF_ALLMULTI);
 	error = ENETRESET;
 }
@@ -6249,8 +6254,10 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 	case SIOCDELMULTI:
 		if (ether_delmulti(ifreq_getaddr(cmd, ifr), >sc_ec) == ENETRESET) {
 			error = ether_multiaddr(>ifr_addr, addrlo, addrhi);
-			if (error != 0)
+			if (error != 0) {
+splx(s);
 return (error);
+			}
 
 			for (i = 0; i < MCX_NUM_MCAST_FLOWS; i++) {
 if (memcmp(sc->sc_mcast_flows[i], addrlo,
@@ -6269,10 +6276,23 @@ mcx_ioctl(struct ifnet *ifp, u_long cmd,
 sc->sc_extra_mcast--;
 
 			if (ISSET(ifp->if_flags, IFF_ALLMULTI) &&
-			(sc->sc_extra_mcast == 0) &&
-			(sc->sc_ec.ec_multicnt == 0)) {
-CLR(ifp->if_flags, IFF_ALLMULTI);
-error = ENETRESET;
+			sc->sc_extra_mcast == 0) {
+flags = 0;
+ETHER_LOCK(ec);
+ETHER_FIRST_MULTI(step, ec, enm);
+while (enm != NULL) {
+	if (memcmp(enm->enm_addrlo,
+	enm->enm_addrhi, ETHER_ADDR_LEN)) {
+		SET(flags, IFF_ALLMULTI);
+		break;
+	}
+	ETHER_NEXT_MULTI(step, enm);
+}
+ETHER_UNLOCK(ec);
+if (!ISSET(flags, IFF_ALLMULTI)) {
+	CLR(ifp->if_flags, IFF_ALLMULTI);
+	error = ENETRESET;
+}
 			}
 		}
 		break;



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:22:51 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: if_hvn.c

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

sys/dev/hyperv/if_hvn.c: revision 1.11

hvn(4): Fix incorrect ident when waiting for NVS command response.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.4 -r1.4.2.5 src/sys/dev/hyperv/if_hvn.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/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.4.2.4 src/sys/dev/hyperv/if_hvn.c:1.4.2.5
--- src/sys/dev/hyperv/if_hvn.c:1.4.2.4	Mon Nov 25 16:58:54 2019
+++ src/sys/dev/hyperv/if_hvn.c	Tue Nov 26 08:22:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.4.2.4 2019/11/25 16:58:54 martin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.4.2.5 2019/11/26 08:22:51 martin Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.4 2019/11/25 16:58:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.5 2019/11/26 08:22:51 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1097,7 +1097,8 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			hvn_nvs_intr(sc);
 			splx(s);
 		} else
-			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
+			tsleep(sc->sc_nvsrsp, PRIBIO | PCATCH, "nvscmd",
+			mstohz(1));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:22:51 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: if_hvn.c

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

sys/dev/hyperv/if_hvn.c: revision 1.11

hvn(4): Fix incorrect ident when waiting for NVS command response.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.4 -r1.4.2.5 src/sys/dev/hyperv/if_hvn.c

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



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:20:47 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_age.c if_alc.c if_ale.c if_cas.c

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

sys/dev/pci/if_cas.c: revision 1.36
sys/dev/pci/if_alc.c: revision 1.44
sys/dev/pci/if_ale.c: revision 1.35
sys/dev/pci/if_ale.c: revision 1.36
sys/dev/pci/if_age.c: revision 1.64

Fix a bug that IFF_ALLMULTI is almost always set.
 OpenBSD's ac_multirangecnt is not NetBSD's ec_multicnt.

 Remove accidentally committed debug code. Sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/dev/pci/if_cas.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_age.c
diff -u src/sys/dev/pci/if_age.c:1.60.2.3 src/sys/dev/pci/if_age.c:1.60.2.4
--- src/sys/dev/pci/if_age.c:1.60.2.3	Tue Nov 26 08:18:40 2019
+++ src/sys/dev/pci/if_age.c	Tue Nov 26 08:20:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $ */
+/*	$NetBSD: if_age.c,v 1.60.2.4 2019/11/26 08:20:47 martin Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.4 2019/11/26 08:20:47 martin Exp $");
 
 #include "vlan.h"
 
@@ -2275,27 +2275,37 @@ age_rxfilter(struct age_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_LOCK(ec);
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		ETHER_NEXT_MULTI(step, enm);
+	}
+	ETHER_UNLOCK(ec);
+
+update:
+	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if (ifp->if_flags & IFF_PROMISC) {
 			rxcfg |= MAC_CFG_PROMISC;
-		else
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+		} else
 			rxcfg |= MAC_CFG_ALLMULTI;
 		mchash[0] = mchash[1] = 0x;
-	} else {
-		/* Program new filter. */
-		memset(mchash, 0, sizeof(mchash));
-
-		ETHER_LOCK(ec);
-		ETHER_FIRST_MULTI(step, ec, enm);
-		while (enm != NULL) {
-			crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
-			mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
-			ETHER_NEXT_MULTI(step, enm);
-		}
-		ETHER_UNLOCK(ec);
 	}
-
 	CSR_WRITE_4(sc, AGE_MAR0, mchash[0]);
 	CSR_WRITE_4(sc, AGE_MAR1, mchash[1]);
 	CSR_WRITE_4(sc, AGE_MAC_CFG, rxcfg);

Index: src/sys/dev/pci/if_alc.c
diff -u src/sys/dev/pci/if_alc.c:1.38.2.2 src/sys/dev/pci/if_alc.c:1.38.2.3
--- src/sys/dev/pci/if_alc.c:1.38.2.2	Wed Nov  6 09:59:38 2019
+++ src/sys/dev/pci/if_alc.c	Tue Nov 26 08:20:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_alc.c,v 1.38.2.2 2019/11/06 09:59:38 martin Exp $	*/
+/*	$NetBSD: if_alc.c,v 1.38.2.3 2019/11/26 08:20:47 martin Exp $	*/
 /*	$OpenBSD: if_alc.c,v 1.1 2009/08/08 09:31:13 kevlo Exp $	*/
 /*-
  * Copyright (c) 2009, Pyun YongHyeon 
@@ -3443,27 +3443,37 @@ alc_iff(struct alc_softc *sc)
 	 */
 	rxcfg |= MAC_CFG_BCAST;
 
-	if (ifp->if_flags & IFF_PROMISC || ec->ec_multicnt > 0) {
-		ifp->if_flags |= IFF_ALLMULTI;
-		if (ifp->if_flags & IFF_PROMISC)
+	/* Program new filter. */
+	if ((ifp->if_flags & IFF_PROMISC) != 0)
+		goto update;
+
+	memset(mchash, 0, sizeof(mchash));
+
+	ETHER_LOCK(ec);
+	ETHER_FIRST_MULTI(step, ec, enm);
+	while (enm != NULL) {
+		if (memcmp(enm->enm_addrlo, enm->enm_addrhi, ETHER_ADDR_LEN)) {
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+			ETHER_UNLOCK(ec);
+			goto update;
+		}
+		crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
+		mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
+		ETHER_NEXT_MULTI(step, enm);
+	}
+	ETHER_UNLOCK(ec);
+
+update:
+	if ((ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) != 0) {
+		if (ifp->if_flags & IFF_PROMISC) {
 			rxcfg |= MAC_CFG_PROMISC;
-		else
+			/* XXX Use ETHER_F_ALLMULTI in future. */
+			ifp->if_flags |= IFF_ALLMULTI;
+		} else
 			rxcfg |= MAC_CFG_ALLMULTI;
 		mchash[0] = mchash[1] = 0x;
-	} else {
-		/* Program new filter. */
-		memset(mchash, 0, sizeof(mchash));
-
-		

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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:20:47 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_age.c if_alc.c if_ale.c if_cas.c

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

sys/dev/pci/if_cas.c: revision 1.36
sys/dev/pci/if_alc.c: revision 1.44
sys/dev/pci/if_ale.c: revision 1.35
sys/dev/pci/if_ale.c: revision 1.36
sys/dev/pci/if_age.c: revision 1.64

Fix a bug that IFF_ALLMULTI is almost always set.
 OpenBSD's ac_multirangecnt is not NetBSD's ec_multicnt.

 Remove accidentally committed debug code. Sorry.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.3 -r1.60.2.4 src/sys/dev/pci/if_age.c
cvs rdiff -u -r1.38.2.2 -r1.38.2.3 src/sys/dev/pci/if_alc.c
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/sys/dev/pci/if_ale.c
cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/dev/pci/if_cas.c

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



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:18:40 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_age.c

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

sys/dev/pci/if_age.c: revision 1.63

Fix multicast handling. All Atheros controllers use big-endian form
when computing multicast hash. Same as OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/pci/if_age.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_age.c
diff -u src/sys/dev/pci/if_age.c:1.60.2.2 src/sys/dev/pci/if_age.c:1.60.2.3
--- src/sys/dev/pci/if_age.c:1.60.2.2	Wed Nov  6 09:59:39 2019
+++ src/sys/dev/pci/if_age.c	Tue Nov 26 08:18:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.60.2.2 2019/11/06 09:59:39 martin Exp $ */
+/*	$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.2 2019/11/06 09:59:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60.2.3 2019/11/26 08:18:40 martin Exp $");
 
 #include "vlan.h"
 
@@ -2289,7 +2289,7 @@ age_rxfilter(struct age_softc *sc)
 		ETHER_LOCK(ec);
 		ETHER_FIRST_MULTI(step, ec, enm);
 		while (enm != NULL) {
-			crc = ether_crc32_le(enm->enm_addrlo, ETHER_ADDR_LEN);
+			crc = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
 			mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f);
 			ETHER_NEXT_MULTI(step, enm);
 		}



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

2019-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 26 08:18:40 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_age.c

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

sys/dev/pci/if_age.c: revision 1.63

Fix multicast handling. All Atheros controllers use big-endian form
when computing multicast hash. Same as OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.60.2.2 -r1.60.2.3 src/sys/dev/pci/if_age.c

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



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:58:55 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvs.c if_hvn.c

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

sys/dev/hyperv/hvs.c: revision 1.3
sys/dev/hyperv/if_hvn.c: revision 1.10

hvs(4), hvn(4): Set correct size for bus_dmamap_sync(9).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/dev/hyperv/hvs.c
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/sys/dev/hyperv/if_hvn.c

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



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:58:55 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvs.c if_hvn.c

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

sys/dev/hyperv/hvs.c: revision 1.3
sys/dev/hyperv/if_hvn.c: revision 1.10

hvs(4), hvn(4): Set correct size for bus_dmamap_sync(9).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/dev/hyperv/hvs.c
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 src/sys/dev/hyperv/if_hvn.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/hyperv/hvs.c
diff -u src/sys/dev/hyperv/hvs.c:1.1 src/sys/dev/hyperv/hvs.c:1.1.8.1
--- src/sys/dev/hyperv/hvs.c:1.1	Fri Feb 15 08:54:01 2019
+++ src/sys/dev/hyperv/hvs.c	Mon Nov 25 16:58:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvs.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $	*/
+/*	$NetBSD: hvs.c,v 1.1.8.1 2019/11/25 16:58:54 martin Exp $	*/
 /*	$OpenBSD: hvs.c,v 1.17 2017/08/10 17:22:48 mikeb Exp $	*/
 
 /*-
@@ -37,7 +37,7 @@
 /* #define HVS_DEBUG_IO */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.1.8.1 2019/11/25 16:58:54 martin Exp $");
 
 #include 
 #include 
@@ -1095,7 +1095,8 @@ hvs_free_ccbs(struct hvs_softc *sc)
 		if (ccb->ccb_dmap == NULL)
 			continue;
 
-		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmap,
+		0, ccb->ccb_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmap);
 		bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmap);

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.4.2.3 src/sys/dev/hyperv/if_hvn.c:1.4.2.4
--- src/sys/dev/hyperv/if_hvn.c:1.4.2.3	Sun Nov 24 08:13:07 2019
+++ src/sys/dev/hyperv/if_hvn.c	Mon Nov 25 16:58:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.4.2.3 2019/11/24 08:13:07 martin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.4.2.4 2019/11/25 16:58:54 martin Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.3 2019/11/24 08:13:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.4 2019/11/25 16:58:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -632,7 +632,8 @@ hvn_decap(struct hvn_softc *sc, struct h
 {
 	struct ifnet *ifp = SC2IFP(sc);
 
-	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+	0, txd->txd_dmap->dm_mapsize,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	txd->txd_buf = NULL;
@@ -667,7 +668,8 @@ hvn_txeof(struct hvn_softc *sc, uint64_t
 	}
 	txd->txd_buf = NULL;
 
-	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+	0, txd->txd_dmap->dm_mapsize,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	m_freem(m);
@@ -844,7 +846,8 @@ hvn_tx_ring_destroy(struct hvn_softc *sc
 		txd = >sc_tx_desc[i];
 		if (txd->txd_dmap == NULL)
 			continue;
-		bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+		0, txd->txd_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 		bus_dmamap_destroy(sc->sc_dmat, txd->txd_dmap);
@@ -855,7 +858,8 @@ hvn_tx_ring_destroy(struct hvn_softc *sc
 		txd->txd_buf = NULL;
 	}
 	if (sc->sc_tx_rmap) {
-		bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap,
+		0, txd->txd_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, sc->sc_tx_rmap);
 		bus_dmamap_destroy(sc->sc_dmat, sc->sc_tx_rmap);



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:55:09 UTC 2019

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

Log Message:
Regen for ticket 479


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.4 -r1.151.2.5 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.4 -r1.139.2.5 src/sys/dev/mii/miidevs_data.h

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:55:09 UTC 2019

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

Log Message:
Regen for ticket 479


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.4 -r1.151.2.5 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.4 -r1.139.2.5 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.151.2.4 src/sys/dev/mii/miidevs.h:1.151.2.5
--- src/sys/dev/mii/miidevs.h:1.151.2.4	Mon Nov 25 16:53:55 2019
+++ src/sys/dev/mii/miidevs.h	Mon Nov 25 16:55:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miidevs.h,v 1.151.2.4 2019/11/25 16:53:55 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.151.2.5 2019/11/25 16:55:09 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.139.2.4 src/sys/dev/mii/miidevs_data.h:1.139.2.5
--- src/sys/dev/mii/miidevs_data.h:1.139.2.4	Mon Nov 25 16:53:55 2019
+++ src/sys/dev/mii/miidevs_data.h	Mon Nov 25 16:55:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miidevs_data.h,v 1.139.2.4 2019/11/25 16:53:55 martin Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.139.2.5 2019/11/25 16:55:09 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:53:55 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: files.mii miidevs.h miidevs_data.h
Added Files:
src/sys/dev/mii [netbsd-9]: jmphy.c jmphyreg.h smscphy.c

Log Message:
Regen for ticket 479


To generate a diff of this commit:
cvs rdiff -u -r1.50.26.1 -r1.50.26.2 src/sys/dev/mii/files.mii
cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/mii/jmphy.c src/sys/dev/mii/jmphyreg.h \
src/sys/dev/mii/smscphy.c
cvs rdiff -u -r1.151.2.3 -r1.151.2.4 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.3 -r1.139.2.4 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/files.mii
diff -u src/sys/dev/mii/files.mii:1.50.26.1 src/sys/dev/mii/files.mii:1.50.26.2
--- src/sys/dev/mii/files.mii:1.50.26.1	Mon Nov 25 16:44:31 2019
+++ src/sys/dev/mii/files.mii	Mon Nov 25 16:53:55 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mii,v 1.50.26.1 2019/11/25 16:44:31 martin Exp $
+#	$NetBSD: files.mii,v 1.50.26.2 2019/11/25 16:53:55 martin Exp $
 
 defflag	opt_mii.h	MIIVERBOSE
 
@@ -103,6 +103,10 @@ device	ipgphy: mii_phy
 attach	ipgphy at mii
 file	dev/mii/ipgphy.c			ipgphy
 
+device	jmphy: mii_phy
+attach	jmphy at mii
+file	dev/mii/jmphy.cjmphy
+
 device	sqphy: mii_phy
 attach	sqphy at mii
 file	dev/mii/sqphy.csqphy
@@ -162,3 +166,7 @@ file	dev/mii/rdcphy.c			rdcphy
 device	micphy: mii_phy, ukphy_subr
 attach	micphy at mii
 file	dev/mii/micphy.c			micphy
+
+device	smscphy: mii_phy
+attach	smscphy at mii
+file	dev/mii/smscphy.c			smscphy

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.151.2.3 src/sys/dev/mii/miidevs.h:1.151.2.4
--- src/sys/dev/mii/miidevs.h:1.151.2.3	Mon Nov 25 16:26:31 2019
+++ src/sys/dev/mii/miidevs.h	Mon Nov 25 16:53:55 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.151.2.3 2019/11/25 16:26:31 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.151.2.4 2019/11/25 16:53:55 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.153.2.3 2019/11/25 16:26:00 martin Exp
+ *	NetBSD: miidevs,v 1.153.2.4 2019/11/25 16:53:29 martin Exp
  */
 
 /*-
@@ -494,13 +494,27 @@
 #define	MII_MODEL_MARVELL_E	0x000c
 #define	MII_STR_MARVELL_E	"Marvell 88E Gigabit PHY"
 
-/* Micrel PHYs */
+/* Micrel PHYs (Kendin and Microchip) */
+#define	MII_MODEL_MICREL_KSZ8041	0x0011
+#define	MII_STR_MICREL_KSZ8041	"Micrel KSZ8041TL/FTL/MLL 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ8041RNLI	0x0013
+#define	MII_STR_MICREL_KSZ8041RNLI	"Micrel KSZ8041RNLI 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ8051	0x0015
+#define	MII_STR_MICREL_KSZ8051	"Micrel KSZ80[235]1 10/100 PHY"
 #define	MII_MODEL_MICREL_KSZ8081	0x0016
-#define	MII_STR_MICREL_KSZ8081	"Micrel KSZ8081 10/100 PHY"
-#define	MII_MODEL_MICREL_KSZ9021RNI	0x0021
-#define	MII_STR_MICREL_KSZ9021RNI	"Micrel KSZ9021RNI 10/100/1000 PHY"
+#define	MII_STR_MICREL_KSZ8081	"Micrel KSZ80[89]1 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ8061	0x0017
+#define	MII_STR_MICREL_KSZ8061	"Micrel KSZ8061 10/100 PHY"
+#define	MII_MODEL_MICREL_KSZ9021_8001_8721	0x0021
+#define	MII_STR_MICREL_KSZ9021_8001_8721	"Micrel KSZ9021 Gb & KSZ8001/8721 10/100 PHY"
 #define	MII_MODEL_MICREL_KSZ9031	0x0022
 #define	MII_STR_MICREL_KSZ9031	"Micrel KSZ9031 10/100/1000 PHY"
+#define	MII_MODEL_MICREL_KSZ9477	0x0023
+#define	MII_STR_MICREL_KSZ9477	"Micrel KSZ9477 10/100/1000 PHY"
+#define	MII_MODEL_MICREL_KSZ9131	0x0024
+#define	MII_STR_MICREL_KSZ9131	"Micrel KSZ9131 10/100/1000 PHY"
+#define	MII_MODEL_MICREL_KS8737	0x0032
+#define	MII_STR_MICREL_KS8737	"Micrel KS8737 10/100 PHY"
 
 /* Myson Technology PHYs */
 #define	MII_MODEL_xxMYSON_MTD972	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.139.2.3 src/sys/dev/mii/miidevs_data.h:1.139.2.4
--- src/sys/dev/mii/miidevs_data.h:1.139.2.3	Mon Nov 25 16:26:31 2019
+++ src/sys/dev/mii/miidevs_data.h	Mon Nov 25 16:53:55 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.139.2.3 2019/11/25 16:26:31 martin Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.139.2.4 2019/11/25 16:53:55 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.153.2.3 2019/11/25 16:26:00 martin Exp
+ *	NetBSD: miidevs,v 1.153.2.4 2019/11/25 16:53:29 martin Exp
  */
 
 /*-
@@ -204,9 +204,16 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_MARVELL, MII_MODEL_MARVELL_E1000_5, MII_STR_MARVELL_E1000_5 },
  { MII_OUI_MARVELL, MII_MODEL_MARVELL_E1000_6, MII_STR_MARVELL_E1000_6 },
  { MII_OUI_MARVELL, MII_MODEL_MARVELL_E, MII_STR_MARVELL_E },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8041, MII_STR_MICREL_KSZ8041 },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8041RNLI, MII_STR_MICREL_KSZ8041RNLI },
+ { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8051, MII_STR_MICREL_KSZ8051 },
  { MII_OUI_MICREL, MII_MODEL_MICREL_KSZ8081, 

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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:53:55 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: files.mii miidevs.h miidevs_data.h
Added Files:
src/sys/dev/mii [netbsd-9]: jmphy.c jmphyreg.h smscphy.c

Log Message:
Regen for ticket 479


To generate a diff of this commit:
cvs rdiff -u -r1.50.26.1 -r1.50.26.2 src/sys/dev/mii/files.mii
cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/mii/jmphy.c src/sys/dev/mii/jmphyreg.h \
src/sys/dev/mii/smscphy.c
cvs rdiff -u -r1.151.2.3 -r1.151.2.4 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.3 -r1.139.2.4 src/sys/dev/mii/miidevs_data.h

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:47:16 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_vge.c

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

sys/dev/pci/if_vge.c: revision 1.76
sys/dev/pci/if_vge.c: revision 1.77

 Fixes a bug that "ifmedia vge0 media 1000baseT-FDX" causes device timeout.

If the interface's media is NOT in the "best" mode (i.e. other than IFM_AUTO),
control VGE_DIAGCTL_GMII bit.

- Set duplex correctly when user setting is not IFM_AUTO.
- When the link is up, set VGE_DIAGCTL not from user media setting but from
  the current active link status.


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/dev/pci/if_vge.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_vge.c
diff -u src/sys/dev/pci/if_vge.c:1.73.2.1 src/sys/dev/pci/if_vge.c:1.73.2.2
--- src/sys/dev/pci/if_vge.c:1.73.2.1	Thu Oct 17 18:58:33 2019
+++ src/sys/dev/pci/if_vge.c	Mon Nov 25 16:47:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.73.2.1 2019/10/17 18:58:33 martin Exp $ */
+/* $NetBSD: if_vge.c,v 1.73.2.2 2019/11/25 16:47:16 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.73.2.1 2019/10/17 18:58:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.73.2.2 2019/11/25 16:47:16 martin Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -1916,6 +1916,7 @@ vge_miibus_statchg(struct ifnet *ifp)
 	struct vge_softc *sc = ifp->if_softc;
 	struct mii_data *mii = >sc_mii;
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
+	uint8_t dctl;
 
 	/*
 	 * If the user manually selects a media mode, we need to turn
@@ -1927,31 +1928,37 @@ vge_miibus_statchg(struct ifnet *ifp)
 	 * always implied, so we turn on the forced mode bit but leave
 	 * the FDX bit cleared.
 	 */
+	dctl = CSR_READ_1(sc, VGE_DIAGCTL);
 
-	switch (IFM_SUBTYPE(ife->ifm_media)) {
-	case IFM_AUTO:
-		CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
-		CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		break;
-	case IFM_1000_T:
-		CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
-		CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		break;
-	case IFM_100_TX:
-	case IFM_10_T:
-		CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
-		if ((ife->ifm_media & IFM_FDX) != 0) {
-			CSR_SETBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		} else {
-			CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_FDXFORCE);
-		}
-		break;
-	default:
-		printf("%s: unknown media type: %x\n",
-		device_xname(sc->sc_dev),
-		IFM_SUBTYPE(ife->ifm_media));
-		break;
+	if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
+		dctl &= ~VGE_DIAGCTL_MACFORCE;
+		dctl &= ~VGE_DIAGCTL_FDXFORCE;
+	} else {
+		u_int ifmword;
+
+		/* If the link is up, use the current active media. */
+		if ((mii->mii_media_status & IFM_ACTIVE) != 0)
+			ifmword = mii->mii_media_active;
+		else
+			ifmword = ife->ifm_media;
+
+		dctl |= VGE_DIAGCTL_MACFORCE;
+		if ((ifmword & IFM_FDX) != 0)
+			dctl |= VGE_DIAGCTL_FDXFORCE;
+		else
+			dctl &= ~VGE_DIAGCTL_FDXFORCE;
+
+		if (IFM_SUBTYPE(ifmword) == IFM_1000_T) {
+			/*
+			 * It means the user setting is not auto but it's
+			 * 1000baseT-FDX or 1000baseT.
+			 */
+			dctl |= VGE_DIAGCTL_GMII;
+		} else
+			dctl &= ~VGE_DIAGCTL_GMII;
 	}
+
+	CSR_WRITE_1(sc, VGE_DIAGCTL, dctl);
 }
 
 static int



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:47:16 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_vge.c

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

sys/dev/pci/if_vge.c: revision 1.76
sys/dev/pci/if_vge.c: revision 1.77

 Fixes a bug that "ifmedia vge0 media 1000baseT-FDX" causes device timeout.

If the interface's media is NOT in the "best" mode (i.e. other than IFM_AUTO),
control VGE_DIAGCTL_GMII bit.

- Set duplex correctly when user setting is not IFM_AUTO.
- When the link is up, set VGE_DIAGCTL not from user media setting but from
  the current active link status.


To generate a diff of this commit:
cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/dev/pci/if_vge.c

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:37:06 UTC 2019

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

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

sys/dev/usb/if_upl.c: revision 1.68

Make it compilable with UPL_DEBUG.


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

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:37:06 UTC 2019

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

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

sys/dev/usb/if_upl.c: revision 1.68

Make it compilable with UPL_DEBUG.


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

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

Modified files:

Index: src/sys/dev/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.64.2.2 src/sys/dev/usb/if_upl.c:1.64.2.3
--- src/sys/dev/usb/if_upl.c:1.64.2.2	Fri Sep 13 06:51:58 2019
+++ src/sys/dev/usb/if_upl.c	Mon Nov 25 16:37:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.64.2.3 2019/11/25 16:37:06 martin Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.2 2019/09/13 06:51:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.64.2.3 2019/11/25 16:37:06 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -229,8 +229,8 @@ upl_rx_loop(struct usbnet * un, struct u
 {
 	usbnet_isowned_rx(un);
 
-	DPRINTFN(9,("%s: %s: enter status=%d length=%d\n",
-		device_xname(un->un_dev), __func__, status, total_len));
+	DPRINTFN(9,("%s: %s: enter length=%d\n",
+		device_xname(un->un_dev), __func__, total_len));
 
 	usbnet_input(un, c->unc_buf, total_len);
 }



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:26:31 UTC 2019

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

Log Message:
Regen for ticket #473


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.2 -r1.151.2.3 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.2 -r1.139.2.3 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.151.2.2 src/sys/dev/mii/miidevs.h:1.151.2.3
--- src/sys/dev/mii/miidevs.h:1.151.2.2	Wed Oct 23 19:46:53 2019
+++ src/sys/dev/mii/miidevs.h	Mon Nov 25 16:26:31 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.151.2.2 2019/10/23 19:46:53 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.151.2.3 2019/11/25 16:26:31 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.153.2.2 2019/10/23 19:45:56 martin Exp
+ *	NetBSD: miidevs,v 1.153.2.3 2019/11/25 16:26:00 martin Exp
  */
 
 /*-
@@ -72,7 +72,9 @@
 #define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
 #define	MII_OUI_SUNPLUS	0x001105	/* Sunplus Technology */
 #define	MII_OUI_ATHEROS	0x001374	/* Atheros */
+#define	MII_OUI_TERANETICS	0x0014a6	/* Teranetics */
 #define	MII_OUI_RALINK2	0x0017a5	/* Ralink Technology */
+#define	MII_OUI_AQUANTIA	0x0017b6	/* Aquantia Corporation */
 #define	MII_OUI_BROADCOM3	0x001be9	/* Broadcom Corporation */
 #define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
 #define	MII_OUI_VIA	0x004063	/* VIA Technologies */
@@ -81,7 +83,6 @@
 #define	MII_OUI_AMLOGIC	0x006051	/* Amlogic */
 #define	MII_OUI_DAVICOM	0x00606e	/* Davicom Semiconductor */
 #define	MII_OUI_SMSC	0x00800f	/* SMSC */
-#define	MII_OUI_ICPLUS	0x0090c3	/* IC Plus Corp. */
 #define	MII_OUI_SEEQ	0x00a07d	/* Seeq */
 #define	MII_OUI_ICS	0x00a0be	/* Integrated Circuit Systems */
 #define	MII_OUI_INTEL	0x00aa00	/* Intel */
@@ -98,8 +99,9 @@
 #define	MII_OUI_NATSEMI	0x080017	/* National Semiconductor */
 #define	MII_OUI_TI	0x080028	/* Texas Instruments */
 #define	MII_OUI_BROADCOM4	0x18c086	/* Broadcom Corporation */
+#define	MII_OUI_RENESAS	0x749050	/* Renesas */
 
-/* Unregisterd or wrong OUI */
+/* Unregistered or wrong OUI */
 #define	MII_OUI_yyREALTEK	0x04	/* Realtek */
 #define	MII_OUI_yyAMD	0x58	/* Advanced Micro Devices */
 #define	MII_OUI_xxMYSON	0x00032d	/* Myson Technology */
@@ -111,6 +113,7 @@
 #define	MII_OUI_xxREALTEK	0x000732	/* Realtek */
 #define	MII_OUI_xxBROADCOM	0x000818	/* Broadcom Corporation */
 #define	MII_OUI_xxPMCSIERRA	0x0009c0	/* PMC-Sierra */
+#define	MII_OUI_xxICPLUS	0x0009c3	/* IC Plus Corp. */
 #define	MII_OUI_xxMARVELL	0x000ac2	/* Marvell Semiconductor */
 #define	MII_OUI_xxINTEL	0x001f00	/* Intel */
 #define	MII_OUI_xxBROADCOM_ALT1	0x0050ef	/* Broadcom Corporation */
@@ -343,14 +346,14 @@
 #define	MII_STR_xxDAVICOM_DM9601	"DM9601 internal 10/100 media interface"
 
 /* IC Plus Corp. PHYs */
-#define	MII_MODEL_ICPLUS_IP100	0x0004
-#define	MII_STR_ICPLUS_IP100	"IP100 10/100 PHY"
-#define	MII_MODEL_ICPLUS_IP101	0x0005
-#define	MII_STR_ICPLUS_IP101	"IP101 10/100 PHY"
-#define	MII_MODEL_ICPLUS_IP1000A	0x0008
-#define	MII_STR_ICPLUS_IP1000A	"IP1000A 10/100/1000 PHY"
-#define	MII_MODEL_ICPLUS_IP1001	0x0019
-#define	MII_STR_ICPLUS_IP1001	"IP1001 10/100/1000 PHY"
+#define	MII_MODEL_xxICPLUS_IP100	0x0004
+#define	MII_STR_xxICPLUS_IP100	"IP100 10/100 PHY"
+#define	MII_MODEL_xxICPLUS_IP101	0x0005
+#define	MII_STR_xxICPLUS_IP101	"IP101 10/100 PHY"
+#define	MII_MODEL_xxICPLUS_IP1000A	0x0008
+#define	MII_STR_xxICPLUS_IP1000A	"IP1000A 10/100/1000 PHY"
+#define	MII_MODEL_xxICPLUS_IP1001	0x0019
+#define	MII_STR_xxICPLUS_IP1001	"IP1001 10/100/1000 PHY"
 
 /* Integrated Circuit Systems PHYs */
 #define	MII_MODEL_ICS_1889	0x0001
@@ -408,10 +411,10 @@
 
 
 /* JMicron PHYs */
-#define	MII_MODEL_JMICRON_JMC250	0x0021
-#define	MII_STR_JMICRON_JMC250	"JMC250 10/100/1000 media interface"
-#define	MII_MODEL_JMICRON_JMC260	0x0022
-#define	MII_STR_JMICRON_JMC260	"JMC260 10/100 media interface"
+#define	MII_MODEL_JMICRON_JMP211	0x0021
+#define	MII_STR_JMICRON_JMP211	"JMP211 10/100/1000 media interface"
+#define	MII_MODEL_JMICRON_JMP202	0x0022
+#define	MII_STR_JMICRON_JMP202	"JMP202 10/100 media interface"
 
 /* Level 1 PHYs */
 #define	MII_MODEL_xxLEVEL1_LXT970	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.139.2.2 src/sys/dev/mii/miidevs_data.h:1.139.2.3
--- src/sys/dev/mii/miidevs_data.h:1.139.2.2	Wed Oct 23 19:46:53 2019
+++ src/sys/dev/mii/miidevs_data.h	Mon Nov 25 16:26:31 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.139.2.2 2019/10/23 19:46:53 martin Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.139.2.3 2019/11/25 16:26:31 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.153.2.2 2019/10/23 19:45:56 martin Exp
+ *	

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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:26:31 UTC 2019

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

Log Message:
Regen for ticket #473


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.2 -r1.151.2.3 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.2 -r1.139.2.3 src/sys/dev/mii/miidevs_data.h

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:26:01 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: miidevs rlphy.c

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

sys/dev/mii/rlphy.c: revision 1.37
sys/dev/mii/miidevs: revision 1.155
sys/dev/mii/miidevs: revision 1.156
sys/dev/mii/miidevs: revision 1.157
sys/dev/mii/miidevs: revision 1.159
sys/dev/mii/miidevs: revision 1.160

 Add Teranetics, Aquantia and Renesas.

 Use uppercase for vendor name.

 Change ICPLUS(0x0090c3) to xxICPLUS(0x0009c3)
- ICPLUS -> xxICPLUS
- Print model name if it's ICPLUS IP101 to avoid "Realtek internal PHY".

Fix typo. from vezhlys
- Rename JMICRON 0x0021 from JMC250 to JMP211
- Rename JMICRON 0x0022 from JMC260 to JMP202


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.2 -r1.153.2.3 src/sys/dev/mii/miidevs
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/dev/mii/rlphy.c

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



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

2019-11-25 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 25 16:26:01 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: miidevs rlphy.c

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

sys/dev/mii/rlphy.c: revision 1.37
sys/dev/mii/miidevs: revision 1.155
sys/dev/mii/miidevs: revision 1.156
sys/dev/mii/miidevs: revision 1.157
sys/dev/mii/miidevs: revision 1.159
sys/dev/mii/miidevs: revision 1.160

 Add Teranetics, Aquantia and Renesas.

 Use uppercase for vendor name.

 Change ICPLUS(0x0090c3) to xxICPLUS(0x0009c3)
- ICPLUS -> xxICPLUS
- Print model name if it's ICPLUS IP101 to avoid "Realtek internal PHY".

Fix typo. from vezhlys
- Rename JMICRON 0x0021 from JMC250 to JMP211
- Rename JMICRON 0x0022 from JMC260 to JMP202


To generate a diff of this commit:
cvs rdiff -u -r1.153.2.2 -r1.153.2.3 src/sys/dev/mii/miidevs
cvs rdiff -u -r1.36 -r1.36.4.1 src/sys/dev/mii/rlphy.c

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

Modified files:

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.153.2.2 src/sys/dev/mii/miidevs:1.153.2.3
--- src/sys/dev/mii/miidevs:1.153.2.2	Wed Oct 23 19:45:56 2019
+++ src/sys/dev/mii/miidevs	Mon Nov 25 16:26:00 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.153.2.2 2019/10/23 19:45:56 martin Exp $
+$NetBSD: miidevs,v 1.153.2.3 2019/11/25 16:26:00 martin Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -65,7 +65,9 @@ oui ALTIMA			0x0010a9	Altima Communicati
 oui ENABLESEMI			0x0010dd	Enable Semiconductor
 oui SUNPLUS			0x001105	Sunplus Technology
 oui ATHEROS			0x001374	Atheros
+oui TERANETICS			0x0014a6	Teranetics
 oui RALINK2			0x0017a5	Ralink Technology
+oui AQUANTIA			0x0017b6	Aquantia Corporation
 oui BROADCOM3			0x001be9	Broadcom Corporation
 oui LEVEL1			0x00207b	Level 1
 oui VIA0x004063	VIA Technologies
@@ -74,7 +76,6 @@ oui QUALSEMI			0x006051	Quality Semicond
 oui AMLOGIC			0x006051	Amlogic
 oui DAVICOM			0x00606e	Davicom Semiconductor
 oui SMSC			0x00800f	SMSC
-oui ICPLUS			0x0090c3	IC Plus Corp.
 oui SEEQ			0x00a07d	Seeq
 oui ICS0x00a0be	Integrated Circuit Systems
 oui INTEL			0x00aa00	Intel
@@ -91,8 +92,9 @@ oui XAQTI			0x00e0ae	XaQti Corp.
 oui NATSEMI			0x080017	National Semiconductor
 oui TI0x080028	Texas Instruments
 oui BROADCOM4			0x18c086	Broadcom Corporation
+oui RENESAS			0x749050	Renesas
 
-/* Unregisterd or wrong OUI */
+/* Unregistered or wrong OUI */
 oui yyREALTEK			0x04	Realtek
 oui yyAMD			0x58	Advanced Micro Devices
 oui xxMYSON			0x00032d	Myson Technology
@@ -104,6 +106,7 @@ oui xxQUALSEMI			0x00068a	Quality Semico
 oui xxREALTEK			0x000732	Realtek
 oui xxBROADCOM			0x000818	Broadcom Corporation
 oui xxPMCSIERRA			0x0009c0	PMC-Sierra
+oui xxICPLUS			0x0009c3	IC Plus Corp.
 oui xxMARVELL			0x000ac2	Marvell Semiconductor
 oui xxINTEL			0x001f00	Intel
 oui xxBROADCOM_ALT1		0x0050ef	Broadcom Corporation
@@ -242,10 +245,10 @@ model xxDAVICOM DM9161B		0x000b DM9161[B
 model xxDAVICOM DM9601		0x000c DM9601 internal 10/100 media interface
 
 /* IC Plus Corp. PHYs */
-model ICPLUS IP100		0x0004 IP100 10/100 PHY
-model ICPLUS IP101		0x0005 IP101 10/100 PHY
-model ICPLUS IP1000A		0x0008 IP1000A 10/100/1000 PHY
-model ICPLUS IP1001		0x0019 IP1001 10/100/1000 PHY
+model xxICPLUS IP100		0x0004 IP100 10/100 PHY
+model xxICPLUS IP101		0x0005 IP101 10/100 PHY
+model xxICPLUS IP1000A		0x0008 IP1000A 10/100/1000 PHY
+model xxICPLUS IP1001		0x0019 IP1001 10/100/1000 PHY
 
 /* Integrated Circuit Systems PHYs */
 model ICS 1889			0x0001 ICS1889 10/100 media interface
@@ -278,8 +281,8 @@ model ATTANSIC I82578		0x0004 Intel 8257
 
 
 /* JMicron PHYs */
-model JMICRON JMC250		0x0021 JMC250 10/100/1000 media interface
-model JMICRON JMC260		0x0022 JMC260 10/100 media interface
+model JMICRON JMP211		0x0021 JMP211 10/100/1000 media interface
+model JMICRON JMP202		0x0022 JMP202 10/100 media interface
 
 /* Level 1 PHYs */
 model xxLEVEL1 LXT970		0x LXT970 10/100 media interface

Index: src/sys/dev/mii/rlphy.c
diff -u src/sys/dev/mii/rlphy.c:1.36 src/sys/dev/mii/rlphy.c:1.36.4.1
--- src/sys/dev/mii/rlphy.c:1.36	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/rlphy.c	Mon Nov 25 16:26:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlphy.c,v 1.36 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: rlphy.c,v 1.36.4.1 2019/11/25 16:26:00 martin Exp $	*/
 /*	$OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.36 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.36.4.1 2019/11/25 16:26:00 martin Exp $");
 
 #include 
 #include 
@@ -78,7 +78,7 @@ const struct mii_phy_funcs rlphy_funcs =
 static const struct mii_phydesc rlphys[] = {
 	MII_PHY_DESC(yyREALTEK, RTL8201L),
 	MII_PHY_DESC(REALTEK, RTL8201E),
-	MII_PHY_DESC(ICPLUS, IP101),
+	MII_PHY_DESC(xxICPLUS, 

CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 24 08:13:07 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvkbd.c if_hvn.c vmbus.c

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

sys/dev/hyperv/if_hvn.c: revision 1.8
sys/dev/hyperv/if_hvn.c: revision 1.9
sys/dev/hyperv/hvkbd.c: revision 1.5
sys/dev/hyperv/hvkbd.c: revision 1.6
sys/dev/hyperv/vmbus.c: revision 1.5

vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).
hvn(4), hvkbd(4): Only need to poll when cold.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/hyperv/vmbus.c

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



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 24 08:13:07 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvkbd.c if_hvn.c vmbus.c

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

sys/dev/hyperv/if_hvn.c: revision 1.8
sys/dev/hyperv/if_hvn.c: revision 1.9
sys/dev/hyperv/hvkbd.c: revision 1.5
sys/dev/hyperv/hvkbd.c: revision 1.6
sys/dev/hyperv/vmbus.c: revision 1.5

vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).
hvn(4), hvkbd(4): Only need to poll when cold.


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.4.2.2 -r1.4.2.3 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/hyperv/vmbus.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.2.2.1 src/sys/dev/hyperv/hvkbd.c:1.2.2.2
--- src/sys/dev/hyperv/hvkbd.c:1.2.2.1	Sat Nov 16 16:51:45 2019
+++ src/sys/dev/hyperv/hvkbd.c	Sun Nov 24 08:13:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.2.2.1 2019/11/16 16:51:45 martin Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.2.2.2 2019/11/24 08:13:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2.2.1 2019/11/16 16:51:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2.2.2 2019/11/24 08:13:07 martin Exp $");
 
 #include 
 #include 
@@ -359,13 +359,13 @@ hvkbd_connect(struct hvkbd_softc *sc)
 	}
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
-			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", 1);
-		s = spltty();
-		hvkbd_intr(sc);
-		splx(s);
+			s = spltty();
+			hvkbd_intr(sc);
+			splx(s);
+		} else
+			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
 	} while (--timo > 0 && sc->sc_connected == 0);
 
 	if (timo == 0 && sc->sc_connected == 0) {

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.4.2.2 src/sys/dev/hyperv/if_hvn.c:1.4.2.3
--- src/sys/dev/hyperv/if_hvn.c:1.4.2.2	Mon Nov 18 19:46:33 2019
+++ src/sys/dev/hyperv/if_hvn.c	Sun Nov 24 08:13:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.4.2.2 2019/11/18 19:46:33 martin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.4.2.3 2019/11/24 08:13:07 martin Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.2 2019/11/18 19:46:33 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.3 2019/11/24 08:13:07 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1069,7 +1069,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			if (cold)
 delay(1000);
 			else
-tsleep(cmd, PRIBIO, "nvsout", 1);
+tsleep(cmd, PRIBIO, "nvsout", mstohz(1));
 		} else if (rv) {
 			DPRINTF("%s: NVSP operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->nvs_type, rv);
@@ -1087,13 +1087,13 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 		return 0;
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
-			tsleep(sc, PRIBIO | PCATCH, "nvscmd", 1);
-		s = splnet();
-		hvn_nvs_intr(sc);
-		splx(s);
+			s = splnet();
+			hvn_nvs_intr(sc);
+			splx(s);
+		} else
+			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {
@@ -1391,7 +1391,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			if (cold)
 delay(1000);
 			else
-tsleep(rc, PRIBIO, "rndisout", 1);
+tsleep(rc, PRIBIO, "rndisout", mstohz(1));
 		} else if (rv) {
 			DPRINTF("%s: RNDIS operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->rm_type, rv);
@@ -1410,13 +1410,13 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 	BUS_DMASYNC_POSTWRITE);
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
-			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", 1);
-		s = splnet();
-		hvn_nvs_intr(sc);
-		splx(s);
+			s = splnet();
+			hvn_nvs_intr(sc);
+			splx(s);
+		} else
+			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
 	} while (--timo > 0 && rc->rc_done != 1);
 
 	bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,

Index: src/sys/dev/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.4 src/sys/dev/hyperv/vmbus.c:1.4.2.1
--- src/sys/dev/hyperv/vmbus.c:1.4	Tue Jul  9 10:07:11 2019
+++ src/sys/dev/hyperv/vmbus.c	Sun Nov 24 08:13:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.4.2.1 2019/11/24 08:13:07 martin Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4.2.1 2019/11/24 08:13:07 martin Exp $");
 
 #include 
 #include 
@@ -604,7 +604,7 @@ 

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

2019-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 14:00:49 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: atphy.c mii_physubr.c miivar.h

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

sys/dev/mii/atphy.c: revision 1.23
sys/dev/mii/atphy.c: revision 1.25
sys/dev/mii/miivar.h: revision 1.69
sys/dev/mii/mii_physubr.c: revision 1.88

s/etphy/atphy/. No functional change.

 Fix a bug that atphy(4) can't negotiate correctly when the media setting is
neither auto nor 1000baseT. Use correct index for mii_media_table[].

 History: mii_anar() is first added in OpenBSD and ported to NetBSD. On NetBSD,
only atphy(4) use this function. mii_physubr.c rev. 1.75 changed mii_anar()
for simplify. It changed the argument from the ifmedia word to ifm_data used
in our MII API, but the caller have not been changed. And then, PR kern/50206
was reported and the caller was modified by me to prevent panic but it was not
correct fix.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.4.1 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.87 -r1.87.4.1 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/dev/mii/miivar.h

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

Modified files:

Index: src/sys/dev/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.22 src/sys/dev/mii/atphy.c:1.22.4.1
--- src/sys/dev/mii/atphy.c:1.22	Thu Apr 11 09:00:34 2019
+++ src/sys/dev/mii/atphy.c	Thu Nov 21 14:00:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.22 2019/04/11 09:00:34 msaitoh Exp $ */
+/*	$NetBSD: atphy.c,v 1.22.4.1 2019/11/21 14:00:49 martin Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.22 2019/04/11 09:00:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.22.4.1 2019/11/21 14:00:49 martin Exp $");
 
 #include 
 #include 
@@ -90,7 +90,7 @@ const struct mii_phy_funcs atphy_funcs =
 atphy_service, atphy_status, atphy_reset,
 };
 
-static const struct mii_phydesc etphys[] = {
+static const struct mii_phydesc atphys[] = {
 	MII_PHY_DESC(ATHEROS, F1),
 	MII_PHY_DESC(ATTANSIC, L1),
 	MII_PHY_DESC(ATTANSIC, L2),
@@ -118,7 +118,7 @@ atphy_match(device_t parent, cfdata_t ma
 {
 	struct mii_attach_args *ma = aux;
 
-	if (mii_phy_match(ma, etphys) != NULL)
+	if (mii_phy_match(ma, atphys) != NULL)
 		return 10;
 
 	return 0;
@@ -133,7 +133,7 @@ atphy_attach(device_t parent, device_t s
 	const struct mii_phydesc *mpd;
 	uint16_t bmsr;
 
-	mpd = mii_phy_match(ma, etphys);
+	mpd = mii_phy_match(ma, atphys);
 	aprint_naive(": Media interface\n");
 	aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
 
@@ -222,7 +222,7 @@ atphy_service(struct mii_softc *sc, stru
 			return EINVAL;
 		}
 
-		anar = mii_anar(IFM_SUBTYPE(ife->ifm_media));
+		anar = mii_anar(ife);
 		if ((ife->ifm_media & IFM_FDX) != 0) {
 			bmcr |= BMCR_FDX;
 			/* Enable pause. */

Index: src/sys/dev/mii/mii_physubr.c
diff -u src/sys/dev/mii/mii_physubr.c:1.87 src/sys/dev/mii/mii_physubr.c:1.87.4.1
--- src/sys/dev/mii/mii_physubr.c:1.87	Tue Apr  9 11:28:45 2019
+++ src/sys/dev/mii/mii_physubr.c	Thu Nov 21 14:00:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii_physubr.c,v 1.87 2019/04/09 11:28:45 msaitoh Exp $	*/
+/*	$NetBSD: mii_physubr.c,v 1.87.4.1 2019/11/21 14:00:49 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.87 2019/04/09 11:28:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mii_physubr.c,v 1.87.4.1 2019/11/21 14:00:49 martin Exp $");
 
 #include 
 #include 
@@ -697,19 +697,16 @@ mii_phy_resume(device_t dv, const pmf_qu
 
 
 /*
- * Given an ifmedia word, return the corresponding ANAR value.
+ * Given an ifmedia_entry, return the corresponding ANAR value.
  */
 uint16_t
-mii_anar(int media)
+mii_anar(struct ifmedia_entry *ife)
 {
-	int rv;
 
 #ifdef DIAGNOSTIC
-	if (/* media < 0 || */ media >= MII_NMEDIA)
+	if (ife->ifm_data >= MII_NMEDIA)
 		panic("mii_anar");
 #endif
 
-	rv = mii_media_table[media].mm_anar;
-
-	return rv;
+	return mii_media_table[ife->ifm_data].mm_anar;
 }

Index: src/sys/dev/mii/miivar.h
diff -u src/sys/dev/mii/miivar.h:1.68 src/sys/dev/mii/miivar.h:1.68.4.1
--- src/sys/dev/mii/miivar.h:1.68	Thu Apr 11 09:14:07 2019
+++ src/sys/dev/mii/miivar.h	Thu Nov 21 14:00:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: miivar.h,v 1.68 2019/04/11 09:14:07 msaitoh Exp $	*/
+/*	$NetBSD: miivar.h,v 1.68.4.1 2019/11/21 14:00:49 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -287,7 +287,7 @@ int	mii_mediachg(struct mii_data *);
 void	mii_tick(struct mii_data *);
 void	mii_pollstat(struct mii_data *);
 void	mii_down(struct mii_data *);
-uint16_t mii_anar(int);
+uint16_t mii_anar(struct ifmedia_entry *);
 

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

2019-11-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 21 14:00:49 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: atphy.c mii_physubr.c miivar.h

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

sys/dev/mii/atphy.c: revision 1.23
sys/dev/mii/atphy.c: revision 1.25
sys/dev/mii/miivar.h: revision 1.69
sys/dev/mii/mii_physubr.c: revision 1.88

s/etphy/atphy/. No functional change.

 Fix a bug that atphy(4) can't negotiate correctly when the media setting is
neither auto nor 1000baseT. Use correct index for mii_media_table[].

 History: mii_anar() is first added in OpenBSD and ported to NetBSD. On NetBSD,
only atphy(4) use this function. mii_physubr.c rev. 1.75 changed mii_anar()
for simplify. It changed the argument from the ifmedia word to ifm_data used
in our MII API, but the caller have not been changed. And then, PR kern/50206
was reported and the caller was modified by me to prevent panic but it was not
correct fix.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.4.1 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.87 -r1.87.4.1 src/sys/dev/mii/mii_physubr.c
cvs rdiff -u -r1.68 -r1.68.4.1 src/sys/dev/mii/miivar.h

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:17:44 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

 XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.6 -r1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.6 -r1.125.2.7 src/sys/dev/pci/ixgbe/ixv.c

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:17:44 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.216
sys/dev/pci/ixgbe/ixv.c: revision 1.141

Print MAC address.

 XXX Should we move such type of printf() to ether_ifattach?


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.6 -r1.199.2.7 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.125.2.6 -r1.125.2.7 src/sys/dev/pci/ixgbe/ixv.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.199.2.6 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.7
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.6	Thu Oct 17 19:09:14 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Tue Nov 19 13:17:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.6 2019/10/17 19:09:14 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.7 2019/11/19 13:17:44 martin Exp $ */
 
 /**
 
@@ -1338,6 +1338,8 @@ ixgbe_setup_interface(device_t dev, stru
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.7
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6	Thu Nov 14 15:30:19 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Tue Nov 19 13:17:44 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.6 2019/11/14 15:30:19 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.7 2019/11/19 13:17:44 martin Exp $*/
 
 /**
 
@@ -1610,6 +1610,8 @@ ixv_setup_interface(device_t dev, struct
 	}
 	adapter->ipq = if_percpuq_create(>osdep.ec.ec_if);
 	ether_ifattach(ifp, adapter->hw.mac.addr);
+	aprint_normal_dev(dev, "Ethernet address %s\n",
+	ether_sprintf(adapter->hw.mac.addr));
 	/*
 	 * We use per TX queue softint, so if_deferred_start_init() isn't
 	 * used.



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:07:37 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_msk.c if_skreg.h

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

sys/dev/pci/if_msk.c: revision 1.94
sys/dev/pci/if_skreg.h: revision 1.27

 Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

 At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.


To generate a diff of this commit:
cvs rdiff -u -r1.91.2.1 -r1.91.2.2 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/dev/pci/if_skreg.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.91.2.1 src/sys/dev/pci/if_msk.c:1.91.2.2
--- src/sys/dev/pci/if_msk.c:1.91.2.1	Thu Oct 24 16:19:23 2019
+++ src/sys/dev/pci/if_msk.c	Tue Nov 19 13:07:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $ */
+/* $NetBSD: if_msk.c,v 1.91.2.2 2019/11/19 13:07:37 martin Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91.2.2 2019/11/19 13:07:37 martin Exp $");
 
 #include 
 #include 
@@ -887,10 +887,27 @@ void
 mskc_reset(struct sk_softc *sc)
 {
 	uint32_t imtimer_ticks, reg1;
+	uint16_t status;
 	int reg;
 
 	DPRINTFN(2, ("mskc_reset\n"));
 
+	/* Disable ASF */
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_SUPR)) {
+		CSR_WRITE_4(sc, SK_Y2_CPU_WDOG, 0);
+		status = CSR_READ_2(sc, SK_Y2_ASF_HCU_CCSR);
+		/* Clear AHB bridge & microcontroller reset. */
+		status &= ~(SK_Y2_ASF_HCU_CSSR_ARB_RST |
+		SK_Y2_ASF_HCU_CSSR_CPU_RST_MODE);
+		/* Clear ASF microcontroller state. */
+		status &= ~SK_Y2_ASF_HCU_CSSR_UC_STATE_MSK;
+		status &= ~SK_Y2_ASF_HCU_CSSR_CPU_CLK_DIVIDE_MSK;
+		CSR_WRITE_2(sc, SK_Y2_ASF_HCU_CCSR, status);
+		CSR_WRITE_4(sc, SK_Y2_CPU_WDOG, 0);
+	} else
+		CSR_WRITE_1(sc, SK_Y2_ASF_CSR, SK_Y2_ASF_RESET);
+	CSR_WRITE_2(sc, SK_CSR, SK_CSR_ASF_OFF);
+
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_SW_RESET);
 	CSR_WRITE_1(sc, SK_CSR, SK_CSR_MASTER_RESET);
 
@@ -963,10 +980,6 @@ mskc_reset(struct sk_softc *sc)
 	DPRINTFN(2, ("mskc_reset: sk_link_ctrl=%x\n",
 		 CSR_READ_2(sc, SK_LINK_CTRL)));
 
-	/* Disable ASF */
-	CSR_WRITE_1(sc, SK_Y2_ASF_CSR, SK_Y2_ASF_RESET);
-	CSR_WRITE_2(sc, SK_CSR, SK_CSR_ASF_OFF);
-
 	/* Clear I2C IRQ noise */
 	CSR_WRITE_4(sc, SK_I2CHWIRQ, 1);
 
@@ -1102,9 +1115,9 @@ msk_reset(struct sk_if_softc *sc_if)
 {
 	/* GMAC and GPHY Reset */
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_SET);
-	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
+	SK_IF_WRITE_1(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
 	DELAY(1000);
-	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_CLEAR);
+	SK_IF_WRITE_1(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_CLEAR);
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_LOOP_OFF |
 		  SK_GMAC_PAUSE_ON | SK_GMAC_RESET_CLEAR);
 }
@@ -2410,17 +2423,31 @@ msk_init_yukon(struct sk_if_softc *sc_if
 
 	/* Configure RX MAC FIFO */
 	SK_IF_WRITE_1(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_RESET_CLEAR);
-	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, SK_RFCTL_OPERATION_ON |
-	SK_RFCTL_FIFO_FLUSH_ON);
-
-	/* Increase flush threshold to 64 bytes */
-	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD,
-	SK_RFCTL_FIFO_THRESHOLD + 1);
+	v =  SK_RFCTL_OPERATION_ON | SK_RFCTL_FIFO_FLUSH_ON;
+	if ((sc->sk_type == SK_YUKON_EX) || (sc->sk_type == SK_YUKON_FE_P))
+		v |= SK_RFCTL_RX_OVER_ON;
+	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_CTRL_TEST, v);
+
+	if ((sc->sk_type == SK_YUKON_FE_P) &&
+	(sc->sk_rev == SK_YUKON_FE_P_REV_A0))
+		v = 0x178; /* Magic value */
+	else {
+		/* Increase flush threshold to 64 bytes */
+		v = SK_RFCTL_FIFO_THRESHOLD + 1;
+	}
+	SK_IF_WRITE_2(sc_if, 0, SK_RXMF1_FLUSH_THRESHOLD, v);
 
 	/* Configure TX MAC FIFO */
 	SK_IF_WRITE_1(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_RESET_CLEAR);
 	SK_IF_WRITE_2(sc_if, 0, SK_TXMF1_CTRL_TEST, SK_TFCTL_OPERATION_ON);
 
+	if ((sc->sk_type == SK_YUKON_FE_P) &&
+	(sc->sk_rev == SK_YUKON_FE_P_REV_A0)) {
+		v = SK_IF_READ_2(sc_if, 0, SK_TXMF1_END);
+		v &= ~SK_TXEND_WM_ON;
+		SK_IF_WRITE_2(sc_if, 0, SK_TXMF1_END, v);
+	}	
+
 #if 1
 	SK_YU_WRITE_2(sc_if, YUKON_GPCR, YU_GPCR_TXEN | YU_GPCR_RXEN);
 #endif
@@ -2457,7 +2484,7 @@ msk_init(struct ifnet *ifp)
 	/* Configure transmit arbiter(s) */
 	SK_IF_WRITE_1(sc_if, 0, SK_TXAR1_COUNTERCTL, SK_TXARCTL_ON);
 #if 0
-	SK_TXARCTL_ON | SK_TXARCTL_FSYNC_ON);
+/*	SK_TXARCTL_ON | SK_TXARCTL_FSYNC_ON); */
 #endif
 
 	if (sc->sk_ramsize) {
@@ -2565,6 +2592,13 @@ msk_init(struct ifnet *ifp)
 	SK_IF_WRITE_2(sc_if, 0, SK_RXQ1_Y2_PREF_PUTIDX,
 	sc_if->sk_cdata.sk_rx_prod);
 
+	
+	if 

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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:07:37 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_msk.c if_skreg.h

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

sys/dev/pci/if_msk.c: revision 1.94
sys/dev/pci/if_skreg.h: revision 1.27

 Make Yukon EX, FE+, SUPR stable. The code is mainly taken from FreeBSD.

 At least, this change made my own Yukon EX machine (HP ProBook 4501s) much
stable than before.


To generate a diff of this commit:
cvs rdiff -u -r1.91.2.1 -r1.91.2.2 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/dev/pci/if_skreg.h

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:04:44 UTC 2019

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

Log Message:
Regen for ticket #449


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.3 -r1.1371.2.4 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.3 -r1.1370.2.4 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.



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:03:32 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1388
sys/dev/pci/pcidevs: revision 1.1389
sys/dev/pci/pcidevs: revision 1.1390
sys/dev/pci/pcidevs: revision 1.1391

Spell controller correctly
 Add Realtek RTL8125.
- Update Intel's NVMe SSDs.
  - Modify 0x0953's description to "750 or DC P3[567]00 SSD"
  - Add DC P4[56]00
- Add Apollo Lake TXE HECI.
Add D-Link DGE-530T C1 and TP-Link TG-3468 v2.


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

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 13:03:32 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1388
sys/dev/pci/pcidevs: revision 1.1389
sys/dev/pci/pcidevs: revision 1.1390
sys/dev/pci/pcidevs: revision 1.1391

Spell controller correctly
 Add Realtek RTL8125.
- Update Intel's NVMe SSDs.
  - Modify 0x0953's description to "750 or DC P3[567]00 SSD"
  - Add DC P4[56]00
- Add Apollo Lake TXE HECI.
Add D-Link DGE-530T C1 and TP-Link TG-3468 v2.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.3 -r1.1383.2.4 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.1383.2.3 src/sys/dev/pci/pcidevs:1.1383.2.4
--- src/sys/dev/pci/pcidevs:1.1383.2.3	Thu Oct 24 16:12:42 2019
+++ src/sys/dev/pci/pcidevs	Tue Nov 19 13:03:32 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.3 2019/10/24 16:12:42 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.4 2019/11/19 13:03:32 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2513,6 +2513,7 @@ product DLINK DL4000		0x4000	DL-4000 Gig
 product DLINK DGE550SX		0x4001	DGE-550SX
 product DLINK DFE520TX		0x4200	DFE-520TX 10/100 Ethernet
 product DLINK DGE528T		0x4300	DGE-528T Gigabit Ethernet
+product DLINK DGE530T_C1	0x4302	DGE-530T C1
 product DLINK DGE560T		0x4b00	DGE-560T Gigabit Ethernet
 product DLINK DGE560T_2		0x4b01	DGE-560T_2 Gigabit Ethernet
 product DLINK DGE560SX		0x4b02	DGE-560SX
@@ -3117,7 +3118,7 @@ product INTEL X1000_HS_UART	0x0936	Quark
 product INTEL X1000_MAC		0x0937	Quark X1000 10/100 Ethernet MAC
 product INTEL X1000_EHCI	0x0939	Quark X1000 EHCI
 product INTEL X1000_OHCI	0x093a	Quark X1000 OHCI
-product INTEL PCIE_NVME_SSD	0x0953	PCIe NVMe SSD
+product INTEL PCIE_NVME_SSD	0x0953	750 or DC P3[567]00 SSD
 product INTEL X1000_HB		0x0958	Quark X1000 Host Bridge
 product INTEL WIFI_LINK_7265_1	0x095a	Dual Band Wireless AC 7265
 product INTEL WIFI_LINK_7265_2	0x095b	Dual Band Wireless AC 7265
@@ -3142,6 +3143,8 @@ product INTEL CORE4G_S_ULT_GT3	0x0a2a	HD
 product INTEL CORE4G_R_ULT_GT3_1 0x0a2b	HD Graphics
 product INTEL CORE4G_R_ULT_GT3_2 0x0a2e	Iris Graphics 5100
 product INTEL DC_P3520_SSD	0x0a53	SSD DC P3520
+product INTEL DC_P4500_SSD	0x0a54	SSD DC P4500
+product INTEL DC_P4600_SSD	0x0a55	SSD DC P4600
 product INTEL HASWELL_HOST_DRAM	0x0c00	Haswell Host Bridge, DRAM
 product INTEL HASWELL_PCIE16	0x0c01	Haswell PCI-E x16 Controller
 product INTEL HASWELL_PCIE8	0x0c05	Haswell PCI-E x8 Controller
@@ -4944,6 +4947,9 @@ product INTEL APL_P2SB		0x5a92	Apollo La
 product INTEL APL_PMC		0x5a94	Apollo Lake PMC
 product INTEL APL_FASTSPI	0x5a96	Apollo Lake Fast SPI
 product INTEL APL_HDA		0x5a98	Apollo Lake HD Audio
+product INTEL APL_TXE_HECI_1	0x5a9a	Apollo Lake TXE HECI1
+product INTEL APL_TXE_HECI_2	0x5a9c	Apollo Lake TXE HECI2
+product INTEL APL_TXE_HECI_3	0x5a9e	Apollo Lake TXE HECI3
 product INTEL APL_ISH		0x5aa2	Apollo Lake Integrated Sensor Hub
 product INTEL APL_XHCI		0x5aa8	Apollo Lake USB Host (xHCI)
 product INTEL APL_XDCI		0x5aaa	Apollo Lake USB Device (xDCI)
@@ -5960,6 +5966,9 @@ product MYRICOM MYRINET	0x8043	Myrinet
 /* Myson-Century Technology products */
 product MYSON MTD803	0x0803	MTD803 3-in-1 Fast Ethernet Controller
 
+/* Ncube products */
+product NCUBE TG3648	0x8168	TP-Link TG-3468 v2 Gigabit Ethernet
+
 /* National Datacomm products */
 product NDC NCP130		0x0130 NCP130 Wireless NIC
 product NDC NCP130A2		0x0131 NCP130 rev A2 Wireless NIC
@@ -6839,7 +6848,7 @@ product PROMISE PDC20271	0x6269	PDC20271
 product PROMISE PDC20617	0x6617	PDC20617 Dual Ultra/133 IDE Controller
 product PROMISE PDC20620	0x6620	PDC20620 Dual Ultra/133 IDE Controller
 product PROMISE PDC20621	0x6621	PDC20621 Dual Ultra/133 IDE Controller
-product PROMISE PDC20618	0x6626	PDC20618 Dual Ultra/133 IDE Controler
+product PROMISE PDC20618	0x6626	PDC20618 Dual Ultra/133 IDE Controller
 product PROMISE PDC20619	0x6629	PDC20619 Dual Ultra/133 IDE Controller
 product PROMISE PDC20277	0x7275	PDC20277 Ultra/133 IDE Controller
 
@@ -7031,6 +7040,7 @@ product REALTEK RTL8411		0x5289	RTL8411 
 product REALTEK RT8029		0x8029	8029 Ethernet
 product REALTEK RT8139D		0x8039	8139D 10/100 Ethernet
 product REALTEK RT8100		0x8100	8100 10/100 Ethernet
+product REALTEK RT8125		0x8125	8129 10/100/1G/2.5G Ethernet
 product REALTEK RT8129		0x8129	8129 10/100 Ethernet
 product REALTEK RT8101E		0x8136	8100E/8101E/8102E 10/100 Ethernet
 product REALTEK RT8138		0x8138	8138 10/100 Ethernet



CVS commit: [netbsd-9] src/sys/dev/audio

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 12:58:30 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by isaki in ticket #448):

sys/dev/audio/audio.c: revision 1.33

Fix a wrong calculation of recording ring buffer.  Reported on
http://mail-index.netbsd.org/current-users/2019/11/04/msg036976.html


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.3 -r1.28.2.4 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.28.2.3 src/sys/dev/audio/audio.c:1.28.2.4
--- src/sys/dev/audio/audio.c:1.28.2.3	Sun Oct  6 11:02:32 2019
+++ src/sys/dev/audio/audio.c	Tue Nov 19 12:58:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.28.2.3 2019/10/06 11:02:32 martin Exp $	*/
+/*	$NetBSD: audio.c,v 1.28.2.4 2019/11/19 12:58:29 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.3 2019/10/06 11:02:32 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.4 2019/11/19 12:58:29 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4510,7 +4510,7 @@ audio_track_record(audio_track_t *track)
 		int bytes1;
 		int bytes2;
 
-		bytes1 = auring_get_contig_used(usrbuf);
+		bytes1 = auring_get_contig_free(usrbuf);
 		KASSERT(bytes1 % framesize == 0);
 		memcpy((uint8_t *)usrbuf->mem + auring_tail(usrbuf),
 		(uint8_t *)outbuf->mem + outbuf->head * framesize,



CVS commit: [netbsd-9] src/sys/dev/audio

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 12:58:30 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by isaki in ticket #448):

sys/dev/audio/audio.c: revision 1.33

Fix a wrong calculation of recording ring buffer.  Reported on
http://mail-index.netbsd.org/current-users/2019/11/04/msg036976.html


To generate a diff of this commit:
cvs rdiff -u -r1.28.2.3 -r1.28.2.4 src/sys/dev/audio/audio.c

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



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 12:56:48 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by isaki in ticket #447):

sys/dev/usb/uaudio.c: revision 1.162

Use kmem_zalloc() instead of kmem_alloc() to initialize structure.
struct audio_format added a member since isaki-audio2.

Fix PR kern/54662 "uaudio sometimes not recognized".


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

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

Modified files:

Index: src/sys/dev/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.161 src/sys/dev/usb/uaudio.c:1.161.2.1
--- src/sys/dev/usb/uaudio.c:1.161	Thu Jun  6 12:59:33 2019
+++ src/sys/dev/usb/uaudio.c	Tue Nov 19 12:56:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.161 2019/06/06 12:59:33 isaki Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.161.2.1 2019/11/19 12:56:48 martin Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.161 2019/06/06 12:59:33 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.161.2.1 2019/11/19 12:56:48 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1795,13 +1795,12 @@ uaudio_identify_as(struct uaudio_softc *
 	}
 
 	/* build audio_format array */
-	sc->sc_formats = kmem_alloc(sizeof(struct audio_format) * sc->sc_nalts,
+	sc->sc_formats = kmem_zalloc(sizeof(struct audio_format) * sc->sc_nalts,
 	KM_SLEEP);
 	sc->sc_nformats = sc->sc_nalts;
 	for (i = 0; i < sc->sc_nalts; i++) {
 		auf = >sc_formats[i];
 		t1desc = sc->sc_alts[i].asf1desc;
-		auf->driver_data = NULL;
 		if (UE_GET_DIR(sc->sc_alts[i].edesc->bEndpointAddress) == UE_DIR_OUT)
 			auf->mode = AUMODE_PLAY;
 		else



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

2019-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Nov 19 12:56:48 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by isaki in ticket #447):

sys/dev/usb/uaudio.c: revision 1.162

Use kmem_zalloc() instead of kmem_alloc() to initialize structure.
struct audio_format added a member since isaki-audio2.

Fix PR kern/54662 "uaudio sometimes not recognized".


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

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



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:46:33 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: if_hvn.c
src/sys/dev/pci [netbsd-9]: if_mcx.c

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

sys/dev/hyperv/if_hvn.c: revision 1.7
sys/dev/pci/if_mcx.c: revision 1.6

Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/dev/pci/if_mcx.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/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.4.2.1 src/sys/dev/hyperv/if_hvn.c:1.4.2.2
--- src/sys/dev/hyperv/if_hvn.c:1.4.2.1	Sat Nov 16 16:51:45 2019
+++ src/sys/dev/hyperv/if_hvn.c	Mon Nov 18 19:46:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.4.2.1 2019/11/16 16:51:45 martin Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.4.2.2 2019/11/18 19:46:33 martin Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.1 2019/11/16 16:51:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.2 2019/11/18 19:46:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -565,7 +565,7 @@ hvn_encap(struct hvn_softc *sc, struct m
 	case 0:
 		break;
 	case EFBIG:
-		if (m_defrag(m, M_NOWAIT) == 0 &&
+		if (m_defrag(m, M_NOWAIT) != NULL &&
 		bus_dmamap_load_mbuf(sc->sc_dmat, txd->txd_dmap, m,
 		  BUS_DMA_READ | BUS_DMA_NOWAIT) == 0)
 			break;

Index: src/sys/dev/pci/if_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.1.2.4 src/sys/dev/pci/if_mcx.c:1.1.2.5
--- src/sys/dev/pci/if_mcx.c:1.1.2.4	Sun Sep 29 07:26:23 2019
+++ src/sys/dev/pci/if_mcx.c	Mon Nov 18 19:46:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.1.2.4 2019/09/29 07:26:23 martin Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.1.2.5 2019/11/18 19:46:33 martin Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -6347,7 +6347,7 @@ mcx_load_mbuf(struct mcx_softc *sc, stru
 		break;
 
 	case EFBIG:
-		if (m_defrag(m, M_DONTWAIT) == 0 &&
+		if (m_defrag(m, M_DONTWAIT) != NULL &&
 		bus_dmamap_load_mbuf(sc->sc_dmat, ms->ms_map, m,
 		BUS_DMA_STREAMING | BUS_DMA_NOWAIT) == 0)
 			break;



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

2019-11-18 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 18 19:46:33 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: if_hvn.c
src/sys/dev/pci [netbsd-9]: if_mcx.c

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

sys/dev/hyperv/if_hvn.c: revision 1.7
sys/dev/pci/if_mcx.c: revision 1.6

Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/dev/pci/if_mcx.c

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



CVS commit: [netbsd-9] src/sys/dev/nvmm/x86

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 20:08:45 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86 [netbsd-9]: nvmm_x86.c

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

sys/dev/nvmm/x86/nvmm_x86.c: revision 1.8

Don't report MWAITX by default.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/dev/nvmm/x86/nvmm_x86.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/nvmm/x86/nvmm_x86.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86.c:1.7 src/sys/dev/nvmm/x86/nvmm_x86.c:1.7.4.1
--- src/sys/dev/nvmm/x86/nvmm_x86.c:1.7	Wed May 15 04:39:52 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86.c	Sat Nov 16 20:08:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86.c,v 1.7 2019/05/15 04:39:52 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86.c,v 1.7.4.1 2019/11/16 20:08:45 martin Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86.c,v 1.7 2019/05/15 04:39:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86.c,v 1.7.4.1 2019/11/16 20:08:45 martin Exp $");
 
 #include 
 #include 
@@ -292,7 +292,7 @@ const struct nvmm_x86_cpuid_mask nvmm_cp
 	.eax = ~0,
 	.ebx = ~0,
 	.ecx =
-	/* Excluded: SVM, EAPIC, OSVW. */
+	/* Excluded: SVM, EAPIC, OSVW, MWAITX. */
 	CPUID_LAHF | CPUID_CMPLEGACY |
 	CPUID_ALTMOVCR0 | CPUID_LZCNT |
 	CPUID_SSE4A | CPUID_MISALIGNSSE |
@@ -304,7 +304,7 @@ const struct nvmm_x86_cpuid_mask nvmm_cp
 	CPUID_TOPOEXT | CPUID_PCEC |
 	CPUID_PCENB | CPUID_SPM |
 	CPUID_DBE | CPUID_PTSC |
-	CPUID_L2IPERFC | CPUID_MWAITX,
+	CPUID_L2IPERFC,
 	.edx =
 	/* Excluded: RDTSCP. */
 	CPUID_SYSCALL | CPUID_MPC |



CVS commit: [netbsd-9] src/sys/dev/nvmm/x86

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 20:08:45 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86 [netbsd-9]: nvmm_x86.c

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

sys/dev/nvmm/x86/nvmm_x86.c: revision 1.8

Don't report MWAITX by default.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/dev/nvmm/x86/nvmm_x86.c

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



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:51:45 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvkbd.c if_hvn.c

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

sys/dev/hyperv/if_hvn.c: revision 1.6
sys/dev/hyperv/hvkbd.c: revision 1.4

hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/hyperv/if_hvn.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.2 src/sys/dev/hyperv/hvkbd.c:1.2.2.1
--- src/sys/dev/hyperv/hvkbd.c:1.2	Sun Jul 21 16:08:13 2019
+++ src/sys/dev/hyperv/hvkbd.c	Sat Nov 16 16:51:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.2 2019/07/21 16:08:13 rin Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.2.2.1 2019/11/16 16:51:45 martin Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2 2019/07/21 16:08:13 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.2.2.1 2019/11/16 16:51:45 martin Exp $");
 
 #include 
 #include 
@@ -216,12 +216,6 @@ hvkbd_attach(device_t parent, device_t s
 		return;
 	}
 
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(self))) {
-		aprint_error_dev(self,
-		"failed to create the interrupt thread\n");
-		goto free_buf;
-	}
-
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 	if (vmbus_channel_open(sc->sc_chan,
 	HVKBD_TX_RING_SIZE + HVKBD_RX_RING_SIZE, NULL, 0, hvkbd_intr, sc)) {

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.4 src/sys/dev/hyperv/if_hvn.c:1.4.2.1
--- src/sys/dev/hyperv/if_hvn.c:1.4	Tue Jul  9 08:46:58 2019
+++ src/sys/dev/hyperv/if_hvn.c	Sat Nov 16 16:51:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.4 2019/07/09 08:46:58 msaitoh Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.4.2.1 2019/11/16 16:51:45 martin Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.4.2.1 2019/11/16 16:51:45 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -928,12 +928,6 @@ hvn_nvs_attach(struct hvn_softc *sc)
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(sc->sc_dev))) {
-		aprint_error_dev(sc->sc_dev,
-		"failed to create the interrupt thread\n");
-		return -1;
-	}
-
 	/* Associate our interrupt handler with the channel */
 	if (vmbus_channel_open(sc->sc_chan, ringsize, NULL, 0,
 	hvn_nvs_intr, sc)) {



CVS commit: [netbsd-9] src/sys/dev/hyperv

2019-11-16 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 16 16:51:45 UTC 2019

Modified Files:
src/sys/dev/hyperv [netbsd-9]: hvkbd.c if_hvn.c

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

sys/dev/hyperv/if_hvn.c: revision 1.6
sys/dev/hyperv/hvkbd.c: revision 1.4

hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/hyperv/if_hvn.c

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



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:41:04 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by hauke in ticket #426):

sys/dev/pci/pucdata.c: revision 1.105

The 16C1054 and 16C1058 serial multi-port controllers need a clock
multiplier of 8, just like the 16C1050 controller.

Verified with an ExSys EX-41388.
ryo@ checked back with the hardware his original commit was based on,
and confirmed the change.

XXX Pull-up to netbsd-{7,8,9}


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.2.1 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.



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:41:04 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by hauke in ticket #426):

sys/dev/pci/pucdata.c: revision 1.105

The 16C1054 and 16C1058 serial multi-port controllers need a clock
multiplier of 8, just like the 16C1050 controller.

Verified with an ExSys EX-41388.
ryo@ checked back with the hardware his original commit was based on,
and confirmed the change.

XXX Pull-up to netbsd-{7,8,9}


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.2.1 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/pucdata.c
diff -u src/sys/dev/pci/pucdata.c:1.104 src/sys/dev/pci/pucdata.c:1.104.2.1
--- src/sys/dev/pci/pucdata.c:1.104	Thu May  2 21:33:12 2019
+++ src/sys/dev/pci/pucdata.c	Thu Nov 14 15:41:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pucdata.c,v 1.104 2019/05/02 21:33:12 jdolecek Exp $	*/
+/*	$NetBSD: pucdata.c,v 1.104.2.1 2019/11/14 15:41:03 martin Exp $	*/
 
 /*
  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.104 2019/05/02 21:33:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.104.2.1 2019/11/14 15:41:03 martin Exp $");
 
 #include 
 #include 
@@ -2883,10 +2883,10 @@ const struct puc_device_description puc_
 	{	PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1054, 0, 0 },
 	{	0x,	0x,		 0, 0 },
 	{
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8 },
 	},
 	},
 
@@ -2895,14 +2895,14 @@ const struct puc_device_description puc_
 	{   PCI_VENDOR_SYSTEMBASE, PCI_PRODUCT_SYSTEMBASE_SB16C1058, 0, 0 },
 	{	0x,	0x,		 0, 0 },
 	{
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x20, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x28, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x30, COM_FREQ },
-		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x38, COM_FREQ },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x08, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x10, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x18, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x20, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x28, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x30, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, PCI_BAR0, 0x38, COM_FREQ * 8 },
 	},
 	},
 



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:30:19 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


To generate a diff of this commit:
cvs rdiff -u -r1.125.2.5 -r1.125.2.6 src/sys/dev/pci/ixgbe/ixv.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/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5 src/sys/dev/pci/ixgbe/ixv.c:1.125.2.6
--- src/sys/dev/pci/ixgbe/ixv.c:1.125.2.5	Tue Oct  8 17:05:16 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Thu Nov 14 15:30:19 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.125.2.5 2019/10/08 17:05:16 martin Exp $*/
+/*$NetBSD: ixv.c,v 1.125.2.6 2019/11/14 15:30:19 martin Exp $*/
 
 /**
 
@@ -1920,7 +1920,8 @@ ixv_initialize_receive_units(struct adap
 			adapter->num_rx_desc - 1);
 	}
 
-	ixv_initialize_rss_mapping(adapter);
+	if (adapter->hw.mac.type >= ixgbe_mac_X550_vf)
+		ixv_initialize_rss_mapping(adapter);
 } /* ixv_initialize_receive_units */
 
 /



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

2019-11-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 14 15:30:19 UTC 2019

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

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

sys/dev/pci/ixgbe/ixv.c: revision 1.140

ixv(4): disable RSS configuration on 82599 and X540 VFs.

Those VFs share their RSS configuration with PF and, thus,
they cannot be configured independently. From FreeBSD r354349.


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

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



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

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

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

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

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

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


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

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



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

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

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

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

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

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


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

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

Modified files:

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:05:15 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_kse.c

Log Message:
Pull up following revision(s) (requested by nisimura in ticket #406):

sys/dev/pci/if_kse.c: revision 1.40
sys/dev/pci/if_kse.c: revision 1.41
sys/dev/pci/if_kse.c: revision 1.39

comment touchup

 -

clarify 8842 MAC behaves 100FDX only has no alternative media selection
possible.

 -

major rework to fix link control breakage


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/dev/pci/if_kse.c

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



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

2019-11-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Nov 10 13:05:15 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_kse.c

Log Message:
Pull up following revision(s) (requested by nisimura in ticket #406):

sys/dev/pci/if_kse.c: revision 1.40
sys/dev/pci/if_kse.c: revision 1.41
sys/dev/pci/if_kse.c: revision 1.39

comment touchup

 -

clarify 8842 MAC behaves 100FDX only has no alternative media selection
possible.

 -

major rework to fix link control breakage


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/dev/pci/if_kse.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_kse.c
diff -u src/sys/dev/pci/if_kse.c:1.38 src/sys/dev/pci/if_kse.c:1.38.2.1
--- src/sys/dev/pci/if_kse.c:1.38	Wed May 29 10:07:29 2019
+++ src/sys/dev/pci/if_kse.c	Sun Nov 10 13:05:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kse.c,v 1.38 2019/05/29 10:07:29 msaitoh Exp $	*/
+/*	$NetBSD: if_kse.c,v 1.38.2.1 2019/11/10 13:05:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -29,9 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.38 2019/05/29 10:07:29 msaitoh Exp $");
+/*
+ * Micrel 8841/8842 10/100 ethernet driver
+ */
 
+#include 
+__KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1.38.2.1 2019/11/10 13:05:15 martin Exp $");
 
 #include 
 #include 
@@ -58,6 +61,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1
 #include 
 #include 
 
+#define KSE_LINKDEBUG 0
+
 #define CSR_READ_4(sc, off) \
 	bus_space_read_4(sc->sc_st, sc->sc_sh, off)
 #define CSR_WRITE_4(sc, off, val) \
@@ -93,6 +98,17 @@ __KERNEL_RCSID(0, "$NetBSD: if_kse.c,v 1
 #define P1SR	0x514	/* port 1 status */
 #define P2CR4	0x532	/* port 2 control 4 */
 #define P2SR	0x534	/* port 2 status */
+#define PxCR_STARTNEG	(1U << 9)	/* restart auto negotiation */
+#define PxCR_AUTOEN	(1U << 7)	/* auto negotiation enable */
+#define PxCR_SPD100	(1U << 6)	/* force speed 100 */
+#define PxCR_USEFDX	(1U << 5)	/* force full duplex */
+#define PxCR_USEFC	(1U << 4)	/* advertise pause flow control */
+#define PxSR_ACOMP	(1U << 6)	/* auto negotiation completed */
+#define PxSR_SPD100	(1U << 10)	/* speed is 100Mbps */
+#define PxSR_FDX	(1U << 9)	/* full duplex */
+#define PxSR_LINKUP	(1U << 5)	/* link is good */
+#define PxSR_RXFLOW	(1U << 12)	/* receive flow control active */
+#define PxSR_TXFLOW	(1U << 11)	/* transmit flow control active */
 
 #define TXC_BS_MSK	0x3f00	/* burst size */
 #define TXC_BS_SFT	(24)		/* 1,2,4,8,16,32 or 0 for unlimited */
@@ -207,8 +223,8 @@ struct kse_softc {
 	void *sc_ih;			/* interrupt cookie */
 
 	struct ifmedia sc_media;	/* ifmedia information */
-	int sc_media_status;		/* PHY */
-	int sc_media_active;		/* PHY */
+	int sc_linkstatus;		/* last P1SR register value */
+
 	callout_t  sc_callout;		/* MII tick callout */
 	callout_t  sc_stat_ch;		/* statistics counter callout */
 
@@ -313,11 +329,10 @@ static int kse_intr(void *);
 static void rxintr(struct kse_softc *);
 static void txreap(struct kse_softc *);
 static void lnkchg(struct kse_softc *);
-static int ifmedia_upd(struct ifnet *);
-static void ifmedia_sts(struct ifnet *, struct ifmediareq *);
+static int ksephy_change(struct ifnet *);
+static void ksephy_status(struct ifnet *, struct ifmediareq *);
+static void nopifm_status(struct ifnet *, struct ifmediareq *);
 static void phy_tick(void *);
-static int ifmedia2_upd(struct ifnet *);
-static void ifmedia2_sts(struct ifnet *, struct ifmediareq *);
 #ifdef KSE_EVENT_COUNTERS
 static void stat_tick(void *);
 static void zerostats(struct kse_softc *);
@@ -493,8 +508,9 @@ kse_attach(device_t parent, device_t sel
 	/* Initialize ifmedia structures. */
 	ifm = >sc_media;
 	sc->sc_ethercom.ec_ifmedia = ifm;
+	sc->sc_linkstatus = 0;
 	if (sc->sc_chip == 0x8841) {
-		ifmedia_init(ifm, 0, ifmedia_upd, ifmedia_sts);
+		ifmedia_init(ifm, 0, ksephy_change, ksephy_status);
 		ifmedia_add(ifm, IFM_ETHER | IFM_10_T, 0, NULL);
 		ifmedia_add(ifm, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL);
 		ifmedia_add(ifm, IFM_ETHER | IFM_100_TX, 0, NULL);
@@ -502,9 +518,18 @@ kse_attach(device_t parent, device_t sel
 		ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
 		ifmedia_set(ifm, IFM_ETHER | IFM_AUTO);
 	} else {
-		ifmedia_init(ifm, 0, ifmedia2_upd, ifmedia2_sts);
-		ifmedia_add(ifm, IFM_ETHER | IFM_AUTO, 0, NULL);
-		ifmedia_set(ifm, IFM_ETHER | IFM_AUTO);
+		/*
+		 * pretend 100FDX w/ no alternative media selection.
+		 * 8842 MAC is tied with a builtin 3 port switch.
+		 * It can do rate control over either of tx / rx direction
+		 * respectively, tough, this driver leaves the rate unlimited
+		 * intending 100Mbps maximum.
+		 * 2 ports behave in AN mode and this driver provides no mean
+		 * to see the exact details.
+		 */
+		ifmedia_init(ifm, 0, NULL, nopifm_status);
+		ifmedia_add(ifm, IFM_ETHER | IFM_100_TX | 

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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 10:07:42 UTC 2019

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

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

sys/dev/pci/if_wm.c: revision 1.646
sys/dev/pci/if_wm.c: revision 1.647
sys/dev/pci/if_wm.c: revision 1.649

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

printf -> device_printf

Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.645.2.1 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.



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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 10:07:42 UTC 2019

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

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

sys/dev/pci/if_wm.c: revision 1.646
sys/dev/pci/if_wm.c: revision 1.647
sys/dev/pci/if_wm.c: revision 1.649

Use unsigned to avoid undefined behavior in wm_i82543_mii_sendbits().
Found by kUBSan.

printf -> device_printf

Fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.645 -r1.645.2.1 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.645 src/sys/dev/pci/if_wm.c:1.645.2.1
--- src/sys/dev/pci/if_wm.c:1.645	Tue Jul 30 04:42:29 2019
+++ src/sys/dev/pci/if_wm.c	Wed Nov  6 10:07:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.645 2019/07/30 04:42:29 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645 2019/07/30 04:42:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645.2.1 2019/11/06 10:07:42 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4616,8 +4616,8 @@ wm_flush_desc_rings(struct wm_softc *sc)
 		return;
 
 	/* TX */
-	printf("%s: Need TX flush (reg = %08x, len = %u)\n",
-	device_xname(sc->sc_dev), preg, reg);
+	device_printf(sc->sc_dev, "Need TX flush (reg = %08x, len = %u)\n",
+	preg, reg);
 	reg = CSR_READ(sc, WMREG_TCTL);
 	CSR_WRITE(sc, WMREG_TCTL, reg | TCTL_EN);
 
@@ -4644,8 +4644,7 @@ wm_flush_desc_rings(struct wm_softc *sc)
 		return;
 
 	/* RX */
-	printf("%s: Need RX flush (reg = %08x)\n",
-	device_xname(sc->sc_dev), preg);
+	device_printf(sc->sc_dev, "Need RX flush (reg = %08x)\n", preg);
 	rctl = CSR_READ(sc, WMREG_RCTL);
 	CSR_WRITE(sc, WMREG_RCTL, rctl & ~RCTL_EN);
 	CSR_WRITE_FLUSH(sc);
@@ -4885,7 +4884,7 @@ wm_reset(struct wm_softc *sc)
 			reg |= CTRL_PHY_RESET;
 			phy_reset = 1;
 		} else
-			printf("XXX reset is blocked!!!\n");
+			device_printf(sc->sc_dev, "XXX reset is blocked!!!\n");
 		sc->phy.acquire(sc);
 		CSR_WRITE(sc, WMREG_CTRL, reg);
 		/* Don't insert a completion barrier when reset */
@@ -9033,7 +9032,8 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
  * Fiber?
  * Shoud not enter here.
  */
-printf("unknown media (%x)\n", active);
+device_printf(dev, "unknown media (%x)\n",
+active);
 break;
 			}
 			if (active & IFM_FDX)
@@ -9893,7 +9893,7 @@ wm_gmii_reset(struct wm_softc *sc)
  * 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
+ * It might not be perfect 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,
@@ -10413,7 +10413,7 @@ wm_i82543_mii_sendbits(struct wm_softc *
 	v &= ~(MDI_IO | MDI_CLK | (CTRL_SWDPIO_MASK << CTRL_SWDPIO_SHIFT));
 	v |= MDI_DIR | CTRL_SWDPIO(3);
 
-	for (i = 1 << (nbits - 1); i != 0; i >>= 1) {
+	for (i = __BIT(nbits - 1); i != 0; i >>= 1) {
 		if (data & i)
 			v |= MDI_IO;
 		else
@@ -11137,7 +11137,7 @@ wm_gmii_hv_readreg_locked(device_t dev, 
 	 * own func
 	 */
 	if ((page > 0) && (page < HV_INTC_FC_PAGE_START)) {
-		printf("gmii_hv_readreg!!!\n");
+		device_printf(dev, "gmii_hv_readreg!!!\n");
 		return -1;
 	}
 
@@ -11205,7 +11205,7 @@ wm_gmii_hv_writereg_locked(device_t dev,
 	 * own func
 	 */
 	if ((page > 0) && (page < HV_INTC_FC_PAGE_START)) {
-		printf("gmii_hv_writereg!!!\n");
+		device_printf(dev, "gmii_hv_writereg!!!\n");
 		return -1;
 	}
 
@@ -11229,7 +11229,7 @@ wm_gmii_hv_writereg_locked(device_t dev,
 			if ((child != NULL) && (child->mii_mpd_rev >= 1)
 			&& (phy == 2) && ((regnum & MII_ADDRMASK) == 0)
 			&& ((val & (1 << 11)) != 0)) {
-printf("XXX need workaround\n");
+device_printf(dev, "XXX need workaround\n");
 			}
 		}
 
@@ -12851,12 +12851,12 @@ wm_ich8_cycle_init(struct wm_softc *sc)
 	/*
 	 * Either we should have a hardware SPI cycle in progress bit to check
 	 * against, in order to start a new cycle or FDONE bit should be
-	 * changed in the hardware so that it is 1 after harware reset, which
+	 * changed in the hardware so that it is 1 after hardware reset, which
 	 * can then be used as an indication whether a cycle is in progress or
 	 * has been completed .. we should also have some software semaphore
 	 * mechanism to guard FDONE or the cycle in progress bit so that two
 	 * threads access to those bits can be sequentiallized or a way so that
-	 * 2 threads dont start the cycle at the same time
+	 * 2 threads don't start the cycle at the same time
 	 */
 
 	

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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 09:53:59 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ukphy_subr.c

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

sys/dev/mii/ukphy_subr.c: revision 1.16

Fix a bug that ukphy_status() misunderstand master mode.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.4.1 src/sys/dev/mii/ukphy_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/mii/ukphy_subr.c
diff -u src/sys/dev/mii/ukphy_subr.c:1.15 src/sys/dev/mii/ukphy_subr.c:1.15.4.1
--- src/sys/dev/mii/ukphy_subr.c:1.15	Mon Mar 25 09:20:46 2019
+++ src/sys/dev/mii/ukphy_subr.c	Wed Nov  6 09:53:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ukphy_subr.c,v 1.15 2019/03/25 09:20:46 msaitoh Exp $	*/
+/*	$NetBSD: ukphy_subr.c,v 1.15.4.1 2019/11/06 09:53:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.15 2019/03/25 09:20:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukphy_subr.c,v 1.15.4.1 2019/11/06 09:53:59 martin Exp $");
 
 #include 
 #include 
@@ -119,7 +119,7 @@ ukphy_status(struct mii_softc *phy)
 		else
 			mii->mii_media_active |= IFM_NONE;
 
-		if ((mii->mii_media_active & IFM_1000_T) &&
+		if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) &&
 		(gtsr & GTSR_MS_RES))
 			mii->mii_media_active |= IFM_ETH_MASTER;
 



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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 09:53:59 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ukphy_subr.c

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

sys/dev/mii/ukphy_subr.c: revision 1.16

Fix a bug that ukphy_status() misunderstand master mode.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.4.1 src/sys/dev/mii/ukphy_subr.c

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



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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 09:52:20 UTC 2019

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

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

sys/dev/pci/pci.c: revision 1.156

PCIe downstream ports only have a single child device, so limit probing to
dev 0.


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

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



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

2019-11-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Nov  6 09:52:20 UTC 2019

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

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

sys/dev/pci/pci.c: revision 1.156

PCIe downstream ports only have a single child device, so limit probing to
dev 0.


To generate a diff of this commit:
cvs rdiff -u -r1.154.4.1 -r1.154.4.2 src/sys/dev/pci/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/pci.c
diff -u src/sys/dev/pci/pci.c:1.154.4.1 src/sys/dev/pci/pci.c:1.154.4.2
--- src/sys/dev/pci/pci.c:1.154.4.1	Tue Oct 15 19:33:23 2019
+++ src/sys/dev/pci/pci.c	Wed Nov  6 09:52:20 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $	*/
+/*	$NetBSD: pci.c,v 1.154.4.2 2019/11/06 09:52:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1997, 1998
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.2 2019/11/06 09:52:20 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -695,17 +695,26 @@ pci_enumerate_bus(struct pci_softc *sc, 
 
 	device_t bridgedev;
 	bool arien = false;
+	bool downstream_port = false;
 
-	/* Check PCIe ARI */
+	/* Check PCIe ARI and port type */
 	bridgedev = device_parent(sc->sc_dev);
 	if (device_is_a(bridgedev, "ppb")) {
 		struct ppb_softc *ppbsc = device_private(bridgedev);
 		pci_chipset_tag_t ppbpc = ppbsc->sc_pc;
 		pcitag_t ppbtag = ppbsc->sc_tag;
-		pcireg_t pciecap, reg;
+		pcireg_t pciecap, capreg, reg;
 
 		if (pci_get_capability(ppbpc, ppbtag, PCI_CAP_PCIEXPRESS,
-		, NULL) != 0) {
+		, ) != 0) {
+			switch (PCIE_XCAP_TYPE(capreg)) {
+			case PCIE_XCAP_TYPE_ROOT:
+			case PCIE_XCAP_TYPE_DOWN:
+			case PCIE_XCAP_TYPE_PCI2PCIE:
+downstream_port = true;
+break;
+			}
+
 			reg = pci_conf_read(ppbpc, ppbtag, pciecap
 			+ PCIE_DCSR2);
 			if ((reg & PCIE_DCSR2_ARI_FWD) != 0)
@@ -714,6 +723,11 @@ pci_enumerate_bus(struct pci_softc *sc, 
 	}
 
 	n = pci_bus_devorder(sc->sc_pc, sc->sc_bus, devs, __arraycount(devs));
+	if (downstream_port) {
+		/* PCIe downstream ports only have a single child device */
+		n = 1;
+	}
+
 	for (i = 0; i < n; i++) {
 		device = devs[i];
 



CVS commit: [netbsd-9] src/sys/dev/rasops

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:13:31 UTC 2019

Modified Files:
src/sys/dev/rasops [netbsd-9]: rasops.h

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

sys/dev/rasops/rasops.h: revision 1.49

Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg79.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.38.2.1 -r1.38.2.2 src/sys/dev/rasops/rasops.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.38.2.1 src/sys/dev/rasops/rasops.h:1.38.2.2
--- src/sys/dev/rasops/rasops.h:1.38.2.1	Thu Aug 15 12:21:27 2019
+++ src/sys/dev/rasops/rasops.h	Mon Nov  4 14:13:31 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.38.2.1 2019/08/15 12:21:27 martin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.38.2.2 2019/11/04 14:13:31 martin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -149,10 +149,8 @@ struct rasops_info {
 	/* Callbacks so we can share some code */
 	void	(*ri_do_cursor)(struct rasops_info *);
 
-#if NRASOPS_ROTATION > 0
 	/* Used to intercept putchar to permit display rotation */
 	struct	wsdisplay_emulops ri_real_ops;
-#endif
 };
 
 #define CHAR_IN_FONT(c, font)		\



CVS commit: [netbsd-9] src/sys/dev/rasops

2019-11-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov  4 14:13:31 UTC 2019

Modified Files:
src/sys/dev/rasops [netbsd-9]: rasops.h

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

sys/dev/rasops/rasops.h: revision 1.49

Fix "Alignment Fault 3" kernel failure of NetBSD/zaurus 8.1 GENERIC.
structure in header files could be problematic.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/31/msg79.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.38.2.1 -r1.38.2.2 src/sys/dev/rasops/rasops.h

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



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

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

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

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

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

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


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

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



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

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

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

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

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

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


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

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

Modified files:

Index: src/sys/dev/ic/ld_nvme.c
diff -u src/sys/dev/ic/ld_nvme.c:1.22 src/sys/dev/ic/ld_nvme.c:1.22.2.1
--- src/sys/dev/ic/ld_nvme.c:1.22	Fri Apr 26 14:28:40 2019
+++ src/sys/dev/ic/ld_nvme.c	Mon Oct 28 18:30:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ld_nvme.c,v 1.22 2019/04/26 14:28:40 mlelstv Exp $	*/
+/*	$NetBSD: ld_nvme.c,v 1.22.2.1 2019/10/28 18:30:43 martin Exp $	*/
 
 /*-
  * Copyright (C) 2016 NONAKA Kimihiro 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.22 2019/04/26 14:28:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_nvme.c,v 1.22.2.1 2019/10/28 18:30:43 martin Exp $");
 
 #include 
 #include 
@@ -105,6 +105,19 @@ ld_nvme_attach(device_t parent, device_t
 	KASSERT(ns);
 	f = >ident->lbaf[NVME_ID_NS_FLBAS(ns->ident->flbas)];
 
+	/*
+	 * NVME1.0e 6.11 Identify command
+	 *
+	 * LBADS values smaller than 9 are not supported, a value
+	 * of zero means that the format is not used.
+	 */
+	if (f->lbads < 9) {
+		if (f->lbads > 0)
+			aprint_error_dev(self,
+			"unsupported logical data size %u\n", f->lbads);
+		return;
+	}
+
 	ld->sc_secsize = 1 << f->lbads;
 	ld->sc_secperunit = ns->ident->nsze;
 	ld->sc_maxxfer = naa->naa_maxphys;



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:29:13 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ciphy.c

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

sys/dev/mii/ciphy.c: revision 1.36

Call mii_phy_flowstatus() to show the flow setting.


To generate a diff of this commit:
cvs rdiff -u -r1.34.4.2 -r1.34.4.3 src/sys/dev/mii/ciphy.c

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



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:29:13 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ciphy.c

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

sys/dev/mii/ciphy.c: revision 1.36

Call mii_phy_flowstatus() to show the flow setting.


To generate a diff of this commit:
cvs rdiff -u -r1.34.4.2 -r1.34.4.3 src/sys/dev/mii/ciphy.c

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

Modified files:

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.34.4.2 src/sys/dev/mii/ciphy.c:1.34.4.3
--- src/sys/dev/mii/ciphy.c:1.34.4.2	Wed Oct 23 19:45:56 2019
+++ src/sys/dev/mii/ciphy.c	Thu Oct 24 16:29:13 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.34.4.2 2019/10/23 19:45:56 martin Exp $ */
+/* $NetBSD: ciphy.c,v 1.34.4.3 2019/10/24 16:29:13 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34.4.2 2019/10/23 19:45:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34.4.3 2019/10/24 16:29:13 martin Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -339,7 +339,7 @@ ciphy_status(struct mii_softc *sc)
 	}
 
 	if (bmsr & CIPHY_AUXCSR_FDX)
-		mii->mii_media_active |= IFM_FDX;
+		mii->mii_media_active |= IFM_FDX | mii_phy_flowstatus(sc);
 	else
 		mii->mii_media_active |= IFM_HDX;
 



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:25:33 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_jme.c

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

sys/dev/pci/if_jme.c: revision 1.46

A * is missing here. This could cause a use-after-free.
Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/dev/pci/if_jme.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_jme.c
diff -u src/sys/dev/pci/if_jme.c:1.44 src/sys/dev/pci/if_jme.c:1.44.2.1
--- src/sys/dev/pci/if_jme.c:1.44	Tue Jul  9 08:46:59 2019
+++ src/sys/dev/pci/if_jme.c	Thu Oct 24 16:25:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_jme.c,v 1.44 2019/07/09 08:46:59 msaitoh Exp $	*/
+/*	$NetBSD: if_jme.c,v 1.44.2.1 2019/10/24 16:25:33 martin Exp $	*/
 
 /*
  * Copyright (c) 2008 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.44 2019/07/09 08:46:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.44.2.1 2019/10/24 16:25:33 martin Exp $");
 
 
 #include 
@@ -1453,7 +1453,7 @@ jme_encap(struct jme_softc *sc, struct m
 			"DMA segments, dropping...\n",
 			device_xname(sc->jme_dev));
 			m_freem(*m_head);
-			m_head = NULL;
+			*m_head = NULL;
 		}
 		return (error);
 	}



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:25:33 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_jme.c

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

sys/dev/pci/if_jme.c: revision 1.46

A * is missing here. This could cause a use-after-free.
Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/dev/pci/if_jme.c

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



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:19:23 UTC 2019

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

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

sys/dev/pci/if_msk.c: revision 1.92

Fix order of m_freem(). Found by kASan. OK'd by jdolecek and mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/sys/dev/pci/if_msk.c

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



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:19:23 UTC 2019

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

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

sys/dev/pci/if_msk.c: revision 1.92

Fix order of m_freem(). Found by kASan. OK'd by jdolecek and mrg.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.91.2.1 src/sys/dev/pci/if_msk.c

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

Modified files:

Index: src/sys/dev/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.91 src/sys/dev/pci/if_msk.c:1.91.2.1
--- src/sys/dev/pci/if_msk.c:1.91	Mon Jun  3 05:22:57 2019
+++ src/sys/dev/pci/if_msk.c	Thu Oct 24 16:19:23 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.91 2019/06/03 05:22:57 msaitoh Exp $ */
+/* $NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91 2019/06/03 05:22:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.91.2.1 2019/10/24 16:19:23 martin Exp $");
 
 #include 
 #include 
@@ -2118,9 +2118,6 @@ msk_txeof(struct sk_if_softc *sc_if)
 		if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) {
 			entry = sc_if->sk_cdata.sk_tx_map[idx];
 
-			m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
-			sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
-
 			bus_dmamap_sync(sc->sc_dmatag, entry->dmamap, 0,
 			entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
 
@@ -2128,6 +2125,8 @@ msk_txeof(struct sk_if_softc *sc_if)
 			SIMPLEQ_INSERT_TAIL(_if->sk_txmap_head, entry,
 	  link);
 			sc_if->sk_cdata.sk_tx_map[idx] = NULL;
+			m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
+			sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
 		}
 		sc_if->sk_cdata.sk_tx_cnt--;
 		SK_INC(idx, MSK_TX_RING_CNT);
@@ -2646,13 +2645,19 @@ msk_stop(struct ifnet *ifp, int disable)
 
 	for (i = 0; i < MSK_TX_RING_CNT; i++) {
 		if (sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf != NULL) {
-			m_freem(sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf);
-			sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
+			dma = sc_if->sk_cdata.sk_tx_map[i];
+
+			bus_dmamap_sync(sc->sc_dmatag, dma->dmamap, 0,
+			dma->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+
+			bus_dmamap_unload(sc->sc_dmatag, dma->dmamap);
 #if 1
 			SIMPLEQ_INSERT_HEAD(_if->sk_txmap_head,
 			sc_if->sk_cdata.sk_tx_map[i], link);
 			sc_if->sk_cdata.sk_tx_map[i] = 0;
 #endif
+			m_freem(sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf);
+			sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
 		}
 	}
 



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:14:11 UTC 2019

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

Log Message:
Regen for ticket #373


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.2 -r1.1371.2.3 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.2 -r1.1370.2.3 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.



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:14:11 UTC 2019

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

Log Message:
Regen for ticket #373


To generate a diff of this commit:
cvs rdiff -u -r1.1371.2.2 -r1.1371.2.3 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1370.2.2 -r1.1370.2.3 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-9] src/sys/dev/pci

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:12:42 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1386
sys/dev/pci/pcidevs: revision 1.1387

Modify Attansic Ethernet devices' description to clarify.
Add Killer E2400 and E2500.


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

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



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

2019-10-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 24 16:12:42 UTC 2019

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

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

sys/dev/pci/pcidevs: revision 1.1386
sys/dev/pci/pcidevs: revision 1.1387

Modify Attansic Ethernet devices' description to clarify.
Add Killer E2400 and E2500.


To generate a diff of this commit:
cvs rdiff -u -r1.1383.2.2 -r1.1383.2.3 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.1383.2.2 src/sys/dev/pci/pcidevs:1.1383.2.3
--- src/sys/dev/pci/pcidevs:1.1383.2.2	Tue Sep 24 02:59:35 2019
+++ src/sys/dev/pci/pcidevs	Thu Oct 24 16:12:42 2019
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1383.2.2 2019/09/24 02:59:35 martin Exp $
+$NetBSD: pcidevs,v 1.1383.2.3 2019/10/24 16:12:42 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1332,18 +1332,20 @@ product ASUSTEK HFCPCI		0x0675	ISDN
 /* Attansic Technology Corp. */
 product ATTANSIC ETHERNET_L1E	0x1026	L1E Gigabit Ethernet Adapter
 product ATTANSIC ETHERNET_GIGA	0x1048	L1 Gigabit Ethernet Adapter
-product ATTANSIC AR8132		0x1062	AR8132 Fast Ethernet Adapter
-product ATTANSIC AR8131		0x1063	AR8131 Gigabit Ethernet Adapter
-product ATTANSIC AR8151		0x1073	AR8151 v1.0 Gigabit Ethernet Adapter
-product ATTANSIC AR8151_V2	0x1083	AR8151 v2.0 Gigabit Ethernet Adapter
+product ATTANSIC AR8132		0x1062	AR8132 L2C Fast Ethernet Adapter
+product ATTANSIC AR8131		0x1063	AR8131 L1C Gigabit Ethernet Adapter
+product ATTANSIC AR8151		0x1073	AR8151 v1.0 L1D Gigabit Ethernet Adapter
+product ATTANSIC AR8151_V2	0x1083	AR8151 v2.0 L1D Gigabit Ethernet Adapter
 product ATTANSIC AR8162		0x1090	AR8162
 product ATTANSIC AR8161		0x1091	AR8161
 product ATTANSIC AR8172		0x10a0	AR8172
 product ATTANSIC AR8171		0x10a1	AR8171
 product ATTANSIC ETHERNET_100	0x2048	L2 100 Mbit Ethernet Adapter
-product ATTANSIC AR8152_B	0x2060	AR8152 v1.1 Fast Ethernet Adapter
-product ATTANSIC AR8152_B2	0x2062	AR8152 v2.0 Fast Ethernet Adapter
-product ATTANSIC E2200		0xe091	E2200
+product ATTANSIC AR8152_B	0x2060	AR8152 v1.1 L2C Fast Ethernet Adapter
+product ATTANSIC AR8152_B2	0x2062	AR8152 v2.0 L2C Fast Ethernet Adapter
+product ATTANSIC E2200		0xe091	Killer E2200
+product ATTANSIC E2400		0xe0a1	Killer E2400
+product ATTANSIC E2500		0xe0b1	Killer E2500
 
 /* ATI products */
 /* See http://www.x.org/wiki/Radeon%20ASICs */



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 20:35:52 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #356):

sys/dev/fss.c: revision 1.108

Check fc_type before fc_cluster, because the latter may not be initialized.

This is harmless because fc_type is always initialized properly, so the
next branch wouldn't have been taken.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.107.4.1 src/sys/dev/fss.c

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

Modified files:

Index: src/sys/dev/fss.c
diff -u src/sys/dev/fss.c:1.107 src/sys/dev/fss.c:1.107.4.1
--- src/sys/dev/fss.c:1.107	Wed Feb 20 10:03:25 2019
+++ src/sys/dev/fss.c	Wed Oct 23 20:35:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $	*/
+/*	$NetBSD: fss.c,v 1.107.4.1 2019/10/23 20:35:52 martin Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.107 2019/02/20 10:03:25 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fss.c,v 1.107.4.1 2019/10/23 20:35:52 martin Exp $");
 
 #include 
 #include 
@@ -992,16 +992,19 @@ restart:
 		return 0;
 	}
 
-	for (scp = sc->sc_cache; scp < scl; scp++)
-		if (scp->fc_cluster == cl) {
-			if (scp->fc_type == FSS_CACHE_VALID) {
+	for (scp = sc->sc_cache; scp < scl; scp++) {
+		if (scp->fc_type == FSS_CACHE_VALID) {
+			if (scp->fc_cluster == cl) {
 mutex_exit(>sc_slock);
 return 0;
-			} else if (scp->fc_type == FSS_CACHE_BUSY) {
+			}
+		} else if (scp->fc_type == FSS_CACHE_BUSY) {
+			if (scp->fc_cluster == cl) {
 cv_wait(>fc_state_cv, >sc_slock);
 goto restart;
 			}
 		}
+	}
 
 	for (scp = sc->sc_cache; scp < scl; scp++)
 		if (scp->fc_type == FSS_CACHE_FREE) {



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 20:35:52 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by maxv in ticket #356):

sys/dev/fss.c: revision 1.108

Check fc_type before fc_cluster, because the latter may not be initialized.

This is harmless because fc_type is always initialized properly, so the
next branch wouldn't have been taken.


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.107.4.1 src/sys/dev/fss.c

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



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:46:53 UTC 2019

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

Log Message:
Regen for ticket #372


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.1 -r1.151.2.2 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.1 -r1.139.2.2 src/sys/dev/mii/miidevs_data.h

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



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:46:53 UTC 2019

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

Log Message:
Regen for ticket #372


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.1 -r1.151.2.2 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.1 -r1.139.2.2 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.151.2.1 src/sys/dev/mii/miidevs.h:1.151.2.2
--- src/sys/dev/mii/miidevs.h:1.151.2.1	Mon Sep  2 07:06:11 2019
+++ src/sys/dev/mii/miidevs.h	Wed Oct 23 19:46:53 2019
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.151.2.1 2019/09/02 07:06:11 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.151.2.2 2019/10/23 19:46:53 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.153.2.1 2019/09/01 13:56:01 martin Exp
+ *	NetBSD: miidevs,v 1.153.2.2 2019/10/23 19:45:56 martin Exp
  */
 
 /*-
@@ -57,10 +57,8 @@
  */
 
 #define	MII_OUI_AMD	0x1a	/* Advanced Micro Devices */
-#define	MII_OUI_VITESSE	0x0001c1	/* Vitesse */
 #define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
 #define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
-#define	MII_OUI_CICADA	0x0003f1	/* Cicada Semiconductor */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
 #define	MII_OUI_BANKSPEED	0x0006b8	/* Bankspeed Pty */
 #define	MII_OUI_NETEXCELL	0x0008bb	/* NetExcell */
@@ -118,6 +116,7 @@
 #define	MII_OUI_xxBROADCOM_ALT1	0x0050ef	/* Broadcom Corporation */
 #define	MII_OUI_yyINTEL	0x005500	/* Intel */
 #define	MII_OUI_yyASIX	0x007063	/* Asix Semiconductor */
+#define	MII_OUI_xxVITESSE	0x008083	/* Vitesse Semiconductor */
 #define	MII_OUI_xxPMCSIERRA2	0x009057	/* PMC-Sierra */
 #define	MII_OUI_xxCICADA	0x00c08f	/* Cicada Semiconductor */
 #define	MII_OUI_xxNATSEMI	0x1000e8	/* National Semiconductor */
@@ -305,23 +304,26 @@
 #define	MII_MODEL_xxBROADCOM_ALT1_BCM5906	0x0004
 #define	MII_STR_xxBROADCOM_ALT1_BCM5906	"BCM5906 10/100baseTX media interface"
 
-/* Cicada Semiconductor PHYs (now owned by Vitesse?) */
-#define	MII_MODEL_CICADA_CS8201	0x0001
-#define	MII_STR_CICADA_CS8201	"Cicada CS8201 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8204	0x0004
-#define	MII_STR_CICADA_CS8204	"Cicada CS8204 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_VSC8211	0x000b
-#define	MII_STR_CICADA_VSC8211	"Cicada VSC8211 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8201A	0x0020
-#define	MII_STR_CICADA_CS8201A	"Cicada CS8201 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8201B	0x0021
-#define	MII_STR_CICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
-#define	MII_MODEL_CICADA_CS8244	0x002c
-#define	MII_STR_CICADA_CS8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
+/* Cicada Semiconductor PHYs (-> Vitesse -> Microsemi) */
+
+#define	MII_MODEL_xxCICADA_CIS8201	0x0001
+#define	MII_STR_xxCICADA_CIS8201	"Cicada CIS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_CIS8204	0x0004
+#define	MII_STR_xxCICADA_CIS8204	"Cicada CIS8204 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8211	0x000b
+#define	MII_STR_xxCICADA_VSC8211	"Cicada VSC8211 10/100/1000TX PHY"
 #define	MII_MODEL_xxCICADA_VSC8221	0x0015
 #define	MII_STR_xxCICADA_VSC8221	"Vitesse VSC8221 10/100/1000BASE-T PHY"
-#define	MII_MODEL_xxCICADA_CS8201B	0x0021
-#define	MII_STR_xxCICADA_CS8201B	"Cicada CS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8224	0x0018
+#define	MII_STR_xxCICADA_VSC8224	"Vitesse VSC8224 10/100/1000BASE-T PHY"
+#define	MII_MODEL_xxCICADA_CIS8201A	0x0020
+#define	MII_STR_xxCICADA_CIS8201A	"Cicada CIS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_CIS8201B	0x0021
+#define	MII_STR_xxCICADA_CIS8201B	"Cicada CIS8201 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8234	0x0022
+#define	MII_STR_xxCICADA_VSC8234	"Vitesse VSC8234 10/100/1000TX PHY"
+#define	MII_MODEL_xxCICADA_VSC8244	0x002c
+#define	MII_STR_xxCICADA_VSC8244	"Vitesse VSC8244 Quad 10/100/1000BASE-T PHY"
 
 /* Davicom Semiconductor PHYs */
 /* AMD Am79C873 seems to be a relabeled DM9101 */
@@ -601,9 +603,13 @@
 #define	MII_MODEL_VIA_VT6103_2	0x0034
 #define	MII_STR_VIA_VT6103_2	"VT6103 10/100 PHY"
 
-/* Vitesse PHYs */
-#define	MII_MODEL_VITESSE_VSC8601	0x0002
-#define	MII_STR_VITESSE_VSC8601	"VSC8601 10/100/1000 PHY"
+/* Vitesse PHYs (Now Microsemi) */
+#define	MII_MODEL_xxVITESSE_VSC8601	0x0002
+#define	MII_STR_xxVITESSE_VSC8601	"VSC8601 10/100/1000 PHY"
+#define	MII_MODEL_xxVITESSE_VSC8641	0x0003
+#define	MII_STR_xxVITESSE_VSC8641	"Vitesse VSC8641 10/100/1000TX PHY"
+#define	MII_MODEL_xxVITESSE_VSC8501	0x0013
+#define	MII_STR_xxVITESSE_VSC8501	"Vitesse VSC8501 10/100/1000TX PHY"
 
 /* XaQti Corp. PHYs */
 #define	MII_MODEL_xxXAQTI_XMACII	0x

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.139.2.1 src/sys/dev/mii/miidevs_data.h:1.139.2.2
--- 

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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:45:57 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ciphy.c miidevs

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

sys/dev/mii/miidevs: revision 1.158
sys/dev/mii/ciphy.c: revision 1.37

- All of Cicada and Vitesse devices' OUI are not bit-reversed, so use "xx".
- Rename CS82xx -> CIS82xx
- Add Vitesse VSC8224, VSC8234, VSC8641 and VSC8501.
- Match a lot of Cicada and Vitesse devices correctly. This change also fixes
  a bug that ciphy_fixup() didn't work.
- Match VSC8221, VSC8234 and VSC8641.


To generate a diff of this commit:
cvs rdiff -u -r1.34.4.1 -r1.34.4.2 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.153.2.1 -r1.153.2.2 src/sys/dev/mii/miidevs

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



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:45:57 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ciphy.c miidevs

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

sys/dev/mii/miidevs: revision 1.158
sys/dev/mii/ciphy.c: revision 1.37

- All of Cicada and Vitesse devices' OUI are not bit-reversed, so use "xx".
- Rename CS82xx -> CIS82xx
- Add Vitesse VSC8224, VSC8234, VSC8641 and VSC8501.
- Match a lot of Cicada and Vitesse devices correctly. This change also fixes
  a bug that ciphy_fixup() didn't work.
- Match VSC8221, VSC8234 and VSC8641.


To generate a diff of this commit:
cvs rdiff -u -r1.34.4.1 -r1.34.4.2 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.153.2.1 -r1.153.2.2 src/sys/dev/mii/miidevs

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

Modified files:

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.34.4.1 src/sys/dev/mii/ciphy.c:1.34.4.2
--- src/sys/dev/mii/ciphy.c:1.34.4.1	Thu Oct 17 19:06:58 2019
+++ src/sys/dev/mii/ciphy.c	Wed Oct 23 19:45:56 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.34.4.1 2019/10/17 19:06:58 martin Exp $ */
+/* $NetBSD: ciphy.c,v 1.34.4.2 2019/10/23 19:45:56 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34.4.1 2019/10/17 19:06:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34.4.2 2019/10/23 19:45:56 martin Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -74,16 +74,16 @@ static const struct mii_phy_funcs ciphy_
 };
 
 static const struct mii_phydesc ciphys[] = {
-	MII_PHY_DESC(CICADA, CS8201),
-	MII_PHY_DESC(CICADA, CS8201A),
-	MII_PHY_DESC(CICADA, CS8201B),
-	MII_PHY_DESC(CICADA, CS8204),
-	MII_PHY_DESC(CICADA, VSC8211),
-	MII_PHY_DESC(CICADA, CS8244),
-	MII_PHY_DESC(CICADA, CS8201),
-	MII_PHY_DESC(CICADA, CS8201A),
-	MII_PHY_DESC(xxCICADA, CS8201B),
-	MII_PHY_DESC(VITESSE, VSC8601),
+	MII_PHY_DESC(xxCICADA, CIS8201),
+	MII_PHY_DESC(xxCICADA, CIS8201A),
+	MII_PHY_DESC(xxCICADA, CIS8201B),
+	MII_PHY_DESC(xxCICADA, CIS8204),
+	MII_PHY_DESC(xxCICADA, VSC8211),
+	MII_PHY_DESC(xxCICADA, VSC8221),
+	MII_PHY_DESC(xxCICADA, VSC8234),
+	MII_PHY_DESC(xxCICADA, VSC8244),
+	MII_PHY_DESC(xxVITESSE, VSC8601),
+	MII_PHY_DESC(xxVITESSE, VSC8641),
 	MII_PHY_END,
 };
 
@@ -398,8 +398,8 @@ ciphy_fixup(struct mii_softc *sc)
 	}
 
 	switch (model) {
-	case MII_MODEL_CICADA_CS8201:
-	case MII_MODEL_CICADA_CS8204:
+	case MII_MODEL_xxCICADA_CIS8201:
+	case MII_MODEL_xxCICADA_CIS8204:
 		/* Turn off "aux mode" (whatever that means) */
 		PHY_SETBIT(sc, CIPHY_MII_AUXCSR, CIPHY_AUXCSR_MDPPS);
 
@@ -418,8 +418,8 @@ ciphy_fixup(struct mii_softc *sc)
 
 		break;
 
-	case MII_MODEL_CICADA_CS8201A:
-	case MII_MODEL_CICADA_CS8201B:
+	case MII_MODEL_xxCICADA_CIS8201A:
+	case MII_MODEL_xxCICADA_CIS8201B:
 		/*
 		 * Work around speed polling bug in VT3119/VT3216
 		 * when using MII in full duplex mode.
@@ -431,9 +431,12 @@ ciphy_fixup(struct mii_softc *sc)
 			PHY_CLRBIT(sc, CIPHY_MII_10BTCSR, CIPHY_10BTCSR_ECHO);
 
 		break;
-	case MII_MODEL_CICADA_VSC8211:
-	case MII_MODEL_CICADA_CS8244:
-	case MII_MODEL_VITESSE_VSC8601:
+	case MII_MODEL_xxCICADA_VSC8211:
+	case MII_MODEL_xxCICADA_VSC8221:
+	case MII_MODEL_xxCICADA_VSC8234:
+	case MII_MODEL_xxCICADA_VSC8244:
+	case MII_MODEL_xxVITESSE_VSC8601:
+	case MII_MODEL_xxVITESSE_VSC8641:
 		break;
 	default:
 		aprint_error_dev(sc->mii_dev, "unknown CICADA PHY model %x\n",

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.153.2.1 src/sys/dev/mii/miidevs:1.153.2.2
--- src/sys/dev/mii/miidevs:1.153.2.1	Sun Sep  1 13:56:01 2019
+++ src/sys/dev/mii/miidevs	Wed Oct 23 19:45:56 2019
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.153.2.1 2019/09/01 13:56:01 martin Exp $
+$NetBSD: miidevs,v 1.153.2.2 2019/10/23 19:45:56 martin Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -50,10 +50,8 @@ $NetBSD: miidevs,v 1.153.2.1 2019/09/01 
  */
 
 oui AMD0x1a	Advanced Micro Devices
-oui VITESSE			0x0001c1	Vitesse
 oui TRIDIUM			0x0001f0	Tridium
 oui DATATRACK			0x0002c6	Data Track Technology
-oui CICADA			0x0003f1	Cicada Semiconductor
 oui AGERE			0x00053d	Agere
 oui BANKSPEED			0x0006b8	Bankspeed Pty
 oui NETEXCELL			0x0008bb	NetExcell
@@ -111,6 +109,7 @@ oui xxINTEL			0x001f00	Intel
 oui xxBROADCOM_ALT1		0x0050ef	Broadcom Corporation
 oui yyINTEL			0x005500	Intel
 oui yyASIX			0x007063	Asix Semiconductor
+oui xxVITESSE			0x008083	Vitesse Semiconductor
 oui xxPMCSIERRA2		0x009057	PMC-Sierra
 oui xxCICADA			0x00c08f	Cicada Semiconductor
 oui xxNATSEMI			0x1000e8	National Semiconductor
@@ -220,15 +219,17 @@ model BROADCOM3 BCM5720C	0x0036 BCM5720C
 model BROADCOM4 BCM5725C	0x0038 BCM5725C 1000BASE-T media interface
 model xxBROADCOM_ALT1 BCM5906	0x0004 BCM5906 10/100baseTX media interface
 
-/* Cicada Semiconductor PHYs (now owned by Vitesse?) */
-model 

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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:38:52 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_bce.c if_bcereg.h

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

sys/dev/pci/if_bce.c: revision 1.55
sys/dev/pci/if_bce.c: revision 1.56
sys/dev/pci/if_bcereg.h: revision 1.5

- Add missing splnet()/splx() around mii_tick(). Same as OpenBSD rev. 1.23
- Use device_printf() instead of aprint_error_dev)() in bce_watchdog().
- Remove unnecessary inclusion.

>From OpenBSD:
 - Mark ETHERCAP_VLAN_MTU.
 - Clear the powerdown mode. Fixes PR kern/24911 reported by Werner Backes.
 - Set proper LED modes.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.2.1 src/sys/dev/pci/if_bce.c
cvs rdiff -u -r1.4 -r1.4.170.1 src/sys/dev/pci/if_bcereg.h

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



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 19:38:52 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_bce.c if_bcereg.h

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

sys/dev/pci/if_bce.c: revision 1.55
sys/dev/pci/if_bce.c: revision 1.56
sys/dev/pci/if_bcereg.h: revision 1.5

- Add missing splnet()/splx() around mii_tick(). Same as OpenBSD rev. 1.23
- Use device_printf() instead of aprint_error_dev)() in bce_watchdog().
- Remove unnecessary inclusion.

>From OpenBSD:
 - Mark ETHERCAP_VLAN_MTU.
 - Clear the powerdown mode. Fixes PR kern/24911 reported by Werner Backes.
 - Set proper LED modes.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.52.2.1 src/sys/dev/pci/if_bce.c
cvs rdiff -u -r1.4 -r1.4.170.1 src/sys/dev/pci/if_bcereg.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_bce.c
diff -u src/sys/dev/pci/if_bce.c:1.52 src/sys/dev/pci/if_bce.c:1.52.2.1
--- src/sys/dev/pci/if_bce.c:1.52	Thu May 30 02:32:18 2019
+++ src/sys/dev/pci/if_bce.c	Wed Oct 23 19:38:52 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bce.c,v 1.52 2019/05/30 02:32:18 msaitoh Exp $	 */
+/* $NetBSD: if_bce.c,v 1.52.2.1 2019/10/23 19:38:52 martin Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.52 2019/05/30 02:32:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.52.2.1 2019/10/23 19:38:52 martin Exp $");
 
 #include "vlan.h"
 
@@ -63,8 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 
@@ -423,6 +421,8 @@ bce_attach(device_t parent, device_t sel
 	ifp->if_stop = bce_stop;
 	IFQ_SET_READY(>if_snd);
 
+	sc->ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
+
 	/* Initialize our media structures and probe the MII. */
 
 	mii->mii_ifp = ifp;
@@ -653,7 +653,7 @@ bce_watchdog(struct ifnet *ifp)
 {
 	struct bce_softc *sc = ifp->if_softc;
 
-	aprint_error_dev(sc->bce_dev, "device timeout\n");
+	device_printf(sc->bce_dev, "device timeout\n");
 	ifp->if_oerrors++;
 
 	(void) bce_init(ifp);
@@ -920,10 +920,15 @@ bce_init(struct ifnet *ifp)
 	sc->bce_txsnext = 0;
 	sc->bce_txin = 0;
 
-	/* enable crc32 generation */
+	/* enable crc32 generation and set proper LED modes */
 	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL,
 	bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL) |
-	BCE_EMC_CG);
+	BCE_EMC_CRC32_ENAB | BCE_EMC_LED);
+
+	/* reset or clear powerdown control bit  */
+	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL,
+	bus_space_read_4(sc->bce_btag, sc->bce_bhandle, BCE_MACCTL) &
+	~BCE_EMC_PDOWN);
 
 	/* setup DMA interrupt control */
 	bus_space_write_4(sc->bce_btag, sc->bce_bhandle, BCE_DMAI_CTL, 1 << 24);	/* MAGIC */
@@ -1476,9 +1481,11 @@ static void
 bce_tick(void *v)
 {
 	struct bce_softc *sc = v;
+	int s;
 
-	/* Tick the MII. */
+	s = splnet();
 	mii_tick(>bce_mii);
+	splx(s);
 
 	callout_reset(>bce_timeout, hz, bce_tick, sc);
 }

Index: src/sys/dev/pci/if_bcereg.h
diff -u src/sys/dev/pci/if_bcereg.h:1.4 src/sys/dev/pci/if_bcereg.h:1.4.170.1
--- src/sys/dev/pci/if_bcereg.h:1.4	Sun Dec 11 12:22:49 2005
+++ src/sys/dev/pci/if_bcereg.h	Wed Oct 23 19:38:52 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bcereg.h,v 1.4 2005/12/11 12:22:49 christos Exp $	 */
+/* $NetBSD: if_bcereg.h,v 1.4.170.1 2019/10/23 19:38:52 martin Exp $	 */
 
 /*
  * Copyright (c) 2003 Clifford Wright. All rights reserved.
@@ -71,7 +71,10 @@
 /* Ethernet MAC Control */
 #define BCE_MACCTL			0x00A8	/* ethernet mac control */
 /* mac control bits */
-#define BCE_EMC_CG			0x0001	/* crc32 generation */
+#define BCE_EMC_CRC32_ENAB		0x0001	/* crc32 generation */
+#define BCE_EMC_PDOWN			0x0004	/* PHY powerdown */
+#define BCE_EMC_EDET			0x0008	/* PHY energy detect */
+#define BCE_EMC_LED			0x00e0	/* PHY LED control */
 
 /* DMA Interrupt control */
 #define BCE_DMAI_CTL			0x0100



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 18:09:18 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by tnn in ticket #358):

sys/dev/pci/ahcisata_pci.c: revision 1.56

ahcisata: make sure bus mastering and memory space are actually enabled
This makes the "ROCKPro64 PCI-e to Dual SATA-II Interface Card" work.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/dev/pci/ahcisata_pci.c

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



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 18:09:18 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by tnn in ticket #358):

sys/dev/pci/ahcisata_pci.c: revision 1.56

ahcisata: make sure bus mastering and memory space are actually enabled
This makes the "ROCKPro64 PCI-e to Dual SATA-II Interface Card" work.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.55.4.1 src/sys/dev/pci/ahcisata_pci.c

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

Modified files:

Index: src/sys/dev/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.55 src/sys/dev/pci/ahcisata_pci.c:1.55.4.1
--- src/sys/dev/pci/ahcisata_pci.c:1.55	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/pci/ahcisata_pci.c	Wed Oct 23 18:09:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.55 2019/01/27 02:08:42 pgoyette Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.55.4.1 2019/10/23 18:09:18 martin Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.55 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.55.4.1 2019/10/23 18:09:18 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ahcisata_pci.h"
@@ -394,6 +394,7 @@ ahci_pci_attach(device_t parent, device_
 	struct ahci_softc *sc = >ah_sc;
 	bool ahci_cap_64bit;
 	bool ahci_bad_64bit;
+	pcireg_t reg;
 
 	sc->sc_atac.atac_dev = self;
 
@@ -447,6 +448,10 @@ ahci_pci_attach(device_t parent, device_
 		AHCIDEBUG_PRINT(("%s: SATA mode\n", AHCINAME(sc)), DEBUG_PROBE);
 	}
 
+	reg = pci_conf_read(psc->sc_pc, psc->sc_pcitag, PCI_COMMAND_STATUS_REG);
+	reg |= (PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE);
+	pci_conf_write(psc->sc_pc, psc->sc_pcitag, PCI_COMMAND_STATUS_REG, reg);
+
 	ahci_attach(sc);
 
 	if (!pmf_device_register(self, NULL, ahci_pci_resume))



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 18:06:46 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-9]: ahcisata_core.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #357):

sys/dev/ic/ahcisata_core.c: revision 1.76

Ensure cmdh_prdtl is 0 in ahci_do_reset_drive().
(I'm probably just being paranoid here.)


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.75.4.1 src/sys/dev/ic/ahcisata_core.c

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

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.75 src/sys/dev/ic/ahcisata_core.c:1.75.4.1
--- src/sys/dev/ic/ahcisata_core.c:1.75	Sun Apr  7 17:46:49 2019
+++ src/sys/dev/ic/ahcisata_core.c	Wed Oct 23 18:06:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.75 2019/04/07 17:46:49 bouyer Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.75.4.1 2019/10/23 18:06:46 martin Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.75 2019/04/07 17:46:49 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.75.4.1 2019/10/23 18:06:46 martin Exp $");
 
 #include 
 #include 
@@ -842,6 +842,7 @@ again:
 	cmd_tbl = achp->ahcic_cmd_tbl[c_slot];
 	cmd_h->cmdh_flags = htole16(AHCI_CMDH_F_RST | AHCI_CMDH_F_CBSY |
 	RHD_FISLEN / 4 | (drive << AHCI_CMDH_F_PMP_SHIFT));
+	cmd_h->cmdh_prdtl = 0;
 	cmd_h->cmdh_prdbc = 0;
 	memset(cmd_tbl->cmdt_cfis, 0, 64);
 	cmd_tbl->cmdt_cfis[fis_type] = RHD_FISTYPE;



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

2019-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Oct 23 18:06:46 UTC 2019

Modified Files:
src/sys/dev/ic [netbsd-9]: ahcisata_core.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #357):

sys/dev/ic/ahcisata_core.c: revision 1.76

Ensure cmdh_prdtl is 0 in ahci_do_reset_drive().
(I'm probably just being paranoid here.)


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.75.4.1 src/sys/dev/ic/ahcisata_core.c

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:09:14 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.214

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.5 -r1.199.2.6 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.



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:09:14 UTC 2019

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

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

sys/dev/pci/ixgbe/ixgbe.c: revision 1.214

Apply FreeBSD r353599:
 > ixgbe: Disable EEE for backplane X550EM_X
 >
 > From Zach:
 > Intel documentation indicates that backplane X550EM_X KR devices do not
 > support Energy Efficient Ethernet. Prior to this patch, X552 devices
 > (device ID 0x15AB) will crash the system when transitioning EEE state
 > via sysctl.
 >
 > Signed-off-by: Zach Vargas 
 >
 > PR:  240320
 > Submitted by:Zach Vargas 
 > Reviewed by: erj@
 > MFC after:   3 days
 > Differential Revision:   https://reviews.freebsd.org/D21673


To generate a diff of this commit:
cvs rdiff -u -r1.199.2.5 -r1.199.2.6 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.199.2.5 src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.6
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.199.2.5	Thu Sep 26 19:07:22 2019
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Oct 17 19:09:14 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.199.2.5 2019/09/26 19:07:22 martin Exp $ */
+/* $NetBSD: ixgbe.c,v 1.199.2.6 2019/10/17 19:09:14 martin Exp $ */
 
 /**
 
@@ -5860,7 +5860,7 @@ ixgbe_sysctl_eee_state(SYSCTLFN_ARGS)
 	if ((new_eee < 0) || (new_eee > 1))
 		return (EINVAL);
 
-	retval = adapter->hw.mac.ops.setup_eee(>hw, new_eee);
+	retval = ixgbe_setup_eee(>hw, new_eee);
 	if (retval) {
 		device_printf(dev, "Error in EEE setup: 0x%08X\n", retval);
 		return (EINVAL);
@@ -6034,8 +6034,6 @@ ixgbe_init_device_features(struct adapte
 		 */
 		adapter->feat_cap |= IXGBE_FEATURE_SRIOV;
 		adapter->feat_cap |= IXGBE_FEATURE_FDIR;
-		if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR)
-			adapter->feat_cap |= IXGBE_FEATURE_EEE;
 		break;
 	case ixgbe_mac_X550EM_a:
 		/*



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:06:58 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ciphy.c rgephy.c

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

sys/dev/mii/ciphy.c: revision 1.35
sys/dev/mii/rgephy.c: revision 1.56
sys/dev/mii/rgephy.c: revision 1.57

Make new rgephy_linkup() function and share it like FreeBSD.
No functional change intended.

- Indicate master mode if the negotiated result say so.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/dev/mii/rgephy.c

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:06:58 UTC 2019

Modified Files:
src/sys/dev/mii [netbsd-9]: ciphy.c rgephy.c

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

sys/dev/mii/ciphy.c: revision 1.35
sys/dev/mii/rgephy.c: revision 1.56
sys/dev/mii/rgephy.c: revision 1.57

Make new rgephy_linkup() function and share it like FreeBSD.
No functional change intended.

- Indicate master mode if the negotiated result say so.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.34.4.1 src/sys/dev/mii/ciphy.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/sys/dev/mii/rgephy.c

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

Modified files:

Index: src/sys/dev/mii/ciphy.c
diff -u src/sys/dev/mii/ciphy.c:1.34 src/sys/dev/mii/ciphy.c:1.34.4.1
--- src/sys/dev/mii/ciphy.c:1.34	Thu Apr 11 09:14:07 2019
+++ src/sys/dev/mii/ciphy.c	Thu Oct 17 19:06:58 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ciphy.c,v 1.34 2019/04/11 09:14:07 msaitoh Exp $ */
+/* $NetBSD: ciphy.c,v 1.34.4.1 2019/10/17 19:06:58 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34 2019/04/11 09:14:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.34.4.1 2019/10/17 19:06:58 martin Exp $");
 
 /*
  * Driver for the Cicada CS8201 10/100/1000 copper PHY.
@@ -297,7 +297,7 @@ static void
 ciphy_status(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
-	uint16_t bmsr, bmcr;
+	uint16_t bmsr, bmcr, gtsr;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
@@ -343,16 +343,19 @@ ciphy_status(struct mii_softc *sc)
 	else
 		mii->mii_media_active |= IFM_HDX;
 
-	return;
+	if (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) {
+		PHY_READ(sc, MII_GTSR, );
+		if ((gtsr & GTSR_MS_RES) != 0)
+			mii->mii_media_active |= IFM_ETH_MASTER;
+	}
 }
 
 static void
 ciphy_reset(struct mii_softc *sc)
 {
+
 	mii_phy_reset(sc);
 	DELAY(1000);
-
-	return;
 }
 
 static inline int
@@ -437,6 +440,4 @@ ciphy_fixup(struct mii_softc *sc)
 		model);
 		break;
 	}
-
-	return;
 }

Index: src/sys/dev/mii/rgephy.c
diff -u src/sys/dev/mii/rgephy.c:1.55 src/sys/dev/mii/rgephy.c:1.55.2.1
--- src/sys/dev/mii/rgephy.c:1.55	Wed Jun  5 17:50:06 2019
+++ src/sys/dev/mii/rgephy.c	Thu Oct 17 19:06:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rgephy.c,v 1.55 2019/06/05 17:50:06 triaxx Exp $	*/
+/*	$NetBSD: rgephy.c,v 1.55.2.1 2019/10/17 19:06:58 martin Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.55 2019/06/05 17:50:06 triaxx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.55.2.1 2019/10/17 19:06:58 martin Exp $");
 
 
 /*
@@ -75,6 +75,7 @@ static int	rgephy_service(struct mii_sof
 static void	rgephy_status(struct mii_softc *);
 static int	rgephy_mii_phy_auto(struct mii_softc *);
 static void	rgephy_reset(struct mii_softc *);
+static bool	rgephy_linkup(struct mii_softc *);
 static void	rgephy_loop(struct mii_softc *);
 static void	rgephy_load_dspcode(struct mii_softc *);
 
@@ -295,26 +296,9 @@ rgephy_service(struct mii_softc *sc, str
 		 * need to restart the autonegotiation process.  Read
 		 * the BMSR twice in case it's latched.
 		 */
-		if (sc->mii_mpd_rev >= RGEPHY_8211F) {
-			/* RTL8211F */
-			PHY_READ(sc, RGEPHY_MII_PHYSR, );
-			if (reg & RGEPHY_PHYSR_LINK) {
-sc->mii_ticks = 0;
-break;
-			}
-		} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
-			/* RTL8211B(L) */
-			PHY_READ(sc, RGEPHY_MII_SSR, );
-			if (reg & RGEPHY_SSR_LINK) {
-sc->mii_ticks = 0;
-break;
-			}
-		} else {
-			PHY_READ(sc, RTK_GMEDIASTAT, );
-			if ((reg & RTK_GMEDIASTAT_LINK) != 0) {
-sc->mii_ticks = 0;
-break;
-			}
+		if (rgephy_linkup(sc)) {
+			sc->mii_ticks = 0;
+			break;
 		}
 
 		/* Announce link loss right after it happens. */
@@ -345,28 +329,40 @@ rgephy_service(struct mii_softc *sc, str
 	return 0;
 }
 
+static bool
+rgephy_linkup(struct mii_softc *sc)
+{
+	bool linkup = false;
+	uint16_t reg;
+
+	if (sc->mii_mpd_rev >= RGEPHY_8211F) {
+		PHY_READ(sc, RGEPHY_MII_PHYSR, );
+		if (reg & RGEPHY_PHYSR_LINK)
+			linkup = true;
+	} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
+		PHY_READ(sc, RGEPHY_MII_SSR, );
+		if (reg & RGEPHY_SSR_LINK)
+			linkup = true;
+	} else {
+		PHY_READ(sc, RTK_GMEDIASTAT, );
+		if ((reg & RTK_GMEDIASTAT_LINK) != 0)
+			linkup = true;
+	}
+
+	return linkup;
+}
+
 static void
 rgephy_status(struct mii_softc *sc)
 {
 	struct mii_data *mii = sc->mii_pdata;
-	uint16_t gstat, bmsr, bmcr, physr, ssr;
+	uint16_t gstat, bmsr, bmcr, gtsr, physr, ssr;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
 
-	if (sc->mii_mpd_rev >= RGEPHY_8211F) {
-		PHY_READ(sc, RGEPHY_MII_PHYSR, );
-		if (physr & RGEPHY_PHYSR_LINK)
-			mii->mii_media_status |= IFM_ACTIVE;
-	} else if (sc->mii_mpd_rev >= RGEPHY_8211B) {
-		

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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:02:55 UTC 2019

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

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

sys/dev/pci/if_et.c: revision 1.27

Fix a bug that multicast address filter doesn't work correctly.
XXX pullup-[789].


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

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 19:02:55 UTC 2019

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

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

sys/dev/pci/if_et.c: revision 1.27

Fix a bug that multicast address filter doesn't work correctly.
XXX pullup-[789].


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

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

Modified files:

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.24.2.1 src/sys/dev/pci/if_et.c:1.24.2.2
--- src/sys/dev/pci/if_et.c:1.24.2.1	Fri Aug  9 16:03:13 2019
+++ src/sys/dev/pci/if_et.c	Thu Oct 17 19:02:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.24.2.1 2019/08/09 16:03:13 martin Exp $	*/
+/*	$NetBSD: if_et.c,v 1.24.2.2 2019/10/17 19:02:54 martin Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.24.2.1 2019/08/09 16:03:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.24.2.2 2019/10/17 19:02:54 martin Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -1304,7 +1304,6 @@ et_setmulti(struct et_softc *sc)
 	uint32_t rxmac_ctrl, pktfilt;
 	struct ether_multi *enm;
 	struct ether_multistep step;
-	uint8_t addr[ETHER_ADDR_LEN];
 	int i, count;
 
 	pktfilt = CSR_READ_4(sc, ET_PKTFILT);
@@ -1316,19 +1315,13 @@ et_setmulti(struct et_softc *sc)
 		goto back;
 	}
 
-	bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN);
-
 	count = 0;
 	ETHER_LOCK(ec);
 	ETHER_FIRST_MULTI(step, ec, enm);
 	while (enm != NULL) {
 		uint32_t *hp, h;
 
-		for (i = 0; i < ETHER_ADDR_LEN; i++) {
-			addr[i] &= enm->enm_addrlo[i];
-		}
-
-		h = ether_crc32_be(addr, ETHER_ADDR_LEN);
+		h = ether_crc32_be(enm->enm_addrlo, ETHER_ADDR_LEN);
 		h = (h & 0x3f80) >> 23;
 
 		hp = [0];



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:58:33 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_vge.c if_vgereg.h

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

sys/dev/pci/if_vgereg.h: revision 1.5
sys/dev/pci/if_vge.c: revision 1.75

Copy vge_clrwol() from FreeBSD and call it in vge_attach() to recover from
powerdown mode. Fixes PR kern/41525 reported by Aran Clauson.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.2.1 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/pci/if_vgereg.h

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:58:33 UTC 2019

Modified Files:
src/sys/dev/pci [netbsd-9]: if_vge.c if_vgereg.h

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

sys/dev/pci/if_vgereg.h: revision 1.5
sys/dev/pci/if_vge.c: revision 1.75

Copy vge_clrwol() from FreeBSD and call it in vge_attach() to recover from
powerdown mode. Fixes PR kern/41525 reported by Aran Clauson.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.73.2.1 src/sys/dev/pci/if_vge.c
cvs rdiff -u -r1.4 -r1.4.2.1 src/sys/dev/pci/if_vgereg.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_vge.c
diff -u src/sys/dev/pci/if_vge.c:1.73 src/sys/dev/pci/if_vge.c:1.73.2.1
--- src/sys/dev/pci/if_vge.c:1.73	Tue Jul  9 08:46:59 2019
+++ src/sys/dev/pci/if_vge.c	Thu Oct 17 18:58:33 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.73 2019/07/09 08:46:59 msaitoh Exp $ */
+/* $NetBSD: if_vge.c,v 1.73.2.1 2019/10/17 18:58:33 martin Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.73 2019/07/09 08:46:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.73.2.1 2019/10/17 18:58:33 martin Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -328,6 +328,7 @@ static void vge_miibus_statchg(struct if
 
 static void vge_cam_clear(struct vge_softc *);
 static int vge_cam_set(struct vge_softc *, uint8_t *);
+static void	vge_clrwol(struct vge_softc *);
 static void vge_setmulti(struct vge_softc *);
 static void vge_reset(struct vge_softc *);
 
@@ -953,6 +954,9 @@ vge_attach(device_t parent, device_t sel
 	aprint_normal_dev(self, "Ethernet address %s\n",
 	ether_sprintf(eaddr));
 
+	/* Clear WOL and take hardware from powerdown. */
+	vge_clrwol(sc);
+
 	/*
 	 * Use the 32bit tag. Hardware supports 48bit physical addresses,
 	 * but we don't use that for now.
@@ -2156,3 +2160,30 @@ vge_shutdown(device_t self, int howto)
 
 	return true;
 }
+
+static void
+vge_clrwol(struct vge_softc *sc)
+{
+	uint8_t val;
+
+	val = CSR_READ_1(sc, VGE_PWRSTAT);
+	val &= ~VGE_STICKHW_SWPTAG;
+	CSR_WRITE_1(sc, VGE_PWRSTAT, val);
+	/* Disable WOL and clear power state indicator. */
+	val = CSR_READ_1(sc, VGE_PWRSTAT);
+	val &= ~(VGE_STICKHW_DS0 | VGE_STICKHW_DS1);
+	CSR_WRITE_1(sc, VGE_PWRSTAT, val);
+
+	CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_GMII);
+	CSR_CLRBIT_1(sc, VGE_DIAGCTL, VGE_DIAGCTL_MACFORCE);
+
+	/* Clear WOL on pattern match. */
+	CSR_WRITE_1(sc, VGE_WOLCR0C, VGE_WOLCR0_PATTERN_ALL);
+	/* Disable WOL on magic/unicast packet. */
+	CSR_WRITE_1(sc, VGE_WOLCR1C, 0x0F);
+	CSR_WRITE_1(sc, VGE_WOLCFGC, VGE_WOLCFG_SAB | VGE_WOLCFG_SAM |
+	VGE_WOLCFG_PMEOVR);
+	/* Clear WOL status on pattern match. */
+	CSR_WRITE_1(sc, VGE_WOLSR0C, 0xFF);
+	CSR_WRITE_1(sc, VGE_WOLSR1C, 0xFF);
+}

Index: src/sys/dev/pci/if_vgereg.h
diff -u src/sys/dev/pci/if_vgereg.h:1.4 src/sys/dev/pci/if_vgereg.h:1.4.2.1
--- src/sys/dev/pci/if_vgereg.h:1.4	Thu Jul 11 03:49:51 2019
+++ src/sys/dev/pci/if_vgereg.h	Thu Oct 17 18:58:33 2019
@@ -540,6 +540,31 @@
 #define VGE_TXBLOCK_128PKTS	0x08
 #define VGE_TXBLOCK_8PKTS	0x0C
 
+/* Sticky bit shadow register */
+
+#define	VGE_STICKHW_DS0		0x01
+#define	VGE_STICKHW_DS1		0x02
+#define	VGE_STICKHW_WOL_ENB	0x04
+#define	VGE_STICKHW_WOL_STS	0x08
+#define	VGE_STICKHW_SWPTAG	0x10
+
+/* WOL pattern control */
+#define	VGE_WOLCR0_PATTERN0	0x01
+#define	VGE_WOLCR0_PATTERN1	0x02
+#define	VGE_WOLCR0_PATTERN2	0x04
+#define	VGE_WOLCR0_PATTERN3	0x08
+#define	VGE_WOLCR0_PATTERN4	0x10
+#define	VGE_WOLCR0_PATTERN5	0x20
+#define	VGE_WOLCR0_PATTERN6	0x40
+#define	VGE_WOLCR0_PATTERN7	0x80
+#define	VGE_WOLCR0_PATTERN_ALL	0xFF
+
+/* WOL config register */
+#define	VGE_WOLCFG_PHYINT_ENB	0x01
+#define	VGE_WOLCFG_SAB		0x10
+#define	VGE_WOLCFG_SAM		0x20
+#define	VGE_WOLCFG_PMEOVR	0x80
+
 /* EEPROM control/status register */
 
 #define VGE_EECSR_EDO		0x01	/* data out pin */



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:53:26 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by bad in ticket #343):

sys/dev/usb/if_ure.c: revision 1.32
sys/dev/usb/if_ure.c: revision 1.33

read mac address of ure version 4c10 from URE_PLA_IDR, save as 4c00.
from ganbold@freebsd r346052.
XXX pullup-9

 -

allocate a random mac address if on-chip mac is all zeroes.
helps ure(4) on NanoPi R1.
partly from ganbold@freebsd r346052.
XXX pullup-9


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

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



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

2019-10-17 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Oct 17 18:53:26 UTC 2019

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

Log Message:
Pull up following revision(s) (requested by bad in ticket #343):

sys/dev/usb/if_ure.c: revision 1.32
sys/dev/usb/if_ure.c: revision 1.33

read mac address of ure version 4c10 from URE_PLA_IDR, save as 4c00.
from ganbold@freebsd r346052.
XXX pullup-9

 -

allocate a random mac address if on-chip mac is all zeroes.
helps ure(4) on NanoPi R1.
partly from ganbold@freebsd r346052.
XXX pullup-9


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

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

Modified files:

Index: src/sys/dev/usb/if_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.14.2.1 src/sys/dev/usb/if_ure.c:1.14.2.2
--- src/sys/dev/usb/if_ure.c:1.14.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_ure.c	Thu Oct 17 18:53:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.14.2.1 2019/09/01 13:00:36 martin Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.14.2.2 2019/10/17 18:53:25 martin Exp $	*/
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.14.2.2 2019/10/17 18:53:25 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -38,6 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1
 #endif
 
 #include 
+#include 
 
 #include 
 
@@ -66,6 +67,9 @@ int	uredebug = 0;
 #define DPRINTFN(n, x)
 #endif
 
+#define ETHER_IS_ZERO(addr) \
+	(!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5]))
+
 static const struct usb_devno ure_devs[] = {
 	{ USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8152 },
 	{ USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8153 }
@@ -848,6 +852,7 @@ ure_attach(device_t parent, device_t sel
 	uint16_t ver;
 	uint8_t eaddr[8]; /* 2byte padded */
 	char *devinfop;
+	uint32_t maclo, machi;
 
 	aprint_naive("\n");
 	aprint_normal("\n");
@@ -941,13 +946,24 @@ ure_attach(device_t parent, device_t sel
 	else
 		ure_rtl8153_init(un);
 
-	if (un->un_flags & URE_FLAG_VER_4C00)
+	if ((un->un_flags & URE_FLAG_VER_4C00) ||
+	(un->un_flags & URE_FLAG_VER_4C10))
 		ure_read_mem(un, URE_PLA_IDR, URE_MCU_TYPE_PLA, eaddr,
 		sizeof(eaddr));
 	else
 		ure_read_mem(un, URE_PLA_BACKUP, URE_MCU_TYPE_PLA, eaddr,
 		sizeof(eaddr));
 	usbnet_unlock(un);
+	if (ETHER_IS_ZERO(eaddr)) {
+		maclo = 0x00f2 | (cprng_strong32() & 0x);
+		machi = cprng_strong32() & 0x;
+		eaddr[0] = maclo & 0xff;
+		eaddr[1] = (maclo >> 8) & 0xff;
+		eaddr[2] = (maclo >> 16) & 0xff;
+		eaddr[3] = (maclo >> 24) & 0xff;
+		eaddr[4] = machi & 0xff;
+		eaddr[5] = (machi >> 8) & 0xff;
+	}
 	memcpy(un->un_eaddr, eaddr, sizeof un->un_eaddr);
 
 	struct ifnet *ifp = usbnet_ifp(un);



  1   2   >