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 416A0D811BD for ; Mon, 18 Dec 2023 15:12:33 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=2Q9tCumNqDP34Bd1zAlB0SABintZ2sKdovzr0VbOf8k=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Authentication-Results-Original:Message-ID:Date:User-Agent:Subject:To:Cc:References:From:In-Reply-To:MIME-Version:NoDisclaimer:Original-Authentication-Results:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Language; s=20140610; t=1702912351; v=1; b=HwtPvrqVTrgYeovkpZXYUsK63PA2hYOKqtcavMp7fIeBbsEhNcH7zyuGTxqHe1gZFfVyg0FS qAkKxdnuRL6tmHi352NnFb4C8pIJ6Wbg+/JZvxz38jXNAV/uFqQzAHj9BjOuU7H1fIKs+kK2Hzt smhCqhanbuy76W255+eyyZoA= X-Received: by 127.0.0.2 with SMTP id 8gFdYY7687511xENnXk8oHUZ; Mon, 18 Dec 2023 07:12:31 -0800 X-Received: from EUR01-HE1-obe.outbound.protection.outlook.com (EUR01-HE1-obe.outbound.protection.outlook.com [40.107.13.53]) by mx.groups.io with SMTP id smtpd.web11.46106.1702912350597977493 for ; Mon, 18 Dec 2023 07:12:31 -0800 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ON0YXGsjIFs9tTa0ZGdztYKfVIE7mdz0kV5/ktD6YflxDZ5NVcuFpjdiZ26bANMalRkmtBq5Rrtrc2RYVuhAkXWxJmO0X/AptMUaYYlxrCA9H6WvRpO9ApayCqB8yKbgqyr4JRXRZc1Ntfm2XdTQR1lIGd8GY4T6Ee4oKhRpJ2agC+Li+j0AGcPKrq8cWWXBsPWtmLyA9DRkMyfChOvVhC/0Tgd0RtntS1C+O/7DazRntEeK26YyqevmltabXtbM0dInKqbdPztzg838I6bKM5Q2NqdwEflRoR4Nu+tvcn7A0a7VX5d3CW+XV5gzJBzmut0IHVXhsLlHBpI/FMKwSw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m18x4KFLkpA/8ZqcgkNMIUnSN1hqqWwKI6xRenLNkDY=; b=StPaKJjIuSYcZ7mMpTMNIFsRtfB2Ucdds3r4FOl9Fgx9XOkLWn2uU19EGOtY15UY+PuEq9zhF069+trg/EfARF5EkrhW4L9aL939qxK3lfqvPAl0mjKMkg2GnB3GRxSJndYFky/ZnGKEeVK72HTcT1G4eqJ3fLUaF3m+MujJt5H4k0CI2005jfAxv9ITsSprlDCoRB4FGv7WUNSWWHGkLIjiVoMj0MLQkEAsE6w9mtr0rr6FixR1HOOemtvpMsnSX7l7nTlMA34Qg8GuRHly5Cl0r4fS9JbE5/z5FVQMTUNw2r+j5x1UZGEH2zpCEGlS19f3gGs5VQ86b8oDwEAWUw== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) X-Received: from AM5PR0101CA0015.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::28) by AS8PR08MB10169.eurprd08.prod.outlook.com (2603:10a6:20b:63d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 15:12:26 +0000 X-Received: from AM2PEPF0001C709.eurprd05.prod.outlook.com (2603:10a6:206:16:cafe::c1) by AM5PR0101CA0015.outlook.office365.com (2603:10a6:206:16::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.38 via Frontend Transport; Mon, 18 Dec 2023 15:12:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM2PEPF0001C709.mail.protection.outlook.com (10.167.16.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.14 via Frontend Transport; Mon, 18 Dec 2023 15:12:26 +0000 X-Received: ("Tessian outbound 26ee1d40577c:v228"); Mon, 18 Dec 2023 15:12:25 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5a8232313939400c X-CR-MTA-TID: 64aa7808 X-Received: from ea6df6d7f5f4.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A093F68C-6AF4-4707-95BD-1D2F76F1FDAA.1; Mon, 18 Dec 2023 15:12:19 +0000 X-Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ea6df6d7f5f4.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 18 Dec 2023 15:12:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mtwr6DhEoMCOKLVcgwBPnZMk1EPMiGRYjpKFPkUD/4TUMcolwY6YZ0u3NO5mBghzTuP2GwqqkDz2YZweeeWE8fYdhA7w6K/fEaxvxVyBJUcg+oNgKK3/ggEMWtPXq1QH2no1Oqs1a2AMSqL8XP3g9b41srz/0lxXKvduC7FLvQ2ybw5RwL11dkA2zXjpU/WAQKwTY3+8IBR7syskzVZVRpnKg4jBUtf/atzmyhqCUh5lins8y8zl1pRbC15L2ZKkH8OMHigJJZaWHYv3wgybKw91Yl0NFbJqODcbpZ4HyK0FSvIGCnSpAP7zR4zijjSMyUEUnU6tYZpD4Shmzv7A0Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m18x4KFLkpA/8ZqcgkNMIUnSN1hqqWwKI6xRenLNkDY=; b=B/TaTTIguWlynGhWcB/kT8geS0t+20MPk0Q8s8XG9X/pHqN60mZAm98bgeax2UA+hBTmw3JqEcDtHq31dvfHXM4pRES1taM8SbLW/CKkB5OEhttj7GG0jjeAfO0H4oT5XpuT2EVKbpoNDUqOw/SRkuHgc6UNsMTiTiuUV/yQ2snOCZtIUMYkZavgdFe/z33kVNZZIAm3npICX4cBzAuFo/yMqeqO8WMffZnUvqw0kd6zuJ7IFfAfR0BgsjTOFdxyaWLDmCb90dLNtlf5TAx7YUHHzt4Q/U8aHUuOGBv8U613TVSZFZssy/HJI440TCG1CXsKSutXYUixc8Lc3ydNzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AS8PR08MB8947.eurprd08.prod.outlook.com (2603:10a6:20b:5b3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 15:12:17 +0000 X-Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::f36e:3882:2fce:d775]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::f36e:3882:2fce:d775%4]) with mapi id 15.20.7091.034; Mon, 18 Dec 2023 15:12:17 +0000 Message-ID: <1b7caceb-f4bc-417f-a027-14423e865d10@arm.com> Date: Mon, 18 Dec 2023 15:12:16 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [edk2-platforms][PATCH V1 2/5] Silicon/ARM/NeoverseN1Soc: NOR flash library for N1Sdp To: sahil , devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , "nd@arm.com" References: <20231116114554.4055517-1-sahil@arm.com> <20231116114554.4055517-3-sahil@arm.com> From: "Sami Mujawar" In-Reply-To: <20231116114554.4055517-3-sahil@arm.com> X-ClientProxiedBy: LO4P123CA0066.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::17) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6806:EE_|AS8PR08MB8947:EE_|AM2PEPF0001C709:EE_|AS8PR08MB10169:EE_ X-MS-Office365-Filtering-Correlation-Id: f7e33e37-d06f-401b-6f8e-08dbffdbbe79 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Oad/SgY4qvS7kPuI4yvQ2ed40um2LiiItwwUaSlnm9HK956mdzRdSIi614Ilt0gWBKq9pFR/lnvDcKoM65Vln0kEWTd8f49DlsYs9p6pM6VUKzFd/n47t9ZHuO4njwqM9ovFs5xswUBSEQfd2GKoQ+I5TcavqHXKDi8XerYEzD4M+rtHKBXBzZ8K44HQ1HQ/uFAG84W6Fb+eAsrI08ho1rF0d+OCsxQQnUiM47Wo0d3O0zBR46x7sbbfO6yL2sBjdr1WimE1Fpqm1jWqBfBsYEwr/kwKwKGA/jRcYWCW6cfdrplepxluXYBGwHTrFVpG8tZ8cz6C6q90o7+79v/JLOdh3RYEuaGcfRbeJGzsnYmf4U5Ppx4mnOTYBfpLIdQ7R/4Lirt6yGNonx8mMBpCwzyeE0ZWwzAIhvgUzIf3f9jgA0cqXmD2tH2b7FNByhZ4+0aMy5yO28v8VAwy/r8BxzNPQhQsn2vyziIx4eVCYt/krcP0s6BHrngavq8VerfRtBbxyJbdCoFHfdqjXtLom3jpz8UHOWncBNPaYTn7t0Sfbv8hO/+lAldhYpDycF1ZcXzy9qavJJI0od6u/lIijwdFZAt6pE4U5XjgwMYbWVS6sgltuFJ8OJtBvfdaN0B38db0giY/rox0heFO57ccdMzdHyAAnlE9M31QNk1/kts= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39860400002)(376002)(396003)(366004)(346002)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(31686004)(26005)(2616005)(2906002)(36756003)(31696002)(86362001)(38100700002)(83380400001)(44832011)(5660300002)(6512007)(53546011)(33964004)(6506007)(8936002)(8676002)(4326008)(66946007)(66556008)(6486002)(54906003)(316002)(66476007)(41300700001)(478600001)(19627235002)(32563001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8947 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM2PEPF0001C709.eurprd05.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 8b25af9c-b10c-4e4e-61a0-08dbffdbb90a X-Microsoft-Antispam-Message-Info: ml+yDvPtNcnXiPdrang+w6n+id3fShVgjFeNfrch5Nm1+GmRXaVjV4lSq6T5Vumi3zDgMZAStCZ3yxzjiDdVbadla7iQni0SuaLADQd6ZDhqyJ0HeUEE0sn/5ocOhrl8iw2Tp+E1VCH1n8BVyg7CUxgxT7nZvJfWq2FIm4iEnsXPbn9Td+Bb+OTHd3rgj65RXn0l9LLZl6g61KAfbSzGUzYqFQK4bwo+bcsQArTnEIZ/GIJx3xZIkyPuNDA4itYSwj/GVDJqoIPnMDRaD7IIEwCo2CDgzZsIIyNx22jc6d4n5K/zmFoS5TayltEnFXcJi24ALglZNfNzXDQm7W49VyjIG0EPcbQjj44bROTxU4t91PJP0AgkXHDQlt3CXwT70iGDnkerDfnFi/tpV3MGduRitEgMmYdBgOT2HGafVbACW7K6eLOqNQWrZFbFHg31+WJ48FK68M7NCqS4+MdNnxfLy7NUyhwJzhmycPEuRW80N4yrwhmN4MqE+9LKjZaG94PjlgEkqpR0gyOYgMTXGf84W+uhM1CgMTy0qZ8KiSRwO3uYAEPVcmCMo2CdAS8CwWHF12c7fvp2ZLfaDcfGNCPeLSP7w4ECC2jj3e/9DC4RQAJnJoPPzXIbJjPz3OFZTYLf+GZv0c5mxe3PLQpNLHdcMED7SEW9vzm9YfjEgtF44RqJQ3oJdldPEhOpeZJx8AVyYezmJ17DYgLuya79zAekTJR6OK0humi1ZUMdN7zMoDRhvMkJ5+39Ze00ua7rJQFVZORUYAEPqo0/bfDzzFcDm58ZpuI++XiaNz5jOks= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2023 15:12:26.0982 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7e33e37-d06f-401b-6f8e-08dbffdbbe79 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM2PEPF0001C709.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB10169 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,sami.mujawar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: c0ZRxstnErA2IBxcCX1zOFY6x7686176AA= Content-Type: multipart/alternative; boundary="------------6O7Or1d03mXKHN0XcJllP90f" Content-Language: en-GB X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=HwtPvrqV; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 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); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") --------------6O7Or1d03mXKHN0XcJllP90f Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Sahil, Please find my feedback marked inline as [SAMI]. With those fixed, Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 16/11/2023 11:45 am, sahil wrote: > 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.in= f 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 > > +# NOR flash lib for ARM Neoverse N1 platform. > > +# > > +# Copyright (c) 2023, 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 [SAMI] Since this library class is NorFlashPlatformLib, you need to=20 implement NorFlashPlatformInitialization(). A platform may not need to do anything in=20 NorFlashPlatformInitialization() and just return success. [/SAMI] > > + > > +[Sources.common] > > + NorFlashLib.c > > + > > +[Packages] > > + MdeModulePkg/MdeModulePkg.dec > > + MdePkg/MdePkg.dec > > + Platform/ARM/ARM.dec > > + Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec > > + > > +[LibraryClasses] > > + BaseLib > > + DebugLib > > + IoLib > > + > > +[FixedPcd] > > + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize > > + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize > > + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase > > + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize > > 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 > > +* NOR flash lib for ARM Neoverse N1 platform > > +* > > +* Copyright (c) 2023, ARM Limited. All rights reserved.
> > +* > > +* SPDX-License-Identifier: BSD-2-Clause-Patent > > +* > > +**/ > > + > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase= ) > > +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSiz= e) + \ > > + FixedPcdGet32 (PcdFlashNvStorageFt= wWorkingSize) + \ > > + FixedPcdGet32 (PcdFlashNvStorageFt= wSpareSize)) [SAMI] Please limit line length to 80 characters. Also run uncrustify. > > + > > +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 > > + }, > > +}; > > + > > +/** > > + Get NOR flash region info > > + > > + @param[out] NorFlashDevices NOR flash regions info. > > + @param[out] Count number of flash instance. > > + > > + @retval EFI_SUCCESS Success. [SAMI] EFI_INVALID_PARAMETER ? > > +**/ > > +EFI_STATUS > > +NorFlashPlatformGetDevices ( > > + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices, > > + OUT UINT32 *Count > > + ) > > +{ > > + if ((NorFlashDevices =3D=3D NULL) || (Count =3D=3D NULL)) { > > + return EFI_INVALID_PARAMETER; > > + } > > + > > + *NorFlashDevices =3D mNorFlashDevices; > > + *Count =3D ARRAY_SIZE (mNorFlashDevices); > > + return EFI_SUCCESS; > > +} > -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112642): https://edk2.groups.io/g/devel/message/112642 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --------------6O7Or1d03mXKHN0XcJllP90f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi Sahil,

Please find my feedback marked inline as [SAMI].

With those fixed,

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar

On 16/11/2023 11:45 am, sahil wrote:
Add NOR flash library, this li=
brary provides APIs for getting the list
of NOR flash devices on the platform.

Signed-off-by: sahil <sahil@arm.com>
---
 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

+#  NOR flash lib for ARM Neoverse N1 platform.

+#

+#  Copyright (c) 2023, ARM Limited. All rights reserved.<BR>

+#

+#  SPDX-License-Identifier: BSD-2-Clause-Patent

+#

+##

+

+[Defines]

+  INF_VERSION                    =3D 0x0001001B

+  BASE_NAME                      =3D NorFlashNeoverseN1SocLib

+  FILE_GUID                      =3D 7006fcf1-a585-4272-92e3-b286b1dff5bb

+  MODULE_TYPE                    =3D DXE_DRIVER

+  VERSION_STRING                 =3D 1.0

+  LIBRARY_CLASS                  =3D NorFlashPlatformLib

[SAMI] Since this library class is NorFlashPlatformLib, you need to implement N= orFlashPlatformInitialization().

A platform ma= y not need to do anything in NorFlashPlatformInitialization() and just return success. <= /span>

[/SAMI]


+

+[Sources.common]

+  NorFlashLib.c

+

+[Packages]

+  MdeModulePkg/MdeModulePkg.dec

+  MdePkg/MdePkg.dec

+  Platform/ARM/ARM.dec

+  Silicon/ARM/NeoverseN1Soc/NeoverseN1Soc.dec

+

+[LibraryClasses]

+  BaseLib

+  DebugLib

+  IoLib

+

+[FixedPcd]

+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize

+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize

+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase

+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize

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

+*  NOR flash lib for ARM Neoverse N1 platform

+*

+*  Copyright (c) 2023, ARM Limited. All rights reserved.<BR>

+*

+*  SPDX-License-Identifier: BSD-2-Clause-Patent

+*

+**/

+

+#include <Library/DebugLib.h>

+#include <Library/IoLib.h>

+#include <Library/NorFlashPlatformLib.h>

+#include <NeoverseN1Soc.h>

+#include <PiDxe.h>

+

+#define FW_ENV_REGION_BASE  FixedPcdGet32 (PcdFlashNvStorageVariableBase)

+#define FW_ENV_REGION_SIZE  (FixedPcdGet32 (PcdFlashNvStorageVariableSize)=
 +           \

+                                      FixedPcdGet32 (PcdFlashNvStorageFtwW=
orkingSize) + \

+                                      FixedPcdGet32 (PcdFlashNvStorageFtwS=
pareSize))
[SAMI] Please limit line length to 80 characters. Also run uncrustify.

