[edk2,edk2-platforms,14/14] Platform/Synquacer: incorporate NOR flash and variable drivers

Message ID 20170908182315.9591-15-ard.biesheuvel@linaro.org
State New
Headers show
Series
  • add support for Socionext Synquacer EVB
Related show

Commit Message

Ard Biesheuvel Sept. 8, 2017, 6:23 p.m.
Wire up the non-volatile EFI variable store support, by switching from
the emulation driver to the real one, and enabling the prerequisite
FTW and NOR flash drivers.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

---
 Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc                                | 32 ++++++++++++++++++--
 Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf                                |  9 ++++--
 Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c   | 10 ++++++
 Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf |  2 ++
 4 files changed, 49 insertions(+), 4 deletions(-)

-- 
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, 7:13 p.m. | #1
On Fri, Sep 08, 2017 at 07:23:15PM +0100, Ard Biesheuvel wrote:
> Wire up the non-volatile EFI variable store support, by switching from

> the emulation driver to the real one, and enabling the prerequisite

> FTW and NOR flash drivers.

> 

> Contributed-under: TianoCore Contribution Agreement 1.1

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>


Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>


> ---

>  Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc                                | 32 ++++++++++++++++++--

>  Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf                                |  9 ++++--

>  Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c   | 10 ++++++

>  Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf |  2 ++

>  4 files changed, 49 insertions(+), 4 deletions(-)

> 

> diff --git a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc

> index 92c1d3eb8283..11b2e63453cd 100644

> --- a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc

> +++ b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc

> @@ -319,6 +319,19 @@

>    #

>    gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE

>  

> +  #

> +  # Variable store

> +  #

> +  gFip006DxeTokenSpaceGuid.PcdFip006DxeRegBaseAddress|0x54800000

> +  gFip006DxeTokenSpaceGuid.PcdFip006DxeMemBaseAddress|0x08000000

> +

> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x08400000

> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000

> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x08410000

> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000

> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x08420000

> +  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000

> +

>  [PcdsDynamicHii]

>    gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5

>  

> @@ -360,7 +373,6 @@

>    MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf

>    MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf

>    ArmPkg/Drivers/TimerDxe/TimerDxe.inf

> -  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf

>    ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf

>    MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf

>  

> @@ -378,6 +390,22 @@

>    }

>  

>    #

> +  # Variable services

> +  #

> +  Silicon/Socionext/Synquacer/Drivers/Fip006Dxe/Fip006Dxe.inf {

> +    <LibraryClasses>

> +      NorFlashPlatformLib|Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf

> +  }

> +  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf

> +  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {

> +    <LibraryClasses>

> +      AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf

> +      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf

> +      TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf

> +      VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf

> +  }

> +

> +  #

>    # UEFI application (Shell Embedded Boot Loader)

>    #

>    ShellPkg/Application/Shell/Shell.inf {

> @@ -481,7 +509,7 @@

>    #

>    MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf {

>      <LibraryClasses>

> -      #NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf

> +      NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf

>  

>      <PcdsFixedAtBuild>

>        # support ACPI v5.0 or later

> diff --git a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf

> index de97d3e56ded..86685a22208b 100644

> --- a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf

> +++ b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf

> @@ -1,4 +1,3 @@

> -

>  #

>  #  Copyright (c) 2013-2014, ARM Limited. All rights reserved.

>  #  Copyright (c) 2017, Linaro Limited. All rights reserved.

> @@ -102,7 +101,6 @@ READ_LOCK_STATUS   = TRUE

>    INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf

>    INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf

>    INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf

> -  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf

>    INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf

>    INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf

>  

> @@ -116,6 +114,13 @@ READ_LOCK_STATUS   = TRUE

>    INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf

>  

>    #

> +  # Variable services

> +  #

> +  INF Silicon/Socionext/Synquacer/Drivers/Fip006Dxe/Fip006Dxe.inf

> +  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf

> +  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf

> +

> +  #

>    # UEFI applications

>    #

>    INF ShellPkg/Application/Shell/Shell.inf

> diff --git a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c

> index 1d25d63f1b6c..1af30a2bbe60 100644

> --- a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c

> +++ b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c

> @@ -87,6 +87,16 @@ STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[] = {

>    ARM_DEVICE_REGION (SYNQUACER_PCI_SEG1_PORTIO_MEMBASE,

>                       SYNQUACER_PCI_SEG1_PORTIO_MEMSIZE),

>  

> +  // variable store

> +  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFip006DxeRegBaseAddress),

> +                     EFI_PAGE_SIZE),

> +  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFlashNvStorageVariableBase),

> +                     FixedPcdGet32 (PcdFlashNvStorageVariableSize)),

> +  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFlashNvStorageFtwWorkingBase),

> +                     FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize)),

> +  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFlashNvStorageFtwSpareBase),

> +                     FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)),

> +

>    { }

>  };

>  

> diff --git a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf

> index 5f45c30a5e92..044c19ff9600 100644

> --- a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf

> +++ b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf

> @@ -30,6 +30,7 @@

>    MdePkg/MdePkg.dec

>    MdeModulePkg/MdeModulePkg.dec

>    Silicon/Socionext/Synquacer/Synquacer.dec

> +  Silicon/Socionext/Synquacer/Drivers/Fip006Dxe/Fip006Dxe.dec

>  

>  [LibraryClasses]

>    ArmLib

> @@ -48,3 +49,4 @@

>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize

>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase

>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize

> +  gFip006DxeTokenSpaceGuid.PcdFip006DxeRegBaseAddress

> -- 

> 2.11.0

> 

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

Patch

diff --git a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc
index 92c1d3eb8283..11b2e63453cd 100644
--- a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc
+++ b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.dsc
@@ -319,6 +319,19 @@ 
   #
   gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
 
+  #
+  # Variable store
+  #
+  gFip006DxeTokenSpaceGuid.PcdFip006DxeRegBaseAddress|0x54800000
+  gFip006DxeTokenSpaceGuid.PcdFip006DxeMemBaseAddress|0x08000000
+
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase|0x08400000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize|0x00010000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase|0x08410000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize|0x00010000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase|0x08420000
+  gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize|0x00010000
+
 [PcdsDynamicHii]
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
 
@@ -360,7 +373,6 @@ 
   MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
   MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   ArmPkg/Drivers/TimerDxe/TimerDxe.inf
-  MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
   ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
   MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
 
@@ -378,6 +390,22 @@ 
   }
 
   #
+  # Variable services
+  #
+  Silicon/Socionext/Synquacer/Drivers/Fip006Dxe/Fip006Dxe.inf {
+    <LibraryClasses>
+      NorFlashPlatformLib|Silicon/Socionext/Synquacer/Library/NorFlashSynquacerLib/NorFlashSynquacerLib.inf
+  }
+  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
+    <LibraryClasses>
+      AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
+      NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
+      TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
+      VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+  }
+
+  #
   # UEFI application (Shell Embedded Boot Loader)
   #
   ShellPkg/Application/Shell/Shell.inf {
@@ -481,7 +509,7 @@ 
   #
   MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf {
     <LibraryClasses>
-      #NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
+      NULL|EmbeddedPkg/Library/PlatformHasAcpiLib/PlatformHasAcpiLib.inf
 
     <PcdsFixedAtBuild>
       # support ACPI v5.0 or later
diff --git a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf
index de97d3e56ded..86685a22208b 100644
--- a/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf
+++ b/Platform/Socionext/SynquacerEvalBoard/SynquacerEvalBoard.fdf
@@ -1,4 +1,3 @@ 
-
 #
 #  Copyright (c) 2013-2014, ARM Limited. All rights reserved.
 #  Copyright (c) 2017, Linaro Limited. All rights reserved.
@@ -102,7 +101,6 @@  READ_LOCK_STATUS   = TRUE
   INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
   INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
   INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf
-  INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf
   INF ArmPkg/Drivers/GenericWatchdogDxe/GenericWatchdogDxe.inf
   INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
 
@@ -116,6 +114,13 @@  READ_LOCK_STATUS   = TRUE
   INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf
 
   #
+  # Variable services
+  #
+  INF Silicon/Socionext/Synquacer/Drivers/Fip006Dxe/Fip006Dxe.inf
+  INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+  INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+
+  #
   # UEFI applications
   #
   INF ShellPkg/Application/Shell/Shell.inf
diff --git a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c
index 1d25d63f1b6c..1af30a2bbe60 100644
--- a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c
+++ b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.c
@@ -87,6 +87,16 @@  STATIC ARM_MEMORY_REGION_DESCRIPTOR mVirtualMemoryTable[] = {
   ARM_DEVICE_REGION (SYNQUACER_PCI_SEG1_PORTIO_MEMBASE,
                      SYNQUACER_PCI_SEG1_PORTIO_MEMSIZE),
 
+  // variable store
+  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFip006DxeRegBaseAddress),
+                     EFI_PAGE_SIZE),
+  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFlashNvStorageVariableBase),
+                     FixedPcdGet32 (PcdFlashNvStorageVariableSize)),
+  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFlashNvStorageFtwWorkingBase),
+                     FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize)),
+  ARM_DEVICE_REGION (FixedPcdGet32 (PcdFlashNvStorageFtwSpareBase),
+                     FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)),
+
   { }
 };
 
diff --git a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf
index 5f45c30a5e92..044c19ff9600 100644
--- a/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf
+++ b/Silicon/Socionext/Synquacer/Library/SynquacerMemoryInitPeiLib/SynquacerMemoryInitPeiLib.inf
@@ -30,6 +30,7 @@ 
   MdePkg/MdePkg.dec
   MdeModulePkg/MdeModulePkg.dec
   Silicon/Socionext/Synquacer/Synquacer.dec
+  Silicon/Socionext/Synquacer/Drivers/Fip006Dxe/Fip006Dxe.dec
 
 [LibraryClasses]
   ArmLib
@@ -48,3 +49,4 @@ 
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
+  gFip006DxeTokenSpaceGuid.PcdFip006DxeRegBaseAddress