diff options
author | jhb <jhb@FreeBSD.org> | 2008-07-30 19:16:53 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-07-30 19:16:53 +0000 |
commit | f6a13d47bfca8b170f40ba6b001fbe350fde3360 (patch) | |
tree | d0e13f8249a0b01f901b0469fb89b3f095e275d7 /sys/dev | |
parent | 95fe9af01ee322d9b50b26c9d1f614e4d03da069 (diff) | |
download | FreeBSD-src-f6a13d47bfca8b170f40ba6b001fbe350fde3360.zip FreeBSD-src-f6a13d47bfca8b170f40ba6b001fbe350fde3360.tar.gz |
Use single byte read and write operations to toggle the BIOS and OS
semaphores rather than 4 byte operations.
MFC after: 1 month
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/usb/ehci_pci.c | 23 | ||||
-rw-r--r-- | sys/dev/usb/ehcireg.h | 5 |
2 files changed, 14 insertions, 14 deletions
diff --git a/sys/dev/usb/ehci_pci.c b/sys/dev/usb/ehci_pci.c index 37a56c4..d9a42d0 100644 --- a/sys/dev/usb/ehci_pci.c +++ b/sys/dev/usb/ehci_pci.c @@ -549,7 +549,8 @@ static void ehci_pci_takecontroller(device_t self) { ehci_softc_t *sc = device_get_softc(self); - u_int32_t cparams, eec, legsup; + u_int32_t cparams, eec; + uint8_t bios_sem; int eecp, i; cparams = EREAD4(sc, EHCI_HCCPARAMS); @@ -560,19 +561,20 @@ ehci_pci_takecontroller(device_t self) eec = pci_read_config(self, eecp, 4); if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) continue; - legsup = eec; - if (legsup & EHCI_LEGSUP_BIOSOWNED) { - pci_write_config(self, eecp, - legsup | EHCI_LEGSUP_OSOWNED, 4); + bios_sem = pci_read_config(self, eecp + EHCI_LEGSUP_BIOS_SEM, + 1); + if (bios_sem) { + pci_write_config(self, eecp + EHCI_LEGSUP_OS_SEM, 1, 1); printf("%s: waiting for BIOS to give up control\n", device_get_nameunit(sc->sc_bus.bdev)); for (i = 0; i < 5000; i++) { - legsup = pci_read_config(self, eecp, 4); - if ((legsup & EHCI_LEGSUP_BIOSOWNED) == 0) + bios_sem = pci_read_config(self, eecp + + EHCI_LEGSUP_BIOS_SEM, 1); + if (bios_sem == 0) break; DELAY(1000); } - if (legsup & EHCI_LEGSUP_BIOSOWNED) + if (bios_sem) printf("%s: timed out waiting for BIOS\n", device_get_nameunit(sc->sc_bus.bdev)); } @@ -584,7 +586,7 @@ ehci_pci_givecontroller(device_t self) { #if 0 ehci_softc_t *sc = device_get_softc(self); - u_int32_t cparams, eec, legsup; + u_int32_t cparams, eec; int eecp; cparams = EREAD4(sc, EHCI_HCCPARAMS); @@ -593,8 +595,7 @@ ehci_pci_givecontroller(device_t self) eec = pci_read_config(self, eecp, 4); if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) continue; - legsup = eec; - pci_write_config(self, eecp, legsup & ~EHCI_LEGSUP_OSOWNED, 4); + pci_write_config(self, eecp + EHCI_LEGSUP_OS_SEM, 0, 1); } #endif } diff --git a/sys/dev/usb/ehcireg.h b/sys/dev/usb/ehcireg.h index e918273..8f2942e 100644 --- a/sys/dev/usb/ehcireg.h +++ b/sys/dev/usb/ehcireg.h @@ -71,9 +71,8 @@ #define EHCI_EECP_ID(x) ((x) & 0xff) /* Legacy support extended capability */ -#define EHCI_LEGSUP_LEGSUP 0x01 -#define EHCI_LEGSUP_OSOWNED 0x01000000 /* OS owned semaphore */ -#define EHCI_LEGSUP_BIOSOWNED 0x00010000 /* BIOS owned semaphore */ +#define EHCI_LEGSUP_OS_SEM 0x03 /* OS owned semaphore */ +#define EHCI_LEGSUP_BIOS_SEM 0x02 /* BIOS owned semaphore */ #define EHCI_LEGSUP_USBLEGCTLSTS 0x04 /*** EHCI capability registers ***/ |