ArmPlatformPkg/NorFlashDxe: cue the variable driver with NvVarStoreFormatted
authorLaszlo Ersek <lersek@redhat.com>
Wed, 11 Apr 2018 20:50:18 +0000 (22:50 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 12 Apr 2018 19:24:34 +0000 (21:24 +0200)
The BEFORE depex opcode that we currently use to force ourselves in front
of the variable driver cannot be combined with other depex opcodes.
Replace the depex with TRUE, and signal NvVarStoreFormattedLib through the
installation of "gEdkiiNvVarStoreFormattedGuid".

Platforms that rely on NorFlashDxe to format the variable store (as
opposed to formatting a variable store template through an FDF file, as
part of the build) should hook NvVarStoreFormattedLib into the variable
drivers they use, so that the latter await our cue.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Steve Capper <steve.capper@linaro.org>
Cc: Supreeth Venkatesh <Supreeth.Venkatesh@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Steve Capper <steve.capper@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/ArmPlatformPkg.dec
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c

index 7cec775abeee219e6821488a2c5abe88d23bbed1..8f32a5e2c14dece225748bd16909521d40304b02 100644 (file)
 \r
 [Guids.common]\r
   gArmPlatformTokenSpaceGuid   = { 0x9c0aaed4, 0x74c5, 0x4043, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xce, 0x76 } }\r
 \r
 [Guids.common]\r
   gArmPlatformTokenSpaceGuid   = { 0x9c0aaed4, 0x74c5, 0x4043, { 0xb4, 0x17, 0xa3, 0x22, 0x38, 0x14, 0xce, 0x76 } }\r
-  #\r
-  # Following Guid must match FILE_GUID in MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf\r
-  #\r
-  gVariableRuntimeDxeFileGuid = { 0xcbd2e4d5, 0x7068, 0x4ff5, { 0xb4, 0x62, 0x98, 0x22, 0xb4, 0xad, 0x8d, 0x60 } }\r
 \r
 [PcdsFeatureFlag.common]\r
   gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|FALSE|BOOLEAN|0x00000004\r
 \r
 [PcdsFeatureFlag.common]\r
   gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores|FALSE|BOOLEAN|0x00000004\r
index 812dafd065b2c65514ca2f825dbb04116f314612..c40ac27a65999bee0e1087b94b0f881cba45ca9c 100644 (file)
@@ -31,6 +31,7 @@
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
   ArmPlatformPkg/ArmPlatformPkg.dec\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
   ArmPlatformPkg/ArmPlatformPkg.dec\r
+  EmbeddedPkg/EmbeddedPkg.dec\r
 \r
 [LibraryClasses]\r
   IoLib\r
 \r
 [LibraryClasses]\r
   IoLib\r
@@ -49,6 +50,7 @@
   gEfiVariableGuid\r
   gEfiAuthenticatedVariableGuid\r
   gEfiEventVirtualAddressChangeGuid\r
   gEfiVariableGuid\r
   gEfiAuthenticatedVariableGuid\r
   gEfiEventVirtualAddressChangeGuid\r
+  gEdkiiNvVarStoreFormattedGuid     ## PRODUCES ## PROTOCOL\r
 \r
 [Protocols]\r
   gEfiBlockIoProtocolGuid\r
 \r
 [Protocols]\r
   gEfiBlockIoProtocolGuid\r
@@ -67,7 +69,4 @@
   gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked\r
 \r
 [Depex]\r
   gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked\r
 \r
 [Depex]\r
-  #\r
-  # NorFlashDxe must be loaded before VariableRuntimeDxe in case empty flash needs populating with default values\r
-  #\r
-  BEFORE gVariableRuntimeDxeFileGuid\r
+  TRUE\r
index c3e6489f398f896811d16999cb3a09292425329f..e62ffbb433d08784b377b112b7b4a35bab887e06 100644 (file)
@@ -25,6 +25,7 @@
 \r
 #include <Guid/VariableFormat.h>\r
 #include <Guid/SystemNvDataGuid.h>\r
 \r
 #include <Guid/VariableFormat.h>\r
 #include <Guid/SystemNvDataGuid.h>\r
+#include <Guid/NvVarStoreFormatted.h>\r
 \r
 #include "NorFlashDxe.h"\r
 \r
 \r
 #include "NorFlashDxe.h"\r
 \r
@@ -776,6 +777,18 @@ NorFlashFvbInitialize (
     }\r
   }\r
 \r
     }\r
   }\r
 \r
+  //\r
+  // The driver implementing the variable read service can now be dispatched;\r
+  // the varstore headers are in place.\r
+  //\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &gImageHandle,\r
+                  &gEdkiiNvVarStoreFormattedGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   //\r
   // Register for the virtual address change event\r
   //\r
   //\r
   // Register for the virtual address change event\r
   //\r