From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web08.6984.1666180305974136011 for ; Wed, 19 Oct 2022 04:51:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=M5tmmnz9; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8766DB82187; Wed, 19 Oct 2022 11:51:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EC9AC433C1; Wed, 19 Oct 2022 11:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666180302; bh=klrGhlFaNzMj49kPWIVW7l23nWm17neZ49cvXEdg9G8=; h=From:To:Cc:Subject:Date:From; b=M5tmmnz9a2KbKguKE3b92xTTxFabxiXw9PailOLlGxpI3+i1Hvzv13mWdHmGR4jhJ o9kLop3WPgFxBNpYHn8cbk+MEZOBSi0w1QSe62ZReosWIbnbSG8RlSRKLfz4POJ5kQ FcDY0pQpX9XrwHYtLKOVDw3IFF7Qqq7AECJvKp4v0KkNBrt+Wv1ZKGJnY6IbVfjuzb lffT0VuouWZzQ7AkiltKwoFRoe9pfrZC7WNvmTqy1KkJrjuMaQZwrbl8wxCu607VGe UO4FaDAbZ8nsN1DiFGy/DhYgCUWl0+54Nx0iTcQxvRovCMCG2rbrgL1sMYB6uzR7Zt 008lvJognRiuA== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: quic_llindhol@quicinc.com, Ard Biesheuvel Subject: [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib Date: Wed, 19 Oct 2022 13:51:36 +0200 Message-Id: <20221019115136.513007-1-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Fip006Dxe is part of the SynQuacer platform, which is its only user, and yet, it relies on NorFlashPlatformLib to carry the platform specific NOR geometry. This library is tied to ArmPlatformPkg's NorFlashDxe, which will be going away, so let's stop using it. Since the abstraction serves no purpose here, let's just merge the library with its only user. Signed-off-by: Ard Biesheuvel --- .../SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf | 3 +- .../Drivers/Fip006Dxe/Fip006StandaloneMm.inf | 2 +- .../NorFlashSynQuacerLib.inf | 35 ---------- .../SynQuacer/Drivers/Fip006Dxe/NorFlash.h | 14 +++- .../SynQuacer/Drivers/Fip006Dxe/NorFlash.c | 44 +++++++++++++ .../SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c | 7 -- .../SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c | 7 -- .../NorFlashSynQuacerLib/NorFlashSynQuacer.c | 64 ------------------- 8 files changed, 59 insertions(+), 117 deletions(-) delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLi= b/NorFlashSynQuacerLib.inf delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLi= b/NorFlashSynQuacer.c diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf b/= Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf index f91fdcfbc46d..6c7ce663d8b0 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf @@ -24,11 +24,11 @@ [Sources] NorFlashFvb.c=0D =0D [Packages]=0D - ArmPlatformPkg/ArmPlatformPkg.dec=0D EmbeddedPkg/EmbeddedPkg.dec=0D MdeModulePkg/MdeModulePkg.dec=0D MdePkg/MdePkg.dec=0D Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec=0D + Silicon/Socionext/SynQuacer/SynQuacer.dec=0D =0D [LibraryClasses]=0D BaseLib=0D @@ -40,7 +40,6 @@ [LibraryClasses] IoLib=0D MemoryAllocationLib=0D NorFlashInfoLib=0D - NorFlashPlatformLib=0D UefiBootServicesTableLib=0D UefiDriverEntryPoint=0D UefiLib=0D diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Standalone= Mm.inf b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.i= nf index 8f4184dcbd8b..014ad791defc 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf @@ -30,6 +30,7 @@ [Packages] MdeModulePkg/MdeModulePkg.dec=0D MdePkg/MdePkg.dec=0D Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec=0D + Silicon/Socionext/SynQuacer/SynQuacer.dec=0D StandaloneMmPkg/StandaloneMmPkg.dec=0D =0D [LibraryClasses]=0D @@ -40,7 +41,6 @@ [LibraryClasses] MemoryAllocationLib=0D MmServicesTableLib=0D NorFlashInfoLib=0D - NorFlashPlatformLib=0D StandaloneMmDriverEntryPoint=0D =0D [Guids]=0D diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFl= ashSynQuacerLib.inf b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacer= Lib/NorFlashSynQuacerLib.inf deleted file mode 100644 index c1ed3c4d1ca8..000000000000 --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQ= uacerLib.inf +++ /dev/null @@ -1,35 +0,0 @@ -#/** @file=0D -#=0D -# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
=0D -# SPDX-License-Identifier: BSD-2-Clause-Patent=0D -#=0D -#**/=0D -=0D -[Defines]=0D - INF_VERSION =3D 0x0001001A=0D - BASE_NAME =3D NorFlashSynQuacerLib=0D - FILE_GUID =3D 8279227C-C555-4D75-B439-D8A959635CDD= =0D - MODULE_TYPE =3D BASE=0D - VERSION_STRING =3D 1.0=0D - LIBRARY_CLASS =3D NorFlashPlatformLib=0D -=0D -[Sources]=0D - NorFlashSynQuacer.c=0D -=0D -[Packages]=0D - ArmPlatformPkg/ArmPlatformPkg.dec=0D - ArmPkg/ArmPkg.dec=0D - MdeModulePkg/MdeModulePkg.dec=0D - MdePkg/MdePkg.dec=0D - Silicon/Socionext/SynQuacer/SynQuacer.dec=0D -=0D -[LibraryClasses]=0D - BaseLib=0D -=0D -[FixedPcd]=0D - gArmTokenSpaceGuid.PcdFdBaseAddress=0D - gArmTokenSpaceGuid.PcdFdSize=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize=0D - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize=0D diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h b/Sil= icon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h index 3cb86ab588e0..a287b9e396fb 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h @@ -22,7 +22,6 @@ =0D #include =0D #include =0D -#include =0D =0D #include "Fip006Reg.h"=0D =0D @@ -291,6 +290,19 @@ NorFlashReadID ( OUT UINT8 JedecId[3]=0D );=0D =0D +typedef struct {=0D + UINTN DeviceBaseAddress; // Start address of the Device Base Ad= dress (DBA)=0D + UINTN RegionBaseAddress; // Start address of one single region= =0D + UINTN Size;=0D + UINTN BlockSize;=0D +} NOR_FLASH_DESCRIPTION;=0D +=0D +EFI_STATUS=0D +NorFlashPlatformGetDevices (=0D + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,=0D + OUT UINT32 *Count=0D + );=0D +=0D #define SPINOR_SR_WIP BIT0 // Write in progress=0D #define SPINOR_FSR_READY BIT7 // Flag Status Register: ready= =0D =0D diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Sil= icon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c index b2ca0033ac13..978b2e1e4c63 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c @@ -15,8 +15,35 @@ #include =0D #include =0D =0D +#include =0D +=0D #include "NorFlash.h"=0D =0D +#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE=0D +#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)=0D +=0D +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)= =0D +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize)= + \=0D + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSiz= e) + \=0D + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)= )=0D +=0D +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D {=0D + {=0D + // UEFI code region=0D + SYNQUACER_SPI_NOR_BASE, // device base=0D + FW_CODE_REGION_BASE, // region base=0D + FW_CODE_REGION_SIZE, // region size=0D + SIZE_64KB, // block size=0D + },=0D + {=0D + // Environment variable region=0D + SYNQUACER_SPI_NOR_BASE, // device base=0D + FW_ENV_REGION_BASE, // region base=0D + FW_ENV_REGION_SIZE, // region size=0D + SIZE_64KB, // block size=0D + },=0D +};=0D +=0D STATIC CONST UINT16 mFip006NullCmdSeq[] =3D {=0D CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE)= ,=0D CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE)= ,=0D @@ -995,3 +1022,20 @@ NorFlashReadID ( NorFlashSetHostCommand (Instance, SPINOR_OP_READ_4B);=0D return EFI_SUCCESS;=0D }=0D +=0D +EFI_STATUS=0D +NorFlashPlatformGetDevices (=0D + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,=0D + OUT UINT32 *Count=0D + )=0D +{=0D + if (NorFlashDevices =3D=3D NULL ||=0D + Count =3D=3D NULL) {=0D + return EFI_INVALID_PARAMETER;=0D + }=0D +=0D + *Count =3D ARRAY_SIZE (mNorFlashDevices);=0D + *NorFlashDevices =3D mNorFlashDevices;=0D +=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c b/= Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c index d87b62956ded..aa380cd9aec3 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashDxe.c @@ -229,13 +229,6 @@ NorFlashInitialise ( EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);=0D ASSERT_EFI_ERROR (Status);=0D =0D - Status =3D NorFlashPlatformInitialization ();=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR,=0D - "NorFlashInitialise: Fail to initialize Nor Flash devices\n"));=0D - return Status;=0D - }=0D -=0D // Initialize NOR flash instances=0D Status =3D NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDevic= eCount);=0D if (EFI_ERROR (Status)) {=0D diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c b/= Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c index 7daec948a995..718b19b33117 100644 --- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c +++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashSmm.c @@ -106,13 +106,6 @@ NorFlashInitialise ( NOR_FLASH_DESCRIPTION* NorFlashDevices;=0D BOOLEAN ContainVariableStorage;=0D =0D - Status =3D NorFlashPlatformInitialization ();=0D - if (EFI_ERROR (Status)) {=0D - DEBUG ((DEBUG_ERROR,=0D - "NorFlashInitialise: Fail to initialize Nor Flash devices\n"));=0D - return Status;=0D - }=0D -=0D // Initialize NOR flash instances=0D Status =3D NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDevic= eCount);=0D if (EFI_ERROR (Status)) {=0D diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFl= ashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/N= orFlashSynQuacer.c deleted file mode 100644 index b2d1c39e2c61..000000000000 --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQ= uacer.c +++ /dev/null @@ -1,64 +0,0 @@ -/** @file=0D -=0D - Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
=0D -=0D - SPDX-License-Identifier: BSD-2-Clause-Patent=0D -=0D - **/=0D -=0D -#include =0D -#include =0D -#include =0D -#include =0D -=0D -#include =0D -=0D -#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE=0D -#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)=0D -=0D -#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)= =0D -#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize)= + \=0D - FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSiz= e) + \=0D - FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)= )=0D -=0D -STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] =3D {=0D - {=0D - // UEFI code region=0D - SYNQUACER_SPI_NOR_BASE, // device base=0D - FW_CODE_REGION_BASE, // region base=0D - FW_CODE_REGION_SIZE, // region size=0D - SIZE_64KB, // block size=0D - },=0D - {=0D - // Environment variable region=0D - SYNQUACER_SPI_NOR_BASE, // device base=0D - FW_ENV_REGION_BASE, // region base=0D - FW_ENV_REGION_SIZE, // region size=0D - SIZE_64KB, // block size=0D - },=0D -};=0D -=0D -EFI_STATUS=0D -NorFlashPlatformInitialization (=0D - VOID=0D - )=0D -{=0D - return EFI_SUCCESS;=0D -}=0D -=0D -EFI_STATUS=0D -NorFlashPlatformGetDevices (=0D - OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,=0D - OUT UINT32 *Count=0D - )=0D -{=0D - if (NorFlashDevices =3D=3D NULL ||=0D - Count =3D=3D NULL) {=0D - return EFI_INVALID_PARAMETER;=0D - }=0D -=0D - *Count =3D ARRAY_SIZE (mNorFlashDevices);=0D - *NorFlashDevices =3D mNorFlashDevices;=0D -=0D - return EFI_SUCCESS;=0D -}=0D --=20 2.35.1