public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: edk2-devel@lists.01.org
Cc: leif.lindholm@linaro.org, Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH edk2-platforms 5/5] Silicon/SynQuacer: drop BEFORE depex for varstore formatting
Date: Fri, 27 Apr 2018 13:37:48 +0200	[thread overview]
Message-ID: <20180427113748.21663-6-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180427113748.21663-1-ard.biesheuvel@linaro.org>

Laszlo kindly implemented support for correctly sequencing the load
order of the various DXE drivers involved in persistent variable
support so that we can ensure that an empty or corrupted varstore
in NOR flash is reinitialized before the variable runtime driver
attempts to access it. So incorporate this into the SynQuacar
platforms.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/Socionext/DeveloperBox/DeveloperBox.dsc               |  1 +
 Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc   |  1 +
 Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf    |  6 ++----
 Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashFvbDxe.c | 15 +++++++++++++++
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
index cacb3d9e4852..75816ad94ff3 100644
--- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
+++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
@@ -521,6 +521,7 @@ [Components.common]
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
     <LibraryClasses>
+      NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf
       AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
       NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
       TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
diff --git a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
index 2d68aed76ca2..aa34fb075d77 100644
--- a/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
+++ b/Platform/Socionext/SynQuacerEvalBoard/SynQuacerEvalBoard.dsc
@@ -493,6 +493,7 @@ [Components.common]
   MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
   MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf {
     <LibraryClasses>
+      NULL|EmbeddedPkg/Library/NvVarStoreFormattedLib/NvVarStoreFormattedLib.inf
       AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLibNull.inf
       NULL|MdeModulePkg/Library/VarCheckUefiLib/VarCheckUefiLib.inf
       TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf
index 62f81cfe33cd..bddb052c2dcc 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf
+++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/Fip006Dxe.inf
@@ -53,6 +53,7 @@ [LibraryClasses]
   UefiRuntimeServicesTableLib
 
 [Guids]
+  gEdkiiNvVarStoreFormattedGuid
   gEfiAuthenticatedVariableGuid
   gEfiEventVirtualAddressChangeGuid
   gEfiSystemNvDataFvGuid
@@ -75,7 +76,4 @@ [FixedPcd]
   gFip006DxeTokenSpaceGuid.PcdFip006DxeMemBaseAddress
 
 [Depex]
-  #
-  # NorFlashDxe must be loaded before VariableRuntimeDxe in case empty flash needs populating with default values
-  #
-  BEFORE gVariableRuntimeDxeFileGuid
+  gEfiCpuArchProtocolGuid
diff --git a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashFvbDxe.c b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashFvbDxe.c
index acc9490b9a5f..ca3b1b5c34f8 100644
--- a/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashFvbDxe.c
+++ b/Silicon/Socionext/SynQuacer/Drivers/Fip006Dxe/NorFlashFvbDxe.c
@@ -813,6 +813,21 @@ NorFlashFvbInitialize (
     }
   }
 
+  //
+  // The driver implementing the variable read service can now be dispatched;
+  // the varstore headers are in place.
+  //
+  Status = gBS->InstallProtocolInterface (&gImageHandle,
+                  &gEdkiiNvVarStoreFormattedGuid,
+                  EFI_NATIVE_INTERFACE,
+                  NULL);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR,
+      "%a: Failed to install gEdkiiNvVarStoreFormattedGuid\n",
+      __FUNCTION__));
+      return Status;
+  }
+
   //
   // Declare the Non-Volatile storage as EFI_MEMORY_RUNTIME
   //
-- 
2.17.0



  parent reply	other threads:[~2018-04-27 11:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 11:37 [PATCH edk2-platforms 0/5] assorted SynQuacer updates Ard Biesheuvel
2018-04-27 11:37 ` [PATCH edk2-platforms 1/5] Silicon/SynQuacer/NetsecDxe: Add polling function to reinitialize GMAC Ard Biesheuvel
2018-04-27 11:37 ` [PATCH edk2-platforms 2/5] Platform/Socionext/DeveloperBox: add SNP driver Ard Biesheuvel
2018-05-22 15:04   ` Leif Lindholm
2018-04-27 11:37 ` [PATCH edk2-platforms 3/5] Platform/SynQuacer: add 'acpiview' shell command to build Ard Biesheuvel
2018-04-27 11:37 ` [PATCH edk2-platforms 4/5] Silicon/SynQuacer/PlatformDxe: depex on gEfiVariableArchProtocolGuid Ard Biesheuvel
2018-04-27 11:37 ` Ard Biesheuvel [this message]
2018-05-22 15:41 ` [PATCH edk2-platforms 0/5] assorted SynQuacer updates Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180427113748.21663-6-ard.biesheuvel@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox