Module Name:    src
Committed By:   msaitoh
Date:           Wed Jul 18 10:44:17 UTC 2018

Modified Files:
        src/sys/dev/usb: xhci.c xhcireg.h

Log Message:
 Read xHCI 1.1's HCCPARAMS2 registar and print it with aprint_debug_dev().
e.g.: xhci0: hcc2=0x7d<ETC,CIC,LEC,CTC,FSC,U3C>


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/xhcireg.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.94 src/sys/dev/usb/xhci.c:1.95
--- src/sys/dev/usb/xhci.c:1.94	Mon Jul 16 23:07:31 2018
+++ src/sys/dev/usb/xhci.c	Wed Jul 18 10:44:17 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.94 2018/07/16 23:07:31 christos Exp $	*/
+/*	$NetBSD: xhci.c,v 1.95 2018/07/18 10:44:17 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.94 2018/07/16 23:07:31 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.95 2018/07/18 10:44:17 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -879,6 +879,18 @@ xhci_ecp(struct xhci_softc *sc, uint32_t
 	"b\0AC64\0"						\
 	"\0"
 
+#define XHCI_HCC2_BITS	\
+	"\177\020"	/* New bitmask */			\
+	"b\7ETC_TSC\0"						\
+	"b\6ETC\0"						\
+	"b\5CIC\0"						\
+	"b\4LEC\0"						\
+	"b\3CTC\0"						\
+	"b\2FSC\0"						\
+	"b\1CMC\0"						\
+	"b\0U3C\0"						\
+	"\0"
+
 void
 xhci_start(struct xhci_softc *sc)
 {
@@ -900,7 +912,7 @@ int
 xhci_init(struct xhci_softc *sc)
 {
 	bus_size_t bsz;
-	uint32_t cap, hcs1, hcs2, hcs3, hcc, dboff, rtsoff;
+	uint32_t cap, hcs1, hcs2, hcs3, hcc, dboff, rtsoff, hcc2;
 	uint32_t pagesize, config;
 	int i = 0;
 	uint16_t hciversion;
@@ -961,6 +973,11 @@ xhci_init(struct xhci_softc *sc)
 		snprintb(sbuf, sizeof(sbuf), XHCI_HCCV1_x_BITS, hcc);
 	aprint_debug_dev(sc->sc_dev, "hcc=%s\n", sbuf);
 	aprint_debug_dev(sc->sc_dev, "xECP %x\n", XHCI_HCC_XECP(hcc) * 4);
+	if (hciversion >= XHCI_HCIVERSION_1_1) {
+		hcc2 = xhci_cap_read_4(sc, XHCI_HCCPARAMS2);
+		snprintb(sbuf, sizeof(sbuf), XHCI_HCC2_BITS, hcc2);
+		aprint_debug_dev(sc->sc_dev, "hcc2=%s\n", sbuf);
+	}
 
 	/* default all ports to bus 0, i.e. usb 3 */
 	sc->sc_ctlrportbus = kmem_zalloc(

Index: src/sys/dev/usb/xhcireg.h
diff -u src/sys/dev/usb/xhcireg.h:1.11 src/sys/dev/usb/xhcireg.h:1.12
--- src/sys/dev/usb/xhcireg.h:1.11	Fri Jun 29 17:48:24 2018
+++ src/sys/dev/usb/xhcireg.h	Wed Jul 18 10:44:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: xhcireg.h,v 1.11 2018/06/29 17:48:24 msaitoh Exp $ */
+/* $NetBSD: xhcireg.h,v 1.12 2018/07/18 10:44:17 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -51,6 +51,7 @@
 #define	 XHCI_HCIVERSION_0_9	0x0090	/* xHCI version 0.9 */
 #define	 XHCI_HCIVERSION_0_96	0x0096	/* xHCI version 0.96 */
 #define	 XHCI_HCIVERSION_1_0	0x0100	/* xHCI version 1.0 */
+#define	 XHCI_HCIVERSION_1_1	0x0110	/* xHCI version 1.1 */
 
 #define	XHCI_HCSPARAMS1		0x04	/* RO structual parameters 1 */
 #define	 XHCI_HCS1_MAXSLOTS(x)	((x) & 0xFF)
@@ -89,6 +90,15 @@
 
 #define	 XHCI_DBOFF		0x14	/* RO doorbell offset */
 #define	 XHCI_RTSOFF		0x18	/* RO runtime register space offset */
+#define XHCI_HCCPARAMS2	0x1c	/* RO capability parameters 2 */
+#define	 XHCI_HCC2_U3C(x)	(((x) >> 0) & 0x1)	/* U3 Entry capable */
+#define	 XHCI_HCC2_CMC(x)	(((x) >> 1) & 0x1)	/* CEC MaxExLatTooLg */
+#define	 XHCI_HCC2_FSC(x)	(((x) >> 2) & 0x1)	/* Foce Save Context */
+#define	 XHCI_HCC2_CTC(x)	(((x) >> 3) & 0x1)	/* Compliance Transc */
+#define	 XHCI_HCC2_LEC(x)	(((x) >> 4) & 0x1)	/* Large ESIT Paylod */
+#define	 XHCI_HCC2_CIC(x)	(((x) >> 5) & 0x1)	/* Configuration Inf */
+#define	 XHCI_HCC2_ETC(x)	(((x) >> 6) & 0x1)	/* Extended TBC */
+#define	 XHCI_HCC2_ETC_TSC(x)	(((x) >> 7) & 0x1)	/* ExtTBC TRB Status */
 
 /* XHCI operational registers.  Offset given by XHCI_CAPLENGTH register */
 #define	XHCI_USBCMD		0x00	/* XHCI command */

Reply via email to