From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 0CA9BD80D4E for ; Thu, 4 Jan 2024 13:16:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=n1gk6XM++IvTIscLNsY4eH/JB2+UFT+7yjrcnhznrr0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1704374190; v=1; b=Yd+47Vm/4JkuxYLaX2J0vKXX167X+BoFBIXtNkFVwEqHCKVz02/775d7Ilym2JnvsvWyCl1z oBU0Jl/WX5OCOw8V1QseLWUKTMrUt+3oSkB2VPplS+ZiS1kbbzxgw6LZ07ze0tlVPIv87HU47Hi r0zo7FWV4eb7XcpLE1YaA48U= X-Received: by 127.0.0.2 with SMTP id jrd2YY7687511xhfnYs5tIyY; Thu, 04 Jan 2024 05:16:30 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.53582.1704374190050949074 for ; Thu, 04 Jan 2024 05:16:30 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8D7EFC15; Thu, 4 Jan 2024 05:17:15 -0800 (PST) X-Received: from usa.arm.com (a077434.blr.arm.com [10.162.17.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0CE693F64C; Thu, 4 Jan 2024 05:16:27 -0800 (PST) From: "sahil" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Sahil Kaushal Subject: [edk2-devel] [edk2-platforms][PATCH V4 2/4] Platform/ARM/N1Sdp: Add N1SdpNtFwConfigPei PEI module Date: Thu, 4 Jan 2024 18:46:14 +0530 Message-Id: <20240104131616.474492-3-sahil@arm.com> In-Reply-To: <20240104131616.474492-1-sahil@arm.com> References: <20240104131616.474492-1-sahil@arm.com> MIME-Version: 1.0 Precedence: Bulk 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,sahil@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: xObELlhngGTgYdc3i9942uvGx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="Yd+47Vm/"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none) This patch adds a PEI to parse NT_FW_CONFIG and pass it to other PEI modules(as PPI) and DXE modules(as HOB). Signed-off-by: sahil --- Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.inf | 41 ++++= ++ Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.c | 132 ++++= ++++++++++++++++ 2 files changed, 173 insertions(+) diff --git a/Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.in= f b/Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.inf new file mode 100644 index 000000000000..363351b5a1df --- /dev/null +++ b/Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.inf @@ -0,0 +1,41 @@ +## @file=0D +# This PEI module parse the NtFwConfig for N1Sdp platform and produce=0D +# the PPI and HOB.=0D +#=0D +# Copyright (c) 2024, ARM Limited. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x0001001B=0D + BASE_NAME =3D N1SdpNtFwConfigPei=0D + FILE_GUID =3D CE76D56C-D3A5-4763-9138-DF09E1D1B614= =0D + MODULE_TYPE =3D PEIM=0D + VERSION_STRING =3D 1.0=0D + ENTRY_POINT =3D NtFwConfigPeEntryPoint=0D +=0D +[Sources]=0D + NtFwConfigPei.c=0D +=0D +[Packages]=0D + EmbeddedPkg/EmbeddedPkg.dec=0D + MdePkg/MdePkg.dec=0D + Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec=0D +=0D +[LibraryClasses]=0D + DebugLib=0D + FdtLib=0D + HobLib=0D + PeimEntryPoint=0D +=0D +[Ppis]=0D + gArmNeoverseN1SocPlatformInfoDescriptorPpiGuid=0D + gArmNeoverseN1SocParameterPpiGuid=0D +=0D +[Guids]=0D + gArmNeoverseN1SocPlatformInfoDescriptorGuid=0D +=0D +[Depex]=0D + gArmNeoverseN1SocParameterPpiGuid=0D diff --git a/Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.c = b/Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.c new file mode 100644 index 000000000000..330377d21a79 --- /dev/null +++ b/Platform/ARM/N1Sdp/Drivers/N1SdpNtFwConfigPei/NtFwConfigPei.c @@ -0,0 +1,132 @@ +/** @file=0D +=0D + Copyright (c) 2024, ARM Limited. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +=0D +#include =0D +#include =0D +=0D +STATIC EFI_PEI_PPI_DESCRIPTOR mPpi;=0D +=0D +/**=0D + The entrypoint of the module, parse NtFwConfig and produce the PPI and H= OB.=0D +=0D + @param[in] FileHandle Handle of the file being invoked.=0D + @param[in] PeiServices Describes the list of possible PEI Services= .=0D +=0D + @retval EFI_SUCCESS Either no NT_FW_CONFIG was given by EL3 fir= mware=0D + OR the N1Sdp FDT HOB was successfully creat= ed.=0D + @retval EFI_NOT_FOUND Error processing the DTB=0D + @retval EFI_OUT_OF_RESOURCES Could not allocate memory for the HOB=0D + @retval * Other errors are possible.=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +NtFwConfigPeEntryPoint (=0D + IN EFI_PEI_FILE_HANDLE FileHandle,=0D + IN CONST EFI_PEI_SERVICES **PeiServices=0D + )=0D +{=0D + CONST NEOVERSEN1SOC_EL3_FW_HANDOFF_PARAM_PPI *ParamPpi;=0D + CONST UINT32 *Property;=0D + INT32 Offset;=0D + NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D + INT32 Status;=0D +=0D + PlatInfo =3D BuildGuidHob (=0D + &gArmNeoverseN1SocPlatformInfoDescriptorGuid,=0D + sizeof (*PlatInfo)=0D + );=0D +=0D + if (PlatInfo =3D=3D NULL) {=0D + DEBUG ((=0D + DEBUG_ERROR,=0D + "[%a]: failed to allocate platform info HOB\n",=0D + gEfiCallerBaseName=0D + ));=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D +=0D + Status =3D PeiServicesLocatePpi (=0D + &gArmNeoverseN1SocParameterPpiGuid,=0D + 0,=0D + NULL,=0D + (VOID **)&ParamPpi=0D + );=0D +=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((=0D + DEBUG_ERROR,=0D + "[%a]: failed to locate gArmNeoverseN1SocParameterPpiGuid - %r\n",=0D + gEfiCallerBaseName,=0D + Status=0D + ));=0D + return Status;=0D + }=0D +=0D + if (fdt_check_header (ParamPpi->NtFwConfig) !=3D 0) {=0D + DEBUG ((DEBUG_ERROR, "Invalid DTB file %p passed\n", ParamPpi->NtFwCon= fig));=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + Offset =3D fdt_subnode_offset (ParamPpi->NtFwConfig, 0, "platform-info")= ;=0D + if (Offset =3D=3D -FDT_ERR_NOTFOUND) {=0D + DEBUG ((DEBUG_ERROR, "Invalid DTB : platform-info node not found\n"));= =0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + Property =3D fdt_getprop (ParamPpi->NtFwConfig, Offset, "local-ddr-size"= , NULL);=0D + if (Property =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "local-ddr-size property not found\n"));=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + PlatInfo->LocalDdrSize =3D fdt32_to_cpu (*Property);=0D +=0D + Property =3D fdt_getprop (ParamPpi->NtFwConfig, Offset, "remote-ddr-size= ", NULL);=0D + if (Property =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "remote-ddr-size property not found\n"));=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + PlatInfo->RemoteDdrSize =3D fdt32_to_cpu (*Property);=0D +=0D + Property =3D fdt_getprop (ParamPpi->NtFwConfig, Offset, "secondary-chip-= count", NULL);=0D + if (Property =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "secondary-chip-count property not found\n"));=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + PlatInfo->SecondaryChipCount =3D fdt32_to_cpu (*Property);=0D +=0D + Property =3D fdt_getprop (ParamPpi->NtFwConfig, Offset, "multichip-mode"= , NULL);=0D + if (Property =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "multichip-mode property not found\n"));=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + PlatInfo->MultichipMode =3D fdt32_to_cpu (*Property);=0D +=0D + mPpi.Flags =3D EFI_PEI_PPI_DESCRIPTOR_PPI=0D + | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;=0D + mPpi.Guid =3D &gArmNeoverseN1SocPlatformInfoDescriptorPpiGuid;=0D + mPpi.Ppi =3D PlatInfo;=0D +=0D + Status =3D PeiServicesInstallPpi (&mPpi);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((=0D + DEBUG_ERROR,=0D + "[%a]: failed to install PEI service - %r\n",=0D + gEfiCallerBaseName,=0D + Status=0D + ));=0D + }=0D +=0D + return Status;=0D +}=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113165): https://edk2.groups.io/g/devel/message/113165 Mute This Topic: https://groups.io/mt/103521644/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-