public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
@ 2019-04-02  5:50 Zhichao Gao
  2019-04-02 15:35 ` Philippe Mathieu-Daudé
  2019-04-11  7:20 ` Gao, Zhichao
  0 siblings, 2 replies; 10+ messages in thread
From: Zhichao Gao @ 2019-04-02  5:50 UTC (permalink / raw)
  To: edk2-devel
  Cc: Bret Barkelew, Jian J Wang, Ray Ni, Star Zeng, Liming Gao,
	Sean Brogan, Michael Turner

From: Bret Barkelew <Bret.Barkelew@microsoft.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677

For some pointer and UINT64 data, the debug code print with '%x'.
Which would loss the upper 32bit data. So update '%x' to '%lx'
for these data.
Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
DEBUG_ version is recommended to use.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Turner <Michael.Turner@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
---
 .../CapsulePei/Common/CapsuleCoalesce.c       | 90 +++++++++----------
 .../Universal/CapsulePei/UefiCapsule.c        | 46 +++++-----
 .../Universal/CapsulePei/X64/X64Entry.c       |  2 +-
 3 files changed, 69 insertions(+), 69 deletions(-)

diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
index 3575a94d0f..2a527054bd 100644
--- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
+++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
@@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
   // Sanity Check
   //
   if (Size > MAX_ADDRESS) {
-    DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
+    DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
     return FALSE;
   }
 
@@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
   // Sanity Check
   //
   if (Address > (MAX_ADDRESS - Size)) {
-    DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS - Size(0x%lx))\n", Address, Size));
+    DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS - Size(0x%lx))\n", Address, Size));
     return FALSE;
   }
 
@@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
   for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
     if ((Address >= MemoryResource[Index].PhysicalStart) &&
         ((Address + Size) <= (MemoryResource[Index].PhysicalStart + MemoryResource[Index].ResourceLength))) {
-      DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
+      DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
                           Address, Size,
                           Index, MemoryResource[Index].PhysicalStart, MemoryResource[Index].ResourceLength));
       return TRUE;
     }
   }
 
-  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any MemoryResource\n", Address, Size));
+  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any MemoryResource\n", Address, Size));
   return FALSE;
 }
 
@@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
   UINTN                          CapsuleCount;
   EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
 
-  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
+  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
 
   //
   // Go through the list to look for inconsistencies. Check for:
@@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
     return NULL;
   }
 
-  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
-  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
+  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));
+  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
+  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
   while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer != (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
     //
     // Make sure the descriptor is aligned at UINT64 in memory
     //
     if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
-      DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment check\n"));
+      DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment check\n"));
       return NULL;
     }
 
@@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
       if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
         return NULL;
       }
-      DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
-      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
+      DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", (UINT64)Ptr));
+      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
+      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
     } else {
       if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr->Union.DataBlock, Ptr->Length)) {
         return NULL;
@@ -375,14 +375,14 @@ ValidateCapsuleIntegrity (
         // Sanity check
         //
         if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
-          DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) < sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
+          DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) < sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
           return NULL;
         }
         //
         // Make sure HeaderSize field is valid
         //
         if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize) {
-          DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader->HeaderSize, CapsuleHeader->CapsuleImageSize));
+          DEBUG ((DEBUG_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader->HeaderSize, CapsuleHeader->CapsuleImageSize));
           return NULL;
         }
         if (IsCapsuleCorrupted (CapsuleHeader)) {
@@ -395,7 +395,7 @@ ValidateCapsuleIntegrity (
       if (CapsuleSize >= Ptr->Length) {
         CapsuleSize = CapsuleSize - Ptr->Length;
       } else {
-        DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
+        DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
         //
         // Sanity check
         //
@@ -409,9 +409,9 @@ ValidateCapsuleIntegrity (
       if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
         return NULL;
       }
-      DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr));
-      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
-      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
+      DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%lx\n", (UINT64)Ptr));
+      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
+      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
     }
   }
 
@@ -419,7 +419,7 @@ ValidateCapsuleIntegrity (
     //
     // No any capsule is found in BlockList
     //
-    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n", CapsuleCount));
+    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n", CapsuleCount));
     return NULL;
   }
 
@@ -427,7 +427,7 @@ ValidateCapsuleIntegrity (
     //
     // Capsule data is incomplete.
     //
-    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n", CapsuleSize));
+    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n", CapsuleSize));
     return NULL;
   }
 
@@ -515,7 +515,7 @@ RelocateBlockDescriptors (
         }
 
         CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length);
