Exemple #1
0
static int
le_isa_detach(device_t dev)
{
	struct le_isa_softc *lesc;
	struct lance_softc *sc;

	lesc = device_get_softc(dev);
	sc = &lesc->sc_am7990.lsc;

	if (device_is_attached(dev)) {
		lwkt_serialize_enter(sc->ifp->if_serializer);
		lance_stop(sc);
		bus_teardown_intr(dev, lesc->sc_ires, lesc->sc_ih);
		lwkt_serialize_exit(sc->ifp->if_serializer);

		am7990_detach(&lesc->sc_am7990);
	}

	if (lesc->sc_ires)
		bus_release_resource(dev, SYS_RES_IRQ, lesc->sc_irid, lesc->sc_ires);
	if (lesc->sc_dres)
		bus_release_resource(dev, SYS_RES_DRQ, lesc->sc_drid, lesc->sc_dres);
	if (lesc->sc_rres)
		bus_release_resource(dev, SYS_RES_IOPORT, lesc->sc_rrid, lesc->sc_rres);
	if (lesc->sc_dmam) {
		bus_dmamap_unload(lesc->sc_dmat, lesc->sc_dmam);
		bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam);
	}
	if (lesc->sc_dmat)
		bus_dma_tag_destroy(lesc->sc_dmat);
	if (lesc->sc_pdmat)
		bus_dma_tag_destroy(lesc->sc_pdmat);

	return (0);
}
Exemple #2
0
/*===========================================================================*
 *		           sef_cb_signal_handler                             *
 *===========================================================================*/
static void sef_cb_signal_handler(int signo)
{

   /* Only check for termination signal, ignore anything else. */
   if (signo != SIGTERM) return;

   if (ec_state.mode == EC_ENABLED)
      lance_stop(&ec_state);

#if VERBOSE
   printf("LANCE driver stopped.\n");
#endif

   exit(0);
}