diff mbox series

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

Message ID 20170908182315.9591-13-ard.biesheuvel@linaro.org
State New
Headers show
Series add support for Socionext Synquacer EVB | expand

Commit Message

Ard Biesheuvel Sept. 8, 2017, 6:23 p.m. UTC
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(+)

-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Leif Lindholm Sept. 11, 2017, 4:38 p.m. UTC | #1
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
diff mbox series

Patch

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