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 E0A9B740047 for ; Tue, 21 May 2024 14:05:46 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=voVNnMikbEOy8gF9pCfg9EaWQ6M/tVcJN2XafS0OKwI=; c=relaxed/simple; d=groups.io; h=Received-SPF: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:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1716300345; v=1; b=t1W0CZ4eQMmC6T4qMsQekKRpBRG694ilXkJOyVirydpLfNSm0tOtvL9gh3uCL38XlX8L3mva l4+9Xf0wIgCvP+iwMzMXB7y0cvIlei9+VxNfCqiXz/dNEKYShg1LgDjum+oMcPt3mtxh2kv2Pmc P52IEJN+Z3j4RldPHyZ1fFRMc/haQn9YKRDOqRYOL8rXG9X1wueuFO2oIOZt+a0Z/Rm8o6Zaupn xxiby55Xhu4AofrL6ywWtw+s5br/zvvukaBfcY5babVyfyqEedXDVx5qomR4PyJvhgJQIfZ/tBd 8Pb1bqtaiIRgNbIPXTTJzaTp5dI5fFtcMk7U5i7t2jqTQ== X-Received: by 127.0.0.2 with SMTP id Zi1bYY7687511xadyzM9Ktrb; Tue, 21 May 2024 07:05:45 -0700 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.77]) by mx.groups.io with SMTP id smtpd.web10.20519.1716300342886466619 for ; Tue, 21 May 2024 07:05:43 -0700 X-Received: from DUZPR01CA0049.eurprd01.prod.exchangelabs.com (2603:10a6:10:469::9) by PAWPR08MB9757.eurprd08.prod.outlook.com (2603:10a6:102:2e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Tue, 21 May 2024 14:05:37 +0000 X-Received: from DU6PEPF0000A7DE.eurprd02.prod.outlook.com (2603:10a6:10:469:cafe::4d) by DUZPR01CA0049.outlook.office365.com (2603:10a6:10:469::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36 via Frontend Transport; Tue, 21 May 2024 14:05:37 +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=arm.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 DU6PEPF0000A7DE.mail.protection.outlook.com (10.167.8.38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7611.14 via Frontend Transport; Tue, 21 May 2024 14:05:36 +0000 X-Received: ("Tessian outbound b7675f20d34d:v315"); Tue, 21 May 2024 14:05:36 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 10256ddec8207903 X-CR-MTA-TID: 64aa7808 X-Received: from c4cdd0781bef.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 3AD7D8CD-2DE8-4FDD-BA84-4F5F2AA168E4.1; Tue, 21 May 2024 14:05:31 +0000 X-Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c4cdd0781bef.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 21 May 2024 14:05:31 +0000 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 PAXPR08MB6463.eurprd08.prod.outlook.com (2603:10a6:102:157::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.18; Tue, 21 May 2024 14:05:25 +0000 X-Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::1e13:dc65:224e:219c]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::1e13:dc65:224e:219c%5]) with mapi id 15.20.7587.035; Tue, 21 May 2024 14:05:25 +0000 Message-ID: Date: Tue, 21 May 2024 15:05:24 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH RESEND edk2-platforms][PATCH V2 05/14] Platform/ARM: Create NorFlashDeviceLib library interface for flash specific functions To: Sahil , devel@edk2.groups.io CC: Sahil Kaushal , Ard Biesheuvel , Leif Lindholm , "nd@arm.com" References: <20240423055638.1271531-1-Sahil.Kaushal@arm.com> <20240423055638.1271531-6-Sahil.Kaushal@arm.com> From: "Sami Mujawar" In-Reply-To: X-ClientProxiedBy: LO4P123CA0051.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:152::20) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AS8PR08MB6806:EE_|PAXPR08MB6463:EE_|DU6PEPF0000A7DE:EE_|PAWPR08MB9757:EE_ X-MS-Office365-Filtering-Correlation-Id: 56f0cc7f-38e7-4fb7-6f36-08dc799f16da x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0;ARA:13230031|376005|1800799015|366007; X-Microsoft-Antispam-Message-Info-Original: =?utf-8?B?M2wxT1RQMCtnYkJEblBoOGw4QUNFcXhLR1JGcFY1NURzaGR6ZX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.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(1800799015)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6463 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: DU6PEPF0000A7DE.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 4dca3147-277e-4896-a5e6-08dc799f100e X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?sTgwsrCziHqPsYtYPohk8NmsyHUaBeo41dsTbUFAeMfADE8CoBQL2rlvAGvT?= =?us-ascii?Q?Cw7x+QJ05H+00wdb/HzfSb6bnW924OhSopY+TyWV7ChNR742Tr0yXOx6dtBV?= =?us-ascii?Q?IkQz4biKz5jqU1rNiW8Oe9vhHw2V4Ukx8N6R9pdrk8k/x3BFFA+JybhfDEpY?= =?us-ascii?Q?P2djRpxnJNj8sQa3NKS7SBw2qYyo/M05e8GpY6N44EffFb97dV99iSEenifZ?= =?us-ascii?Q?8ievJCR4rtj0F7RPSWdMUEo//562TfLbRGzeuXzrRCHLHaXZz8NvmTsuuwHi?= =?us-ascii?Q?8LZ1ibT8qh4bQAMQr+C8Dt+c/J6T0XybssJcGYtwTCfZq78qksd6v/zTudNI?= =?us-ascii?Q?wi9vbCmzTOpP04oBM9xIcPmUtnBKJchhTKHJpA1VxmD2edaQRxSqthRhB2OL?= =?us-ascii?Q?D0zPtaQlr4NNulnRMCk4/bXICvzteVBNS3McOl+/SoUM9izyN2r9F85ermY7?= =?us-ascii?Q?BvJEPo9muAJ7YSDMFZs/8pmBKMtQwAwTPKbxWr2m3xwRD2kl+GmFMzyr8AgQ?= =?us-ascii?Q?Io+ky6kfxmzDYcavmg2ZFkCkdZUNiUpMHGwLf6rxISn1PZR/ks2TQ8JzwVdu?= =?us-ascii?Q?jejl3dBtkr8aRghqvnowrGj9ptZaJVAalRFXj24W7+p7wAVb5zIjE/Z6C78Z?= =?us-ascii?Q?6ZHFM3v5Z0kH05v70kY0ldTgnT0BUgwp56Bwj8a7yvpu1MXwY0ebsZLRurJk?= =?us-ascii?Q?ZUssHn51ciAmNsftsSeTPvwXqB8Rl8euUJauDIGu6Wn9fQRZYDQQWrJYzlKX?= =?us-ascii?Q?i0of+HU4b9nqnuGMxsUUUdqTWoMIedZ3tKxZRAf2y+jEOO8nRuOhCjZnCWBE?= =?us-ascii?Q?98b+apVK8kcCQE8P32W7CfbCym9aMDhoAvpqZ8eUjYVcdBDSvZzE5C6SD5+p?= =?us-ascii?Q?2aFdTrxCmC/GxU0yDKMBtweV59J9jEyZ/o3kPKD+ryJuXDDdsRU9yyAt5xJt?= =?us-ascii?Q?+U+ILYHr3MzBbqUN8ZrnKOU3TLWoqbweH3nvaeqGCpyp5tQdoHxXPWBmBVds?= =?us-ascii?Q?b3Z/3T/DA2HkmmQs18ipsSKZhNAv2dtfad65Rc9Sdo/Ei7ThF966B2ecGaYb?= =?us-ascii?Q?pBX9cWUL9KmBSqI3fKYmg9wXu2jNSfQ/zWT5bY5V5nfc5+y98xvB8zR5aXVz?= =?us-ascii?Q?yLEdGNB6RU6R2xTEjSVjtibKsfkoNZHDp18Grol3ahcv1QZmeZnv2tEpKYDD?= =?us-ascii?Q?60i1WC2xTgLEwVNkcw14qZTmksls43ataPcChn8kkbTe5rrRGyi5cI4nHY/V?= =?us-ascii?Q?0CY8f7xaPYb84kEekHkg1vhRljlIj4Rs6STB305okYZoQjnVFdQNAkQdXZOj?= =?us-ascii?Q?/6aqrktLXImQikmUEb/MHvwilyi1B+NAk0pn/grZvJcreZTAL6cWB/8MPhsT?= =?us-ascii?Q?l7kBS8MiECbkMTQT/rtk4zEAjp/p?= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 May 2024 14:05:36.9942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 56f0cc7f-38e7-4fb7-6f36-08dc799f16da 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: DU6PEPF0000A7DE.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR08MB9757 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: Tue, 21 May 2024 07:05:43 -0700 Resent-From: sami.mujawar@arm.com Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: nb6DuyjRFwiDXZxSULi8Z260x7686176AA= Content-Language: en-GB Content-Type: text/plain; charset=UTF-8; format=flowed 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=t1W0CZ4e; 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 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io Hi Sahil, Please find my response inline marked [SAMI]. Regards, Sami mujawar On 21/05/2024 09:37 am, Sahil wrote: > Hi Sami, > Thank you for reviewing the patches. > Please find my comments inline below marked as [SAHIL]. > Also, for the documentation headers, I will try to add in > NorFlashDeviceLib.h and keep it consistent with > CadenceQspiNorFlashDeviceLib. > > > On Thu, 16 May 2024 at 20:48, Sami Mujawar via groups.io > wrote: >> Hi Sahil, >> >> Thank you for this patch. >> >> I have some feedback marked inline as [SAMI]. >> >> Other than that, is is possible to add documentation header for the func= tions and data streuctures in this file, please? >> >> With that fixed, >> >> Reviewed-by: Sami Mujawar >> >> Regards, >> >> Sami Mujawar >> >> On 23/04/2024 06:56 am, Sahil Kaushal wrote: >> >> From: sahil >> >> NorFlashDeviceLib can be used to provide implementations of different >> NOR Flash to NorFlashDxe, i.e. NorFlashDxe links with NorFlashDeviceLib >> and the platforms can specify their respective NorFlashDeviceLib >> instances. >> >> This patch splits NorFlash.h and moves out the function prototypes and >> macros that are expected by NorFlashDxe to be implemented by any >> Nor Flash implementation to NorFlashDeviceLib.h file. >> >> Signed-off-by: sahil >> --- >> Platform/ARM/ARM.dec | 1 + >> Platform/ARM/Drivers/NorFlashDxe/NorFlash.h | 143 +-------------= ---- >> Platform/ARM/Drivers/NorFlashDxe/NorFlashCommon.h | 1 + >> Platform/ARM/Include/Library/NorFlashDeviceLib.h | 156 ++++++++++++++= ++++++ >> 4 files changed, 159 insertions(+), 142 deletions(-) >> >> diff --git a/Platform/ARM/ARM.dec b/Platform/ARM/ARM.dec >> index be7e6dc83fde..86d1fcb4878e 100644 >> --- a/Platform/ARM/ARM.dec >> +++ b/Platform/ARM/ARM.dec >> @@ -17,6 +17,7 @@ >> >> >> [LibraryClasses] >> >> BdsLib|Include/Library/BdsLib.h >> >> + NorFlashDeviceLib|Include/Library/NorFlashDeviceLib.h >> >> NorFlashPlatformLib|Include/Library/NorFlashPlatformLib.h >> >> >> >> [Guids] >> >> diff --git a/Platform/ARM/Drivers/NorFlashDxe/NorFlash.h b/Platform/ARM/= Drivers/NorFlashDxe/NorFlash.h >> index bd5c6a949cf0..6cb1f64b9875 100644 >> --- a/Platform/ARM/Drivers/NorFlashDxe/NorFlash.h >> +++ b/Platform/ARM/Drivers/NorFlashDxe/NorFlash.h >> @@ -20,6 +20,7 @@ >> >> >> #include >> >> #include >> >> +#include >> >> >> >> #define NOR_FLASH_ERASE_RETRY 10 >> >> >> >> @@ -40,7 +41,6 @@ >> #define CREATE_NOR_ADDRESS(BaseAddr, OffsetAddr) ((BaseAddr) + (= (OffsetAddr) << 2)) >> >> #define CREATE_DUAL_CMD(Cmd) ( ( Cmd << 16) = | ( Cmd & LOW_16_BITS) ) >> >> #define SEND_NOR_COMMAND(BaseAddr, Offset, Cmd) MmioWrite32 (CR= EATE_NOR_ADDRESS(BaseAddr,Offset), CREATE_DUAL_CMD(Cmd)) >> >> -#define GET_NOR_BLOCK_ADDRESS(BaseAddr, Lba, LbaSize) ( BaseAddr + (UI= NTN)((Lba) * LbaSize) ) >> >> >> >> // Status Register Bits >> >> #define P30_SR_BIT_WRITE (BIT7 << 16 | BIT7) >> >> @@ -105,145 +105,4 @@ >> #define P30_CMD_READ_CONFIGURATION_REGISTER_SETUP 0x0060 >> >> #define P30_CMD_READ_CONFIGURATION_REGISTER 0x0003 >> >> >> >> -typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; >> >> - >> >> -#pragma pack (1) >> >> -typedef struct { >> >> - VENDOR_DEVICE_PATH Vendor; >> >> - UINT8 Index; >> >> - EFI_DEVICE_PATH_PROTOCOL End; >> >> -} NOR_FLASH_DEVICE_PATH; >> >> -#pragma pack () >> >> - >> >> -struct _NOR_FLASH_INSTANCE { >> >> - UINT32 Signature; >> >> - EFI_HANDLE Handle; >> >> - >> >> - UINTN DeviceBaseAddress; >> >> - UINTN RegionBaseAddress; >> >> - UINTN Size; >> >> - EFI_LBA StartLba; >> >> - >> >> - EFI_BLOCK_IO_PROTOCOL BlockIoProtocol; >> >> - EFI_BLOCK_IO_MEDIA Media; >> >> - EFI_DISK_IO_PROTOCOL DiskIoProtocol; >> >> - >> >> - EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL FvbProtocol; >> >> - VOID *ShadowBuffer; >> >> - >> >> - NOR_FLASH_DEVICE_PATH DevicePath; >> >> -}; >> >> - >> >> -EFI_STATUS >> >> -NorFlashReadCfiData ( >> >> - IN UINTN DeviceBaseAddress, >> >> - IN UINTN CFI_Offset, >> >> - IN UINT32 NumberOfBytes, >> >> - OUT UINT32 *Data >> >> - ); >> >> [SAMI] Where is this function implemented ? > [SAHIL] > This function is not implemented anywhere. It is the same for > NorFlashWrite() as well. > I have migrated them as-is from NorFlash.h but If needed I can push a > patch removing both from the library interface. > Shall I push it? [SAMI] Yes, please drop the dead code. [/SAMI] > [/SAHIL] >> - >> >> -EFI_STATUS >> >> -NorFlashWriteBuffer ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN UINTN TargetAddress, >> >> - IN UINTN BufferSizeInBytes, >> >> - IN UINT32 *Buffer >> >> - ); >> >> - >> >> -// >> >> -// NorFlash.c >> >> -// >> >> -EFI_STATUS >> >> -NorFlashWriteSingleBlock ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN EFI_LBA Lba, >> >> - IN UINTN Offset, >> >> - IN OUT UINTN *NumBytes, >> >> - IN UINT8 *Buffer >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashWriteBlocks ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN EFI_LBA Lba, >> >> - IN UINTN BufferSizeInBytes, >> >> - IN VOID *Buffer >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashReadBlocks ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN EFI_LBA Lba, >> >> - IN UINTN BufferSizeInBytes, >> >> - OUT VOID *Buffer >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashRead ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN EFI_LBA Lba, >> >> - IN UINTN Offset, >> >> - IN UINTN BufferSizeInBytes, >> >> - OUT VOID *Buffer >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashWrite ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN EFI_LBA Lba, >> >> - IN UINTN Offset, >> >> - IN OUT UINTN *NumBytes, >> >> - IN UINT8 *Buffer >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashReset ( >> >> - IN NOR_FLASH_INSTANCE *Instance >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashEraseSingleBlock ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN UINTN BlockAddress >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashUnlockSingleBlockIfNecessary ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN UINTN BlockAddress >> >> - ); >> >> [SAMI] Should this be a STATIC function in the Device Library implementa= tions? Would it make more sense to have NorFlashBlockIsLocked() exposed via= this library interface instead. >> >> Also, would it make sense to integrate the check to see if the block is = locked in the NorFlashUnlockSingleBlock() instead and expose it via the lib= rary interface? >> >> [/SAMI] > [SAHIL] > I think it is okay to just expose > NorFlashUnlockSingleBlockIfNecessary() through the interface as it > takes care of both NorFlashBlockIsLocked() and > NorFlashUnlockSingleBlock(). Also, at the moment these functions are > not used anywhere outside the library implementations. > But if we still want to make it STATIC and expose other functions, do > you want me to expose both NorFlashBlockIsLocked() and > NorFlashUnlockSingleBlock()? Or just NorFlashUnlockSingleBlock() with > the NorFlashBlockIsLocked() check in it? [/SAHIL] [SAMI]=C2=A0 If the functions are not used outside the library just make th= em=20 STATIC and in that case there is no need to modify the existing=20 functionality. If we need to export them at a later point in time it can always be done. [/SAMI] >> - >> >> -EFI_STATUS >> >> -NorFlashWriteSingleWord ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN UINTN WordAddress, >> >> - IN UINT32 WriteData >> >> - ); >> >> [SAMI] Should this function be made STATIC in the Device Library impleme= ntations? > [SAHIL] I will push a new patch making NorFlashWriteBuffer() and > NorFlashWriteSingleWord () STATIC. >> - >> >> -EFI_STATUS >> >> -NorFlashWriteFullBlock ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN EFI_LBA Lba, >> >> - IN UINT32 *DataBuffer, >> >> - IN UINT32 BlockSizeInWords >> >> - ); >> >> - >> >> -EFI_STATUS >> >> -NorFlashUnlockAndEraseSingleBlock ( >> >> - IN NOR_FLASH_INSTANCE *Instance, >> >> - IN UINTN BlockAddress >> >> - ); >> >> - >> >> -VOID >> >> -EFIAPI >> >> -NorFlashLock ( >> >> - IN EFI_TPL *OriginalTPL >> >> - ); >> >> - >> >> -VOID >> >> -EFIAPI >> >> -NorFlashUnlock ( >> >> - IN EFI_TPL OriginalTPL >> >> - ); >> >> - >> >> #endif /* __NOR_FLASH_H__ */ >> >> diff --git a/Platform/ARM/Drivers/NorFlashDxe/NorFlashCommon.h b/Platfor= m/ARM/Drivers/NorFlashDxe/NorFlashCommon.h >> index c0a3b5861532..7fcb949843e8 100644 >> --- a/Platform/ARM/Drivers/NorFlashDxe/NorFlashCommon.h >> +++ b/Platform/ARM/Drivers/NorFlashDxe/NorFlashCommon.h >> @@ -19,6 +19,7 @@ >> #include >> >> >> >> #include >> >> +#include >> >> #include >> >> #include >> >> #include >> >> diff --git a/Platform/ARM/Include/Library/NorFlashDeviceLib.h b/Platform= /ARM/Include/Library/NorFlashDeviceLib.h >> new file mode 100644 >> index 000000000000..e5017130a091 >> --- /dev/null >> +++ b/Platform/ARM/Include/Library/NorFlashDeviceLib.h >> @@ -0,0 +1,156 @@ >> +/** @file NorFlashDeviceLib.h >> >> + >> >> + Copyright (c) 2011 - 2024, Arm Limited. All rights reserved.
>> >> + >> >> + SPDX-License-Identifier: BSD-2-Clause-Patent >> >> + >> >> +**/ >> >> + >> >> +#ifndef NOR_FLASH_DEVICE_LIB_H_ >> >> +#define NOR_FLASH_DEVICE_LIB_H_ >> >> + >> >> +#include >> >> +#include >> >> +#include >> >> + >> >> +typedef struct _NOR_FLASH_INSTANCE NOR_FLASH_INSTANCE; >> >> + >> >> +#define GET_NOR_BLOCK_ADDRESS(BaseAddr, Lba, LbaSize) ( BaseAddr + (UI= NTN)((Lba) * LbaSize) ) >> >> + >> >> +#pragma pack (1) >> >> +typedef struct { >> >> + VENDOR_DEVICE_PATH Vendor; >> >> + UINT8 Index; >> >> + EFI_DEVICE_PATH_PROTOCOL End; >> >> +} NOR_FLASH_DEVICE_PATH; >> >> +#pragma pack () >> >> + >> >> +struct _NOR_FLASH_INSTANCE { >> >> + UINT32 Signature; >> >> + EFI_HANDLE Handle; >> >> + >> >> + UINTN DeviceBaseAddress; >> >> + UINTN RegionBaseAddress; >> >> + UINTN Size; >> >> + EFI_LBA StartLba; >> >> + >> >> + EFI_BLOCK_IO_PROTOCOL BlockIoProtocol; >> >> + EFI_BLOCK_IO_MEDIA Media; >> >> + EFI_DISK_IO_PROTOCOL DiskIoProtocol; >> >> + >> >> + EFI_FIRMWARE_VOLUME_BLOCK2_PROTOCOL FvbProtocol; >> >> + VOID *ShadowBuffer; >> >> + >> >> + NOR_FLASH_DEVICE_PATH DevicePath; >> >> +}; >> >> + >> >> +EFI_STATUS >> >> +NorFlashReadCfiData ( >> >> + IN UINTN DeviceBaseAddress, >> >> + IN UINTN CFI_Offset, >> >> + IN UINT32 NumberOfBytes, >> >> + OUT UINT32 *Data >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashWriteBuffer ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN UINTN TargetAddress, >> >> + IN UINTN BufferSizeInBytes, >> >> + IN UINT32 *Buffer >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashWriteFullBlock ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN EFI_LBA Lba, >> >> + IN UINT32 *DataBuffer, >> >> + IN UINT32 BlockSizeInWords >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashUnlockAndEraseSingleBlock ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN UINTN BlockAddress >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashWriteSingleBlock ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN EFI_LBA Lba, >> >> + IN UINTN Offset, >> >> + IN OUT UINTN *NumBytes, >> >> + IN UINT8 *Buffer >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashWriteBlocks ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN EFI_LBA Lba, >> >> + IN UINTN BufferSizeInBytes, >> >> + IN VOID *Buffer >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashReadBlocks ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN EFI_LBA Lba, >> >> + IN UINTN BufferSizeInBytes, >> >> + OUT VOID *Buffer >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashRead ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN EFI_LBA Lba, >> >> + IN UINTN Offset, >> >> + IN UINTN BufferSizeInBytes, >> >> + OUT VOID *Buffer >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashWrite ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN EFI_LBA Lba, >> >> + IN UINTN Offset, >> >> + IN OUT UINTN *NumBytes, >> >> + IN UINT8 *Buffer >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashReset ( >> >> + IN NOR_FLASH_INSTANCE *Instance >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashEraseSingleBlock ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN UINTN BlockAddress >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashUnlockSingleBlockIfNecessary ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN UINTN BlockAddress >> >> + ); >> >> + >> >> +EFI_STATUS >> >> +NorFlashWriteSingleWord ( >> >> + IN NOR_FLASH_INSTANCE *Instance, >> >> + IN UINTN WordAddress, >> >> + IN UINT32 WriteData >> >> + ); >> >> + >> >> +VOID >> >> +EFIAPI >> >> +NorFlashLock ( >> >> + IN EFI_TPL *OriginalTPL >> >> + ); >> >> + >> >> +VOID >> >> +EFIAPI >> >> +NorFlashUnlock ( >> >> + IN EFI_TPL OriginalTPL >> >> + ); >> >> + >> >> +#endif /* NOR_FLASH_DEVICE_LIB_H_ */ >> >> IMPORTANT NOTICE: The contents of this email and any attachments are con= fidential and may also be privileged. If you are not the intended recipient= , please notify the sender immediately and do not disclose the contents to = any other person, use it for any purpose, or store or copy the information = in any medium. Thank you. >>=20 -=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 (#119103): https://edk2.groups.io/g/devel/message/119103 Mute This Topic: https://groups.io/mt/105690940/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-