diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec index d987035515..89e8448a84 100644 --- a/ArmVirtPkg/ArmVirtPkg.dec +++ b/ArmVirtPkg/ArmVirtPkg.dec @@ -67,6 +67,7 @@ gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0|UINT64|0x00000004 gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0|UINT64|0x00000005 + gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0|UINT64|0x00000009 # # Supported GIC revision (2, 3, ...) diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index f1af96827f..9e40f39e4b 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -199,6 +199,7 @@ gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0 gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0 + gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0 # # Set video resolution for boot options and for text setup. diff --git a/ArmVirtPkg/ArmVirtXen.dsc b/ArmVirtPkg/ArmVirtXen.dsc index 5c19afca30..ac37cd2a43 100644 --- a/ArmVirtPkg/ArmVirtXen.dsc +++ b/ArmVirtPkg/ArmVirtXen.dsc @@ -144,6 +144,7 @@ gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress|0x0 gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress|0x0 + gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress|0x0 gArmVirtTokenSpaceGuid.PcdArmPsciMethod|0 diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c index 73db63078f..74f80d1d2b 100644 --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.c @@ -302,6 +302,8 @@ InitializeVirtFdtDxe ( UINT64 FwCfgSelectorSize; UINT64 FwCfgDataAddress; UINT64 FwCfgDataSize; + UINT64 FwCfgDmaAddress; + UINT64 FwCfgDmaSize; Hob = GetFirstGuidHob(&gFdtHobGuid); if (Hob == NULL || GET_GUID_HOB_DATA_SIZE (Hob) != sizeof (UINT64)) { @@ -382,6 +384,19 @@ InitializeVirtFdtDxe ( DEBUG ((EFI_D_INFO, "Found FwCfg @ 0x%Lx/0x%Lx\n", FwCfgSelectorAddress, FwCfgDataAddress)); + + if (fdt64_to_cpu (((UINT64 *)RegProp)[1]) >= 0x18) { + FwCfgDmaAddress = FwCfgDataAddress + 0x10; + FwCfgDmaSize = 0x08; + + // + // See explanation above. + // + ASSERT (FwCfgDmaAddress <= MAX_UINTN - FwCfgDmaSize + 1); + + PcdSet64 (PcdFwCfgDmaAddress, FwCfgDmaAddress); + DEBUG ((EFI_D_INFO, "Found FwCfg DMA @ 0x%Lx\n", FwCfgDmaAddress)); + } break; case PropertyTypeVirtio: diff --git a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf index 657b4e8801..ee2503ac4a 100644 --- a/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf +++ b/ArmVirtPkg/VirtFdtDxe/VirtFdtDxe.inf @@ -53,6 +53,7 @@ gArmVirtTokenSpaceGuid.PcdArmPsciMethod gArmVirtTokenSpaceGuid.PcdFwCfgSelectorAddress gArmVirtTokenSpaceGuid.PcdFwCfgDataAddress + gArmVirtTokenSpaceGuid.PcdFwCfgDmaAddress gArmVirtTokenSpaceGuid.PcdArmGicRevision gArmTokenSpaceGuid.PcdGicDistributorBase gArmTokenSpaceGuid.PcdGicRedistributorsBase