Initializing a Miniport Adapter
When a networking device becomes available, the system loads the required NDIS miniport driver, if it is not already loaded. Subsequently, the Plug and Play (PnP) manager sends NDIS a Plug and Play IRP to start the device. NDIS calls the miniport driver's MiniportInitializeEx function to initialize an adapter for network I/O operations. NDIS can call MiniportInitializeEx at any time after the driver is initialized. For more information about miniport driver initialization, see Initializing a Miniport Driver.
Until MiniportInitializeEx returns, NDIS submits no requests for the adapter being initialized. The adapter is in the Initializing state.
A miniport driver typically performs the following tasks in MiniportInitializeEx:
Obtains configuration information for the adapter.
Obtains information about the hardware resources for the adapter.
Calls the NdisMSetMiniportAttributes and provides the following attributes that are associated with the adapter:
- A pointer to a driver-allocated context area.
- Appropriate attributes flags.
- The time-out interval for calling its MiniportCheckForHangEx function.
- The interface type.
Initializes adapter-specific resources.
The miniport driver specifies the adapter attributes in the NDIS_MINIPORT_ADAPTER_ATTRIBUTES structure that MiniportInitializeEx passes to NdisMSetMiniportAttributes.
Typically, MiniportInitializeEx allocates adapter-specific resources in the following order:
Nonpaged pool memory.
NET_BUFFER and NET_BUFFER_LIST pools (see Miniport Driver Send and Receive Operations).
Spin locks.
Timers.
IO ports.
DMA (see Scatter/Gather DMA).
Shared memory.
Interrupts (see Managing Interrupts).
After MiniportInitializeEx returns successfully, the adapter is in the Paused state. NDIS can call the MiniportRestart function to transition the adapter to the Running state. For more information, see Starting a Miniport Adapter.
If MiniportInitializeEx returns NDIS_STATUS_SUCCESS, the driver should release all the resources for the adapter in the MiniportHaltEx function. For more information, see Halting a Miniport Adapter.
The driver must call NdisMSetMiniportAttributes and set the GeneralAttributes in the NDIS_MINIPORT_ADAPTER_ATTRIBUTES structure if it returns NDIS_STATUS_SUCCESS.
If MiniportInitializeEx failed, MiniportInitializeEx must release all resources that it allocated before it returns and the adapter returns to the Halted state.
Related topics
Miniport Adapter States and Operations