diff options
author | wpaul <wpaul@FreeBSD.org> | 2005-10-26 06:52:57 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2005-10-26 06:52:57 +0000 |
commit | a16098473846c54b54bd1b74ca434605687746c7 (patch) | |
tree | e7dba255548a2bef54a00de0a1224fb116f0d971 /sys/compat/ndis/subr_ndis.c | |
parent | fe60acc5023fa40342cc5c55c39c1a2efcbdfc82 (diff) | |
download | FreeBSD-src-a16098473846c54b54bd1b74ca434605687746c7.zip FreeBSD-src-a16098473846c54b54bd1b74ca434605687746c7.tar.gz |
Get rid of the timer tracking and reaping code in NdisMInitializeTimer()
and ndis_halt_nic(). It's been disabled for some time anyway, and
it turns out there's a possible deadlock in NdisMInitializeTimer() when
acquiring the miniport block lock to modify the timer list: it's
possible for a driver to call NdisMInitializeTimer() when the miniport
block lock has already been acquired by an earlier piece of code. You
can't acquire the same spinlock twice, so this can deadlock.
Also, implement MmMapIoSpace() and MmUnmapIoSpace(), and make
NdisMMapIoSpace() and NdisMUnmapIoSpace() use them. There are some
drivers that want MmMapIoSpace() and MmUnmapIoSpace() so that they can
map arbitrary register spaces not directly associated with their
device resources. For example, there's an Atheros driver for
a miniPci card (0x168C:0x1014) on the IBM Thinkpad x40 that wants
to map some I/O spaces at 0xF00000 and 0xE00000 which are held by
the acpi0 device. I don't know what it wants these ranges for,
but if it can't map and access them, the MiniportInitialize() method
fails.
Diffstat (limited to 'sys/compat/ndis/subr_ndis.c')
-rw-r--r-- | sys/compat/ndis/subr_ndis.c | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index 03a277b..eb2ae66 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -1257,8 +1257,6 @@ NdisMInitializeTimer(timer, handle, func, ctx) ndis_timer_function func; void *ctx; { - uint8_t irql; - /* Save the driver's funcptr and context */ timer->nmt_timerfunc = func; @@ -1276,13 +1274,6 @@ NdisMInitializeTimer(timer, handle, func, ctx) ndis_findwrap((funcptr)ndis_timercall), timer); timer->nmt_ktimer.k_dpc = &timer->nmt_kdpc; - KeAcquireSpinLock(&timer->nmt_block->nmb_lock, &irql); - - timer->nmt_nexttimer = timer->nmt_block->nmb_timerlist; - timer->nmt_block->nmb_timerlist = timer; - - KeReleaseSpinLock(&timer->nmt_block->nmb_lock, irql); - return; } @@ -1750,25 +1741,12 @@ NdisMMapIoSpace(vaddr, adapter, paddr, len) ndis_physaddr paddr; uint32_t len; { - ndis_miniport_block *block; - struct ndis_softc *sc; - if (adapter == NULL) return(NDIS_STATUS_FAILURE); - block = (ndis_miniport_block *)adapter; - sc = device_get_softc(block->nmb_physdeviceobj->do_devext); + *vaddr = MmMapIoSpace(paddr.np_quad, len, 0); - if (sc->ndis_res_mem != NULL && - paddr.np_quad == rman_get_start(sc->ndis_res_mem)) - *vaddr = (void *)rman_get_virtual(sc->ndis_res_mem); - else if (sc->ndis_res_altmem != NULL && - paddr.np_quad == rman_get_start(sc->ndis_res_altmem)) - *vaddr = (void *)rman_get_virtual(sc->ndis_res_altmem); - else if (sc->ndis_res_am != NULL && - paddr.np_quad == rman_get_start(sc->ndis_res_am)) - *vaddr = (void *)rman_get_virtual(sc->ndis_res_am); - else + if (*vaddr == NULL) return(NDIS_STATUS_FAILURE); return(NDIS_STATUS_SUCCESS); @@ -1780,6 +1758,7 @@ NdisMUnmapIoSpace(adapter, vaddr, len) void *vaddr; uint32_t len; { + MmUnmapIoSpace(vaddr, len); return; } |