UefiCpuPkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()

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

Update use of DEBUG_CODE(Expression) if Expression is a complex code
block with if/while/for/case statements that use {}.

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
Michael D Kinney 2021-12-05 14:34:05 -08:00 committed by mergify[bot]
parent f9f4fb2329
commit 7c2a6033c1
6 changed files with 14 additions and 16 deletions

View File

@ -1071,7 +1071,7 @@ AddMemoryMappedIoSpace (
} }
} }
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
// //
// Make sure there are adjacent descriptors covering [Base, Base + Length). // Make sure there are adjacent descriptors covering [Base, Base + Length).
// It is possible that they have not been merged; merging can be prevented // It is possible that they have not been merged; merging can be prevented
@ -1089,7 +1089,7 @@ AddMemoryMappedIoSpace (
ASSERT (Descriptor.GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo); ASSERT (Descriptor.GcdMemoryType == EfiGcdMemoryTypeMemoryMappedIo);
ASSERT ((Descriptor.Capabilities & Capabilities) == Capabilities); ASSERT ((Descriptor.Capabilities & Capabilities) == Capabilities);
} }
); DEBUG_CODE_END ();
FreeMemorySpaceMap: FreeMemorySpaceMap:
FreePool (MemorySpaceMap); FreePool (MemorySpaceMap);
@ -1212,4 +1212,3 @@ InitializeCpu (
return Status; return Status;
} }

View File

@ -243,7 +243,7 @@ GetApicMode (
VOID VOID
) )
{ {
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
{ {
MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr; MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr;
@ -259,7 +259,7 @@ GetApicMode (
ASSERT (ApicBaseMsr.Bits.EXTD == 0); ASSERT (ApicBaseMsr.Bits.EXTD == 0);
} }
} }
); DEBUG_CODE_END ();
return LOCAL_APIC_MODE_XAPIC; return LOCAL_APIC_MODE_XAPIC;
} }

View File

@ -2155,7 +2155,7 @@ MpInitLibInitialize (
// //
// Dump the microcode revision for each core. // Dump the microcode revision for each core.
// //
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
UINT32 ThreadId; UINT32 ThreadId;
UINT32 ExpectedMicrocodeRevision; UINT32 ExpectedMicrocodeRevision;
CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob; CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
@ -2176,7 +2176,7 @@ MpInitLibInitialize (
)); ));
} }
} }
); DEBUG_CODE_END ();
// //
// Initialize global data for MP support // Initialize global data for MP support
// //

View File

@ -2186,7 +2186,7 @@ MtrrSetMemoryAttributesInMtrrSettings (
// //
// 0. Dump the requests. // 0. Dump the requests.
// //
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
DEBUG ((DEBUG_CACHE, "Mtrr: Set Mem Attribute to %a, ScratchSize = %x%a", DEBUG ((DEBUG_CACHE, "Mtrr: Set Mem Attribute to %a, ScratchSize = %x%a",
(MtrrSetting == NULL) ? "Hardware" : "Buffer", *ScratchSize, (MtrrSetting == NULL) ? "Hardware" : "Buffer", *ScratchSize,
(RangeCount <= 1) ? "," : "\n" (RangeCount <= 1) ? "," : "\n"
@ -2197,7 +2197,7 @@ MtrrSetMemoryAttributesInMtrrSettings (
Ranges[Index].BaseAddress, Ranges[Index].BaseAddress + Ranges[Index].Length Ranges[Index].BaseAddress, Ranges[Index].BaseAddress + Ranges[Index].Length
)); ));
} }
); DEBUG_CODE_END ();
// //
// 1. Validate the parameters. // 1. Validate the parameters.
@ -2715,7 +2715,7 @@ MtrrDebugPrintAllMtrrsWorker (
IN MTRR_SETTINGS *MtrrSetting IN MTRR_SETTINGS *MtrrSetting
) )
{ {
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
MTRR_SETTINGS LocalMtrrs; MTRR_SETTINGS LocalMtrrs;
MTRR_SETTINGS *Mtrrs; MTRR_SETTINGS *Mtrrs;
UINTN Index; UINTN Index;
@ -2799,7 +2799,7 @@ MtrrDebugPrintAllMtrrsWorker (
Ranges[Index].BaseAddress, Ranges[Index].BaseAddress + Ranges[Index].Length - 1 Ranges[Index].BaseAddress, Ranges[Index].BaseAddress + Ranges[Index].Length - 1
)); ));
} }
); DEBUG_CODE_END ();
} }
/** /**

View File

@ -636,7 +636,7 @@ AnalysisProcessorFeatures (
// //
// Dump the last CPU feature list // Dump the last CPU feature list
// //
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
DEBUG ((DEBUG_INFO, "Last CPU features list...\n")); DEBUG ((DEBUG_INFO, "Last CPU features list...\n"));
Entry = GetFirstNode (&CpuFeaturesData->FeatureList); Entry = GetFirstNode (&CpuFeaturesData->FeatureList);
while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) { while (!IsNull (&CpuFeaturesData->FeatureList, Entry)) {
@ -659,7 +659,7 @@ AnalysisProcessorFeatures (
DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting), CpuFeaturesData->BitMaskSize); DumpCpuFeatureMask (PcdGetPtr (PcdCpuFeaturesSetting), CpuFeaturesData->BitMaskSize);
DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n")); DEBUG ((DEBUG_INFO, "Final PcdCpuFeaturesSetting:\n"));
DumpCpuFeatureMask (CpuFeaturesData->SettingPcd, CpuFeaturesData->BitMaskSize); DumpCpuFeatureMask (CpuFeaturesData->SettingPcd, CpuFeaturesData->BitMaskSize);
); DEBUG_CODE_END ();
// //
// Save PCDs and display CPU PCDs // Save PCDs and display CPU PCDs
@ -1190,4 +1190,3 @@ CpuFeaturesDetect (
AnalysisProcessorFeatures (CpuFeaturesData->NumberOfCpus); AnalysisProcessorFeatures (CpuFeaturesData->NumberOfCpus);
} }

View File

@ -597,12 +597,12 @@ PiCpuSmmEntry (
// If support CPU hot plug, PcdCpuSmmEnableBspElection should be set to TRUE. // If support CPU hot plug, PcdCpuSmmEnableBspElection should be set to TRUE.
// A constant BSP index makes no sense because it may be hot removed. // A constant BSP index makes no sense because it may be hot removed.
// //
DEBUG_CODE ( DEBUG_CODE_BEGIN ();
if (FeaturePcdGet (PcdCpuHotPlugSupport)) { if (FeaturePcdGet (PcdCpuHotPlugSupport)) {
ASSERT (FeaturePcdGet (PcdCpuSmmEnableBspElection)); ASSERT (FeaturePcdGet (PcdCpuSmmEnableBspElection));
} }
); DEBUG_CODE_END ();
// //
// Save the PcdCpuSmmCodeAccessCheckEnable value into a global variable. // Save the PcdCpuSmmCodeAccessCheckEnable value into a global variable.