svn commit: r245737 - stable/8/sys/dev/usb/controller

Hans Petter Selasky hselasky at FreeBSD.org
Mon Jan 21 07:41:28 UTC 2013


Author: hselasky
Date: Mon Jan 21 07:41:27 2013
New Revision: 245737
URL: http://svnweb.freebsd.org/changeset/base/245737

Log:
  MFC r245132 and r245175:
  Optimise the XHCI interrupt handling.
  This patch will save CPU time when the XHCI interrupt is
  shared with other devices.
  Only check event rings when interrupt bits are set.
  Otherwise would indicate hiding possible hardware fault(s).
  
  Tested by:    sos @
  Submitted by: sos @

Modified:
  stable/8/sys/dev/usb/controller/xhci.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/controller/xhci.c
==============================================================================
--- stable/8/sys/dev/usb/controller/xhci.c	Mon Jan 21 07:39:16 2013	(r245736)
+++ stable/8/sys/dev/usb/controller/xhci.c	Mon Jan 21 07:41:27 2013	(r245737)
@@ -1440,26 +1440,37 @@ void
 xhci_interrupt(struct xhci_softc *sc)
 {
 	uint32_t status;
-	uint32_t temp;
+	uint32_t iman;
 
 	USB_BUS_LOCK(&sc->sc_bus);
 
 	status = XREAD4(sc, oper, XHCI_USBSTS);
+	if (status == 0)
+		goto done;
 
 	/* acknowledge interrupts */
 
 	XWRITE4(sc, oper, XHCI_USBSTS, status);
 
-	temp = XREAD4(sc, runt, XHCI_IMAN(0));
-
-	/* acknowledge pending event */
-
-	XWRITE4(sc, runt, XHCI_IMAN(0), temp);
+	DPRINTFN(16, "real interrupt (status=0x%08x)\n", status);
+ 
+	if (status & XHCI_STS_EINT) {
+
+		/* acknowledge pending event */
+		iman = XREAD4(sc, runt, XHCI_IMAN(0));
+
+		/* reset interrupt */
+		XWRITE4(sc, runt, XHCI_IMAN(0), iman);
+ 
+		DPRINTFN(16, "real interrupt (iman=0x%08x)\n", iman);
+ 
+		/* check for event(s) */
+		xhci_interrupt_poll(sc);
+	}
 
-	DPRINTFN(16, "real interrupt (sts=0x%08x, "
-	    "iman=0x%08x)\n", status, temp);
+	if (status & (XHCI_STS_PCD | XHCI_STS_HCH |
+	    XHCI_STS_HSE | XHCI_STS_HCE)) {
 
-	if (status != 0) {
 		if (status & XHCI_STS_PCD) {
 			xhci_root_intr(sc);
 		}
@@ -1479,9 +1490,7 @@ xhci_interrupt(struct xhci_softc *sc)
 			   __FUNCTION__);
 		}
 	}
-
-	xhci_interrupt_poll(sc);
-
+done:
 	USB_BUS_UNLOCK(&sc->sc_bus);
 }
 


More information about the svn-src-all mailing list