* [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib
@ 2022-10-19 11:51 Ard Biesheuvel
2022-10-19 13:49 ` Leif Lindholm
0 siblings, 1 reply; 3+ messages in thread
From: Ard Biesheuvel @ 2022-10-19 11:51 UTC (permalink / raw)
To: devel; +Cc: quic_llindhol, Ard Biesheuvel
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 <ardb@kernel.org>
---
.../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/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf
delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/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
[Packages]
- ArmPlatformPkg/ArmPlatformPkg.dec
EmbeddedPkg/EmbeddedPkg.dec
MdeModulePkg/MdeModulePkg.dec
MdePkg/MdePkg.dec
Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec
+ Silicon/Socionext/SynQuacer/SynQuacer.dec
[LibraryClasses]
BaseLib
@@ -40,7 +40,6 @@ [LibraryClasses]
IoLib
MemoryAllocationLib
NorFlashInfoLib
- NorFlashPlatformLib
UefiBootServicesTableLib
UefiDriverEntryPoint
UefiLib
diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf
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
MdePkg/MdePkg.dec
Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec
+ Silicon/Socionext/SynQuacer/SynQuacer.dec
StandaloneMmPkg/StandaloneMmPkg.dec
[LibraryClasses]
@@ -40,7 +41,6 @@ [LibraryClasses]
MemoryAllocationLib
MmServicesTableLib
NorFlashInfoLib
- NorFlashPlatformLib
StandaloneMmDriverEntryPoint
[Guids]
diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf
deleted file mode 100644
index c1ed3c4d1ca8..000000000000
--- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf
+++ /dev/null
@@ -1,35 +0,0 @@
-#/** @file
-#
-# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#**/
-
-[Defines]
- INF_VERSION = 0x0001001A
- BASE_NAME = NorFlashSynQuacerLib
- FILE_GUID = 8279227C-C555-4D75-B439-D8A959635CDD
- MODULE_TYPE = BASE
- VERSION_STRING = 1.0
- LIBRARY_CLASS = NorFlashPlatformLib
-
-[Sources]
- NorFlashSynQuacer.c
-
-[Packages]
- ArmPlatformPkg/ArmPlatformPkg.dec
- ArmPkg/ArmPkg.dec
- MdeModulePkg/MdeModulePkg.dec
- MdePkg/MdePkg.dec
- Silicon/Socionext/SynQuacer/SynQuacer.dec
-
-[LibraryClasses]
- BaseLib
-
-[FixedPcd]
- gArmTokenSpaceGuid.PcdFdBaseAddress
- gArmTokenSpaceGuid.PcdFdSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
- gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h b/Silicon/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 @@
#include <Library/DebugLib.h>
#include <Library/IoLib.h>
-#include <Library/NorFlashPlatformLib.h>
#include "Fip006Reg.h"
@@ -291,6 +290,19 @@ NorFlashReadID (
OUT UINT8 JedecId[3]
);
+typedef struct {
+ UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA)
+ UINTN RegionBaseAddress; // Start address of one single region
+ UINTN Size;
+ UINTN BlockSize;
+} NOR_FLASH_DESCRIPTION;
+
+EFI_STATUS
+NorFlashPlatformGetDevices (
+ OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
+ OUT UINT32 *Count
+ );
+
#define SPINOR_SR_WIP BIT0 // Write in progress
#define SPINOR_FSR_READY BIT7 // Flag Status Register: ready
diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Silicon/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 <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
+#include <Platform/MemoryMap.h>
+
#include "NorFlash.h"
+#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE
+#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)
+
+#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)
+#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
+ FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
+ FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
+
+STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
+ {
+ // UEFI code region
+ SYNQUACER_SPI_NOR_BASE, // device base
+ FW_CODE_REGION_BASE, // region base
+ FW_CODE_REGION_SIZE, // region size
+ SIZE_64KB, // block size
+ },
+ {
+ // Environment variable region
+ SYNQUACER_SPI_NOR_BASE, // device base
+ FW_ENV_REGION_BASE, // region base
+ FW_ENV_REGION_SIZE, // region size
+ SIZE_64KB, // block size
+ },
+};
+
STATIC CONST UINT16 mFip006NullCmdSeq[] = {
CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE),
CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE),
@@ -995,3 +1022,20 @@ NorFlashReadID (
NorFlashSetHostCommand (Instance, SPINOR_OP_READ_4B);
return EFI_SUCCESS;
}
+
+EFI_STATUS
+NorFlashPlatformGetDevices (
+ OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
+ OUT UINT32 *Count
+ )
+{
+ if (NorFlashDevices == NULL ||
+ Count == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ *Count = ARRAY_SIZE (mNorFlashDevices);
+ *NorFlashDevices = mNorFlashDevices;
+
+ return EFI_SUCCESS;
+}
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);
ASSERT_EFI_ERROR (Status);
- Status = NorFlashPlatformInitialization ();
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR,
- "NorFlashInitialise: Fail to initialize Nor Flash devices\n"));
- return Status;
- }
-
// Initialize NOR flash instances
Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount);
if (EFI_ERROR (Status)) {
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;
BOOLEAN ContainVariableStorage;
- Status = NorFlashPlatformInitialization ();
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR,
- "NorFlashInitialise: Fail to initialize Nor Flash devices\n"));
- return Status;
- }
-
// Initialize NOR flash instances
Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount);
if (EFI_ERROR (Status)) {
diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
deleted file mode 100644
index b2d1c39e2c61..000000000000
--- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/** @file
-
- Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
-
- SPDX-License-Identifier: BSD-2-Clause-Patent
-
- **/
-
-#include <Base.h>
-#include <Uefi.h>
-#include <Library/BaseLib.h>
-#include <Library/NorFlashPlatformLib.h>
-
-#include <Platform/MemoryMap.h>
-
-#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE
-#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)
-
-#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)
-#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
- FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
-
-STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
- {
- // UEFI code region
- SYNQUACER_SPI_NOR_BASE, // device base
- FW_CODE_REGION_BASE, // region base
- FW_CODE_REGION_SIZE, // region size
- SIZE_64KB, // block size
- },
- {
- // Environment variable region
- SYNQUACER_SPI_NOR_BASE, // device base
- FW_ENV_REGION_BASE, // region base
- FW_ENV_REGION_SIZE, // region size
- SIZE_64KB, // block size
- },
-};
-
-EFI_STATUS
-NorFlashPlatformInitialization (
- VOID
- )
-{
- return EFI_SUCCESS;
-}
-
-EFI_STATUS
-NorFlashPlatformGetDevices (
- OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
- OUT UINT32 *Count
- )
-{
- if (NorFlashDevices == NULL ||
- Count == NULL) {
- return EFI_INVALID_PARAMETER;
- }
-
- *Count = ARRAY_SIZE (mNorFlashDevices);
- *NorFlashDevices = mNorFlashDevices;
-
- return EFI_SUCCESS;
-}
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib
2022-10-19 11:51 [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib Ard Biesheuvel
@ 2022-10-19 13:49 ` Leif Lindholm
2022-10-19 14:54 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Leif Lindholm @ 2022-10-19 13:49 UTC (permalink / raw)
To: Ard Biesheuvel; +Cc: devel
On Wed, Oct 19, 2022 at 13:51:36 +0200, Ard Biesheuvel wrote:
> 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 <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
/
Leif
> ---
> .../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/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf
> delete mode 100644 Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/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
>
> [Packages]
> - ArmPlatformPkg/ArmPlatformPkg.dec
> EmbeddedPkg/EmbeddedPkg.dec
> MdeModulePkg/MdeModulePkg.dec
> MdePkg/MdePkg.dec
> Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec
> + Silicon/Socionext/SynQuacer/SynQuacer.dec
>
> [LibraryClasses]
> BaseLib
> @@ -40,7 +40,6 @@ [LibraryClasses]
> IoLib
> MemoryAllocationLib
> NorFlashInfoLib
> - NorFlashPlatformLib
> UefiBootServicesTableLib
> UefiDriverEntryPoint
> UefiLib
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006StandaloneMm.inf
> 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
> MdePkg/MdePkg.dec
> Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.dec
> + Silicon/Socionext/SynQuacer/SynQuacer.dec
> StandaloneMmPkg/StandaloneMmPkg.dec
>
> [LibraryClasses]
> @@ -40,7 +41,6 @@ [LibraryClasses]
> MemoryAllocationLib
> MmServicesTableLib
> NorFlashInfoLib
> - NorFlashPlatformLib
> StandaloneMmDriverEntryPoint
>
> [Guids]
> diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf
> deleted file mode 100644
> index c1ed3c4d1ca8..000000000000
> --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacerLib.inf
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -#/** @file
> -#
> -# Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -#**/
> -
> -[Defines]
> - INF_VERSION = 0x0001001A
> - BASE_NAME = NorFlashSynQuacerLib
> - FILE_GUID = 8279227C-C555-4D75-B439-D8A959635CDD
> - MODULE_TYPE = BASE
> - VERSION_STRING = 1.0
> - LIBRARY_CLASS = NorFlashPlatformLib
> -
> -[Sources]
> - NorFlashSynQuacer.c
> -
> -[Packages]
> - ArmPlatformPkg/ArmPlatformPkg.dec
> - ArmPkg/ArmPkg.dec
> - MdeModulePkg/MdeModulePkg.dec
> - MdePkg/MdePkg.dec
> - Silicon/Socionext/SynQuacer/SynQuacer.dec
> -
> -[LibraryClasses]
> - BaseLib
> -
> -[FixedPcd]
> - gArmTokenSpaceGuid.PcdFdBaseAddress
> - gArmTokenSpaceGuid.PcdFdSize
> - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
> - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
> - gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.h b/Silicon/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 @@
>
> #include <Library/DebugLib.h>
> #include <Library/IoLib.h>
> -#include <Library/NorFlashPlatformLib.h>
>
> #include "Fip006Reg.h"
>
> @@ -291,6 +290,19 @@ NorFlashReadID (
> OUT UINT8 JedecId[3]
> );
>
> +typedef struct {
> + UINTN DeviceBaseAddress; // Start address of the Device Base Address (DBA)
> + UINTN RegionBaseAddress; // Start address of one single region
> + UINTN Size;
> + UINTN BlockSize;
> +} NOR_FLASH_DESCRIPTION;
> +
> +EFI_STATUS
> +NorFlashPlatformGetDevices (
> + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
> + OUT UINT32 *Count
> + );
> +
> #define SPINOR_SR_WIP BIT0 // Write in progress
> #define SPINOR_FSR_READY BIT7 // Flag Status Register: ready
>
> diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlash.c b/Silicon/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 <Library/UefiBootServicesTableLib.h>
> #include <Library/UefiLib.h>
>
> +#include <Platform/MemoryMap.h>
> +
> #include "NorFlash.h"
>
> +#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE
> +#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)
> +
> +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)
> +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
> + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
> + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
> +
> +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
> + {
> + // UEFI code region
> + SYNQUACER_SPI_NOR_BASE, // device base
> + FW_CODE_REGION_BASE, // region base
> + FW_CODE_REGION_SIZE, // region size
> + SIZE_64KB, // block size
> + },
> + {
> + // Environment variable region
> + SYNQUACER_SPI_NOR_BASE, // device base
> + FW_ENV_REGION_BASE, // region base
> + FW_ENV_REGION_SIZE, // region size
> + SIZE_64KB, // block size
> + },
> +};
> +
> STATIC CONST UINT16 mFip006NullCmdSeq[] = {
> CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE),
> CSDC (CSDC_END, CSDC_CONT_NON_CONTINUOUS, CSDC_TRP_MBM, CSDC_DEC_DECODE),
> @@ -995,3 +1022,20 @@ NorFlashReadID (
> NorFlashSetHostCommand (Instance, SPINOR_OP_READ_4B);
> return EFI_SUCCESS;
> }
> +
> +EFI_STATUS
> +NorFlashPlatformGetDevices (
> + OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
> + OUT UINT32 *Count
> + )
> +{
> + if (NorFlashDevices == NULL ||
> + Count == NULL) {
> + return EFI_INVALID_PARAMETER;
> + }
> +
> + *Count = ARRAY_SIZE (mNorFlashDevices);
> + *NorFlashDevices = mNorFlashDevices;
> +
> + return EFI_SUCCESS;
> +}
> 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);
> ASSERT_EFI_ERROR (Status);
>
> - Status = NorFlashPlatformInitialization ();
> - if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR,
> - "NorFlashInitialise: Fail to initialize Nor Flash devices\n"));
> - return Status;
> - }
> -
> // Initialize NOR flash instances
> Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount);
> if (EFI_ERROR (Status)) {
> 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;
> BOOLEAN ContainVariableStorage;
>
> - Status = NorFlashPlatformInitialization ();
> - if (EFI_ERROR (Status)) {
> - DEBUG ((DEBUG_ERROR,
> - "NorFlashInitialise: Fail to initialize Nor Flash devices\n"));
> - return Status;
> - }
> -
> // Initialize NOR flash instances
> Status = NorFlashPlatformGetDevices (&NorFlashDevices, &mNorFlashDeviceCount);
> if (EFI_ERROR (Status)) {
> diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
> deleted file mode 100644
> index b2d1c39e2c61..000000000000
> --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c
> +++ /dev/null
> @@ -1,64 +0,0 @@
> -/** @file
> -
> - Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
> -
> - SPDX-License-Identifier: BSD-2-Clause-Patent
> -
> - **/
> -
> -#include <Base.h>
> -#include <Uefi.h>
> -#include <Library/BaseLib.h>
> -#include <Library/NorFlashPlatformLib.h>
> -
> -#include <Platform/MemoryMap.h>
> -
> -#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE
> -#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE)
> -
> -#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase)
> -#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \
> - FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \
> - FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize))
> -
> -STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
> - {
> - // UEFI code region
> - SYNQUACER_SPI_NOR_BASE, // device base
> - FW_CODE_REGION_BASE, // region base
> - FW_CODE_REGION_SIZE, // region size
> - SIZE_64KB, // block size
> - },
> - {
> - // Environment variable region
> - SYNQUACER_SPI_NOR_BASE, // device base
> - FW_ENV_REGION_BASE, // region base
> - FW_ENV_REGION_SIZE, // region size
> - SIZE_64KB, // block size
> - },
> -};
> -
> -EFI_STATUS
> -NorFlashPlatformInitialization (
> - VOID
> - )
> -{
> - return EFI_SUCCESS;
> -}
> -
> -EFI_STATUS
> -NorFlashPlatformGetDevices (
> - OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,
> - OUT UINT32 *Count
> - )
> -{
> - if (NorFlashDevices == NULL ||
> - Count == NULL) {
> - return EFI_INVALID_PARAMETER;
> - }
> -
> - *Count = ARRAY_SIZE (mNorFlashDevices);
> - *NorFlashDevices = mNorFlashDevices;
> -
> - return EFI_SUCCESS;
> -}
> --
> 2.35.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib
2022-10-19 13:49 ` Leif Lindholm
@ 2022-10-19 14:54 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2022-10-19 14:54 UTC (permalink / raw)
To: Leif Lindholm; +Cc: devel
On Wed, 19 Oct 2022 at 15:50, Leif Lindholm <quic_llindhol@quicinc.com> wrote:
>
> On Wed, Oct 19, 2022 at 13:51:36 +0200, Ard Biesheuvel wrote:
> > 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 <ardb@kernel.org>
>
> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
>
Thanks
Pushed as cf45696d243a..85280b124e5a
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-19 14:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-19 11:51 [PATCH edk2-platforms] Silicon/SynQuacer: Drop dependency on NorFlashPlatformLib Ard Biesheuvel
2022-10-19 13:49 ` Leif Lindholm
2022-10-19 14:54 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox