Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Add some more counters (disabled by default)



details:   https://anonhg.NetBSD.org/src/rev/7fdf2ce39a8e
branches:  trunk
changeset: 783955:7fdf2ce39a8e
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Jan 13 15:21:47 2013 +0000

description:
Add some more counters (disabled by default)

diffstat:

 sys/dev/usb/dwc_otg.c    |  29 +++++++++++++++++++++++++++--
 sys/dev/usb/dwc_otgvar.h |  14 +++++++-------
 2 files changed, 34 insertions(+), 9 deletions(-)

diffs (110 lines):

diff -r 29bed76c98e5 -r 7fdf2ce39a8e sys/dev/usb/dwc_otg.c
--- a/sys/dev/usb/dwc_otg.c     Sun Jan 13 14:46:21 2013 +0000
+++ b/sys/dev/usb/dwc_otg.c     Sun Jan 13 15:21:47 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc_otg.c,v 1.22 2013/01/13 14:46:21 jmcneill Exp $    */
+/*     $NetBSD: dwc_otg.c,v 1.23 2013/01/13 15:21:47 skrll Exp $       */
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc_otg.c,v 1.22 2013/01/13 14:46:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_otg.c,v 1.23 2013/01/13 15:21:47 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -3389,9 +3389,16 @@
        status = DWC_OTG_READ_4(sc, DOTG_GINTSTS);
        DWC_OTG_WRITE_4(sc, DOTG_GINTSTS, status);
 
+       for (size_t i = 0; i < 32; i++) {
+               if (status & (1<<i)) {
+                       DOTG_EVCNT_INCR(sc->sc_ev_intr_bit[i]);
+               }
+       }
+
        KASSERT(mutex_owned(&sc->sc_intr_lock));
        if (status & GINTSTS_USBRST) {
                DPRINTF("GINTSTS_USBRST\n");
+
                /* set correct state */
                sc->sc_flags.status_device_mode = 1;
                sc->sc_flags.status_bus_reset = 0;
@@ -4112,6 +4119,18 @@
        usb_schedsoftintr(&sc->sc_bus);
 }
 
+static const char * const intnames[32] = {
+       "curmod",       "modemis",      "otgint",       "sof",
+       "rxflvl",       "nptxfemp",     "ginnakeff",    "goutnakeff",
+       "ulpickint",    "i2cint",       "erlysusp",     "usbsusp",
+       "usbrst",       "enumdone",     "isooutdrop",   "eopf",
+       "restore_done", "epmis",        "iepint",       "oepint",
+       "incompisoin",  "incomplp",     "fetsusp",      "resetdet",
+       "prtint",       "hchint",       "ptxfemp",      "lpm",
+       "conidstschng", "disconnint",   "sessreqint",   "wkupint"
+};
+
+
 usbd_status
 dwc_otg_init(struct dwc_otg_softc *sc)
 {
@@ -4165,6 +4184,12 @@
            NULL, xname, "xfer pool get");
        evcnt_attach_dynamic(&sc->sc_ev_xferpoolput, EVCNT_TYPE_MISC,
            NULL, xname, "xfer pool put");
+
+       for (size_t i = 0; i < 32; i++) {
+               evcnt_attach_dynamic(&sc->sc_ev_intr_bit[i], EVCNT_TYPE_INTR,
+                   NULL, xname, intnames[i]);
+       }       
+
 #endif
 
        temp = DWC_OTG_READ_4(sc, DOTG_GUSBCFG);
diff -r 29bed76c98e5 -r 7fdf2ce39a8e sys/dev/usb/dwc_otgvar.h
--- a/sys/dev/usb/dwc_otgvar.h  Sun Jan 13 14:46:21 2013 +0000
+++ b/sys/dev/usb/dwc_otgvar.h  Sun Jan 13 15:21:47 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dwc_otgvar.h,v 1.4 2013/01/12 23:26:06 jmcneill Exp $ */
+/*     $NetBSD: dwc_otgvar.h,v 1.5 2013/01/13 15:21:47 skrll Exp $ */
 
 /* $FreeBSD: src/sys/dev/usb/controller/dwc_otg.h,v 1.12 2012/09/27 15:23:38 hselasky Exp $ */
 /*-
@@ -180,7 +180,6 @@
        kmutex_t sc_intr_lock;
 
        void *sc_rhc_si;
-       //void *sc_intr_si;
 
        struct workqueue *sc_wq;
        struct dwc_otg_work sc_timer_work;
@@ -201,19 +200,20 @@
 
        pool_cache_t sc_tdpool;
        pool_cache_t sc_xferpool;
-
+       
 #ifdef DOTG_COUNTERS
-       
+
        struct evcnt sc_ev_intr;
+       struct evcnt sc_ev_intr_bit[32];
+
        struct evcnt sc_ev_soft_intr;
        struct evcnt sc_ev_work;
-       
+
        struct evcnt sc_ev_tdpoolget;
        struct evcnt sc_ev_tdpoolput;
        struct evcnt sc_ev_xferpoolget;
        struct evcnt sc_ev_xferpoolput;
-       
-#endif 
+#endif
 
        /* From FreeBSD softc */
        struct callout sc_timer;



Home | Main Index | Thread Index | Old Index