MdeModulePkg/CapsulePei: Change debug MACRO

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

Change debug printlevel from EFI_D_ to DEBUG_.
DEBUG_ version is recommanded to use.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao Wu <hao.a.wu@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>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Zhichao Gao 2019-04-11 16:20:36 +08:00 committed by Hao Wu
parent 68d47eea42
commit 85b0193276
2 changed files with 68 additions and 68 deletions

View File

@ -252,7 +252,7 @@ ValidateCapsuleByMemoryResource (
// Sanity Check // Sanity Check
// //
if (Size > MAX_ADDRESS) { 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; return FALSE;
} }
@ -260,7 +260,7 @@ ValidateCapsuleByMemoryResource (
// Sanity Check // Sanity Check
// //
if (Address > (MAX_ADDRESS - Size)) { 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; return FALSE;
} }
@ -274,14 +274,14 @@ ValidateCapsuleByMemoryResource (
for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) { for (Index = 0; MemoryResource[Index].ResourceLength != 0; Index++) {
if ((Address >= MemoryResource[Index].PhysicalStart) && if ((Address >= MemoryResource[Index].PhysicalStart) &&
((Address + Size) <= (MemoryResource[Index].PhysicalStart + MemoryResource[Index].ResourceLength))) { ((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, Address, Size,
Index, MemoryResource[Index].PhysicalStart, MemoryResource[Index].ResourceLength)); Index, MemoryResource[Index].PhysicalStart, MemoryResource[Index].ResourceLength));
return TRUE; 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; return FALSE;
} }
@ -306,7 +306,7 @@ ValidateCapsuleIntegrity (
UINTN CapsuleCount; UINTN CapsuleCount;
EFI_CAPSULE_BLOCK_DESCRIPTOR *Ptr; 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: // Go through the list to look for inconsistencies. Check for:
@ -327,15 +327,15 @@ ValidateCapsuleIntegrity (
return NULL; return NULL;
} }
DEBUG ((EFI_D_INFO, "Ptr - 0x%x\n", Ptr)); DEBUG ((DEBUG_INFO, "Ptr - 0x%x\n", Ptr));
DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length)); DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer)); DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer != (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) { while ((Ptr->Length != 0) || (Ptr->Union.ContinuationPointer != (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)) {
// //
// Make sure the descriptor is aligned at UINT64 in memory // Make sure the descriptor is aligned at UINT64 in memory
// //
if ((UINTN) Ptr & (sizeof(UINT64) - 1)) { 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; return NULL;
} }
@ -348,9 +348,9 @@ ValidateCapsuleIntegrity (
if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) { if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
return NULL; return NULL;
} }
DEBUG ((EFI_D_INFO, "Ptr(C) - 0x%x\n", Ptr)); DEBUG ((DEBUG_INFO, "Ptr(C) - 0x%x\n", Ptr));
DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length)); DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer)); DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
} else { } else {
if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr->Union.DataBlock, Ptr->Length)) { if (!ValidateCapsuleByMemoryResource (MemoryResource, Ptr->Union.DataBlock, Ptr->Length)) {
return NULL; return NULL;
@ -369,14 +369,14 @@ ValidateCapsuleIntegrity (
// Sanity check // Sanity check
// //
if (Ptr->Length < sizeof(EFI_CAPSULE_HEADER)) { 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; return NULL;
} }
// //
// Make sure HeaderSize field is valid // Make sure HeaderSize field is valid
// //
if (CapsuleHeader->HeaderSize > CapsuleHeader->CapsuleImageSize) { 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; return NULL;
} }
if (IsCapsuleCorrupted (CapsuleHeader)) { if (IsCapsuleCorrupted (CapsuleHeader)) {
@ -389,7 +389,7 @@ ValidateCapsuleIntegrity (
if (CapsuleSize >= Ptr->Length) { if (CapsuleSize >= Ptr->Length) {
CapsuleSize = CapsuleSize - Ptr->Length; CapsuleSize = CapsuleSize - Ptr->Length;
} else { } 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 // Sanity check
// //
@ -403,9 +403,9 @@ ValidateCapsuleIntegrity (
if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) { if (!ValidateCapsuleByMemoryResource (MemoryResource, (EFI_PHYSICAL_ADDRESS) (UINTN) Ptr, sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR))) {
return NULL; return NULL;
} }
DEBUG ((EFI_D_INFO, "Ptr(B) - 0x%x\n", Ptr)); DEBUG ((DEBUG_INFO, "Ptr(B) - 0x%x\n", Ptr));
DEBUG ((EFI_D_INFO, "Ptr->Length - 0x%x\n", Ptr->Length)); DEBUG ((DEBUG_INFO, "Ptr->Length - 0x%x\n", Ptr->Length));
DEBUG ((EFI_D_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer)); DEBUG ((DEBUG_INFO, "Ptr->Union - 0x%x\n", Ptr->Union.ContinuationPointer));
} }
} }
@ -413,7 +413,7 @@ ValidateCapsuleIntegrity (
// //
// No any capsule is found in BlockList // 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; return NULL;
} }
@ -421,7 +421,7 @@ ValidateCapsuleIntegrity (
// //
// Capsule data is incomplete. // 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; return NULL;
} }
@ -509,7 +509,7 @@ RelocateBlockDescriptors (
} }
CopyMem ((VOID *) RelocBuffer, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length); 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->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocBuffer;
} }
TempBlockDesc++; TempBlockDesc++;
@ -546,7 +546,7 @@ RelocateBlockDescriptors (
return NULL; return NULL;
} }
CopyMem ((VOID *) RelocBuffer, (VOID *) CurrBlockDescHead, BlockListSize); 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 // Point the previous block's next point to this copied version. If
// the tail pointer is null, then this is the first descriptor block. // the tail pointer is null, then this is the first descriptor block.
@ -645,7 +645,7 @@ GetCapsuleInfo (
UINTN ThisCapsuleImageSize; UINTN ThisCapsuleImageSize;
EFI_CAPSULE_HEADER *CapsuleHeader; EFI_CAPSULE_HEADER *CapsuleHeader;
DEBUG ((EFI_D_INFO, "GetCapsuleInfo enter\n")); DEBUG ((DEBUG_INFO, "GetCapsuleInfo enter\n"));
ASSERT (Desc != NULL); ASSERT (Desc != NULL);
@ -667,7 +667,7 @@ GetCapsuleInfo (
// While here we need check all capsules size. // While here we need check all capsules size.
// //
if (Desc->Length >= (MAX_ADDRESS - 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; return EFI_OUT_OF_RESOURCES;
} }
Size += (UINTN) Desc->Length; Size += (UINTN) Desc->Length;
@ -701,7 +701,7 @@ GetCapsuleInfo (
// If no descriptors, then fail // If no descriptors, then fail
// //
if (Count == 0) { if (Count == 0) {
DEBUG ((EFI_D_ERROR, "ERROR: Count == 0\n")); DEBUG ((DEBUG_ERROR, "ERROR: Count == 0\n"));
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
@ -781,7 +781,7 @@ CapsuleTestPatternPreCoalesce (
UINT32 TestCounter; UINT32 TestCounter;
UINT32 TestSize; UINT32 TestSize;
DEBUG ((EFI_D_INFO, "CapsuleTestPatternPreCoalesce\n")); DEBUG ((DEBUG_INFO, "CapsuleTestPatternPreCoalesce\n"));
// //
// Find first data descriptor // Find first data descriptor
@ -797,7 +797,7 @@ CapsuleTestPatternPreCoalesce (
// First one better be long enough to at least hold the test signature // First one better be long enough to at least hold the test signature
// //
if (Desc->Length < sizeof (UINT32)) { 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 ; return ;
} }
@ -817,13 +817,13 @@ CapsuleTestPatternPreCoalesce (
TestPtr += 2; TestPtr += 2;
while (1) { while (1) {
if ((TestSize & 0x03) != 0) { 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 ; return ;
} }
while (TestSize > 0) { while (TestSize > 0) {
if (*TestPtr != TestCounter) { 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 ; return ;
} }
@ -867,7 +867,7 @@ BuildCapsuleDescriptors (
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlock; EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlock;
EFI_CAPSULE_BLOCK_DESCRIPTOR *HeadBlock; EFI_CAPSULE_BLOCK_DESCRIPTOR *HeadBlock;
DEBUG ((EFI_D_INFO, "BuildCapsuleDescriptors enter\n")); DEBUG ((DEBUG_INFO, "BuildCapsuleDescriptors enter\n"));
LastBlock = NULL; LastBlock = NULL;
HeadBlock = NULL; HeadBlock = NULL;
@ -898,7 +898,7 @@ BuildCapsuleDescriptors (
} }
} }
} else { } 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 ++; Index ++;
} }
@ -1016,7 +1016,7 @@ CapsuleDataCoalesce (
EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockDesc; EFI_CAPSULE_BLOCK_DESCRIPTOR *TempBlockDesc;
EFI_CAPSULE_BLOCK_DESCRIPTOR PrivateDataDesc[2]; EFI_CAPSULE_BLOCK_DESCRIPTOR PrivateDataDesc[2];
DEBUG ((EFI_D_INFO, "CapsuleDataCoalesce enter\n")); DEBUG ((DEBUG_INFO, "CapsuleDataCoalesce enter\n"));
CapsuleIndex = 0; CapsuleIndex = 0;
SizeLeft = 0; SizeLeft = 0;
@ -1049,15 +1049,15 @@ CapsuleDataCoalesce (
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
DEBUG ((EFI_D_INFO, "CapsuleSize - 0x%x\n", CapsuleSize)); DEBUG ((DEBUG_INFO, "CapsuleSize - 0x%x\n", CapsuleSize));
DEBUG ((EFI_D_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber)); DEBUG ((DEBUG_INFO, "CapsuleNumber - 0x%x\n", CapsuleNumber));
DEBUG ((EFI_D_INFO, "NumDescriptors - 0x%x\n", NumDescriptors)); DEBUG ((DEBUG_INFO, "NumDescriptors - 0x%x\n", NumDescriptors));
if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber == 0)) { if ((CapsuleSize == 0) || (NumDescriptors == 0) || (CapsuleNumber == 0)) {
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
if (CapsuleNumber - 1 >= (MAX_ADDRESS - (sizeof (EFI_CAPSULE_PEIM_PRIVATE_DATA) + sizeof(UINT64))) / sizeof(UINT64)) { 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; return EFI_BUFFER_TOO_SMALL;
} }
@ -1087,7 +1087,7 @@ CapsuleDataCoalesce (
// Sanity check // Sanity check
// //
if (CapsuleSize >= (MAX_ADDRESS - (sizeof (EFI_CAPSULE_PEIM_PRIVATE_DATA) + (CapsuleNumber - 1) * sizeof(UINT64) + sizeof(UINT64)))) { 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; return EFI_BUFFER_TOO_SMALL;
} }
// //
@ -1099,7 +1099,7 @@ CapsuleDataCoalesce (
// Sanity check // Sanity check
// //
if (NumDescriptors >= (MAX_ADDRESS / sizeof(EFI_CAPSULE_BLOCK_DESCRIPTOR))) { 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; return EFI_BUFFER_TOO_SMALL;
} }
DescriptorsSize = NumDescriptors * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR); DescriptorsSize = NumDescriptors * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR);
@ -1107,7 +1107,7 @@ CapsuleDataCoalesce (
// Sanity check // Sanity check
// //
if (DescriptorsSize >= (MAX_ADDRESS - CapsuleSize)) { 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; return EFI_BUFFER_TOO_SMALL;
} }
@ -1115,10 +1115,10 @@ CapsuleDataCoalesce (
// Don't go below some min address. If the base is below it, // Don't go below some min address. If the base is below it,
// then move it up and adjust the size accordingly. // 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 < (UINTN) MIN_COALESCE_ADDR) {
if (((UINTN)*MemoryBase + *MemorySize) < (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; return EFI_BUFFER_TOO_SMALL;
} else { } else {
*MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR - (UINTN) *MemoryBase); *MemorySize = *MemorySize - ((UINTN) MIN_COALESCE_ADDR - (UINTN) *MemoryBase);
@ -1127,13 +1127,13 @@ CapsuleDataCoalesce (
} }
if (*MemorySize <= (CapsuleSize + DescriptorsSize)) { 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; return EFI_BUFFER_TOO_SMALL;
} }
FreeMemBase = *MemoryBase; FreeMemBase = *MemoryBase;
FreeMemSize = *MemorySize; 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 // Relocate all the block descriptors to low memory to make further
@ -1199,7 +1199,7 @@ CapsuleDataCoalesce (
} }
CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length); 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)); (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) RelocPtr, (UINTN) TempBlockDesc->Length));
TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocPtr; TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocPtr;
@ -1250,7 +1250,7 @@ CapsuleDataCoalesce (
ASSERT (CurrentBlockDesc->Length <= SizeLeft); ASSERT (CurrentBlockDesc->Length <= SizeLeft);
CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc->Union.DataBlock), (UINTN)CurrentBlockDesc->Length); 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)); CurrentBlockDesc->Union.DataBlock, (UINT64)(UINTN)DestPtr, CurrentBlockDesc->Length));
DestPtr += CurrentBlockDesc->Length; DestPtr += CurrentBlockDesc->Length;
SizeLeft -= CurrentBlockDesc->Length; SizeLeft -= CurrentBlockDesc->Length;

View File

@ -420,7 +420,7 @@ ModeSwitch (
if (ReservedRangeEnd < MemoryEnd64) { if (ReservedRangeEnd < MemoryEnd64) {
MemoryBase64 = ReservedRangeEnd; MemoryBase64 = ReservedRangeEnd;
} else { } 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; return EFI_OUT_OF_RESOURCES;
} }
} else if (ReservedRangeBase < MemoryEnd64) { } else if (ReservedRangeBase < MemoryEnd64) {
@ -518,7 +518,7 @@ FindCapsuleCoalesceImage (
&AuthenticationState &AuthenticationState
); );
if (EFI_ERROR (Status)) { 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; return Status;
} }
*CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress); *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);
@ -567,7 +567,7 @@ GetLongModeContext (
LongModeBuffer LongModeBuffer
); );
if (EFI_ERROR (Status)) { 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; return Status;
} }
@ -727,7 +727,7 @@ BuildMemoryResourceDescriptor (
} }
if (Index == 0) { 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) #if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
// //
// Allocate memory to hold memory resource descriptor, // Allocate memory to hold memory resource descriptor,
@ -739,7 +739,7 @@ BuildMemoryResourceDescriptor (
MemoryResource[0].PhysicalStart = 0; MemoryResource[0].PhysicalStart = 0;
MemoryResource[0].ResourceLength = LShiftU64 (1, GetPhysicalAddressBits ()); 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)); MemoryResource[0x0].PhysicalStart, MemoryResource[0x0].ResourceLength));
return MemoryResource; return MemoryResource;
#else #else
@ -763,7 +763,7 @@ BuildMemoryResourceDescriptor (
while (Hob.Raw != NULL) { while (Hob.Raw != NULL) {
ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw; ResourceDescriptor = (EFI_HOB_RESOURCE_DESCRIPTOR *) Hob.Raw;
if (ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) { 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)); Index, ResourceDescriptor->PhysicalStart, ResourceDescriptor->ResourceLength));
MemoryResource[Index].PhysicalStart = ResourceDescriptor->PhysicalStart; MemoryResource[Index].PhysicalStart = ResourceDescriptor->PhysicalStart;
MemoryResource[Index].ResourceLength = ResourceDescriptor->ResourceLength; MemoryResource[Index].ResourceLength = ResourceDescriptor->ResourceLength;
@ -966,7 +966,7 @@ CapsuleCoalesce (
// //
Status = PeiServicesGetBootMode (&BootMode); Status = PeiServicesGetBootMode (&BootMode);
if (EFI_ERROR (Status) || (BootMode != BOOT_ON_FLASH_UPDATE)) { 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; Status = EFI_NOT_FOUND;
goto Done; goto Done;
} }
@ -1009,14 +1009,14 @@ CapsuleCoalesce (
// //
// There is no capsule variables, quit // 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; break;
} }
VariableCount++; VariableCount++;
Index++; 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. // The last entry is the end flag.
@ -1027,7 +1027,7 @@ CapsuleCoalesce (
); );
if (Status != EFI_SUCCESS) { 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; goto Done;
} }
@ -1039,7 +1039,7 @@ CapsuleCoalesce (
// //
Status = GetCapsuleDescriptors (VariableArrayAddress); Status = GetCapsuleDescriptors (VariableArrayAddress);
if (EFI_ERROR (Status)) { 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; goto Done;
} }
@ -1057,14 +1057,14 @@ CapsuleCoalesce (
CoalesceImageEntryPoint = 0; CoalesceImageEntryPoint = 0;
Status = GetLongModeContext (&LongModeBuffer); Status = GetLongModeContext (&LongModeBuffer);
if (EFI_ERROR (Status)) { 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; Status = EFI_NOT_FOUND;
goto Done; goto Done;
} }
Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint, &CoalesceImageMachineType); Status = FindCapsuleCoalesceImage (&CoalesceImageEntryPoint, &CoalesceImageMachineType);
if ((EFI_ERROR (Status)) || (CoalesceImageMachineType != EFI_IMAGE_MACHINE_X64)) { 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; Status = EFI_NOT_FOUND;
goto Done; goto Done;
} }
@ -1084,14 +1084,14 @@ CapsuleCoalesce (
Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase, MemorySize); Status = CapsuleDataCoalesce (PeiServices, (EFI_PHYSICAL_ADDRESS *)(UINTN)VariableArrayAddress, MemoryResource, MemoryBase, MemorySize);
#endif #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) { 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) { 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 ( REPORT_STATUS_CODE (
EFI_ERROR_CODE | EFI_ERROR_MAJOR, EFI_ERROR_CODE | EFI_ERROR_MAJOR,
(EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR) (EFI_SOFTWARE_PEI_MODULE | EFI_SW_PEI_EC_INVALID_CAPSULE_DESCRIPTOR)
@ -1156,7 +1156,7 @@ CapsuleTestPattern (
// //
if (*TestPtr == 0x54534554) { if (*TestPtr == 0x54534554) {
RetValue = TRUE; 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); TestSize = TestPtr[1] / sizeof (UINT32);
// //
// Skip over the signature and the size fields in the pattern data header // Skip over the signature and the size fields in the pattern data header
@ -1165,7 +1165,7 @@ CapsuleTestPattern (
TestCounter = 0; TestCounter = 0;
while (TestSize > 0) { while (TestSize > 0) {
if (*TestPtr != TestCounter) { 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; return TRUE;
} }
@ -1174,7 +1174,7 @@ CapsuleTestPattern (
TestSize--; TestSize--;
} }
DEBUG ((EFI_D_INFO, "Capsule test pattern mode SUCCESS\n")); DEBUG ((DEBUG_INFO, "Capsule test pattern mode SUCCESS\n"));
} }
return RetValue; return RetValue;
@ -1219,11 +1219,11 @@ CreateState (
return EFI_VOLUME_CORRUPTED; return EFI_VOLUME_CORRUPTED;
} }
if (PrivateData->CapsuleAllImageSize >= MAX_ADDRESS) { 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; return EFI_OUT_OF_RESOURCES;
} }
if (PrivateData->CapsuleNumber >= MAX_ADDRESS) { 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; return EFI_OUT_OF_RESOURCES;
} }
// //
@ -1241,13 +1241,13 @@ CreateState (
); );
if (Status != EFI_SUCCESS) { if (Status != EFI_SUCCESS) {
DEBUG ((EFI_D_ERROR, "AllocatePages Failed!\n")); DEBUG ((DEBUG_ERROR, "AllocatePages Failed!\n"));
return Status; return Status;
} }
// //
// Copy to our new buffer for DXE // 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); 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 // Check for test data pattern. If it is the test pattern, then we'll