]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h
MdeModulePkg/PciHostBridgeDxe: Add support for address translation
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciHostBridgeDxe / PciHostBridge.h
index 9a8ca21f4819e33e5911174aa0c6a75d6b60359a..c2791ea5c2a4fb74465354a693ed7b7e60002d4d 100644 (file)
@@ -37,6 +37,13 @@ typedef struct {
 \r
 #define PCI_HOST_BRIDGE_FROM_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)\r
 \r
+//\r
+// Macros to translate device address to host address and vice versa. According\r
+// to UEFI 2.7, device address = host address + translation offset.\r
+//\r
+#define TO_HOST_ADDRESS(DeviceAddress,TranslationOffset) ((DeviceAddress) - (TranslationOffset))\r
+#define TO_DEVICE_ADDRESS(HostAddress,TranslationOffset) ((HostAddress) + (TranslationOffset))\r
+\r
 //\r
 // Driver Entry Point\r
 //\r
@@ -247,6 +254,20 @@ ResourceConflict (
   IN  PCI_HOST_BRIDGE_INSTANCE *HostBridge\r
   );\r
 \r
+/**\r
+  This routine gets translation offset from a root bridge instance by resource type.\r
+\r
+  @param RootBridge The Root Bridge Instance for the resources.\r
+  @param ResourceType The Resource Type of the translation offset.\r
+\r
+  @retval The Translation Offset of the specified resource.\r
+**/\r
+UINT64\r
+GetTranslationByResourceType (\r
+  IN  PCI_ROOT_BRIDGE_INSTANCE     *RootBridge,\r
+  IN  PCI_RESOURCE_TYPE            ResourceType\r
+  );\r
+\r
 extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;\r
 extern EFI_CPU_IO2_PROTOCOL        *mCpuIo;\r
 #endif\r