HalGetBusData

ULONG
    HalGetBusData(

        IN BUS_DATA_TYPE  BusDataType,
        IN ULONG  BusNumber,
        IN ULONG  SlotNumber,
        IN PVOID  Buffer,
        IN ULONG  Length
        );

HalGetBusData obtains details about a given slot or address on a particular I/O bus.

Parameters

BusDataType
Specifies the type of bus data to be retrieved. Currently, its value can be one of the following: Cmos, EisaConfiguration, Pos, or PCIConfiguration. However, additional types of bus configuration will be supported in future versions of Windows NT. The upper bound on the types supported is always MaximumBusDataType.
BusNumber
Specifies the zero-based and system-assigned number of the bus in systems with several buses of the same BusDataType.
SlotNumber
Specifes the logical slot number or location of the device. If PCIConfiguration is specified as the BusDataType, this is specified as a PCI_SLOT_NUMBER-type value.
Buffer
Points to a caller-supplied buffer for configuration information specific to BusDataType.

If Cmos is specified, the buffer will contain the contents of the CMOS (bus number equals zero) or ECMOS (bus number equals one) locations starting with the location specified for SlotNumber.

If EisaConfiguration is specified, the buffer will contain the CM_EISA_SLOT_INFORMATION structure followed by zero or more CM_EISA_FUNCTION_INFORMATION structures for the specified slot.

If Pos is specified, the buffer will contain a CM_MCA_POS_DATA structure for the specified slot.

If PCIConfiguration is specified, the buffer will contain the PCI_COMMON_CONFIG information for the given SlotNumber.

Length
Specifies the maximum number of bytes to return in the Buffer.

Return Value

HalGetBusData returns the number of bytes of data it wrote in the given buffer. If the given BusDataType is not valid for the current platform, this routine returns zero.

When the input BusType is PCIConfiguration, HalGetBusData can return either of the following values to indicate an error:

Value

Meaning

0 (zero)

The specified PCI bus does not exist.

2

The specified PCI bus exists, but there is no device at the given PCI SlotNumber. The Buffer also contains the value PCI_INVALID_VENDOR_ID at the PCI_COMMON_CONFIG VendorId member.

Comments

Device drivers call this routine during initialization to locate their devices on a particular I/O bus in the machine. The bus-type-specific configuration data returned is later used in calls to other configuration and initialization routines, such as HalTranslateBusAddress, HalGetInterrupt, HalGetAdapter, IoAssignResources, and so forth.

Calling HalGetBusData with any BusDataType except Cmos is the same as calling HalGetBusDataByOffset with an input Offset of zero.

If the input BusDataType is PCIConfiguration, callers of HalGetBusData can be running at IRQL <= DISPATCH_LEVEL. Otherwise, callers of HalGetBusData must be running at IRQL PASSIVE_LEVEL.

See Also

CM_EISA_FUNCTION_INFORMATION, CM_EISA_SLOT_INFORMATION, CM_MCA_POS_DATA, HalAssignSlotResources, HalGetAdapter, HalGetBusDataByOffset, HalGetInterruptVector, HalSetBusData, HalTranslateBusAddress, IoAssignResources, PCI_COMMON_CONFIG, PCI_SLOT_NUMBER