diff options
author | Heyi Guo <heyi.guo@linaro.org> | 2018-02-27 19:53:34 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-03-19 10:33:32 +0800 |
commit | 0e1be48bdd41d26daf06c8ee3d85a4f2d427e2bd (patch) | |
tree | c0942e43ddc967a3cb03d7fee1c155f9591709f6 /MdeModulePkg/Include | |
parent | 35700831290eb0dd67ad92b4866f3ec0f60f48eb (diff) | |
download | edk2-0e1be48bdd41d26daf06c8ee3d85a4f2d427e2bd.tar.gz edk2-0e1be48bdd41d26daf06c8ee3d85a4f2d427e2bd.tar.bz2 edk2-0e1be48bdd41d26daf06c8ee3d85a4f2d427e2bd.zip |
MdeModulePkg/PciHostBridgeLib.h: add address Translation
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>
(cherry picked from commit 5bb1866e5383f3f54252d9838c2dd53759ffc4af)
Diffstat (limited to 'MdeModulePkg/Include')
-rw-r--r-- | MdeModulePkg/Include/Library/PciHostBridgeLib.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/MdeModulePkg/Include/Library/PciHostBridgeLib.h b/MdeModulePkg/Include/Library/PciHostBridgeLib.h index d42e9ecdd7..18963a0d38 100644 --- a/MdeModulePkg/Include/Library/PciHostBridgeLib.h +++ b/MdeModulePkg/Include/Library/PciHostBridgeLib.h @@ -20,8 +20,27 @@ // (Base > Limit) indicates an aperture is not available.
//
typedef struct {
+ //
+ // Base and Limit are the device address instead of host address when
+ // Translation is not zero
+ //
UINT64 Base;
UINT64 Limit;
+ //
+ // According to UEFI 2.7, Device Address = Host Address + Translation,
+ // so Translation = Device Address - Host Address.
+ // On platforms where Translation is not zero, the subtraction is probably to
+ // be performed with UINT64 wrap-around semantics, for we may translate an
+ // above-4G host address into a below-4G device address for legacy PCIe device
+ // compatibility.
+ //
+ // NOTE: The alignment of Translation is required to be larger than any BAR
+ // alignment in the same root bridge, so that the same alignment can be
+ // applied to both device address and host address, which simplifies the
+ // situation and makes the current resource allocation code in generic PCI
+ // host bridge driver still work.
+ //
+ UINT64 Translation;
} PCI_ROOT_BRIDGE_APERTURE;
typedef struct {
|