static int coram_detach(device_t self, int flags) { struct coram_softc *sc = device_private(self); struct coram_iic_softc *cic; unsigned int i; int error; error = coram_mpeg_detach(sc, flags); if (error) return error; if (sc->sc_tuner) mt2131_close(sc->sc_tuner); if (sc->sc_demod) cx24227_close(sc->sc_demod); for (i = 0; i < I2C_NUM; i++) { cic = &sc->sc_iic[i]; if (cic->cic_i2cdev) config_detach(cic->cic_i2cdev, flags); mutex_destroy(&cic->cic_busmutex); } pmf_device_deregister(self); if (sc->sc_mems) bus_space_unmap(sc->sc_memt, sc->sc_memh, sc->sc_mems); if (sc->sc_ih) pci_intr_disestablish(sc->sc_pc, sc->sc_ih); return 0; }
static int xhci_pci_detach(device_t self, int flags) { struct xhci_pci_softc * const psc = device_private(self); struct xhci_softc * const sc = &psc->sc_xhci; int rv; rv = xhci_detach(sc, flags); if (rv) return rv; pmf_device_deregister(self); xhci_shutdown(self, flags); if (sc->sc_ios) { #if 0 /* Disable interrupts, so we don't get any spurious ones. */ bus_space_write_4(sc->sc_iot, sc->sc_ioh, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); #endif } if (sc->sc_ih != NULL) { pci_intr_disestablish(psc->sc_pc, sc->sc_ih); sc->sc_ih = NULL; } if (sc->sc_ios) { bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_ios); sc->sc_ios = 0; } return 0; }
static int hdaudio_pci_detach(device_t self, int flags) { struct hdaudio_pci_softc *sc = device_private(self); pcireg_t csr; hdaudio_detach(&sc->sc_hdaudio, flags); if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); sc->sc_ih = NULL; } if (sc->sc_hdaudio.sc_memvalid == true) { bus_space_unmap(sc->sc_hdaudio.sc_memt, sc->sc_hdaudio.sc_memh, sc->sc_hdaudio.sc_memsize); sc->sc_hdaudio.sc_memvalid = false; } /* Disable busmastering and MMIO access */ csr = pci_conf_read(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG); csr &= ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE); pci_conf_write(sc->sc_pc, sc->sc_tag, PCI_COMMAND_STATUS_REG, csr); pmf_device_deregister(self); return 0; }
int sili_pci_detach(struct device *self, int flags) { struct sili_pci_softc *psc = (struct sili_pci_softc *)self; struct sili_softc *sc = &psc->psc_sili; int rv; rv = sili_detach(sc, flags); if (rv != 0) return (rv); if (psc->psc_ih != NULL) { pci_intr_disestablish(psc->psc_pc, psc->psc_ih); psc->psc_ih = NULL; } if (sc->sc_ios_port != 0) { bus_space_unmap(sc->sc_iot_port, sc->sc_ioh_port, sc->sc_ios_port); sc->sc_ios_port = 0; } if (sc->sc_ios_global != 0) { bus_space_unmap(sc->sc_iot_global, sc->sc_ioh_global, sc->sc_ios_global); sc->sc_ios_global = 0; } return (0); }
static int ohci_pci_detach(device_t self, int flags) { struct ohci_pci_softc *sc = device_private(self); int rv; rv = ohci_detach(&sc->sc, flags); if (rv) return rv; pmf_device_deregister(self); ohci_shutdown(self, flags); if (sc->sc.sc_size) { /* Disable interrupts, so we don't get any spurious ones. */ bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTRS); } if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); sc->sc_ih = NULL; } if (sc->sc.sc_size) { bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); sc->sc.sc_size = 0; } #if NEHCI > 0 usb_pci_rem(&sc->sc_pci); #endif return 0; }
static void wi_pci_disable(struct wi_softc *sc) { struct wi_pci_softc *psc = (struct wi_pci_softc *)sc; pci_intr_disestablish(psc->psc_pc, sc->sc_ih); }
static int auich_detach(device_t self, int flags) { struct auich_softc *sc = device_private(self); /* audio */ if (sc->sc_audiodev != NULL) config_detach(sc->sc_audiodev, flags); /* sysctl */ sysctl_teardown(&sc->sc_log); mutex_enter(&sc->sc_lock); /* audio_encoding_set */ auconv_delete_encodings(sc->sc_encodings); auconv_delete_encodings(sc->sc_spdif_encodings); /* ac97 */ if (sc->codec_if != NULL) sc->codec_if->vtbl->detach(sc->codec_if); mutex_exit(&sc->sc_lock); mutex_destroy(&sc->sc_lock); mutex_destroy(&sc->sc_intr_lock); /* PCI */ if (sc->sc_ih != NULL) pci_intr_disestablish(sc->sc_pc, sc->sc_ih); if (sc->mix_size != 0) bus_space_unmap(sc->iot, sc->mix_ioh, sc->mix_size); if (sc->aud_size != 0) bus_space_unmap(sc->iot, sc->aud_ioh, sc->aud_size); return 0; }
static int uhci_pci_detach(device_t self, int flags) { struct uhci_pci_softc *sc = device_private(self); int rv; if (sc->sc_initialized & SC_INIT_UHCI) { rv = uhci_detach(&sc->sc, flags); if (rv) return (rv); } if (sc->sc_initialized & SC_INIT_PMF) pmf_device_deregister(self); /* disable interrupts and acknowledge any pending */ bus_space_write_2(sc->sc.iot, sc->sc.ioh, UHCI_INTR, 0); bus_space_write_2(sc->sc.iot, sc->sc.ioh, UHCI_STS, bus_space_read_2(sc->sc.iot, sc->sc.ioh, UHCI_STS)); if (sc->sc_ih != NULL) { pci_intr_disestablish(sc->sc_pc, sc->sc_ih); sc->sc_ih = NULL; } if (sc->sc.sc_size) { bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); sc->sc.sc_size = 0; } #if NEHCI > 0 usb_pci_rem(&sc->sc_pci); #endif return (0); }
void ohci_pci_attach_deferred(struct device *self) { struct ohci_pci_softc *sc = (struct ohci_pci_softc *)self; usbd_status r; int s; s = splusb(); sc->sc.sc_bus.dying = 0; r = ohci_init(&sc->sc); if (r != USBD_NORMAL_COMPLETION) { printf("%s: init failed, error=%d\n", sc->sc.sc_bus.bdev.dv_xname, r); bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); pci_intr_disestablish(sc->sc_pc, sc->sc_ih); splx(s); return; } splx(s); /* Attach usb device. */ sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus, usbctlprint); }
int re_pci_detach(struct device *self, int flags) { struct re_pci_softc *psc = (struct re_pci_softc *)self; struct rl_softc *sc = &psc->sc_rl; struct ifnet *ifp = &sc->sc_arpcom.ac_if; /* Remove timeout handler */ timeout_del(&sc->timer_handle); /* Detach PHY */ if (LIST_FIRST(&sc->sc_mii.mii_phys) != NULL) mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); /* Delete media stuff */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); ether_ifdetach(ifp); if_detach(ifp); /* Disable interrupts */ if (psc->sc_ih != NULL) pci_intr_disestablish(psc->sc_pc, psc->sc_ih); /* Free pci resources */ bus_space_unmap(sc->rl_btag, sc->rl_bhandle, psc->sc_iosize); return (0); }
int vte_detach(struct device *self, int flags) { struct vte_softc *sc = (struct vte_softc *)self; struct ifnet *ifp = &sc->sc_arpcom.ac_if; int s; s = splnet(); vte_stop(sc); splx(s); mii_detach(&sc->sc_miibus, MII_PHY_ANY, MII_OFFSET_ANY); /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_miibus.mii_media, IFM_INST_ANY); ether_ifdetach(ifp); if_detach(ifp); vte_dma_free(sc); if (sc->sc_irq_handle != NULL) { pci_intr_disestablish(sc->sc_pct, sc->sc_irq_handle); sc->sc_irq_handle = NULL; } return (0); }
int ppbdetach(struct device *self, int flags) { struct ppb_softc *sc = (struct ppb_softc *)self; char *name; int rv; if (sc->sc_intrhand) pci_intr_disestablish(sc->sc_pc, sc->sc_intrhand); rv = config_detach_children(self, flags); if (sc->sc_ioex) { name = sc->sc_ioex->ex_name; extent_destroy(sc->sc_ioex); free(name, M_DEVBUF); } if (sc->sc_memex) { name = sc->sc_memex->ex_name; extent_destroy(sc->sc_memex); free(name, M_DEVBUF); } if (sc->sc_pmemex) { name = sc->sc_pmemex->ex_name; extent_destroy(sc->sc_pmemex); free(name, M_DEVBUF); } return (rv); }
void rtw_pci_disable(struct rtw_softc *sc) { struct rtw_pci_softc *psc = (void *)sc; /* Unhook the interrupt handler. */ pci_intr_disestablish(psc->psc_pc, psc->psc_intrcookie); psc->psc_intrcookie = NULL; }
void mfi_pci_attach(struct device *parent, struct device *self, void *aux) { struct mfi_softc *sc = (struct mfi_softc *)self; struct pci_attach_args *pa = aux; const struct mfi_pci_device *mpd; pci_intr_handle_t ih; bus_size_t size; pcireg_t reg; int regbar; mpd = mfi_pci_find_device(pa); if (mpd == NULL) { printf(": can't find matching pci device\n"); return; } if (mpd->mpd_iop == MFI_IOP_GEN2 || mpd->mpd_iop == MFI_IOP_SKINNY) regbar = MFI_BAR_GEN2; else regbar = MFI_BAR; reg = pci_mapreg_type(pa->pa_pc, pa->pa_tag, regbar); if (pci_mapreg_map(pa, regbar, reg, 0, &sc->sc_iot, &sc->sc_ioh, NULL, &size, MFI_PCI_MEMSIZE)) { printf(": can't map controller pci space\n"); return; } sc->sc_dmat = pa->pa_dmat; if (pci_intr_map(pa, &ih) != 0) { printf(": can't map interrupt\n"); goto unmap; } printf(": %s\n", pci_intr_string(pa->pa_pc, ih)); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, mfi_intr, sc, sc->sc_dev.dv_xname); if (!sc->sc_ih) { printf("%s: can't establish interrupt\n", DEVNAME(sc)); goto unmap; } if (mfi_attach(sc, mpd->mpd_iop)) { printf("%s: can't attach\n", DEVNAME(sc)); goto unintr; } return; unintr: pci_intr_disestablish(pa->pa_pc, sc->sc_ih); sc->sc_ih = NULL; unmap: bus_space_unmap(sc->sc_iot, sc->sc_ioh, size); }
void mfi_pci_attach(struct device *parent, struct device *self, void *aux) { struct mfi_softc *sc = (struct mfi_softc *)self; struct pci_attach_args *pa = aux; const char *intrstr; pci_intr_handle_t ih; bus_size_t size; pcireg_t csr; uint32_t subsysid, i; subsysid = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); for (i = 0; mfi_pci_devices[i].mpd_vendor; i++) if (mfi_pci_devices[i].mpd_subvendor == PCI_VENDOR(subsysid) && mfi_pci_devices[i].mpd_subproduct == PCI_PRODUCT(subsysid)){ printf(", %s", mfi_pci_devices[i].mpd_model); break; } csr = pci_mapreg_type(pa->pa_pc, pa->pa_tag, MFI_BAR); csr |= PCI_MAPREG_MEM_TYPE_32BIT; if (pci_mapreg_map(pa, MFI_BAR, csr, 0, &sc->sc_iot, &sc->sc_ioh, NULL, &size, MFI_PCI_MEMSIZE)) { printf(": can't map controller pci space\n"); return; } sc->sc_dmat = pa->pa_dmat; if (pci_intr_map(pa, &ih)) { printf(": can't map interrupt\n"); bus_space_unmap(sc->sc_iot, sc->sc_ioh, size); return; } intrstr = pci_intr_string(pa->pa_pc, ih); sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_BIO, mfi_intr, sc, sc->sc_dev.dv_xname); if (!sc->sc_ih) { printf(": can't establish interrupt"); if (intrstr) printf(" at %s", intrstr); printf("\n"); bus_space_unmap(sc->sc_iot, sc->sc_ioh, size); return; } printf(": %s\n", intrstr); if (mfi_attach(sc)) { printf("%s: can't attach", DEVNAME(sc)); pci_intr_disestablish(pa->pa_pc, sc->sc_ih); sc->sc_ih = NULL; bus_space_unmap(sc->sc_iot, sc->sc_ioh, size); } }
int malo_pci_detach(device_t self, int flags) { struct malo_pci_softc *psc = device_private(self); struct malo_softc *sc = &psc->sc_malo; malo_detach(sc); pci_intr_disestablish(psc->sc_pc, psc->sc_ih); return (0); }
int ral_pci_detach(device_t self, int flags) { struct ral_pci_softc *psc = device_private(self); struct rt2560_softc *sc = &psc->sc_sc; (*psc->sc_opns->detach)(sc); pci_intr_disestablish(psc->sc_pc, psc->sc_ih); return 0; }
int acx_pci_detach(struct device *self, int flags) { struct acx_pci_softc *psc = (struct acx_pci_softc *)self; struct acx_softc *sc = &psc->sc_acx; acx_detach(sc); pci_intr_disestablish(psc->sc_pc, psc->sc_ih); return 0; }
static bool atw_pci_suspend(device_t self, const pmf_qual_t *qual) { struct atw_pci_softc *psc = device_private(self); /* Unhook the interrupt handler. */ pci_intr_disestablish(psc->psc_pc, psc->psc_intrcookie); psc->psc_intrcookie = NULL; return atw_suspend(self, qual); }
int bwi_pci_detach(struct device *self, int flags) { struct bwi_pci_softc *psc = (struct bwi_pci_softc *)self; struct bwi_softc *sc = &psc->psc_bwi; bwi_detach(sc); pci_intr_disestablish(psc->psc_pc, psc->psc_ih); return (0); }
int dc_pci_detach(struct device *self, int flags) { struct dc_pci_softc *psc = (void *)self; struct dc_softc *sc = &psc->psc_softc; if (sc->sc_ih != NULL) pci_intr_disestablish(psc->psc_pc, sc->sc_ih); dc_detach(sc); bus_space_unmap(sc->dc_btag, sc->dc_bhandle, psc->psc_mapsize); return (0); }
Static bool athn_pci_suspend(device_t self, const pmf_qual_t *qual) { struct athn_pci_softc *psc = device_private(self); struct athn_softc *sc = &psc->psc_sc; athn_suspend(sc); if (psc->psc_ih != NULL) { pci_intr_disestablish(psc->psc_pc, psc->psc_ih); psc->psc_ih = NULL; } return true; }
static int rtsx_pci_detach(device_t self, int flags) { struct rtsx_pci_softc *sc = device_private(self); int rv; rv = rtsx_detach(&sc->sc, flags); if (rv) return rv; pci_intr_disestablish(sc->sc_pc, sc->sc_ih); return 0; }
static int b3_617_detach(device_t dev) { struct b3_617_softc *sc = device_private(dev); b3_617_halt(sc); if (sc->sc_ih) pci_intr_disestablish(sc->sc_pc, sc->sc_ih); bus_space_unmap(sc->sc_bc, sc->csrbase, 32); bus_space_unmap(sc->sc_bc, sc->mapbase, 64*1024); return(0); }
int gem_detach_pci(struct device *self, int flags) { struct gem_pci_softc *gsc = (void *)self; struct gem_softc *sc = &gsc->gsc_gem; timeout_del(&sc->sc_tick_ch); timeout_del(&sc->sc_rx_watchdog); gem_unconfig(sc); pci_intr_disestablish(gsc->gsc_pc, gsc->gsc_ih); bus_space_unmap(gsc->gsc_memt, gsc->gsc_memh, gsc->gsc_memsize); return (0); }
int athn_pci_detach(struct device *self, int flags) { struct athn_pci_softc *psc = (struct athn_pci_softc *)self; struct athn_softc *sc = &psc->sc_sc; if (psc->sc_ih != NULL) { athn_detach(sc); pci_intr_disestablish(psc->sc_pc, psc->sc_ih); } if (psc->sc_mapsize > 0) bus_space_unmap(psc->sc_st, psc->sc_sh, psc->sc_mapsize); return (0); }
int pgt_pci_detach(struct device *self, int flags) { struct pgt_pci_softc *psc = (struct pgt_pci_softc *)self; struct pgt_softc *sc = &psc->sc_pgt; if (psc->sc_ih != NULL) { pgt_detach(sc); pci_intr_disestablish(psc->sc_pc, psc->sc_ih); } if (psc->sc_mapsize > 0) bus_space_unmap(sc->sc_iotag, sc->sc_iohandle, psc->sc_mapsize); return (0); }
int bwi_pci_detach(device_t self, int flags) { struct bwi_pci_softc *psc = device_private(self); struct bwi_softc *sc = &psc->psc_bwi; pmf_device_deregister(self); bwi_detach(sc); if (sc->sc_ih != NULL) { pci_intr_disestablish(psc->psc_pc, sc->sc_ih); sc->sc_ih = NULL; } return (0); }
static int rtsx_pci_detach(device_t self, int flags) { struct rtsx_pci_softc *sc = device_private(self); int rv; rv = rtsx_detach(&sc->sc, flags); if (rv) return rv; pci_intr_disestablish(sc->sc_pc, sc->sc_ih); #ifdef __HAVE_PCI_MSI_MSIX pci_intr_release(sc->sc_pc, sc->sc_pihp, 1); #endif /* __HAVE_PCI_MSI_MSIX */ return 0; }
int rtw_pci_detach(struct device *self, int flags) { struct rtw_pci_softc *psc = (void *)self; struct rtw_softc *sc = &psc->psc_rtw; struct rtw_regs *regs = &sc->sc_regs; int rv; rv = rtw_detach(sc); if (rv) return (rv); if (psc->psc_intrcookie != NULL) pci_intr_disestablish(psc->psc_pc, psc->psc_intrcookie); bus_space_unmap(regs->r_bt, regs->r_bh, psc->psc_mapsize); return (0); }