- 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:
parent
30c1156451
commit
183498934b
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user