From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.38.85; helo=nam02-bl2-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0085.outbound.protection.outlook.com [104.47.38.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 01BCF2034EE06 for ; Tue, 7 Nov 2017 00:50:45 -0800 (PST) Received: from BN6PR03CA0015.namprd03.prod.outlook.com (10.168.230.153) by BN3PR03MB2355.namprd03.prod.outlook.com (10.166.74.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Tue, 7 Nov 2017 08:54:43 +0000 Received: from BN1AFFO11FD007.protection.gbl (2a01:111:f400:7c10::163) by BN6PR03CA0015.outlook.office365.com (2603:10b6:404:23::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.178.6 via Frontend Transport; Tue, 7 Nov 2017 08:54:43 +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 BN1AFFO11FD007.mail.protection.outlook.com (10.58.52.67) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.178.5 via Frontend Transport; Tue, 7 Nov 2017 08:54:43 +0000 Received: from uefi-OptiPlex-790.ap.freescale.net (uefi-OptiPlex-790.ap.freescale.net [10.232.132.78]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vA78s4Df009319; Tue, 7 Nov 2017 01:54:40 -0700 From: Meenakshi Aggarwal To: , , , Date: Tue, 7 Nov 2017 20:12:14 +0530 Message-ID: <1510065736-9394-9-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510065736-9394-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1510065736-9394-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131545184835452667; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7966004)(376002)(39380400002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(50944005)(199003)(189002)(36756003)(356003)(76176999)(86362001)(50986999)(575784001)(316002)(15188155005)(48376002)(5660300001)(6306002)(16586007)(16799955002)(54906003)(110136005)(50466002)(305945005)(33646002)(106466001)(5003940100001)(50226002)(105606002)(53936002)(966005)(85426001)(2201001)(189998001)(8676002)(8656006)(81156014)(6666003)(4326008)(81166006)(2950100002)(97736004)(104016004)(8936002)(77096006)(47776003)(68736007)(53376002)(2906002)(498600001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2355; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD007; 1:OCTfb2Q3Xrw1eAM82KjT8CwDM97aNZNf4G+uWsYdRdmF7Fq3aSLcyYFzMip/ltsebKXlwnQfMPQgOf48d/jFq3rvlxYcWWubtdzSBkwm70xlGrJuHcRrNyPAmODu4uIO MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84158db1-287a-4a16-5d99-08d525bd307c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603249); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 3:SmuEtYbYEH76zSSvNxvwT0XWEdudFZwVxZaufeqy5faTSu63f5Y9Xr0gvaGEJZo1TlPUmu2qLS7pkPA2jsGZ839rtK+ILbqv1RwLaAAu3AqtXpISw8X2m7AyuLu3Xp/NOpxQmYb+Lp/P1NClQTwkUzaZfnlW8dJt5g0uuEnElZd6u7JYzgjGC2HemIdHAfADfviYCOqJMWy0TbXfJpUDgBOY2yinVHJOSwD8wU/v+hCYVOuGFbSmxGGm2XGixTmu1lXgortKzQ8+/vONdpyBRH5LBlTY7hfQHnzVl4bGL3cFxDLbLGaaSSCRqZVl1YIyRg0lHaV0UPCfbgYVDWuABW8FQMfR7R7I4TVqk7NTV4Y=; 25:PfdVMgNhDuEMEOB3ysi+533rHGlFPt2CLkWsfGvVyDPm4+Q55F2MsgTWfpLR0M/6LzKblqxM963lE3+FRMukGZEfRXpYRPEMvN0pcwy3it5I6hvvrUr5pUaHAfX2QKxJ+67UEhxmb8fj/E7TaIUPLVetyL0StrZDTCAuN36w72yrVCfj6ct0+s0gYGJ4w3hFZMBoXOKajL8VtK3BFu/dnzfxRyO/rSE1n4dg0V2oP+mTCRXmEmEtf1dFiWuZEDSKsYAv3tSpG7zVrdzY/ke2BgIJ8ymmvcEjTiM4bC8dPByaQou55Gl4SlfYlnkfqSZJKsSz4vTpisEQQE/8/b6Bmg== X-MS-TrafficTypeDiagnostic: BN3PR03MB2355: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 31:FAuwY06DCND3A+WHG9/ZdkyIWNeOEJ1ONUMHv9myXL7/h+emZKJLyL+zM3V2dm1sas/kYlnidGwnJZENMWS68e3Vi9EZrRphZ+zM3BGhT04KwHf0q5wlDlr3MqBalrsoexOByt0Dzc/1PnzUcllimuPZyGkMhdmSy+SKoutpBqwT2D/wMSNe7tmIBUa0XV/pRa5a6NX3IYOJ1silxjbflZQstP4X56E1yN4k0GWlyGU=; 4:8di6m6ReJNBbXF5SHKry7ww+tOQ4cnYZ8OBsScANXjaLNOVRKVVSo1pd73s9Kn65qnULfabjmBDLNcozjxVFHaOSZJG8JxclD4I4B2ravQF9ziPdIo6fQqCIw+r5wSqf2jytF89jRIIPWlQedgMxy1LMaE8c1nVmMZrVRcLiatkCbg7If82HEa6grUMw9bi/Rl2L9bTN6iQ11i/ubjd0PEXxLr+nZoC/3LQ2LvNXMfc23SOURdycJBp/Z8tAZCa8qqs2wERG22CqjlGXb6Lj3WyMPzUru9G0PiXrbiG5GxVevzCrNmXPHhKFe3cPqhh2 X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231021)(100000703101)(100105400095)(6055026)(6096035)(20161123559100)(20161123556025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123561025)(20161123563025)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2355; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2355; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2355; 23:h7ag2qXZpgrT+A+9X1+/lFdkFDNVbRDX63xdnHZtY?= =?us-ascii?Q?MdtExpIIHa5KzgYY3vQEg7OzcJCED9XdgZ/511LAk1qJe9Pqd2mP/4O6Q+iY?= =?us-ascii?Q?fRR00l1wjnrIZ4gMzmEB2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kSV8d1QtOwaOLlTryl0rUbz47pR6B1Z2E28V7OxKB1LckxDLDHIhP8LUq8pk8oYsCx2w=; 7:0fv6q627ej/6yA+vbbxinXZs/D9G1kky+eu0EcVXk2E8zhLQblxBqR0Gg/yyo90sTash4gAJ6jfKNSQLGUXXcZ/07LM60LsqZLWHHLecVJ2fIf0w38v6X1X5z4JVljpSbEtszyjxOGH1TrfYARRycxG1MJhUr+lTAhsweI1qc7F98kFlZVWO1UYd3/2FJxUqzn79etPbbUi0G+9pgGTDSR5toJcBT84TCQHE3yGB3TGusr0IYVGc0w6d7RY1Y1zi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:43.3580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84158db1-287a-4a16-5d99-08d525bd307c 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: BN3PR03MB2355 Subject: [PATCH 08/10] Platform/NXP: Add support for ArmPlatformLib X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Nov 2017 08:50:46 -0000 Content-Type: text/plain Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- .../Library/PlatformLib/ArmPlatformLib.c | 105 ++++++++++++ .../Library/PlatformLib/ArmPlatformLib.inf | 70 ++++++++ .../Library/PlatformLib/NxpQoriqLsHelper.S | 38 +++++ .../Library/PlatformLib/NxpQoriqLsMem.c | 184 +++++++++++++++++++++ 4 files changed, 397 insertions(+) create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.c create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.c b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.c new file mode 100644 index 0000000..21deb41 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.c @@ -0,0 +1,105 @@ +/** 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 LS1043aMpCoreInfoCTA53x4[] = { + { + // 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(LS1043aMpCoreInfoCTA53x4) / sizeof(ARM_CORE_INFO); + *ArmCoreTable = LS1043aMpCoreInfoCTA53x4; + + 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/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf new file mode 100644 index 0000000..43956f7 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf @@ -0,0 +1,70 @@ +# @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 = 0x00010005 + BASE_NAME = PlatformLib + FILE_GUID = 736343a0-1d96-11e0-aaaa-0002a5d5c51b + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmPlatformLib + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + +[LibraryClasses] + ArmLib + SocLib + +[Sources.common] + NxpQoriqLsHelper.S | GCC + NxpQoriqLsMem.c + ArmPlatformLib.c + +[Ppis] + gArmMpCoreInfoPpiGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmPrimaryCore + gNxpQoriqLsTokenSpaceGuid.PcdCcsrBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdCcsrSize + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1Size + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2Size + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpSize + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdDram1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram1Size + gNxpQoriqLsTokenSpaceGuid.PcdDram2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram2Size + gNxpQoriqLsTokenSpaceGuid.PcdDram3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram3Size + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionSize diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S new file mode 100644 index 0000000..205c0d8 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S @@ -0,0 +1,38 @@ +# @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) +EL1_OR_EL2(x0) +1: +2: + ret + +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (x0, FixedPcdGet32(PcdArmPrimaryCore)) + ldrh w0, [x0] + ret diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c new file mode 100644 index 0000000..4b4f558 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c @@ -0,0 +1,184 @@ +/** 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 + +#define CCSR_BASE_ADDR FixedPcdGet64 (PcdCcsrBaseAddr) +#define CCSR_SIZE FixedPcdGet64 (PcdCcsrSize) +#define IFC_REGION1_BASE_ADDR FixedPcdGet64 (PcdIfcRegion1BaseAddr) +#define IFC_REGION1_SIZE FixedPcdGet64 (PcdIfcRegion1Size) +#define IFC_REGION2_BASE_ADDR FixedPcdGet64 (PcdIfcRegion2BaseAddr) +#define IFC_REGION2_SIZE FixedPcdGet64 (PcdIfcRegion2Size) +#define QMAN_SWP_BASE_ADDR FixedPcdGet64 (PcdQmanSwpBaseAddr) +#define QMAN_SWP_SIZE FixedPcdGet64 (PcdQmanSwpSize) +#define BMAN_SWP_BASE_ADDR FixedPcdGet64 (PcdBmanSwpBaseAddr) +#define BMAN_SWP_SIZE FixedPcdGet64 (PcdBmanSwpSize) +#define PCI_EXP1_BASE_ADDR FixedPcdGet64 (PcdPciExp1BaseAddr) +#define PCI_EXP1_BASE_SIZE FixedPcdGet64 (PcdPciExp1BaseSize) +#define PCI_EXP2_BASE_ADDR FixedPcdGet64 (PcdPciExp2BaseAddr) +#define PCI_EXP2_BASE_SIZE FixedPcdGet64 (PcdPciExp2BaseSize) +#define PCI_EXP3_BASE_ADDR FixedPcdGet64 (PcdPciExp3BaseAddr) +#define PCI_EXP3_BASE_SIZE FixedPcdGet64 (PcdPciExp3BaseSize) +#define DRAM1_BASE_ADDR FixedPcdGet64 (PcdDram1BaseAddr) +#define DRAM1_SIZE FixedPcdGet64 (PcdDram1Size) +#define DRAM2_BASE_ADDR FixedPcdGet64 (PcdDram2BaseAddr) +#define DRAM2_SIZE FixedPcdGet64 (PcdDram2Size) +#define DRAM3_BASE_ADDR FixedPcdGet64 (PcdDram3BaseAddr) +#define DRAM3_SIZE FixedPcdGet64 (PcdDram3Size) +#define QSPI_REGION_BASE_ADDR FixedPcdGet64 (PcdQspiRegionBaseAddr) +#define QSPI_REGION_SIZE FixedPcdGet64 (PcdQspiRegionSize) + +/** + 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 = DRAM1_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = DRAM1_BASE_ADDR; + VirtualMemoryTable[Index].Length = DRAM1_SIZE; + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // CCSR Space + VirtualMemoryTable[++Index].PhysicalBase = CCSR_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = CCSR_BASE_ADDR; + VirtualMemoryTable[Index].Length = CCSR_SIZE; + 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 = IFC_REGION1_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = IFC_REGION1_BASE_ADDR; + VirtualMemoryTable[Index].Length = IFC_REGION1_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // QMAN SWP + VirtualMemoryTable[++Index].PhysicalBase = QMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = QMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].Length = QMAN_SWP_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + // BMAN SWP + VirtualMemoryTable[++Index].PhysicalBase = BMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = BMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].Length = BMAN_SWP_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + // IFC region 2 + VirtualMemoryTable[++Index].PhysicalBase = IFC_REGION2_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = IFC_REGION2_BASE_ADDR; + VirtualMemoryTable[Index].Length = IFC_REGION2_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // DRAM2 + VirtualMemoryTable[++Index].PhysicalBase = DRAM2_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = DRAM2_BASE_ADDR; + VirtualMemoryTable[Index].Length = DRAM2_SIZE; + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // PCIe1 + VirtualMemoryTable[++Index].PhysicalBase = PCI_EXP1_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = PCI_EXP1_BASE_ADDR; + VirtualMemoryTable[Index].Length = PCI_EXP1_BASE_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // PCIe2 + VirtualMemoryTable[++Index].PhysicalBase = PCI_EXP2_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = PCI_EXP2_BASE_ADDR; + VirtualMemoryTable[Index].Length = PCI_EXP2_BASE_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // PCIe3 + VirtualMemoryTable[++Index].PhysicalBase = PCI_EXP3_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = PCI_EXP3_BASE_ADDR; + VirtualMemoryTable[Index].Length = PCI_EXP3_BASE_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_DEVICE; + + // DRAM3 + VirtualMemoryTable[++Index].PhysicalBase = DRAM3_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = DRAM3_BASE_ADDR; + VirtualMemoryTable[Index].Length = DRAM3_SIZE; + VirtualMemoryTable[Index].Attributes = CacheAttributes; + + // QSPI region + VirtualMemoryTable[++Index].PhysicalBase = QSPI_REGION_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase = QSPI_REGION_BASE_ADDR; + VirtualMemoryTable[Index].Length = QSPI_REGION_SIZE; + VirtualMemoryTable[Index].Attributes = ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + + // 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; +} -- 1.9.1