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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 09:59:31 UTC 2024

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

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

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

nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.6 -r1.44.2.7 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.6 src/sys/dev/ic/nvme.c:1.44.2.7
--- src/sys/dev/ic/nvme.c:1.44.2.6	Mon Jun 21 17:25:48 2021
+++ src/sys/dev/ic/nvme.c	Tue Mar 12 09:59:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.44.2.6 2021/06/21 17:25:48 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.44.2.7 2024/03/12 09:59:31 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.6 2021/06/21 17:25:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.7 2024/03/12 09:59:31 martin Exp $");
 
 #include 
 #include 
@@ -552,7 +552,6 @@ nvme_detach(struct nvme_softc *sc, int f
 		return error;
 
 	/* from now on we are committed to detach, following will never fail */
-	sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
 	for (i = 0; i < sc->sc_nq; i++)
 		nvme_q_free(sc, sc->sc_q[i]);
 	kmem_free(sc->sc_q, sizeof(*sc->sc_q) * sc->sc_nq);
@@ -582,6 +581,11 @@ nvme_resume(struct nvme_softc *sc)
 	}
 
 	nvme_q_reset(sc, sc->sc_admin_q);
+	if (sc->sc_intr_establish(sc, NVME_ADMIN_Q, sc->sc_admin_q)) {
+		error = EIO;
+		device_printf(sc->sc_dev, "unable to establish admin q\n");
+		goto disable;
+	}
 
 	error = nvme_enable(sc, ffs(sc->sc_mps) - 1);
 	if (error) {
@@ -643,6 +647,8 @@ nvme_shutdown(struct nvme_softc *sc)
 	if (disabled)
 		goto disable;
 
+	sc->sc_intr_disestablish(sc, NVME_ADMIN_Q);
+
 	cc = nvme_read4(sc, NVME_CC);
 	CLR(cc, NVME_CC_SHN_MASK);
 	SET(cc, NVME_CC_SHN(NVME_CC_SHN_NORMAL));



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

2024-03-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Mar 12 09:59:31 UTC 2024

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

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

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

nvme(4): Disestablish admin q interrupt while suspended.

And re-establish on resume.  Fixes nvmectl(8) after a suspend/resume
cycle on some systems.

Adapted from a patch by mrg@.

PR kern/58025


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

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 15:06:50 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1705):

sys/dev/ic/rtl81x9var.h: revision 1.58
sys/dev/ic/rtl81x9reg.h: revision 1.54
sys/dev/ic/rtl8169.c: revision 1.167
sys/dev/ic/rtl8169.c: revision 1.168

re(4): misc chip revision support changes
 * remove impossible-to-match chip revision cases
 * bring support for modern chips in line with FreeBSD and OpenBSD
  * adds support for RTL8168GU

Addresses PR kern/56312.

- Print chip revision. From OpenBSD.
- Rename RTK_HWREV_8168_SPIN[123] to RTK_HWREV_8168'B'_SPIN[123].
  Same as other *BSDs.
- Rename RTK_HWREV_8168G_SPIN4 to RTK_HWREV_8411B. Same as other *BSDs.
- Add definition of RTK_HWREV_8169_8110SCE.


To generate a diff of this commit:
cvs rdiff -u -r1.159.2.1 -r1.159.2.2 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/dev/ic/rtl81x9reg.h
cvs rdiff -u -r1.56.18.1 -r1.56.18.2 src/sys/dev/ic/rtl81x9var.h

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

Modified files:

