From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (EUR04-DB3-obe.outbound.protection.outlook.com [40.107.6.51]) by mx.groups.io with SMTP id smtpd.web10.10523.1591104401107888215 for ; Tue, 02 Jun 2020 06:26:41 -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=J7JtDKZA; spf=pass (domain: oss.nxp.com, ip: 40.107.6.51, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZW6NfqFaBUejoWXi6oYJa9m+YbwsQQZk2EwmepdPyPfx4i5q8beYv2+Ra/PF7LFHaSBvVreuWC1kGUsry4s0EyeNkZXN2tsQ7t0DSXnwcGJVfGwe8NGpCrLpg5ve+JDD5FKz63LfLBTFzBPnwCBC5mDU9BbqmBLvSNVnzWFrbAM58OQ0hhA9zSimpu05+RgxjaI6Rab6CxamMRuA2+6vtN+o+Nf9as7SX74lOkgh8HyKkiaPmdUtccb8iluOd5ayMbRhIDAarrnsgYMLnoPWNyWxkvqB1o1t4R/pal1chaoxSRIEJ23iNhuKqf4nlUU1B8uCRpQk60/b1Ybp3WhevA== 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=W8gLU4zzKX4l72GnH1bicgYf3NgpYI2LPMsLcqXyuDc=; b=feEw2YZ5mHs0ZhV5DtSS9c6tghpzWm1qANyXgusT9IQ7wJbIttcoo3dbXW3ouLWDu4c1QalJUD8sLKb4J6PrUURLgH9iN12pgA2O1+t53aeL9XMIYqQRqwr2K2WBHJpNjP5VxvNVZ9UdXXSE8CrBY1AXy27MxDI7zeyhp8ThEjFIjQ66cS4DDBNpdF33hyBrRMUAq1umUTYvq5oLM+yk7Khsw160mw6uUofq3PiOjXBRjm/MUQr7YIZ4MCXx8VUI7MZy2DPtiivxckO2J8MwCP88G93b8ui8Gj/2Uw5HhsP2UWd6gc8gJko2jKP08KyWQVLA2RsFeajB+C7xIr+yDQ== 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=W8gLU4zzKX4l72GnH1bicgYf3NgpYI2LPMsLcqXyuDc=; b=J7JtDKZAvgWfy9FVDTFyK8DOwMGcPWMni3YhLmCTKY27hSbXx3QTUgHinZOGsMdGR3bAIn9mDokYxIjpii/lcpFLNiirNxbjLgtIPcLu48yeCY8VYqtGHRH/LLW5sCXn9AbOUVKeSBeOqhCd+Fs33fUzcC8AJeaWpYDdB+Y0rUo= Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB5926.eurprd04.prod.outlook.com (2603:10a6:20b:af::31) by AM6PR04MB5702.eurprd04.prod.outlook.com (2603:10a6:20b:b0::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.17; Tue, 2 Jun 2020 13:26:38 +0000 Received: from AM6PR04MB5926.eurprd04.prod.outlook.com ([fe80::64fa:9421:3ffb:eed7]) by AM6PR04MB5926.eurprd04.prod.outlook.com ([fe80::64fa:9421:3ffb:eed7%4]) with mapi id 15.20.3066.018; Tue, 2 Jun 2020 13:26:38 +0000 From: "Pankaj Bansal" To: Leif Lindholm , Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Augustine Philips , Ard Biesheuvel , Arokia Samy , Kuldip Dwivedi Subject: [PATCH edk2-platforms 3/5] Platform/NXP/LS1046AFRWY: Add ArmPlatformLib Date: Tue, 2 Jun 2020 18:55:01 +0530 Message-ID: <20200602132503.27154-4-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602132503.27154-1-pankaj.bansal@oss.nxp.com> References: <20200602132503.27154-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: SG2PR02CA0109.apcprd02.prod.outlook.com (2603:1096:4:92::25) To AM6PR04MB5926.eurprd04.prod.outlook.com (2603:10a6:20b:af::31) 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 SG2PR02CA0109.apcprd02.prod.outlook.com (2603:1096:4:92::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Tue, 2 Jun 2020 13:26:35 +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: 91e0f706-6d09-4afe-7c80-08d806f89464 X-MS-TrafficTypeDiagnostic: AM6PR04MB5702: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-Forefront-PRVS: 0422860ED4 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rkhjVOs4D2A6/WJGHdE8OGexdosZaKB2xqQDWzsHNt87ESaQOKE1z5qgugWbWyTJgAkYo2tC+jpJj3nx/HRE0ipsavQjAMvS5aDUUNIHHlvdX3Cl2i2OdrMw14B1hInmMyJdcB+doqJJI9usn+b+S/xVcxE4K6HZrVymZkYbNAoQESGbwbXQ0ocGFRkkuxfSBkN1VmB784Rgv3HYqsCFxyiyJdOwnY/w46ptep35fy/pnTxNjJHPeWU5anDAU9b9U6IiTDJDhFEEMkybbaIR4oh5Q+Ol+J7e0Lc7t8Dow+mCo97B5jnMBbrkscsQAZM1jPnRoYfpaRPo2jW6guxNPjQ0CpQ0E9avjHySqQAT3cZdSAU7u5MApQDj7cUMcM6O X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB5926.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(2906002)(66946007)(2616005)(956004)(498600001)(66476007)(66556008)(8936002)(83380400001)(8676002)(19627235002)(5660300002)(186003)(86362001)(6666004)(16526019)(44832011)(110136005)(1076003)(6486002)(6506007)(6512007)(26005)(52116002)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: oQf4SDyBt06MaS9Ju4szcizKIONJcxa1vok83ZBn2I9QqZSDJ+XP4dcsvfVXDaACzeTIx4b1pZV2adYq99RtemW/QdXApeaQzlrF82LXnMouPnHFleMOGdS4v4o8S3jtAYkMz6qzsEQPJj7Z0O7a8Ej9xHySPtzGquobhnc00zEIwUfkT6+ePlv1m/G1NfwcDakEcRIINeZutXMd1gl2+8naqXXz5JMPDf+hsjgQVlXiFJhwL5L4ZUDJ6vPa6W93poSNC0JxPMT2dfXwfSxBgNBFtRTs78IWCyu4aR+ydTwvpq9zdKwAnkhGacloLXT6jGAdRBLPAIjJBPmIBJJFq8mwk7XcszpZE2mBr0zS3tre0uMABQsnJRCXckLrrunA5uLfDiZBZ0brDcMkXb/dLOUvIe45O4SxRUdK1Pgo0d3NYI6si9CzLK+vLcagVu0UBGkQg/nUMbp8QgzEl+OnT/tSktXLHL8sCsWz/ZvPZAY= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91e0f706-6d09-4afe-7c80-08d806f89464 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2020 13:26:38.6573 (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: rchGcRESDOb9EbDMV2CtnR86Rk0fb2wY76nZY3eaEoBBRXm7OAQPndCsXY5kKkTJy8Xe0Rr8MPkZMNiw5AP7Sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB5702 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Pankaj Bansal Add ArmPlatformLib for LS1046AFRWY platform that is based on ArmPlatformPkg/Library/ArmPlatformLibNull. Signed-off-by: Pankaj Bansal --- Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.inf = | 38 ++++++++ Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.c = | 96 ++++++++++++++++++++ Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c = | 28 ++++++ Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch64/ArmPlatformHelp= er.S | 45 +++++++++ 4 files changed, 207 insertions(+) diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatform= Lib.inf b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib= .inf new file mode 100644 index 000000000000..e6b6fb4d7e88 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.inf @@ -0,0 +1,38 @@ +#/* @file +# Copyright 2019-2020 NXP +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#*/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D PlatformLib + FILE_GUID =3D c61c8a13-36a0-46f4-a3bc-7bab5a55db81 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmPlatformLib + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + DebugLib + +[Sources.common] + ArmPlatformLib.c + ArmPlatformLibMem.c + +[Sources.AArch64] + AArch64/ArmPlatformHelper.S + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmPrimaryCore + gArmTokenSpaceGuid.PcdArmPrimaryCoreMask + +[Ppis] + gArmMpCoreInfoPpiGuid diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatform= Lib.c b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.c new file mode 100644 index 000000000000..f59e7aa556a3 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.c @@ -0,0 +1,96 @@ +/** @file +* +* Copyright 2019-2020 NXP +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include + +#include + +ARM_CORE_INFO mLS1046aMpCoreInfoTable[] =3D { + { + // 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 + } +}; + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Initialize controllers that must setup in the normal world + + This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/Pl= atformPei + in the PEI phase. + +**/ +EFI_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + //TODO: Implement me + + return EFI_SUCCESS; +} + +EFI_STATUS +PrePeiCoreGetMpCoreInfo ( + OUT UINTN *CoreCount, + OUT ARM_CORE_INFO **ArmCoreTable + ) +{ + if (ArmIsMpCore()) { + *CoreCount =3D sizeof(mLS1046aMpCoreInfoTable) / sizeof(ARM_CORE_IN= FO); + *ArmCoreTable =3D mLS1046aMpCoreInfoTable; + return EFI_SUCCESS; + } else { + return EFI_UNSUPPORTED; + } +} + +ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi =3D { PrePeiCoreGetMpCoreInfo }; + +EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] =3D { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gArmMpCoreInfoPpiGuid, + &mMpCoreInfoPpi + } +}; + +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + if (ArmIsMpCore()) { + *PpiListSize =3D sizeof(gPlatformPpiTable); + *PpiList =3D gPlatformPpiTable; + } else { + *PpiListSize =3D 0; + *PpiList =3D NULL; + } +} diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatform= LibMem.c b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLi= bMem.c new file mode 100644 index 000000000000..24d949369b98 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLibMem.= c @@ -0,0 +1,28 @@ +/** @file +* +* Copyright 2019-2020 NXP +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU on your platform. + + @param[out] VirtualMemoryMap Array of ARM_MEMORY_REGION_DESCRIPTOR = describing a Physical-to- + Virtual Memory mapping. This array mus= t be ended by a zero-filled + entry + +**/ +VOID +ArmPlatformGetVirtualMemoryMap ( + IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ) +{ + ASSERT(0); +} diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch64/Arm= PlatformHelper.S b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch= 64/ArmPlatformHelper.S new file mode 100644 index 000000000000..b7c6dbdc2e61 --- /dev/null +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch64/ArmPlatfor= mHelper.S @@ -0,0 +1,45 @@ +// +// Copyright (c) 2012-2013, ARM Limited. All rights reserved. +// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// + +#include +#include + +ASM_FUNC(ArmPlatformPeiBootAction) + ret + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +// With this function: CorePos =3D (ClusterId * 4) + CoreId +ASM_FUNC(ArmPlatformGetCorePosition) + and x1, x0, #ARM_CORE_MASK + and x0, x0, #ARM_CLUSTER_MASK + add x0, x1, x0, LSR #6 + ret + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (w0, FixedPcdGet32 (PcdArmPrimaryCore)) + ret + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformIsPrimaryCore) + MOV32 (w1, FixedPcdGet32 (PcdArmPrimaryCoreMask)) + and x0, x0, x1 + MOV32 (w1, FixedPcdGet32 (PcdArmPrimaryCore)) + cmp w0, w1 + mov x0, #1 + mov x1, #0 + csel x0, x0, x1, eq + ret --=20 2.17.1