示例#1
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;
}
示例#2
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);
}
static int
ohci_pci_detach(device_ptr_t self, int flags)
{
	struct ohci_pci_softc *sc = device_private(self);
	int rv;

	rv = ohci_detach(&sc->sc, flags);
	if (rv)
		return (rv);
	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);
}