From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.84]) by mx.groups.io with SMTP id smtpd.web10.53517.1594023900482391175 for ; Mon, 06 Jul 2020 01:25:01 -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=T/fFYmjm; spf=pass (domain: oss.nxp.com, ip: 40.107.8.84, mailfrom: pankaj.bansal@oss.nxp.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ckIsoblnLw39M7C5yN7Zf3szhzmZKxrhF0Pz3E2Q2WDJ3ux6/ODzsYd6ds07a+a9EzobXzw5YIEeNQQctPIuo51QFc0IowglxzZLhp4fcjFiDx6KAZeI99SfbrbpoeSH8LDPWqYXkBCXEjBY3nBv4eQMYaipWTaCc7tu8eZEJvYhclwuZRS5j9vnSUZdGY1ir6kTa7tVbZuiNHamW7cc5V8BMM4VmoyRYnc3lIivpZI0I/oK+wc+RwzmAY+SSl4DLwAeqzuGGcQC/hu3ZHyapbYzWUr1zYtxnZ3fm0ePPUTqjstyiNDHur0Owqddkcx5USL3uLwgDtNEIC91JCt/jg== 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=Wc5vRbwpcw+RzP6CAB6TL2y3EYteojgrl8ChKjaqQNE=; b=SSHmKnpaGLHKiqtfiRVwe9zyUvkvjSrQdRiEhirIKPvBqBd2j5rBHRsyV1h2tfCARyXXgQed6BHeh2A73bgg9z9S75IUHBOQ3ZYvBBGHyEdGfVc1/DBMEFMkEtopxCl2dH903gvPKdHFCntSl5AIAD9H9qIXhOiVIM9UoNFrEsZhRsw6cPgi6CbUAZYbakgLiosWty+Kn0EZsz4jEibloMr5X6Y8yqCPfMJJMgADobfITu9bfRmY8iDSCbFT9SuJbrw3rmtAATVsxswJkTcIZx5P/9pjD4mhehawigAcWorExXEo6Rh6tvqiIg7xm1vK13hm+9xatg35t3BHbqVrLA== 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=Wc5vRbwpcw+RzP6CAB6TL2y3EYteojgrl8ChKjaqQNE=; b=T/fFYmjm1aN0LnGIQ61rM0Ps9aNt39Hifsw9DOXkCr9hbDGBnk+6ci5E4blsglgpbvQtqIVF/TX02WI7WWZ3ZKPbRgJXW2tTejgxLA+4FWtrZa4QyuxNMJMAoM47YpyvmEXNNz6BaBAHEbvKBWFZMRue7t8f+jMwvDxuG8VTI0E= 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 VI1PR04MB5933.eurprd04.prod.outlook.com (2603:10a6:803:ec::16) by VI1PR04MB6782.eurprd04.prod.outlook.com (2603:10a6:803:139::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22; Mon, 6 Jul 2020 08:24:58 +0000 Received: from VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::4521:b667:cf06:b79b]) by VI1PR04MB5933.eurprd04.prod.outlook.com ([fe80::4521:b667:cf06:b79b%7]) with mapi id 15.20.3153.029; Mon, 6 Jul 2020 08:24:58 +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 v2 4/6] Platform/NXP/LS1046AFRWY: Add ArmPlatformLib Date: Mon, 6 Jul 2020 03:24:19 -0500 Message-ID: <20200706082421.9139-5-pankaj.bansal@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706082421.9139-1-pankaj.bansal@oss.nxp.com> References: <20200706082421.9139-1-pankaj.bansal@oss.nxp.com> X-ClientProxiedBy: BYAPR08CA0035.namprd08.prod.outlook.com (2603:10b6:a03:100::48) 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 TFTPTOUEFI.am.freescale.net (64.157.242.222) by BYAPR08CA0035.namprd08.prod.outlook.com (2603:10b6:a03:100::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Mon, 6 Jul 2020 08:24:54 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [64.157.242.222] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 65a1bcd4-1797-4384-a0c8-08d821861150 X-MS-TrafficTypeDiagnostic: VI1PR04MB6782: 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: 04569283F9 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gzT+neGRZ4KfsLHuGD5SjTqkEVOThKz4zhjpHtWHPnA/z1IV8Tj+Yth8tVEzoPOifdVcWIfAfvl7jf+Lds41LCQirJ98zp8squIZ+zkEFtp4lQei1mJ+nMXZfmHWyrricNMJEk6dnfCDCyA9FMUHeRAXmCMdM5GXcD7jcgSb8ijDMkKOsnUU/VZ4SDs8BCxhLBMxRKgLIx45CbxOD/dYtdsHaHDkpkGzhlceTzzNtLIEy0usUMQicc91a99U2/AwgIsFFG53F0ZmG8lnff4jp8o7nKAgUcXvJhhj9fS75ePnXq8U9TH99uuvRlJvk7goZ3Pc/Y463QYgrrVl2LCSKLCM1ismM2V9pEAeL231whVXzFKFpjGjcht0NtcVUEDe 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:(4636009)(396003)(136003)(366004)(346002)(39860400002)(376002)(1076003)(478600001)(52116002)(83380400001)(6506007)(66476007)(16526019)(186003)(5660300002)(316002)(110136005)(6512007)(956004)(2616005)(44832011)(8676002)(6486002)(19627235002)(66946007)(86362001)(66556008)(8936002)(2906002)(26005)(6666004)(921003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: wEFxF38Klhu16M9zhY7QW7TmN+I34bPp0FD6s/HGpi5LBus057enz8EtnCSpVwdosSwwXC56+SijRzGY6BkGUubV7xZZ7J0nU9jpu+9yoeIo28+EfL79v0/LQd5XLSjEFEg/kk5F4bd2MIe+PEmEm0znfpHtctDUx1vtotxCxTxxz32zjOHInE/y0nQS/vJefJaJ16sov3w9NhXYq4/inPxhUxiXNrbmtU/HqKBOm+yBkl7iiMooRp26MTXBBRDai4z/pIHklB4V0yvB/AkplKxcJPFpldUs6ZEGIrw8xiLTWhDP1ANJVFx/MjTVvzAMJQR0CdYROsE1H8M7FAqrbxwbEdpbHUbQbpQrgFAykCqIRNXNUkIpDqsZlYVFE1pyJccMBjqMhx+Ao4lAs9jfzMFbB9E/89cJadub+OyBm5Q0dYHDxPv1zr5eGbd/nQbvAF/45M9ahv9skPV1RIx2U2zVlQk4g6teXSD+1QAVRvQlMS0mi/tlkA8lmHu3SDNn X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65a1bcd4-1797-4384-a0c8-08d821861150 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5933.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jul 2020 08:24:58.0201 (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: yXYqPtT/OcjkdcrTKUktpayKLxG4EhgHJbat9RMYwW/sTFHPqTV7yZylI3kOf3GgaJaKuVzhDqbCtn7hs2cDUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6782 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..de93681708e3 --- /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..4f56a1c366ab --- /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