Dump the entire contents if the GCD Memory Space Map using DEBUG() macros when\r
PcdDebugPrintErrorLevel has the DEBUG_GCD bit set.\r
\r
+ @param InitialMap TRUE if the initial GCD Memory Map is being dumped. Otherwise, FALSE.\r
+ \r
**/\r
VOID\r
EFIAPI\r
CoreDumpGcdMemorySpaceMap (\r
- VOID\r
+ BOOLEAN InitialMap\r
)\r
{\r
- EFI_STATUS Status;\r
- UINTN NumberOfDescriptors;\r
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;\r
- UINTN Index;\r
- \r
- Status = CoreGetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);\r
- ASSERT_EFI_ERROR (Status);\r
- \r
- DEBUG ((DEBUG_GCD, "GCDMemType Range Capabilities Attributes \n"));\r
- DEBUG ((DEBUG_GCD, "========== ================================= ================ ================\n"));\r
- for (Index = 0; Index < NumberOfDescriptors; Index++) {\r
- DEBUG ((DEBUG_GCD, "%a %016lx-%016lx %016lx %016lx%c\n", \r
- mGcdMemoryTypeNames[MIN (MemorySpaceMap[Index].GcdMemoryType, EfiGcdMemoryTypeMaximum)],\r
- MemorySpaceMap[Index].BaseAddress, \r
- MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - 1,\r
- MemorySpaceMap[Index].Capabilities, \r
- MemorySpaceMap[Index].Attributes,\r
- MemorySpaceMap[Index].ImageHandle == NULL ? ' ' : '*'\r
- ));\r
- }\r
- DEBUG ((DEBUG_GCD, "\n"));\r
- FreePool (MemorySpaceMap);\r
+ DEBUG_CODE (\r
+ EFI_STATUS Status;\r
+ UINTN NumberOfDescriptors;\r
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;\r
+ UINTN Index;\r
+ \r
+ Status = CoreGetMemorySpaceMap (&NumberOfDescriptors, &MemorySpaceMap);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ if (InitialMap) {\r
+ DEBUG ((DEBUG_GCD, "GCD:Initial GCD Memory Space Map\n"));\r
+ }\r
+ DEBUG ((DEBUG_GCD, "GCDMemType Range Capabilities Attributes \n"));\r
+ DEBUG ((DEBUG_GCD, "========== ================================= ================ ================\n"));\r
+ for (Index = 0; Index < NumberOfDescriptors; Index++) {\r
+ DEBUG ((DEBUG_GCD, "%a %016lx-%016lx %016lx %016lx%c\n", \r
+ mGcdMemoryTypeNames[MIN (MemorySpaceMap[Index].GcdMemoryType, EfiGcdMemoryTypeMaximum)],\r
+ MemorySpaceMap[Index].BaseAddress, \r
+ MemorySpaceMap[Index].BaseAddress + MemorySpaceMap[Index].Length - 1,\r
+ MemorySpaceMap[Index].Capabilities, \r
+ MemorySpaceMap[Index].Attributes,\r
+ MemorySpaceMap[Index].ImageHandle == NULL ? ' ' : '*'\r
+ ));\r
+ }\r
+ DEBUG ((DEBUG_GCD, "\n"));\r
+ FreePool (MemorySpaceMap);\r
+ );\r
}\r
\r
/**\r
Dump the entire contents if the GCD I/O Space Map using DEBUG() macros when \r
PcdDebugPrintErrorLevel has the DEBUG_GCD bit set.\r
\r
+ @param InitialMap TRUE if the initial GCD I/O Map is being dumped. Otherwise, FALSE.\r
+ \r
**/\r
VOID\r
EFIAPI\r
CoreDumpGcdIoSpaceMap (\r
- VOID\r
+ BOOLEAN InitialMap\r
)\r
{\r
- EFI_STATUS Status;\r
- UINTN NumberOfDescriptors;\r
- EFI_GCD_IO_SPACE_DESCRIPTOR *IoSpaceMap;\r
- UINTN Index;\r
- \r
- Status = CoreGetIoSpaceMap (&NumberOfDescriptors, &IoSpaceMap);\r
- ASSERT_EFI_ERROR (Status);\r
- \r
- DEBUG ((DEBUG_GCD, "GCDIoType Range \n"));\r
- DEBUG ((DEBUG_GCD, "========== =================================\n"));\r
- for (Index = 0; Index < NumberOfDescriptors; Index++) {\r
- DEBUG ((DEBUG_GCD, "%a %016lx-%016lx%c\n", \r
- mGcdIoTypeNames[MIN (IoSpaceMap[Index].GcdIoType, EfiGcdIoTypeMaximum)],\r
- IoSpaceMap[Index].BaseAddress, \r
- IoSpaceMap[Index].BaseAddress + IoSpaceMap[Index].Length - 1,\r
- IoSpaceMap[Index].ImageHandle == NULL ? ' ' : '*'\r
- ));\r
- }\r
- DEBUG ((DEBUG_GCD, "\n"));\r
- FreePool (IoSpaceMap);\r
+ DEBUG_CODE (\r
+ EFI_STATUS Status;\r
+ UINTN NumberOfDescriptors;\r
+ EFI_GCD_IO_SPACE_DESCRIPTOR *IoSpaceMap;\r
+ UINTN Index;\r
+ \r
+ Status = CoreGetIoSpaceMap (&NumberOfDescriptors, &IoSpaceMap);\r
+ ASSERT_EFI_ERROR (Status);\r
+ \r
+ if (InitialMap) {\r
+ DEBUG ((DEBUG_GCD, "GCD:Initial GCD I/O Space Map\n"));\r
+ } \r
+ \r
+ DEBUG ((DEBUG_GCD, "GCDIoType Range \n"));\r
+ DEBUG ((DEBUG_GCD, "========== =================================\n"));\r
+ for (Index = 0; Index < NumberOfDescriptors; Index++) {\r
+ DEBUG ((DEBUG_GCD, "%a %016lx-%016lx%c\n", \r
+ mGcdIoTypeNames[MIN (IoSpaceMap[Index].GcdIoType, EfiGcdIoTypeMaximum)],\r
+ IoSpaceMap[Index].BaseAddress, \r
+ IoSpaceMap[Index].BaseAddress + IoSpaceMap[Index].Length - 1,\r
+ IoSpaceMap[Index].ImageHandle == NULL ? ' ' : '*'\r
+ ));\r
+ }\r
+ DEBUG ((DEBUG_GCD, "\n"));\r
+ FreePool (IoSpaceMap);\r
+ );\r
}\r
\r
\r
UINT64 CpuArchAttributes;\r
\r
if (Length == 0) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Status = CoreCleanupGcdMapEntry (TopEntry, BottomEntry, StartLink, EndLink, Map);\r
\r
Done:\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", Status));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", Status));\r
\r
if ((Operation & GCD_MEMORY_SPACE_OPERATION) != 0) {\r
CoreReleaseGcdMemoryLock ();\r
- DEBUG_CODE_BEGIN ();\r
- //\r
- // Do not dump GCD Memory Space Map for GCD changes below 16 MB \r
- //\r
- if (BaseAddress >= BASE_16MB) {\r
- CoreDumpGcdMemorySpaceMap ();\r
- }\r
- DEBUG_CODE_END ();\r
+ CoreDumpGcdMemorySpaceMap (FALSE);\r
}\r
if ((Operation & GCD_IO_SPACE_OPERATION) != 0) {\r
CoreReleaseGcdIoLock ();\r
- DEBUG_CODE_BEGIN ();\r
- CoreDumpGcdIoSpaceMap ();\r
- DEBUG_CODE_END ();\r
+ CoreDumpGcdIoSpaceMap (FALSE);\r
}\r
\r
return Status;\r
// Make sure parameters are valid\r
//\r
if (GcdAllocateType < 0 || GcdAllocateType >= EfiGcdMaxAllocateType) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
if (GcdMemoryType < 0 || GcdMemoryType >= EfiGcdMemoryTypeMaximum) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
if (GcdIoType < 0 || GcdIoType >= EfiGcdIoTypeMaximum) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
if (BaseAddress == NULL) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
if (ImageHandle == NULL) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
if (Alignment >= 64) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_NOT_FOUND));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_NOT_FOUND));\r
return EFI_NOT_FOUND;\r
}\r
if (Length == 0) {\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r\n", EFI_INVALID_PARAMETER));\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
Status = CoreCleanupGcdMapEntry (TopEntry, BottomEntry, StartLink, EndLink, Map);\r
\r
Done:\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, " Status = %r", Status));\r
- if (!EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_GCD, " (BaseAddress = %016lx)\n", *BaseAddress));\r
- }\r
- DEBUG ((DEBUG_GCD, "\n"));\r
- DEBUG_CODE_END ();\r
+ DEBUG ((DEBUG_GCD, " Status = %r", Status));\r
+ if (!EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_GCD, " (BaseAddress = %016lx)", *BaseAddress));\r
+ }\r
+ DEBUG ((DEBUG_GCD, "\n"));\r
\r
if ((Operation & GCD_MEMORY_SPACE_OPERATION) != 0) {\r
CoreReleaseGcdMemoryLock ();\r
- DEBUG_CODE_BEGIN ();\r
- //\r
- // Do not dump GCD Memory Space Map for GCD changes below 16 MB \r
- //\r
- if (*BaseAddress >= BASE_16MB) {\r
- CoreDumpGcdMemorySpaceMap ();\r
- }\r
- DEBUG_CODE_END ();\r
+ CoreDumpGcdMemorySpaceMap (FALSE);\r
}\r
if ((Operation & GCD_IO_SPACE_OPERATION) !=0) {\r
CoreReleaseGcdIoLock ();\r
- DEBUG_CODE_BEGIN ();\r
- CoreDumpGcdIoSpaceMap ();\r
- DEBUG_CODE_END ();\r
+ CoreDumpGcdIoSpaceMap (FALSE);\r
}\r
- \r
+\r
return Status;\r
}\r
\r
return Status;\r
}\r
\r
+\r
/**\r
Converts a Resource Descriptor HOB attributes mask to an EFI Memory Descriptor\r
capabilities mask\r
\r
InsertHeadList (&mGcdMemorySpaceMap, &Entry->Link);\r
\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, "GCD:Initial GCD Memory Space Map\n"));\r
- CoreDumpGcdMemorySpaceMap ();\r
- DEBUG_CODE_END ();\r
+ CoreDumpGcdMemorySpaceMap (TRUE);\r
\r
//\r
// Initialize the GCD I/O Space Map\r
\r
InsertHeadList (&mGcdIoSpaceMap, &Entry->Link);\r
\r
- DEBUG_CODE_BEGIN ();\r
- DEBUG ((DEBUG_GCD, "GCD:Initial GCD I/O Space Map\n"));\r
- CoreDumpGcdIoSpaceMap ();\r
- DEBUG_CODE_END ();\r
+ CoreDumpGcdIoSpaceMap (TRUE);\r
\r
//\r
// Walk the HOB list and add all resource descriptors to the GCD\r