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 3E2197803CC for ; Thu, 4 Jan 2024 13:16:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=XEn0Z8XKgrF102S5Vuhev54AQUPvMkz4/MIqjjgz0QY=; 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=1704374194; v=1; b=vUnNSS6XBhhBiVqG03bDWeDRB/iDgcS0EL6XzAG2DOstMCMUBaDXlilE0+ohdgKSEi5drPYx MP20qFUGLHKQF1px/ImR5WG/rs8GF47EN0/yHUUIV+klaMLF6mdM/OZVvZjrBkdVD8nr1F77I0V ndLr2980lc6wcoukz2j0zcKg= X-Received: by 127.0.0.2 with SMTP id 2qVOYY7687511xP7QAmm51Hy; Thu, 04 Jan 2024 05:16:34 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.53387.1704374194377870858 for ; Thu, 04 Jan 2024 05:16:34 -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 EA16AC15; Thu, 4 Jan 2024 05:17:19 -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 69BE33F64C; Thu, 4 Jan 2024 05:16:32 -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 4/4] Silicon/ARM/NeoverseN1Soc: Consume N1SdpNtFwConfigPei supplied data Date: Thu, 4 Jan 2024 18:46:16 +0530 Message-Id: <20240104131616.474492-5-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: p9sN53YvTwRgzVsvDmjOD21Zx7686176AA= 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=vUnNSS6X; 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 N1SdpNtFwConfigPei PEIM extracts platform information from NT_FW_CONFIG and provides it to other modules as a PPI and a HOB. PlatformLibMem then consumes these values in the form of a PPI during PEI phase and ConfigurationManagerDxe as a HOB during DXE phase. The previous approach of fetching platform information from a fixed address is also removed in this patch. Signed-off-by: sahil --- Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Configurat= ionManagerDxe.inf | 6 +++- Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.inf = | 1 + Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Configurat= ionManager.h | 5 ++- Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h = | 5 --- Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Configurat= ionManager.c | 33 +++++++++--------- Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c = | 35 +++++++++++++++----- 6 files changed, 55 insertions(+), 30 deletions(-) diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDx= e/ConfigurationManagerDxe.inf b/Platform/ARM/N1Sdp/ConfigurationManager/Con= figurationManagerDxe/ConfigurationManagerDxe.inf index 4f8e7f13021a..e4aaed3e9dd5 100644 --- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Confi= gurationManagerDxe.inf +++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Confi= gurationManagerDxe.inf @@ -1,7 +1,7 @@ ## @file=0D # Configuration Manager Dxe=0D #=0D -# Copyright (c) 2021, ARM Limited. All rights reserved.
=0D +# Copyright (c) 2021 - 2024, ARM Limited. All rights reserved.
=0D #=0D # SPDX-License-Identifier: BSD-2-Clause-Patent=0D #=0D @@ -42,6 +42,7 @@ =0D [LibraryClasses]=0D ArmPlatformLib=0D + HobLib=0D PrintLib=0D UefiBootServicesTableLib=0D UefiDriverEntryPoint=0D @@ -170,5 +171,8 @@ gArmNeoverseN1SocTokenSpaceGuid.PcdRemotePcieMmio64Translation=0D gArmNeoverseN1SocTokenSpaceGuid.PcdRemotePcieSegmentNumber=0D =0D +[Guids]=0D + gArmNeoverseN1SocPlatformInfoDescriptorGuid=0D +=0D [Depex]=0D TRUE=0D diff --git a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.inf = b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.inf index ead7f11ec964..e7af4c711817 100644 --- a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.inf +++ b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLib.inf @@ -64,3 +64,4 @@ [Ppis]=0D gArmMpCoreInfoPpiGuid=0D gArmNeoverseN1SocParameterPpiGuid=0D + gArmNeoverseN1SocPlatformInfoDescriptorPpiGuid=0D diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDx= e/ConfigurationManager.h b/Platform/ARM/N1Sdp/ConfigurationManager/Configur= ationManagerDxe/ConfigurationManager.h index 303c38dcaee9..ea9cb20ba752 100644 --- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Confi= gurationManager.h +++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Confi= gurationManager.h @@ -1,6 +1,6 @@ /** @file=0D =0D - Copyright (c) 2021, ARM Limited. All rights reserved.
=0D + Copyright (c) 2021-2024, ARM Limited. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -302,6 +302,9 @@ typedef struct PlatformRepositoryInfo { /// Memory Affinity Info=0D CM_ARM_MEMORY_AFFINITY_INFO MemAffInfo[DDR_REGION_COUNT];=0D =0D + /// N1Sdp Platform Info=0D + NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D +=0D } EDKII_PLATFORM_REPOSITORY_INFO;=0D =0D #endif // CONFIGURATION_MANAGER_H_=0D diff --git a/Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h b/Silicon/AR= M/NeoverseN1Soc/Include/NeoverseN1Soc.h index 2bddf5007431..5483e7bc5f68 100644 --- a/Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h +++ b/Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h @@ -41,11 +41,6 @@ #define NEOVERSEN1SOC_EXP_PERIPH_BASE0 0x1C000000=0D #define NEOVERSEN1SOC_EXP_PERIPH_BASE0_SZ 0x1300000=0D =0D -// Base address to a structure of type NEOVERSEN1SOC_PLAT_INFO which is=0D -// pre-populated by a earlier boot stage=0D -#define NEOVERSEN1SOC_PLAT_INFO_STRUCT_BASE (NEOVERSEN1SOC_NON_SE= CURE_SRAM_BASE + \=0D - 0x00008000)=0D -=0D /*=0D * Platform information structure stored in Non-secure SRAM. Platform=0D * information are passed from the trusted firmware with the below structu= re=0D diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDx= e/ConfigurationManager.c b/Platform/ARM/N1Sdp/ConfigurationManager/Configur= ationManagerDxe/ConfigurationManager.c index fa6408a7dd1e..966a83294c00 100644 --- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Confi= gurationManager.c +++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/Confi= gurationManager.c @@ -1,7 +1,7 @@ /** @file=0D Configuration Manager Dxe=0D =0D - Copyright (c) 2021, ARM Limited. All rights reserved.
=0D + Copyright (c) 2021 - 2024, ARM Limited. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -16,6 +16,7 @@ #include =0D #include =0D #include =0D +#include =0D #include =0D #include =0D #include =0D @@ -1242,19 +1243,27 @@ InitializePlatformRepository ( IN EDKII_PLATFORM_REPOSITORY_INFO * CONST PlatRepoInfo=0D )=0D {=0D - NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D UINT64 Dram2Size;=0D UINT64 RemoteDdrSize;=0D + VOID *PlatInfoHob;=0D +=0D + PlatInfoHob =3D GetFirstGuidHob (&gArmNeoverseN1SocPlatformInfoDescripto= rGuid);=0D +=0D + if (PlatInfoHob =3D=3D NULL) {=0D + DEBUG ((DEBUG_ERROR, "Platform HOB is NULL\n"));=0D + return EFI_NOT_FOUND;=0D + }=0D +=0D + PlatRepoInfo->PlatInfo =3D (NEOVERSEN1SOC_PLAT_INFO *)GET_GUID_HOB_DATA = (PlatInfoHob);=0D =0D RemoteDdrSize =3D 0;=0D =0D - PlatInfo =3D (NEOVERSEN1SOC_PLAT_INFO *)NEOVERSEN1SOC_PLAT_INFO_STRUCT_B= ASE;=0D - Dram2Size =3D ((PlatInfo->LocalDdrSize - 2) * SIZE_1GB);=0D + Dram2Size =3D ((PlatRepoInfo->PlatInfo->LocalDdrSize - 2) * SIZE_1GB);=0D =0D PlatRepoInfo->MemAffInfo[LOCAL_DDR_REGION2].Length =3D Dram2Size;=0D =0D - if (PlatInfo->MultichipMode =3D=3D 1) {=0D - RemoteDdrSize =3D ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB);= =0D + if (PlatRepoInfo->PlatInfo->MultichipMode =3D=3D 1) {=0D + RemoteDdrSize =3D ((UINT64)(PlatRepoInfo->PlatInfo->RemoteDdrSize - 2)= * SIZE_1GB);=0D =0D // Update Remote DDR Region1=0D PlatRepoInfo->MemAffInfo[REMOTE_DDR_REGION1].ProximityDomain =3D 1;=0D @@ -1512,7 +1521,6 @@ GetGicCInfo ( )=0D {=0D EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;=0D - NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D UINT32 TotalObjCount;=0D UINT32 ObjIndex;=0D =0D @@ -1523,9 +1531,8 @@ GetGicCInfo ( }=0D =0D PlatformRepo =3D This->PlatRepoInfo;=0D - PlatInfo =3D (NEOVERSEN1SOC_PLAT_INFO *)NEOVERSEN1SOC_PLAT_INFO_STRUCT_B= ASE;=0D =0D - if (PlatInfo->MultichipMode =3D=3D 1) {=0D + if (PlatformRepo->PlatInfo->MultichipMode =3D=3D 1) {=0D TotalObjCount =3D PLAT_CPU_COUNT * 2;=0D } else {=0D TotalObjCount =3D PLAT_CPU_COUNT;=0D @@ -1623,7 +1630,6 @@ GetStandardNameSpaceObject ( {=0D EFI_STATUS Status;=0D EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;=0D - NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D UINT32 AcpiTableCount;=0D =0D if ((This =3D=3D NULL) || (CmObject =3D=3D NULL)) {=0D @@ -1634,9 +1640,8 @@ GetStandardNameSpaceObject ( =0D Status =3D EFI_NOT_FOUND;=0D PlatformRepo =3D This->PlatRepoInfo;=0D - PlatInfo =3D (NEOVERSEN1SOC_PLAT_INFO *)NEOVERSEN1SOC_PLAT_INFO_STRUCT_B= ASE;=0D AcpiTableCount =3D ARRAY_SIZE (PlatformRepo->CmAcpiTableList);=0D - if (PlatInfo->MultichipMode =3D=3D 0)=0D + if (PlatformRepo->PlatInfo->MultichipMode =3D=3D 0)=0D AcpiTableCount -=3D 1;=0D =0D switch (GET_CM_OBJECT_ID (CmObjectId)) {=0D @@ -1697,7 +1702,6 @@ GetArmNameSpaceObject ( {=0D EFI_STATUS Status;=0D EDKII_PLATFORM_REPOSITORY_INFO * PlatformRepo;=0D - NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D UINT32 GicRedistCount;=0D UINT32 GicCpuCount;=0D UINT32 ProcHierarchyInfoCount;=0D @@ -1719,8 +1723,7 @@ GetArmNameSpaceObject ( PlatformRepo =3D This->PlatRepoInfo;=0D =0D // Probe for multi chip information=0D - PlatInfo =3D (NEOVERSEN1SOC_PLAT_INFO *)NEOVERSEN1SOC_PLAT_INFO_STRUCT_B= ASE;=0D - if (PlatInfo->MultichipMode =3D=3D 1) {=0D + if (PlatformRepo->PlatInfo->MultichipMode =3D=3D 1) {=0D GicRedistCount =3D 2;=0D GicCpuCount =3D PLAT_CPU_COUNT * 2;=0D ProcHierarchyInfoCount =3D PLAT_PROC_HIERARCHY_NODE_COUNT * 2;=0D diff --git a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c= b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c index 9e8a1efc557d..80daedb33416 100644 --- a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c +++ b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c @@ -1,6 +1,6 @@ /** @file=0D =0D - Copyright (c) 2018 - 2021, ARM Limited. All rights reserved.
=0D + Copyright (c) 2018 - 2024, ARM Limited. All rights reserved.
=0D =0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -10,6 +10,7 @@ #include =0D #include =0D #include =0D +#include =0D #include =0D =0D // The total number of descriptors, including the final "end-of-table" des= criptor.=0D @@ -30,15 +31,33 @@ ArmPlatformGetVirtualMemoryMap ( IN ARM_MEMORY_REGION_DESCRIPTOR **VirtualMemoryMap=0D )=0D {=0D - UINTN Index;=0D - ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;=0D - EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;=0D - NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D - UINT64 DramBlock2Size;=0D - UINT64 RemoteDdrSize;=0D + UINTN Index;=0D + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable;=0D + EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes;=0D + CONST NEOVERSEN1SOC_PLAT_INFO *PlatInfo;=0D + UINT64 DramBlock2Size;=0D + UINT64 RemoteDdrSize;=0D + EFI_STATUS Status;=0D =0D Index =3D 0;=0D - PlatInfo =3D (NEOVERSEN1SOC_PLAT_INFO *)NEOVERSEN1SOC_PLAT_INFO_STRUCT_B= ASE;=0D +=0D + Status =3D PeiServicesLocatePpi (=0D + &gArmNeoverseN1SocPlatformInfoDescriptorPpiGuid,=0D + 0,=0D + NULL,=0D + (VOID **)&PlatInfo=0D + );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((=0D + DEBUG_ERROR,=0D + "[%a]: failed to locate gArmNeoverseN1SocPlatformInfoDescriptorPpiGu= id - %r\n",=0D + gEfiCallerBaseName,=0D + Status=0D + ));=0D + *VirtualMemoryMap =3D NULL;=0D + return;=0D + }=0D +=0D DramBlock2Size =3D ((UINT64)(PlatInfo->LocalDdrSize -=0D NEOVERSEN1SOC_DRAM_BLOCK1_SIZE / SIZE_1GB) *= =0D (UINT64)SIZE_1GB);=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#113167): https://edk2.groups.io/g/devel/message/113167 Mute This Topic: https://groups.io/mt/103521648/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-