From nobody Thu Dec 26 15:37:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104860+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104860+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1684146276; cv=none; d=zohomail.com; s=zohoarc; b=Oa81W02FHa82rW5hOLtbOiLtwbTMf9269RRpUWBiOjeIi3lnMY5v0C1ALfES2sExr/G7ykrfLg5SdS30emrwAb6TVs7Y5yoJK0qYObdBgrAFKDoN87BAeZm5bXHizpKcWUjCiw7mMaDJeEUaIJerovRVeh0S1ytkQZzZzpqgD1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684146276; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=9kaYLar466Rk17gLCzLWPplrIZzUQp8WvBF8ZaKZFaA=; b=jynIDQsQ23ifeiemVnMh+TI95CbE3T6Ku0huPrzWqPCdeNgu9/hNmLEaJj6CvGDxv4pTdKO9N4voVYa6K0wk9s22UWpMCIjLnmioS69h2V3izauUCoJvMTgyjnX7a3X7iNI7rvb062jXTdLlGCQ/vFgk7W1bBFFpVoqFZ4mqQj0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104860+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 16841462760537.224302235280106; Mon, 15 May 2023 03:24:36 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id qHYYYY1788612xe3PUuDBbdx; Mon, 15 May 2023 03:24:35 -0700 X-Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web10.85268.1684146274856299681 for ; Mon, 15 May 2023 03:24:35 -0700 X-Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id CC8A62600A6; Mon, 15 May 2023 12:24:32 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at juszkiewicz.com.pl X-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 VvE-hq3qfY-b; Mon, 15 May 2023 12:24:31 +0200 (CEST) X-Received: from applejack.lan (83.11.34.59.ipv4.supernova.orange.pl [83.11.34.59]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 9B937260BA8; Mon, 15 May 2023 12:24:30 +0200 (CEST) From: "Marcin Juszkiewicz" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Rebecca Cran , Sami Mujawar , Marcin Juszkiewicz Subject: [edk2-devel] [PATCH 1/2] Platform/SbsaQemu: read platform version Date: Mon, 15 May 2023 12:24:22 +0200 Message-Id: <20230515102423.359916-2-marcin.juszkiewicz@linaro.org> In-Reply-To: <20230515102423.359916-1-marcin.juszkiewicz@linaro.org> References: <20230515102423.359916-1-marcin.juszkiewicz@linaro.org> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,marcin.juszkiewicz@linaro.org X-Gm-Message-State: sh5Jo9mXB1j4Jz4V1y1kIyftx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684146275; bh=pdfJIGpfmq+Syhj7c9WqSPoL3EVWd1s5/uLePqm68xU=; h=Cc:Date:From:Reply-To:Subject:To; b=X5YvD33zYLvYfYHpK5pm2d7nUAHNU1RbXTjCUH5XF15FowAIgv5dDitisGVe/5etyQX /Ht+rZDiHUONN74EQ36rHv2H1eofs3PIcabEc1EJtiA5bRoLGWQ4wtPYIQis9hYyN5L89 7rqkgqxcgrNYr11TycaNhStu/txdTn26g/8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684146278074100006 Content-Type: text/plain; charset="utf-8" Qemu has versioning for sbsa-ref platform. TF-A reads it from provided DeviceTree and provides as SMC. This change adds reading platform version into EDK2. Signed-off-by: Marcin Juszkiewicz --- Platform/Qemu/SbsaQemu/SbsaQemu.dsc | 3 +++ .../SbsaQemuPlatformDxe/SbsaQemuPlatformDxe.c | 27 +++++++++++++++++++ .../SbsaQemuPlatformDxe.inf | 5 ++++ Silicon/Qemu/SbsaQemu/SbsaQemu.dec | 3 +++ 4 files changed, 38 insertions(+) diff --git a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc b/Platform/Qemu/SbsaQemu/S= bsaQemu.dsc index 0bd0df4f0239..b88729ad8ad6 100644 --- a/Platform/Qemu/SbsaQemu/SbsaQemu.dsc +++ b/Platform/Qemu/SbsaQemu/SbsaQemu.dsc @@ -558,6 +558,9 @@ DEFINE NETWORK_HTTP_BOOT_ENABLE =3D FALSE gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L"AT0000" gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L"SK0000" =20 + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0 + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0 + ##########################################################################= ###### # # Components Section - list of all EDK II Modules needed by this Platform diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.c b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatf= ormDxe.c index b7270a07abbd..199766c7014a 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .c @@ -7,15 +7,25 @@ * **/ =20 +#include #include #include #include #include #include #include +#include =20 #include =20 +/* those probably should go into IndustryStandard/ArmStdSmc.h */ +#define SMC_FASTCALL 0x80000000 +#define SMC64_FUNCTION (SMC_FASTCALL | 0x40000000) +#define SIP_FUNCTION (SMC64_FUNCTION | 0x02000000) +#define SIP_FUNCTION_ID(n) (SIP_FUNCTION | (n)) + +#define SIP_SVC_VERSION SIP_FUNCTION_ID(1) + EFI_STATUS EFIAPI InitializeSbsaQemuPlatformDxe ( @@ -26,6 +36,9 @@ InitializeSbsaQemuPlatformDxe ( EFI_STATUS Status; UINTN Size; VOID* Base; + UINTN Arg0; + UINTN Arg1; + UINTN Result; =20 DEBUG ((DEBUG_INFO, "%a: InitializeSbsaQemuPlatformDxe called\n", __FUNC= TION__)); =20 @@ -51,5 +64,19 @@ InitializeSbsaQemuPlatformDxe ( return Status; } =20 + Result =3D ArmCallSmc0 (SIP_SVC_VERSION, &Arg0, &Arg1, NULL); + if (Result =3D=3D SMC_ARCH_CALL_SUCCESS) + { + Result =3D PcdSet32S (PcdPlatformVersionMajor, Arg0); + ASSERT_EFI_ERROR (Result); + Result =3D PcdSet32S (PcdPlatformVersionMinor, Arg1); + ASSERT_EFI_ERROR (Result); + } + + Arg0 =3D PcdGet32 (PcdPlatformVersionMajor); + Arg1 =3D PcdGet32 (PcdPlatformVersionMinor); + + DEBUG ((DEBUG_INFO, "Platform version: %d.%d\n", Arg0, Arg1)); + return EFI_SUCCESS; } diff --git a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlat= formDxe.inf b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPla= tformDxe.inf index 21d2135f6d17..1f2c8a9dd6af 100644 --- a/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .inf +++ b/Silicon/Qemu/SbsaQemu/Drivers/SbsaQemuPlatformDxe/SbsaQemuPlatformDxe= .inf @@ -20,6 +20,7 @@ SbsaQemuPlatformDxe.c =20 [Packages] + ArmPkg/ArmPkg.dec ArmVirtPkg/ArmVirtPkg.dec EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec @@ -27,6 +28,7 @@ Silicon/Qemu/SbsaQemu/SbsaQemu.dec =20 [LibraryClasses] + ArmSmcLib PcdLib DebugLib NonDiscoverableDeviceRegistrationLib @@ -36,6 +38,9 @@ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciBase gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformAhciSize =20 + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor + [Depex] TRUE =20 diff --git a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec b/Silicon/Qemu/SbsaQemu/Sbs= aQemu.dec index 9448852967b6..5182978cf56d 100644 --- a/Silicon/Qemu/SbsaQemu/SbsaQemu.dec +++ b/Silicon/Qemu/SbsaQemu/SbsaQemu.dec @@ -67,3 +67,6 @@ gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisManufacturer|L""|VOID*|= 0x0000011B gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisAssetTag|L""|VOID*|0x00= 00011C gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdChassisSKU|L""|VOID*|0x0000011D + + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMajor|0x0|UINT3= 2|0x0000011E + gArmVirtSbsaQemuPlatformTokenSpaceGuid.PcdPlatformVersionMinor|0x0|UINT3= 2|0x0000011F --=20 2.40.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104860): https://edk2.groups.io/g/devel/message/104860 Mute This Topic: https://groups.io/mt/98900379/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-