/* Use address to match apertures of memory type and then get the corresponding translation. */
EFI_STATUS RootBridgeIoGetMemTranslationByAddress(IN PCI_ROOT_BRIDGE_INSTANCE *RootBridge, IN UINT64 Address, IN OUT UINT64 *Translation)
/* Use address to match apertures of memory type and then get the corresponding translation. */
EFI_STATUS RootBridgeIoGetMemTranslationByAddress(IN PCI_ROOT_BRIDGE_INSTANCE *RootBridge, IN UINT64 Address, IN OUT UINT64 *Translation)
{
  if ((Address >= RootBridge->Mem.Base) && (Address <= RootBridge->Mem.Limit)) {
    *Translation = RootBridge->Mem.Translation;
  } else if ((Address >= RootBridge->PMem.Base) && (Address <= RootBridge->PMem.Limit)) {
    *Translation = RootBridge->PMem.Translation;
  } else if ((Address >= RootBridge->MemAbove4G.Base) && (Address <= RootBridge->MemAbove4G.Limit)) {
    *Translation = RootBridge->MemAbove4G.Translation;
  } else if ((Address >= RootBridge->PMemAbove4G.Base) && (Address <= RootBridge->PMemAbove4G.Limit)) {
    *Translation = RootBridge->PMemAbove4G.Translation;
  } else {
    return EFI_INVALID_PARAMETER;
  }
  return EFI_SUCCESS;
}