From: "Marcin Juszkiewicz" <marcin.juszkiewicz@linaro.org>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Leif Lindholm <quic_llindhol@quicinc.com>,
Rebecca Cran <rebecca@bsdio.com>,
Sami Mujawar <sami.mujawar@arm.com>,
Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Subject: [PATCH 2/2] Platform/SbsaQemu: read GIC base from TF-A
Date: Mon, 15 May 2023 12:24:23 +0200 [thread overview]
Message-ID: <20230515102423.359916-3-marcin.juszkiewicz@linaro.org> (raw)
In-Reply-To: <20230515102423.359916-1-marcin.juszkiewicz@linaro.org>
Qemu has versioning for sbsa-ref platform. TF-A reads data from provided
DeviceTree and provides as SMC.
This change adds reading GIC base addresses into EDK2.
Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
---
.../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 30 +++++++++++++++++++
.../SbsaQemuPlatformDxe.inf | 4 +++
2 files changed, 34 insertions(+)
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
index 199766c7014a..1213268519c8 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c
@@ -25,6 +25,8 @@
#define SIP_FUNCTION_ID(n) (SIP_FUNCTION | (n))
#define SIP_SVC_VERSION SIP_FUNCTION_ID(1)
+#define SIP_SVC_GET_GICD SIP_FUNCTION_ID(2)
+#define SIP_SVC_GET_GICR SIP_FUNCTION_ID(3)
EFI_STATUS
EFIAPI
@@ -78,5 +80,33 @@ InitializeSbsaQemuPlatformDxe (
DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Arg0, Arg1));
+ /* If we are on platform version 0.0 then there is no more data for us in DeviceTree */
+ if ((Arg0 == 0) & (Arg1 == 0))
+ {
+ return EFI_SUCCESS;
+ }
+
+ Result = ArmCallSmc0 (SIP_SVC_GET_GICD, &Arg0, NULL, NULL);
+ if (Result == SMC_ARCH_CALL_SUCCESS)
+ {
+ Result = PcdSet64S (PcdGicDistributorBase, Arg0);
+ ASSERT_EFI_ERROR (Result);
+ }
+
+ Arg0 = PcdGet64 (PcdGicDistributorBase);
+
+ DEBUG ((DEBUG_INFO, "GICD base: 0x%x\n", Arg0));
+
+ Result = ArmCallSmc0 (SIP_SVC_GET_GICR, &Arg0, NULL, NULL);
+ if (Result == SMC_ARCH_CALL_SUCCESS)
+ {
+ Result = PcdSet64S (PcdGicRedistributorsBase, Arg0);
+ ASSERT_EFI_ERROR (Result);
+ }
+
+ Arg0 = PcdGet64 (PcdGicRedistributorsBase);
+
+ DEBUG ((DEBUG_INFO, "GICR base: 0x%x\n", Arg0));
+
return EFI_SUCCESS;
}
diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
index 1f2c8a9dd6af..545794a8c7ff 100644
--- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
+++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.inf
@@ -41,6 +41,10 @@
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor
gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor
+ gArmTokenSpaceGuid.PcdGicDistributorBase
+ gArmTokenSpaceGuid.PcdGicRedistributorsBase
+
+
[Depex]
TRUE
--
2.40.1
next prev parent reply other threads:[~2023-05-15 10:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 10:24 [PATCH v4 0/2] Qemu/Sbsa versioning Marcin Juszkiewicz
2023-05-15 10:24 ` [PATCH 1/2] Platform/SbsaQemu: read platform version Marcin Juszkiewicz
2023-05-15 13:12 ` Rebecca Cran
2023-06-01 10:58 ` Leif Lindholm
2023-05-15 10:24 ` Marcin Juszkiewicz [this message]
2023-05-15 13:14 ` [PATCH 2/2] Platform/SbsaQemu: read GIC base from TF-A Rebecca Cran
2023-05-15 13:27 ` Marcin Juszkiewicz
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=20230515102423.359916-3-marcin.juszkiewicz@linaro.org \
--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