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:

  1. Obtains configuration information for the adapter.

  2. Obtains information about the hardware resources for the adapter.

  3. 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.
  4. 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:

  1. Nonpaged pool memory.

  2. NET_BUFFER and NET_BUFFER_LIST pools (see Miniport Driver Send and Receive Operations).

  3. Spin locks.

  4. Timers.

  5. IO ports.

  6. DMA (see Scatter/Gather DMA).

  7. Shared memory.

  8. 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.

Halting a Miniport Adapter

Miniport Adapter States and Operations

Miniport Driver Send and Receive Operations

Scatter/Gather DMA

Starting a Miniport Adapter