Hardware Dev Center

NdisMFreeSharedMemory function

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

Syntax


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

Parameters

MiniportAdapterHandle [in]

Specifies the handle originally input to MiniportInitializeEx.

Length [in]

Specifies the number of bytes originally allocated.

Cached [in]

Specifies TRUE if the original allocation was cacheable.

VirtualAddress [in]

Specifies the base virtual address returned by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsyncEx.

PhysicalAddress [in]

Specifies the corresponding physical address returned by NdisMAllocateSharedMemory or NdisMAllocateSharedMemoryAsyncEx.

Return value

None

Remarks

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

  • Its MiniportInitializeEx 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 driver 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 NdisMAllocateSharedMemoryAsyncEx when I/O demand on a NIC was high but network traffic has now subsided to an average level.

A miniport driver 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 NdisMAllocateSharedMemoryAsyncEx.

NdisMFreeSharedMemory cannot be called from a MiniportShutdownEx function.

Microsoft Windows Server 2003, Windows XP Service Pack 1, and later versions of Windows allow both bus-master DMA NICs and subordinate DMA NICs to call NdisMFreeSharedMemory. Prior releases allow only bus-master DMA NICs to call NdisMFreeSharedMemory.

Requirements

Target platform

Universal

Version

Supported for NDIS 6.0 and NDIS 5.1 drivers (see NdisMFreeSharedMemory (NDIS 5.1)) in Windows Vista. Supported for NDIS 5.1 drivers (see NdisMFreeSharedMemory (NDIS 5.1)) in Windows XP.

Header

Ndis.h (include Ndis.h)

IRQL

<= DISPATCH_LEVEL

DDI compliance rules

Irql_Miniport_Driver_Function, NdisMFreeSharedMemory

See also

MiniportSharedMemoryAllocateComplete
MiniportHaltEx
MiniportInitializeEx
MiniportShutdownEx
NdisMAllocateSharedMemory
NdisMAllocateSharedMemoryAsyncEx

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft