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 988E194135C for ; Tue, 23 Jan 2024 09:11:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=OyAReC6CCQ8oSR8EGNc+2J/btgHlIJw+v8xnRrYVrcg=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20140610; t=1706001083; v=1; b=kysQgZ2zh9tad75yTUAG60FvAOZmif5XBkHyn53gZZq+cj9U/RweAPCYq+zzaDSV97XaXudN GHlElb4TYyI3tfl1iPMRnbRsJMkzQPt8p4eqthCl6uKJRQDPL/EuLMPiI/Afo4wIeNkpJ91pT3F aoW9pJupbf089jqH930eJHxw= X-Received: by 127.0.0.2 with SMTP id aUn8YY7687511xDRuD8o506q; Tue, 23 Jan 2024 01:11:23 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.8000.1706001082255006361 for ; Tue, 23 Jan 2024 01:11:22 -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 2F3DC113E for ; Tue, 23 Jan 2024 01:12:07 -0800 (PST) X-Received: from mail-pf1-f173.google.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AF8E73F5A1 for ; Tue, 23 Jan 2024 01:11:21 -0800 (PST) X-Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-6dbcc7647c9so2074642b3a.0 for ; Tue, 23 Jan 2024 01:11:21 -0800 (PST) X-Gm-Message-State: 2QtMJUgeghMyy1quWj4SnoZ8x7686176AA= X-Google-Smtp-Source: AGHT+IHj2lmft4Kh14NFiMqsfOTDwRI0dYGJGXX9pFdpKm6f17Mk3e4awL0qAI4HfMXL/APSeBWqk+xL0rHrW4SaSS4= X-Received: by 2002:a05:6a21:3394:b0:199:f335:449c with SMTP id yy20-20020a056a21339400b00199f335449cmr2780195pzb.45.1706001081046; Tue, 23 Jan 2024 01:11:21 -0800 (PST) MIME-Version: 1.0 References: <20240104131616.474492-1-sahil@arm.com> <20240104131616.474492-3-sahil@arm.com> In-Reply-To: <20240104131616.474492-3-sahil@arm.com> From: "sahil" Date: Tue, 23 Jan 2024 14:41:10 +0530 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [edk2-devel] [edk2-platforms][PATCH V4 2/4] Platform/ARM/N1Sdp: Add N1SdpNtFwConfigPei PEI module To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar , Sahil Kaushal , thomas.abraham@arm.com, quic_llindhol@quicinc.com 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: Content-Type: text/plain; charset="UTF-8" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=kysQgZ2z; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hi All, Please find the links to previous discussions below : V1 - https://edk2.groups.io/g/devel/topic/96088980#100022 V2 - https://edk2.groups.io/g/devel/topic/96671861#103652 V3 - https://edk2.groups.io/g/devel/topic/100912169#112452 Thanks, Sahil On Thu, 4 Jan 2024 at 18:46, sahil wrote: > > 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.inf 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 > +# This PEI module parse the NtFwConfig for N1Sdp platform and produce > +# the PPI and HOB. > +# > +# Copyright (c) 2024, ARM Limited. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION = 0x0001001B > + BASE_NAME = N1SdpNtFwConfigPei > + FILE_GUID = CE76D56C-D3A5-4763-9138-DF09E1D1B614 > + MODULE_TYPE = PEIM > + VERSION_STRING = 1.0 > + ENTRY_POINT = NtFwConfigPeEntryPoint > + > +[Sources] > + NtFwConfigPei.c > + > +[Packages] > + EmbeddedPkg/EmbeddedPkg.dec > + MdePkg/MdePkg.dec > + Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec > + > +[LibraryClasses] > + DebugLib > + FdtLib > + HobLib > + PeimEntryPoint > + > +[Ppis] > + gArmNeoverseN1SocPlatformInfoDescriptorPpiGuid > + gArmNeoverseN1SocParameterPpiGuid > + > +[Guids] > + gArmNeoverseN1SocPlatformInfoDescriptorGuid > + > +[Depex] > + gArmNeoverseN1SocParameterPpiGuid > 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 > + > + Copyright (c) 2024, ARM Limited. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > + > +#include > +#include > + > +STATIC EFI_PEI_PPI_DESCRIPTOR mPpi; > + > +/** > + The entrypoint of the module, parse NtFwConfig and produce the PPI and HOB. > + > + @param[in] FileHandle Handle of the file being invoked. > + @param[in] PeiServices Describes the list of possible PEI Services. > + > + @retval EFI_SUCCESS Either no NT_FW_CONFIG was given by EL3 firmware > + OR the N1Sdp FDT HOB was successfully created. > + @retval EFI_NOT_FOUND Error processing the DTB > + @retval EFI_OUT_OF_RESOURCES Could not allocate memory for the HOB > + @retval * Other errors are possible. > +**/ > +EFI_STATUS > +EFIAPI > +NtFwConfigPeEntryPoint ( > + IN EFI_PEI_FILE_HANDLE FileHandle, > + IN CONST EFI_PEI_SERVICES **PeiServices > + ) > +{ > + CONST NEOVERSEN1SOC_EL3_FW_HANDOFF_PARAM_PPI *ParamPpi; > + CONST UINT32 *Property; > + INT32 Offset; > + NEOVERSEN1SOC_PLAT_INFO *PlatInfo; > + INT32 Status; > + > + PlatInfo = BuildGuidHob ( > + &gArmNeoverseN1SocPlatformInfoDescriptorGuid, > + sizeof (*PlatInfo) > + ); > + > + if (PlatInfo == NULL) { > + DEBUG (( > + DEBUG_ERROR, > + "[%a]: failed to allocate platform info HOB\n", > + gEfiCallerBaseName > + )); > + return EFI_OUT_OF_RESOURCES; > + } > + > + Status = PeiServicesLocatePpi ( > + &gArmNeoverseN1SocParameterPpiGuid, > + 0, > + NULL, > + (VOID **)&ParamPpi > + ); > + > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "[%a]: failed to locate gArmNeoverseN1SocParameterPpiGuid - %r\n", > + gEfiCallerBaseName, > + Status > + )); > + return Status; > + } > + > + if (fdt_check_header (ParamPpi->NtFwConfig) != 0) { > + DEBUG ((DEBUG_ERROR, "Invalid DTB file %p passed\n", ParamPpi->NtFwConfig)); > + return EFI_NOT_FOUND; > + } > + > + Offset = fdt_subnode_offset (ParamPpi->NtFwConfig, 0, "platform-info"); > + if (Offset == -FDT_ERR_NOTFOUND) { > + DEBUG ((DEBUG_ERROR, "Invalid DTB : platform-info node not found\n")); > + return EFI_NOT_FOUND; > + } > + > + Property = fdt_getprop (ParamPpi->NtFwConfig, Offset, "local-ddr-size", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "local-ddr-size property not found\n")); > + return EFI_NOT_FOUND; > + } > + > + PlatInfo->LocalDdrSize = fdt32_to_cpu (*Property); > + > + Property = fdt_getprop (ParamPpi->NtFwConfig, Offset, "remote-ddr-size", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "remote-ddr-size property not found\n")); > + return EFI_NOT_FOUND; > + } > + > + PlatInfo->RemoteDdrSize = fdt32_to_cpu (*Property); > + > + Property = fdt_getprop (ParamPpi->NtFwConfig, Offset, "secondary-chip-count", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "secondary-chip-count property not found\n")); > + return EFI_NOT_FOUND; > + } > + > + PlatInfo->SecondaryChipCount = fdt32_to_cpu (*Property); > + > + Property = fdt_getprop (ParamPpi->NtFwConfig, Offset, "multichip-mode", NULL); > + if (Property == NULL) { > + DEBUG ((DEBUG_ERROR, "multichip-mode property not found\n")); > + return EFI_NOT_FOUND; > + } > + > + PlatInfo->MultichipMode = fdt32_to_cpu (*Property); > + > + mPpi.Flags = EFI_PEI_PPI_DESCRIPTOR_PPI > + | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; > + mPpi.Guid = &gArmNeoverseN1SocPlatformInfoDescriptorPpiGuid; > + mPpi.Ppi = PlatInfo; > + > + Status = PeiServicesInstallPpi (&mPpi); > + if (EFI_ERROR (Status)) { > + DEBUG (( > + DEBUG_ERROR, > + "[%a]: failed to install PEI service - %r\n", > + gEfiCallerBaseName, > + Status > + )); > + } > + > + return Status; > +} > -- > 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/7175337 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [sahilkaushal05@gmail.com] > ------------ > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114186): https://edk2.groups.io/g/devel/message/114186 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] -=-=-=-=-=-=-=-=-=-=-=-