[edk2] [PATCH edk2-platforms 12/14] Silicon/Synquacer: add NorFlashPlatformLib implementation

Ard Biesheuvel posted 14 patches 7 years, 3 months ago
[edk2] [PATCH edk2-platforms 12/14] Silicon/Synquacer: add NorFlashPlatformLib implementation
Posted by Ard Biesheuvel 7 years, 3 months ago
Add the platform glue for the NOR flash driver.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c      | 60 ++++++++++++++++++++
 Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf | 38 +++++++++++++
 2 files changed, 98 insertions(+)

diff --git a/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c
new file mode 100644
index 000000000000..0d9a81b61b73
--- /dev/null
+++ b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c
@@ -0,0 +1,60 @@
+/** @file
+
+ Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution.  The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ **/
+
+#include <Base.h>
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/NorFlashPlatformLib.h>
+
+#include <Platform/MemoryMap.h>
+
+STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
+  {
+    // Environment variable region
+    SYNQUACER_SPI_NOR_BASE,                             // device base
+    FixedPcdGet32 (PcdFlashNvStorageVariableBase),      // region base
+    FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
+    FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
+    FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize),      // region size
+    SIZE_64KB,                                          // block size
+    {
+      0x3105BD7A, 0x82C3, 0x486F, { 0xB1, 0x03, 0x1E, 0x09, 0x54, 0xEC, 0x85, 0x75 }
+    }
+  },
+};
+
+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;
+}
diff --git a/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf
new file mode 100644
index 000000000000..bd84be0aebf8
--- /dev/null
+++ b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf
@@ -0,0 +1,38 @@
+#/** @file
+#
+#  Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution.  The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#**/
+
+[Defines]
+  INF_VERSION                    = 0x00010005
+  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
+  MdeModulePkg/MdeModulePkg.dec
+  MdePkg/MdePkg.dec
+  Silicon/Socionext/Synquacer/Synquacer.dec
+
+[LibraryClasses]
+  BaseLib
+
+[FixedPcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH edk2-platforms 12/14] Silicon/Synquacer: add NorFlashPlatformLib implementation
Posted by Leif Lindholm 7 years, 3 months ago
On Fri, Sep 08, 2017 at 07:23:13PM +0100, Ard Biesheuvel wrote:
> Add the platform glue for the NOR flash driver.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c      | 60 ++++++++++++++++++++
>  Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf | 38 +++++++++++++
>  2 files changed, 98 insertions(+)
> 
> diff --git a/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c
> new file mode 100644
> index 000000000000..0d9a81b61b73
> --- /dev/null
> +++ b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacer.c
> @@ -0,0 +1,60 @@
> +/** @file
> +
> + Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>
> +
> + This program and the accompanying materials
> + are licensed and made available under the terms and conditions of the BSD License
> + which accompanies this distribution.  The full text of the license may be found at
> + http://opensource.org/licenses/bsd-license.php
> +
> + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +
> + **/
> +
> +#include <Base.h>
> +#include <Uefi.h>
> +#include <Library/BaseLib.h>
> +#include <Library/NorFlashPlatformLib.h>
> +
> +#include <Platform/MemoryMap.h>
> +
> +STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {
> +  {
> +    // Environment variable region
> +    SYNQUACER_SPI_NOR_BASE,                             // device base
> +    FixedPcdGet32 (PcdFlashNvStorageVariableBase),      // region base
> +    FixedPcdGet32 (PcdFlashNvStorageVariableSize) +
> +    FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) +
> +    FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize),      // region size
> +    SIZE_64KB,                                          // block size
> +    {
> +      0x3105BD7A, 0x82C3, 0x486F, { 0xB1, 0x03, 0x1E, 0x09, 0x54, 0xEC, 0x85, 0x75 }
> +    }
> +  },
> +};
> +
> +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;
> +}
> diff --git a/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf
> new file mode 100644
> index 000000000000..bd84be0aebf8
> --- /dev/null
> +++ b/Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf
> @@ -0,0 +1,38 @@
> +#/** @file
> +#
> +#  Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>
> +#  This program and the accompanying materials
> +#  are licensed and made available under the terms and conditions of the BSD License
> +#  which accompanies this distribution.  The full text of the license may be found at
> +#  http://opensource.org/licenses/bsd-license.php
> +#
> +#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> +#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
> +#
> +#**/
> +
> +[Defines]
> +  INF_VERSION                    = 0x00010005

If you bump this:
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> +  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
> +  MdeModulePkg/MdeModulePkg.dec
> +  MdePkg/MdePkg.dec
> +  Silicon/Socionext/Synquacer/Synquacer.dec
> +
> +[LibraryClasses]
> +  BaseLib
> +
> +[FixedPcd]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
> -- 
> 2.11.0
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel