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.
Typically, MiniportInitializeEx allocates adapter-specific resources in the following order:
Nonpaged pool memory.
DMA (see Scatter/Gather DMA).
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 failed, MiniportInitializeEx must release all resources that it allocated before it returns and the adapter returns to the Halted state.