HOWTO: Acquire NDIS 4.0 PCI Miniport Resources

Last reviewed: March 11, 1998
Article 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.

For additional information about debugging your setup scripts, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q126419
   TITLE     : HOWTO: Enable Debug Output for OEMSetup.inf Scripts


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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 11, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.