BOOLEAN
HalTranslateBusAddress(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN PHYSICAL_ADDRESS BusAddress,
IN OUT PULONG AddressSpace,
OUT PPHYSICAL_ADDRESS TranslatedAddress
);
HalTranslateBusAddress translates a bus-specific address into the corresponding system logical address.
A return value of TRUE indicates the system logical address corresponding to the given BusNumber and BusAddress has been returned in TranslatedAddress.
The value returned for TranslatedAddress must be used in a subsequent call to MmMapIoSpace if the AddressSpace value of zero is returned.
There are many ways to connect a peripheral bus into a system. The memory address space of the bus, referred to as the logical address space, can be directly merged with the physical address space of the host, or some mapping may be involved. Also, some machines can have more than one bus, or a bus can have more than one address space, as in having separate memory and I/O addresses.
A device driver calls HalTranslateBusAddress to perform this translation. The parameters to this routine include a bus number to support platforms with more than one bus of the same InterfaceType, the bus address to be translated, and an AddressSpace specifier typically used to differentiate between memory and I/O space, if these are separate. The driver might obtain these parameters from the registry, by calling HalGetBusData or HalGetBusDataByOffset and interrogating the device hardware, by calling IoAssignResources or HalAssignSlotResources, or by using defaults and claiming them in the registry.
Callers of HalTranslateBusAddress must be running at IRQL <= DISPATCH_LEVEL. Usually, the caller is running at IRQL PASSIVE_LEVEL, because this routine is seldom called except when a driver is initializing.
HalAssignSlotResources, HalGetBusData, HalGetBusDataByOffset, IoAssignResources, MmMapIoSpace