From: "sahil" <sahil@arm.com>
To: devel@edk2.groups.io
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Sami Mujawar <sami.mujawar@arm.com>,
Sahil Kaushal <sahil.kaushal@arm.com>,
thomas.abraham@arm.com, quic_llindhol@quicinc.com
Subject: Re: [edk2-devel] [edk2-platforms][PATCH V4 2/4] Platform/ARM/N1Sdp: Add N1SdpNtFwConfigPei PEI module
Date: Tue, 23 Jan 2024 14:41:10 +0530 [thread overview]
Message-ID: <CAHDJ2V7H7aowZdxdD9nUVo6oKZqmU7iFu+AtwU4npU3PEeJRDA@mail.gmail.com> (raw)
In-Reply-To: <20240104131616.474492-3-sahil@arm.com>
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 <sahil@arm.com> 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 <sahil@arm.com>
> ---
> 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.<BR>
> +#
> +# 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.<BR>
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <Library/DebugLib.h>
> +#include <Library/HobLib.h>
> +#include <Library/PeiServicesLib.h>
> +
> +#include <NeoverseN1Soc.h>
> +#include <libfdt.h>
> +
> +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]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-23 9:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-04 13:16 [edk2-devel] [edk2-platforms][PATCH V4 0/4] Add support to parse NT_FW_CONFIG sahil
2024-01-04 13:16 ` [edk2-devel] [edk2-platforms][PATCH V4 1/4] Silicon/ARM/NeoverseN1Soc: Extract NT_FW_CONFIG address passed by TF-A sahil
2024-01-23 8:58 ` sahil
2024-03-01 14:02 ` Sami Mujawar
2024-01-04 13:16 ` [edk2-devel] [edk2-platforms][PATCH V4 2/4] Platform/ARM/N1Sdp: Add N1SdpNtFwConfigPei PEI module sahil
2024-01-23 9:11 ` sahil [this message]
2024-03-01 14:23 ` Sami Mujawar
2024-01-04 13:16 ` [edk2-devel] [edk2-platforms][PATCH V4 3/4] Platform/ARM/N1Sdp: Enable N1SdpNtFwConfigPei PEI module for N1Sdp sahil
2024-01-23 9:14 ` sahil
2024-03-01 14:19 ` Sami Mujawar
2024-01-04 13:16 ` [edk2-devel] [edk2-platforms][PATCH V4 4/4] Silicon/ARM/NeoverseN1Soc: Consume N1SdpNtFwConfigPei supplied data sahil
2024-01-23 9:14 ` sahil
2024-03-01 14:22 ` Sami Mujawar
2024-01-19 11:24 ` [edk2-devel] [edk2-platforms][PATCH V4 0/4] Add support to parse NT_FW_CONFIG Sami Mujawar
2024-03-04 14:38 ` Sami Mujawar
2024-03-04 14:40 ` Sami Mujawar
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=CAHDJ2V7H7aowZdxdD9nUVo6oKZqmU7iFu+AtwU4npU3PEeJRDA@mail.gmail.com \
--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