int wdc_obio_detach(device_t self, int flags) { struct wdc_obio_softc *sc = device_private(self); int error; if ((error = wdcdetach(self, flags)) != 0) return error; intr_disestablish(sc->sc_ih); /* Unmap our i/o space. */ bus_space_unmap(sc->sc_wdcdev.regs->cmd_iot, sc->sc_wdcdev.regs->cmd_baseioh, WDC_REG_NPORTS << 4); /* Unmap DMA registers. */ bus_space_unmap(sc->sc_wdcdev.regs->cmd_iot, sc->sc_dmaregh, 0x100); free(sc->sc_dmacmd, M_DEVBUF); return 0; }
int wdc_obio_detach(struct device *self, int flags) { struct wdc_obio_softc *sc = (struct wdc_obio_softc *)self; struct channel_softc *chp = &sc->wdc_channel; int error; if ((error = wdcdetach(chp, flags)) != 0) return (error); free(chp->ch_queue, M_DEVBUF); if (sc->sc_use_dma) { unmapiodev((void *)sc->sc_dmareg, sc->sc_dmasize); dbdma_free(sc->sc_dbdma); } mac_intr_disestablish(NULL, sc->sc_ih); bus_space_unmap(chp->cmd_iot, chp->cmd_ioh, sc->sc_cmdsize); bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap); return (0); }
int njata32_detach(struct njata32_softc *sc, int flags) { int rv, devno; if (sc->sc_flags & NJATA32_CMDPG_MAPPED) { if ((rv = wdcdetach(sc->sc_wdcdev.sc_atac.atac_dev, flags))) return rv; /* free DMA resource */ for (devno = 0; devno < NJATA32_NUM_DEV; devno++) { bus_dmamap_destroy(sc->sc_dmat, sc->sc_dev[devno].d_dmamap_xfer); } bus_dmamap_unload(sc->sc_dmat, sc->sc_dmamap_sgt); bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmamap_sgt); bus_dmamem_unmap(sc->sc_dmat, (void *)sc->sc_sgtpg, sizeof(struct njata32_dma_page)); bus_dmamem_free(sc->sc_dmat, &sc->sc_sgt_seg, sc->sc_sgt_nsegs); } return 0; }