From 6431d3dd07040fe58d10ed38aea75caf6d654671 Mon Sep 17 00:00:00 2001 From: wpaul Date: Sun, 1 Aug 2004 06:42:44 +0000 Subject: Add some minor changes related to PCMCIA attribute memory mapping (which I apparently forgot to commit earlier). Acquire NDIS_LOCK() in ndis_linksts_done(). --- sys/dev/if_ndis/if_ndis.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'sys/dev/if_ndis') diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index 60b6096..4a3fd96 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -73,8 +73,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include @@ -389,6 +389,15 @@ ndis_attach(dev) goto fail; } + if (sc->ndis_iftype == PCMCIABus) { + error = ndis_alloc_amem(sc); + if (error) { + device_printf(dev, "failed to allocate " + "attribute memory\n"); + goto fail; + } + } + sc->ndis_regvals = ndis_regvals; #if __FreeBSD_version < 502113 @@ -737,6 +746,9 @@ ndis_detach(dev) bus_release_resource(dev, SYS_RES_MEMORY, sc->ndis_altmem_rid, sc->ndis_res_altmem); + if (sc->ndis_iftype == PCMCIABus) + ndis_free_amem(sc); + if (sc->ndis_sc) ndis_destroy_dma(sc); @@ -957,8 +969,11 @@ ndis_linksts_done(adapter) ifp = block->nmb_ifp; sc = ifp->if_softc; - if (!NDIS_INITIALIZED(sc)) + NDIS_LOCK(sc); + if (!NDIS_INITIALIZED(sc)) { + NDIS_UNLOCK(sc); return; + } switch (block->nmb_getstat) { case NDIS_STATUS_MEDIA_CONNECT: @@ -973,6 +988,7 @@ ndis_linksts_done(adapter) break; } + NDIS_UNLOCK(sc); return; } -- cgit v1.1