#\r
gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x0|UINT64|0x00000001\r
\r
+ #\r
+ # Padding in bytes to add to the device tree allocation, so that the DTB can\r
+ # be modified in place (default: 256 bytes)\r
+ #\r
+ gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeAllocationPadding|256|UINT32|0x00000002\r
+\r
[PcdsDynamic, PcdsFixedAtBuild]\r
#\r
# ARM PSCI function invocations can be done either through hypervisor\r
VOID *Base;\r
VOID *NewBase;\r
UINTN FdtSize;\r
+ UINTN FdtPages;\r
UINT64 *FdtHobData;\r
UINT64 *UartHobData;\r
INT32 Node, Prev;\r
ASSERT (Base != NULL);\r
ASSERT (fdt_check_header (Base) == 0);\r
\r
- FdtSize = fdt_totalsize (Base);\r
- NewBase = AllocatePages (EFI_SIZE_TO_PAGES (FdtSize));\r
+ FdtSize = fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadding);\r
+ FdtPages = EFI_SIZE_TO_PAGES (FdtSize);\r
+ NewBase = AllocatePages (FdtPages);\r
ASSERT (NewBase != NULL);\r
- CopyMem (NewBase, Base, FdtSize);\r
+ fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));\r
\r
FdtHobData = BuildGuidHob (&gFdtHobGuid, sizeof *FdtHobData);\r
ASSERT (FdtHobData != NULL);\r
gArmTokenSpaceGuid.PcdFvBaseAddress\r
gArmTokenSpaceGuid.PcdFvSize\r
gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress\r
+ gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeAllocationPadding\r
\r
[Guids]\r
gEarlyPL011BaseAddressGuid\r