From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web10.4461.1686043297551382821 for ; Tue, 06 Jun 2023 02:21:37 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: linaro.org, ip: 213.251.184.221, mailfrom: marcin.juszkiewicz@linaro.org) Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id AE3A4260214; Tue, 6 Jun 2023 11:21:35 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at juszkiewicz.com.pl Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ho4imZurEnwi; Tue, 6 Jun 2023 11:21:33 +0200 (CEST) Received: from applejack.lan (83.21.93.182.ipv4.supernova.orange.pl [83.21.93.182]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id F05E2260698; Tue, 6 Jun 2023 11:21:31 +0200 (CEST) From: "Marcin Juszkiewicz" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Graeme Gregory , Marcin Juszkiewicz Subject: [PATCH edk2-platforms v2 2/2] Platform/SbsaQemu: read GIC base from TF-A Date: Tue, 6 Jun 2023 11:21:25 +0200 Message-Id: <20230606092125.513420-3-marcin.juszkiewicz@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606092125.513420-1-marcin.juszkiewicz@linaro.org> References: <20230606092125.513420-1-marcin.juszkiewicz@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 --- .../SbsaQemuPlatformDxe.inf | 5 +++++ .../Include/IndustryStandard/SbsaQemuSmc.h | 1 + .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPl= atformDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQem= uPlatformDxe.inf index cb1826979bd6..545794a8c7ff 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformD= xe.inf +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformD= xe.inf @@ -40,6 +40,11 @@ [Pcd] =20 gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor + + gArmTokenSpaceGuid.PcdGicDistributorBase + gArmTokenSpaceGuid.PcdGicRedistributorsBase + + [Depex] TRUE =20 diff --git a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuSmc.h= b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuSmc.h index 5a179f69b629..24ae6e390abd 100644 --- a/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuSmc.h +++ b/Silicon/Qemu/SbsaQemu/Include/IndustryStandard/SbsaQemuSmc.h @@ -9,3 +9,4 @@ #include =20 #define SIP_SVC_VERSION SMC_SIP_FUNCTION_ID(1) +#define SIP_SVC_GET_GIC SMC_SIP_FUNCTION_ID(100) diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPl= atformDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuP= latformDxe.c index 515d18564bd0..2c4ee54c3e6b 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformD= xe.c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformD= xe.c @@ -70,5 +70,23 @@ InitializeSbsaQemuPlatformDxe ( Arg1 =3D PcdGet32 (PcdPlatformVersionMinor); =20 DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Arg0, Arg1)); + + SmcResult =3D ArmCallSmc0 (SIP_SVC_GET_GIC, &Arg0, &Arg1, NULL); + if (SmcResult =3D=3D SMC_ARCH_CALL_SUCCESS) + { + Result =3D PcdSet64S (PcdGicDistributorBase, Arg0); + ASSERT_RETURN_ERROR (Result); + Result =3D PcdSet64S (PcdGicRedistributorsBase, Arg1); + ASSERT_RETURN_ERROR (Result); + } + + Arg0 =3D PcdGet64 (PcdGicDistributorBase); + + DEBUG ((DEBUG_INFO, "GICD base: 0x%x\n", Arg0)); + + Arg0 =3D PcdGet64 (PcdGicRedistributorsBase); + + DEBUG ((DEBUG_INFO, "GICR base: 0x%x\n", Arg0)); + return EFI_SUCCESS; } --=20 2.40.1