Index: src/sys/dev/ic/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.159.2.1 src/sys/dev/ic/rtl8169.c:1.159.2.2
--- src/sys/dev/ic/rtl8169.c:1.159.2.1	Tue Jan 28 11:12:30 2020
+++ src/sys/dev/ic/rtl8169.c	Fri Aug  4 15:06:50 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.159.2.1 2020/01/28 11:12:30 martin Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.159.2.2 2023/08/04 15:06:50 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.159.2.1 2020/01/28 11:12:30 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.159.2.2 2023/08/04 15:06:50 martin Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -172,6 +172,54 @@ static void re_miibus_statchg(struct ifn
 
 static void re_reset(struct rtk_softc *);
 
+static const struct re_revision {
+	uint32_t		re_chipid;
+	const char		*re_name;
+} re_revisions[] = {
+	{ RTK_HWREV_8100,	"RTL8100" },
+	{ RTK_HWREV_8100E,	"RTL8100E" },
+	{ RTK_HWREV_8100E_SPIN2, "RTL8100E 2" },
+	{ RTK_HWREV_8101,	"RTL8101" },
+	{ RTK_HWREV_8101E,	"RTL8101E" },
+	{ RTK_HWREV_8102E,	"RTL8102E" },
+	{ RTK_HWREV_8106E,	"RTL8106E" },
+	{ RTK_HWREV_8401E,	"RTL8401E" },
+	{ RTK_HWREV_8402,	"RTL8402" },
+	{ RTK_HWREV_8411,	"RTL8411" },
+	{ RTK_HWREV_8411B,	"RTL8411B" },
+	{ RTK_HWREV_8102EL,	"RTL8102EL" },
+	{ RTK_HWREV_8102EL_SPIN1, "RTL8102EL 1" },
+	{ RTK_HWREV_8103E,   "RTL8103E" },
+	{ RTK_HWREV_8110S,	"RTL8110S" },
+	{ RTK_HWREV_8139CPLUS,	"RTL8139C+" },
+	{ RTK_HWREV_8168B_SPIN1, "RTL8168 1" },
+	{ RTK_HWREV_8168B_SPIN2, "RTL8168 2" },
+	{ RTK_HWREV_8168B_SPIN3, "RTL8168 3" },
+	{ RTK_HWREV_8168C,	"RTL8168C/8111C" },
+	{ RTK_HWREV_8168C_SPIN2, "RTL8168C/8111C" },
+	{ RTK_HWREV_8168CP,	"RTL8168CP/8111CP" },
+	{ RTK_HWREV_8168F,	"RTL8168F/8111F" },
+	{ RTK_HWREV_8168G,	"RTL8168G/8111G" },
+	{ RTK_HWREV_8168GU,	"RTL8168GU/8111GU" },
+	{ RTK_HWREV_8168H,	"RTL8168H/8111H" },
+	{ RTK_HWREV_8105E,	"RTL8105E" },
+	{ RTK_HWREV_8105E_SPIN1, "RTL8105E" },
+	{ RTK_HWREV_8168D,	"RTL8168D/8111D" },
+	{ RTK_HWREV_8168DP,	"RTL8168DP/8111DP" },
+	{ RTK_HWREV_8168E,	"RTL8168E/8111E" },
+	{ RTK_HWREV_8168E_VL,	"RTL8168E/8111E-VL" },
+	{ RTK_HWREV_8168EP,	"RTL8168EP/8111EP" },
+	{ RTK_HWREV_8168FP,	"RTL8168FP/8117" },
+	{ RTK_HWREV_8169,	"RTL8169" },
+	{ RTK_HWREV_8169_8110SB, "RTL8169/8110SB" },
+	{ RTK_HWREV_8169_8110SBL, "RTL8169SBL" },
+	{ RTK_HWREV_8169_8110SC, "RTL8169/8110SCd" },
+	{ RTK_HWREV_8169_8110SCE, "RTL8169/8110SCe" },
+	{ RTK_HWREV_8169S,	"RTL8169S" },
+
+	{ 0, NULL }
+};
+
 static inline void
 re_set_bufaddr(struct re_desc *d, bus_addr_t addr)
 {
@@ -562,13 +610,26 @@ re_attach(struct rtk_softc *sc)
 	struct ifnet *ifp;
 	struct mii_data *mii = >mii;
 	int error = 0, i;
+	const struct re_revision *rr;
+	const char *re_name = NULL;
 
 	if ((sc->sc_quirk & RTKQ_8139CPLUS) == 0) {
-		uint32_t hwrev;
-
 		/* Revision of 8169/8169S/8110s in bits 30..26, 23 */
-		hwrev = CSR_READ_4(sc, RTK_TXCFG) & RTK_TXCFG_HWREV;
-		switch (hwrev) {
+		sc->sc_hwrev = CSR_READ_4(sc, RTK_TXCFG) & RTK_TXCFG_HWREV;
+
+		for (rr = re_revisions; rr->re_name != NULL; rr++) {
+			if (rr->re_chipid == sc->sc_hwrev)
+re_name = rr->re_name;
+		}
+
+		if (re_name == NULL)
+			aprint_normal_dev(sc->sc_dev,
+			"unknown ASIC (0x%04x)\n", sc->sc_hwrev >> 16);
+		else
+			aprint_normal_dev(sc->sc_dev,
+			"%s (0x%04x)\n", re_name, sc->sc_hwrev >> 16);
+
+		switch (sc->sc_hwrev) {
 		case RTK_HWREV_8169:
 			sc->sc_quirk |= RTKQ_8169NONS;
 			break;
@@ -579,9 +640,9 @@ re_attach(struct rtk_softc *sc)
 		case RTK_HWREV_8169_8110SC:
 			sc->sc_quirk |= RTKQ_MACLDPS;
 			break;
-		case RTK_HWREV_8168_SPIN1:
-		case RTK_HWREV_8168_SPIN2:
-		case 

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

2023-08-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  4 15:06:50 UTC 2023

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

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1705):

sys/dev/ic/rtl81x9var.h: revision 1.58
sys/dev/ic/rtl81x9reg.h: revision 1.54
sys/dev/ic/rtl8169.c: revision 1.167
sys/dev/ic/rtl8169.c: revision 1.168

re(4): misc chip revision support changes
 * remove impossible-to-match chip revision cases
 * bring support for modern chips in line with FreeBSD and OpenBSD
  * adds support for RTL8168GU

Addresses PR kern/56312.

- Print chip revision. From OpenBSD.
- Rename RTK_HWREV_8168_SPIN[123] to RTK_HWREV_8168'B'_SPIN[123].
  Same as other *BSDs.
- Rename RTK_HWREV_8168G_SPIN4 to RTK_HWREV_8411B. Same as other *BSDs.
- Add definition of RTK_HWREV_8169_8110SCE.


To generate a diff of this commit:
cvs rdiff -u -r1.159.2.1 -r1.159.2.2 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.50.4.1 -r1.50.4.2 src/sys/dev/ic/rtl81x9reg.h
cvs rdiff -u -r1.56.18.1 -r1.56.18.2 src/sys/dev/ic/rtl81x9var.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

2022-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 12 15:12:29 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1499):

sys/dev/ic/dwc_gmac.c: revision 1.76-1.77

Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS
bytes.
ether_input() can now trust M_HASFCS to accurately represent the packet
contents.

Discussed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/dev/ic/dwc_gmac.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/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.64.2.1 src/sys/dev/ic/dwc_gmac.c:1.64.2.2
--- src/sys/dev/ic/dwc_gmac.c:1.64.2.1	Tue Aug 11 17:14:21 2020
+++ src/sys/dev/ic/dwc_gmac.c	Fri Aug 12 15:12:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.64.2.1 2020/08/11 17:14:21 martin Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.64.2.2 2022/08/12 15:12:29 martin Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.64.2.1 2020/08/11 17:14:21 martin Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.64.2.2 2022/08/12 15:12:29 martin Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -812,7 +812,6 @@ dwc_gmac_miibus_statchg(struct ifnet *if
 	conf |= AWIN_GMAC_MAC_CONF_FRAMEBURST
 	| AWIN_GMAC_MAC_CONF_DISABLERXOWN
 	| AWIN_GMAC_MAC_CONF_DISABLEJABBER
-	| AWIN_GMAC_MAC_CONF_ACS
 	| AWIN_GMAC_MAC_CONF_RXENABLE
 	| AWIN_GMAC_MAC_CONF_TXENABLE;
 	switch (IFM_SUBTYPE(mii->mii_media_active)) {



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

2022-08-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug 12 15:12:29 UTC 2022

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

Log Message:
Pull up following revision(s) (requested by sekiya in ticket #1499):

sys/dev/ic/dwc_gmac.c: revision 1.76-1.77

Turn off AWIN_GMAC_MAC_CONF_ACS, so that all received packets retain FCS
bytes.
ether_input() can now trust M_HASFCS to accurately represent the packet
contents.

Discussed on tech-net@


To generate a diff of this commit:
cvs rdiff -u -r1.64.2.1 -r1.64.2.2 src/sys/dev/ic/dwc_gmac.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/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/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/ic

2019-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 26 19:13:14 UTC 2019

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

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

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

nvme(4): Don't attach the device, if namespace not found.


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.1 -r1.44.2.2 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.1 src/sys/dev/ic/nvme.c:1.44.2.2
--- src/sys/dev/ic/nvme.c:1.44.2.1	Sun Sep 22 12:18:56 2019
+++ src/sys/dev/ic/nvme.c	Thu Sep 26 19:13:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.44.2.1 2019/09/22 12:18:56 martin Exp $	*/
+/*	$NetBSD: nvme.c,v 1.44.2.2 2019/09/26 19:13:14 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.1 2019/09/22 12:18:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.2 2019/09/26 19:13:14 martin Exp $");
 
 #include 
 #include 
@@ -399,6 +399,10 @@ nvme_attach(struct nvme_softc *sc)
 		aprint_error_dev(sc->sc_dev, "unable to identify controller\n");
 		goto disable;
 	}
+	if (sc->sc_nn == 0) {
+		aprint_error_dev(sc->sc_dev, "namespace not found\n");
+		goto disable;
+	}
 
 	/* we know how big things are now */
 	sc->sc_max_sgl = sc->sc_mdts / sc->sc_mps;



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

2019-09-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Sep 26 19:13:14 UTC 2019

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

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

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

nvme(4): Don't attach the device, if namespace not found.


To generate a diff of this commit:
cvs rdiff -u -r1.44.2.1 -r1.44.2.2 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-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 22 12:18:56 UTC 2019

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

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

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

Don't set Phase Tag bit of Completion Queue entry at nvme_poll_done().

A new completion queue entry check incorrectly determined that there was
a Completion Queue entry for a command that was not submitted.

Fix PR kern/54275, PR kern/54503, PR kern/54532.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 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-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 22 12:18:56 UTC 2019

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

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

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

Don't set Phase Tag bit of Completion Queue entry at nvme_poll_done().

A new completion queue entry check incorrectly determined that there was
a Completion Queue entry for a command that was not submitted.

Fix PR kern/54275, PR kern/54503, PR kern/54532.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 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 src/sys/dev/ic/nvme.c:1.44.2.1
--- src/sys/dev/ic/nvme.c:1.44	Fri Jun 28 15:08:47 2019
+++ src/sys/dev/ic/nvme.c	Sun Sep 22 12:18:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.44 2019/06/28 15:08:47 jmcneill Exp $	*/
+/*	$NetBSD: nvme.c,v 1.44.2.1 2019/09/22 12:18:56 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 2019/06/28 15:08:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44.2.1 2019/09/22 12:18:56 martin Exp $");
 
 #include 
 #include 
@@ -1302,8 +1302,8 @@ nvme_poll_done(struct nvme_queue *q, str
 {
 	struct nvme_poll_state *state = ccb->ccb_cookie;
 
-	SET(cqe->flags, htole16(NVME_CQE_PHASE));
 	state->c = *cqe;
+	SET(state->c.flags, htole16(NVME_CQE_PHASE));
 
 	ccb->ccb_cookie = state->cookie;
 	state->done(q, ccb, >c);



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

2019-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 22 12:13:33 UTC 2019

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

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

sys/dev/ic/i82557.c: revision 1.155

Fix direction of the loop.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/dev/ic/i82557.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-09-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Sep 22 12:13:33 UTC 2019

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

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

sys/dev/ic/i82557.c: revision 1.155

Fix direction of the loop.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/dev/ic/i82557.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/i82557.c
diff -u src/sys/dev/ic/i82557.c:1.154 src/sys/dev/ic/i82557.c:1.154.2.1
--- src/sys/dev/ic/i82557.c:1.154	Tue Jul  9 08:46:58 2019
+++ src/sys/dev/ic/i82557.c	Sun Sep 22 12:13:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82557.c,v 1.154 2019/07/09 08:46:58 msaitoh Exp $	*/
+/*	$NetBSD: i82557.c,v 1.154.2.1 2019/09/22 12:13:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.154 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.154.2.1 2019/09/22 12:13:33 martin Exp $");
 
 #include 
 #include 
@@ -1892,7 +1892,7 @@ fxp_init(struct ifnet *ifp)
 	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->sc_cddma + FXP_CDIASOFF);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 	/* ...and wait for it to complete. */
-	for (i = 1000; i > 0; i++) {
+	for (i = 1000; i > 0; i--) {
 		FXP_CDIASSYNC(sc,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 		status = le16toh(cb_ias->cb_status);