Deleted Added
full compact
39c39
< __FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci_pci.c 198500 2009-10-26 20:23:15Z thompsa $");
---
> __FBSDID("$FreeBSD: head/sys/dev/usb/controller/ehci_pci.c 198501 2009-10-26 21:47:16Z thompsa $");
104a105,106
> static void ehci_pci_takecontroller(device_t self);
>
129a132
> ehci_pci_takecontroller(self);
413a417
> ehci_pci_takecontroller(self);
504a509,553
> static void
> ehci_pci_takecontroller(device_t self)
> {
> ehci_softc_t *sc = device_get_softc(self);
> uint32_t cparams;
> uint32_t eec;
> uint16_t to;
> uint8_t eecp;
> uint8_t bios_sem;
>
> cparams = EREAD4(sc, EHCI_HCCPARAMS);
>
> /* Synchronise with the BIOS if it owns the controller. */
> for (eecp = EHCI_HCC_EECP(cparams); eecp != 0;
> eecp = EHCI_EECP_NEXT(eec)) {
> eec = pci_read_config(self, eecp, 4);
> if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) {
> continue;
> }
> bios_sem = pci_read_config(self, eecp +
> EHCI_LEGSUP_BIOS_SEM, 1);
> if (bios_sem == 0) {
> continue;
> }
> device_printf(sc->sc_bus.bdev, "waiting for BIOS "
> "to give up control\n");
> pci_write_config(self, eecp +
> EHCI_LEGSUP_OS_SEM, 1, 1);
> to = 500;
> while (1) {
> bios_sem = pci_read_config(self, eecp +
> EHCI_LEGSUP_BIOS_SEM, 1);
> if (bios_sem == 0)
> break;
>
> if (--to == 0) {
> device_printf(sc->sc_bus.bdev,
> "timed out waiting for BIOS\n");
> break;
> }
> usb_pause_mtx(NULL, hz / 100); /* wait 10ms */
> }
> }
> }
>