Summary of Changes Required to Port a Miniport Driver to NDIS 6.0
This topic summarizes the changes that are required to port an NDIS 5.x miniport driver to NDIS 6.0. Porting earlier drivers is similar to porting NDIS 5.x drivers.
To run in the NDIS 6.0 environment, NDIS 5.x miniport drivers must be modified as follows:
Set the miniport driver version in the MajorDriverVersion and MinorDriverVersion members of the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure to an appropriate driver-specific value.
If the miniport driver uses optional handlers, add the entry point for the MiniportSetOptions function to the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure. To register optional handlers, MiniportSetOptions calls the NdisSetOptionalHandlers function.
In the DriverEntry routine, replace calls to the NdisMInitializeWrapper, NdisMRegisterUnloadHandler, and NdisMRegisterMiniport functions with a call to the NdisMRegisterMiniportDriver function. If an error occurs after a successful call to NdisMRegisterMiniportDriver, the driver must call NdisMDeregisterMiniportDriver before DriverEntry returns. NDIS 6.0 miniport drivers do not call the NdisTerminateWrapper function.
Create the miniport driver's MiniportDriverUnload function or, if it exists, update it. For NDIS 6.0, the MiniportDriverUnload entry point is in the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure. NDIS 6.0 drivers do not call the NdisMRegisterUnloadHandler function.
To deregister the miniport driver, MiniportDriverUnload must call the NdisMDeregisterMiniportDriver function.
Rewrite the MiniportInitialize function (renamed MiniportInitializeEx) to support the NDIS_MINIPORT_INIT_PARAMETERS structure.
All NDIS 6.0 miniport drivers are deserialized.
If the driver uses scatter gather DMA (SGDMA) for send operations, add calls to the SGDMA functions as described in the following DMA change summary.
Bus master miniport drivers should call the NdisMRegisterScatterGatherDma function from the MiniportInitializeEx function to allocate, initialize, and obtain the necessary information for scatter gather DMA (SGDMA) run-time operations. To release the SGDMA resources obtained with NdisMRegisterScatterGatherDma, call the NdisMDeregisterScatterGatherDma function from MiniportHaltEx.
Define the MiniportSharedMemoryAllocateComplete function (formerly MiniportAllocateComplete) for miniport drivers that call the NdisMAllocateSharedMemoryAsyncEx function (formerly NdisMAllocateSharedMemoryAsync). The entry point for MiniportSharedMemoryAllocateComplete is in the NDIS_SG_DMA_DESCRIPTION structure that the driver passed to NdisMRegisterScatterGatherDma.
Define the MiniportProcessSGList function The entry point for MiniportProcessSGList is in the NDIS_SG_DMA_DESCRIPTION structure that the driver passed to NdisMRegisterScatterGatherDma.
When handling send requests, drivers call the NdisMAllocateNetBufferSGList function to allocate a scatter gather list (SGL). The driver uses the SGL, obtained from MiniportProcessSGList, to send data to a NIC. After the driver is done with the SGL, free the SGL by calling the NdisMFreeNetBufferSGList function.
Define the interrupt parameters in the NDIS_MINIPORT_INTERRUPT_CHARACTERISTICS structure. Also, define the entry points for the interrupt functions in this structure..
Add optional entry points for message signaled interrupts (MSI). For example, define a MiniportMessageInterrupt function.
Replace the miniport driver's MiniportQueryInformation function and MiniportSetInformation function with the MiniportOidRequest function. The MiniportOidRequest function uses NDIS_OID_REQUEST structures instead of NDIS_REQUEST structures.
Create the miniport driver's MiniportCancelOidRequest function. To cancel OID requests, NDIS calls MiniportCancelOidRequest. NDIS does not reset the miniport adapter.
- Replace calls to the NdisMIndicateStatus function with calls to the NdisMIndicateStatusEx function and remove calls to the NdisMIndicateStatusComplete function. To make status indications, pass the NdisMIndicateStatusEx function an NDIS_STATUS_INDICATION structure.
- Include new miniport adapter pause and restart functionality. For more information about adapter states, see Adapter States of a Miniport Driver.