]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()
authorMichael D Kinney <michael.d.kinney@intel.com>
Sun, 5 Dec 2021 22:33:58 +0000 (14:33 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 7 Dec 2021 17:24:28 +0000 (17:24 +0000)
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: Jian J Wang <jian.j.wang@intel.com>
SecurityPkg/Library/Tpm12DeviceLibDTpm/Tpm12Tis.c
SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Ptp.c
SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2Tis.c
SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c

index b8218f122de50ca3faf22b1c1f4e7bdb012f8488..d9e1ce86ee72eab910023e0342359fcb1d695dca 100644 (file)
@@ -263,7 +263,7 @@ Tpm12TisTpmCommand (
   UINT32                            Data32;\r
   UINT16                            RspTag;\r
 \r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     UINTN  DebugSize;\r
 \r
     DEBUG ((DEBUG_VERBOSE, "Tpm12TisTpmCommand Send - "));\r
@@ -282,7 +282,7 @@ Tpm12TisTpmCommand (
       }\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   TpmOutSize = 0;\r
 \r
   Status = Tpm12TisPcPrepareCommand (TisReg);\r
@@ -351,13 +351,13 @@ Tpm12TisTpmCommand (
       if (Index == sizeof (TPM_RSP_COMMAND_HDR)) break;\r
     }\r
   }\r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     DEBUG ((DEBUG_VERBOSE, "Tpm12TisTpmCommand ReceiveHeader - "));\r
     for (Index = 0; Index < sizeof (TPM_RSP_COMMAND_HDR); Index++) {\r
       DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index]));\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   //\r
   // Check the response data header (tag, parasize and returncode)\r
   //\r
@@ -395,13 +395,13 @@ Tpm12TisTpmCommand (
     }\r
   }\r
 Exit:\r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     DEBUG ((DEBUG_VERBOSE, "Tpm12TisTpmCommand Receive - "));\r
     for (Index = 0; Index < TpmOutSize; Index++) {\r
       DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index]));\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY);\r
   return Status;\r
 }\r
index edde7f8e1546246d932ff8196d181f271adee198..5ceb6c8466d59c24db64e2b61fbd0d7a7c609c71 100644 (file)
@@ -151,7 +151,7 @@ PtpCrbTpmCommand (
   UINT16                            Data16;\r
   UINT32                            Data32;\r
 \r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     UINTN  DebugSize;\r
 \r
     DEBUG ((DEBUG_VERBOSE, "PtpCrbTpmCommand Send - "));\r
@@ -170,7 +170,7 @@ PtpCrbTpmCommand (
       }\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   TpmOutSize         = 0;\r
 \r
   //\r
@@ -285,13 +285,13 @@ PtpCrbTpmCommand (
   for (Index = 0; Index < sizeof (TPM2_RESPONSE_HEADER); Index++) {\r
     BufferOut[Index] = MmioRead8 ((UINTN)&CrbReg->CrbDataBuffer[Index]);\r
   }\r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     DEBUG ((DEBUG_VERBOSE, "PtpCrbTpmCommand ReceiveHeader - "));\r
     for (Index = 0; Index < sizeof (TPM2_RESPONSE_HEADER); Index++) {\r
       DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index]));\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   //\r
   // Check the response data header (tag, parasize and returncode)\r
   //\r
@@ -320,13 +320,13 @@ PtpCrbTpmCommand (
     BufferOut[Index] = MmioRead8 ((UINTN)&CrbReg->CrbDataBuffer[Index]);\r
   }\r
 \r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     DEBUG ((DEBUG_VERBOSE, "PtpCrbTpmCommand Receive - "));\r
     for (Index = 0; Index < TpmOutSize; Index++) {\r
       DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index]));\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
 \r
 GoReady_Exit:\r
   //\r
index e3bef8dfe491dbc7e9a32595a462d6ecaff36ae7..a3c84d8ab491ebb6487cecbc223080f8c61b7d23 100644 (file)
@@ -218,7 +218,7 @@ Tpm2TisTpmCommand (
   UINT16                            Data16;\r
   UINT32                            Data32;\r
 \r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     UINTN  DebugSize;\r
 \r
     DEBUG ((DEBUG_VERBOSE, "Tpm2TisTpmCommand Send - "));\r
@@ -237,7 +237,7 @@ Tpm2TisTpmCommand (
       }\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   TpmOutSize = 0;\r
 \r
   Status = TisPcPrepareCommand (TisReg);\r
@@ -332,13 +332,13 @@ Tpm2TisTpmCommand (
       if (Index == sizeof (TPM2_RESPONSE_HEADER)) break;\r
     }\r
   }\r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     DEBUG ((DEBUG_VERBOSE, "Tpm2TisTpmCommand ReceiveHeader - "));\r
     for (Index = 0; Index < sizeof (TPM2_RESPONSE_HEADER); Index++) {\r
       DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index]));\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   //\r
   // Check the response data header (tag,parasize and returncode )\r
   //\r
@@ -376,13 +376,13 @@ Tpm2TisTpmCommand (
     }\r
   }\r
 Exit:\r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     DEBUG ((DEBUG_VERBOSE, "Tpm2TisTpmCommand Receive - "));\r
     for (Index = 0; Index < TpmOutSize; Index++) {\r
       DEBUG ((DEBUG_VERBOSE, "%02x ", BufferOut[Index]));\r
     }\r
     DEBUG ((DEBUG_VERBOSE, "\n"));\r
-  );\r
+  DEBUG_CODE_END ();\r
   MmioWrite8((UINTN)&TisReg->Status, TIS_PC_STS_READY);\r
   return Status;\r
 }\r
index 02320bec9804640bd3cf96dc0c93eabe847332cf..2dc6d11e39ad4aa3e2f5f7c9b5061e856e997902 100644 (file)
@@ -2677,7 +2677,7 @@ DriverEntry (
     DEBUG ((DEBUG_INFO, "Tpm2GetCapabilityManufactureID - %08x\n", mTcgDxeData.BsCap.ManufacturerID));\r
   }\r
 \r
-  DEBUG_CODE (\r
+  DEBUG_CODE_BEGIN ();\r
     UINT32                    FirmwareVersion1;\r
     UINT32                    FirmwareVersion2;\r
 \r
@@ -2687,7 +2687,7 @@ DriverEntry (
     } else {\r
       DEBUG ((DEBUG_INFO, "Tpm2GetCapabilityFirmwareVersion - %08x %08x\n", FirmwareVersion1, FirmwareVersion2));\r
     }\r
-  );\r
+  DEBUG_CODE_END ();\r
 \r
   Status = Tpm2GetCapabilityMaxCommandResponseSize (&MaxCommandSize, &MaxResponseSize);\r
   if (EFI_ERROR (Status)) {\r