]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: NorFlashDxe: mellow DEBUG messages about flash reinit
authorLaszlo Ersek <lersek@redhat.com>
Fri, 16 Oct 2015 15:46:28 +0000 (15:46 +0000)
committerlersek <lersek@Edk2>
Fri, 16 Oct 2015 15:46:28 +0000 (15:46 +0000)
The ValidateFvHeader() function checks several conditions against the
firmware volume header. Failure of the first of these checks, reported as
"No Firmware Volume header present", is a common situation for unformatted
flash images, especially when a new virtual machine is created.

Similarly, "Variable Store Guid non-compatible" is common when the
firmware binary is switched from Secure Boot-incapable to Secure
Boot-capable, or vice versa.

The only caller of ValidateFvHeader(), NorFlashFvbInitialize(), handles
all these mismatches by installing a new FVB header. It also emits
another, loud ERROR message (which is even less justified when it is
triggered by (BootMode == BOOT_WITH_DEFAULT_SETTINGS)).

Downgrade these messages from EFI_D_ERROR to EFI_D_INFO, so that they
don't clutter the debug output when the PcdDebugPrintErrorLevel mask only
enables EFI_D_ERROR (i.e., in a "silent" build).

These messages have annoyed / confused users; see for example:
- https://bugzilla.redhat.com/show_bug.cgi?id=1270279
- http://thread.gmane.org/gmane.comp.bios.edk2.devel/2772/focus=2869

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Drew Jones <drjones@redhat.com>
Cc: Yehuda Yitschak <yehuday@marvell.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18618 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c

index 3ed3bb945ff681da40b7a5a1fdfd735e9fa0db98..e0edc62c95ebcfb69413876f8f8311f6530643ee 100644 (file)
@@ -158,20 +158,23 @@ ValidateFvHeader (
       || (FwVolHeader->FvLength  != FvLength)\r
       )\r
   {\r
-    DEBUG ((EFI_D_ERROR, "ValidateFvHeader: No Firmware Volume header present\n"));\r
+    DEBUG ((EFI_D_INFO, "%a: No Firmware Volume header present\n",\r
+      __FUNCTION__));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
   // Check the Firmware Volume Guid\r
   if( CompareGuid (&FwVolHeader->FileSystemGuid, &gEfiSystemNvDataFvGuid) == FALSE ) {\r
-    DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Firmware Volume Guid non-compatible\n"));\r
+    DEBUG ((EFI_D_INFO, "%a: Firmware Volume Guid non-compatible\n",\r
+      __FUNCTION__));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
   // Verify the header checksum\r
   Checksum = CalculateSum16((UINT16*)FwVolHeader, FwVolHeader->HeaderLength);\r
   if (Checksum != 0) {\r
-    DEBUG ((EFI_D_ERROR, "ValidateFvHeader: FV checksum is invalid (Checksum:0x%X)\n",Checksum));\r
+    DEBUG ((EFI_D_INFO, "%a: FV checksum is invalid (Checksum:0x%X)\n",\r
+      __FUNCTION__, Checksum));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
@@ -179,13 +182,15 @@ ValidateFvHeader (
 \r
   // Check the Variable Store Guid\r
   if (!CompareGuid (&VariableStoreHeader->Signature, mNorFlashVariableGuid)) {\r
-    DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Variable Store Guid non-compatible\n"));\r
+    DEBUG ((EFI_D_INFO, "%a: Variable Store Guid non-compatible\n",\r
+      __FUNCTION__));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
   VariableStoreLength = PcdGet32 (PcdFlashNvStorageVariableSize) - FwVolHeader->HeaderLength;\r
   if (VariableStoreHeader->Size != VariableStoreLength) {\r
-    DEBUG ((EFI_D_ERROR, "ValidateFvHeader: Variable Store Length does not match\n"));\r
+    DEBUG ((EFI_D_INFO, "%a: Variable Store Length does not match\n",\r
+      __FUNCTION__));\r
     return EFI_NOT_FOUND;\r
   }\r
 \r
@@ -731,7 +736,9 @@ NorFlashFvbInitialize (
   // Install the Default FVB header if required\r
   if (EFI_ERROR(Status)) {\r
     // There is no valid header, so time to install one.\r
-    DEBUG((EFI_D_ERROR,"NorFlashFvbInitialize: ERROR - The FVB Header is not valid. Installing a correct one for this volume.\n"));\r
+    DEBUG ((EFI_D_INFO, "%a: The FVB Header is not valid.\n", __FUNCTION__));\r
+    DEBUG ((EFI_D_INFO, "%a: Installing a correct one for this volume.\n",\r
+      __FUNCTION__));\r
 \r
     // Erase all the NorFlash that is reserved for variable storage\r
     FvbNumLba = (PcdGet32(PcdFlashNvStorageVariableSize) + PcdGet32(PcdFlashNvStorageFtwWorkingSize) + PcdGet32(PcdFlashNvStorageFtwSpareSize)) / Instance->Media.BlockSize;\r