From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (EUR01-VE1-obe.outbound.protection.outlook.com [40.107.14.89]) by mx.groups.io with SMTP id smtpd.web11.9754.1586866561419392907 for ; Tue, 14 Apr 2020 05:16:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nxp1.onmicrosoft.com header.s=selector2-nxp1-onmicrosoft-com header.b=FSxR5WIt; spf=pass (domain: oss.nxp.com, ip: 40.107.14.89, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fg/iNwjtLnnUBcvWzYrO4fJzIg9pngw62WDd395fkBB4Qm0uTNVM88dzcdD53dhd8rXALbb8LjyFnGKVVt5S/iQJtYcXo7/RgK9Two8aw16sNlMJb9VXdklRyL3JP1OdTKcDxpVGwkBhSUA03pwFCcY7P7bg95l/Ns03OplPD/zCocEEyURvJXW45QHopVFDbFiV65V5736eKJQIZObpcQwPmFqKRjYTBlRM2RCBZlTY2yXrS30/5lPHaCL3qDz190HdqkAnyhhrYxgg45GNthhoWoHi36Qmie2N7/G0/Rf/F0iW55+u+zGESVjV/Z2WUmRqH4V1qubjpppKIrp3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9MHzjVNh1zjStTJ7LZv575bxGjw0CMeZEa8YM7wc+RA=; b=aX+m0BRh+LBJU88ut6SQaODBmuq7yBxL85NxdpPB2trHZSSZOzY33147f/UaO8mHH49igl3Wdj34exEAT0/oN97sG7+B5V5F/x5uzR+U5ke7LQljqvZRYXzmy2FEEoncKfnhsjR63F8oXFH937CB2BTWXrgtw9LfF5kxDVS4Cj9S39XCzZP7sKT9SinavRnji77iDIBPm4nUH/4NfH/S2B1ALnjwCyOPJSo08F2ep3sRibFgZfASo/mAzR+DwSCI7PraHNKfnsAZ3AbYs88VAE1D1/RCZCaUGMgLUk9sUOLDZX3et1ush2Uw6TW1Vr2uYjufWSDnEchKuTZibFo8ag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9MHzjVNh1zjStTJ7LZv575bxGjw0CMeZEa8YM7wc+RA=; b=FSxR5WIt+3zCSV3biSy7ATTskQRqdUwZ/MLPunNTVwIPXvYmLwSf5TH0bfDCvKJYEGilLYwjVM+4sKLrk6EfK3xSkb2Ud0G3RlFqWBJE//v3qN/jVUHDi6kLS9J6s1nQNAcsmJegciCJMCtF6UsTOgcTIg539X/mO/n8YPrp2e4= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=pankaj.bansal@oss.nxp.com; Received: from VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB4461.eurprd04.prod.outlook.com (2603:10a6:803:70::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.28; Tue, 14 Apr 2020 12:15:58 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::45c4:8846:5327:9513%7]) with mapi id 15.20.2900.028; Tue, 14 Apr 2020 12:15:58 +0000 From: "Pankaj Bansal" To: Leif Lindholm , Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Jon Nettleton , Ard Biesheuvel Subject: [PATCH edk2-platforms v3 24/24] Platform/NXP/LS1043aRdbPkg: Add PEI Phase Date: Wed, 15 Apr 2020 17:43:42 +0530 Message-ID: <20200415121342.9246-25-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> References: <20200415121342.9246-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR01CA0092.apcprd01.prod.exchangelabs.com (2603:1096:3:15::18) To VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) Return-Path: pankaj.bansal@oss.nxp.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from uefi-workstation.ap.freescale.net (92.120.0.69) by SG2PR01CA0092.apcprd01.prod.exchangelabs.com (2603:1096:3:15::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.15 via Frontend Transport; Tue, 14 Apr 2020 12:15:55 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [92.120.0.69] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 881f700c-447a-4525-c861-08d7e06d96aa X-MS-TrafficTypeDiagnostic: VI1PR04MB4461:|VI1PR04MB4461: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0373D94D15 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5933.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10009020)(4636009)(376002)(366004)(346002)(136003)(39850400004)(396003)(30864003)(1076003)(186003)(8936002)(16526019)(86362001)(110136005)(26005)(478600001)(81156014)(8676002)(6512007)(66946007)(316002)(44832011)(66476007)(66556008)(52116002)(5660300002)(6666004)(2906002)(6486002)(6506007)(956004)(19627235002)(2616005);DIR:OUT;SFP:1101; Received-SPF: None (protection.outlook.com: oss.nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a2WaggGbRRBbOans+JjTIF+LATmpV3UmWYhCIlnGn9S84rf/bdbMLpQUH4z50r5vnN+l41pd3f0jti7uxcp7220W0XumILu1X2fPfgPfF6J2BZq+4ntYS2Sur3ODrDHLPohgquhsDDbyAS8WWvNvklZdiDyHlJBQfuM8d3Ylt5hGNgdXiItz87Uiw627pITpDTTL2VhAPCQQL5eu8KtjrfDNyfcdgUXQ0G4sf+NJxM2CLdrBzQwRnNvK4794BPyH6kYkwjJTuMcxXZyWoIBTb0MRRt9dW+XTiXbk19UBveBj6td7QBtgDTVd/OoLAqkGAaVRIQDuH9mKpfk7IKjni0X55Ou+GINUuBkUfRxDUfIP3PSDfGtnAFvvep/qvxyTx4JcenAUa1VnB8HK6tFOQj+bACfpYM9FDY2ymtv2sz8TxhzEWSJ5GixQqDNlVwK+ X-MS-Exchange-AntiSpam-MessageData: YmYE4ArOB4a5J/G+p6Jstkn6G2ou1a56TwmLKOf07YNS/RnSylBHZnbkkQN9ED/nrdkpIFzsSxgpICF7KrGqxhQRBsymDKWWTuSepd5W+VcLy3h6pHebR92DFLODUaMrMcrpvKBS/sxbhrh50asJww== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 881f700c-447a-4525-c861-08d7e06d96aa X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 12:15:58.3884 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 56WJhh8oFTtpCg5gT8ezM6hmzlFN2KO28343yPkno4AFGaomGfQ1LCU2FUY6A9lozHWzqYs9AzucawGCNuQW3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4461 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Pankaj Bansal Add PEI phase to LS1043aRdb. This is needed becuase we need to have dynamic PCDs support to be able to reserve memory before reporting memory to UEFI fimrware. Using PEI phase we are now also dynamically setting the PcdSystemMemoryBase and PcdSystemMemorySize depending upon the DRAM regions detected. This in turn would depend on the DDR DIMMs installed on board. Signed-off-by: Pankaj Bansal --- Notes: - Update commit description Silicon/NXP/NxpQoriqLs.dsc.inc | 61 +++++++++++= ++----- Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc | 9 --- Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf | 18 ++++-- Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf | 3 +- Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 67 +++++++++++= --------- 5 files changed, 98 insertions(+), 60 deletions(-) diff --git a/Silicon/NXP/NxpQoriqLs.dsc.inc b/Silicon/NXP/NxpQoriqLs.dsc.in= c index 3c8b11d9e04c..14fbea72d3f8 100644 --- a/Silicon/NXP/NxpQoriqLs.dsc.inc +++ b/Silicon/NXP/NxpQoriqLs.dsc.inc @@ -93,30 +93,35 @@ CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf NonDiscoverableDeviceRegistrationLib|MdeModulePkg/Library/NonDiscoverabl= eDeviceRegistrationLib/NonDiscoverableDeviceRegistrationLib.inf ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeRepor= tStatusCodeLib.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf =20 I2cLib|Silicon/NXP/Library/I2cLib/I2cLib.inf ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSy= stemLib.inf IoAccessLib|Silicon/NXP/Library/IoAccessLib/IoAccessLib.inf =20 + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf MemoryInitPeiLib|Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.i= nf =20 [LibraryClasses.common.SEC] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf - ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib= /PrePiExtractGuidedSectionLib.inf - LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCusto= mDecompressLib.inf - PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf - PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/Pre= PiHobListPointerLib.inf - MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe= moryAllocationLib.inf + DebugAgentLib|ArmPkg/Library/DebugAgentSymbolsBaseLib/DebugAgentSymbolsB= aseLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + +[LibraryClasses.common.PEI_CORE] + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf - PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExt= ractGuidedSectionLib.inf + ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf =20 - # 1/123 faster than Stm or Vstm version - BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf - - # Uncomment to turn on GDB stub in SEC. - #DebugAgentLib|EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf =20 [LibraryClasses.common.PEIM] PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf @@ -125,14 +130,16 @@ PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf + ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExt= ractGuidedSectionLib.inf ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf + OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHo= okStatusCodeLibNull.inf =20 [LibraryClasses.common.DXE_CORE] HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf - UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform= anceLib.inf =20 @@ -204,6 +211,9 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 =20 + gArmTokenSpaceGuid.PcdSystemMemoryBase|0 + gArmTokenSpaceGuid.PcdSystemMemorySize|0 + [PcdsDynamicHii.common.DEFAULT] gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|10 =20 @@ -224,6 +234,12 @@ gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 =20 + ## Base of DRAM + ## since TFA puts Fd at 0x2000000 offset from DRAM base, we can use this= space + ## for temporary ram + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase|0x80000000 + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x02000000 + !if $(TARGET) =3D=3D RELEASE gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x27 gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x81000001 @@ -281,13 +297,26 @@ ##########################################################################= ###### [Components.common] # - # SEC + # PEI Phase modules # - ArmPlatformPkg/PrePi/PeiUniCore.inf + ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf + + MdeModulePkg/Core/Pei/PeiMain.inf MdeModulePkg/Universal/PCD/Pei/Pcd.inf { PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf } + MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf + MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + + ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + ArmPkg/Drivers/CpuPei/CpuPei.inf + ArmPlatformPkg/PlatformPei/PlatformPeim.inf + + MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf + } =20 # # DXE diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.dsc index d486c9b36fab..d45fd67c03b5 100644 --- a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc @@ -30,15 +30,6 @@ RealTimeClockLib|Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.inf =20 [PcdsFixedAtBuild.common] - - # - # LS1043a board Specific PCDs - # XX (DRAM - Region 1 2GB) - # (NOR - IFC Region 1 512MB) - gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 - gArmTokenSpaceGuid.PcdSystemMemorySize|0x7BE00000 - gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x02000000 - # # RTC Pcds # diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.fdf index 99fbc87e1200..931d0bb14f9b 100644 --- a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf @@ -24,10 +24,10 @@ =20 [FD.LS1043ARDB_EFI] BaseAddress =3D 0x82000000|gArmTokenSpaceGuid.PcdFdBaseAddress #The bas= e address of the FLASH Device. -Size =3D 0x000ED000|gArmTokenSpaceGuid.PcdFdSize #The siz= e in bytes of the FLASH Device +Size =3D 0x00140000|gArmTokenSpaceGuid.PcdFdSize #The siz= e in bytes of the FLASH Device ErasePolarity =3D 1 -BlockSize =3D 0x1 -NumBlocks =3D 0xED000 +BlockSize =3D 0x40000 +NumBlocks =3D 0x5 =20 ##########################################################################= ###### # @@ -44,7 +44,7 @@ NumBlocks =3D 0xED000 # RegionType # ##########################################################################= ###### -0x00000000|0x000ED000 +0x00000000|0x00140000 gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize FV =3D FVMAIN_COMPACT =20 @@ -159,7 +159,15 @@ READ_STATUS =3D TRUE READ_LOCK_CAP =3D TRUE READ_LOCK_STATUS =3D TRUE =20 - INF ArmPlatformPkg/PrePi/PeiUniCore.inf + INF ArmPlatformPkg/PrePeiCore/PrePeiCoreUniCore.inf + INF MdeModulePkg/Core/Pei/PeiMain.inf + INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.i= nf + INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf + INF ArmPkg/Drivers/CpuPei/CpuPei.inf + INF ArmPlatformPkg/PlatformPei/PlatformPeim.inf + INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf =20 FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE { diff --git a/Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf b/Si= licon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf index ad2371115b17..a33f8cd3f743 100644 --- a/Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf +++ b/Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf @@ -13,7 +13,8 @@ FILE_GUID =3D 55ddb6e0-70b5-11e0-b33e-0002a5d5c51b MODULE_TYPE =3D BASE VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D MemoryInitPeiLib|SEC PEIM DXE_DRIVER + LIBRARY_CLASS =3D MemoryInitPeiLib|PEIM + CONSTRUCTOR =3D MemoryInitPeiLibConstructor =20 [Sources] MemoryInitPeiLib.c diff --git a/Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/Sili= con/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.c index ea3e7d59532e..932bdf948f6f 100644 --- a/Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.c +++ b/Silicon/NXP/Library/MemoryInitPeiLib/MemoryInitPeiLib.c @@ -111,22 +111,17 @@ GetDramRegionsInfo ( =20 /** Get the installed RAM information. - Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + Initialize Memory HOBs (Resource Descriptor HOBs) + Set the PcdSystemMemoryBase and PcdSystemMemorySize. =20 - @param[in] UefiMemoryBase Base address of region used by UEFI in - permanent memory - @param[in] UefiMemorySize Size of the region used by UEFI in permanent = memory - - @return EFI_SUCCESS Successfuly Initialize MMU and Memory HOBs. + @return EFI_SUCCESS Successfuly retrieved the system memory informatio= n **/ EFI_STATUS EFIAPI -MemoryPeim ( - IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, - IN UINT64 UefiMemorySize +MemoryInitPeiLibConstructor ( + VOID ) { - ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; INT32 Index; UINTN BaseAddress; UINTN Size; @@ -137,18 +132,6 @@ MemoryPeim ( UINTN FdTop; BOOLEAN FoundSystemMem; =20 - // Get Virtual Memory Map from the Platform Library - ArmPlatformGetVirtualMemoryMap (&MemoryTable); - - // - // Ensure MemoryTable[0].Length which is size of DRAM has been set - // by ArmPlatformGetVirtualMemoryMap () - // - ASSERT (MemoryTable[0].Length !=3D 0); - - // - // Now, the permanent memory has been installed, we can call AllocatePag= es() - // ResourceAttributes =3D ( EFI_RESOURCE_ATTRIBUTE_PRESENT | EFI_RESOURCE_ATTRIBUTE_INITIALIZED | @@ -163,8 +146,8 @@ MemoryPeim ( =20 GetDramRegionsInfo (DramRegions, ARRAY_SIZE (DramRegions)); =20 - FdBase =3D (UINTN)FixedPcdGet64 (PcdFdBaseAddress); - FdTop =3D FdBase + (UINTN)FixedPcdGet32 (PcdFdSize); + FdBase =3D (UINTN)PcdGet64 (PcdFdBaseAddress); + FdTop =3D FdBase + (UINTN)PcdGet32 (PcdFdSize); =20 // Declare memory regios to system // The DRAM region info is sorted based on the RAM address is SOC memory= map. @@ -217,8 +200,8 @@ MemoryPeim ( ); }; // Mark the memory covering the Firmware Device as boot services dat= a - BuildMemoryAllocationHob (FixedPcdGet64 (PcdFdBaseAddress), - FixedPcdGet32 (PcdFdSize), + BuildMemoryAllocationHob (PcdGet64 (PcdFdBaseAddress), + PcdGet32 (PcdFdSize), EfiBootServicesData); } else { BuildResourceDescriptorHob ( @@ -236,17 +219,43 @@ MemoryPeim ( Size =3D DramRegions[Index].Size; =20 if (FdBase >=3D BaseAddress && FdTop <=3D Top) { - Size -=3D (UINTN)FixedPcdGet32 (PcdFdSize); + Size -=3D (UINTN)PcdGet32 (PcdFdSize); } =20 - if ((UefiMemoryBase >=3D BaseAddress) && (Size >=3D UefiMemorySize)) { + if (Size >=3D FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)) { FoundSystemMem =3D TRUE; + PcdSet64S (PcdSystemMemoryBase, BaseAddress); + PcdSet64S (PcdSystemMemorySize, Size); } } =20 ASSERT (FoundSystemMem =3D=3D TRUE); =20 - // Build Memory Allocation Hob + return EFI_SUCCESS; +} + +/** + Initialize MMU + + @param[in] UefiMemoryBase Base address of region used by UEFI in + permanent memory + @param[in] UefiMemorySize Size of the region used by UEFI in permanent = memory + + @return EFI_SUCCESS Successfuly Initialize MMU +**/ +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ) +{ + ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; + + // Get Virtual Memory Map from the Platform Library + ArmPlatformGetVirtualMemoryMap (&MemoryTable); + + // Initialize Mmu InitMmu (MemoryTable); =20 if (FeaturePcdGet (PcdPrePiProduceMemoryTypeInformationHob)) { --=20 2.17.1