-        DEBUG ((EFI_D_INFO, "Capsule relocate descriptors from/to/size  0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock, (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
+        DEBUG ((DEBUG_INFO, "Capsule relocate descriptors from/to/size  0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock, (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
         TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocBuffer;
       }
       TempBlockDesc++;
@@ -552,7 +552,7 @@ RelocateBlockDescriptors (
         return NULL;
       }
       CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead, BlockListSize);
-      DEBUG ((EFI_D_INFO, "Capsule reloc descriptor block #2\n"));
+      DEBUG ((DEBUG_INFO, "Capsule reloc descriptor block #2\n"));
       //
       // Point the previous block's next point to this copied version. If
       // the tail pointer is null, then this is the first descriptor block.
@@ -651,7 +651,7 @@ GetCapsuleInfo (
   UINTN                          ThisCapsuleImageSize;
   EFI_CAPSULE_HEADER             *CapsuleHeader;
 
-  DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n"));
+  DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
 
   ASSERT (Desc != NULL);
 
@@ -673,7 +673,7 @@ GetCapsuleInfo (
       // While here we need check all capsules size.
       //
       if (Desc->Length >= (MAX_ADDRESS - Size)) {
-        DEBUG ((EFI_D_ERROR, "ERROR: Desc->Length(0x%lx) >= (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
+        DEBUG ((DEBUG_ERROR, "ERROR: Desc->Length(0x%lx) >= (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
         return EFI_OUT_OF_RESOURCES;
       }
       Size += (UINTN) Desc->Length;
@@ -707,7 +707,7 @@ GetCapsuleInfo (
   // If no descriptors, then fail
   //
   if (Count == 0) {
-    DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n"));
+    DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
     return EFI_NOT_FOUND;
   }
 
@@ -787,7 +787,7 @@ CapsuleTestPatternPreCoalesce (
   UINT32  TestCounter;
   UINT32  TestSize;
 
-  DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n"));
+  DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
 
   //
   // Find first data descriptor
@@ -803,7 +803,7 @@ CapsuleTestPatternPreCoalesce (
   // First one better be long enough to at least hold the test signature
   //
   if (Desc->Length < sizeof (UINT32)) {
-    DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted #1\n"));
+    DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted #1\n"));
     return ;
   }
 
@@ -823,13 +823,13 @@ CapsuleTestPatternPreCoalesce (
   TestPtr += 2;
   while (1) {
     if ((TestSize & 0x03) != 0) {
-      DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted #2\n"));
+      DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted #2\n"));
       return ;
     }
 
     while (TestSize > 0) {
       if (*TestPtr != TestCounter) {
-        DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce failed data corruption check\n"));
+        DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce failed data corruption check\n"));
         return ;
       }
 
@@ -873,7 +873,7 @@ BuildCapsuleDescriptors (
   EFI_CAPSULE_BLOCK_DESCRIPTOR     *TempBlock;
   EFI_CAPSULE_BLOCK_DESCRIPTOR     *HeadBlock;
 
-  DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n"));
+  DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
 
   LastBlock         = NULL;
   HeadBlock         = NULL;
@@ -904,7 +904,7 @@ BuildCapsuleDescriptors (
         }
       }
     } else {
-      DEBUG ((EFI_D_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) < MAX_ADDRESS\n", BlockListBuffer[Index]));
+      DEBUG ((DEBUG_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) < MAX_ADDRESS\n", BlockListBuffer[Index]));
     }
     Index ++;
   }
@@ -1022,7 +1022,7 @@ CapsuleDataCoalesce (
   EFI_CAPSULE_BLOCK_DESCRIPTOR   *TempBlockDesc;
   EFI_CAPSULE_BLOCK_DESCRIPTOR   PrivateDataDesc[2];
 
-  DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n"));
+  DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
 
   CapsuleIndex     = 0;
   SizeLeft         = 0;
@@ -1055,15 +1055,15 @@ CapsuleDataCoalesce (
   if (EFI_ERROR (Status)) {
     return Status;
   }
-  DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
-  DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
-  DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
+  DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
+  DEBUG ((DEBUG_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
+  DEBUG ((DEBUG_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
   if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber == 0)) {
     return EFI_NOT_FOUND;
   }
 
   if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof (EFI_CAPSULE_PEIM_PRIVATE_DATA)  + sizeof(UINT64))) / sizeof(UINT64)) {
-    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleNumber - 0x%x\n", CapsuleNumber));
+    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleNumber - 0x%x\n", CapsuleNumber));
     return EFI_BUFFER_TOO_SMALL;
   }
 
@@ -1093,7 +1093,7 @@ CapsuleDataCoalesce (
   // Sanity check
   //
   if (CapsuleSize >= (MAX_ADDRESS - (sizeof (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64) + sizeof(UINT64)))) {
-    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
+    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
     return EFI_BUFFER_TOO_SMALL;
   }
   //
@@ -1105,7 +1105,7 @@ CapsuleDataCoalesce (
   // Sanity check
   //
   if (NumDescriptors >= (MAX_ADDRESS / sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
-    DEBUG ((EFI_D_ERROR, "ERROR: NumDescriptors - 0x%x\n", NumDescriptors));
+    DEBUG ((DEBUG_ERROR, "ERROR: NumDescriptors - 0x%x\n", NumDescriptors));
     return EFI_BUFFER_TOO_SMALL;
   }
   DescriptorsSize  = NumDescriptors * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR);
@@ -1113,7 +1113,7 @@ CapsuleDataCoalesce (
   // Sanity check
   //
   if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) {
-    DEBUG ((EFI_D_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
+    DEBUG ((DEBUG_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
     return EFI_BUFFER_TOO_SMALL;
   }
 
@@ -1121,10 +1121,10 @@ CapsuleDataCoalesce (
   // Don't go below some min address. If the base is below it,
   // then move it up and adjust the size accordingly.
   //
-  DEBUG ((EFI_D_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n", (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
+  DEBUG ((DEBUG_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n", (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
   if ((UINTN)*MemoryBase < (UINTN) MIN_COALESCE_ADDR) {
     if (((UINTN)*MemoryBase + *MemorySize) < (UINTN) MIN_COALESCE_ADDR) {
-      DEBUG ((EFI_D_ERROR, "ERROR: *MemoryBase + *MemorySize - 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
+      DEBUG ((DEBUG_ERROR, "ERROR: *MemoryBase + *MemorySize - 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
       return EFI_BUFFER_TOO_SMALL;
     } else {
       *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR - (UINTN) *MemoryBase);
@@ -1133,13 +1133,13 @@ CapsuleDataCoalesce (
   }
 
   if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
-    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize + DescriptorsSize - 0x%x\n", CapsuleSize + DescriptorsSize));
+    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize + DescriptorsSize - 0x%x\n", CapsuleSize + DescriptorsSize));
     return EFI_BUFFER_TOO_SMALL;
   }
 
   FreeMemBase = *MemoryBase;
   FreeMemSize = *MemorySize;
-  DEBUG ((EFI_D_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n", (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
+  DEBUG ((DEBUG_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n", (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
 
   //
   // Relocate all the block descriptors to low memory to make further
@@ -1205,7 +1205,7 @@ CapsuleDataCoalesce (
         }
 
         CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length);
-        DEBUG ((EFI_D_INFO, "Capsule reloc data block from 0x%8X to 0x%8X with size 0x%8X\n",
+        DEBUG ((DEBUG_INFO, "Capsule reloc data block from 0x%8X to 0x%8X with size 0x%8X\n",
                 (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) RelocPtr, (UINTN) TempBlockDesc->Length));
 
         TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocPtr;
@@ -1256,7 +1256,7 @@ CapsuleDataCoalesce (
       ASSERT (CurrentBlockDesc->Length <= SizeLeft);
 
       CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc->Union.DataBlock), (UINTN)CurrentBlockDesc->Length);
-      DEBUG ((EFI_D_INFO, "Capsule coalesce block no.0x%lX from 0x%lX to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
+      DEBUG ((DEBUG_INFO, "Capsule coalesce block no.0x%lX from 0x%lX to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
              CurrentBlockDesc->Union.DataBlock, (UINT64)(UINTN)DestPtr, CurrentBlockDesc->Length));
       DestPtr += CurrentBlockDesc->Length;
       SizeLeft -= CurrentBlockDesc->Length;
diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index 1131094c4f..f5ec1c20ec 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -427,7 +427,7 @@ ModeSwitch (
     if (ReservedRangeEnd < MemoryEnd64) {
       MemoryBase64 = ReservedRangeEnd;
     } else {
-      DEBUG ((EFI_D_ERROR, "Memory is not enough to process capsule!\n"));
+      DEBUG ((DEBUG_ERROR, "Memory is not enough to process capsule!\n"));
       return EFI_OUT_OF_RESOURCES;
     }
   } else if (ReservedRangeBase < MemoryEnd64) {
@@ -525,7 +525,7 @@ FindCapsuleCoalesceImage (
                            &AuthenticationState
                            );
       if (EFI_ERROR (Status)) {
-        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleX64 image ffs %r!\n", Status));
+        DEBUG ((DEBUG_ERROR, "Unable to find PE32 section in CapsuleX64 image ffs %r!\n", Status));
         return Status;
       }
       *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);
@@ -574,7 +574,7 @@ GetLongModeContext (
                                   LongModeBuffer
                                   );
   if (EFI_ERROR (Status)) {
-    DEBUG (( EFI_D_ERROR, "Error Get LongModeBuffer variable %r!\n", Status));
+    DEBUG (( DEBUG_ERROR, "Error Get LongModeBuffer variable %r!\n", Status));
   }
   return Status;
 }
@@ -734,7 +734,7 @@ BuildMemoryResourceDescriptor (
   }
 
   if (Index == 0) {
-    DEBUG ((EFI_D_INFO | EFI_D_WARN, "No memory resource descriptor reported in HOB list before capsule Coalesce\n"));
+    DEBUG ((DEBUG_INFO | DEBUG_WARN, "No memory resource descriptor reported in HOB list before capsule Coalesce\n"));
 #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
     //
     // Allocate memory to hold memory resource descriptor,
@@ -746,7 +746,7 @@ BuildMemoryResourceDescriptor (
 
     MemoryResource[0].PhysicalStart = 0;
     MemoryResource[0].ResourceLength = LShiftU64 (1, GetPhysicalAddressBits ());
-    DEBUG ((EFI_D_INFO, "MemoryResource[0x0] - Start(0x%0lx) Length(0x%0lx)\n",
+    DEBUG ((DEBUG_INFO, "MemoryResource[0x0] - Start(0x%0lx) Length(0x%0lx)\n",
                         MemoryResource[0x0].PhysicalStart, MemoryResource[0x0].ResourceLength));
     return MemoryResource;
 #else
@@ -770,7 +770,7 @@ BuildMemoryResourceDescriptor (
   while (Hob.Raw != NULL) {
     ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw;
     if (ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
-      DEBUG ((EFI_D_INFO, "MemoryResource[0x%x] - Start(0x%0lx) Length(0x%0lx)\n",
+      DEBUG ((DEBUG_INFO, "MemoryResource[0x%x] - Start(0x%0lx) Length(0x%0lx)\n",
                           Index, ResourceDescriptor->PhysicalStart, ResourceDescriptor->ResourceLength));
       MemoryResource[Index].PhysicalStart = ResourceDescriptor->PhysicalStart;
       MemoryResource[Index].ResourceLength = ResourceDescriptor->ResourceLength;
@@ -973,7 +973,7 @@ CapsuleCoalesce (
   //
   Status = PeiServicesGetBootMode (&BootMode);
   if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) {
-    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update path.\n"));
+    DEBUG ((DEBUG_ERROR, "Boot mode is not correct for capsule update path.\n"));
     Status = EFI_NOT_FOUND;
     goto Done;
   }
@@ -1016,14 +1016,14 @@ CapsuleCoalesce (
       //
       // There is no capsule variables, quit
       //
-      DEBUG ((EFI_D_INFO,"Capsule variable Index = %d\n", Index));
+      DEBUG ((DEBUG_INFO,"Capsule variable Index = %d\n", Index));
       break;
     }
     VariableCount++;
     Index++;
   }
 
-  DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n", VariableCount));
+  DEBUG ((DEBUG_INFO,"Capsule variable count = %d\n", VariableCount));
 
   //
   // The last entry is the end flag.
@@ -1034,7 +1034,7 @@ CapsuleCoalesce (
              );
 
   if (Status != EFI_SUCCESS) {
-    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!, Status = %x\n", Status));
+    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!, Status = %x\n", Status));
     goto Done;
   }
 
@@ -1046,7 +1046,7 @@ CapsuleCoalesce (
   //
   Status = GetCapsuleDescriptors (VariableArrayAddress);
   if (EFI_ERROR (Status)) {
-    DEBUG ((EFI_D_ERROR, "Fail to find capsule variables.\n"));
+    DEBUG ((DEBUG_ERROR, "Fail to find capsule variables.\n"));
     goto Done;
   }
 
@@ -1064,14 +1064,14 @@ CapsuleCoalesce (
     CoalesceImageEntryPoint = 0;
     Status = GetLongModeContext (&LongModeBuffer);
     if (EFI_ERROR (Status)) {
-      DEBUG ((EFI_D_ERROR, "Fail to find the variable for long mode context!\n"));
+      DEBUG ((DEBUG_ERROR, "Fail to find the variable for long mode context!\n"));
       Status = EFI_NOT_FOUND;
       goto Done;
     }
 
     Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint, &CoalesceImageMachineType);
     if ((EFI_ERROR (Status)) || (CoalesceImageMachineType != EFI_IMAGE_MACHINE_X64)) {
-      DEBUG ((EFI_D_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
+      DEBUG ((DEBUG_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
       Status = EFI_NOT_FOUND;
       goto Done;
     }
@@ -1091,14 +1091,14 @@ CapsuleCoalesce (
   Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase, MemorySize);
 #endif
 
-  DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n", Status));
+  DEBUG ((DEBUG_INFO, "Capsule Coalesce Status = %r!\n", Status));
 
   if (Status == EFI_BUFFER_TOO_SMALL) {
-    DEBUG ((EFI_D_ERROR, "There is not enough memory to process capsule!\n"));
+    DEBUG ((DEBUG_ERROR, "There is not enough memory to process capsule!\n"));
   }
 
   if (Status == EFI_NOT_FOUND) {
-    DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in memory!\n"));
+    DEBUG ((DEBUG_ERROR, "Fail to parse capsule descriptor in memory!\n"));
     REPORT_STATUS_CODE (
       EFI_ERROR_CODE | EFI_ERROR_MAJOR,
       (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
@@ -1163,7 +1163,7 @@ CapsuleTestPattern (
   //
   if (*TestPtr == 0x54534554) {
     RetValue = TRUE;
-    DEBUG ((EFI_D_INFO, "Capsule test pattern mode activated...\n"));
+    DEBUG ((DEBUG_INFO, "Capsule test pattern mode activated...\n"));
     TestSize = TestPtr[1] / sizeof (UINT32);
     //
     // Skip over the signature and the size fields in the pattern data header
@@ -1172,7 +1172,7 @@ CapsuleTestPattern (
     TestCounter = 0;
     while (TestSize > 0) {
       if (*TestPtr != TestCounter) {
-        DEBUG ((EFI_D_INFO, "Capsule test pattern mode FAILED: BaseAddr/FailAddr 0x%X 0x%X\n", (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase, (UINT32)(UINTN)TestPtr));
+        DEBUG ((DEBUG_INFO, "Capsule test pattern mode FAILED: BaseAddr/FailAddr 0x%X 0x%X\n", (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase, (UINT32)(UINTN)TestPtr));
         return TRUE;
       }
 
@@ -1181,7 +1181,7 @@ CapsuleTestPattern (
       TestSize--;
     }
 
-    DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n"));
+    DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
   }
 
   return RetValue;
@@ -1226,11 +1226,11 @@ CreateState (
     return EFI_VOLUME_CORRUPTED;
   }
   if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) {
-    DEBUG ((EFI_D_ERROR, "CapsuleAllImageSize too big - 0x%lx\n", PrivateData->CapsuleAllImageSize));
+    DEBUG ((DEBUG_ERROR, "CapsuleAllImageSize too big - 0x%lx\n", PrivateData->CapsuleAllImageSize));
     return EFI_OUT_OF_RESOURCES;
   }
   if (PrivateData->CapsuleNumber >= MAX_ADDRESS) {
-    DEBUG ((EFI_D_ERROR, "CapsuleNumber too big - 0x%lx\n", PrivateData->CapsuleNumber));
+    DEBUG ((DEBUG_ERROR, "CapsuleNumber too big - 0x%lx\n", PrivateData->CapsuleNumber));
     return EFI_OUT_OF_RESOURCES;
   }
   //
@@ -1248,13 +1248,13 @@ CreateState (
              );
 
   if (Status != EFI_SUCCESS) {
-    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n"));
+    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
     return Status;
   }
   //
   // Copy to our new buffer for DXE
   //
-  DEBUG ((EFI_D_INFO, "Capsule copy from 0x%8X to 0x%8X with size 0x%8X\n", (UINTN)((UINT8 *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64)), (UINTN) NewBuffer, Size));
+  DEBUG ((DEBUG_INFO, "Capsule copy from 0x%8X to 0x%8X with size 0x%8X\n", (UINTN)((UINT8 *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64)), (UINTN) NewBuffer, Size));
   CopyMem ((VOID *) (UINTN) NewBuffer, (VOID *) (UINTN) ((UINT8 *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64)), Size);
   //
   // Check for test data pattern. If it is the test pattern, then we'll
diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
index 40b7095194..2c309990fb 100644
--- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
+++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
@@ -174,7 +174,7 @@ PageFaultHandler (
   AddressEncMask = PageFaultContext->AddressEncMask;
 
   PFAddress = AsmReadCr2 ();
-  DEBUG ((EFI_D_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n", PFAddress));
+  DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n", PFAddress));
 
   if (PFAddress >= PhyMask + SIZE_4KB) {
     return PageFaultContext->OriginalHandler;
-- 
2.21.0.windows.1



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-02  5:50 [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data Zhichao Gao
@ 2019-04-02 15:35 ` Philippe Mathieu-Daudé
  2019-04-11  7:47   ` [edk2] " Gao, Zhichao
  2019-04-11  7:20 ` Gao, Zhichao
  1 sibling, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-04-02 15:35 UTC (permalink / raw)
  To: Zhichao Gao, edk2-devel
  Cc: Bret Barkelew, Michael Turner, Liming Gao, Star Zeng

Hi Bret,

On 4/2/19 7:50 AM, Zhichao Gao wrote:
> From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> 
> For some pointer and UINT64 data, the debug code print with '%x'.
> Which would loss the upper 32bit data. So update '%x' to '%lx'
> for these data.

Some are UINTN. Per Laszlo answer on this thread:
https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
for those, casting and changing format is the accepted way.

However this is a change,

> Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> DEBUG_ version is recommended to use.

and this is another change.

Splitting this patch in 2 would make it more digestable.

> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  .../CapsulePei/Common/CapsuleCoalesce.c       | 90 +++++++++----------
>  .../Universal/CapsulePei/UefiCapsule.c        | 46 +++++-----
>  .../Universal/CapsulePei/X64/X64Entry.c       |  2 +-
>  3 files changed, 69 insertions(+), 69 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> index 3575a94d0f..2a527054bd 100644
> --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
>    // Sanity Check
>    //
>    if (Size > MAX_ADDRESS) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
> +    DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
>      return FALSE;
>    }
>  
> @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
>    // Sanity Check
>    //
>    if (Address > (MAX_ADDRESS - Size)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS - Size(0x%lx))\n", Address, Size));
> +    DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS - Size(0x%lx))\n", Address, Size));
>      return FALSE;
>    }
>  
> @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
>    for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
>      if ((Address >= MemoryResource[Index].PhysicalStart) &&
>          ((Address + Size) <= (MemoryResource[Index].PhysicalStart + MemoryResource[Index].ResourceLength))) {
> -      DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> +      DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
>                            Address, Size,
>                            Index, MemoryResource[Index].PhysicalStart, MemoryResource[Index].ResourceLength));
>        return TRUE;
>      }
>    }
>  
> -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any MemoryResource\n", Address, Size));
> +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any MemoryResource\n", Address, Size));
>    return FALSE;
>  }
>  
> @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
>    UINTN                          CapsuleCount;
>    EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
>  
> -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
>  
>    //
>    // Go through the list to look for inconsistencies. Check for:
> @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
>      return NULL;
>    }
>  
> -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
> +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));
> +  DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> +  DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
>    while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer != (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
>      //
>      // Make sure the descriptor is aligned at UINT64 in memory
>      //
>      if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
> -      DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment check\n"));
> +      DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment check\n"));
>        return NULL;
>      }
>  
> @@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
>        if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
>          return NULL;
>        }
> -      DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
> -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
> +      DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", (UINT64)Ptr));
> +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
>      } else {
>        if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr->Union.DataBlock, Ptr->Length)) {
>          return NULL;
> @@ -375,14 +375,14 @@ ValidateCapsuleIntegrity (
>          // Sanity check
>          //
>          if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
> -          DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) < sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> +          DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) < sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
>            return NULL;
>          }
>          //
>          // Make sure HeaderSize field is valid
>          //
>          if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize) {
> -          DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader->HeaderSize, CapsuleHeader->CapsuleImageSize));
> +          DEBUG ((DEBUG_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader->HeaderSize, CapsuleHeader->CapsuleImageSize));
>            return NULL;
>          }
>          if (IsCapsuleCorrupted (CapsuleHeader)) {
> @@ -395,7 +395,7 @@ ValidateCapsuleIntegrity (
>        if (CapsuleSize >= Ptr->Length) {
>          CapsuleSize = CapsuleSize - Ptr->Length;
>        } else {
> -        DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> +        DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
>          //
>          // Sanity check
>          //
> @@ -409,9 +409,9 @@ ValidateCapsuleIntegrity (
>        if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
>          return NULL;
>        }
> -      DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr));
> -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
> +      DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%lx\n", (UINT64)Ptr));
> +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n", Ptr->Union.ContinuationPointer));
>      }
>    }
>  
> @@ -419,7 +419,7 @@ ValidateCapsuleIntegrity (
>      //
>      // No any capsule is found in BlockList
>      //
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n", CapsuleCount));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n", CapsuleCount));
>      return NULL;
>    }
>  
> @@ -427,7 +427,7 @@ ValidateCapsuleIntegrity (
>      //
>      // Capsule data is incomplete.
>      //
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n", CapsuleSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n", CapsuleSize));
>      return NULL;
>    }
>  
> @@ -515,7 +515,7 @@ RelocateBlockDescriptors (
>          }
>  
>          CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length);
> -        DEBUG ((EFI_D_INFO, "Capsule relocate descriptors from/to/size  0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock, (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> +        DEBUG ((DEBUG_INFO, "Capsule relocate descriptors from/to/size  0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock, (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
>          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocBuffer;
>        }
>        TempBlockDesc++;
> @@ -552,7 +552,7 @@ RelocateBlockDescriptors (
>          return NULL;
>        }
>        CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead, BlockListSize);
> -      DEBUG ((EFI_D_INFO, "Capsule reloc descriptor block #2\n"));
> +      DEBUG ((DEBUG_INFO, "Capsule reloc descriptor block #2\n"));
>        //
>        // Point the previous block's next point to this copied version. If
>        // the tail pointer is null, then this is the first descriptor block.
> @@ -651,7 +651,7 @@ GetCapsuleInfo (
>    UINTN                          ThisCapsuleImageSize;
>    EFI_CAPSULE_HEADER             *CapsuleHeader;
>  
> -  DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n"));
> +  DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
>  
>    ASSERT (Desc != NULL);
>  
> @@ -673,7 +673,7 @@ GetCapsuleInfo (
>        // While here we need check all capsules size.
>        //
>        if (Desc->Length >= (MAX_ADDRESS - Size)) {
> -        DEBUG ((EFI_D_ERROR, "ERROR: Desc->Length(0x%lx) >= (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> +        DEBUG ((DEBUG_ERROR, "ERROR: Desc->Length(0x%lx) >= (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
>          return EFI_OUT_OF_RESOURCES;
>        }
>        Size += (UINTN) Desc->Length;
> @@ -707,7 +707,7 @@ GetCapsuleInfo (
>    // If no descriptors, then fail
>    //
>    if (Count == 0) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n"));
> +    DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
>      return EFI_NOT_FOUND;
>    }
>  
> @@ -787,7 +787,7 @@ CapsuleTestPatternPreCoalesce (
>    UINT32  TestCounter;
>    UINT32  TestSize;
>  
> -  DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n"));
> +  DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
>  
>    //
>    // Find first data descriptor
> @@ -803,7 +803,7 @@ CapsuleTestPatternPreCoalesce (
>    // First one better be long enough to at least hold the test signature
>    //
>    if (Desc->Length < sizeof (UINT32)) {
> -    DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted #1\n"));
> +    DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted #1\n"));
>      return ;
>    }
>  
> @@ -823,13 +823,13 @@ CapsuleTestPatternPreCoalesce (
>    TestPtr += 2;
>    while (1) {
>      if ((TestSize & 0x03) != 0) {
> -      DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted #2\n"));
> +      DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted #2\n"));
>        return ;
>      }
>  
>      while (TestSize > 0) {
>        if (*TestPtr != TestCounter) {
> -        DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce failed data corruption check\n"));
> +        DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce failed data corruption check\n"));
>          return ;
>        }
>  
> @@ -873,7 +873,7 @@ BuildCapsuleDescriptors (
>    EFI_CAPSULE_BLOCK_DESCRIPTOR     *TempBlock;
>    EFI_CAPSULE_BLOCK_DESCRIPTOR     *HeadBlock;
>  
> -  DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n"));
> +  DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
>  
>    LastBlock         = NULL;
>    HeadBlock         = NULL;
> @@ -904,7 +904,7 @@ BuildCapsuleDescriptors (
>          }
>        }
>      } else {
> -      DEBUG ((EFI_D_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) < MAX_ADDRESS\n", BlockListBuffer[Index]));
> +      DEBUG ((DEBUG_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) < MAX_ADDRESS\n", BlockListBuffer[Index]));
>      }
>      Index ++;
>    }
> @@ -1022,7 +1022,7 @@ CapsuleDataCoalesce (
>    EFI_CAPSULE_BLOCK_DESCRIPTOR   *TempBlockDesc;
>    EFI_CAPSULE_BLOCK_DESCRIPTOR   PrivateDataDesc[2];
>  
> -  DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n"));
> +  DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
>  
>    CapsuleIndex     = 0;
>    SizeLeft         = 0;
> @@ -1055,15 +1055,15 @@ CapsuleDataCoalesce (
>    if (EFI_ERROR (Status)) {
>      return Status;
>    }
> -  DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> -  DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> -  DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
> +  DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> +  DEBUG ((DEBUG_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));

This is confuse CapsuleNumber is declared UINT64 in
MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h and we use a
UINTN here. Why not keep UINT64 and use "%lx"?

> +  DEBUG ((DEBUG_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
>    if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber == 0)) {
>      return EFI_NOT_FOUND;
>    }
>  
>    if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof (EFI_CAPSULE_PEIM_PRIVATE_DATA)  + sizeof(UINT64))) / sizeof(UINT64)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleNumber - 0x%x\n", CapsuleNumber));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleNumber - 0x%x\n", CapsuleNumber));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>  
> @@ -1093,7 +1093,7 @@ CapsuleDataCoalesce (
>    // Sanity check
>    //
>    if (CapsuleSize >= (MAX_ADDRESS - (sizeof (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64) + sizeof(UINT64)))) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>    //
> @@ -1105,7 +1105,7 @@ CapsuleDataCoalesce (
>    // Sanity check
>    //
>    if (NumDescriptors >= (MAX_ADDRESS / sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: NumDescriptors - 0x%x\n", NumDescriptors));
> +    DEBUG ((DEBUG_ERROR, "ERROR: NumDescriptors - 0x%x\n", NumDescriptors));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>    DescriptorsSize  = NumDescriptors * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR);
> @@ -1113,7 +1113,7 @@ CapsuleDataCoalesce (
>    // Sanity check
>    //
>    if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>  
> @@ -1121,10 +1121,10 @@ CapsuleDataCoalesce (
>    // Don't go below some min address. If the base is below it,
>    // then move it up and adjust the size accordingly.
>    //
> -  DEBUG ((EFI_D_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n", (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> +  DEBUG ((DEBUG_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n", (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));

Don't you also want to cast to UINT64 and use "%lX" here?

>    if ((UINTN)*MemoryBase < (UINTN) MIN_COALESCE_ADDR) {
>      if (((UINTN)*MemoryBase + *MemorySize) < (UINTN) MIN_COALESCE_ADDR) {
> -      DEBUG ((EFI_D_ERROR, "ERROR: *MemoryBase + *MemorySize - 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> +      DEBUG ((DEBUG_ERROR, "ERROR: *MemoryBase + *MemorySize - 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
>        return EFI_BUFFER_TOO_SMALL;
>      } else {
>        *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR - (UINTN) *MemoryBase);
> @@ -1133,13 +1133,13 @@ CapsuleDataCoalesce (
>    }
>  
>    if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize + DescriptorsSize - 0x%x\n", CapsuleSize + DescriptorsSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize + DescriptorsSize - 0x%x\n", CapsuleSize + DescriptorsSize));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>  
>    FreeMemBase = *MemoryBase;
>    FreeMemSize = *MemorySize;
> -  DEBUG ((EFI_D_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n", (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> +  DEBUG ((DEBUG_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n", (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
>  
>    //
>    // Relocate all the block descriptors to low memory to make further
> @@ -1205,7 +1205,7 @@ CapsuleDataCoalesce (
>          }
>  
>          CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length);
> -        DEBUG ((EFI_D_INFO, "Capsule reloc data block from 0x%8X to 0x%8X with size 0x%8X\n",
> +        DEBUG ((DEBUG_INFO, "Capsule reloc data block from 0x%8X to 0x%8X with size 0x%8X\n",
>                  (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) RelocPtr, (UINTN) TempBlockDesc->Length));
>  
>          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocPtr;
> @@ -1256,7 +1256,7 @@ CapsuleDataCoalesce (
>        ASSERT (CurrentBlockDesc->Length <= SizeLeft);
>  
>        CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc->Union.DataBlock), (UINTN)CurrentBlockDesc->Length);
> -      DEBUG ((EFI_D_INFO, "Capsule coalesce block no.0x%lX from 0x%lX to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> +      DEBUG ((DEBUG_INFO, "Capsule coalesce block no.0x%lX from 0x%lX to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
>               CurrentBlockDesc->Union.DataBlock, (UINT64)(UINTN)DestPtr, CurrentBlockDesc->Length));
>        DestPtr += CurrentBlockDesc->Length;
>        SizeLeft -= CurrentBlockDesc->Length;
> diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> index 1131094c4f..f5ec1c20ec 100644
> --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> @@ -427,7 +427,7 @@ ModeSwitch (
>      if (ReservedRangeEnd < MemoryEnd64) {
>        MemoryBase64 = ReservedRangeEnd;
>      } else {
> -      DEBUG ((EFI_D_ERROR, "Memory is not enough to process capsule!\n"));
> +      DEBUG ((DEBUG_ERROR, "Memory is not enough to process capsule!\n"));
>        return EFI_OUT_OF_RESOURCES;
>      }
>    } else if (ReservedRangeBase < MemoryEnd64) {
> @@ -525,7 +525,7 @@ FindCapsuleCoalesceImage (
>                             &AuthenticationState
>                             );
>        if (EFI_ERROR (Status)) {
> -        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleX64 image ffs %r!\n", Status));
> +        DEBUG ((DEBUG_ERROR, "Unable to find PE32 section in CapsuleX64 image ffs %r!\n", Status));
>          return Status;
>        }
>        *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);
> @@ -574,7 +574,7 @@ GetLongModeContext (
>                                    LongModeBuffer
>                                    );
>    if (EFI_ERROR (Status)) {
> -    DEBUG (( EFI_D_ERROR, "Error Get LongModeBuffer variable %r!\n", Status));
> +    DEBUG (( DEBUG_ERROR, "Error Get LongModeBuffer variable %r!\n", Status));
>    }
>    return Status;
>  }
> @@ -734,7 +734,7 @@ BuildMemoryResourceDescriptor (
>    }
>  
>    if (Index == 0) {
> -    DEBUG ((EFI_D_INFO | EFI_D_WARN, "No memory resource descriptor reported in HOB list before capsule Coalesce\n"));
> +    DEBUG ((DEBUG_INFO | DEBUG_WARN, "No memory resource descriptor reported in HOB list before capsule Coalesce\n"));
>  #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
>      //
>      // Allocate memory to hold memory resource descriptor,
> @@ -746,7 +746,7 @@ BuildMemoryResourceDescriptor (
>  
>      MemoryResource[0].PhysicalStart = 0;
>      MemoryResource[0].ResourceLength = LShiftU64 (1, GetPhysicalAddressBits ());
> -    DEBUG ((EFI_D_INFO, "MemoryResource[0x0] - Start(0x%0lx) Length(0x%0lx)\n",
> +    DEBUG ((DEBUG_INFO, "MemoryResource[0x0] - Start(0x%0lx) Length(0x%0lx)\n",
>                          MemoryResource[0x0].PhysicalStart, MemoryResource[0x0].ResourceLength));
>      return MemoryResource;
>  #else
> @@ -770,7 +770,7 @@ BuildMemoryResourceDescriptor (
>    while (Hob.Raw != NULL) {
>      ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw;
>      if (ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) {
> -      DEBUG ((EFI_D_INFO, "MemoryResource[0x%x] - Start(0x%0lx) Length(0x%0lx)\n",
> +      DEBUG ((DEBUG_INFO, "MemoryResource[0x%x] - Start(0x%0lx) Length(0x%0lx)\n",
>                            Index, ResourceDescriptor->PhysicalStart, ResourceDescriptor->ResourceLength));
>        MemoryResource[Index].PhysicalStart = ResourceDescriptor->PhysicalStart;
>        MemoryResource[Index].ResourceLength = ResourceDescriptor->ResourceLength;
> @@ -973,7 +973,7 @@ CapsuleCoalesce (
>    //
>    Status = PeiServicesGetBootMode (&BootMode);
>    if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) {
> -    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update path.\n"));
> +    DEBUG ((DEBUG_ERROR, "Boot mode is not correct for capsule update path.\n"));
>      Status = EFI_NOT_FOUND;
>      goto Done;
>    }
> @@ -1016,14 +1016,14 @@ CapsuleCoalesce (
>        //
>        // There is no capsule variables, quit
>        //
> -      DEBUG ((EFI_D_INFO,"Capsule variable Index = %d\n", Index));
> +      DEBUG ((DEBUG_INFO,"Capsule variable Index = %d\n", Index));
>        break;
>      }
>      VariableCount++;
>      Index++;
>    }
>  
> -  DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n", VariableCount));
> +  DEBUG ((DEBUG_INFO,"Capsule variable count = %d\n", VariableCount));
>  
>    //
>    // The last entry is the end flag.
> @@ -1034,7 +1034,7 @@ CapsuleCoalesce (
>               );
>  
>    if (Status != EFI_SUCCESS) {
> -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!, Status = %x\n", Status));
> +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!, Status = %x\n", Status));
>      goto Done;
>    }
>  
> @@ -1046,7 +1046,7 @@ CapsuleCoalesce (
>    //
>    Status = GetCapsuleDescriptors (VariableArrayAddress);
>    if (EFI_ERROR (Status)) {
> -    DEBUG ((EFI_D_ERROR, "Fail to find capsule variables.\n"));
> +    DEBUG ((DEBUG_ERROR, "Fail to find capsule variables.\n"));
>      goto Done;
>    }
>  
> @@ -1064,14 +1064,14 @@ CapsuleCoalesce (
>      CoalesceImageEntryPoint = 0;
>      Status = GetLongModeContext (&LongModeBuffer);
>      if (EFI_ERROR (Status)) {
> -      DEBUG ((EFI_D_ERROR, "Fail to find the variable for long mode context!\n"));
> +      DEBUG ((DEBUG_ERROR, "Fail to find the variable for long mode context!\n"));
>        Status = EFI_NOT_FOUND;
>        goto Done;
>      }
>  
>      Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint, &CoalesceImageMachineType);
>      if ((EFI_ERROR (Status)) || (CoalesceImageMachineType != EFI_IMAGE_MACHINE_X64)) {
> -      DEBUG ((EFI_D_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
> +      DEBUG ((DEBUG_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
>        Status = EFI_NOT_FOUND;
>        goto Done;
>      }
> @@ -1091,14 +1091,14 @@ CapsuleCoalesce (
>    Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase, MemorySize);
>  #endif
>  
> -  DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n", Status));
> +  DEBUG ((DEBUG_INFO, "Capsule Coalesce Status = %r!\n", Status));
>  
>    if (Status == EFI_BUFFER_TOO_SMALL) {
> -    DEBUG ((EFI_D_ERROR, "There is not enough memory to process capsule!\n"));
> +    DEBUG ((DEBUG_ERROR, "There is not enough memory to process capsule!\n"));
>    }
>  
>    if (Status == EFI_NOT_FOUND) {
> -    DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in memory!\n"));
> +    DEBUG ((DEBUG_ERROR, "Fail to parse capsule descriptor in memory!\n"));
>      REPORT_STATUS_CODE (
>        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
>        (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
> @@ -1163,7 +1163,7 @@ CapsuleTestPattern (
>    //
>    if (*TestPtr == 0x54534554) {
>      RetValue = TRUE;
> -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode activated...\n"));
> +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode activated...\n"));
>      TestSize = TestPtr[1] / sizeof (UINT32);
>      //
>      // Skip over the signature and the size fields in the pattern data header
> @@ -1172,7 +1172,7 @@ CapsuleTestPattern (
>      TestCounter = 0;
>      while (TestSize > 0) {
>        if (*TestPtr != TestCounter) {
> -        DEBUG ((EFI_D_INFO, "Capsule test pattern mode FAILED: BaseAddr/FailAddr 0x%X 0x%X\n", (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase, (UINT32)(UINTN)TestPtr));
> +        DEBUG ((DEBUG_INFO, "Capsule test pattern mode FAILED: BaseAddr/FailAddr 0x%X 0x%X\n", (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase, (UINT32)(UINTN)TestPtr));
>          return TRUE;
>        }
>  
> @@ -1181,7 +1181,7 @@ CapsuleTestPattern (
>        TestSize--;
>      }
>  
> -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n"));
> +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
>    }
>  
>    return RetValue;
> @@ -1226,11 +1226,11 @@ CreateState (
>      return EFI_VOLUME_CORRUPTED;
>    }
>    if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) {
> -    DEBUG ((EFI_D_ERROR, "CapsuleAllImageSize too big - 0x%lx\n", PrivateData->CapsuleAllImageSize));
> +    DEBUG ((DEBUG_ERROR, "CapsuleAllImageSize too big - 0x%lx\n", PrivateData->CapsuleAllImageSize));
>      return EFI_OUT_OF_RESOURCES;
>    }
>    if (PrivateData->CapsuleNumber >= MAX_ADDRESS) {
> -    DEBUG ((EFI_D_ERROR, "CapsuleNumber too big - 0x%lx\n", PrivateData->CapsuleNumber));
> +    DEBUG ((DEBUG_ERROR, "CapsuleNumber too big - 0x%lx\n", PrivateData->CapsuleNumber));
>      return EFI_OUT_OF_RESOURCES;
>    }
>    //
> @@ -1248,13 +1248,13 @@ CreateState (
>               );
>  
>    if (Status != EFI_SUCCESS) {
> -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n"));
> +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
>      return Status;
>    }
>    //
>    // Copy to our new buffer for DXE
>    //
> -  DEBUG ((EFI_D_INFO, "Capsule copy from 0x%8X to 0x%8X with size 0x%8X\n", (UINTN)((UINT8 *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64)), (UINTN) NewBuffer, Size));
> +  DEBUG ((DEBUG_INFO, "Capsule copy from 0x%8X to 0x%8X with size 0x%8X\n", (UINTN)((UINT8 *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64)), (UINTN) NewBuffer, Size));
>    CopyMem ((VOID *) (UINTN) NewBuffer, (VOID *) (UINTN) ((UINT8 *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64)), Size);
>    //
>    // Check for test data pattern. If it is the test pattern, then we'll
> diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> index 40b7095194..2c309990fb 100644
> --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> @@ -174,7 +174,7 @@ PageFaultHandler (
>    AddressEncMask = PageFaultContext->AddressEncMask;
>  
>    PFAddress = AsmReadCr2 ();
> -  DEBUG ((EFI_D_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n", PFAddress));
> +  DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n", PFAddress));
>  
>    if (PFAddress >= PhyMask + SIZE_4KB) {
>      return PageFaultContext->OriginalHandler;
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-02  5:50 [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data Zhichao Gao
  2019-04-02 15:35 ` Philippe Mathieu-Daudé
@ 2019-04-11  7:20 ` Gao, Zhichao
  1 sibling, 0 replies; 10+ messages in thread
From: Gao, Zhichao @ 2019-04-11  7:20 UTC (permalink / raw)
  To: Gao, Zhichao, devel@edk2.groups.io
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star, Ni, Ray,
	Wang, Jian J, Wu, Hao A, Sean Brogan

Resend to gourps.io. And add the missing people.

Thanks,
Zhichao

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Zhichao Gao
> Sent: Tuesday, April 2, 2019 1:50 PM
> To: edk2-devel@lists.01.org
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> Subject: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> 
> For some pointer and UINT64 data, the debug code print with '%x'.
> Which would loss the upper 32bit data. So update '%x' to '%lx'
> for these data.
> Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> DEBUG_ version is recommended to use.
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Turner <Michael.Turner@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> ---
>  .../CapsulePei/Common/CapsuleCoalesce.c       | 90 +++++++++----------
>  .../Universal/CapsulePei/UefiCapsule.c        | 46 +++++-----
>  .../Universal/CapsulePei/X64/X64Entry.c       |  2 +-
>  3 files changed, 69 insertions(+), 69 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> index 3575a94d0f..2a527054bd 100644
> --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
>    // Sanity Check
>    //
>    if (Size > MAX_ADDRESS) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
> +    DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
>      return FALSE;
>    }
> 
> @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
>    // Sanity Check
>    //
>    if (Address > (MAX_ADDRESS - Size)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> Size(0x%lx))\n", Address, Size));
> +    DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> + Size(0x%lx))\n", Address, Size));
>      return FALSE;
>    }
> 
> @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
>    for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
>      if ((Address >= MemoryResource[Index].PhysicalStart) &&
>          ((Address + Size) <= (MemoryResource[Index].PhysicalStart +
> MemoryResource[Index].ResourceLength))) {
> -      DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> +      DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
>                            Address, Size,
>                            Index, MemoryResource[Index].PhysicalStart,
> MemoryResource[Index].ResourceLength));
>        return TRUE;
>      }
>    }
> 
> -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> MemoryResource\n", Address, Size));
> +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> + MemoryResource\n", Address, Size));
>    return FALSE;
>  }
> 
> @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
>    UINTN                          CapsuleCount;
>    EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
> 
> -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
> 
>    //
>    // Go through the list to look for inconsistencies. Check for:
> @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
>      return NULL;
>    }
> 
> -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));  DEBUG
> + ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));  DEBUG
> + ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> + Ptr->Union.ContinuationPointer));
>    while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer !=
> (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
>      //
>      // Make sure the descriptor is aligned at UINT64 in memory
>      //
>      if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
> -      DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment
> check\n"));
> +      DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment
> + check\n"));
>        return NULL;
>      }
> 
> @@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
>        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
>          return NULL;
>        }
> -      DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
> -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> +      DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", (UINT64)Ptr));
> +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> + Ptr->Union.ContinuationPointer));
>      } else {
>        if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr-
> >Union.DataBlock, Ptr->Length)) {
>          return NULL;
> @@ -375,14 +375,14 @@ ValidateCapsuleIntegrity (
>          // Sanity check
>          //
>          if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
> -          DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) <
> sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> +          DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) <
> + sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
>            return NULL;
>          }
>          //
>          // Make sure HeaderSize field is valid
>          //
>          if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize) {
> -          DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) >
> CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader->HeaderSize,
> CapsuleHeader->CapsuleImageSize));
> +          DEBUG ((DEBUG_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x)
> + > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader-
> >HeaderSize,
> + CapsuleHeader->CapsuleImageSize));
>            return NULL;
>          }
>          if (IsCapsuleCorrupted (CapsuleHeader)) { @@ -395,7 +395,7 @@
> ValidateCapsuleIntegrity (
>        if (CapsuleSize >= Ptr->Length) {
>          CapsuleSize = CapsuleSize - Ptr->Length;
>        } else {
> -        DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr-
> >Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> +        DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) <
> + Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
>          //
>          // Sanity check
>          //
> @@ -409,9 +409,9 @@ ValidateCapsuleIntegrity (
>        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
>          return NULL;
>        }
> -      DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr));
> -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> +      DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%lx\n", (UINT64)Ptr));
> +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> + Ptr->Union.ContinuationPointer));
>      }
>    }
> 
> @@ -419,7 +419,7 @@ ValidateCapsuleIntegrity (
>      //
>      // No any capsule is found in BlockList
>      //
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> CapsuleCount));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> + CapsuleCount));
>      return NULL;
>    }
> 
> @@ -427,7 +427,7 @@ ValidateCapsuleIntegrity (
>      //
>      // Capsule data is incomplete.
>      //
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> CapsuleSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> + CapsuleSize));
>      return NULL;
>    }
> 
> @@ -515,7 +515,7 @@ RelocateBlockDescriptors (
>          }
> 
>          CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN) TempBlockDesc-
> >Union.DataBlock, (UINTN) TempBlockDesc->Length);
> -        DEBUG ((EFI_D_INFO, "Capsule relocate descriptors from/to/size  0x%lX
> 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> +        DEBUG ((DEBUG_INFO, "Capsule relocate descriptors from/to/size
> + 0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> + (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
>          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN)
> RelocBuffer;
>        }
>        TempBlockDesc++;
> @@ -552,7 +552,7 @@ RelocateBlockDescriptors (
>          return NULL;
>        }
>        CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead,
> BlockListSize);
> -      DEBUG ((EFI_D_INFO, "Capsule reloc descriptor block #2\n"));
> +      DEBUG ((DEBUG_INFO, "Capsule reloc descriptor block #2\n"));
>        //
>        // Point the previous block's next point to this copied version. If
>        // the tail pointer is null, then this is the first descriptor block.
> @@ -651,7 +651,7 @@ GetCapsuleInfo (
>    UINTN                          ThisCapsuleImageSize;
>    EFI_CAPSULE_HEADER             *CapsuleHeader;
> 
> -  DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n"));
> +  DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
> 
>    ASSERT (Desc != NULL);
> 
> @@ -673,7 +673,7 @@ GetCapsuleInfo (
>        // While here we need check all capsules size.
>        //
>        if (Desc->Length >= (MAX_ADDRESS - Size)) {
> -        DEBUG ((EFI_D_ERROR, "ERROR: Desc->Length(0x%lx) >=
> (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> +        DEBUG ((DEBUG_ERROR, "ERROR: Desc->Length(0x%lx) >=
> + (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
>          return EFI_OUT_OF_RESOURCES;
>        }
>        Size += (UINTN) Desc->Length;
> @@ -707,7 +707,7 @@ GetCapsuleInfo (
>    // If no descriptors, then fail
>    //
>    if (Count == 0) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n"));
> +    DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
>      return EFI_NOT_FOUND;
>    }
> 
> @@ -787,7 +787,7 @@ CapsuleTestPatternPreCoalesce (
>    UINT32  TestCounter;
>    UINT32  TestSize;
> 
> -  DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n"));
> +  DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
> 
>    //
>    // Find first data descriptor
> @@ -803,7 +803,7 @@ CapsuleTestPatternPreCoalesce (
>    // First one better be long enough to at least hold the test signature
>    //
>    if (Desc->Length < sizeof (UINT32)) {
> -    DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted #1\n"));
> +    DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> + #1\n"));
>      return ;
>    }
> 
> @@ -823,13 +823,13 @@ CapsuleTestPatternPreCoalesce (
>    TestPtr += 2;
>    while (1) {
>      if ((TestSize & 0x03) != 0) {
> -      DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted #2\n"));
> +      DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> + #2\n"));
>        return ;
>      }
> 
>      while (TestSize > 0) {
>        if (*TestPtr != TestCounter) {
> -        DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce failed data
> corruption check\n"));
> +        DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce failed
> + data corruption check\n"));
>          return ;
>        }
> 
> @@ -873,7 +873,7 @@ BuildCapsuleDescriptors (
>    EFI_CAPSULE_BLOCK_DESCRIPTOR     *TempBlock;
>    EFI_CAPSULE_BLOCK_DESCRIPTOR     *HeadBlock;
> 
> -  DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n"));
> +  DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
> 
>    LastBlock         = NULL;
>    HeadBlock         = NULL;
> @@ -904,7 +904,7 @@ BuildCapsuleDescriptors (
>          }
>        }
>      } else {
> -      DEBUG ((EFI_D_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> MAX_ADDRESS\n", BlockListBuffer[Index]));
> +      DEBUG ((DEBUG_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> + MAX_ADDRESS\n", BlockListBuffer[Index]));
>      }
>      Index ++;
>    }
> @@ -1022,7 +1022,7 @@ CapsuleDataCoalesce (
>    EFI_CAPSULE_BLOCK_DESCRIPTOR   *TempBlockDesc;
>    EFI_CAPSULE_BLOCK_DESCRIPTOR   PrivateDataDesc[2];
> 
> -  DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n"));
> +  DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
> 
>    CapsuleIndex     = 0;
>    SizeLeft         = 0;
> @@ -1055,15 +1055,15 @@ CapsuleDataCoalesce (
>    if (EFI_ERROR (Status)) {
>      return Status;
>    }
> -  DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> -  DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> -  DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
> +  DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));  DEBUG
> + ((DEBUG_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));  DEBUG
> + ((DEBUG_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
>    if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber == 0)) {
>      return EFI_NOT_FOUND;
>    }
> 
>    if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof
> (EFI_CAPSULE_PEIM_PRIVATE_DATA)  + sizeof(UINT64))) / sizeof(UINT64)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> CapsuleNumber));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> + CapsuleNumber));
>      return EFI_BUFFER_TOO_SMALL;
>    }
> 
> @@ -1093,7 +1093,7 @@ CapsuleDataCoalesce (
>    // Sanity check
>    //
>    if (CapsuleSize >= (MAX_ADDRESS - (sizeof
> (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> sizeof(UINT64) + sizeof(UINT64)))) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>    //
> @@ -1105,7 +1105,7 @@ CapsuleDataCoalesce (
>    // Sanity check
>    //
>    if (NumDescriptors >= (MAX_ADDRESS /
> sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> NumDescriptors));
> +    DEBUG ((DEBUG_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> + NumDescriptors));
>      return EFI_BUFFER_TOO_SMALL;
>    }
>    DescriptorsSize  = NumDescriptors * sizeof
> (EFI_CAPSULE_BLOCK_DESCRIPTOR); @@ -1113,7 +1113,7 @@
> CapsuleDataCoalesce (
>    // Sanity check
>    //
>    if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize -
> 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize -
> + 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
>      return EFI_BUFFER_TOO_SMALL;
>    }
> 
> @@ -1121,10 +1121,10 @@ CapsuleDataCoalesce (
>    // Don't go below some min address. If the base is below it,
>    // then move it up and adjust the size accordingly.
>    //
> -  DEBUG ((EFI_D_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n",
> (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> +  DEBUG ((DEBUG_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n",
> + (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
>    if ((UINTN)*MemoryBase < (UINTN) MIN_COALESCE_ADDR) {
>      if (((UINTN)*MemoryBase + *MemorySize) < (UINTN)
> MIN_COALESCE_ADDR) {
> -      DEBUG ((EFI_D_ERROR, "ERROR: *MemoryBase + *MemorySize -
> 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> +      DEBUG ((DEBUG_ERROR, "ERROR: *MemoryBase + *MemorySize -
> 0x%x\n",
> + (UINTN)*MemoryBase + *MemorySize));
>        return EFI_BUFFER_TOO_SMALL;
>      } else {
>        *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR -
> (UINTN) *MemoryBase); @@ -1133,13 +1133,13 @@ CapsuleDataCoalesce (
>    }
> 
>    if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
> -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize + DescriptorsSize - 0x%x\n",
> CapsuleSize + DescriptorsSize));
> +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> + 0x%x\n", CapsuleSize + DescriptorsSize));
>      return EFI_BUFFER_TOO_SMALL;
>    }
> 
>    FreeMemBase = *MemoryBase;
>    FreeMemSize = *MemorySize;
> -  DEBUG ((EFI_D_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n",
> (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> +  DEBUG ((DEBUG_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n",
> + (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> 
>    //
>    // Relocate all the block descriptors to low memory to make further @@ -
> 1205,7 +1205,7 @@ CapsuleDataCoalesce (
>          }
> 
>          CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc-
> >Union.DataBlock, (UINTN) TempBlockDesc->Length);
> -        DEBUG ((EFI_D_INFO, "Capsule reloc data block from 0x%8X to 0x%8X
> with size 0x%8X\n",
> +        DEBUG ((DEBUG_INFO, "Capsule reloc data block from 0x%8X to
> + 0x%8X with size 0x%8X\n",
>                  (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) RelocPtr,
> (UINTN) TempBlockDesc->Length));
> 
>          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN)
> RelocPtr; @@ -1256,7 +1256,7 @@ CapsuleDataCoalesce (
>        ASSERT (CurrentBlockDesc->Length <= SizeLeft);
> 
>        CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc-
> >Union.DataBlock), (UINTN)CurrentBlockDesc->Length);
> -      DEBUG ((EFI_D_INFO, "Capsule coalesce block no.0x%lX from 0x%lX to
> 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> +      DEBUG ((DEBUG_INFO, "Capsule coalesce block no.0x%lX from 0x%lX
> + to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
>               CurrentBlockDesc->Union.DataBlock, (UINT64)(UINTN)DestPtr,
> CurrentBlockDesc->Length));
>        DestPtr += CurrentBlockDesc->Length;
>        SizeLeft -= CurrentBlockDesc->Length; diff --git
> a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> index 1131094c4f..f5ec1c20ec 100644
> --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> @@ -427,7 +427,7 @@ ModeSwitch (
>      if (ReservedRangeEnd < MemoryEnd64) {
>        MemoryBase64 = ReservedRangeEnd;
>      } else {
> -      DEBUG ((EFI_D_ERROR, "Memory is not enough to process capsule!\n"));
> +      DEBUG ((DEBUG_ERROR, "Memory is not enough to process
> + capsule!\n"));
>        return EFI_OUT_OF_RESOURCES;
>      }
>    } else if (ReservedRangeBase < MemoryEnd64) { @@ -525,7 +525,7 @@
> FindCapsuleCoalesceImage (
>                             &AuthenticationState
>                             );
>        if (EFI_ERROR (Status)) {
> -        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleX64
> image ffs %r!\n", Status));
> +        DEBUG ((DEBUG_ERROR, "Unable to find PE32 section in CapsuleX64
> + image ffs %r!\n", Status));
>          return Status;
>        }
>        *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *)
> (UINTN) CoalesceImageAddress); @@ -574,7 +574,7 @@
> GetLongModeContext (
>                                    LongModeBuffer
>                                    );
>    if (EFI_ERROR (Status)) {
> -    DEBUG (( EFI_D_ERROR, "Error Get LongModeBuffer variable %r!\n",
> Status));
> +    DEBUG (( DEBUG_ERROR, "Error Get LongModeBuffer variable %r!\n",
> + Status));
>    }
>    return Status;
>  }
> @@ -734,7 +734,7 @@ BuildMemoryResourceDescriptor (
>    }
> 
>    if (Index == 0) {
> -    DEBUG ((EFI_D_INFO | EFI_D_WARN, "No memory resource descriptor
> reported in HOB list before capsule Coalesce\n"));
> +    DEBUG ((DEBUG_INFO | DEBUG_WARN, "No memory resource
> descriptor
> + reported in HOB list before capsule Coalesce\n"));
>  #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
>      //
>      // Allocate memory to hold memory resource descriptor, @@ -746,7
> +746,7 @@ BuildMemoryResourceDescriptor (
> 
>      MemoryResource[0].PhysicalStart = 0;
>      MemoryResource[0].ResourceLength = LShiftU64 (1,
> GetPhysicalAddressBits ());
> -    DEBUG ((EFI_D_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> Length(0x%0lx)\n",
> +    DEBUG ((DEBUG_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> + Length(0x%0lx)\n",
>                          MemoryResource[0x0].PhysicalStart,
> MemoryResource[0x0].ResourceLength));
>      return MemoryResource;
>  #else
> @@ -770,7 +770,7 @@ BuildMemoryResourceDescriptor (
>    while (Hob.Raw != NULL) {
>      ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw;
>      if (ResourceDescriptor->ResourceType ==
> EFI_RESOURCE_SYSTEM_MEMORY) {
> -      DEBUG ((EFI_D_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> Length(0x%0lx)\n",
> +      DEBUG ((DEBUG_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> + Length(0x%0lx)\n",
>                            Index, ResourceDescriptor->PhysicalStart, ResourceDescriptor-
> >ResourceLength));
>        MemoryResource[Index].PhysicalStart = ResourceDescriptor-
> >PhysicalStart;
>        MemoryResource[Index].ResourceLength = ResourceDescriptor-
> >ResourceLength;
> @@ -973,7 +973,7 @@ CapsuleCoalesce (
>    //
>    Status = PeiServicesGetBootMode (&BootMode);
>    if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) {
> -    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update
> path.\n"));
> +    DEBUG ((DEBUG_ERROR, "Boot mode is not correct for capsule update
> + path.\n"));
>      Status = EFI_NOT_FOUND;
>      goto Done;
>    }
> @@ -1016,14 +1016,14 @@ CapsuleCoalesce (
>        //
>        // There is no capsule variables, quit
>        //
> -      DEBUG ((EFI_D_INFO,"Capsule variable Index = %d\n", Index));
> +      DEBUG ((DEBUG_INFO,"Capsule variable Index = %d\n", Index));
>        break;
>      }
>      VariableCount++;
>      Index++;
>    }
> 
> -  DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n", VariableCount));
> +  DEBUG ((DEBUG_INFO,"Capsule variable count = %d\n", VariableCount));
> 
>    //
>    // The last entry is the end flag.
> @@ -1034,7 +1034,7 @@ CapsuleCoalesce (
>               );
> 
>    if (Status != EFI_SUCCESS) {
> -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!, Status = %x\n", Status));
> +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!, Status = %x\n",
> + Status));
>      goto Done;
>    }
> 
> @@ -1046,7 +1046,7 @@ CapsuleCoalesce (
>    //
>    Status = GetCapsuleDescriptors (VariableArrayAddress);
>    if (EFI_ERROR (Status)) {
> -    DEBUG ((EFI_D_ERROR, "Fail to find capsule variables.\n"));
> +    DEBUG ((DEBUG_ERROR, "Fail to find capsule variables.\n"));
>      goto Done;
>    }
> 
> @@ -1064,14 +1064,14 @@ CapsuleCoalesce (
>      CoalesceImageEntryPoint = 0;
>      Status = GetLongModeContext (&LongModeBuffer);
>      if (EFI_ERROR (Status)) {
> -      DEBUG ((EFI_D_ERROR, "Fail to find the variable for long mode
> context!\n"));
> +      DEBUG ((DEBUG_ERROR, "Fail to find the variable for long mode
> + context!\n"));
>        Status = EFI_NOT_FOUND;
>        goto Done;
>      }
> 
>      Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint,
> &CoalesceImageMachineType);
>      if ((EFI_ERROR (Status)) || (CoalesceImageMachineType !=
> EFI_IMAGE_MACHINE_X64)) {
> -      DEBUG ((EFI_D_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
> +      DEBUG ((DEBUG_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
>        Status = EFI_NOT_FOUND;
>        goto Done;
>      }
> @@ -1091,14 +1091,14 @@ CapsuleCoalesce (
>    Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS
> *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase,
> MemorySize);  #endif
> 
> -  DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n", Status));
> +  DEBUG ((DEBUG_INFO, "Capsule Coalesce Status = %r!\n", Status));
> 
>    if (Status == EFI_BUFFER_TOO_SMALL) {
> -    DEBUG ((EFI_D_ERROR, "There is not enough memory to process
> capsule!\n"));
> +    DEBUG ((DEBUG_ERROR, "There is not enough memory to process
> + capsule!\n"));
>    }
> 
>    if (Status == EFI_NOT_FOUND) {
> -    DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in memory!\n"));
> +    DEBUG ((DEBUG_ERROR, "Fail to parse capsule descriptor in
> + memory!\n"));
>      REPORT_STATUS_CODE (
>        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
>        (EFI_SOFTWARE_PEI_MODULE |
> EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
> @@ -1163,7 +1163,7 @@ CapsuleTestPattern (
>    //
>    if (*TestPtr == 0x54534554) {
>      RetValue = TRUE;
> -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode activated...\n"));
> +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode activated...\n"));
>      TestSize = TestPtr[1] / sizeof (UINT32);
>      //
>      // Skip over the signature and the size fields in the pattern data header
> @@ -1172,7 +1172,7 @@ CapsuleTestPattern (
>      TestCounter = 0;
>      while (TestSize > 0) {
>        if (*TestPtr != TestCounter) {
> -        DEBUG ((EFI_D_INFO, "Capsule test pattern mode FAILED:
> BaseAddr/FailAddr 0x%X 0x%X\n",
> (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> (UINT32)(UINTN)TestPtr));
> +        DEBUG ((DEBUG_INFO, "Capsule test pattern mode FAILED:
> + BaseAddr/FailAddr 0x%X 0x%X\n",
> + (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> + (UINT32)(UINTN)TestPtr));
>          return TRUE;
>        }
> 
> @@ -1181,7 +1181,7 @@ CapsuleTestPattern (
>        TestSize--;
>      }
> 
> -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n"));
> +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
>    }
> 
>    return RetValue;
> @@ -1226,11 +1226,11 @@ CreateState (
>      return EFI_VOLUME_CORRUPTED;
>    }
>    if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) {
> -    DEBUG ((EFI_D_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> PrivateData->CapsuleAllImageSize));
> +    DEBUG ((DEBUG_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> + PrivateData->CapsuleAllImageSize));
>      return EFI_OUT_OF_RESOURCES;
>    }
>    if (PrivateData->CapsuleNumber >= MAX_ADDRESS) {
> -    DEBUG ((EFI_D_ERROR, "CapsuleNumber too big - 0x%lx\n", PrivateData-
> >CapsuleNumber));
> +    DEBUG ((DEBUG_ERROR, "CapsuleNumber too big - 0x%lx\n",
> + PrivateData->CapsuleNumber));
>      return EFI_OUT_OF_RESOURCES;
>    }
>    //
> @@ -1248,13 +1248,13 @@ CreateState (
>               );
> 
>    if (Status != EFI_SUCCESS) {
> -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n"));
> +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
>      return Status;
>    }
>    //
>    // Copy to our new buffer for DXE
>    //
> -  DEBUG ((EFI_D_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> sizeof(UINT64)), (UINTN) NewBuffer, Size));
> +  DEBUG ((DEBUG_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> + 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> + sizeof(UINT64)), (UINTN) NewBuffer, Size));
>    CopyMem ((VOID *) (UINTN) NewBuffer, (VOID *) (UINTN) ((UINT8
> *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) +
> (CapsuleNumber - 1) * sizeof(UINT64)), Size);
>    //
>    // Check for test data pattern. If it is the test pattern, then we'll diff --git
> a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> index 40b7095194..2c309990fb 100644
> --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> @@ -174,7 +174,7 @@ PageFaultHandler (
>    AddressEncMask = PageFaultContext->AddressEncMask;
> 
>    PFAddress = AsmReadCr2 ();
> -  DEBUG ((EFI_D_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n",
> PFAddress));
> +  DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n",
> + PFAddress));
> 
>    if (PFAddress >= PhyMask + SIZE_4KB) {
>      return PageFaultContext->OriginalHandler;
> --
> 2.21.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-02 15:35 ` Philippe Mathieu-Daudé
@ 2019-04-11  7:47   ` Gao, Zhichao
  2019-04-11  8:12     ` Wu, Hao A
  0 siblings, 1 reply; 10+ messages in thread
From: Gao, Zhichao @ 2019-04-11  7:47 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, devel@edk2.groups.io
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star, Wu, Hao A,
	Wang, Jian J

Sorry for missing this email.

While I change the code, it couldn't pass the Patchcher.py because of the 'EFI_D_" version MACRO. So I change all the debug message in this driver.
Maybe that is a redundant work.

Thanks,
Zhichao

> -----Original Message-----
> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> Sent: Tuesday, April 2, 2019 11:36 PM
> To: Gao, Zhichao <zhichao.gao@intel.com>; edk2-devel@lists.01.org
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> Zeng, Star <star.zeng@intel.com>
> Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> Hi Bret,
> 
> On 4/2/19 7:50 AM, Zhichao Gao wrote:
> > From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> >
> > For some pointer and UINT64 data, the debug code print with '%x'.
> > Which would loss the upper 32bit data. So update '%x' to '%lx'
> > for these data.
> 
> Some are UINTN. Per Laszlo answer on this thread:
> https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
> for those, casting and changing format is the accepted way.
> 
> However this is a change,
> 
> > Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> > DEBUG_ version is recommended to use.
> 
> and this is another change.
> 
> Splitting this patch in 2 would make it more digestable.
> 
> >
> > Cc: Jian J Wang <jian.j.wang@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Star Zeng <star.zeng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Cc: Sean Brogan <sean.brogan@microsoft.com>
> > Cc: Michael Turner <Michael.Turner@microsoft.com>
> > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> > ---
> >  .../CapsulePei/Common/CapsuleCoalesce.c       | 90 +++++++++----------
> >  .../Universal/CapsulePei/UefiCapsule.c        | 46 +++++-----
> >  .../Universal/CapsulePei/X64/X64Entry.c       |  2 +-
> >  3 files changed, 69 insertions(+), 69 deletions(-)
> >
> > diff --git
> > a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > index 3575a94d0f..2a527054bd 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > +++ b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
> >    // Sanity Check
> >    //
> >    if (Size > MAX_ADDRESS) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n", Size));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > + Size));
> >      return FALSE;
> >    }
> >
> > @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
> >    // Sanity Check
> >    //
> >    if (Address > (MAX_ADDRESS - Size)) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> Size(0x%lx))\n", Address, Size));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > + Size(0x%lx))\n", Address, Size));
> >      return FALSE;
> >    }
> >
> > @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
> >    for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
> >      if ((Address >= MemoryResource[Index].PhysicalStart) &&
> >          ((Address + Size) <= (MemoryResource[Index].PhysicalStart +
> MemoryResource[Index].ResourceLength))) {
> > -      DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > +      DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> > + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> >                            Address, Size,
> >                            Index, MemoryResource[Index].PhysicalStart,
> MemoryResource[Index].ResourceLength));
> >        return TRUE;
> >      }
> >    }
> >
> > -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> > MemoryResource\n", Address, Size));
> > +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> > + MemoryResource\n", Address, Size));
> >    return FALSE;
> >  }
> >
> > @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
> >    UINTN                          CapsuleCount;
> >    EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
> >
> > -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> > +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
> >
> >    //
> >    // Go through the list to look for inconsistencies. Check for:
> > @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
> >      return NULL;
> >    }
> >
> > -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> > -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n",
> > Ptr->Union.ContinuationPointer));
> > +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));  DEBUG
> > + ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));  DEBUG
> > + ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > + Ptr->Union.ContinuationPointer));
> >    while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer !=
> (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
> >      //
> >      // Make sure the descriptor is aligned at UINT64 in memory
> >      //
> >      if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
> > -      DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment
> check\n"));
> > +      DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment
> > + check\n"));
> >        return NULL;
> >      }
> >
> > @@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
> >        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> >          return NULL;
> >        }
> > -      DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
> > -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> > +      DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", (UINT64)Ptr));
> > +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> > +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > + Ptr->Union.ContinuationPointer));
> >      } else {
> >        if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr-
> >Union.DataBlock, Ptr->Length)) {
> >          return NULL;
> > @@ -375,14 +375,14 @@ ValidateCapsuleIntegrity (
> >          // Sanity check
> >          //
> >          if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
> > -          DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) <
> sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> > +          DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) <
> > + sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> >            return NULL;
> >          }
> >          //
> >          // Make sure HeaderSize field is valid
> >          //
> >          if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize)
> {
> > -          DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader->HeaderSize(0x%x) >
> CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader->HeaderSize,
> CapsuleHeader->CapsuleImageSize));
> > +          DEBUG ((DEBUG_ERROR, "ERROR:
> > + CapsuleHeader->HeaderSize(0x%x) >
> > + CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader-
> >HeaderSize,
> > + CapsuleHeader->CapsuleImageSize));
> >            return NULL;
> >          }
> >          if (IsCapsuleCorrupted (CapsuleHeader)) { @@ -395,7 +395,7 @@
> > ValidateCapsuleIntegrity (
> >        if (CapsuleSize >= Ptr->Length) {
> >          CapsuleSize = CapsuleSize - Ptr->Length;
> >        } else {
> > -        DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr-
> >Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> > +        DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) <
> > + Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> >          //
> >          // Sanity check
> >          //
> > @@ -409,9 +409,9 @@ ValidateCapsuleIntegrity (
> >        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> >          return NULL;
> >        }
> > -      DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr));
> > -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> >Union.ContinuationPointer));
> > +      DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%lx\n", (UINT64)Ptr));
> > +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> > +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > + Ptr->Union.ContinuationPointer));
> >      }
> >    }
> >
> > @@ -419,7 +419,7 @@ ValidateCapsuleIntegrity (
> >      //
> >      // No any capsule is found in BlockList
> >      //
> > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> CapsuleCount));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> > + CapsuleCount));
> >      return NULL;
> >    }
> >
> > @@ -427,7 +427,7 @@ ValidateCapsuleIntegrity (
> >      //
> >      // Capsule data is incomplete.
> >      //
> > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> CapsuleSize));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> > + CapsuleSize));
> >      return NULL;
> >    }
> >
> > @@ -515,7 +515,7 @@ RelocateBlockDescriptors (
> >          }
> >
> >          CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN) TempBlockDesc-
> >Union.DataBlock, (UINTN) TempBlockDesc->Length);
> > -        DEBUG ((EFI_D_INFO, "Capsule relocate descriptors from/to/size
> 0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> > +        DEBUG ((DEBUG_INFO, "Capsule relocate descriptors
> > + from/to/size  0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> > + (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> >          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN)
> RelocBuffer;
> >        }
> >        TempBlockDesc++;
> > @@ -552,7 +552,7 @@ RelocateBlockDescriptors (
> >          return NULL;
> >        }
> >        CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead,
> BlockListSize);
> > -      DEBUG ((EFI_D_INFO, "Capsule reloc descriptor block #2\n"));
> > +      DEBUG ((DEBUG_INFO, "Capsule reloc descriptor block #2\n"));
> >        //
> >        // Point the previous block's next point to this copied version. If
> >        // the tail pointer is null, then this is the first descriptor block.
> > @@ -651,7 +651,7 @@ GetCapsuleInfo (
> >    UINTN                          ThisCapsuleImageSize;
> >    EFI_CAPSULE_HEADER             *CapsuleHeader;
> >
> > -  DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n"));
> > +  DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
> >
> >    ASSERT (Desc != NULL);
> >
> > @@ -673,7 +673,7 @@ GetCapsuleInfo (
> >        // While here we need check all capsules size.
> >        //
> >        if (Desc->Length >= (MAX_ADDRESS - Size)) {
> > -        DEBUG ((EFI_D_ERROR, "ERROR: Desc->Length(0x%lx) >=
> (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> > +        DEBUG ((DEBUG_ERROR, "ERROR: Desc->Length(0x%lx) >=
> > + (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> >          return EFI_OUT_OF_RESOURCES;
> >        }
> >        Size += (UINTN) Desc->Length;
> > @@ -707,7 +707,7 @@ GetCapsuleInfo (
> >    // If no descriptors, then fail
> >    //
> >    if (Count == 0) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n"));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
> >      return EFI_NOT_FOUND;
> >    }
> >
> > @@ -787,7 +787,7 @@ CapsuleTestPatternPreCoalesce (
> >    UINT32  TestCounter;
> >    UINT32  TestSize;
> >
> > -  DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n"));
> > +  DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
> >
> >    //
> >    // Find first data descriptor
> > @@ -803,7 +803,7 @@ CapsuleTestPatternPreCoalesce (
> >    // First one better be long enough to at least hold the test signature
> >    //
> >    if (Desc->Length < sizeof (UINT32)) {
> > -    DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted
> #1\n"));
> > +    DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> > + #1\n"));
> >      return ;
> >    }
> >
> > @@ -823,13 +823,13 @@ CapsuleTestPatternPreCoalesce (
> >    TestPtr += 2;
> >    while (1) {
> >      if ((TestSize & 0x03) != 0) {
> > -      DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted
> #2\n"));
> > +      DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> > + #2\n"));
> >        return ;
> >      }
> >
> >      while (TestSize > 0) {
> >        if (*TestPtr != TestCounter) {
> > -        DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce failed data
> corruption check\n"));
> > +        DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce failed
> > + data corruption check\n"));
> >          return ;
> >        }
> >
> > @@ -873,7 +873,7 @@ BuildCapsuleDescriptors (
> >    EFI_CAPSULE_BLOCK_DESCRIPTOR     *TempBlock;
> >    EFI_CAPSULE_BLOCK_DESCRIPTOR     *HeadBlock;
> >
> > -  DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n"));
> > +  DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
> >
> >    LastBlock         = NULL;
> >    HeadBlock         = NULL;
> > @@ -904,7 +904,7 @@ BuildCapsuleDescriptors (
> >          }
> >        }
> >      } else {
> > -      DEBUG ((EFI_D_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> MAX_ADDRESS\n", BlockListBuffer[Index]));
> > +      DEBUG ((DEBUG_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> > + MAX_ADDRESS\n", BlockListBuffer[Index]));
> >      }
> >      Index ++;
> >    }
> > @@ -1022,7 +1022,7 @@ CapsuleDataCoalesce (
> >    EFI_CAPSULE_BLOCK_DESCRIPTOR   *TempBlockDesc;
> >    EFI_CAPSULE_BLOCK_DESCRIPTOR   PrivateDataDesc[2];
> >
> > -  DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n"));
> > +  DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
> >
> >    CapsuleIndex     = 0;
> >    SizeLeft         = 0;
> > @@ -1055,15 +1055,15 @@ CapsuleDataCoalesce (
> >    if (EFI_ERROR (Status)) {
> >      return Status;
> >    }
> > -  DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> > -  DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> > -  DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
> > +  DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));  DEBUG
> > + ((DEBUG_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> 
> This is confuse CapsuleNumber is declared UINT64 in
> MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h and we
> use a UINTN here. Why not keep UINT64 and use "%lx"?
> 
> > +  DEBUG ((DEBUG_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
> >    if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber == 0))
> {
> >      return EFI_NOT_FOUND;
> >    }
> >
> >    if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof
> (EFI_CAPSULE_PEIM_PRIVATE_DATA)  + sizeof(UINT64))) / sizeof(UINT64)) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> CapsuleNumber));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> > + CapsuleNumber));
> >      return EFI_BUFFER_TOO_SMALL;
> >    }
> >
> > @@ -1093,7 +1093,7 @@ CapsuleDataCoalesce (
> >    // Sanity check
> >    //
> >    if (CapsuleSize >= (MAX_ADDRESS - (sizeof
> (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> sizeof(UINT64) + sizeof(UINT64)))) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize - 0x%x\n",
> > + CapsuleSize));
> >      return EFI_BUFFER_TOO_SMALL;
> >    }
> >    //
> > @@ -1105,7 +1105,7 @@ CapsuleDataCoalesce (
> >    // Sanity check
> >    //
> >    if (NumDescriptors >= (MAX_ADDRESS /
> sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> NumDescriptors));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> > + NumDescriptors));
> >      return EFI_BUFFER_TOO_SMALL;
> >    }
> >    DescriptorsSize  = NumDescriptors * sizeof
> > (EFI_CAPSULE_BLOCK_DESCRIPTOR); @@ -1113,7 +1113,7 @@
> CapsuleDataCoalesce (
> >    // Sanity check
> >    //
> >    if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize -
> 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize
> > + - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> >      return EFI_BUFFER_TOO_SMALL;
> >    }
> >
> > @@ -1121,10 +1121,10 @@ CapsuleDataCoalesce (
> >    // Don't go below some min address. If the base is below it,
> >    // then move it up and adjust the size accordingly.
> >    //
> > -  DEBUG ((EFI_D_INFO, "Capsule Memory range from 0x%8X to 0x%8X\n",
> > (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> > +  DEBUG ((DEBUG_INFO, "Capsule Memory range from 0x%8X to
> 0x%8X\n",
> > + (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> 
> Don't you also want to cast to UINT64 and use "%lX" here?
> 
> >    if ((UINTN)*MemoryBase < (UINTN) MIN_COALESCE_ADDR) {
> >      if (((UINTN)*MemoryBase + *MemorySize) < (UINTN)
> MIN_COALESCE_ADDR) {
> > -      DEBUG ((EFI_D_ERROR, "ERROR: *MemoryBase + *MemorySize -
> 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> > +      DEBUG ((DEBUG_ERROR, "ERROR: *MemoryBase + *MemorySize -
> > + 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> >        return EFI_BUFFER_TOO_SMALL;
> >      } else {
> >        *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR -
> > (UINTN) *MemoryBase); @@ -1133,13 +1133,13 @@ CapsuleDataCoalesce
> (
> >    }
> >
> >    if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
> > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> 0x%x\n", CapsuleSize + DescriptorsSize));
> > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> > + 0x%x\n", CapsuleSize + DescriptorsSize));
> >      return EFI_BUFFER_TOO_SMALL;
> >    }
> >
> >    FreeMemBase = *MemoryBase;
> >    FreeMemSize = *MemorySize;
> > -  DEBUG ((EFI_D_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n",
> > (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> > +  DEBUG ((DEBUG_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n",
> > + (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> >
> >    //
> >    // Relocate all the block descriptors to low memory to make further
> > @@ -1205,7 +1205,7 @@ CapsuleDataCoalesce (
> >          }
> >
> >          CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc-
> >Union.DataBlock, (UINTN) TempBlockDesc->Length);
> > -        DEBUG ((EFI_D_INFO, "Capsule reloc data block from 0x%8X to 0x%8X
> with size 0x%8X\n",
> > +        DEBUG ((DEBUG_INFO, "Capsule reloc data block from 0x%8X to
> > + 0x%8X with size 0x%8X\n",
> >                  (UINTN) TempBlockDesc->Union.DataBlock, (UINTN)
> > RelocPtr, (UINTN) TempBlockDesc->Length));
> >
> >          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS)
> > (UINTN) RelocPtr; @@ -1256,7 +1256,7 @@ CapsuleDataCoalesce (
> >        ASSERT (CurrentBlockDesc->Length <= SizeLeft);
> >
> >        CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc-
> >Union.DataBlock), (UINTN)CurrentBlockDesc->Length);
> > -      DEBUG ((EFI_D_INFO, "Capsule coalesce block no.0x%lX from 0x%lX to
> 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> > +      DEBUG ((DEBUG_INFO, "Capsule coalesce block no.0x%lX from 0x%lX
> > + to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> >               CurrentBlockDesc->Union.DataBlock, (UINT64)(UINTN)DestPtr,
> CurrentBlockDesc->Length));
> >        DestPtr += CurrentBlockDesc->Length;
> >        SizeLeft -= CurrentBlockDesc->Length; diff --git
> > a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > index 1131094c4f..f5ec1c20ec 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > @@ -427,7 +427,7 @@ ModeSwitch (
> >      if (ReservedRangeEnd < MemoryEnd64) {
> >        MemoryBase64 = ReservedRangeEnd;
> >      } else {
> > -      DEBUG ((EFI_D_ERROR, "Memory is not enough to process
> capsule!\n"));
> > +      DEBUG ((DEBUG_ERROR, "Memory is not enough to process
> > + capsule!\n"));
> >        return EFI_OUT_OF_RESOURCES;
> >      }
> >    } else if (ReservedRangeBase < MemoryEnd64) { @@ -525,7 +525,7 @@
> > FindCapsuleCoalesceImage (
> >                             &AuthenticationState
> >                             );
> >        if (EFI_ERROR (Status)) {
> > -        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleX64
> image ffs %r!\n", Status));
> > +        DEBUG ((DEBUG_ERROR, "Unable to find PE32 section in
> > + CapsuleX64 image ffs %r!\n", Status));
> >          return Status;
> >        }
> >        *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID
> > *) (UINTN) CoalesceImageAddress); @@ -574,7 +574,7 @@
> GetLongModeContext (
> >                                    LongModeBuffer
> >                                    );
> >    if (EFI_ERROR (Status)) {
> > -    DEBUG (( EFI_D_ERROR, "Error Get LongModeBuffer variable %r!\n",
> Status));
> > +    DEBUG (( DEBUG_ERROR, "Error Get LongModeBuffer variable %r!\n",
> > + Status));
> >    }
> >    return Status;
> >  }
> > @@ -734,7 +734,7 @@ BuildMemoryResourceDescriptor (
> >    }
> >
> >    if (Index == 0) {
> > -    DEBUG ((EFI_D_INFO | EFI_D_WARN, "No memory resource descriptor
> reported in HOB list before capsule Coalesce\n"));
> > +    DEBUG ((DEBUG_INFO | DEBUG_WARN, "No memory resource
> descriptor
> > + reported in HOB list before capsule Coalesce\n"));
> >  #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
> >      //
> >      // Allocate memory to hold memory resource descriptor, @@ -746,7
> > +746,7 @@ BuildMemoryResourceDescriptor (
> >
> >      MemoryResource[0].PhysicalStart = 0;
> >      MemoryResource[0].ResourceLength = LShiftU64 (1,
> GetPhysicalAddressBits ());
> > -    DEBUG ((EFI_D_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> Length(0x%0lx)\n",
> > +    DEBUG ((DEBUG_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> > + Length(0x%0lx)\n",
> >                          MemoryResource[0x0].PhysicalStart,
> MemoryResource[0x0].ResourceLength));
> >      return MemoryResource;
> >  #else
> > @@ -770,7 +770,7 @@ BuildMemoryResourceDescriptor (
> >    while (Hob.Raw != NULL) {
> >      ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw;
> >      if (ResourceDescriptor->ResourceType ==
> EFI_RESOURCE_SYSTEM_MEMORY) {
> > -      DEBUG ((EFI_D_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> Length(0x%0lx)\n",
> > +      DEBUG ((DEBUG_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> > + Length(0x%0lx)\n",
> >                            Index, ResourceDescriptor->PhysicalStart,
> ResourceDescriptor->ResourceLength));
> >        MemoryResource[Index].PhysicalStart = ResourceDescriptor-
> >PhysicalStart;
> >        MemoryResource[Index].ResourceLength =
> > ResourceDescriptor->ResourceLength;
> > @@ -973,7 +973,7 @@ CapsuleCoalesce (
> >    //
> >    Status = PeiServicesGetBootMode (&BootMode);
> >    if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) {
> > -    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update
> path.\n"));
> > +    DEBUG ((DEBUG_ERROR, "Boot mode is not correct for capsule update
> > + path.\n"));
> >      Status = EFI_NOT_FOUND;
> >      goto Done;
> >    }
> > @@ -1016,14 +1016,14 @@ CapsuleCoalesce (
> >        //
> >        // There is no capsule variables, quit
> >        //
> > -      DEBUG ((EFI_D_INFO,"Capsule variable Index = %d\n", Index));
> > +      DEBUG ((DEBUG_INFO,"Capsule variable Index = %d\n", Index));
> >        break;
> >      }
> >      VariableCount++;
> >      Index++;
> >    }
> >
> > -  DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n",
> > VariableCount));
> > +  DEBUG ((DEBUG_INFO,"Capsule variable count = %d\n",
> > + VariableCount));
> >
> >    //
> >    // The last entry is the end flag.
> > @@ -1034,7 +1034,7 @@ CapsuleCoalesce (
> >               );
> >
> >    if (Status != EFI_SUCCESS) {
> > -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!, Status = %x\n", Status));
> > +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!, Status = %x\n",
> > + Status));
> >      goto Done;
> >    }
> >
> > @@ -1046,7 +1046,7 @@ CapsuleCoalesce (
> >    //
> >    Status = GetCapsuleDescriptors (VariableArrayAddress);
> >    if (EFI_ERROR (Status)) {
> > -    DEBUG ((EFI_D_ERROR, "Fail to find capsule variables.\n"));
> > +    DEBUG ((DEBUG_ERROR, "Fail to find capsule variables.\n"));
> >      goto Done;
> >    }
> >
> > @@ -1064,14 +1064,14 @@ CapsuleCoalesce (
> >      CoalesceImageEntryPoint = 0;
> >      Status = GetLongModeContext (&LongModeBuffer);
> >      if (EFI_ERROR (Status)) {
> > -      DEBUG ((EFI_D_ERROR, "Fail to find the variable for long mode
> context!\n"));
> > +      DEBUG ((DEBUG_ERROR, "Fail to find the variable for long mode
> > + context!\n"));
> >        Status = EFI_NOT_FOUND;
> >        goto Done;
> >      }
> >
> >      Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint,
> &CoalesceImageMachineType);
> >      if ((EFI_ERROR (Status)) || (CoalesceImageMachineType !=
> EFI_IMAGE_MACHINE_X64)) {
> > -      DEBUG ((EFI_D_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
> > +      DEBUG ((DEBUG_ERROR, "Fail to find CapsuleX64 module in
> > + FV!\n"));
> >        Status = EFI_NOT_FOUND;
> >        goto Done;
> >      }
> > @@ -1091,14 +1091,14 @@ CapsuleCoalesce (
> >    Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS
> > *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase,
> > MemorySize);  #endif
> >
> > -  DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n", Status));
> > +  DEBUG ((DEBUG_INFO, "Capsule Coalesce Status = %r!\n", Status));
> >
> >    if (Status == EFI_BUFFER_TOO_SMALL) {
> > -    DEBUG ((EFI_D_ERROR, "There is not enough memory to process
> capsule!\n"));
> > +    DEBUG ((DEBUG_ERROR, "There is not enough memory to process
> > + capsule!\n"));
> >    }
> >
> >    if (Status == EFI_NOT_FOUND) {
> > -    DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in
> memory!\n"));
> > +    DEBUG ((DEBUG_ERROR, "Fail to parse capsule descriptor in
> > + memory!\n"));
> >      REPORT_STATUS_CODE (
> >        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
> >        (EFI_SOFTWARE_PEI_MODULE |
> > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
> > @@ -1163,7 +1163,7 @@ CapsuleTestPattern (
> >    //
> >    if (*TestPtr == 0x54534554) {
> >      RetValue = TRUE;
> > -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode activated...\n"));
> > +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode activated...\n"));
> >      TestSize = TestPtr[1] / sizeof (UINT32);
> >      //
> >      // Skip over the signature and the size fields in the pattern
> > data header @@ -1172,7 +1172,7 @@ CapsuleTestPattern (
> >      TestCounter = 0;
> >      while (TestSize > 0) {
> >        if (*TestPtr != TestCounter) {
> > -        DEBUG ((EFI_D_INFO, "Capsule test pattern mode FAILED:
> BaseAddr/FailAddr 0x%X 0x%X\n",
> (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> (UINT32)(UINTN)TestPtr));
> > +        DEBUG ((DEBUG_INFO, "Capsule test pattern mode FAILED:
> > + BaseAddr/FailAddr 0x%X 0x%X\n",
> > + (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> > + (UINT32)(UINTN)TestPtr));
> >          return TRUE;
> >        }
> >
> > @@ -1181,7 +1181,7 @@ CapsuleTestPattern (
> >        TestSize--;
> >      }
> >
> > -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n"));
> > +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
> >    }
> >
> >    return RetValue;
> > @@ -1226,11 +1226,11 @@ CreateState (
> >      return EFI_VOLUME_CORRUPTED;
> >    }
> >    if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) {
> > -    DEBUG ((EFI_D_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> PrivateData->CapsuleAllImageSize));
> > +    DEBUG ((DEBUG_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> > + PrivateData->CapsuleAllImageSize));
> >      return EFI_OUT_OF_RESOURCES;
> >    }
> >    if (PrivateData->CapsuleNumber >= MAX_ADDRESS) {
> > -    DEBUG ((EFI_D_ERROR, "CapsuleNumber too big - 0x%lx\n",
> PrivateData->CapsuleNumber));
> > +    DEBUG ((DEBUG_ERROR, "CapsuleNumber too big - 0x%lx\n",
> > + PrivateData->CapsuleNumber));
> >      return EFI_OUT_OF_RESOURCES;
> >    }
> >    //
> > @@ -1248,13 +1248,13 @@ CreateState (
> >               );
> >
> >    if (Status != EFI_SUCCESS) {
> > -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n"));
> > +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
> >      return Status;
> >    }
> >    //
> >    // Copy to our new buffer for DXE
> >    //
> > -  DEBUG ((EFI_D_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> > 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> > sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > sizeof(UINT64)), (UINTN) NewBuffer, Size));
> > +  DEBUG ((DEBUG_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> > + 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> > + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > + sizeof(UINT64)), (UINTN) NewBuffer, Size));
> >    CopyMem ((VOID *) (UINTN) NewBuffer, (VOID *) (UINTN) ((UINT8
> *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) +
> (CapsuleNumber - 1) * sizeof(UINT64)), Size);
> >    //
> >    // Check for test data pattern. If it is the test pattern, then
> > we'll diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > index 40b7095194..2c309990fb 100644
> > --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > @@ -174,7 +174,7 @@ PageFaultHandler (
> >    AddressEncMask = PageFaultContext->AddressEncMask;
> >
> >    PFAddress = AsmReadCr2 ();
> > -  DEBUG ((EFI_D_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n",
> > PFAddress));
> > +  DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n",
> > + PFAddress));
> >
> >    if (PFAddress >= PhyMask + SIZE_4KB) {
> >      return PageFaultContext->OriginalHandler;
> >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-11  7:47   ` [edk2] " Gao, Zhichao
@ 2019-04-11  8:12     ` Wu, Hao A
  2019-04-11  9:33       ` Gao, Zhichao
  0 siblings, 1 reply; 10+ messages in thread
From: Wu, Hao A @ 2019-04-11  8:12 UTC (permalink / raw)
  To: Gao, Zhichao, Philippe Mathieu-Daudé, devel@edk2.groups.io
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star,
	Wang, Jian J

> -----Original Message-----
> From: Gao, Zhichao
> Sent: Thursday, April 11, 2019 3:47 PM
> To: Philippe Mathieu-Daudé; devel@edk2.groups.io
> Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao A; Wang,
> Jian J
> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> Sorry for missing this email.
> 
> While I change the code, it couldn't pass the Patchcher.py because of the
> 'EFI_D_" version MACRO. So I change all the debug message in this driver.
> Maybe that is a redundant work.

Hello Zhichao,

For this case, you can work out a first patch to replace all the macros
starting with 'EFI_D_' with 'DEBUG_'. And a second patch to address the real
issue.

> 
> Thanks,
> Zhichao
> 
> > -----Original Message-----
> > From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> > Sent: Tuesday, April 2, 2019 11:36 PM
> > To: Gao, Zhichao <zhichao.gao@intel.com>; edk2-devel@lists.01.org
> > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> > <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> > Zeng, Star <star.zeng@intel.com>
> > Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> debug
> > code to print 64bit data
> >
> > Hi Bret,
> >
> > On 4/2/19 7:50 AM, Zhichao Gao wrote:
> > > From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> > >
> > > For some pointer and UINT64 data, the debug code print with '%x'.
> > > Which would loss the upper 32bit data. So update '%x' to '%lx'
> > > for these data.
> >
> > Some are UINTN. Per Laszlo answer on this thread:
> > https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
> > for those, casting and changing format is the accepted way.

After a skim of the patch, I think there seems only 2 cases that are
handled in this patch:

1. UINT64
For this one, the change in this patch looks good to me.

2. Pointers
I think we can directly use '%p' for pointers.

If I happen to miss other cases, please do follow the above link to handle
UINTN.


Best Regards,
Hao Wu

> >
> > However this is a change,
> >
> > > Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> > > DEBUG_ version is recommended to use.
> >
> > and this is another change.
> >
> > Splitting this patch in 2 would make it more digestable.
> >
> > >
> > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > Cc: Ray Ni <ray.ni@intel.com>
> > > Cc: Star Zeng <star.zeng@intel.com>
> > > Cc: Liming Gao <liming.gao@intel.com>
> > > Cc: Sean Brogan <sean.brogan@microsoft.com>
> > > Cc: Michael Turner <Michael.Turner@microsoft.com>
> > > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> > > ---
> > >  .../CapsulePei/Common/CapsuleCoalesce.c       | 90 +++++++++----------
> > >  .../Universal/CapsulePei/UefiCapsule.c        | 46 +++++-----
> > >  .../Universal/CapsulePei/X64/X64Entry.c       |  2 +-
> > >  3 files changed, 69 insertions(+), 69 deletions(-)
> > >
> > > diff --git
> > > a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > index 3575a94d0f..2a527054bd 100644
> > > --- a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > +++
> b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
> > >    // Sanity Check
> > >    //
> > >    if (Size > MAX_ADDRESS) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> Size));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > > + Size));
> > >      return FALSE;
> > >    }
> > >
> > > @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
> > >    // Sanity Check
> > >    //
> > >    if (Address > (MAX_ADDRESS - Size)) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > Size(0x%lx))\n", Address, Size));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > > + Size(0x%lx))\n", Address, Size));
> > >      return FALSE;
> > >    }
> > >
> > > @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
> > >    for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++)
> {
> > >      if ((Address >= MemoryResource[Index].PhysicalStart) &&
> > >          ((Address + Size) <= (MemoryResource[Index].PhysicalStart +
> > MemoryResource[Index].ResourceLength))) {
> > > -      DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> > MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > > +      DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> > > + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > >                            Address, Size,
> > >                            Index, MemoryResource[Index].PhysicalStart,
> > MemoryResource[Index].ResourceLength));
> > >        return TRUE;
> > >      }
> > >    }
> > >
> > > -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in any
> > > MemoryResource\n", Address, Size));
> > > +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in
> any
> > > + MemoryResource\n", Address, Size));
> > >    return FALSE;
> > >  }
> > >
> > > @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
> > >    UINTN                          CapsuleCount;
> > >    EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
> > >
> > > -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> > > +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
> > >
> > >    //
> > >    // Go through the list to look for inconsistencies. Check for:
> > > @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
> > >      return NULL;
> > >    }
> > >
> > > -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> > > -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > > -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n",
> > > Ptr->Union.ContinuationPointer));
> > > +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));  DEBUG
> > > + ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));  DEBUG
> > > + ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > > + Ptr->Union.ContinuationPointer));
> > >    while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer !=
> > (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
> > >      //
> > >      // Make sure the descriptor is aligned at UINT64 in memory
> > >      //
> > >      if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
> > > -      DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment
> > check\n"));
> > > +      DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed alignment
> > > + check\n"));
> > >        return NULL;
> > >      }
> > >
> > > @@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
> > >        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> > (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> > (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > >          return NULL;
> > >        }
> > > -      DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
> > > -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > > -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> > >Union.ContinuationPointer));
> > > +      DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", (UINT64)Ptr));
> > > +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> > > +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > > + Ptr->Union.ContinuationPointer));
> > >      } else {
> > >        if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr-
> > >Union.DataBlock, Ptr->Length)) {
> > >          return NULL;
> > > @@ -375,14 +375,14 @@ ValidateCapsuleIntegrity (
> > >          // Sanity check
> > >          //
> > >          if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
> > > -          DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) <
> > sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> > > +          DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) <
> > > + sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> > >            return NULL;
> > >          }
> > >          //
> > >          // Make sure HeaderSize field is valid
> > >          //
> > >          if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize)
> > {
> > > -          DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader-
> >HeaderSize(0x%x) >
> > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader-
> >HeaderSize,
> > CapsuleHeader->CapsuleImageSize));
> > > +          DEBUG ((DEBUG_ERROR, "ERROR:
> > > + CapsuleHeader->HeaderSize(0x%x) >
> > > + CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader-
> > >HeaderSize,
> > > + CapsuleHeader->CapsuleImageSize));
> > >            return NULL;
> > >          }
> > >          if (IsCapsuleCorrupted (CapsuleHeader)) { @@ -395,7 +395,7 @@
> > > ValidateCapsuleIntegrity (
> > >        if (CapsuleSize >= Ptr->Length) {
> > >          CapsuleSize = CapsuleSize - Ptr->Length;
> > >        } else {
> > > -        DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr-
> > >Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> > > +        DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) <
> > > + Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> > >          //
> > >          // Sanity check
> > >          //
> > > @@ -409,9 +409,9 @@ ValidateCapsuleIntegrity (
> > >        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> > (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> > (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > >          return NULL;
> > >        }
> > > -      DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr));
> > > -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > > -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> > >Union.ContinuationPointer));
> > > +      DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%lx\n", (UINT64)Ptr));
> > > +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> > > +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > > + Ptr->Union.ContinuationPointer));
> > >      }
> > >    }
> > >
> > > @@ -419,7 +419,7 @@ ValidateCapsuleIntegrity (
> > >      //
> > >      // No any capsule is found in BlockList
> > >      //
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> > CapsuleCount));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> > > + CapsuleCount));
> > >      return NULL;
> > >    }
> > >
> > > @@ -427,7 +427,7 @@ ValidateCapsuleIntegrity (
> > >      //
> > >      // Capsule data is incomplete.
> > >      //
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> > CapsuleSize));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> > > + CapsuleSize));
> > >      return NULL;
> > >    }
> > >
> > > @@ -515,7 +515,7 @@ RelocateBlockDescriptors (
> > >          }
> > >
> > >          CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN) TempBlockDesc-
> > >Union.DataBlock, (UINTN) TempBlockDesc->Length);
> > > -        DEBUG ((EFI_D_INFO, "Capsule relocate descriptors from/to/size
> > 0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> > (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> > > +        DEBUG ((DEBUG_INFO, "Capsule relocate descriptors
> > > + from/to/size  0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> > > + (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> > >          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS)
> (UINTN)
> > RelocBuffer;
> > >        }
> > >        TempBlockDesc++;
> > > @@ -552,7 +552,7 @@ RelocateBlockDescriptors (
> > >          return NULL;
> > >        }
> > >        CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead,
> > BlockListSize);
> > > -      DEBUG ((EFI_D_INFO, "Capsule reloc descriptor block #2\n"));
> > > +      DEBUG ((DEBUG_INFO, "Capsule reloc descriptor block #2\n"));
> > >        //
> > >        // Point the previous block's next point to this copied version. If
> > >        // the tail pointer is null, then this is the first descriptor block.
> > > @@ -651,7 +651,7 @@ GetCapsuleInfo (
> > >    UINTN                          ThisCapsuleImageSize;
> > >    EFI_CAPSULE_HEADER             *CapsuleHeader;
> > >
> > > -  DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n"));
> > > +  DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
> > >
> > >    ASSERT (Desc != NULL);
> > >
> > > @@ -673,7 +673,7 @@ GetCapsuleInfo (
> > >        // While here we need check all capsules size.
> > >        //
> > >        if (Desc->Length >= (MAX_ADDRESS - Size)) {
> > > -        DEBUG ((EFI_D_ERROR, "ERROR: Desc->Length(0x%lx) >=
> > (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> > > +        DEBUG ((DEBUG_ERROR, "ERROR: Desc->Length(0x%lx) >=
> > > + (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> > >          return EFI_OUT_OF_RESOURCES;
> > >        }
> > >        Size += (UINTN) Desc->Length;
> > > @@ -707,7 +707,7 @@ GetCapsuleInfo (
> > >    // If no descriptors, then fail
> > >    //
> > >    if (Count == 0) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n"));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
> > >      return EFI_NOT_FOUND;
> > >    }
> > >
> > > @@ -787,7 +787,7 @@ CapsuleTestPatternPreCoalesce (
> > >    UINT32  TestCounter;
> > >    UINT32  TestSize;
> > >
> > > -  DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n"));
> > > +  DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
> > >
> > >    //
> > >    // Find first data descriptor
> > > @@ -803,7 +803,7 @@ CapsuleTestPatternPreCoalesce (
> > >    // First one better be long enough to at least hold the test signature
> > >    //
> > >    if (Desc->Length < sizeof (UINT32)) {
> > > -    DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted
> > #1\n"));
> > > +    DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> > > + #1\n"));
> > >      return ;
> > >    }
> > >
> > > @@ -823,13 +823,13 @@ CapsuleTestPatternPreCoalesce (
> > >    TestPtr += 2;
> > >    while (1) {
> > >      if ((TestSize & 0x03) != 0) {
> > > -      DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted
> > #2\n"));
> > > +      DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> > > + #2\n"));
> > >        return ;
> > >      }
> > >
> > >      while (TestSize > 0) {
> > >        if (*TestPtr != TestCounter) {
> > > -        DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce failed data
> > corruption check\n"));
> > > +        DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce failed
> > > + data corruption check\n"));
> > >          return ;
> > >        }
> > >
> > > @@ -873,7 +873,7 @@ BuildCapsuleDescriptors (
> > >    EFI_CAPSULE_BLOCK_DESCRIPTOR     *TempBlock;
> > >    EFI_CAPSULE_BLOCK_DESCRIPTOR     *HeadBlock;
> > >
> > > -  DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n"));
> > > +  DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
> > >
> > >    LastBlock         = NULL;
> > >    HeadBlock         = NULL;
> > > @@ -904,7 +904,7 @@ BuildCapsuleDescriptors (
> > >          }
> > >        }
> > >      } else {
> > > -      DEBUG ((EFI_D_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> > MAX_ADDRESS\n", BlockListBuffer[Index]));
> > > +      DEBUG ((DEBUG_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> > > + MAX_ADDRESS\n", BlockListBuffer[Index]));
> > >      }
> > >      Index ++;
> > >    }
> > > @@ -1022,7 +1022,7 @@ CapsuleDataCoalesce (
> > >    EFI_CAPSULE_BLOCK_DESCRIPTOR   *TempBlockDesc;
> > >    EFI_CAPSULE_BLOCK_DESCRIPTOR   PrivateDataDesc[2];
> > >
> > > -  DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n"));
> > > +  DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
> > >
> > >    CapsuleIndex     = 0;
> > >    SizeLeft         = 0;
> > > @@ -1055,15 +1055,15 @@ CapsuleDataCoalesce (
> > >    if (EFI_ERROR (Status)) {
> > >      return Status;
> > >    }
> > > -  DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> > > -  DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> > > -  DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
> > > +  DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));  DEBUG
> > > + ((DEBUG_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> >
> > This is confuse CapsuleNumber is declared UINT64 in
> > MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h and
> we
> > use a UINTN here. Why not keep UINT64 and use "%lx"?
> >
> > > +  DEBUG ((DEBUG_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
> > >    if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber ==
> 0))
> > {
> > >      return EFI_NOT_FOUND;
> > >    }
> > >
> > >    if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof
> > (EFI_CAPSULE_PEIM_PRIVATE_DATA)  + sizeof(UINT64))) / sizeof(UINT64))
> {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> > CapsuleNumber));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> > > + CapsuleNumber));
> > >      return EFI_BUFFER_TOO_SMALL;
> > >    }
> > >
> > > @@ -1093,7 +1093,7 @@ CapsuleDataCoalesce (
> > >    // Sanity check
> > >    //
> > >    if (CapsuleSize >= (MAX_ADDRESS - (sizeof
> > (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > sizeof(UINT64) + sizeof(UINT64)))) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize - 0x%x\n", CapsuleSize));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize - 0x%x\n",
> > > + CapsuleSize));
> > >      return EFI_BUFFER_TOO_SMALL;
> > >    }
> > >    //
> > > @@ -1105,7 +1105,7 @@ CapsuleDataCoalesce (
> > >    // Sanity check
> > >    //
> > >    if (NumDescriptors >= (MAX_ADDRESS /
> > sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> > NumDescriptors));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> > > + NumDescriptors));
> > >      return EFI_BUFFER_TOO_SMALL;
> > >    }
> > >    DescriptorsSize  = NumDescriptors * sizeof
> > > (EFI_CAPSULE_BLOCK_DESCRIPTOR); @@ -1113,7 +1113,7 @@
> > CapsuleDataCoalesce (
> > >    // Sanity check
> > >    //
> > >    if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize -
> > 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: DescriptorsSize - 0x%lx,
> CapsuleSize
> > > + - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> > >      return EFI_BUFFER_TOO_SMALL;
> > >    }
> > >
> > > @@ -1121,10 +1121,10 @@ CapsuleDataCoalesce (
> > >    // Don't go below some min address. If the base is below it,
> > >    // then move it up and adjust the size accordingly.
> > >    //
> > > -  DEBUG ((EFI_D_INFO, "Capsule Memory range from 0x%8X to
> 0x%8X\n",
> > > (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> > > +  DEBUG ((DEBUG_INFO, "Capsule Memory range from 0x%8X to
> > 0x%8X\n",
> > > + (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> >
> > Don't you also want to cast to UINT64 and use "%lX" here?
> >
> > >    if ((UINTN)*MemoryBase < (UINTN) MIN_COALESCE_ADDR) {
> > >      if (((UINTN)*MemoryBase + *MemorySize) < (UINTN)
> > MIN_COALESCE_ADDR) {
> > > -      DEBUG ((EFI_D_ERROR, "ERROR: *MemoryBase + *MemorySize -
> > 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> > > +      DEBUG ((DEBUG_ERROR, "ERROR: *MemoryBase + *MemorySize -
> > > + 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> > >        return EFI_BUFFER_TOO_SMALL;
> > >      } else {
> > >        *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR -
> > > (UINTN) *MemoryBase); @@ -1133,13 +1133,13 @@
> CapsuleDataCoalesce
> > (
> > >    }
> > >
> > >    if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
> > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> > 0x%x\n", CapsuleSize + DescriptorsSize));
> > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> > > + 0x%x\n", CapsuleSize + DescriptorsSize));
> > >      return EFI_BUFFER_TOO_SMALL;
> > >    }
> > >
> > >    FreeMemBase = *MemoryBase;
> > >    FreeMemSize = *MemorySize;
> > > -  DEBUG ((EFI_D_INFO, "Capsule Free Memory from 0x%8X to 0x%8X\n",
> > > (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> > > +  DEBUG ((DEBUG_INFO, "Capsule Free Memory from 0x%8X to
> 0x%8X\n",
> > > + (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> > >
> > >    //
> > >    // Relocate all the block descriptors to low memory to make further
> > > @@ -1205,7 +1205,7 @@ CapsuleDataCoalesce (
> > >          }
> > >
> > >          CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc-
> > >Union.DataBlock, (UINTN) TempBlockDesc->Length);
> > > -        DEBUG ((EFI_D_INFO, "Capsule reloc data block from 0x%8X to
> 0x%8X
> > with size 0x%8X\n",
> > > +        DEBUG ((DEBUG_INFO, "Capsule reloc data block from 0x%8X to
> > > + 0x%8X with size 0x%8X\n",
> > >                  (UINTN) TempBlockDesc->Union.DataBlock, (UINTN)
> > > RelocPtr, (UINTN) TempBlockDesc->Length));
> > >
> > >          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS)
> > > (UINTN) RelocPtr; @@ -1256,7 +1256,7 @@ CapsuleDataCoalesce (
> > >        ASSERT (CurrentBlockDesc->Length <= SizeLeft);
> > >
> > >        CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc-
> > >Union.DataBlock), (UINTN)CurrentBlockDesc->Length);
> > > -      DEBUG ((EFI_D_INFO, "Capsule coalesce block no.0x%lX from 0x%lX
> to
> > 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> > > +      DEBUG ((DEBUG_INFO, "Capsule coalesce block no.0x%lX from 0x%lX
> > > + to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> > >               CurrentBlockDesc->Union.DataBlock, (UINT64)(UINTN)DestPtr,
> > CurrentBlockDesc->Length));
> > >        DestPtr += CurrentBlockDesc->Length;
> > >        SizeLeft -= CurrentBlockDesc->Length; diff --git
> > > a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > index 1131094c4f..f5ec1c20ec 100644
> > > --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > @@ -427,7 +427,7 @@ ModeSwitch (
> > >      if (ReservedRangeEnd < MemoryEnd64) {
> > >        MemoryBase64 = ReservedRangeEnd;
> > >      } else {
> > > -      DEBUG ((EFI_D_ERROR, "Memory is not enough to process
> > capsule!\n"));
> > > +      DEBUG ((DEBUG_ERROR, "Memory is not enough to process
> > > + capsule!\n"));
> > >        return EFI_OUT_OF_RESOURCES;
> > >      }
> > >    } else if (ReservedRangeBase < MemoryEnd64) { @@ -525,7 +525,7 @@
> > > FindCapsuleCoalesceImage (
> > >                             &AuthenticationState
> > >                             );
> > >        if (EFI_ERROR (Status)) {
> > > -        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleX64
> > image ffs %r!\n", Status));
> > > +        DEBUG ((DEBUG_ERROR, "Unable to find PE32 section in
> > > + CapsuleX64 image ffs %r!\n", Status));
> > >          return Status;
> > >        }
> > >        *CoalesceImageMachineType = PeCoffLoaderGetMachineType
> ((VOID
> > > *) (UINTN) CoalesceImageAddress); @@ -574,7 +574,7 @@
> > GetLongModeContext (
> > >                                    LongModeBuffer
> > >                                    );
> > >    if (EFI_ERROR (Status)) {
> > > -    DEBUG (( EFI_D_ERROR, "Error Get LongModeBuffer variable %r!\n",
> > Status));
> > > +    DEBUG (( DEBUG_ERROR, "Error Get LongModeBuffer variable %r!\n",
> > > + Status));
> > >    }
> > >    return Status;
> > >  }
> > > @@ -734,7 +734,7 @@ BuildMemoryResourceDescriptor (
> > >    }
> > >
> > >    if (Index == 0) {
> > > -    DEBUG ((EFI_D_INFO | EFI_D_WARN, "No memory resource
> descriptor
> > reported in HOB list before capsule Coalesce\n"));
> > > +    DEBUG ((DEBUG_INFO | DEBUG_WARN, "No memory resource
> > descriptor
> > > + reported in HOB list before capsule Coalesce\n"));
> > >  #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
> > >      //
> > >      // Allocate memory to hold memory resource descriptor, @@ -746,7
> > > +746,7 @@ BuildMemoryResourceDescriptor (
> > >
> > >      MemoryResource[0].PhysicalStart = 0;
> > >      MemoryResource[0].ResourceLength = LShiftU64 (1,
> > GetPhysicalAddressBits ());
> > > -    DEBUG ((EFI_D_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> > Length(0x%0lx)\n",
> > > +    DEBUG ((DEBUG_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> > > + Length(0x%0lx)\n",
> > >                          MemoryResource[0x0].PhysicalStart,
> > MemoryResource[0x0].ResourceLength));
> > >      return MemoryResource;
> > >  #else
> > > @@ -770,7 +770,7 @@ BuildMemoryResourceDescriptor (
> > >    while (Hob.Raw != NULL) {
> > >      ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw;
> > >      if (ResourceDescriptor->ResourceType ==
> > EFI_RESOURCE_SYSTEM_MEMORY) {
> > > -      DEBUG ((EFI_D_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> > Length(0x%0lx)\n",
> > > +      DEBUG ((DEBUG_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> > > + Length(0x%0lx)\n",
> > >                            Index, ResourceDescriptor->PhysicalStart,
> > ResourceDescriptor->ResourceLength));
> > >        MemoryResource[Index].PhysicalStart = ResourceDescriptor-
> > >PhysicalStart;
> > >        MemoryResource[Index].ResourceLength =
> > > ResourceDescriptor->ResourceLength;
> > > @@ -973,7 +973,7 @@ CapsuleCoalesce (
> > >    //
> > >    Status = PeiServicesGetBootMode (&BootMode);
> > >    if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) {
> > > -    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule update
> > path.\n"));
> > > +    DEBUG ((DEBUG_ERROR, "Boot mode is not correct for capsule
> update
> > > + path.\n"));
> > >      Status = EFI_NOT_FOUND;
> > >      goto Done;
> > >    }
> > > @@ -1016,14 +1016,14 @@ CapsuleCoalesce (
> > >        //
> > >        // There is no capsule variables, quit
> > >        //
> > > -      DEBUG ((EFI_D_INFO,"Capsule variable Index = %d\n", Index));
> > > +      DEBUG ((DEBUG_INFO,"Capsule variable Index = %d\n", Index));
> > >        break;
> > >      }
> > >      VariableCount++;
> > >      Index++;
> > >    }
> > >
> > > -  DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n",
> > > VariableCount));
> > > +  DEBUG ((DEBUG_INFO,"Capsule variable count = %d\n",
> > > + VariableCount));
> > >
> > >    //
> > >    // The last entry is the end flag.
> > > @@ -1034,7 +1034,7 @@ CapsuleCoalesce (
> > >               );
> > >
> > >    if (Status != EFI_SUCCESS) {
> > > -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!, Status = %x\n",
> Status));
> > > +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!, Status = %x\n",
> > > + Status));
> > >      goto Done;
> > >    }
> > >
> > > @@ -1046,7 +1046,7 @@ CapsuleCoalesce (
> > >    //
> > >    Status = GetCapsuleDescriptors (VariableArrayAddress);
> > >    if (EFI_ERROR (Status)) {
> > > -    DEBUG ((EFI_D_ERROR, "Fail to find capsule variables.\n"));
> > > +    DEBUG ((DEBUG_ERROR, "Fail to find capsule variables.\n"));
> > >      goto Done;
> > >    }
> > >
> > > @@ -1064,14 +1064,14 @@ CapsuleCoalesce (
> > >      CoalesceImageEntryPoint = 0;
> > >      Status = GetLongModeContext (&LongModeBuffer);
> > >      if (EFI_ERROR (Status)) {
> > > -      DEBUG ((EFI_D_ERROR, "Fail to find the variable for long mode
> > context!\n"));
> > > +      DEBUG ((DEBUG_ERROR, "Fail to find the variable for long mode
> > > + context!\n"));
> > >        Status = EFI_NOT_FOUND;
> > >        goto Done;
> > >      }
> > >
> > >      Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint,
> > &CoalesceImageMachineType);
> > >      if ((EFI_ERROR (Status)) || (CoalesceImageMachineType !=
> > EFI_IMAGE_MACHINE_X64)) {
> > > -      DEBUG ((EFI_D_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
> > > +      DEBUG ((DEBUG_ERROR, "Fail to find CapsuleX64 module in
> > > + FV!\n"));
> > >        Status = EFI_NOT_FOUND;
> > >        goto Done;
> > >      }
> > > @@ -1091,14 +1091,14 @@ CapsuleCoalesce (
> > >    Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS
> > > *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase,
> > > MemorySize);  #endif
> > >
> > > -  DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n", Status));
> > > +  DEBUG ((DEBUG_INFO, "Capsule Coalesce Status = %r!\n", Status));
> > >
> > >    if (Status == EFI_BUFFER_TOO_SMALL) {
> > > -    DEBUG ((EFI_D_ERROR, "There is not enough memory to process
> > capsule!\n"));
> > > +    DEBUG ((DEBUG_ERROR, "There is not enough memory to process
> > > + capsule!\n"));
> > >    }
> > >
> > >    if (Status == EFI_NOT_FOUND) {
> > > -    DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in
> > memory!\n"));
> > > +    DEBUG ((DEBUG_ERROR, "Fail to parse capsule descriptor in
> > > + memory!\n"));
> > >      REPORT_STATUS_CODE (
> > >        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
> > >        (EFI_SOFTWARE_PEI_MODULE |
> > > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
> > > @@ -1163,7 +1163,7 @@ CapsuleTestPattern (
> > >    //
> > >    if (*TestPtr == 0x54534554) {
> > >      RetValue = TRUE;
> > > -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode activated...\n"));
> > > +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode activated...\n"));
> > >      TestSize = TestPtr[1] / sizeof (UINT32);
> > >      //
> > >      // Skip over the signature and the size fields in the pattern
> > > data header @@ -1172,7 +1172,7 @@ CapsuleTestPattern (
> > >      TestCounter = 0;
> > >      while (TestSize > 0) {
> > >        if (*TestPtr != TestCounter) {
> > > -        DEBUG ((EFI_D_INFO, "Capsule test pattern mode FAILED:
> > BaseAddr/FailAddr 0x%X 0x%X\n",
> > (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> > (UINT32)(UINTN)TestPtr));
> > > +        DEBUG ((DEBUG_INFO, "Capsule test pattern mode FAILED:
> > > + BaseAddr/FailAddr 0x%X 0x%X\n",
> > > + (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> > > + (UINT32)(UINTN)TestPtr));
> > >          return TRUE;
> > >        }
> > >
> > > @@ -1181,7 +1181,7 @@ CapsuleTestPattern (
> > >        TestSize--;
> > >      }
> > >
> > > -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n"));
> > > +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
> > >    }
> > >
> > >    return RetValue;
> > > @@ -1226,11 +1226,11 @@ CreateState (
> > >      return EFI_VOLUME_CORRUPTED;
> > >    }
> > >    if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) {
> > > -    DEBUG ((EFI_D_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> > PrivateData->CapsuleAllImageSize));
> > > +    DEBUG ((DEBUG_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> > > + PrivateData->CapsuleAllImageSize));
> > >      return EFI_OUT_OF_RESOURCES;
> > >    }
> > >    if (PrivateData->CapsuleNumber >= MAX_ADDRESS) {
> > > -    DEBUG ((EFI_D_ERROR, "CapsuleNumber too big - 0x%lx\n",
> > PrivateData->CapsuleNumber));
> > > +    DEBUG ((DEBUG_ERROR, "CapsuleNumber too big - 0x%lx\n",
> > > + PrivateData->CapsuleNumber));
> > >      return EFI_OUT_OF_RESOURCES;
> > >    }
> > >    //
> > > @@ -1248,13 +1248,13 @@ CreateState (
> > >               );
> > >
> > >    if (Status != EFI_SUCCESS) {
> > > -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n"));
> > > +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
> > >      return Status;
> > >    }
> > >    //
> > >    // Copy to our new buffer for DXE
> > >    //
> > > -  DEBUG ((EFI_D_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> > > 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> > > sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > > sizeof(UINT64)), (UINTN) NewBuffer, Size));
> > > +  DEBUG ((DEBUG_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> > > + 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> > > + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > > + sizeof(UINT64)), (UINTN) NewBuffer, Size));
> > >    CopyMem ((VOID *) (UINTN) NewBuffer, (VOID *) (UINTN) ((UINT8
> > *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) +
> > (CapsuleNumber - 1) * sizeof(UINT64)), Size);
> > >    //
> > >    // Check for test data pattern. If it is the test pattern, then
> > > we'll diff --git a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > index 40b7095194..2c309990fb 100644
> > > --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > @@ -174,7 +174,7 @@ PageFaultHandler (
> > >    AddressEncMask = PageFaultContext->AddressEncMask;
> > >
> > >    PFAddress = AsmReadCr2 ();
> > > -  DEBUG ((EFI_D_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n",
> > > PFAddress));
> > > +  DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 - %lx\n",
> > > + PFAddress));
> > >
> > >    if (PFAddress >= PhyMask + SIZE_4KB) {
> > >      return PageFaultContext->OriginalHandler;
> > >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-11  8:12     ` Wu, Hao A
@ 2019-04-11  9:33       ` Gao, Zhichao
  2019-04-11 10:33         ` [edk2-devel] " Philippe Mathieu-Daudé
  0 siblings, 1 reply; 10+ messages in thread
From: Gao, Zhichao @ 2019-04-11  9:33 UTC (permalink / raw)
  To: Wu, Hao A, Philippe Mathieu-Daudé, devel@edk2.groups.io
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star,
	Wang, Jian J

Thanks for you advices.

I would better to keep the 'UINTN' with '%x' because PEIM is compiled as 32 bit object. And lots of PEIMs keep this combine.

Thanks,
Zhichao

> -----Original Message-----
> From: Wu, Hao A
> Sent: Thursday, April 11, 2019 4:12 PM
> To: Gao, Zhichao <zhichao.gao@intel.com>; Philippe Mathieu-Daudé
> <philmd@redhat.com>; devel@edk2.groups.io
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> Zeng, Star <star.zeng@intel.com>; Wang, Jian J <jian.j.wang@intel.com>
> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
> code to print 64bit data
> 
> > -----Original Message-----
> > From: Gao, Zhichao
> > Sent: Thursday, April 11, 2019 3:47 PM
> > To: Philippe Mathieu-Daudé; devel@edk2.groups.io
> > Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao A;
> > Wang, Jian J
> > Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> debug
> > code to print 64bit data
> >
> > Sorry for missing this email.
> >
> > While I change the code, it couldn't pass the Patchcher.py because of
> > the 'EFI_D_" version MACRO. So I change all the debug message in this
> driver.
> > Maybe that is a redundant work.
> 
> Hello Zhichao,
> 
> For this case, you can work out a first patch to replace all the macros starting
> with 'EFI_D_' with 'DEBUG_'. And a second patch to address the real issue.
> 
> >
> > Thanks,
> > Zhichao
> >
> > > -----Original Message-----
> > > From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> > > Sent: Tuesday, April 2, 2019 11:36 PM
> > > To: Gao, Zhichao <zhichao.gao@intel.com>; edk2-devel@lists.01.org
> > > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> > > <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> > > Zeng, Star <star.zeng@intel.com>
> > > Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> > debug
> > > code to print 64bit data
> > >
> > > Hi Bret,
> > >
> > > On 4/2/19 7:50 AM, Zhichao Gao wrote:
> > > > From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> > > >
> > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> > > >
> > > > For some pointer and UINT64 data, the debug code print with '%x'.
> > > > Which would loss the upper 32bit data. So update '%x' to '%lx'
> > > > for these data.
> > >
> > > Some are UINTN. Per Laszlo answer on this thread:
> > > https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
> > > for those, casting and changing format is the accepted way.
> 
> After a skim of the patch, I think there seems only 2 cases that are handled in
> this patch:
> 
> 1. UINT64
> For this one, the change in this patch looks good to me.
> 
> 2. Pointers
> I think we can directly use '%p' for pointers.
> 
> If I happen to miss other cases, please do follow the above link to handle
> UINTN.
> 
> 
> Best Regards,
> Hao Wu
> 
> > >
> > > However this is a change,
> > >
> > > > Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> > > > DEBUG_ version is recommended to use.
> > >
> > > and this is another change.
> > >
> > > Splitting this patch in 2 would make it more digestable.
> > >
> > > >
> > > > Cc: Jian J Wang <jian.j.wang@intel.com>
> > > > Cc: Ray Ni <ray.ni@intel.com>
> > > > Cc: Star Zeng <star.zeng@intel.com>
> > > > Cc: Liming Gao <liming.gao@intel.com>
> > > > Cc: Sean Brogan <sean.brogan@microsoft.com>
> > > > Cc: Michael Turner <Michael.Turner@microsoft.com>
> > > > Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
> > > > ---
> > > >  .../CapsulePei/Common/CapsuleCoalesce.c       | 90 +++++++++---------
> -
> > > >  .../Universal/CapsulePei/UefiCapsule.c        | 46 +++++-----
> > > >  .../Universal/CapsulePei/X64/X64Entry.c       |  2 +-
> > > >  3 files changed, 69 insertions(+), 69 deletions(-)
> > > >
> > > > diff --git
> > > > a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > index 3575a94d0f..2a527054bd 100644
> > > > ---
> a/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > +++
> > b/MdeModulePkg/Universal/CapsulePei/Common/CapsuleCoalesce.c
> > > > @@ -258,7 +258,7 @@ ValidateCapsuleByMemoryResource (
> > > >    // Sanity Check
> > > >    //
> > > >    if (Size > MAX_ADDRESS) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > Size));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: Size(0x%lx) > MAX_ADDRESS\n",
> > > > + Size));
> > > >      return FALSE;
> > > >    }
> > > >
> > > > @@ -266,7 +266,7 @@ ValidateCapsuleByMemoryResource (
> > > >    // Sanity Check
> > > >    //
> > > >    if (Address > (MAX_ADDRESS - Size)) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) > (MAX_ADDRESS -
> > > Size(0x%lx))\n", Address, Size));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) >
> (MAX_ADDRESS -
> > > > + Size(0x%lx))\n", Address, Size));
> > > >      return FALSE;
> > > >    }
> > > >
> > > > @@ -280,14 +280,14 @@ ValidateCapsuleByMemoryResource (
> > > >    for (Index = 0; MemoryResource[Index].ResourceLength != 0;
> > > > Index++)
> > {
> > > >      if ((Address >= MemoryResource[Index].PhysicalStart) &&
> > > >          ((Address + Size) <= (MemoryResource[Index].PhysicalStart
> > > > +
> > > MemoryResource[Index].ResourceLength))) {
> > > > -      DEBUG ((EFI_D_INFO, "Address(0x%lx) Size(0x%lx) in
> > > MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > > > +      DEBUG ((DEBUG_INFO, "Address(0x%lx) Size(0x%lx) in
> > > > + MemoryResource[0x%x] - Start(0x%lx) Length(0x%lx)\n",
> > > >                            Address, Size,
> > > >                            Index,
> > > > MemoryResource[Index].PhysicalStart,
> > > MemoryResource[Index].ResourceLength));
> > > >        return TRUE;
> > > >      }
> > > >    }
> > > >
> > > > -  DEBUG ((EFI_D_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in
> > > > any MemoryResource\n", Address, Size));
> > > > +  DEBUG ((DEBUG_ERROR, "ERROR: Address(0x%lx) Size(0x%lx) not in
> > any
> > > > + MemoryResource\n", Address, Size));
> > > >    return FALSE;
> > > >  }
> > > >
> > > > @@ -312,7 +312,7 @@ ValidateCapsuleIntegrity (
> > > >    UINTN                          CapsuleCount;
> > > >    EFI_CAPSULE_BLOCK_DESCRIPTOR   *Ptr;
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "ValidateCapsuleIntegrity\n"));
> > > > +  DEBUG ((DEBUG_INFO, "ValidateCapsuleIntegrity\n"));
> > > >
> > > >    //
> > > >    // Go through the list to look for inconsistencies. Check for:
> > > > @@ -333,15 +333,15 @@ ValidateCapsuleIntegrity (
> > > >      return NULL;
> > > >    }
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr));
> > > > -  DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > > > -  DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n",
> > > > Ptr->Union.ContinuationPointer));
> > > > +  DEBUG ((DEBUG_INFO, "Ptr - 0x%lx\n", (UINT64)Ptr));  DEBUG
> > > > + ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));  DEBUG
> > > > + ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > > > + Ptr->Union.ContinuationPointer));
> > > >    while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer !=
> > > (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
> > > >      //
> > > >      // Make sure the descriptor is aligned at UINT64 in memory
> > > >      //
> > > >      if ((UINTN) Ptr & (sizeof(UINT64) - 1)) {
> > > > -      DEBUG ((EFI_D_ERROR, "ERROR: BlockList address failed alignment
> > > check\n"));
> > > > +      DEBUG ((DEBUG_ERROR, "ERROR: BlockList address failed
> > > > + alignment check\n"));
> > > >        return NULL;
> > > >      }
> > > >
> > > > @@ -354,9 +354,9 @@ ValidateCapsuleIntegrity (
> > > >        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> > > (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> > > (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > > >          return NULL;
> > > >        }
> > > > -      DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr));
> > > > -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > > > -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> > > >Union.ContinuationPointer));
> > > > +      DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%lx\n", (UINT64)Ptr));
> > > > +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> > > > +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > > > + Ptr->Union.ContinuationPointer));
> > > >      } else {
> > > >        if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr-
> > > >Union.DataBlock, Ptr->Length)) {
> > > >          return NULL;
> > > > @@ -375,14 +375,14 @@ ValidateCapsuleIntegrity (
> > > >          // Sanity check
> > > >          //
> > > >          if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) {
> > > > -          DEBUG ((EFI_D_ERROR, "ERROR: Ptr->Length(0x%lx) <
> > > sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> > > > +          DEBUG ((DEBUG_ERROR, "ERROR: Ptr->Length(0x%lx) <
> > > > + sizeof(EFI_CAPSULE_HEADER)\n", Ptr->Length));
> > > >            return NULL;
> > > >          }
> > > >          //
> > > >          // Make sure HeaderSize field is valid
> > > >          //
> > > >          if (CapsuleHeader->HeaderSize >
> > > > CapsuleHeader->CapsuleImageSize)
> > > {
> > > > -          DEBUG ((EFI_D_ERROR, "ERROR: CapsuleHeader-
> > >HeaderSize(0x%x) >
> > > CapsuleHeader->CapsuleImageSize(0x%x)\n", CapsuleHeader-
> > >HeaderSize,
> > > CapsuleHeader->CapsuleImageSize));
> > > > +          DEBUG ((DEBUG_ERROR, "ERROR:
> > > > + CapsuleHeader->HeaderSize(0x%x) > CapsuleImageSize(0x%x)\n",
> > > > + CapsuleHeader->CapsuleHeader-
> > > >HeaderSize,
> > > > + CapsuleHeader->CapsuleImageSize));
> > > >            return NULL;
> > > >          }
> > > >          if (IsCapsuleCorrupted (CapsuleHeader)) { @@ -395,7
> > > >+395,7 @@  ValidateCapsuleIntegrity (
> > > >        if (CapsuleSize >= Ptr->Length) {
> > > >          CapsuleSize = CapsuleSize - Ptr->Length;
> > > >        } else {
> > > > -        DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) < Ptr-
> > > >Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> > > > +        DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) <
> > > > + Ptr->Length(0x%lx)\n", CapsuleSize, Ptr->Length));
> > > >          //
> > > >          // Sanity check
> > > >          //
> > > > @@ -409,9 +409,9 @@ ValidateCapsuleIntegrity (
> > > >        if (!ValidateCapsuleByMemoryResource (MemoryResource,
> > > (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof
> > > (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > > >          return NULL;
> > > >        }
> > > > -      DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr));
> > > > -      DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
> > > > -      DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr-
> > > >Union.ContinuationPointer));
> > > > +      DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%lx\n", (UINT64)Ptr));
> > > > +      DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%lx\n", Ptr->Length));
> > > > +      DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%lx\n",
> > > > + Ptr->Union.ContinuationPointer));
> > > >      }
> > > >    }
> > > >
> > > > @@ -419,7 +419,7 @@ ValidateCapsuleIntegrity (
> > > >      //
> > > >      // No any capsule is found in BlockList
> > > >      //
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> > > CapsuleCount));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleCount(0x%x) == 0\n",
> > > > + CapsuleCount));
> > > >      return NULL;
> > > >    }
> > > >
> > > > @@ -427,7 +427,7 @@ ValidateCapsuleIntegrity (
> > > >      //
> > > >      // Capsule data is incomplete.
> > > >      //
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> > > CapsuleSize));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize(0x%lx) != 0\n",
> > > > + CapsuleSize));
> > > >      return NULL;
> > > >    }
> > > >
> > > > @@ -515,7 +515,7 @@ RelocateBlockDescriptors (
> > > >          }
> > > >
> > > >          CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN)
> > > >TempBlockDesc- Union.DataBlock, (UINTN) TempBlockDesc->Length);
> > > > -        DEBUG ((EFI_D_INFO, "Capsule relocate descriptors from/to/size
> > > 0x%lX 0x%lX 0x%lX\n", TempBlockDesc->Union.DataBlock,
> > > (UINT64)(UINTN)RelocBuffer, TempBlockDesc->Length));
> > > > +        DEBUG ((DEBUG_INFO, "Capsule relocate descriptors
> > > > + from/to/size  0x%lX 0x%lX 0x%lX\n",
> > > > + TempBlockDesc->Union.DataBlock, (UINT64)(UINTN)RelocBuffer,
> > > > + TempBlockDesc->Length));
> > > >          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS)
> > (UINTN)
> > > RelocBuffer;
> > > >        }
> > > >        TempBlockDesc++;
> > > > @@ -552,7 +552,7 @@ RelocateBlockDescriptors (
> > > >          return NULL;
> > > >        }
> > > >        CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead,
> > > BlockListSize);
> > > > -      DEBUG ((EFI_D_INFO, "Capsule reloc descriptor block #2\n"));
> > > > +      DEBUG ((DEBUG_INFO, "Capsule reloc descriptor block
> > > > + #2\n"));
> > > >        //
> > > >        // Point the previous block's next point to this copied version. If
> > > >        // the tail pointer is null, then this is the first descriptor block.
> > > > @@ -651,7 +651,7 @@ GetCapsuleInfo (
> > > >    UINTN                          ThisCapsuleImageSize;
> > > >    EFI_CAPSULE_HEADER             *CapsuleHeader;
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n"));
> > > > +  DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
> > > >
> > > >    ASSERT (Desc != NULL);
> > > >
> > > > @@ -673,7 +673,7 @@ GetCapsuleInfo (
> > > >        // While here we need check all capsules size.
> > > >        //
> > > >        if (Desc->Length >= (MAX_ADDRESS - Size)) {
> > > > -        DEBUG ((EFI_D_ERROR, "ERROR: Desc->Length(0x%lx) >=
> > > (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> > > > +        DEBUG ((DEBUG_ERROR, "ERROR: Desc->Length(0x%lx) >=
> > > > + (MAX_ADDRESS - Size(0x%x))\n", Desc->Length, Size));
> > > >          return EFI_OUT_OF_RESOURCES;
> > > >        }
> > > >        Size += (UINTN) Desc->Length; @@ -707,7 +707,7 @@
> > > > GetCapsuleInfo (
> > > >    // If no descriptors, then fail
> > > >    //
> > > >    if (Count == 0) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n"));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
> > > >      return EFI_NOT_FOUND;
> > > >    }
> > > >
> > > > @@ -787,7 +787,7 @@ CapsuleTestPatternPreCoalesce (
> > > >    UINT32  TestCounter;
> > > >    UINT32  TestSize;
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n"));
> > > > +  DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
> > > >
> > > >    //
> > > >    // Find first data descriptor
> > > > @@ -803,7 +803,7 @@ CapsuleTestPatternPreCoalesce (
> > > >    // First one better be long enough to at least hold the test signature
> > > >    //
> > > >    if (Desc->Length < sizeof (UINT32)) {
> > > > -    DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted
> > > #1\n"));
> > > > +    DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce punted
> > > > + #1\n"));
> > > >      return ;
> > > >    }
> > > >
> > > > @@ -823,13 +823,13 @@ CapsuleTestPatternPreCoalesce (
> > > >    TestPtr += 2;
> > > >    while (1) {
> > > >      if ((TestSize & 0x03) != 0) {
> > > > -      DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce punted
> > > #2\n"));
> > > > +      DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce
> > > > + punted #2\n"));
> > > >        return ;
> > > >      }
> > > >
> > > >      while (TestSize > 0) {
> > > >        if (*TestPtr != TestCounter) {
> > > > -        DEBUG ((EFI_D_INFO, "Capsule test pattern pre-coalesce failed
> data
> > > corruption check\n"));
> > > > +        DEBUG ((DEBUG_INFO, "Capsule test pattern pre-coalesce
> > > > + failed data corruption check\n"));
> > > >          return ;
> > > >        }
> > > >
> > > > @@ -873,7 +873,7 @@ BuildCapsuleDescriptors (
> > > >    EFI_CAPSULE_BLOCK_DESCRIPTOR     *TempBlock;
> > > >    EFI_CAPSULE_BLOCK_DESCRIPTOR     *HeadBlock;
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n"));
> > > > +  DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
> > > >
> > > >    LastBlock         = NULL;
> > > >    HeadBlock         = NULL;
> > > > @@ -904,7 +904,7 @@ BuildCapsuleDescriptors (
> > > >          }
> > > >        }
> > > >      } else {
> > > > -      DEBUG ((EFI_D_ERROR, "ERROR: BlockListBuffer[Index](0x%lx) <
> > > MAX_ADDRESS\n", BlockListBuffer[Index]));
> > > > +      DEBUG ((DEBUG_ERROR, "ERROR: BlockListBuffer[Index](0x%lx)
> > > > + < MAX_ADDRESS\n", BlockListBuffer[Index]));
> > > >      }
> > > >      Index ++;
> > > >    }
> > > > @@ -1022,7 +1022,7 @@ CapsuleDataCoalesce (
> > > >    EFI_CAPSULE_BLOCK_DESCRIPTOR   *TempBlockDesc;
> > > >    EFI_CAPSULE_BLOCK_DESCRIPTOR   PrivateDataDesc[2];
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n"));
> > > > +  DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
> > > >
> > > >    CapsuleIndex     = 0;
> > > >    SizeLeft         = 0;
> > > > @@ -1055,15 +1055,15 @@ CapsuleDataCoalesce (
> > > >    if (EFI_ERROR (Status)) {
> > > >      return Status;
> > > >    }
> > > > -  DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> > > > -  DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
> > > > -  DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n",
> > > > NumDescriptors));
> > > > +  DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
> > > > + DEBUG ((DEBUG_INFO, "CapsuleNumber - 0x%x\n",
> CapsuleNumber));
> > >
> > > This is confuse CapsuleNumber is declared UINT64 in
> > > MdeModulePkg/Universal/CapsulePei/Common/CommonHeader.h and
> > we
> > > use a UINTN here. Why not keep UINT64 and use "%lx"?
> > >
> > > > +  DEBUG ((DEBUG_INFO, "NumDescriptors - 0x%x\n",
> > > > + NumDescriptors));
> > > >    if ((CapsuleSize == 0) || (NumDescriptors == 0) ||
> > > > (CapsuleNumber ==
> > 0))
> > > {
> > > >      return EFI_NOT_FOUND;
> > > >    }
> > > >
> > > >    if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof
> > > (EFI_CAPSULE_PEIM_PRIVATE_DATA)  + sizeof(UINT64))) /
> > > sizeof(UINT64))
> > {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> > > CapsuleNumber));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleNumber - 0x%x\n",
> > > > + CapsuleNumber));
> > > >      return EFI_BUFFER_TOO_SMALL;
> > > >    }
> > > >
> > > > @@ -1093,7 +1093,7 @@ CapsuleDataCoalesce (
> > > >    // Sanity check
> > > >    //
> > > >    if (CapsuleSize >= (MAX_ADDRESS - (sizeof
> > > (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > > sizeof(UINT64) + sizeof(UINT64)))) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize - 0x%x\n",
> CapsuleSize));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize - 0x%x\n",
> > > > + CapsuleSize));
> > > >      return EFI_BUFFER_TOO_SMALL;
> > > >    }
> > > >    //
> > > > @@ -1105,7 +1105,7 @@ CapsuleDataCoalesce (
> > > >    // Sanity check
> > > >    //
> > > >    if (NumDescriptors >= (MAX_ADDRESS /
> > > sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> > > NumDescriptors));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: NumDescriptors - 0x%x\n",
> > > > + NumDescriptors));
> > > >      return EFI_BUFFER_TOO_SMALL;
> > > >    }
> > > >    DescriptorsSize  = NumDescriptors * sizeof
> > > > (EFI_CAPSULE_BLOCK_DESCRIPTOR); @@ -1113,7 +1113,7 @@
> > > CapsuleDataCoalesce (
> > > >    // Sanity check
> > > >    //
> > > >    if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: DescriptorsSize - 0x%lx, CapsuleSize
> -
> > > 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: DescriptorsSize - 0x%lx,
> > CapsuleSize
> > > > + - 0x%lx\n", (UINT64)DescriptorsSize, (UINT64)CapsuleSize));
> > > >      return EFI_BUFFER_TOO_SMALL;
> > > >    }
> > > >
> > > > @@ -1121,10 +1121,10 @@ CapsuleDataCoalesce (
> > > >    // Don't go below some min address. If the base is below it,
> > > >    // then move it up and adjust the size accordingly.
> > > >    //
> > > > -  DEBUG ((EFI_D_INFO, "Capsule Memory range from 0x%8X to
> > 0x%8X\n",
> > > > (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> > > > +  DEBUG ((DEBUG_INFO, "Capsule Memory range from 0x%8X to
> > > 0x%8X\n",
> > > > + (UINTN) *MemoryBase, (UINTN)*MemoryBase + *MemorySize));
> > >
> > > Don't you also want to cast to UINT64 and use "%lX" here?
> > >
> > > >    if ((UINTN)*MemoryBase < (UINTN) MIN_COALESCE_ADDR) {
> > > >      if (((UINTN)*MemoryBase + *MemorySize) < (UINTN)
> > > MIN_COALESCE_ADDR) {
> > > > -      DEBUG ((EFI_D_ERROR, "ERROR: *MemoryBase + *MemorySize -
> > > 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> > > > +      DEBUG ((DEBUG_ERROR, "ERROR: *MemoryBase + *MemorySize -
> > > > + 0x%x\n", (UINTN)*MemoryBase + *MemorySize));
> > > >        return EFI_BUFFER_TOO_SMALL;
> > > >      } else {
> > > >        *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR -
> > > > (UINTN) *MemoryBase); @@ -1133,13 +1133,13 @@
> > CapsuleDataCoalesce
> > > (
> > > >    }
> > > >
> > > >    if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
> > > > -    DEBUG ((EFI_D_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> > > 0x%x\n", CapsuleSize + DescriptorsSize));
> > > > +    DEBUG ((DEBUG_ERROR, "ERROR: CapsuleSize + DescriptorsSize -
> > > > + 0x%x\n", CapsuleSize + DescriptorsSize));
> > > >      return EFI_BUFFER_TOO_SMALL;
> > > >    }
> > > >
> > > >    FreeMemBase = *MemoryBase;
> > > >    FreeMemSize = *MemorySize;
> > > > -  DEBUG ((EFI_D_INFO, "Capsule Free Memory from 0x%8X to
> > > > 0x%8X\n",
> > > > (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> > > > +  DEBUG ((DEBUG_INFO, "Capsule Free Memory from 0x%8X to
> > 0x%8X\n",
> > > > + (UINTN) FreeMemBase, (UINTN) FreeMemBase + FreeMemSize));
> > > >
> > > >    //
> > > >    // Relocate all the block descriptors to low memory to make
> > > > further @@ -1205,7 +1205,7 @@ CapsuleDataCoalesce (
> > > >          }
> > > >
> > > >          CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN)
> > > >TempBlockDesc- Union.DataBlock, (UINTN) TempBlockDesc->Length);
> > > > -        DEBUG ((EFI_D_INFO, "Capsule reloc data block from 0x%8X to
> > 0x%8X
> > > with size 0x%8X\n",
> > > > +        DEBUG ((DEBUG_INFO, "Capsule reloc data block from 0x%8X
> > > > + to 0x%8X with size 0x%8X\n",
> > > >                  (UINTN) TempBlockDesc->Union.DataBlock, (UINTN)
> > > > RelocPtr, (UINTN) TempBlockDesc->Length));
> > > >
> > > >          TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS)
> > > > (UINTN) RelocPtr; @@ -1256,7 +1256,7 @@ CapsuleDataCoalesce (
> > > >        ASSERT (CurrentBlockDesc->Length <= SizeLeft);
> > > >
> > > >        CopyMem ((VOID *) DestPtr, (VOID *) (UINTN)
> > > >(CurrentBlockDesc- Union.DataBlock), (UINTN)CurrentBlockDesc-
> >Length);
> > > > -      DEBUG ((EFI_D_INFO, "Capsule coalesce block no.0x%lX from 0x%lX
> > to
> > > 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> > > > +      DEBUG ((DEBUG_INFO, "Capsule coalesce block no.0x%lX from
> > > > + 0x%lX to 0x%lX with size 0x%lX\n",(UINT64)CapsuleTimes,
> > > >               CurrentBlockDesc->Union.DataBlock,
> > > > (UINT64)(UINTN)DestPtr,
> > > CurrentBlockDesc->Length));
> > > >        DestPtr += CurrentBlockDesc->Length;
> > > >        SizeLeft -= CurrentBlockDesc->Length; diff --git
> > > > a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > > b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > > index 1131094c4f..f5ec1c20ec 100644
> > > > --- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > > +++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
> > > > @@ -427,7 +427,7 @@ ModeSwitch (
> > > >      if (ReservedRangeEnd < MemoryEnd64) {
> > > >        MemoryBase64 = ReservedRangeEnd;
> > > >      } else {
> > > > -      DEBUG ((EFI_D_ERROR, "Memory is not enough to process
> > > capsule!\n"));
> > > > +      DEBUG ((DEBUG_ERROR, "Memory is not enough to process
> > > > + capsule!\n"));
> > > >        return EFI_OUT_OF_RESOURCES;
> > > >      }
> > > >    } else if (ReservedRangeBase < MemoryEnd64) { @@ -525,7 +525,7
> > > > @@ FindCapsuleCoalesceImage (
> > > >                             &AuthenticationState
> > > >                             );
> > > >        if (EFI_ERROR (Status)) {
> > > > -        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleX64
> > > image ffs %r!\n", Status));
> > > > +        DEBUG ((DEBUG_ERROR, "Unable to find PE32 section in
> > > > + CapsuleX64 image ffs %r!\n", Status));
> > > >          return Status;
> > > >        }
> > > >        *CoalesceImageMachineType = PeCoffLoaderGetMachineType
> > ((VOID
> > > > *) (UINTN) CoalesceImageAddress); @@ -574,7 +574,7 @@
> > > GetLongModeContext (
> > > >                                    LongModeBuffer
> > > >                                    );
> > > >    if (EFI_ERROR (Status)) {
> > > > -    DEBUG (( EFI_D_ERROR, "Error Get LongModeBuffer variable %r!\n",
> > > Status));
> > > > +    DEBUG (( DEBUG_ERROR, "Error Get LongModeBuffer variable
> > > > + %r!\n", Status));
> > > >    }
> > > >    return Status;
> > > >  }
> > > > @@ -734,7 +734,7 @@ BuildMemoryResourceDescriptor (
> > > >    }
> > > >
> > > >    if (Index == 0) {
> > > > -    DEBUG ((EFI_D_INFO | EFI_D_WARN, "No memory resource
> > descriptor
> > > reported in HOB list before capsule Coalesce\n"));
> > > > +    DEBUG ((DEBUG_INFO | DEBUG_WARN, "No memory resource
> > > descriptor
> > > > + reported in HOB list before capsule Coalesce\n"));
> > > >  #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
> > > >      //
> > > >      // Allocate memory to hold memory resource descriptor, @@
> > > > -746,7
> > > > +746,7 @@ BuildMemoryResourceDescriptor (
> > > >
> > > >      MemoryResource[0].PhysicalStart = 0;
> > > >      MemoryResource[0].ResourceLength = LShiftU64 (1,
> > > GetPhysicalAddressBits ());
> > > > -    DEBUG ((EFI_D_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> > > Length(0x%0lx)\n",
> > > > +    DEBUG ((DEBUG_INFO, "MemoryResource[0x0] - Start(0x%0lx)
> > > > + Length(0x%0lx)\n",
> > > >                          MemoryResource[0x0].PhysicalStart,
> > > MemoryResource[0x0].ResourceLength));
> > > >      return MemoryResource;
> > > >  #else
> > > > @@ -770,7 +770,7 @@ BuildMemoryResourceDescriptor (
> > > >    while (Hob.Raw != NULL) {
> > > >      ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *)
> Hob.Raw;
> > > >      if (ResourceDescriptor->ResourceType ==
> > > EFI_RESOURCE_SYSTEM_MEMORY) {
> > > > -      DEBUG ((EFI_D_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> > > Length(0x%0lx)\n",
> > > > +      DEBUG ((DEBUG_INFO, "MemoryResource[0x%x] - Start(0x%0lx)
> > > > + Length(0x%0lx)\n",
> > > >                            Index,
> > > > ResourceDescriptor->PhysicalStart,
> > > ResourceDescriptor->ResourceLength));
> > > >        MemoryResource[Index].PhysicalStart = ResourceDescriptor-
> > > >PhysicalStart;
> > > >        MemoryResource[Index].ResourceLength =
> > > > ResourceDescriptor->ResourceLength;
> > > > @@ -973,7 +973,7 @@ CapsuleCoalesce (
> > > >    //
> > > >    Status = PeiServicesGetBootMode (&BootMode);
> > > >    if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE))
> {
> > > > -    DEBUG ((EFI_D_ERROR, "Boot mode is not correct for capsule
> update
> > > path.\n"));
> > > > +    DEBUG ((DEBUG_ERROR, "Boot mode is not correct for capsule
> > update
> > > > + path.\n"));
> > > >      Status = EFI_NOT_FOUND;
> > > >      goto Done;
> > > >    }
> > > > @@ -1016,14 +1016,14 @@ CapsuleCoalesce (
> > > >        //
> > > >        // There is no capsule variables, quit
> > > >        //
> > > > -      DEBUG ((EFI_D_INFO,"Capsule variable Index = %d\n", Index));
> > > > +      DEBUG ((DEBUG_INFO,"Capsule variable Index = %d\n",
> > > > + Index));
> > > >        break;
> > > >      }
> > > >      VariableCount++;
> > > >      Index++;
> > > >    }
> > > >
> > > > -  DEBUG ((EFI_D_INFO,"Capsule variable count = %d\n",
> > > > VariableCount));
> > > > +  DEBUG ((DEBUG_INFO,"Capsule variable count = %d\n",
> > > > + VariableCount));
> > > >
> > > >    //
> > > >    // The last entry is the end flag.
> > > > @@ -1034,7 +1034,7 @@ CapsuleCoalesce (
> > > >               );
> > > >
> > > >    if (Status != EFI_SUCCESS) {
> > > > -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!, Status = %x\n",
> > Status));
> > > > +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!, Status = %x\n",
> > > > + Status));
> > > >      goto Done;
> > > >    }
> > > >
> > > > @@ -1046,7 +1046,7 @@ CapsuleCoalesce (
> > > >    //
> > > >    Status = GetCapsuleDescriptors (VariableArrayAddress);
> > > >    if (EFI_ERROR (Status)) {
> > > > -    DEBUG ((EFI_D_ERROR, "Fail to find capsule variables.\n"));
> > > > +    DEBUG ((DEBUG_ERROR, "Fail to find capsule variables.\n"));
> > > >      goto Done;
> > > >    }
> > > >
> > > > @@ -1064,14 +1064,14 @@ CapsuleCoalesce (
> > > >      CoalesceImageEntryPoint = 0;
> > > >      Status = GetLongModeContext (&LongModeBuffer);
> > > >      if (EFI_ERROR (Status)) {
> > > > -      DEBUG ((EFI_D_ERROR, "Fail to find the variable for long mode
> > > context!\n"));
> > > > +      DEBUG ((DEBUG_ERROR, "Fail to find the variable for long
> > > > + mode context!\n"));
> > > >        Status = EFI_NOT_FOUND;
> > > >        goto Done;
> > > >      }
> > > >
> > > >      Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint,
> > > &CoalesceImageMachineType);
> > > >      if ((EFI_ERROR (Status)) || (CoalesceImageMachineType !=
> > > EFI_IMAGE_MACHINE_X64)) {
> > > > -      DEBUG ((EFI_D_ERROR, "Fail to find CapsuleX64 module in FV!\n"));
> > > > +      DEBUG ((DEBUG_ERROR, "Fail to find CapsuleX64 module in
> > > > + FV!\n"));
> > > >        Status = EFI_NOT_FOUND;
> > > >        goto Done;
> > > >      }
> > > > @@ -1091,14 +1091,14 @@ CapsuleCoalesce (
> > > >    Status = CapsuleDataCoalesce (PeiServices,
> > > > (EFI_PHYSICAL_ADDRESS *)(UINTN)VariableArrayAddress,
> > > > MemoryResource, MemoryBase, MemorySize);  #endif
> > > >
> > > > -  DEBUG ((EFI_D_INFO, "Capsule Coalesce Status = %r!\n",
> > > > Status));
> > > > +  DEBUG ((DEBUG_INFO, "Capsule Coalesce Status = %r!\n",
> > > > + Status));
> > > >
> > > >    if (Status == EFI_BUFFER_TOO_SMALL) {
> > > > -    DEBUG ((EFI_D_ERROR, "There is not enough memory to process
> > > capsule!\n"));
> > > > +    DEBUG ((DEBUG_ERROR, "There is not enough memory to process
> > > > + capsule!\n"));
> > > >    }
> > > >
> > > >    if (Status == EFI_NOT_FOUND) {
> > > > -    DEBUG ((EFI_D_ERROR, "Fail to parse capsule descriptor in
> > > memory!\n"));
> > > > +    DEBUG ((DEBUG_ERROR, "Fail to parse capsule descriptor in
> > > > + memory!\n"));
> > > >      REPORT_STATUS_CODE (
> > > >        EFI_ERROR_CODE | EFI_ERROR_MAJOR,
> > > >        (EFI_SOFTWARE_PEI_MODULE |
> > > > EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
> > > > @@ -1163,7 +1163,7 @@ CapsuleTestPattern (
> > > >    //
> > > >    if (*TestPtr == 0x54534554) {
> > > >      RetValue = TRUE;
> > > > -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode activated...\n"));
> > > > +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode
> > > > + activated...\n"));
> > > >      TestSize = TestPtr[1] / sizeof (UINT32);
> > > >      //
> > > >      // Skip over the signature and the size fields in the pattern
> > > > data header @@ -1172,7 +1172,7 @@ CapsuleTestPattern (
> > > >      TestCounter = 0;
> > > >      while (TestSize > 0) {
> > > >        if (*TestPtr != TestCounter) {
> > > > -        DEBUG ((EFI_D_INFO, "Capsule test pattern mode FAILED:
> > > BaseAddr/FailAddr 0x%X 0x%X\n",
> > > (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA *)CapsuleBase,
> > > (UINT32)(UINTN)TestPtr));
> > > > +        DEBUG ((DEBUG_INFO, "Capsule test pattern mode FAILED:
> > > > + BaseAddr/FailAddr 0x%X 0x%X\n",
> > > > + (UINT32)(UINTN)(EFI_CAPSULE_PEIM_PRIVATE_DATA
> *)CapsuleBase,
> > > > + (UINT32)(UINTN)TestPtr));
> > > >          return TRUE;
> > > >        }
> > > >
> > > > @@ -1181,7 +1181,7 @@ CapsuleTestPattern (
> > > >        TestSize--;
> > > >      }
> > > >
> > > > -    DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n"));
> > > > +    DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
> > > >    }
> > > >
> > > >    return RetValue;
> > > > @@ -1226,11 +1226,11 @@ CreateState (
> > > >      return EFI_VOLUME_CORRUPTED;
> > > >    }
> > > >    if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) {
> > > > -    DEBUG ((EFI_D_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> > > PrivateData->CapsuleAllImageSize));
> > > > +    DEBUG ((DEBUG_ERROR, "CapsuleAllImageSize too big - 0x%lx\n",
> > > > + PrivateData->CapsuleAllImageSize));
> > > >      return EFI_OUT_OF_RESOURCES;
> > > >    }
> > > >    if (PrivateData->CapsuleNumber >= MAX_ADDRESS) {
> > > > -    DEBUG ((EFI_D_ERROR, "CapsuleNumber too big - 0x%lx\n",
> > > PrivateData->CapsuleNumber));
> > > > +    DEBUG ((DEBUG_ERROR, "CapsuleNumber too big - 0x%lx\n",
> > > > + PrivateData->CapsuleNumber));
> > > >      return EFI_OUT_OF_RESOURCES;
> > > >    }
> > > >    //
> > > > @@ -1248,13 +1248,13 @@ CreateState (
> > > >               );
> > > >
> > > >    if (Status != EFI_SUCCESS) {
> > > > -    DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n"));
> > > > +    DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
> > > >      return Status;
> > > >    }
> > > >    //
> > > >    // Copy to our new buffer for DXE
> > > >    //
> > > > -  DEBUG ((EFI_D_INFO, "Capsule copy from 0x%8X to 0x%8X with size
> > > > 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> > > > sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > > > sizeof(UINT64)), (UINTN) NewBuffer, Size));
> > > > +  DEBUG ((DEBUG_INFO, "Capsule copy from 0x%8X to 0x%8X with
> size
> > > > + 0x%8X\n", (UINTN)((UINT8 *)PrivateData +
> > > > + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) *
> > > > + sizeof(UINT64)), (UINTN) NewBuffer, Size));
> > > >    CopyMem ((VOID *) (UINTN) NewBuffer, (VOID *) (UINTN) ((UINT8
> > > *)PrivateData + sizeof(EFI_CAPSULE_PEIM_PRIVATE_DATA) +
> > > (CapsuleNumber - 1) * sizeof(UINT64)), Size);
> > > >    //
> > > >    // Check for test data pattern. If it is the test pattern, then
> > > > we'll diff --git
> > > > a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > > b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > > index 40b7095194..2c309990fb 100644
> > > > --- a/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > > +++ b/MdeModulePkg/Universal/CapsulePei/X64/X64Entry.c
> > > > @@ -174,7 +174,7 @@ PageFaultHandler (
> > > >    AddressEncMask = PageFaultContext->AddressEncMask;
> > > >
> > > >    PFAddress = AsmReadCr2 ();
> > > > -  DEBUG ((EFI_D_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 -
> > > > %lx\n", PFAddress));
> > > > +  DEBUG ((DEBUG_ERROR, "CapsuleX64 - PageFaultHandler: Cr2 -
> > > > + %lx\n", PFAddress));
> > > >
> > > >    if (PFAddress >= PhyMask + SIZE_4KB) {
> > > >      return PageFaultContext->OriginalHandler;
> > > >

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-11  9:33       ` Gao, Zhichao
@ 2019-04-11 10:33         ` Philippe Mathieu-Daudé
  2019-04-17  0:26           ` Gao, Zhichao
  0 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-04-11 10:33 UTC (permalink / raw)
  To: devel, zhichao.gao, Wu, Hao A
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star,
	Wang, Jian J, stephano

Hi Zhichao,

This is not a technical comment related to your patch.

I understand the migration from lists.01.org to edk2.groups.io was in
part motivated to help developpers having a restricted email setup to
easily use a mailing list. I see you top posting your replies so I
wonder if groups.io is really helpful to you.
Are you missing other features that would make your list email workflow
easier?

Thanks,

Phil.

On 4/11/19 11:33 AM, Gao, Zhichao wrote:
> Thanks for you advices.
> 
> I would better to keep the 'UINTN' with '%x' because PEIM is compiled as 32 bit object. And lots of PEIMs keep this combine.
> 
> Thanks,
> Zhichao
> 
>> -----Original Message-----
>> From: Wu, Hao A
>> Sent: Thursday, April 11, 2019 4:12 PM
>> To: Gao, Zhichao <zhichao.gao@intel.com>; Philippe Mathieu-Daudé
>> <philmd@redhat.com>; devel@edk2.groups.io
>> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
>> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
>> Zeng, Star <star.zeng@intel.com>; Wang, Jian J <jian.j.wang@intel.com>
>> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug
>> code to print 64bit data
>>
>>> -----Original Message-----
>>> From: Gao, Zhichao
>>> Sent: Thursday, April 11, 2019 3:47 PM
>>> To: Philippe Mathieu-Daudé; devel@edk2.groups.io
>>> Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao A;
>>> Wang, Jian J
>>> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
>> debug
>>> code to print 64bit data
>>>
>>> Sorry for missing this email.
>>>
>>> While I change the code, it couldn't pass the Patchcher.py because of
>>> the 'EFI_D_" version MACRO. So I change all the debug message in this
>> driver.
>>> Maybe that is a redundant work.
>>
>> Hello Zhichao,
>>
>> For this case, you can work out a first patch to replace all the macros starting
>> with 'EFI_D_' with 'DEBUG_'. And a second patch to address the real issue.
>>
>>>
>>> Thanks,
>>> Zhichao
>>>
>>>> -----Original Message-----
>>>> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
>>>> Sent: Tuesday, April 2, 2019 11:36 PM
>>>> To: Gao, Zhichao <zhichao.gao@intel.com>; edk2-devel@lists.01.org
>>>> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
>>>> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
>>>> Zeng, Star <star.zeng@intel.com>
>>>> Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
>>> debug
>>>> code to print 64bit data
>>>>
>>>> Hi Bret,
>>>>
>>>> On 4/2/19 7:50 AM, Zhichao Gao wrote:
>>>>> From: Bret Barkelew <Bret.Barkelew@microsoft.com>
>>>>>
>>>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
>>>>>
>>>>> For some pointer and UINT64 data, the debug code print with '%x'.
>>>>> Which would loss the upper 32bit data. So update '%x' to '%lx'
>>>>> for these data.
>>>>
>>>> Some are UINTN. Per Laszlo answer on this thread:
>>>> https://lists.01.org/pipermail/edk2-devel/2016-September/002093.html
>>>> for those, casting and changing format is the accepted way.
>>
>> After a skim of the patch, I think there seems only 2 cases that are handled in
>> this patch:
>>
>> 1. UINT64
>> For this one, the change in this patch looks good to me.
>>
>> 2. Pointers
>> I think we can directly use '%p' for pointers.
>>
>> If I happen to miss other cases, please do follow the above link to handle
>> UINTN.
>>
>>
>> Best Regards,
>> Hao Wu
>>
>>>>
>>>> However this is a change,
>>>>
>>>>> Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
>>>>> DEBUG_ version is recommended to use.
>>>>
>>>> and this is another change.
>>>>
>>>> Splitting this patch in 2 would make it more digestable.
[...]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-11 10:33         ` [edk2-devel] " Philippe Mathieu-Daudé
@ 2019-04-17  0:26           ` Gao, Zhichao
  2019-04-17 13:33             ` Laszlo Ersek
  0 siblings, 1 reply; 10+ messages in thread
From: Gao, Zhichao @ 2019-04-17  0:26 UTC (permalink / raw)
  To: devel@edk2.groups.io, philmd@redhat.com, Wu, Hao A
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star,
	Wang, Jian J, stephano

Hi Phil,

Sorry I missed this email again.

When you reply to me, I get the email from the groups.io. It is not directly to me.
I make a folder contained all the email from groups.io. And it would receive so many emails and it is hard for me to view them all. So I may miss some important emails.
I just join the groups.io and install a Extractpatch tool to the email software. Did I miss something or some settings?

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Philippe Mathieu-Daudé
> Sent: Thursday, April 11, 2019 6:33 PM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>; Wu, Hao
> A <hao.a.wu@intel.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> Zeng, Star <star.zeng@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
> stephano <stephano.cetola@linux.intel.com>
> Subject: Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei:
> Update the debug code to print 64bit data
> 
> Hi Zhichao,
> 
> This is not a technical comment related to your patch.
> 
> I understand the migration from lists.01.org to edk2.groups.io was in part
> motivated to help developpers having a restricted email setup to easily use a
> mailing list. I see you top posting your replies so I wonder if groups.io is really
> helpful to you.
> Are you missing other features that would make your list email workflow
> easier?
> 
> Thanks,
> 
> Phil.
> 
> On 4/11/19 11:33 AM, Gao, Zhichao wrote:
> > Thanks for you advices.
> >
> > I would better to keep the 'UINTN' with '%x' because PEIM is compiled as
> 32 bit object. And lots of PEIMs keep this combine.
> >
> > Thanks,
> > Zhichao
> >
> >> -----Original Message-----
> >> From: Wu, Hao A
> >> Sent: Thursday, April 11, 2019 4:12 PM
> >> To: Gao, Zhichao <zhichao.gao@intel.com>; Philippe Mathieu-Daudé
> >> <philmd@redhat.com>; devel@edk2.groups.io
> >> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> >> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> >> Zeng, Star <star.zeng@intel.com>; Wang, Jian J
> >> <jian.j.wang@intel.com>
> >> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> debug
> >> code to print 64bit data
> >>
> >>> -----Original Message-----
> >>> From: Gao, Zhichao
> >>> Sent: Thursday, April 11, 2019 3:47 PM
> >>> To: Philippe Mathieu-Daudé; devel@edk2.groups.io
> >>> Cc: Bret Barkelew; Michael Turner; Gao, Liming; Zeng, Star; Wu, Hao
> >>> A; Wang, Jian J
> >>> Subject: RE: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> >> debug
> >>> code to print 64bit data
> >>>
> >>> Sorry for missing this email.
> >>>
> >>> While I change the code, it couldn't pass the Patchcher.py because
> >>> of the 'EFI_D_" version MACRO. So I change all the debug message in
> >>> this
> >> driver.
> >>> Maybe that is a redundant work.
> >>
> >> Hello Zhichao,
> >>
> >> For this case, you can work out a first patch to replace all the
> >> macros starting with 'EFI_D_' with 'DEBUG_'. And a second patch to
> address the real issue.
> >>
> >>>
> >>> Thanks,
> >>> Zhichao
> >>>
> >>>> -----Original Message-----
> >>>> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> >>>> Sent: Tuesday, April 2, 2019 11:36 PM
> >>>> To: Gao, Zhichao <zhichao.gao@intel.com>; edk2-devel@lists.01.org
> >>>> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> >>>> <Michael.Turner@microsoft.com>; Gao, Liming
> <liming.gao@intel.com>;
> >>>> Zeng, Star <star.zeng@intel.com>
> >>>> Subject: Re: [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the
> >>> debug
> >>>> code to print 64bit data
> >>>>
> >>>> Hi Bret,
> >>>>
> >>>> On 4/2/19 7:50 AM, Zhichao Gao wrote:
> >>>>> From: Bret Barkelew <Bret.Barkelew@microsoft.com>
> >>>>>
> >>>>> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1677
> >>>>>
> >>>>> For some pointer and UINT64 data, the debug code print with '%x'.
> >>>>> Which would loss the upper 32bit data. So update '%x' to '%lx'
> >>>>> for these data.
> >>>>
> >>>> Some are UINTN. Per Laszlo answer on this thread:
> >>>> https://lists.01.org/pipermail/edk2-devel/2016-
> September/002093.htm
> >>>> l for those, casting and changing format is the accepted way.
> >>
> >> After a skim of the patch, I think there seems only 2 cases that are
> >> handled in this patch:
> >>
> >> 1. UINT64
> >> For this one, the change in this patch looks good to me.
> >>
> >> 2. Pointers
> >> I think we can directly use '%p' for pointers.
> >>
> >> If I happen to miss other cases, please do follow the above link to
> >> handle UINTN.
> >>
> >>
> >> Best Regards,
> >> Hao Wu
> >>
> >>>>
> >>>> However this is a change,
> >>>>
> >>>>> Change the DEBUG PrintLevel from EFI_D_ version to DEBUG_ version.
> >>>>> DEBUG_ version is recommended to use.
> >>>>
> >>>> and this is another change.
> >>>>
> >>>> Splitting this patch in 2 would make it more digestable.
> [...]
> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-17  0:26           ` Gao, Zhichao
@ 2019-04-17 13:33             ` Laszlo Ersek
  2019-04-18  0:16               ` Gao, Zhichao
  0 siblings, 1 reply; 10+ messages in thread
From: Laszlo Ersek @ 2019-04-17 13:33 UTC (permalink / raw)
  To: devel, zhichao.gao, philmd@redhat.com, Wu, Hao A
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star,
	Wang, Jian J, stephano

Hi Zhichao,

On 04/17/19 02:26, Gao, Zhichao wrote:
> Hi Phil,
> 
> Sorry I missed this email again.
> 
> When you reply to me, I get the email from the groups.io. It is not directly to me.

That's strange, because Phil's answer addressed both you, and the list.

Unless you have some kind of de-duplication going on under your
@intel.com email address, the message was delivered to you in two copies
-- one directly from Phil, another reflected by the list.

Now, GMail does implement a kind of (broken) de-duplication, which could
explain what you see. However:

(1) groups.io has an account-level setting to counter that (note: this
setting should *NOT* be enabled if you don't use GMail! Because the
workaround enabled by the setting breaks *other* things)

(2) I don't think your @intel.com email address is backed by GMail.

> I make a folder contained all the email from groups.io. And it would receive so many emails and it is hard for me to view them all. So I may miss some important emails.

It's quite possible that your filter is broken, and it sorted both the
personal copy and the list copy into the same folder.

The correct criterion for identifying emails *reflected* by groups.io is
to match the following email message header:

    List-Id: <devel.edk2.groups.io>

Dependent on your filtering solution, you could add a condition such as

  HEADER-NAMED "List-Id" CONTAINS "devel.edk2.groups.io"

> I just join the groups.io and install a Extractpatch tool to the email software. Did I miss something or some settings?

I suspect that your filter is incorrect.

Thanks
Laszlo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data
  2019-04-17 13:33             ` Laszlo Ersek
@ 2019-04-18  0:16               ` Gao, Zhichao
  0 siblings, 0 replies; 10+ messages in thread
From: Gao, Zhichao @ 2019-04-18  0:16 UTC (permalink / raw)
  To: devel@edk2.groups.io, lersek@redhat.com, philmd@redhat.com,
	Wu, Hao A
  Cc: Bret Barkelew, Michael Turner, Gao, Liming, Zeng, Star,
	Wang, Jian J, stephano

Hi Laszlo,

Thanks a lot. You are right. I have updated my filter setting and it works fine.

Thanks,
Zhichao

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Laszlo Ersek
> Sent: Wednesday, April 17, 2019 9:34 PM
> To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@intel.com>;
> philmd@redhat.com; Wu, Hao A <hao.a.wu@intel.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>; Michael Turner
> <Michael.Turner@microsoft.com>; Gao, Liming <liming.gao@intel.com>;
> Zeng, Star <star.zeng@intel.com>; Wang, Jian J <jian.j.wang@intel.com>;
> stephano <stephano.cetola@linux.intel.com>
> Subject: Re: [edk2-devel] [edk2] [PATCH] MdeModulePkg/CapsulePei:
> Update the debug code to print 64bit data
> 
> Hi Zhichao,
> 
> On 04/17/19 02:26, Gao, Zhichao wrote:
> > Hi Phil,
> >
> > Sorry I missed this email again.
> >
> > When you reply to me, I get the email from the groups.io. It is not directly
> to me.
> 
> That's strange, because Phil's answer addressed both you, and the list.
> 
> Unless you have some kind of de-duplication going on under your
> @intel.com email address, the message was delivered to you in two copies
> -- one directly from Phil, another reflected by the list.
> 
> Now, GMail does implement a kind of (broken) de-duplication, which could
> explain what you see. However:
> 
> (1) groups.io has an account-level setting to counter that (note: this setting
> should *NOT* be enabled if you don't use GMail! Because the workaround
> enabled by the setting breaks *other* things)
> 
> (2) I don't think your @intel.com email address is backed by GMail.
> 
> > I make a folder contained all the email from groups.io. And it would receive
> so many emails and it is hard for me to view them all. So I may miss some
> important emails.
> 
> It's quite possible that your filter is broken, and it sorted both the personal
> copy and the list copy into the same folder.
> 
> The correct criterion for identifying emails *reflected* by groups.io is to
> match the following email message header:
> 
>     List-Id: <devel.edk2.groups.io>
> 
> Dependent on your filtering solution, you could add a condition such as
> 
>   HEADER-NAMED "List-Id" CONTAINS "devel.edk2.groups.io"
> 
> > I just join the groups.io and install a Extractpatch tool to the email software.
> Did I miss something or some settings?
> 
> I suspect that your filter is incorrect.
> 
> Thanks
> Laszlo
> 
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-18  0:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-02  5:50 [PATCH] MdeModulePkg/CapsulePei: Update the debug code to print 64bit data Zhichao Gao
2019-04-02 15:35 ` Philippe Mathieu-Daudé
2019-04-11  7:47   ` [edk2] " Gao, Zhichao
2019-04-11  8:12     ` Wu, Hao A
2019-04-11  9:33       ` Gao, Zhichao
2019-04-11 10:33         ` [edk2-devel] " Philippe Mathieu-Daudé
2019-04-17  0:26           ` Gao, Zhichao
2019-04-17 13:33             ` Laszlo Ersek
2019-04-18  0:16               ` Gao, Zhichao
2019-04-11  7:20 ` Gao, Zhichao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox