NdisMFreeSharedMemory

VOID
   NdisMFreeSharedMemory(
       IN NDIS_HANDLE
MiniportAdapterHandle,
       IN ULONG Length,
       IN BOOLEAN Cached,
       IN PVOID VirtualAddress,
       IN NDIS_PHYSICAL_ADDRESS PhysicalAddress
       );

NdisMFreeSharedMemory frees memory that was previously allocated by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync by the driver of a busmaster DMA NIC.

Parameters

MiniportAdapterHandle

Specifies the handle originally input to MiniportInitialize.

Length

Specifies the number of bytes originally allocated.

Cached

Specifies TRUE if the original allocation was cacheable.

VirtualAddress

Specifies the base virtual address returned by NdisMAllocateSharedMemory(Async).

PhysicalAddress

Specifies the corresponding physical address returned by NdisMAllocateSharedMemory(Async).

Comments

If it has already made a successful call to NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync, the NIC driver of a busmaster DMA device calls NdisMFreeSharedMemory if any of the following occurs:

·Its MiniportInitialize function is unable to initialize the NIC, so this function must release all existing claims on hardware resources for that NIC before it returns control.

·The NIC for which the miniport allocated the memory is being removed.

·The driver is being unloaded, whether because the system is shutting down or because the user reconfigured the network components used in the machine.

·The driver allocated additional shared memory with NdisMAllocateSharedMemoryAsync when I/O demand on its NIC was high but network traffic has now subsided to an average level.

A miniport cannot call NdisMFreeSharedMemory to free a subrange within an allocated shared memory range. The parameters passed to NdisMFreeSharedMemory must match exactly those that were passed to NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsync.

NdisMFreeSharedMemory cannot be called from a MiniportShutdown function

Callers of NdisMFreeSharedMemory run at IRQL <= DISPATCH_LEVEL.

See Also

MiniportAllocateComplete, MiniportHalt, MiniportInitialize, MiniportShutdown, NdisMAllocateSharedMemory, NdisMAllocateSharedMemoryAsync, NdisMFreeMapRegisters