+

+STATIC NOR_FLASH_DESCRIPTION  mNorFlashDevices[] =3D {

+  {

+    /// Environment variable region

+    NEOVERSEN1SOC_SCP_QSPI_AHB_BASE,                    ///< device bas=
e

+    FW_ENV_REGION_BASE,                                 ///< region bas=
e

+    FW_ENV_REGION_SIZE,                                 ///< region siz=
e

+    SIZE_4KB,                                           ///< block size

+  },

+};

+

+/**

+  Get NOR flash region info

+

+  @param[out]    NorFlashDevices    NOR flash regions info.

+  @param[out]    Count              number of flash instance.

+

+  @retval        EFI_SUCCESS        Success.
[SAMI] EFI_INVALID_PARAMETER ?

+**/

+EFI_STATUS

+NorFlashPlatformGetDevices (

+  OUT NOR_FLASH_DESCRIPTION  **NorFlashDevices,

+  OUT UINT32                 *Count

+  )

+{

+  if ((NorFlashDevices =3D=3D NULL) || (Count =3D=3D NULL)) {

+    return EFI_INVALID_PARAMETER;

+  }

+

+  *NorFlashDevices =3D mNorFlashDevices;

+  *Count           =3D ARRAY_SIZE (mNorFlashDevices);

+  return EFI_SUCCESS;

+}

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#112642) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--------------6O7Or1d03mXKHN0XcJllP90f--