Module Name:    src
Committed By:   skrll
Date:           Sun Jan 13 15:21:47 UTC 2013

Modified Files:
        src/sys/dev/usb: dwc_otg.c dwc_otgvar.h

Log Message:
Add some more counters (disabled by default)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/usb/dwc_otg.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/dwc_otgvar.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/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.22 src/sys/dev/usb/dwc_otg.c:1.23
--- src/sys/dev/usb/dwc_otg.c:1.22	Sun Jan 13 14:46:21 2013
+++ src/sys/dev/usb/dwc_otg.c	Sun Jan 13 15:21:47 2013
@@ -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 @@ dwc_otg_interrupt(struct dwc_otg_softc *
 	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 @@ dwc_otg_device_done(usbd_xfer_handle xfe
 	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 @@ dwc_otg_init(struct dwc_otg_softc *sc)
 	    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);

Index: src/sys/dev/usb/dwc_otgvar.h
diff -u src/sys/dev/usb/dwc_otgvar.h:1.4 src/sys/dev/usb/dwc_otgvar.h:1.5
--- src/sys/dev/usb/dwc_otgvar.h:1.4	Sat Jan 12 23:26:06 2013
+++ src/sys/dev/usb/dwc_otgvar.h	Sun Jan 13 15:21:47 2013
@@ -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 @@ typedef struct dwc_otg_softc {
 	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 @@ typedef struct dwc_otg_softc {
 
 	pool_cache_t sc_tdpool;
 	pool_cache_t sc_xferpool;
-
-#ifdef DOTG_COUNTERS
 	
+#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;

Reply via email to