From: Sami Mujawar <sami.mujawar@arm.com>
To: edk2-devel@lists.01.org
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org,
lersek@redhat.com, julien.grall@linaro.org, evan.lloyd@arm.com,
Matteo.Carlini@arm.com, Stephanie.Hughes-Fitt@arm.com,
nd@arm.com
Subject: [PATCH v1 4/6] ArmVirtPkg: Save DT base address from X0 in PCD
Date: Fri, 12 Oct 2018 15:40:07 +0100 [thread overview]
Message-ID: <20181012144009.48732-5-sami.mujawar@arm.com> (raw)
In-Reply-To: <20181012144009.48732-1-sami.mujawar@arm.com>
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 <sami.mujawar@arm.com>
---
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)'
next prev parent reply other threads:[~2018-10-12 14:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-12 14:40 [PATCH 0/6] Add kvmtool emulated platform support for ARM Sami Mujawar
2018-10-12 14:40 ` [PATCH v1 1/6] PcAtChipsetPkg: Add MMIO Support to SerialIo Lib Sami Mujawar
2018-10-12 14:49 ` Ard Biesheuvel
2018-10-12 15:06 ` Sami Mujawar
2018-10-12 15:31 ` Kinney, Michael D
2018-10-12 15:33 ` Ard Biesheuvel
2018-10-15 2:38 ` Ni, Ruiyu
2018-10-12 14:40 ` [PATCH v1 2/6] PcAtChipsetPkg: Add MMIO Support to RTC driver Sami Mujawar
2018-10-13 10:51 ` Leif Lindholm
2018-10-12 14:40 ` [PATCH v1 3/6] MdeModulePkg: Map persistent (NV) memory Sami Mujawar
2018-10-13 9:09 ` Zeng, Star
2018-10-13 21:28 ` Laszlo Ersek
2018-10-12 14:40 ` Sami Mujawar [this message]
2018-10-13 21:35 ` [PATCH v1 4/6] ArmVirtPkg: Save DT base address from X0 in PCD Laszlo Ersek
2018-10-19 14:01 ` Ard Biesheuvel
2018-10-12 14:40 ` [PATCH v1 5/6] ArmVirtPkg: Add kvmtool platform driver Sami Mujawar
2018-10-13 21:54 ` Laszlo Ersek
2018-10-12 14:40 ` [PATCH v1 6/6] ArmVirtPkg: Support for kvmtool emulated platform Sami Mujawar
2018-10-13 21:57 ` Laszlo Ersek
2018-10-13 21:42 ` [PATCH 0/6] Add kvmtool emulated platform support for ARM Laszlo Ersek
2018-10-16 3:00 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181012144009.48732-5-sami.mujawar@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox