]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/PciHostBridgeLib.h: add address Translation
authorHeyi Guo <heyi.guo@linaro.org>
Tue, 27 Feb 2018 11:53:34 +0000 (19:53 +0800)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 15 Mar 2018 08:26:05 +0000 (08:26 +0000)
Add Translation field to PCI_ROOT_BRIDGE_APERTURE. Translation is used
to represent the difference between device address and host address,
if they are not the same on some platforms.

In UEFI 2.7, "Address Translation Offset" is "Offset to apply to the
Starting address to convert it to a PCI address".  This means:

  Translation = device address - host address

So we also use the above calculation for this Translation field to
keep consistent.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Signed-off-by: Yi Li <phoenix.liyi@huawei.com>
Reviewed-by: Ni Ruiyu <ruiyu.ni@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
MdeModulePkg/Include/Library/PciHostBridgeLib.h

index d42e9ecdd76306db9aec1ca6485bf5569b1eca44..18963a0d3821760aad37b54b493134b47c3ce41e 100644 (file)
 // (Base > Limit) indicates an aperture is not available.\r
 //\r
 typedef struct {\r
 // (Base > Limit) indicates an aperture is not available.\r
 //\r
 typedef struct {\r
+  //\r
+  // Base and Limit are the device address instead of host address when\r
+  // Translation is not zero\r
+  //\r
   UINT64 Base;\r
   UINT64 Limit;\r
   UINT64 Base;\r
   UINT64 Limit;\r
+  //\r
+  // According to UEFI 2.7, Device Address = Host Address + Translation,\r
+  // so Translation = Device Address - Host Address.\r
+  // On platforms where Translation is not zero, the subtraction is probably to\r
+  // be performed with UINT64 wrap-around semantics, for we may translate an\r
+  // above-4G host address into a below-4G device address for legacy PCIe device\r
+  // compatibility.\r
+  //\r
+  // NOTE: The alignment of Translation is required to be larger than any BAR\r
+  // alignment in the same root bridge, so that the same alignment can be\r
+  // applied to both device address and host address, which simplifies the\r
+  // situation and makes the current resource allocation code in generic PCI\r
+  // host bridge driver still work.\r
+  //\r
+  UINT64 Translation;\r
 } PCI_ROOT_BRIDGE_APERTURE;\r
 \r
 typedef struct {\r
 } PCI_ROOT_BRIDGE_APERTURE;\r
 \r
 typedef struct {\r