Some virtual machine managers provide the base address of the DT in memory in the X0 register. Save the DT Base address in the PcdDeviceTreeInitialBaseAddress so that the firmware can use the PCD to parse the DT and obtain the platform information subsequently.
This change also requires that the PcdDeviceTreeInitialBaseAddress be a Dynamic PCD. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Sami Mujawar <[email protected]> --- The changes can be seen at https://github.com/samimujawar/edk2/commit/57ffa0da043fd73907b24a6833d2797ea3dae564 Notes: v1: - Enable loading of DT from base address passed in X0. [SAMI] ArmVirtPkg/ArmVirtPkg.dec | 12 ++++++++---- ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S | 9 +++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec index 8f656fd2739dd1460891029f53953c765396f8fb..9d4b782a43e505079263ded2347dff2304c2a75c 100644 --- a/ArmVirtPkg/ArmVirtPkg.dec +++ b/ArmVirtPkg/ArmVirtPkg.dec @@ -42,15 +42,19 @@ [Guids.common] [Protocols] gFdtClientProtocolGuid = { 0xE11FACA0, 0x4710, 0x4C8E, { 0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C } } -[PcdsFixedAtBuild, PcdsPatchableInModule] +[PcdsFixedAtBuild.common, PcdsDynamic.common, PcdsPatchableInModule.common] # # This is the physical address where the device tree is expected to be stored - # upon first entry into UEFI. This needs to be a FixedAtBuild PCD, so that we - # can do a first pass over the device tree in the SEC phase to discover the - # UART base address. + # upon first entry into UEFI. In some cases this needs to be a FixedAtBuild + # PCD, so that we can do a first pass over the device tree in the SEC phase + # to discover the UART base address. In other cases where the base address + # for the DT is passed in X0 (by an earlier firmware stage or by a virtual + # machine manager), this needs to be a PcdsDynamic so that the value can be + # updated. # gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress|0x0|UINT64|0x00000001 +[PcdsFixedAtBuild] # # Padding in bytes to add to the device tree allocation, so that the DTB can # be modified in place (default: 256 bytes) diff --git a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S index 891cf1fcab400c0842035be6a2fb003bafd63040..b5f8c9dd3c6a2bd2c937ff3891b2f51be65094d4 100644 --- a/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S +++ b/ArmVirtPkg/PrePi/AArch64/ModuleEntryPoint.S @@ -1,5 +1,5 @@ // -// Copyright (c) 2011-2013, ARM Limited. All rights reserved. +// Copyright (c) 2011-2018, ARM Limited. All rights reserved. // Copyright (c) 2015-2016, Linaro Limited. All rights reserved. // // This program and the accompanying materials @@ -143,8 +143,13 @@ ASM_PFX(DiscoverDramFromDt): // cbnz x0, 0f ldr x0, PcdGet64 (PcdDeviceTreeInitialBaseAddress) + b 1f -0:mov x29, x30 // preserve LR + // Store the device tree base address. +0:adr x8, PcdGet64 (PcdDeviceTreeInitialBaseAddress) + str x0, [x8] + +1:mov x29, x30 // preserve LR mov x28, x0 // preserve DTB pointer mov x27, x1 // preserve base of image pointer -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

