Accessing PCI Device's Configuration Space from Device Driver

ID: Q140730

The information in this article applies to:

SUMMARY

Under certain circumstances, a Windows 95 device driver will need to access a device's PCI configuration space. The Configuration Manager service CONFIGMG_Call_Enumerator_Function can be used to accomplish this.

MORE INFORMATION

The CONFIGMG_Call_Enumerator_Function can be used to read or write to a device's PCI configuraton space. It should be noted that SCSI miniports and NDIS drivers already have defined services for accessing PCI configuration space, and should use those services.

The CONFIGMG_Call_Enumerator_Function service allows you to run bus- specific functions through the bus enumerator. In the case of PCI, there is a Pci.h header file in the DDK that defines two different PCI functions:

   #define PCI_ENUM_FUNC_GET_DEVICE_INFO   0
   #define PCI_ENUM_FUNC_SET_DEVICE_INFO   1

These two functions are used to get and set data in the PCI config space. The parameters for CONFIGMG_Call_Enumerator_Function are:

   Parameter      Description
   ----------------------------------------------------------------------
   dnDevNode      Handle of a device's DevNode
   efFunc         Function number that is one of the Pci.h #defines
   ulRefData      Reference data. Starting byte in PCI config space.
   pBuffer        Pointer to a buffer to read or write PCI config data.
   ulBufferSize   Number of bytes in PCI config space to read or write.
   ulFlags        Must be zero.

For generic Plug and Play drivers, the dnDevNode handle is passed to the driver directly by ConfigMg when it is loaded. For specific driver models (VCOMM, IOS, Display, etc.), please refer to the DDK documentation and samples for information on how to retrieve a DevNode handle for your device.

Additional reference words: 4.00 PCI kbinf

Version           : 4.00
Platform          : WINDOWS

Last Reviewed: January 6, 1999