/* Map the position (serial number) of an extra PCI root bus to its bus number. */
EFI_STATUS MapRootBusPosToBusNr(IN CONST EXTRA_ROOT_BUS_MAP *ExtraRootBusMap, IN UINT64 RootBusPos, OUT UINT32 *RootBusNr)
/* Map the position (serial number) of an extra PCI root bus to its bus number. */
EFI_STATUS MapRootBusPosToBusNr(IN CONST EXTRA_ROOT_BUS_MAP *ExtraRootBusMap, IN UINT64 RootBusPos, OUT UINT32 *RootBusNr)
{
  if (RootBusPos == 0) {
    return EFI_INVALID_PARAMETER;
  }
  if (RootBusPos > ExtraRootBusMap->Count) {
    return EFI_NOT_FOUND;
  }
  *RootBusNr = ExtraRootBusMap->BusNumbers[(UINTN)RootBusPos - 1];
  return EFI_SUCCESS;
}