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:
Build Environment
Replace the preprocessor definition NDIS51_MINIPORT_DRIVER with NDIS60_MINIPORT_DRIVER.
Set the NDIS version to 6.0 in the MajorNdisVersion and MinorNdisVersion members of the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure that is passed to the NdisMRegisterMiniportDriver function.
Set the miniport driver version in the MajorDriverVersion and MinorDriverVersion members of the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure to an appropriate driver-specific value.
Define new and replace obsolete entry points in the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure. For example, the MiniportInitializeEx function replaces the MiniportInitialize function.
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.
Miniport Adapter Initialization
Rewrite the MiniportInitialize function (renamed MiniportInitializeEx) to support the NDIS_MINIPORT_INIT_PARAMETERS structure.
Replace calls to the NdisMSetAttributes and NdisMSetAttributesEx functions with calls to the NdisMSetMiniportAttributes function.
Miniport Adapter Halt and Shutdown
To support the new HaltAction parameter, modify the miniport driver's MiniportHalt function (renamed MiniportHaltEx).
To support the new ShutdownAction parameter, modify the miniport driver's MiniportShutdown function (renamed MiniportShutdownEx).
All NDIS 6.0 miniport drivers are deserialized.
Rewrite the send and receive code paths to use NET_BUFFER structures and NET_BUFFER_LIST structures instead of NDIS_PACKET structures.
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..
Update the interrupt function entry points. For example, replace the MiniportISR function with the MiniportInterrupt function.
Add optional entry points for message signaled interrupts (MSI). For example, define a MiniportMessageInterrupt function.
Replace the NdisMRegisterInterrupt function with the NdisMRegisterInterruptEx function.
Replace the NdisMDeregisterInterrupt function with the NdisMDeregisterInterruptEx 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.
- Replace the MiniportPnPEventNotify function with the MiniportDevicePnPEventNotify function.
Replace the MiniportCheckForHang function with the MiniportCheckForHangEx function.
Replace the MiniportReset function with the MiniportResetEx function.
- Include new miniport adapter pause and restart functionality. For more information about adapter states, see Adapter States of a Miniport Driver.