HOWTO: Acquire NDIS 4.0 PCI Miniport Resources

ID: Q182329


The information in this article applies to:
  • Microsoft Win32 Device Driver Kit (DDK) for Windows NT, version 4.0


SUMMARY

This article describes how to acquire the resources for an NDIS 4.0 PCI miniport driver. This method involves reading the Registry with NdisReadConfiguration for the adapter's BusNumber and SlotNumber during MiniportInitialize. Then you pass the SlotNumber to NdisMPciAssignResources, which returns the adapter's bus-relative resources that are used in subsequent calls to NdisMRegisterInterrupt, NdisMMapIoSpace, or NdisMRegisterIoPortRange as documented. You should not search for you adapter by scanning the PCI bus.


MORE INFORMATION

The adapter's BusNumber and SlotNumber are stored in the Registry during setup through the miniport's OEMSetup.inf install script. The miniport's OEMSetup.inf should shell out to Utility.inf, which provides the required PCI bus scanning functionality. Utility.inf resides in %SystemRoot%\system32 and also in %NTDDK%\src\setup\inf\ndis. Specifically, you should use:


   Shell $(UtilityInf), GetPCIInformation, $(Vendor) $(CFID) 

NDIS 4.0 miniport drivers are also recommended to add the AdapterCFID:REG_DWORD parameter to their adapter's Parameters section in the Registry. The AdapterCFID corresponds to the PCI Configuration Space's Device ID register. This allows NDIS to verify the slot number and to track the adapter if it is moved from slot to slot. NDIS reads the BusNumber and SlotNumber from the registry, and then attempts to read the AdapterCFID from the Registry. If the AdatpterCFID is there, NDIS will read the slot information and verify that the adapter is in that slot. If the AdapterCFID is not there then NDIS will trust the SlotNumber.

Also note that your MiniportInitialize handler is called for every installed adapter that the driver supports. NDIS knows what card you are initializing by maintaining internal information per NdisAdapterHandle. You simply call NdisMPciAssignResources and you are given the resources for that adapter. When MiniportInitialize is entered for the next installed card you call NdisMPciAssignResources again and you are given the resources for the next adapter.


REFERENCES

For more information, see Utility.inf.

Additional query words: NDIS OEMSetup.inf Utility.inf MiniportInitialize NdisMPciAssignResources NdisReadConfiguration NdisMRegisterInterrupt NdisMMapIoSpace NdisMRegisterIoPortRange

Keywords : ntddkndis
Version : winnt:4.0
Platform : winnt
Issue type : kbhowto


Last Reviewed: September 16, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.