From: Michael D Kinney Date: Sun, 5 Dec 2021 22:33:58 +0000 (-0800) Subject: SecurityPkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END() X-Git-Tag: edk2-stable202202~235 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=f9f4fb23290802cc43bb7a58325b9bfa8ed27da9;p=mirror_edk2.git SecurityPkg: 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 Cc: Leif Lindholm Cc: Michael Kubacki Signed-off-by: Michael D Kinney Reviewed-by: Jian J Wang --- diff --git a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c index b8218f122d..d9e1ce86ee 100644 --- a/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c +++ b/SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c @@ -263,7 +263,7 @@ Tpm12TisTpmCommand ( UINT32 Data32; UINT16 RspTag; - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); UINTN DebugSize; DEBUG ((DEBUG_VERBOSE, "Tpm12TisTpmCommand Send - ")); @@ -282,7 +282,7 @@ Tpm12TisTpmCommand ( } } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); TpmOutSize = 0; Status = Tpm12TisPcPrepareCommand (TisReg); @@ -351,13 +351,13 @@ Tpm12TisTpmCommand ( if (Index == sizeof (TPM_RSP_COMMAND_HDR)) break; } } - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); DEBUG ((DEBUG_VERBOSE, "Tpm12TisTpmCommand ReceiveHeader - ")); for (Index = 0; Index < sizeof (TPM_RSP_COMMAND_HDR); Index++) { DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index])); } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); // // Check the response data header (tag, parasize and returncode) // @@ -395,13 +395,13 @@ Tpm12TisTpmCommand ( } } Exit: - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); DEBUG ((DEBUG_VERBOSE, "Tpm12TisTpmCommand Receive - ")); for (Index = 0; Index < TpmOutSize; Index++) { DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index])); } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY); return Status; } diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c index edde7f8e15..5ceb6c8466 100644 --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c @@ -151,7 +151,7 @@ PtpCrbTpmCommand ( UINT16 Data16; UINT32 Data32; - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); UINTN DebugSize; DEBUG ((DEBUG_VERBOSE, "PtpCrbTpmCommand Send - ")); @@ -170,7 +170,7 @@ PtpCrbTpmCommand ( } } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); TpmOutSize = 0; // @@ -285,13 +285,13 @@ PtpCrbTpmCommand ( for (Index = 0; Index < sizeof (TPM2_RESPONSE_HEADER); Index++) { BufferOut[Index] = MmioRead8 ((UINTN)&CrbReg->CrbDataBuffer[Index]); } - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); DEBUG ((DEBUG_VERBOSE, "PtpCrbTpmCommand ReceiveHeader - ")); for (Index = 0; Index < sizeof (TPM2_RESPONSE_HEADER); Index++) { DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index])); } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); // // Check the response data header (tag, parasize and returncode) // @@ -320,13 +320,13 @@ PtpCrbTpmCommand ( BufferOut[Index] = MmioRead8 ((UINTN)&CrbReg->CrbDataBuffer[Index]); } - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); DEBUG ((DEBUG_VERBOSE, "PtpCrbTpmCommand Receive - ")); for (Index = 0; Index < TpmOutSize; Index++) { DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index])); } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); GoReady_Exit: // diff --git a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c index e3bef8dfe4..a3c84d8ab4 100644 --- a/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c +++ b/SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c @@ -218,7 +218,7 @@ Tpm2TisTpmCommand ( UINT16 Data16; UINT32 Data32; - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); UINTN DebugSize; DEBUG ((DEBUG_VERBOSE, "Tpm2TisTpmCommand Send - ")); @@ -237,7 +237,7 @@ Tpm2TisTpmCommand ( } } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); TpmOutSize = 0; Status = TisPcPrepareCommand (TisReg); @@ -332,13 +332,13 @@ Tpm2TisTpmCommand ( if (Index == sizeof (TPM2_RESPONSE_HEADER)) break; } } - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); DEBUG ((DEBUG_VERBOSE, "Tpm2TisTpmCommand ReceiveHeader - ")); for (Index = 0; Index < sizeof (TPM2_RESPONSE_HEADER); Index++) { DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index])); } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); // // Check the response data header (tag,parasize and returncode ) // @@ -376,13 +376,13 @@ Tpm2TisTpmCommand ( } } Exit: - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); DEBUG ((DEBUG_VERBOSE, "Tpm2TisTpmCommand Receive - ")); for (Index = 0; Index < TpmOutSize; Index++) { DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index])); } DEBUG ((DEBUG_VERBOSE, "\n")); - ); + DEBUG_CODE_END (); MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY); return Status; } diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c index 02320bec98..2dc6d11e39 100644 --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c @@ -2677,7 +2677,7 @@ DriverEntry ( DEBUG ((DEBUG_INFO, "Tpm2GetCapabilityManufactureID - %08x\n", mTcgDxeData.BsCap.ManufacturerID)); } - DEBUG_CODE ( + DEBUG_CODE_BEGIN (); UINT32 FirmwareVersion1; UINT32 FirmwareVersion2; @@ -2687,7 +2687,7 @@ DriverEntry ( } else { DEBUG ((DEBUG_INFO, "Tpm2GetCapabilityFirmwareVersion - %08x %08x\n", FirmwareVersion1, FirmwareVersion2)); } - ); + DEBUG_CODE_END (); Status = Tpm2GetCapabilityMaxCommandResponseSize (&MaxCommandSize, &MaxResponseSize); if (EFI_ERROR (Status)) {