From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR03-VE1-obe.outbound.protection.outlook.com (EUR03-VE1-obe.outbound.protection.outlook.com [40.107.5.48]) by mx.groups.io with SMTP id smtpd.web11.9737.1586866523709098914 for ; Tue, 14 Apr 2020 05:15:24 -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=LgEDhtOv; spf=pass (domain: oss.nxp.com, ip: 40.107.5.48, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X1Nw5ENYNDsFEXiT8ST0KFVRwAbF4Y1SEU4wR/r+ybsKuj4eSbM48ebwyjT0GTMqdFGk9eZ/p/1XKsbd275nPZJgq4LKcHSxvW7kJeXw3wc9MGT9AMvOAsAu8hNFh2KUhBoSCVZeAa3fefP0Ao1vTUOIYXowKZYnvi4RraJpSCfentdfIJNlnRerJRA5YVV6pO+PZqHt1gE2sbZLfUSNF7xGN3OXpX5u/GRQGMOnu1OytH9eCW8SzSdrkOxJpmb7FIDPglBGX85vuFyfn52erZcrp/+jcf2Nld733/myGKsn1ff3ZoG86eP7jtNa7hg9YoRnjsDwhQUGsSgkWLreUw== 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=kvSJb3FHS5X4SAutzKBVjUhM+yC8BYNvKWg7NktvzrI=; b=CUpE45PH3LWZLe/hdo25r9Qppn4uEU02NlFJrZByyL+S0Dgp4cufOGC2B8haZ6/ZN+Nk0iVZRU0yNWgY4oKgKdkPgrYhvGDUN1CGSzorzAg7/YmBBAteRsGM9z32G98sumK+S+2NfxmWxhBudLCnruP0wMyGigv9iMVb/cjfFX8HlumvZp+dDCWcAyHQKTxOO763DZgux2bZGOCTSCVW0dXUjEG6SxrQ9N91qProcEhFbRAfurqdnrhSdMSGtlrk96CUt5Kxgoas7KdM87mhpKTOQZ4lrtB6uKQCUsda8et4BkqSLJIVxhvhdNuV5VoQUGurN5e5CXEm3sv+oAuqow== 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=kvSJb3FHS5X4SAutzKBVjUhM+yC8BYNvKWg7NktvzrI=; b=LgEDhtOvWmdQ+xwGNOkDmRnDJLMaKtf4UNYFAx9zx3K1kgi29XfMxnUNZhyxkMtyNkgiGOjrTCGbRFKoh6H0LN+ByMdF8lckPIMJ2Z4n+v3qeWGhlyze5yi7cQv0VjEbX8kKT9h4iI+a3jzOlK5QAPrVa6iZf3KLHW1lw+sCvFI= 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:21 +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:21 +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 12/24] Silicon/NXP: Move RAM retrieval from SocLib Date: Wed, 15 Apr 2020 17:43:30 +0530 Message-ID: <20200415121342.9246-13-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:18 +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: adc4ec16-41b3-45ea-864a-08d7e06d807e 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:9508; 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: 29PhsYiGRTxD04jvVGVBgB0ybC8lcWjGXNnmZ+blJ6eyxSn2zvm/30MN6cLSYfTMHVz3JIrE0uxDshuwoK7qiihF8kK/uOWbHkUdHtm4v1YuLoTv4FQI1rinaaQt4Dn0CZhbGxvPknt60Ftp38TXO3kGYb4sT6x/jaTu1L704Lnhoy5wycs1eoNLa8YHfrV0RvErWKwTMPiTkVy6uqfZpPXBnkDF9K8zK8Gu3iWi1tukZRVivJKJE+PGoDUMqTfrGR01M2QL4pvZ8oUwPt6P/qiLyImD7NwXzrlSH3hbEcFSENpyuyduU6kBIEoEWPhEHMG3wA/bTcjln5TZesaRBLrioR7sqPYpNZY06TRXHVYfrIwrwL3mBS+S6lm5gK4whM8SF5wNDdRCn8ECtWEnb6oW3HKCdC4KGv53b0sLNAtz4j1pv0ZaU5PptUivPTX7 X-MS-Exchange-AntiSpam-MessageData: anbmeW9Pj9bqUUgrOL3ZdNB73mB6eMIhK/sNhGzckA9dqLmatH+6R7Zf93jCtPtnlxqwi6SJXSdnWLHCcs7OkfZ1um2TXdqu6MRsuOUTsbu/anmySbjoRwlSjiznZdufvAZg5cQZOzdE6eh6GlZX7g== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: adc4ec16-41b3-45ea-864a-08d7e06d807e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2020 12:15:21.2424 (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: x42zpcWSbqa/ONls0xnM0xRcYlbHPXhk1P2m4sy47feSV37n7zyKNmnFv0Suf5O272ZUNJ6Wgg9fn+lT6Lp+8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4461 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Pankaj Bansal RAM retrieval using SMC commands is common to all Layerscape SOCs. Therefore, move it to commom MemoryInit Pei Lib. Signed-off-by: Pankaj Bansal --- Notes: - sort headers alphabetically - Moved DRAM region retrieval and Total DRAM size retrieval to separate functions - Fixed MemoryPeim function description - Modified check on FoundSystemMem =3D TRUE to check the RAM region aga= inst MemoryPeim function input arguments UefiMemoryBase and UefiMemorySize - (!DramRegions[Index].Size) =3D> (DramRegions[Index].Size =3D=3D 0) - (FoundSystemMem) =3D> (FoundSystemMem =3D=3D TRUE) - Added explaination for starting for loop from the last DRAM region Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.inf | 7 +- Silicon/NXP/Library/SocLib/LS1043aSocLib.inf | 1 - Silicon/NXP/Include/DramInfo.h | 38 ---- Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.h | 25 +++ Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.c | 196 +++++++++++++= +++---- Silicon/NXP/Library/SocLib/Chassis.c | 67 ------- 6 files changed, 188 insertions(+), 146 deletions(-) diff --git a/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.inf b/Silic= on/NXP/Library/MemoryInitPei/MemoryInitPeiLib.inf index a5bd39415def..ad2371115b17 100644 --- a/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.inf +++ b/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.inf @@ -18,7 +18,6 @@ [Sources] MemoryInitPeiLib.c =20 - [Packages] ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec @@ -30,6 +29,7 @@ [LibraryClasses] ArmMmuLib ArmPlatformLib + ArmSmcLib DebugLib HobLib PcdLib @@ -40,6 +40,11 @@ [FeaturePcd] gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob =20 +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + [Pcd] gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf b/Silicon/NXP/Lib= rary/SocLib/LS1043aSocLib.inf index b7c7fc78cc8f..99d89498e0e2 100644 --- a/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf +++ b/Silicon/NXP/Library/SocLib/LS1043aSocLib.inf @@ -20,7 +20,6 @@ Silicon/NXP/NxpQoriqLs.dec =20 [LibraryClasses] - ArmSmcLib BaseLib DebugLib IoAccessLib diff --git a/Silicon/NXP/Include/DramInfo.h b/Silicon/NXP/Include/DramInfo.= h deleted file mode 100644 index a934aaeff1f5..000000000000 --- a/Silicon/NXP/Include/DramInfo.h +++ /dev/null @@ -1,38 +0,0 @@ -/** @file -* Header defining the structure for Dram Information -* -* Copyright 2019 NXP -* -* SPDX-License-Identifier: BSD-2-Clause-Patent -* -**/ - -#ifndef DRAM_INFO_H_ -#define DRAM_INFO_H_ - -#include - -#define SMC_DRAM_BANK_INFO (0xC200FF12) - -typedef struct { - UINTN BaseAddress; - UINTN Size; -} DRAM_REGION_INFO; - -typedef struct { - UINT32 NumOfDrams; - UINT32 Reserved; - DRAM_REGION_INFO DramRegion[3]; -} DRAM_INFO; - -EFI_STATUS -GetDramBankInfo ( - IN OUT DRAM_INFO *DramInfo - ); - -VOID -UpdateDpaaDram ( - IN OUT DRAM_INFO *DramInfo - ); - -#endif /* DRAM_INFO_H_ */ diff --git a/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.h b/Silicon= /NXP/Library/MemoryInitPei/MemoryInitPeiLib.h new file mode 100644 index 000000000000..edbf0ceaf638 --- /dev/null +++ b/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.h @@ -0,0 +1,25 @@ +/** @file +* +* Copyright 2020 NXP +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#ifndef MEMORY_INIT_PEI_LIB_H_ +#define MEMORY_INIT_PEI_LIB_H_ + +#include + +// Specifies the Maximum regions onto which DDR memory can be mapped in +// a Platform +#define MAX_DRAM_REGIONS 3 +#define SMC_DRAM_BANK_INFO (0xC200FF12) + +typedef struct { + UINTN BaseAddress; + UINTN Size; +} DRAM_REGION_INFO; + +#endif // MEMORY_INIT_PEI_LIB_H_ + diff --git a/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.c b/Silicon= /NXP/Library/MemoryInitPei/MemoryInitPeiLib.c index 3ea773678667..ea3e7d59532e 100644 --- a/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.c +++ b/Silicon/NXP/Library/MemoryInitPei/MemoryInitPeiLib.c @@ -12,13 +12,15 @@ =20 #include #include +#include #include #include #include #include #include =20 -#include +#include "MemoryInitPeiLib.h" + =20 VOID BuildMemoryTypeInformationHob ( @@ -44,22 +46,79 @@ InitMmu ( } } =20 -/*++ +STATIC +UINTN +GetDramSize ( + IN VOID + ) +{ + ARM_SMC_ARGS ArmSmcArgs; =20 -Routine Description: + ArmSmcArgs.Arg0 =3D SMC_DRAM_BANK_INFO; + ArmSmcArgs.Arg1 =3D -1; =20 + ArmCallSmc (&ArmSmcArgs); =20 + if (ArmSmcArgs.Arg0) { + return 0; + } else { + return ArmSmcArgs.Arg1; + } +} =20 -Arguments: +STATIC +EFI_STATUS +GetDramRegionsInfo ( + OUT DRAM_REGION_INFO *DramRegions, + IN UINT32 NumRegions + ) +{ + ARM_SMC_ARGS ArmSmcArgs; + UINT32 Index; + UINTN RemainingDramSize; + UINTN BaseAddress; + UINTN Size; =20 - FileHandle - Handle of the file being invoked. - PeiServices - Describes the list of possible PEI Services. + RemainingDramSize =3D GetDramSize (); + DEBUG ((DEBUG_INFO, "DRAM Total Size 0x%lx \n", RemainingDramSize)); =20 -Returns: + // Ensure Total Dram Size is valid + ASSERT (RemainingDramSize !=3D 0); =20 - Status - EFI_SUCCESS if the boot mode could be set + for (Index =3D 0; (RemainingDramSize !=3D 0) && (Index < NumRegions); In= dex++) { + ArmSmcArgs.Arg0 =3D SMC_DRAM_BANK_INFO; + ArmSmcArgs.Arg1 =3D Index; =20 ---*/ + ArmCallSmc (&ArmSmcArgs); + + BaseAddress =3D ArmSmcArgs.Arg1; + Size =3D ArmSmcArgs.Arg2; + ASSERT (BaseAddress && Size); + + DramRegions[Index].BaseAddress =3D BaseAddress; + DramRegions[Index].Size =3D Size; + RemainingDramSize -=3D Size; + + DEBUG ((DEBUG_INFO, "DRAM Region[%d]: start 0x%lx, size 0x%lx\n", + Index, BaseAddress, Size)); + } + + // Ensure that all regions have been accounted for + ASSERT (RemainingDramSize =3D=3D 0); + + return EFI_SUCCESS; +} + +/** + Get the installed RAM information. + Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + + @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. +**/ EFI_STATUS EFIAPI MemoryPeim ( @@ -67,11 +126,16 @@ MemoryPeim ( IN UINT64 UefiMemorySize ) { - ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; - EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; - EFI_PEI_HOB_POINTERS NextHob; - BOOLEAN Found; - DRAM_INFO DramInfo; + ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; + INT32 Index; + UINTN BaseAddress; + UINTN Size; + UINTN Top; + DRAM_REGION_INFO DramRegions[MAX_DRAM_REGIONS]; + EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; + UINTN FdBase; + UINTN FdTop; + BOOLEAN FoundSystemMem; =20 // Get Virtual Memory Map from the Platform Library ArmPlatformGetVirtualMemoryMap (&MemoryTable); @@ -94,40 +158,94 @@ MemoryPeim ( EFI_RESOURCE_ATTRIBUTE_TESTED ); =20 - if (GetDramBankInfo (&DramInfo)) { - DEBUG ((DEBUG_ERROR, "Failed to get DRAM information, exiting...\n")); - return EFI_UNSUPPORTED; - } + FoundSystemMem =3D FALSE; + ZeroMem (DramRegions, sizeof (DramRegions)); =20 - while (DramInfo.NumOfDrams--) { - // - // Check if the resource for the main system memory has been declared - // - Found =3D FALSE; - NextHob.Raw =3D GetHobList (); - while ((NextHob.Raw =3D GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, = NextHob.Raw)) !=3D NULL) { - if ((NextHob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_SY= STEM_MEMORY) && - (DramInfo.DramRegion[DramInfo.NumOfDrams].BaseAddress >=3D NextH= ob.ResourceDescriptor->PhysicalStart) && - (NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDes= criptor->ResourceLength <=3D - DramInfo.DramRegion[DramInfo.NumOfDrams].BaseAddress + DramInfo= .DramRegion[DramInfo.NumOfDrams].Size)) - { - Found =3D TRUE; - break; + GetDramRegionsInfo (DramRegions, ARRAY_SIZE (DramRegions)); + + FdBase =3D (UINTN)FixedPcdGet64 (PcdFdBaseAddress); + FdTop =3D FdBase + (UINTN)FixedPcdGet32 (PcdFdSize); + + // Declare memory regios to system + // The DRAM region info is sorted based on the RAM address is SOC memory= map. + // i.e. DramRegions[0] is at lower address, as compared to DramRegions[1= ]. + // The goal to start from last region is to find the topmost RAM region = that + // can contain UEFI DXE region i.e. PcdSystemMemoryUefiRegionSize. + // If UEFI were to allocate any reserved or runtime region, it would be + // allocated from topmost RAM region. + // This ensures that maximum amount of lower RAM (32 bit addresses) are = left + // for OS to allocate to devices that can only work with 32bit physical + // addresses. E.g. legacy devices that need to DMA to 32bit addresses. + for (Index =3D MAX_DRAM_REGIONS - 1; Index >=3D 0; Index--) { + if (DramRegions[Index].Size =3D=3D 0) { + continue; + } + + BaseAddress =3D DramRegions[Index].BaseAddress; + Top =3D DramRegions[Index].BaseAddress + DramRegions[Index].Size; + + // EDK2 does not have the concept of boot firmware copied into DRAM. + // To avoid the DXE core to overwrite this area we must create a memor= y + // allocation HOB for the region, but this only works if we split off = the + // underlying resource descriptor as well. + if (FdBase >=3D BaseAddress && FdTop <=3D Top) { + // Update Size + Size =3D FdBase - BaseAddress; + if (Size) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes, + BaseAddress, + Size + ); } - NextHob.Raw =3D GET_NEXT_HOB (NextHob); - } - - if (!Found) { - // Reserved the memory space occupied by the firmware volume + // create the System Memory HOB for the firmware BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY, ResourceAttributes, - DramInfo.DramRegion[DramInfo.NumOfDrams].BaseAddress, - DramInfo.DramRegion[DramInfo.NumOfDrams].Size + FdBase, + PcdGet32 (PcdFdSize) ); + // Create the System Memory HOB for the remaining region (top of the= FD)s + Size =3D Top - FdTop; + if (Size) { + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes, + FdTop, + Size + ); + }; + // Mark the memory covering the Firmware Device as boot services dat= a + BuildMemoryAllocationHob (FixedPcdGet64 (PcdFdBaseAddress), + FixedPcdGet32 (PcdFdSize), + EfiBootServicesData); + } else { + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes, + DramRegions[Index].BaseAddress, + DramRegions[Index].Size + ); + } + + if (FoundSystemMem =3D=3D TRUE) { + continue; + } + + Size =3D DramRegions[Index].Size; + + if (FdBase >=3D BaseAddress && FdTop <=3D Top) { + Size -=3D (UINTN)FixedPcdGet32 (PcdFdSize); + } + + if ((UefiMemoryBase >=3D BaseAddress) && (Size >=3D UefiMemorySize)) { + FoundSystemMem =3D TRUE; } } =20 + ASSERT (FoundSystemMem =3D=3D TRUE); + // Build Memory Allocation Hob InitMmu (MemoryTable); =20 diff --git a/Silicon/NXP/Library/SocLib/Chassis.c b/Silicon/NXP/Library/Soc= Lib/Chassis.c index 847331a63152..1ef99e8de25f 100644 --- a/Silicon/NXP/Library/SocLib/Chassis.c +++ b/Silicon/NXP/Library/SocLib/Chassis.c @@ -22,7 +22,6 @@ #include #include =20 -#include #include "NxpChassis.h" =20 UINT32 @@ -75,69 +74,3 @@ SmmuInit ( MmioWrite32 ((UINTN)SMMU_REG_NSCR0, Value); } =20 -UINTN -GetDramSize ( - IN VOID - ) -{ - ARM_SMC_ARGS ArmSmcArgs; - - ArmSmcArgs.Arg0 =3D SMC_DRAM_BANK_INFO; - ArmSmcArgs.Arg1 =3D -1; - - ArmCallSmc (&ArmSmcArgs); - - if (ArmSmcArgs.Arg0) { - return 0; - } else { - return ArmSmcArgs.Arg1; - } -} - -EFI_STATUS -GetDramBankInfo ( - IN OUT DRAM_INFO *DramInfo - ) -{ - ARM_SMC_ARGS ArmSmcArgs; - UINT32 I; - UINTN DramSize; - - DramSize =3D GetDramSize (); - DEBUG ((DEBUG_INFO, "DRAM Total Size 0x%lx \n", DramSize)); - - // Ensure DramSize has been set - ASSERT (DramSize !=3D 0); - - I =3D 0; - - do { - ArmSmcArgs.Arg0 =3D SMC_DRAM_BANK_INFO; - ArmSmcArgs.Arg1 =3D I; - - ArmCallSmc (&ArmSmcArgs); - if (ArmSmcArgs.Arg0) { - if (I > 0) { - break; - } else { - ASSERT (ArmSmcArgs.Arg0 =3D=3D 0); - } - } - - DramInfo->DramRegion[I].BaseAddress =3D ArmSmcArgs.Arg1; - DramInfo->DramRegion[I].Size =3D ArmSmcArgs.Arg2; - - DramSize -=3D DramInfo->DramRegion[I].Size; - - DEBUG ((DEBUG_INFO, "bank[%d]: start 0x%lx, size 0x%lx\n", - I, DramInfo->DramRegion[I].BaseAddress, DramInfo->DramRegion[I].Size= )); - - I++; - } while (DramSize); - - DramInfo->NumOfDrams =3D I; - - DEBUG ((DEBUG_INFO, "Number Of DRAM in system %d \n", DramInfo->NumOfDra= ms)); - - return EFI_SUCCESS; -} --=20 2.17.1