Module Name:    src
Committed By:   martin
Date:           Tue Jun 22 05:10:50 UTC 2021

Modified Files:
        src/sys/dev/usb [netbsd-9]: xhci.c xhcireg.h xhcivar.h

Log Message:
Fix pullup #1302 by adapting the changes to this branch
(there was a misunderstanding in the ticket handling)


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.8 -r1.107.2.9 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.13.2.1 -r1.13.2.2 src/sys/dev/usb/xhcireg.h
cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/dev/usb/xhcivar.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.107.2.8 src/sys/dev/usb/xhci.c:1.107.2.9
--- src/sys/dev/usb/xhci.c:1.107.2.8	Mon Jun 21 17:11:46 2021
+++ src/sys/dev/usb/xhci.c	Tue Jun 22 05:10:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.107.2.8 2021/06/21 17:11:46 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.107.2.9 2021/06/22 05:10:50 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.8 2021/06/21 17:11:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.107.2.9 2021/06/22 05:10:50 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -724,7 +724,7 @@ xhci_suspend(device_t self, const pmf_qu
 		if (xs->xs_idx == 0)
 			continue;
 
-		for (dci = XHCI_DCI_SLOT; dci <= XHCI_MAX_DCI; dci++) {
+		for (dci = 0; dci < 32; dci++) {
 			/* Skip if the endpoint is not Running.  */
 			/* XXX What about Busy?  */
 			if (xhci_get_epstate(sc, xs, dci) !=
@@ -951,7 +951,7 @@ xhci_resume(device_t self, const pmf_qua
 	 *
 	 * XXX Hope just zeroing it is good enough!
 	 */
-	xhci_host_dequeue(sc->sc_cr);
+	xhci_host_dequeue(&sc->sc_cr);
 
 	/*
 	 * `7. Write the CRCR with the address and RCS value of the
@@ -959,8 +959,8 @@ xhci_resume(device_t self, const pmf_qua
 	 *     cause the Command Ring to restart at the address
 	 *     specified by the CRCR.'
 	 */
-	xhci_op_write_8(sc, XHCI_CRCR, xhci_ring_trbp(sc->sc_cr, 0) |
-	    sc->sc_cr->xr_cs);
+	xhci_op_write_8(sc, XHCI_CRCR, xhci_ring_trbp(&sc->sc_cr, 0) |
+	    sc->sc_cr.xr_cs);
 
 	/*
 	 * `8. Enable the controller by setting Run/Stop (R/S) =
@@ -1049,7 +1049,7 @@ xhci_resume(device_t self, const pmf_qua
 		if (xs->xs_idx == 0)
 			continue;
 
-		for (dci = XHCI_DCI_SLOT; dci <= XHCI_MAX_DCI; dci++) {
+		for (dci = 0; dci < 32; dci++) {
 			/* Skip if the endpoint is not Running.  */
 			if (xhci_get_epstate(sc, xs, dci) !=
 			    XHCI_EPSTATE_RUNNING)

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.13.2.1 src/sys/dev/usb/xhcireg.h:1.13.2.2
--- src/sys/dev/usb/xhcireg.h:1.13.2.1	Mon Jun 21 17:11:46 2021
+++ src/sys/dev/usb/xhcireg.h	Tue Jun 22 05:10:50 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.13.2.1 2021/06/21 17:11:46 martin Exp $ */
+/* $NetBSD: xhcireg.h,v 1.13.2.2 2021/06/22 05:10:50 martin Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -162,8 +162,31 @@
 #define	 XHCI_PS_PED		0x00000002	/* RW - port enabled / disabled */
 #define	 XHCI_PS_OCA		0x00000008	/* RO - over current active */
 #define	 XHCI_PS_PR		0x00000010	/* RW - port reset */
+#define	 XHCI_PS_PLS_MASK	__BITS(8, 5)
 #define	 XHCI_PS_PLS_GET(x)	(((x) >> 5) & 0xF)	/* RW - port link state */
 #define	 XHCI_PS_PLS_SET(x)	(((x) & 0xF) << 5)	/* RW - port link state */
+
+#define  XHCI_PS_PLS_SETU0	0
+#define  XHCI_PS_PLS_SETU2	2
+#define  XHCI_PS_PLS_SETU3	3
+#define  XHCI_PS_PLS_SETDISC	5
+#define  XHCI_PS_PLS_SETCOMP	10
+#define  XHCI_PS_PLS_SETRESUME	15
+
+#define  XHCI_PS_PLS_U0		0
+#define  XHCI_PS_PLS_U1		1
+#define  XHCI_PS_PLS_U2		2
+#define  XHCI_PS_PLS_U3		3
+#define  XHCI_PS_PLS_DISABLED	4
+#define  XHCI_PS_PLS_RXDETECT	5
+#define  XHCI_PS_PLS_INACTIVE	6
+#define  XHCI_PS_PLS_POLLING	7
+#define  XHCI_PS_PLS_RECOVERY	8
+#define  XHCI_PS_PLS_HOTRESET	9
+#define  XHCI_PS_PLS_COMPLIANCE	10
+#define  XHCI_PS_PLS_TEST	11
+#define  XHCI_PS_PLS_RESUME	15
+
 #define	 XHCI_PS_PP		0x00000200	/* RW - port power */
 #define	 XHCI_PS_SPEED_GET(x)	(((x) >> 10) & 0xF)	/* RO - port speed */
 #define	 XHCI_PS_SPEED_FS	1

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.11.4.1 src/sys/dev/usb/xhcivar.h:1.11.4.2
--- src/sys/dev/usb/xhcivar.h:1.11.4.1	Mon Jun 21 17:11:46 2021
+++ src/sys/dev/usb/xhcivar.h	Tue Jun 22 05:10:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.11.4.1 2021/06/21 17:11:46 martin Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.11.4.2 2021/06/22 05:10:50 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch

Reply via email to