From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web11.15279.1594125709266005840 for ; Tue, 07 Jul 2020 05:41:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=orFU45sw; spf=pass (domain: nuviainc.com, ip: 209.85.221.65, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f65.google.com with SMTP id k6so44996766wrn.3 for ; Tue, 07 Jul 2020 05:41:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=CUUeunDmm8deDtR2i/0MLDGi5w4FeqnDMXRNv3gU030=; b=orFU45swDu8XBeVNjEfM6wlh/Zv+NvwockUZNwL9MIguuq808sPu0HeuzSw9GFcl83 s8sfNlqbFgRiw24kXlU+oYOwBrOQmtuYxspBUgWmI4WIZSFxpMyLNQ5St95GdPeVfxBp +yAT2JA5IE7PcA1psmwMcfBAA3UeLvvLp9+YT+mTmfKufJBi0SexX9R5pe5nuo5/rn5/ RBAHFQnKKR1a55dxx0lcM9zwaWcgCavVyXo6ZIdEnemkoIMHdKXSBPubGpthsigugUJj 0AWBPIM7+y0BBMbYbMKB9OwEdEyaDZbnwxyP7Zt3ZtxSlykdlIhCUTgR/zTqCzfOyzTT kBvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CUUeunDmm8deDtR2i/0MLDGi5w4FeqnDMXRNv3gU030=; b=qhVyuwpu/w8/UP789CD40thwljP4U1mfMyVnSEwegxYL6jTwc5m1Z+2lkaRxhngs/N qr8vEFIeJb355H25g7aXRKwV35HnHUu+5+YnFXwn1iWUbHu9nSFtQoB4D94UxMogoVIP CQdBaodQE1xvqkzjEMahZmXSo5TSDcBEaaYjHteyXhMPZaPOwxYYki12Mw6ux0EQ6Jx0 MSlLwgVaFEB4Q5YGCnb019vOzSAAYiWzzoqZR4jnxQfAUV+aEpMoE3DT5LVq5Im708Sh K5ilqVri1o3lTwkVR7wUYWDzfq+GINbjexTyrY8Tw8fxXgrp1c5dmU0SFjARdNKvAZqb n8Dw== X-Gm-Message-State: AOAM532hq/2Ge6/eZsUpdO6Ks9Nvgv1yv05wjsdszW8kkKiUPMwwJ2DC SHoGgbBLlu4cXgn/C9oyiGiKYw== X-Google-Smtp-Source: ABdhPJyZ7WsJ6a0YpdXDtZAvgnSL6r3pdwpcoBbWWGAFZzytPIP5zqhBzKEeFD+d4ckypVR5TdK1ug== X-Received: by 2002:a05:6000:46:: with SMTP id k6mr24702423wrx.102.1594125707865; Tue, 07 Jul 2020 05:41:47 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id m9sm892307wml.45.2020.07.07.05.41.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2020 05:41:47 -0700 (PDT) Date: Tue, 7 Jul 2020 13:41:45 +0100 From: "Leif Lindholm" To: Pankaj Bansal Cc: Meenakshi Aggarwal , Michael D Kinney , devel@edk2.groups.io, Varun Sethi , Samer El-Haj-Mahmoud , Augustine Philips , Ard Biesheuvel , Arokia Samy , Kuldip Dwivedi Subject: Re: [PATCH edk2-platforms v2 4/6] Platform/NXP/LS1046AFRWY: Add ArmPlatformLib Message-ID: <20200707124145.GD12303@vanye> References: <20200706082421.9139-1-pankaj.bansal@oss.nxp.com> <20200706082421.9139-5-pankaj.bansal@oss.nxp.com> MIME-Version: 1.0 In-Reply-To: <20200706082421.9139-5-pankaj.bansal@oss.nxp.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jul 06, 2020 at 03:24:19 -0500, Pankaj Bansal wrote: > 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/ArmPlatformHelper.S | 45 +++++++++ > 4 files changed, 207 insertions(+) > > diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLib.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 = 0x0001001A > + BASE_NAME = PlatformLib > + FILE_GUID = c61c8a13-36a0-46f4-a3bc-7bab5a55db81 > + MODULE_TYPE = BASE > + VERSION_STRING = 1.0 > + LIBRARY_CLASS = 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/ArmPlatformLib.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[] = { > + { > + // 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/PlatformPei > + in the PEI phase. > + > +**/ > +EFI_STATUS > +ArmPlatformInitialize ( > + IN UINTN MpId > + ) > +{ > + //TODO: Implement me Please drop the TODO. / Leif > + > + return EFI_SUCCESS; > +} > + > +EFI_STATUS > +PrePeiCoreGetMpCoreInfo ( > + OUT UINTN *CoreCount, > + OUT ARM_CORE_INFO **ArmCoreTable > + ) > +{ > + if (ArmIsMpCore()) { > + *CoreCount = sizeof(mLS1046aMpCoreInfoTable) / sizeof(ARM_CORE_INFO); > + *ArmCoreTable = mLS1046aMpCoreInfoTable; > + return EFI_SUCCESS; > + } else { > + return EFI_UNSUPPORTED; > + } > +} > + > +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 > + ) > +{ > + if (ArmIsMpCore()) { > + *PpiListSize = sizeof(gPlatformPpiTable); > + *PpiList = gPlatformPpiTable; > + } else { > + *PpiListSize = 0; > + *PpiList = NULL; > + } > +} > diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLibMem.c b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/ArmPlatformLibMem.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 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 > + ) > +{ > + ASSERT(0); > +} > diff --git a/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch64/ArmPlatformHelper.S b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch64/ArmPlatformHelper.S > new file mode 100644 > index 000000000000..4f56a1c366ab > --- /dev/null > +++ b/Platform/NXP/LS1046aFrwyPkg/Library/ArmPlatformLib/AArch64/ArmPlatformHelper.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 = (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 > -- > 2.17.1 >