From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.36.41; helo=nam02-sn1-obe.outbound.protection.outlook.com; envelope-from=wasim.khan@nxp.com; receiver=edk2-devel@lists.01.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0041.outbound.protection.outlook.com [104.47.36.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B3932222CB31A for ; Fri, 22 Dec 2017 02:47:27 -0800 (PST) Received: from MWHPR03CA0010.namprd03.prod.outlook.com (10.175.133.148) by MWHPR03MB2702.namprd03.prod.outlook.com (10.168.207.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Fri, 22 Dec 2017 10:52:15 +0000 Received: from BY2FFO11FD009.protection.gbl (2a01:111:f400:7c0c::166) by MWHPR03CA0010.outlook.office365.com (2603:10b6:300:117::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Fri, 22 Dec 2017 10:52:15 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD009.mail.protection.outlook.com (10.1.14.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Fri, 22 Dec 2017 10:52:00 +0000 Received: from wasimk-VirtualBox.ap.freescale.net (B48164-17.ap.freescale.net [10.232.40.31]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vBMAq18R014260; Fri, 22 Dec 2017 03:52:12 -0700 From: Wasim Khan To: , , , Date: Fri, 22 Dec 2017 16:21:54 +0530 Message-ID: <1513939917-19336-2-git-send-email-wasim.khan@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513939917-19336-1-git-send-email-wasim.khan@nxp.com> References: <1513939917-19336-1-git-send-email-wasim.khan@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131584135209358672; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(7966004)(376002)(396003)(39380400002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(50944005)(199004)(189003)(86362001)(53376002)(4326008)(47776003)(16586007)(356003)(106466001)(53936002)(8656006)(105606002)(316002)(54906003)(110136005)(16799955002)(15188155005)(8936002)(77096006)(2950100002)(305945005)(76176011)(966005)(50466002)(50226002)(2906002)(8676002)(81156014)(51416003)(5660300001)(6666003)(6306002)(68736007)(81166006)(2201001)(104016004)(498600001)(97736004)(85426001)(48376002)(36756003)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2702; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD009; 1:RSIr+TxNxobAl+8hwYd/zF/6YBaWAe1SyEEwGB32ghvib3FRi8JuDBoTxmtJ4qo3uPfNAGY+g77i74pMdUB5sbkm+56PXeWBuee+/OOMudn2jzGTf0jrd0SA4W/z3QIH MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: aba18182-8b17-45e0-1550-08d5492a07b2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603307); SRVR:MWHPR03MB2702; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 3:nDyZ87Ngrv4z6B/7oFK/3/oI+rLEmMosr5NVjysNnvzPR4FzQrmxU5u5e+yim/825CCHsP/eVgc0Q+61fnHwGnM1JWOrzwK8ax6VZdUkPupvqZ0wHdA5VGkOvy44ORQd/X2xoUeHW2C/v8Nmz4xmKjgjGebsHF65O6U9nh6DXncB9lRODbe6MlHBHaq2Lk/9YN62m5VKk9kvCFOMXwzyBWAiNlGZde0PzFP9VM5Ks3ci/2+KFGSizIP2Fb2xJASEcrYgbkRl3Fs2lUMup5DQFz4pAZBiqXw3chWH8KtnoWDlJ0D3+VSeJnMyLeW79+hxYNdUthB9aO/ijTRtKkVuQPiwaIVpdqizJPZj8H6bek4=; 25:dcCZQyvk+D2bYpvNnjxKVZUO7nfyLHFauhlXMJaAuQ/AUOesD2izi4nNNn3062vIyH5918jXtPETvF1GTKhLzirLd6i9Aed8N78LRaAMBdPeuy7opntgf+ho8MsJFXhNPe3vbZOWD+YEQZUg+Eldro260C5RpEypbrjD4+mNg7lNr/jy8BQtCbhkBA26vyTDJJekqDIS7DhP6TMX13CvlFAo8A6OeTgZ/SWEnHUoxAbfbijBdku74uWqrWKl84izWobs4p2dwA8XvOjMp/XMeuJ6A8JbSGMq3MSmKZZjbHC4lySHx8lHMkecrZ7cvJmcQS5kWauhiXx0VtkuS22dgAXO2DPkR9JjS97hKbnYscc= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR03MB2702: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 31:sRi3rVGvAjNlJNzlGgjgmnNDBMhnMK71dqO8yIFBeuAztbiU7gv0+npw6QMePIjbDffYr2sHxe2h6bxeS06w4ffO6RpjjWrcSdd2dBQERkaWsWlAIZN2g9Vl5yUGjTEva1MMmY6YetB/KaioickI+7ZJL7bOHTf1j19RithfEmwiaMhQJ/qzYKS6yar47CB7BY1H0x2G4hHj9uze/her9BGsTkDPGKdnvpZQj+EPJ5M=; 4:I1FBwDz9UFEm8Rh69+BYgr6/gqCM3o3LAB7bg8klj+FdJasUzV33Nh+VbprBnxUGzOBjltU17v5Iq4g5Geu5tY5sfGXGFRUzdCISKDeHG/Lx+Cxo4uKkimA0N+MJmOOPBnbKAjRVcUDM4jhdqHNd5XfkNPMeKlxs6qSDyE/0EI+Mq3kAhVbMYNhRmC3Bdq+dxquCfOKSCvE/jUb9OpOn68dztPIU5T555CsPqEg0LDeBODjgxy40mrKi5Kd+HzR0IVNIvscsvCGpAbjX0xjVG9lw+et1IVKgQIG1jN4/NUxsduWYrYEpQd1nQt0A/CY9ujbeAlT897B/VYJZ08r32MzX8RJC4Sh42Eyz/fRbnK0= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(227817650892897); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231023)(944510041)(944921041)(946801041)(946901041)(6055026)(6096035)(20161123563025)(20161123565025)(20161123561025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123556025)(201708071742011); SRVR:MWHPR03MB2702; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2702; X-Forefront-PRVS: 05299D545B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2702; 23:SbxIwR0x69Z3iU6zRoFJokvnXnel47z90BEhiPFi8?= =?us-ascii?Q?vEpVt7A/4QvrxwJ+8TZKzvJYi0CTuZCD4TidsFlx3orbNiblOAryYp5TfXjh?= =?us-ascii?Q?Cz6HQX3tyHQ7SmmoOvigI2qrKVhwwhwh4c+LkbTjeCGXdMHKtbhHY7JojBgv?= =?us-ascii?Q?ZBlbVcvyhB2bgpICujvtv2WtuY0pebEQAriNtbZdud7AavYuZurEdXAWnIUp?= =?us-asc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dd+B13j6+X05lErkH22ZFGUHF85/fPYVK5Jrs+3H7+SsNu1Naq5g87w/FhinZpNyTFQ0Q+FaAZq7i/XnEtH+CIYVENP1WZvC7OJ2d5wHKkPU4DDw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2017 10:52:00.7486 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aba18182-8b17-45e0-1550-08d5492a07b2 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2702 Subject: [PATCH edk2-platforms 1/4] Platform/NXP: Add support for ArmPlatformLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Dec 2017 10:47:28 -0000 Content-Type: text/plain This patch adds support of adding ArmPlatformLib for NXP LS2088ARDB board Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Wasim Khan --- .../Library/PlatformLib/ArmPlatformLib.c | 106 +++++++++++ .../Library/PlatformLib/ArmPlatformLib.inf | 80 +++++++++ .../Library/PlatformLib/NxpQoriqLsHelper.S | 35 ++++ .../Library/PlatformLib/NxpQoriqLsMem.c | 196 +++++++++++++++++++++ 4 files changed, 417 insertions(+) create mode 100644 Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.c create mode 100644 Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf create mode 100644 Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S create mode 100644 Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c diff --git a/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.c b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.c new file mode 100644 index 0000000..90f14ba --- /dev/null +++ b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.c @@ -0,0 +1,106 @@ +/** ArmPlatformLib.c +* +* Contains board initialization functions. +* +* Based on BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +* Copyright 2017 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include + +extern VOID SocInit (VOID); + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Placeholder for Platform Initialization + +**/ +EFI_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + SocInit (); + + return EFI_SUCCESS; +} + +ARM_CORE_INFO LS2088aMpCoreInfoCTA72x4[] = { + { + // Cluster 0, Core 0 + 0x0, 0x0, + + // MP Core MailBox Set/Get/Clear Addresses and Clear Value + (EFI_PHYSICAL_ADDRESS)0, + (EFI_PHYSICAL_ADDRESS)0, + (EFI_PHYSICAL_ADDRESS)0, + (UINT64)0xFFFFFFFF + }, +}; + +EFI_STATUS +PrePeiCoreGetMpCoreInfo ( + OUT UINTN *CoreCount, + OUT ARM_CORE_INFO **ArmCoreTable + ) +{ + *CoreCount = sizeof (LS2088aMpCoreInfoCTA72x4) / sizeof (ARM_CORE_INFO); + *ArmCoreTable = LS2088aMpCoreInfoCTA72x4; + + return EFI_SUCCESS; +} + +ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo }; + +EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gArmMpCoreInfoPpiGuid, + &mMpCoreInfoPpi + } +}; + +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + *PpiListSize = sizeof (gPlatformPpiTable); + *PpiList = gPlatformPpiTable; +} + + +UINTN +ArmPlatformGetCorePosition ( + IN UINTN MpId + ) +{ + return 1; +} diff --git a/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf new file mode 100644 index 0000000..bac6d26 --- /dev/null +++ b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf @@ -0,0 +1,80 @@ +#/** @file +# +# Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +# Copyright 2017 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +#**/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = PlatformLib + FILE_GUID = d1361285-8a47-421c-9efd-6b262c9093fc + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Platform/NXP/NxpQoriqLs.dec + +[LibraryClasses] + ArmLib + SocLib + +[Sources.common] + ArmPlatformLib.c + NxpQoriqLsHelper.S | GCC + NxpQoriqLsMem.c + + +[Ppis] + gArmMpCoreInfoPpiGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmPrimaryCore + gNxpQoriqLsTokenSpaceGuid.PcdCcsrBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdCcsrSize + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1Size + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2Size + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionSize + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegion2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegion2Size + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp4BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp4BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdDram1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram1Size + gNxpQoriqLsTokenSpaceGuid.PcdDramMemSize + gNxpQoriqLsTokenSpaceGuid.PcdDram2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram2Size + gNxpQoriqLsTokenSpaceGuid.PcdMcHighMemSupport + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McRamSize + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McPortalBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McPortalSize + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2NiPortalsBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2NiPortalsSize + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2QBmanPortalsBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2QBmanPortalSize + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2QBmanPortalsCacheSize + diff --git a/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S new file mode 100644 index 0000000..1917b02 --- /dev/null +++ b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S @@ -0,0 +1,35 @@ +#/** @file +# +# Copyright (c) 2012-2013, ARM Limited. All rights reserved. +# Copyright 2017 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the BSD License +# which accompanies this distribution. The full text of the license may be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +# +#**/ + +#include +#include + +.text +.align 2 + +GCC_ASM_IMPORT(ArmReadMpidr) + +ASM_FUNC(ArmPlatformIsPrimaryCore) + tst x0, #3 + cset x0, eq + ret + +ASM_FUNC(ArmPlatformPeiBootAction) + ret + +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (x0, FixedPcdGet32(PcdArmPrimaryCore)) + ldrh w0, [x0] + ret diff --git a/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c new file mode 100644 index 0000000..f2ea308 --- /dev/null +++ b/Platform/NXP/LS2088aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c @@ -0,0 +1,196 @@ +/** NxpQoriqLsMem.c +* +* Board memory specific Library. +* +* Based on BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardMem.c +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +* Copyright 2017 NXP +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#include +#include +#include +#include + +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 25 + +// +// Calculate the MC (Management Complex) base address and DDR size based on +// if the MC is loaded in DDR low memory region or in DDR high memory region. +// +#if FixedPcdGetBool (PcdMcHighMemSupport) +#define DDR_MEM_SIZE FixedPcdGet64 (PcdDramMemSize) - FixedPcdGet64 (PcdDpaa2McRamSize) +#define MC_BASE_ADDR FixedPcdGet64 (PcdDram2BaseAddr) + DDR_MEM_SIZE +#else +#define DDR_MEM_SIZE FixedPcdGet64 (PcdDramMemSize) +#define MC_BASE_ADDR FixedPcdGet64 (PcdDram1BaseAddr) - FixedPcdGet64 (PcdDpaa2McRamSize) +#endif + + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize the MMU on your platform. + + @param VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR describing a Physical-to- + Virtual Memory mapping. This array must be ended by a zero-filled + entry + +**/ + +VOID +ArmPlatformGetVirtualMemoryMap ( + IN ARM_MEMORY_REGION_DESCRIPTOR ** VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; + UINTN Index; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + + Index = 0; + + ASSERT (VirtualMemoryMap != NULL); + + VirtualMemoryTable = (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages ( + EFI_SIZE_TO_PAGES (sizeof (ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS)); + + if (VirtualMemoryTable == NULL) { + return; + } + + if (FeaturePcdGet (PcdCacheEnable) == TRUE) { + CacheAttributes = ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + } else { + CacheAttributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + } + + // DRAM1 (Must be 1st entry) + VirtualMemoryTable[Index].PhysicalBase = FixedPcdGet64 (PcdDram1BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdDram1BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdDram1Size); + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // CCSR Space + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdCcsrBaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdCcsrBaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdCcsrSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // IFC region 1 + // + // A-009241 : Unaligned write transactions to IFC may result in corruption of data + // Affects : IFC + // Description: 16 byte unaligned write from system bus to IFC may result in extra unintended + // writes on external IFC interface that can corrupt data on external flash. + // Impact : Data corruption on external flash may happen in case of unaligned writes to + // IFC memory space. + // Workaround: Following are the workarounds: + // For write transactions from core, IFC interface memories (including IFC SRAM) + // should be configured as device type memory in MMU. + // For write transactions from non-core masters (like system DMA), the address + // should be 16 byte aligned and the data size should be multiple of 16 bytes. + // + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdIfcRegion1BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdIfcRegion1BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdIfcRegion1Size); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // IFC region 2 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdIfcRegion2BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdIfcRegion2BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdIfcRegion2Size); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // QSPI region 1 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdQspiRegionBaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdQspiRegionBaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdQspiRegionSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + // QSPI region 2 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdQspiRegion2BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdQspiRegion2BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdQspiRegion2Size); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + // DRAM2 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdDram2BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdDram2BaseAddr); + VirtualMemoryTable[Index].Length = DDR_MEM_SIZE; + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // MC private DRAM + VirtualMemoryTable[++Index].PhysicalBase = MC_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = MC_BASE_ADDR; + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdDpaa2McRamSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // PCIe1 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdPciExp1BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdPciExp1BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdPciExp1BaseSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // PCIe2 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdPciExp2BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdPciExp2BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdPciExp2BaseSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // PCIe3 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdPciExp3BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdPciExp3BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdPciExp3BaseSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // PCIe4 + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdPciExp4BaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdPciExp4BaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdPciExp4BaseSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // DPAA2 MC Portals region + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdDpaa2McPortalBaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdDpaa2McPortalBaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdDpaa2McPortalSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // DPAA2 NI Portals region + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdDpaa2NiPortalsBaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdDpaa2NiPortalsBaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdDpaa2NiPortalsSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // DPAA2 QBMAN Portals - cache enabled region + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdDpaa2QBmanPortalsBaseAddr); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdDpaa2QBmanPortalsBaseAddr); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdDpaa2QBmanPortalsCacheSize); + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // DPAA2 QBMAN Portals - cache inhibited region + VirtualMemoryTable[++Index].PhysicalBase = FixedPcdGet64 (PcdDpaa2QBmanPortalsBaseAddr) + FixedPcdGet64 (PcdDpaa2QBmanPortalsCacheSize); + VirtualMemoryTable[Index].VirtualBase = FixedPcdGet64 (PcdDpaa2QBmanPortalsBaseAddr) + FixedPcdGet64 (PcdDpaa2QBmanPortalsCacheSize); + VirtualMemoryTable[Index].Length = FixedPcdGet64 (PcdDpaa2QBmanPortalSize) - FixedPcdGet64 (PcdDpaa2QBmanPortalsCacheSize); + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // End of Table + VirtualMemoryTable[++Index].PhysicalBase = 0; + VirtualMemoryTable[Index].VirtualBase = 0; + VirtualMemoryTable[Index].Length = 0; + VirtualMemoryTable[Index].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)0; + + ASSERT ((Index + 1) <= MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap = VirtualMemoryTable; +} -- 2.7.4