Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Read xHCI 1.1's HCCPARAMS2 registar and print it...



details:   https://anonhg.NetBSD.org/src/rev/f3b5946b1669
branches:  trunk
changeset: 320773:f3b5946b1669
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jul 18 10:44:17 2018 +0000

description:
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>

diffstat:

 sys/dev/usb/xhci.c    |  23 ++++++++++++++++++++---
 sys/dev/usb/xhcireg.h |  12 +++++++++++-
 2 files changed, 31 insertions(+), 4 deletions(-)

diffs (91 lines):

diff -r 526b5208fbd3 -r f3b5946b1669 sys/dev/usb/xhci.c
--- a/sys/dev/usb/xhci.c        Wed Jul 18 07:06:40 2018 +0000
+++ b/sys/dev/usb/xhci.c        Wed Jul 18 10:44:17 2018 +0000
@@ -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 @@
        "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 @@
 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 @@
                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(
diff -r 526b5208fbd3 -r f3b5946b1669 sys/dev/usb/xhcireg.h
--- a/sys/dev/usb/xhcireg.h     Wed Jul 18 07:06:40 2018 +0000
+++ b/sys/dev/usb/xhcireg.h     Wed Jul 18 10:44:17 2018 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index