From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.42.73; helo=nam03-by2-obe.outbound.protection.outlook.com; envelope-from=vabhav.sharma@nxp.com; receiver=edk2-devel@lists.01.org Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0073.outbound.protection.outlook.com [104.47.42.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 089B422183C83 for ; Fri, 1 Dec 2017 08:11:41 -0800 (PST) Received: from MWHPR03CA0022.namprd03.prod.outlook.com (10.175.133.160) by CY4PR03MB2694.namprd03.prod.outlook.com (10.173.43.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Fri, 1 Dec 2017 16:16:06 +0000 Received: from BN1AFFO11FD040.protection.gbl (2a01:111:f400:7c10::150) by MWHPR03CA0022.outlook.office365.com (2603:10b6:300:117::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.282.5 via Frontend Transport; Fri, 1 Dec 2017 16:16:05 +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 BN1AFFO11FD040.mail.protection.outlook.com (10.58.52.251) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.239.4 via Frontend Transport; Fri, 1 Dec 2017 16:16:05 +0000 Received: from uefi-OptiPlex-790.ap.freescale.net ([10.232.132.56]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vB1GFp1r007956; Fri, 1 Dec 2017 09:16:02 -0700 From: Vabhav To: , , , Date: Fri, 1 Dec 2017 09:44:19 +0530 Message-ID: <1512101660-11714-4-git-send-email-vabhav.sharma@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1512101660-11714-1-git-send-email-vabhav.sharma@nxp.com> References: <1512101660-11714-1-git-send-email-vabhav.sharma@nxp.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131566185654407702; (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)(39380400002)(376002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(50944005)(86362001)(575784001)(33646002)(316002)(16799955002)(106466001)(5660300001)(97736004)(15188155005)(36756003)(498600001)(77096006)(105606002)(966005)(2950100002)(6666003)(8936002)(8656006)(47776003)(53936002)(6306002)(50226002)(356003)(85426001)(2870700001)(8676002)(23676004)(81166006)(5820100001)(2906002)(53376002)(68736007)(81156014)(2201001)(189998001)(50466002)(110136005)(54906003)(4326008)(305945005)(104016004)(76176011)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2694; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD040; 1:i/TEnoIWpx3ibB2YveFuxvJJ7TbgvVcKX1ePSVjJhFVgc0t+T791gocTL101No+OvOxlKVdK1DGRmzRbSZDIC6hXSUc7EZZksImx1Cq/OVP0ucdJWofQBnD4fgRu8vsK X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6c23a7c8-3802-4f23-8f54-08d538d6d2d4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603286); SRVR:CY4PR03MB2694; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 3:3oVORl6wQUg3j/ETE9TlJT65OkFzoiSYSLTNdbhqhkVnB+OkJd5AKGaMCi3J4jqTSfwf5AMrK5M8WkRcFonezIxPW2EWj7KlbUSo2d0hOXjkPClr7NwWhh9XP8+V7qj878Wm3m3AWIaZ8F+26CPq7JWOkIwvy7a+iWVuYLk4XZeUOvoKf7e23jNRMhcVJ8kZXstOxHcrFWTqCVCQ5dH3Y0hKEh1/FVYeHvIUe2pwOd/EMXX7EP0fw3Vy+xWvt+livIazo/H0Cj0ffoOE+pR3D3zZBTx5n7a5KP/4fFAbN/K5cRqSLEnxSKd3KZ5H9DSUKDz4zO+26gxgvDVD/dscQITV8Xqit1XCqGOKyrJhGrg=; 25:lXfmxougSYJ1oT3ebPP596vwxMTCBaNAv9t0xR6RCIT3VqNq+JjKDG2H8vIUrv2/5knB4bi27K3FCE5I71Q++un95baVdu7Gfd466bRRmUxCQnOcCUlvA+ZDmTZer5Gjj1PkILNqo6+FnMetj2v5lS1IAFidiyHK0oQlsALqEv5o11Gcfe8BISJAPzdju30oERvvxV5rcPdOecjt5ZDPaigU47P6lFzWSLm2tSTmlid7J3j4nluMvF2EDm5hN4HN2JXudonE7ztllWKsDAPt8zX61BGgaQL/rCQaepsRV4sTfRkND6g9/EWB0WI5J5dFt71qSMTMRhwEx13st66dTg== X-MS-TrafficTypeDiagnostic: CY4PR03MB2694: X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2694; 31:YVprTzRrGpUdQiF9SKlCimcHS9rH/iDKqkU/aL1/m9I7tJnM+LKT9LhQmEHjyd8LXe25212OsV07rNAotvZYNpf2Vbt8PIEGlN1zwEO6ZUZow0ySOHvm/vutWW7ut/WVcabj52PfV7mqzWZUE2N0wNSAdFkvqa2qe//gjQyC53tHqTEpVH+EHdE7pj32aVt6YAD4UXQkUlbDM1su7lBz4+0z0XZLcDxaT4OEJjQofNA=; 4:NbplBfStKeFIeAIBe4yNTDyEQymFpcDOq2KTNKzhuyi/C9NrgBLad4Y6OcS1dj1POqEsylLM5KEeyYdk4XMIhKkKvlGrc5agfpaG8Q/8N8Cf2SNr22Jcu3Mp5SR3WG44GkVNh831EikvckDvFuBSDtCwqPH8Y5+unQddTZvRYXq+oIFxZWlybwJK00dagdTuD+lLG/YmxylW7JDiRG/7HhIX0vOgzJfVzRJ3OX5ScXRcqNLWu7L5mQGfvAQSYS+Ix6M99c3N8sHqcnI6k7ugaCAfAzuFazbA8gUrg+eJwOoOsF+nQeC3WwuynywGpd+O X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3231022)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123561025)(20161123563025)(20161123556025)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(201708071742011); SRVR:CY4PR03MB2694; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY4PR03MB2694; X-Forefront-PRVS: 05087F0C24 X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjAzTUIyNjk0OzIzOkJZV0M1MHRoWG81dmliUDdvRHBnR2l5bU5Y?= =?utf-8?B?cEdiTllIMFYxdUZCZnRRZXk1TnozRG1VNG0vK2pSUzdycUFiNDhBS09DbFdt?= =?utf-8?B?a2FUVU00ZW5QM09leURPVnlOKzhzZzdmVHJYRFVGTGlXZmZDaUI1M2lBQW03?= =?utf-8?B?TU5kbnJqdTI3VFNzSU1mSjBRdWF4YnlyY282RlRvdi8wRW5IVUlZcm1LRzdl?= =?utf-8?B?NXlFRm1CN3pkQWR1YXJtVzlhbHVCQ1ZBWHpRKytqOVlwa01PRWYrVEpnM0Rj?= =?utf-8?B?OXpnUX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357EacAUYX5JsWBZnAMOKQEjw57KnzqbPrsq9HpBTLW2PaZ6P8X6ICArn2f4drZ3ok+vZPCljhTQU=; 5:cmiC4M5agk1Pepb2fW74YHsZ02I60KakEFZUn75IE+gOXLe2iot3JTC26VNuQ7WMmLPQYjcsvhgBqYV6rdy+98v1q07I6+acj9DFOPprlN6d4tHrELbUN+ECRb1S6879hDNoz6SG+63LBhpBlSoiSfMNdWjOJhMxMI3v9C15KjI=; 24:oOoYHafZS0nB9tLeke0dyMY2Njro9SMUCHaiPLXlZXpDQEr6AWLUctYnLWoSj2aBtfxvOwphxzZ0HUHO7CdBXCeGcKq5hedOJrwI/ppHW80=; 7:g2Tayxt/p6JoaLumVzRYYj2JIWynZsWwzMMx3VfG2hkjKm6iv02U8zIOTljkNrVp66D5M5N9G08QIXJmk+PLu3B5VndKwiiGvo65PLJkeZYjMltobnVncEEzadsCI7D1qAMqOOpT+xWOgnpemH0RbnHB+aSqCpS6SizgYpIiZSvEP6QBK6DdE6la4UAClS79trTPo8kCSGbR+6aqIKKxAgU8FgxwrVTylhH4zAfOqzX9HHD5BzoS7YKidpOTPlvZ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2017 16:16:05.0195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c23a7c8-3802-4f23-8f54-08d538d6d2d4 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: CY4PR03MB2694 Subject: [PATCH 3/4] 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: Fri, 01 Dec 2017 16:11:41 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit This patch adds support of adding ArmPlatformLib for NXP LS1046ARDB board Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Vabhav --- .../Library/PlatformLib/ArmPlatformLib.c | 106 ++++++++++++ .../Library/PlatformLib/ArmPlatformLib.inf | 70 ++++++++ .../Library/PlatformLib/NxpQoriqLsHelper.S | 39 +++++ .../Library/PlatformLib/NxpQoriqLsMem.c | 181 +++++++++++++++++++++ 4 files changed, 396 insertions(+) create mode 100644 Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.c create mode 100644 Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf create mode 100644 Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S create mode 100644 Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c diff --git a/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.c b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.c new file mode 100644 index 0000000..e2b645f --- /dev/null +++ b/Platform/NXP/LS1046aRdbPkg/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 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 +#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 +**/ +RETURN_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + SocInit(); + return RETURN_SUCCESS; +} + +ARM_CORE_INFO LS1046aMpCoreInfoCTA72x4[] = { + { + // 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(LS1046aMpCoreInfoCTA72x4) / sizeof(ARM_CORE_INFO); + *ArmCoreTable = LS1046aMpCoreInfoCTA72x4; + + 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/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf new file mode 100644 index 0000000..033f77a --- /dev/null +++ b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf @@ -0,0 +1,70 @@ +#/* @file +# Copyright (c) 2011-2013, ARM Limited. All rights reserved. +# Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +# +# 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 = ArmPlatformLib + FILE_GUID = 177a95a8-27c2-4582-8ba9-c87aa3e0ba75 + 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] + NxpQoriqLsHelper.S | GCC + ArmPlatformLib.c + NxpQoriqLsMem.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/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S new file mode 100644 index 0000000..55e750f --- /dev/null +++ b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S @@ -0,0 +1,39 @@ +# @file +# +# Based on BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardHelper.S +# +# 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/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c new file mode 100644 index 0000000..613ff04 --- /dev/null +++ b/Platform/NXP/LS1046aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c @@ -0,0 +1,181 @@ +/** 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[out] 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 = 0; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + + 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