Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Aug 2010 15:48:38 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 181868 for review
Message-ID:  <201008051548.o75Fmc4g006117@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@181868?ac=10

Change 181868 by hselasky@hselasky_laptop001 on 2010/08/05 15:48:33

	USB controller (XHCI):
		- make vendor ID string nicer
		- correct extended capabilities scan loop

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/controller/xhci_pci.c#7 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/controller/xhci_pci.c#7 (text+ko) ====

@@ -198,7 +198,7 @@
 	}
 	device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
 
-	sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self));
+	sprintf(sc->sc_vendor, "0x%04x", pci_get_vendor(self));
 
 #if (__FreeBSD_version >= 700031)
 	err = bus_setup_intr(self, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
@@ -276,31 +276,34 @@
 {
 	struct xhci_softc *sc = device_get_softc(self);
 	uint32_t cparams;
+	uint32_t eecp;
 	uint32_t eec;
 	uint16_t to;
-	uint8_t eecp;
 	uint8_t bios_sem;
 
 	cparams = XREAD4(sc, capa, XHCI_HCSPARAMS0);
 
+	eec = -1;
+
 	/* Synchronise with the BIOS if it owns the controller. */
-	for (eecp = XHCI_HCS0_XECP(cparams); eecp != 0;
-	    eecp = XHCI_XECP_NEXT(eec)) {
-		eec = pci_read_config(self, eecp, 4);
+	for (eecp = XHCI_HCS0_XECP(cparams) << 2; eecp != 0 && XHCI_XECP_NEXT(eec);
+	    eecp += XHCI_XECP_NEXT(eec) << 2) {
+		eec = XREAD4(sc, capa, eecp);
+
 		if (XHCI_XECP_ID(eec) != XHCI_ID_USB_LEGACY)
 			continue;
-		bios_sem = pci_read_config(self, eecp +
-		    XHCI_XECP_BIOS_SEM, 1);
+		bios_sem = XREAD1(sc, capa, eecp +
+		    XHCI_XECP_BIOS_SEM);
 		if (bios_sem == 0)
 			continue;
 		device_printf(sc->sc_bus.bdev, "waiting for BIOS "
 		    "to give up control\n");
-		pci_write_config(self, eecp +
-		    XHCI_XECP_OS_SEM, 1, 1);
+		XWRITE1(sc, capa, eecp +
+		    XHCI_XECP_OS_SEM, 1);
 		to = 500;
 		while (1) {
-			bios_sem = pci_read_config(self, eecp +
-			    XHCI_XECP_BIOS_SEM, 1);
+			bios_sem = XREAD1(sc, capa, eecp +
+			    XHCI_XECP_BIOS_SEM);
 			if (bios_sem == 0)
 				break;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008051548.o75Fmc4g006117>