svn commit: r245175 - head/sys/dev/usb/controller

Hans Petter Selasky hselasky at FreeBSD.org
Tue Jan 8 19:38:57 UTC 2013


Author: hselasky
Date: Tue Jan  8 19:38:57 2013
New Revision: 245175
URL: http://svnweb.freebsd.org/changeset/base/245175

Log:
  Shave off another register write to save some more
  microseconds of PCI access time.
  
  Tested by:	sos @
  Submitted by:	sos @
  MFC after:	1 week

Modified:
  head/sys/dev/usb/controller/xhci.c

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c	Tue Jan  8 19:16:28 2013	(r245174)
+++ head/sys/dev/usb/controller/xhci.c	Tue Jan  8 19:38:57 2013	(r245175)
@@ -1440,24 +1440,33 @@ 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 (sts=0x%08x, "
-	    "iman=0x%08x)\n", status, 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);
+	}
 
 	if (status & (XHCI_STS_PCD | XHCI_STS_HCH |
 	    XHCI_STS_HSE | XHCI_STS_HCE)) {
@@ -1481,11 +1490,7 @@ xhci_interrupt(struct xhci_softc *sc)
 			   __FUNCTION__);
 		}
 	}
-
-	/* check if we need to check the event rings */
-	if ((status != 0) || (temp & XHCI_IMAN_INTR_PEND))
-		xhci_interrupt_poll(sc);
-
+done:
 	USB_BUS_UNLOCK(&sc->sc_bus);
 }
 


More information about the svn-src-head mailing list