- Don't mess with TX queue in fwohci_stop() if we failed to attach the device.

Tested by: wilko

- Detect memory mapping failure of registers by checking OHCI version.

Tested by: KONDOU, Kazuhiro <kazuhiro@alib.jp>
This commit is contained in:
Hidetoshi Shimokawa 2003-08-04 05:43:02 +00:00
parent 30c1156451
commit 183498934b
2 changed files with 14 additions and 7 deletions

View File

@ -584,6 +584,11 @@ fwohci_init(struct fwohci_softc *sc, device_t dev)
device_printf(dev, "OHCI version %x.%x (ROM=%d)\n",
(reg>>16) & 0xff, reg & 0xff, (reg>>24) & 1);
if (((reg>>16) & 0xff) < 1) {
device_printf(dev, "invalid OHCI version\n");
return (ENXIO);
}
/* Available Isochrounous DMA channel probe */
OWRITE(sc, OHCI_IT_MASK, 0xffffffff);
OWRITE(sc, OHCI_IR_MASK, 0xffffffff);
@ -1690,7 +1695,8 @@ fwohci_stop(struct fwohci_softc *sc, device_t dev)
| OHCI_INT_DMA_ARRQ | OHCI_INT_DMA_ARRS
| OHCI_INT_PHY_BUS_R);
fw_drain_txq(&sc->fc);
if (sc->fc.arq !=0 && sc->fc.arq->maxq > 0)
fw_drain_txq(&sc->fc);
/* XXX Link down? Bus reset? */
return 0;

View File

@ -346,8 +346,14 @@ fwohci_pci_detach(device_t self)
s = splfw();
fwohci_stop(sc, self);
if (sc->bsr)
fwohci_stop(sc, self);
bus_generic_detach(self);
if (sc->fc.bdev) {
device_delete_child(self, sc->fc.bdev);
sc->fc.bdev = NULL;
}
/* disable interrupts that might have been switched on */
if (sc->bst && sc->bsh)
@ -366,11 +372,6 @@ fwohci_pci_detach(device_t self)
sc->ih = NULL;
}
if (sc->fc.bdev) {
device_delete_child(self, sc->fc.bdev);
sc->fc.bdev = NULL;
}
if (sc->irq_res) {
bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res);
sc->irq_res = NULL;