From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id C5AA5D8095A for ; Wed, 29 May 2024 08:55:59 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=NP5l/0nnOXHqkh5leTzP5xdZjc4H5dgMAnd3BqF7MOU=; 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:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1716972959; v=1; b=CRQdCS/tlSsKjIZZuuKVXVuVAqF97JM2IIPnjnoVfYzQyUv8vI+MToYNOY92ik/StBji09vU bhxrvHfQ7IKdct7DKmi8C1jt4WiH0DvBswZxeOcskU0r9kJC8m8DF3HtJnH6Jc0IQr5auu2Z7lA Bnqf6usa7bbE+xc9hJw4hOznVqxsV1+sX4rYBLnkPtdZoDapIHDoUnxGqo0Uvt898GxfPJ2krxj IB1/MpJTAy8UtJC0TjuRjA5pWTKe6demaaJQC45MD+qRX69825AE2DB4euBMIOEPI6Lah65tGnT +cKzUnY7DXDSmcj0/YIBa3pIBpTr4MjNcNE3QjQjArSXw== X-Received: by 127.0.0.2 with SMTP id nPAHYY7687511xYcwSZMQtyD; Wed, 29 May 2024 01:55:58 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.9258.1716972957845270170 for ; Wed, 29 May 2024 01:55:57 -0700 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 C38972F4; Wed, 29 May 2024 01:56:21 -0700 (PDT) X-Received: from usa.arm.com (a077434.arm.com [10.162.46.143]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DF8D93F762; Wed, 29 May 2024 01:55:55 -0700 (PDT) From: "Sahil Kaushal" To: devel@edk2.groups.io Cc: Ard Biesheuvel , =?UTF-8?q?Leif=20Lindholm=20=C2=A0?= , Sami Mujawar , =?UTF-8?q?sahil=20=C2=A0?= Subject: [edk2-devel] [edk2-platforms][PATCH V4 14/17] Silicon/ARM/NeoverseN1Soc: NOR flash library for N1Sdp Date: Wed, 29 May 2024 14:25:14 +0530 Message-Id: <20240529085517.1074417-15-Sahil.Kaushal@arm.com> In-Reply-To: <20240529085517.1074417-1-Sahil.Kaushal@arm.com> References: <20240529085517.1074417-1-Sahil.Kaushal@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 Resent-Date: Wed, 29 May 2024 01:55:58 -0700 Resent-From: sahil.kaushal@arm.com Reply-To: devel@edk2.groups.io,sahil.kaushal@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: adOGZfDYon0uhyOSSCBPISCHx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="CRQdCS/t"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none) From: sahil Add NOR flash library, this library provides APIs for getting the list of NOR flash devices on the platform. This flash is shared between AP core and System Control Processor. The lower addresses are used to store SCP and AP boot images and higher addresses will be used for variable storage. Signed-off-by: sahil --- Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf | 35 +++++= ++++ Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h | 1 + Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c | 80 +++++= +++++++++++++++ 3 files changed, 116 insertions(+) diff --git a/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.in= f b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf new file mode 100644 index 000000000000..a9495cf667d5 --- /dev/null +++ b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.inf @@ -0,0 +1,35 @@ +## @file +# NOR flash lib for ARM Neoverse N1 platform. +# +# Copyright (c) 2024, ARM Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D NorFlashNeoverseN1SocLib + FILE_GUID =3D 7006fcf1-a585-4272-92e3-b286b1dff5b= b + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D NorFlashPlatformLib + +[Sources.common] + NorFlashLib.c + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/ARM/ARM.dec + Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec + +[LibraryClasses] + BaseLib + DebugLib + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize diff --git a/Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h b/Silicon/= ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h index 2dae57a0f01a..2a592e5adc2f 100644 --- a/Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h +++ b/Silicon/ARM/NeoverseN1Soc/Include/NeoverseN1Soc.h @@ -47,6 +47,7 @@ // SCP QSPI flash device #define NEOVERSEN1SOC_SCP_QSPI_AHB_BASE 0x18000000 #define NEOVERSEN1SOC_SCP_QSPI_AHB_SZ 0x2000000 +#define NEOVERSEN1SOC_FIRMWARE_IAMGES_SZ 0x800000 =20 /* * Platform information structure stored in Non-secure SRAM. Platform diff --git a/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c = b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c new file mode 100644 index 000000000000..a354ffb5ac6d --- /dev/null +++ b/Silicon/ARM/NeoverseN1Soc/Library/NorFlashLib/NorFlashLib.c @@ -0,0 +1,80 @@ +/** @file +* NOR flash lib for ARM Neoverse N1 platform +* +* Copyright (c) 2024, ARM Limited. All rights reserved.
+* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include + +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase= ) +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSiz= e) + \ + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSi= ze) + \ + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize= )) + +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D { + { + /// Environment variable region + NEOVERSEN1SOC_SCP_QSPI_AHB_BASE, ///< device base + FW_ENV_REGION_BASE, ///< region base + FW_ENV_REGION_SIZE, ///< region size + SIZE_4KB, ///< block size + }, +}; + +/** + Dummy implementation of NorFlashPlatformInitialization to + comply with NorFlashPlatformLib structure. + + @retval EFI_SUCCESS Success. +**/ +EFI_STATUS +NorFlashPlatformInitialization ( + VOID + ) +{ + return EFI_SUCCESS; +} + +/** + Get NOR flash region info + + @param[out] NorFlashDevices NOR flash regions info. + @param[out] Count number of flash instance. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER The parameters specified are not= valid. + @retval EFI_ACCESS_DENIED Invalid variable region address. +**/ +EFI_STATUS +NorFlashPlatformGetDevices ( + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, + OUT UINT32 *Count + ) +{ + if ((NorFlashDevices =3D=3D NULL) || (Count =3D=3D NULL)) { + return EFI_INVALID_PARAMETER; + } + + if ((NEOVERSEN1SOC_SCP_QSPI_AHB_BASE + + NEOVERSEN1SOC_FIRMWARE_IAMGES_SZ) >=3D + FW_ENV_REGION_BASE) + { + DEBUG (( + DEBUG_ERROR, + "NorFlashPlatformInitialization: Variable region overlapping with = " + "firmware region.\n" + )); + + return EFI_ACCESS_DENIED; + } + + *NorFlashDevices =3D mNorFlashDevices; + *Count =3D ARRAY_SIZE (mNorFlashDevices); + return EFI_SUCCESS; +} --=20 2.25.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#119329): https://edk2.groups.io/g/devel/message/119329 Mute This Topic: https://groups.io/mt/106365465/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-