]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/NorFlashDxe: accept both non-secure and secure varstore GUIDs
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 21 Jun 2016 09:57:48 +0000 (11:57 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 22 Jun 2016 14:52:40 +0000 (16:52 +0200)
Now that the generic Variable Runtime DXE code no longer distinguishes
between gEfiVariableGuid and gEfiAuthenticatedVariableGuid in the varstore
FV header, we can relax the check in the NOR flash driver to accept either
GUID regardless of whether we are running a secure boot capable build or not.

This also means we can always use gEfiAuthenticatedVariableGuid when we
encounter an empty NOR flash that needs to be initialized before use. So
remove the mNorFlashVariableGuid global from the shared code and from both
versions of NorFlashDxe.inf. This essentially collapses the two drivers into
a single one, which means we can remove NorFlashAuthenticatedDxe entirely
in a subsequent patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedDxe.inf
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c [deleted file]
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c [deleted file]

index 6c5e6aef0ddf1930a98ac2563541e29b90dd49d3..0e25b8f6ed6dbb20c7d567bf4da4748ebdcc3250 100644 (file)
@@ -28,7 +28,6 @@
   NorFlashDxe.c\r
   NorFlashFvbDxe.c\r
   NorFlashBlockIoDxe.c\r
-  NorFlashAuthenticatedVariableDep.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
@@ -50,6 +49,7 @@
 \r
 [Guids]\r
   gEfiSystemNvDataFvGuid\r
+  gEfiVariableGuid\r
   gEfiAuthenticatedVariableGuid\r
   gEfiEventVirtualAddressChangeGuid\r
 \r
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashAuthenticatedVariableDep.c
deleted file mode 100644 (file)
index 2ea8ead..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/** @file  NorFlashAuthenticatedVariableDep.c\r
-\r
-  Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
-\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Base.h>\r
-\r
-#include <Include/Guid/AuthenticatedVariableFormat.h>\r
-\r
-CONST EFI_GUID* CONST mNorFlashVariableGuid = &gEfiAuthenticatedVariableGuid;\r
index d0b5c5b12f9e4ef5cc490af855db4a22fd3e6c21..c24680098f629541fe823a7356c778e7819f7907 100644 (file)
@@ -152,8 +152,6 @@ struct _NOR_FLASH_INSTANCE {
   NOR_FLASH_DEVICE_PATH               DevicePath;\r
 };\r
 \r
-extern CONST EFI_GUID* CONST          mNorFlashVariableGuid;\r
-\r
 EFI_STATUS\r
 NorFlashReadCfiData (\r
   IN  UINTN                   DeviceBaseAddress,\r
index 563d7573e7a25db20067a752a449fc5d7dbbe6cf..812dafd065b2c65514ca2f825dbb04116f314612 100644 (file)
@@ -26,7 +26,6 @@
   NorFlashDxe.c\r
   NorFlashFvbDxe.c\r
   NorFlashBlockIoDxe.c\r
-  NorFlashVariableDep.c\r
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
@@ -48,6 +47,7 @@
 [Guids]\r
   gEfiSystemNvDataFvGuid\r
   gEfiVariableGuid\r
+  gEfiAuthenticatedVariableGuid\r
   gEfiEventVirtualAddressChangeGuid\r
 \r
 [Protocols]\r
index e0edc62c95ebcfb69413876f8f8311f6530643ee..42be5c2a2dade7fd4de677e37b4cd44b6ecde4ef 100644 (file)
@@ -111,7 +111,7 @@ InitializeFvAndVariableStoreHeaders (
   // VARIABLE_STORE_HEADER\r
   //\r
   VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)Headers + FirmwareVolumeHeader->HeaderLength);\r
-  CopyGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid);\r
+  CopyGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid);\r
   VariableStoreHeader->Size = PcdGet32(PcdFlashNvStorageVariableSize) - FirmwareVolumeHeader->HeaderLength;\r
   VariableStoreHeader->Format            = VARIABLE_STORE_FORMATTED;\r
   VariableStoreHeader->State             = VARIABLE_STORE_HEALTHY;\r
@@ -181,7 +181,8 @@ ValidateFvHeader (
   VariableStoreHeader = (VARIABLE_STORE_HEADER*)((UINTN)FwVolHeader + FwVolHeader->HeaderLength);\r
 \r
   // Check the Variable Store Guid\r
-  if (!CompareGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid)) {\r
+  if (!CompareGuid (&VariableStoreHeader->Signature, &gEfiVariableGuid) &&\r
+      !CompareGuid (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid)) {\r
     DEBUG ((EFI_D_INFO, "%a: Variable Store Guid non-compatible\n",\r
       __FUNCTION__));\r
     return EFI_NOT_FOUND;\r
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashVariableDep.c
deleted file mode 100644 (file)
index 4d52296..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/** @file  NorFlashVariableDep.c\r
-\r
-  Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\r
-\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include <Base.h>\r
-\r
-#include <Include/Guid/VariableFormat.h>\r
-\r
-CONST EFI_GUID* CONST mNorFlashVariableGuid = &gEfiVariableGuid;\r