Partager via


MiniportHalt (Compact 2013)

3/26/2014

When the network adapter is removed, this required function deallocates resources and halts the network adapter.

Syntax

VOID MiniportHalt(
  NDIS_HANDLE MiniportAdapterContext
);

Parameters

  • MiniportAdapterContext
    [in] Specifies the handle to a miniport-allocated context area in which the driver maintains per-network adapter state, set up by MiniportInitialize

Return Value

None

Remarks

MiniportHalt should stop the network adapter, if it controls a physical network adapter, and must free all resources that the driver allocated for its network adapter before MiniportHalt returns control. In effect, MiniportHalt undoes everything that was done by MiniportInitialize for a particular network adapter.

If the network adapter driver allocated memory, claimed an I/O port range, mapped on-board device memory to host memory, initialized timers and spin locks, allocated map registers or claimed a DMA channel, and registered an interrupt, that driver must call the reciprocals of the NdisXXX functions with which it originally allocated these resources.

Generally, a MiniportHalt function should call reciprocal NdisXXX functions in inverse order to the calls the driver made from MiniportInitialize. That is, if a network adapter driver's MiniportInitialize function called NdisMRegisterAdapterShutdownHandler just before it returned control, its MiniportHalt function would call NdisMDeregisterAdapterShutdownHandler first.

If its network adapter generates interrupts or shares an IRQ, a network adapter driver's MiniportHalt function can be pre-empted by its MiniportISR or MiniportDisableInterrupt function until MiniportHalt calls NdisMDeregisterInterrupt. Such a driver's MiniportHalt function usually disables interrupts on the network adapter, if it is possible, and calls NdisMDeregisterInterrupt as soon as it can.

If the driver has a MiniportTimer function associated with any timer object that might be in the system timer queue, MiniportHalt should call NdisMCancelTimer.

Otherwise, it is unnecessary for the miniport to complete outstanding requests to its network adapter before MiniportHalt begins releasing allocated resources. NDIS submits no additional requests to the miniport for the network adapter designated by the MiniportAdapterContext handle when NDIS has called MiniportHalt. On return from MiniportHalt, NDIS cleans up any state it was maintaining about this network adapter and about its driver if this miniport supports no other network adapters in the current machine.

An NDIS intermediate driver's call to NdisIMDeInitializeDeviceInstance causes a call to its MiniportHalt function.

Requirements

Header

externs.h

See Also

Reference

NDIS 5.x Legacy Functions
MiniportDisableInterrupt
MiniportInitialize
MiniportISR
MiniportTimer
NdisFreeMemory
NdisFreeSpinLock
NdisIMDeInitializeDeviceInstance
NdisMCancelTimer
NdisMDeregisterAdapterShutdownHandler
NdisMDeregisterInterrupt
NdisMDeregisterIoPortRange
NdisMRegisterAdapterShutdownHandler
NdisMUnmapIoSpace
ProtocolUnbindAdapter
NDIS 5.x Legacy Reference