From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 014159413B3 for ; Thu, 16 Nov 2023 11:46:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ZwW8pjxsEIK5PkrGRi+OxFQEqw/tlUMK6NLJR5y8fZU=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1700135169; v=1; b=gO9zPZOOjisuMq6JzMn8NoomkmnNlrBSSAW2G4P7cBquHEGTHgKtiK60NP2aATF5DebDbFol brB6DGYgFmtdXQGkr935PwTk0D2QaLdvV7/1yjZVt9OKLrIzTH4P/RLitNL7Ip45S/svWRbtwwj aKDRPHwQMhK9LLsXFth44c6E= X-Received: by 127.0.0.2 with SMTP id quFwYY7687511xiUfKekOZvy; Thu, 16 Nov 2023 03:46:09 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.4937.1700135168738047255 for ; Thu, 16 Nov 2023 03:46:09 -0800 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B2841650; Thu, 16 Nov 2023 03:46:54 -0800 (PST) X-Received: from usa.arm.com (a077434.blr.arm.com [10.162.17.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8BF803F7B4; Thu, 16 Nov 2023 03:46:06 -0800 (PST) From: "sahil" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar , Sahil Subject: [edk2-devel] [edk2-platforms][PATCH V1 2/5] Silicon/ARM/NeoverseN1Soc: NOR flash library for N1Sdp Date: Thu, 16 Nov 2023 17:15:51 +0530 Message-Id: <20231116114554.4055517-3-sahil@arm.com> In-Reply-To: <20231116114554.4055517-1-sahil@arm.com> References: <20231116114554.4055517-1-sahil@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sahil@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 9ITK1mVwFpYgJabC9LrMbVwzx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=gO9zPZOO; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Add NOR flash library, this library provides APIs for getting the list of NOR flash devices on the platform. Signed-off-by: sahil --- Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf | 36 +++++++= +++++++ Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c | 52 +++++++= +++++++++++++ 2 files changed, 88 insertions(+) diff --git a/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf = b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf new file mode 100644 index 000000000000..14f81125c4e1 --- /dev/null +++ b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf @@ -0,0 +1,36 @@ +## @file=0D +# NOR flash lib for ARM Neoverse N1 platform.=0D +#=0D +# Copyright (c) 2023, ARM Limited. All rights reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x0001001B=0D + BASE_NAME =3D NorFlashNeoverseN1SocLib=0D + FILE_GUID =3D 7006fcf1-a585-4272-92e3-b286b1dff5bb= =0D + MODULE_TYPE =3D DXE_DRIVER=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D NorFlashPlatformLib=0D +=0D +[Sources.common]=0D + NorFlashLib.c=0D +=0D +[Packages]=0D + MdeModulePkg/MdeModulePkg.dec=0D + MdePkg/MdePkg.dec=0D + Platform/ARM/ARM.dec=0D + Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D + DebugLib=0D + IoLib=0D +=0D +[FixedPcd]=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize=0D diff --git a/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c b/= Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c new file mode 100644 index 000000000000..a508d7d77373 --- /dev/null +++ b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c @@ -0,0 +1,52 @@ +/** @file=0D +* NOR flash lib for ARM Neoverse N1 platform=0D +*=0D +* Copyright (c) 2023, ARM Limited. All rights reserved.
=0D +*=0D +* SPDX-License-Identifier: BSD-2-Clause-Patent=0D +*=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)= =0D +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize)= + \=0D + FixedPcdGet32 (PcdFlashNvStorageFtwW= orkingSize) + \=0D + FixedPcdGet32 (PcdFlashNvStorageFtwS= pareSize))=0D +=0D +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D {=0D + {=0D + /// Environment variable region=0D + NEOVERSEN1SOC_SCP_QSPI_AHB_BASE, ///< device base=0D + FW_ENV_REGION_BASE, ///< region base=0D + FW_ENV_REGION_SIZE, ///< region size=0D + SIZE_4KB, ///< block size=0D + },=0D +};=0D +=0D +/**=0D + Get NOR flash region info=0D +=0D + @param[out] NorFlashDevices NOR flash regions info.=0D + @param[out] Count number of flash instance.=0D +=0D + @retval EFI_SUCCESS Success.=0D +**/=0D +EFI_STATUS=0D +NorFlashPlatformGetDevices (=0D + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,=0D + OUT UINT32 *Count=0D + )=0D +{=0D + if ((NorFlashDevices =3D=3D NULL) || (Count =3D=3D NULL)) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + *NorFlashDevices =3D mNorFlashDevices;=0D + *Count =3D ARRAY_SIZE (mNorFlashDevices);=0D + return EFI_SUCCESS;=0D +}=0D --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111309): https://edk2.groups.io/g/devel/message/111309 Mute This Topic: https://groups.io/mt/102625034/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-