]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c
Add error debug information for capsule processing in Bds.
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / Capsules.c
index 47082f57d300c290bada398f9c397121ee691721..07c12195fcf09c5f079eb5a64bf12d1c31dfb48a 100644 (file)
@@ -1,8 +1,8 @@
 /** @file\r
   BDS routines to handle capsules.\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\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
@@ -34,6 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 EFI_STATUS\r
+EFIAPI\r
 BdsProcessCapsules (\r
   EFI_BOOT_MODE BootMode\r
   )\r
@@ -51,7 +52,6 @@ BdsProcessCapsules (
   VOID                        **CapsulePtr;\r
   VOID                        **CapsulePtrCache;\r
   EFI_GUID                    *CapsuleGuidCache; \r
-  CAPSULE_HOB_INFO            *CapsuleHobInfo;\r
 \r
   CapsuleNumber = 0;\r
   CapsuleTotalNumber = 0;\r
@@ -65,6 +65,7 @@ BdsProcessCapsules (
   // We don't do anything else if the boot mode is not flash-update\r
   //\r
   if (BootMode != BOOT_ON_FLASH_UPDATE) {\r
+    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update.\n"));\r
     return EFI_INVALID_PARAMETER;\r
   }\r
   \r
@@ -73,9 +74,8 @@ BdsProcessCapsules (
   // Find all capsule images from hob\r
   //\r
   HobPointer.Raw = GetHobList ();\r
-  while ((HobPointer.Raw = GetNextGuidHob (&gEfiCapsuleVendorGuid, HobPointer.Raw)) != NULL) {\r
+  while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) {\r
     CapsuleTotalNumber ++;\r
-\r
     HobPointer.Raw = GET_NEXT_HOB (HobPointer);\r
   }\r
   \r
@@ -83,6 +83,10 @@ BdsProcessCapsules (
     //\r
     // We didn't find a hob, so had no errors.\r
     //\r
+    DEBUG ((EFI_D_ERROR, "We can not find capsule data in capsule update boot mode.\n"));\r
+    DEBUG ((EFI_D_ERROR, "Please check the followings are correct if unexpected capsule update error happens.\n"));\r
+    DEBUG ((EFI_D_ERROR, "1. CapsuleX64 is built as X64 module when PEI is IA32 and DXE is X64\n"));\r
+    DEBUG ((EFI_D_ERROR, "2. Capsule data should persist in memory across a system reset.\n"));\r
     PlatformBdsLockNonUpdatableFlash ();\r
     return EFI_SUCCESS;\r
   }\r
@@ -101,10 +105,8 @@ BdsProcessCapsules (
   // Find all capsule images from hob\r
   //\r
   HobPointer.Raw = GetHobList ();\r
-  while ((HobPointer.Raw = GetNextGuidHob (&gEfiCapsuleVendorGuid, HobPointer.Raw)) != NULL) {\r
-    CapsuleHobInfo = GET_GUID_HOB_DATA (HobPointer.Guid);\r
-    CapsulePtr [CapsuleNumber++] = (VOID *)(UINTN)(CapsuleHobInfo->BaseAddress);\r
-\r
+  while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, HobPointer.Raw)) != NULL) {\r
+    CapsulePtr [CapsuleNumber++] = (VOID *) (UINTN) HobPointer.Capsule->BaseAddress;\r
     HobPointer.Raw = GET_NEXT_HOB (HobPointer);\r
   }\r
 \r
@@ -206,3 +208,4 @@ BdsProcessCapsules (
 \r
   return Status;\r
 }\r
+\r