]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
Fix a bug in DebugAgent that hang happens when the ACK for GO is lost.
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugAgent / DebugAgentCommon / DebugAgent.c
index f3da983946d6b66c6b6b849af387149b5ecf15d0..99878903b1d871076e4f9a85e671b8eb6c55a153 100644 (file)
 #include "DebugAgent.h"\r
 #include "Ia32/DebugException.h"\r
 \r
-CHAR8 mErrorMsgVersionAlert[]       = "\rThe SourceLevelDebugPkg you are using requires a newer version of the Intel(R) UDK Debugger Tool.\r\n";\r
-CHAR8 mErrorMsgSendInitPacket[]     = "\rSend INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.4) ...\r\n";\r
-CHAR8 mErrorMsgConnectOK[]          = "HOST connection is successful!\r\n";\r
-CHAR8 mErrorMsgConnectFail[]        = "HOST connection is failed!\r\n";\r
-CHAR8 mWarningMsgIngoreBreakpoint[] = "Ignore break point in SMM for SMI issued during DXE debugging!\r\n";\r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgVersionAlert[]       = "\rThe SourceLevelDebugPkg you are using requires a newer version of the Intel(R) UDK Debugger Tool.\r\n";\r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgSendInitPacket[]     = "\rSend INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.4) ...\r\n";\r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectOK[]          = "HOST connection is successful!\r\n";\r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectFail[]        = "HOST connection is failed!\r\n";\r
+GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mWarningMsgIngoreBreakpoint[] = "Ignore break point in SMM for SMI issued during DXE debugging!\r\n";\r
 \r
 //\r
 // Vector Handoff Info list used by Debug Agent for persist\r
 //\r
-EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {\r
   {\r
     DEBUG_EXCEPT_DIVIDE_ERROR,         // Vector 0\r
     EFI_VECTOR_HANDOFF_HOOK_BEFORE,\r
@@ -130,7 +130,7 @@ EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {
   }\r
 };\r
 \r
-UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);\r
+GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);\r
 \r
 /**\r
   Calculate CRC16 for target data.\r
@@ -153,7 +153,7 @@ CalculateCrc16 (
   UINTN  BitIndex;\r
 \r
   for (Index = 0; Index < DataSize; Index++) {\r
-    Crc ^= Data[Index];\r
+    Crc ^= (UINT16)Data[Index];\r
     for (BitIndex = 0; BitIndex < 8; BitIndex++) {\r
       if ((Crc & 0x8000) != 0) {\r
         Crc <<= 1;\r
@@ -174,7 +174,7 @@ CalculateCrc16 (
   @retval  FALSE    IDT entries were not setup by Debug Agent.\r
 \r
 **/\r
-BOOLEAN \r
+BOOLEAN\r
 IsDebugAgentInitialzed (\r
   VOID\r
   )\r
@@ -191,13 +191,13 @@ IsDebugAgentInitialzed (
 \r
 /**\r
   Find and report module image info to HOST.\r
-  \r
+\r
   @param[in] AlignSize      Image aligned size.\r
-  \r
+\r
 **/\r
-VOID \r
+VOID\r
 FindAndReportModuleImageInfo (\r
-  IN UINTN          AlignSize                   \r
+  IN UINTN          AlignSize\r
   )\r
 {\r
   UINTN                                Pe32Data;\r
@@ -243,7 +243,7 @@ FindAndReportModuleImageInfo (
 \r
     //\r
     // Not found the image base, check the previous aligned address\r
-    // \r
+    //\r
     Pe32Data -= AlignSize;\r
   }\r
 \r
@@ -303,7 +303,7 @@ UpdateMailboxChecksum (
   IN DEBUG_AGENT_MAILBOX    *Mailbox\r
   )\r
 {\r
-  Mailbox->CheckSum = CalculateCheckSum8 ((UINT8 *)Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);    \r
+  Mailbox->CheckSum = CalculateCheckSum8 ((UINT8 *)Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);\r
 }\r
 \r
 /**\r
@@ -314,16 +314,16 @@ UpdateMailboxChecksum (
   @param[in]  Mailbox  Debug Agent Mailbox pointer.\r
 \r
 **/\r
-VOID \r
+VOID\r
 VerifyMailboxChecksum (\r
   IN DEBUG_AGENT_MAILBOX    *Mailbox\r
   )\r
 {\r
   UINT8                     CheckSum;\r
-  \r
+\r
   CheckSum = CalculateCheckSum8 ((UINT8 *) Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);\r
   //\r
-  // The checksum updating process may be disturbed by hardware SMI, we need to check CheckSum field \r
+  // The checksum updating process may be disturbed by hardware SMI, we need to check CheckSum field\r
   // and ToBeCheckSum field to validate the mail box.\r
   //\r
   if (CheckSum != Mailbox->CheckSum && CheckSum != Mailbox->ToBeCheckSum) {\r
@@ -339,10 +339,10 @@ VerifyMailboxChecksum (
   @param[in]  Mailbox  Debug Agent Mailbox pointer.\r
   @param[in]  Index    Mailbox content index.\r
   @param[in]  Value    Value to be set into Mailbox.\r
-  \r
+\r
 **/\r
 VOID\r
-UpdateMailboxContent ( \r
+UpdateMailboxContent (\r
   IN DEBUG_AGENT_MAILBOX    *Mailbox,\r
   IN UINTN                  Index,\r
   IN UINT64                 Value\r
@@ -351,7 +351,7 @@ UpdateMailboxContent (
   AcquireMpSpinLock (&mDebugMpContext.MailboxSpinLock);\r
   switch (Index) {\r
   case DEBUG_MAILBOX_DEBUG_FLAG_INDEX:\r
-    Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->DebugFlag.Uint64, sizeof(UINT64)) \r
+    Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->DebugFlag.Uint64, sizeof(UINT64))\r
                                               - CalculateSum8 ((UINT8 *)&Value, sizeof(UINT64));\r
     Mailbox->DebugFlag.Uint64 = Value;\r
     break;\r
@@ -391,10 +391,10 @@ UpdateMailboxContent (
   @param[in]  FlagValue     Debug flag value.\r
 \r
 **/\r
-VOID \r
+VOID\r
 SetDebugFlag (\r
   IN UINT64                 FlagMask,\r
-  IN UINT32                 FlagValue                          \r
+  IN UINT32                 FlagValue\r
   )\r
 {\r
   DEBUG_AGENT_MAILBOX    *Mailbox;\r
@@ -410,7 +410,7 @@ SetDebugFlag (
   Get debug flag in mailbox.\r
 \r
   @param[in]  FlagMask      Debug flag mask value.\r
-  \r
+\r
   @return Debug flag value.\r
 \r
 **/\r
@@ -438,12 +438,12 @@ GetDebugFlag (
 VOID\r
 SendDebugMsgPacket (\r
   IN CHAR8         *Buffer,\r
-  IN UINTN         Length         \r
+  IN UINTN         Length\r
   )\r
 {\r
   DEBUG_PACKET_HEADER  DebugHeader;\r
   DEBUG_PORT_HANDLE    Handle;\r
-  \r
+\r
   Handle = GetDebugPortHandle();\r
 \r
   DebugHeader.StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;\r
@@ -468,7 +468,7 @@ SendDebugMsgPacket (
 \r
   @param[in] ErrorLevel  The error level of the debug message.\r
   @param[in] Format      Format string for the debug message to print.\r
-  @param[in] ...         Variable argument list whose contents are accessed \r
+  @param[in] ...         Variable argument list whose contents are accessed\r
                          based on the format string specified by Format.\r
 \r
 **/\r
@@ -503,15 +503,15 @@ DebugAgentMsgPrint (
 /**\r
   Prints a debug message to the debug output device if the specified error level is enabled.\r
 \r
-  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function \r
-  GetDebugPrintErrorLevel (), then print the message specified by Format and the \r
+  If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function\r
+  GetDebugPrintErrorLevel (), then print the message specified by Format and the\r
   associated variable argument list to the debug output device.\r
 \r
   If Format is NULL, then ASSERT().\r
 \r
   @param[in] ErrorLevel  The error level of the debug message.\r
   @param[in] IsSend      Flag of debug message to declare that the data is being sent or being received.\r
-  @param[in] Data        Variable argument list whose contents are accessed \r
+  @param[in] Data        Variable argument list whose contents are accessed\r
   @param[in] Length      based on the format string specified by Format.\r
 \r
 **/\r
@@ -521,7 +521,7 @@ DebugAgentDataMsgPrint (
   IN UINT8             ErrorLevel,\r
   IN BOOLEAN           IsSend,\r
   IN UINT8             *Data,\r
-  IN UINT8             Length  \r
+  IN UINT8             Length\r
   )\r
 {\r
   CHAR8                Buffer[DEBUG_DATA_MAXIMUM_REAL_DATA];\r
@@ -546,7 +546,7 @@ DebugAgentDataMsgPrint (
   while (TRUE) {\r
     if (DestBuffer - Buffer > DEBUG_DATA_MAXIMUM_REAL_DATA - 6) {\r
       //\r
-      // If there was no enough space in buffer, send out the debug message, \r
+      // If there was no enough space in buffer, send out the debug message,\r
       // reserving 6 bytes is for the last data and end characters "]\n".\r
       //\r
       SendDebugMsgPacket (Buffer, DestBuffer - Buffer);\r
@@ -605,19 +605,20 @@ ReadRemainingBreakPacket (
     return EFI_CRC_ERROR;\r
   }\r
   Mailbox = GetMailboxPointer();\r
-  if (((DebugHeader->Command & DEBUG_COMMAND_RESPONSE) == 0) &&\r
-       (DebugHeader->SequenceNo == (UINT8) (Mailbox->HostSequenceNo + 1))) {\r
-    //\r
-    // Only updagte HostSequenceNo for new command packet \r
-    //\r
-    UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo);\r
-    return EFI_SUCCESS;\r
-  } else {\r
-    //\r
-    // If one old command or response packet received, skip it\r
-    //\r
-    return EFI_DEVICE_ERROR;\r
+  if (IS_REQUEST (DebugHeader)) {\r
+    if (DebugHeader->SequenceNo == (UINT8) (Mailbox->HostSequenceNo + 1)) {\r
+      //\r
+      // Only updagte HostSequenceNo for new command packet \r
+      //\r
+      UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo);\r
+      return EFI_SUCCESS;\r
+    }\r
+    if (DebugHeader->SequenceNo == Mailbox->HostSequenceNo) {\r
+      return EFI_SUCCESS;\r
+    }\r
   }\r
+\r
+  return EFI_DEVICE_ERROR;\r
 }\r
 \r
 /**\r
@@ -639,7 +640,7 @@ IsHostAttached (
   Set HOST connect flag in Mailbox.\r
 \r
   @param[in] Attached        Attach status.\r
-  \r
+\r
 **/\r
 VOID\r
 SetHostAttached (\r
@@ -654,14 +655,14 @@ SetHostAttached (
   Set debug setting of Debug Agent in Mailbox.\r
 \r
   @param DebugSetting         Pointer to Debug Setting defined by transfer protocol.\r
-  \r
+\r
   @retval RETURN_SUCCESS      The setting is set successfully.\r
   @retval RETURN_UNSUPPORTED  The Key value is not supported.\r
 \r
 **/\r
 RETURN_STATUS\r
 SetDebugSetting (\r
-  IN DEBUG_DATA_SET_DEBUG_SETTING  *DebugSetting               \r
+  IN DEBUG_DATA_SET_DEBUG_SETTING  *DebugSetting\r
   )\r
 {\r
   RETURN_STATUS                Status;\r
@@ -747,11 +748,11 @@ SetDebugRegister (
   //\r
   // Enable Gx, Lx\r
   //\r
-  Dr7Value |= 0x3 << (RegisterIndex * 2);\r
+  Dr7Value |= (UINTN) (0x3 << (RegisterIndex * 2));\r
   //\r
   // Set RWx and Lenx\r
   //\r
-  Dr7Value &= ~(0xf << (16 + RegisterIndex * 4));\r
+  Dr7Value &= (UINTN) (~(0xf << (16 + RegisterIndex * 4)));\r
   Dr7Value |= (UINTN) ((SetHwBreakpoint->Type.Length << 2) | SetHwBreakpoint->Type.Access) << (16 + RegisterIndex * 4);\r
   //\r
   // Enable GE, LE\r
@@ -776,19 +777,19 @@ ClearDebugRegister (
 {\r
   if ((ClearHwBreakpoint->IndexMask & BIT0) != 0) {\r
     CpuContext->Dr0 = 0;\r
-    CpuContext->Dr7 &= ~(0x3 << 0);\r
+    CpuContext->Dr7 &= (UINTN)(~(0x3 << 0));\r
   }\r
   if ((ClearHwBreakpoint->IndexMask & BIT1) != 0) {\r
     CpuContext->Dr1 = 0;\r
-    CpuContext->Dr7 &= ~(0x3 << 2);\r
+    CpuContext->Dr7 &= (UINTN)(~(0x3 << 2));\r
   }\r
   if ((ClearHwBreakpoint->IndexMask & BIT2) != 0) {\r
     CpuContext->Dr2 = 0;\r
-    CpuContext->Dr7 &= ~(0x3 << 4);\r
+    CpuContext->Dr7 &= (UINTN)(~(0x3 << 4));\r
   }\r
   if ((ClearHwBreakpoint->IndexMask & BIT3) != 0) {\r
     CpuContext->Dr3 = 0;\r
-    CpuContext->Dr7 &= ~(0x3 << 6);\r
+    CpuContext->Dr7 &= (UINTN)(~(0x3 << 6));\r
   }\r
 }\r
 \r
@@ -994,7 +995,7 @@ ReceivePacket (
   } else {\r
     TimeoutForStartSymbol = Timeout;\r
   }\r
-  \r
+\r
   DebugHeader = (DEBUG_PACKET_HEADER *) InputPacket;\r
   while (TRUE) {\r
     //\r
@@ -1189,13 +1190,13 @@ GetBreakCause (
 \r
       if (CpuContext->Dr3 == IO_PORT_BREAKPOINT_ADDRESS) {\r
 \r
-        Cause = (UINT8) ((CpuContext->Dr0 == IMAGE_LOAD_SIGNATURE) ? \r
+        Cause = (UINT8) ((CpuContext->Dr0 == IMAGE_LOAD_SIGNATURE) ?\r
           DEBUG_DATA_BREAK_CAUSE_IMAGE_LOAD : DEBUG_DATA_BREAK_CAUSE_IMAGE_UNLOAD);\r
       }\r
       break;\r
 \r
     case SOFT_INTERRUPT_SIGNATURE:\r
-   \r
+\r
       if (CpuContext->Dr1 == MEMORY_READY_SIGNATURE) {\r
         Cause = DEBUG_DATA_BREAK_CAUSE_MEMORY_READY;\r
         CpuContext->Dr0 = 0;\r
@@ -1359,7 +1360,7 @@ ReadMemoryAndSendResponsePacket (
     DebugHeader->Crc = CalculateCrc16 ((UINT8 *) DebugHeader, DebugHeader->Length, 0);\r
 \r
     DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, TRUE, (UINT8 *) DebugHeader, DebugHeader->Length);\r
-    \r
+\r
     DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, DebugHeader->Length);\r
 \r
     while (TRUE) {\r
@@ -1439,12 +1440,12 @@ SendBreakCausePacket (
 \r
 /**\r
   Try to attach the HOST.\r
-  \r
+\r
   Send init break packet to HOST:\r
-  If no acknowlege received in specified Timeout, return RETURN_TIMEOUT. \r
-  If received acknowlege, check the revision of HOST. \r
-  Set Attach Flag if attach successfully.  \r
-  \r
+  If no acknowlege received in specified Timeout, return RETURN_TIMEOUT.\r
+  If received acknowlege, check the revision of HOST.\r
+  Set Attach Flag if attach successfully.\r
+\r
   @param[in]  BreakCause     Break cause of this break event.\r
   @param[in]  Timeout        Time out value to wait for acknowlege from HOST.\r
                              The unit is microsecond.\r
@@ -1465,7 +1466,7 @@ AttachHost (
 \r
   IncompatibilityFlag = FALSE;\r
   Handle = GetDebugPortHandle();\r
-    \r
+\r
   //\r
   // Send init break and wait ack in Timeout\r
   //\r
@@ -1483,7 +1484,7 @@ AttachHost (
     DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgVersionAlert, AsciiStrLen (mErrorMsgVersionAlert));\r
     CpuDeadLoop ();\r
   }\r
-  \r
+\r
   if (RETURN_ERROR (Status)) {\r
     DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgConnectFail, AsciiStrLen (mErrorMsgConnectFail));\r
   } else {\r
@@ -1497,8 +1498,8 @@ AttachHost (
 }\r
 \r
 /**\r
-  Send Break point packet to HOST. \r
-  \r
+  Send Break point packet to HOST.\r
+\r
   Only the first breaking processor could sent BREAK_POINT packet.\r
 \r
   @param[in]  BreakCause     Break cause of this break event.\r
@@ -1506,7 +1507,7 @@ AttachHost (
   @param[out] BreakReceived  If BreakReceived is not NULL,\r
                              TRUE is retured if break-in symbol received.\r
                              FALSE is retured if break-in symbol not received.\r
-                            \r
+\r
 **/\r
 VOID\r
 SendBreakPacketToHost (\r
@@ -1517,9 +1518,9 @@ SendBreakPacketToHost (
 {\r
   UINT8                 InputCharacter;\r
   DEBUG_PORT_HANDLE     Handle;\r
-  \r
+\r
   Handle = GetDebugPortHandle();\r
-  \r
+\r
   if (IsHostAttached ()) {\r
     DebugAgentMsgPrint (DEBUG_AGENT_INFO, "processor[%x]:Send Break Packet to HOST.\n", ProcessorIndex);\r
     SendCommandAndWaitForAckOK (DEBUG_COMMAND_BREAK_POINT, READ_PACKET_TIMEOUT, BreakReceived, NULL);\r
@@ -1530,17 +1531,17 @@ SendBreakPacketToHost (
     //\r
     //\r
     // Poll Attach symbols from HOST and ack OK\r
-    //  \r
+    //\r
     do {\r
       DebugPortReadBuffer (Handle, &InputCharacter, 1, 0);\r
     } while (InputCharacter != DEBUG_STARTING_SYMBOL_ATTACH);\r
     SendAckPacket (DEBUG_COMMAND_OK);\r
-    \r
+\r
     //\r
     // Try to attach HOST\r
     //\r
     while (AttachHost (BreakCause, 0, NULL) != RETURN_SUCCESS);\r
-   \r
+\r
   }\r
 }\r
 \r
@@ -1601,7 +1602,7 @@ CommandCommunication (
     SetCpuStopFlagByIndex (ProcessorIndex, TRUE);\r
     if (mDebugMpContext.ViewPointIndex == ProcessorIndex) {\r
       //\r
-      // Only the current view processor could set AgentInProgress Flag. \r
+      // Only the current view processor could set AgentInProgress Flag.\r
       //\r
       IssuedViewPoint = ProcessorIndex;\r
     }\r
@@ -1612,7 +1613,7 @@ CommandCommunication (
     // Set AgentInProgress Flag.\r
     //\r
     SetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS, 1);\r
-  }  \r
+  }\r
 \r
   Handle = GetDebugPortHandle();\r
 \r
@@ -1646,7 +1647,7 @@ CommandCommunication (
 \r
     DebugAgentMsgPrint (DEBUG_AGENT_INFO, "TARGET: Try to get command from HOST...\n");\r
     Status = ReceivePacket ((UINT8 *)DebugHeader, &BreakReceived, NULL, READ_PACKET_TIMEOUT, TRUE);\r
-    if (Status != RETURN_SUCCESS || (DebugHeader->Command & DEBUG_COMMAND_RESPONSE) != 0) {\r
+    if (Status != RETURN_SUCCESS || !IS_REQUEST (DebugHeader)) {\r
       DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command[%x] sequenceno[%x] returned status is [%x] \n", DebugHeader->Command, DebugHeader->SequenceNo, Status);\r
       DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command failed or it's response packet not expected! \n");\r
       ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
@@ -1666,7 +1667,7 @@ CommandCommunication (
       ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
       continue;\r
     }\r
-    \r
+\r
     //\r
     // Save CPU content before executing HOST commond\r
     //\r
@@ -1682,7 +1683,7 @@ CommandCommunication (
     }\r
 \r
     DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Processor[%x]:Received one command(%x)\n", mDebugMpContext.ViewPointIndex, DebugHeader->Command);\r
-    \r
+\r
     switch (DebugHeader->Command) {\r
 \r
     case DEBUG_COMMAND_HALT:\r
@@ -1724,7 +1725,7 @@ CommandCommunication (
       // Clear Stepping Flag\r
       //\r
       SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 0);\r
-      \r
+\r
       if (!HaltDeferred) {\r
         //\r
         // If no HALT command received when being in-active mode\r
@@ -1733,7 +1734,7 @@ CommandCommunication (
           Data32 = FindNextPendingBreakCpu ();\r
           if (Data32 != -1) {\r
             //\r
-            // If there are still others processors being in break state,          \r
+            // If there are still others processors being in break state,\r
             // send OK packet to HOST to finish this go command\r
             //\r
             SendAckPacket (DEBUG_COMMAND_OK);\r
@@ -1763,7 +1764,7 @@ CommandCommunication (
           SetCpuRunningFlag (TRUE);\r
           CpuPause ();\r
           //\r
-          // Wait for all processors are in running state \r
+          // Wait for all processors are in running state\r
           //\r
           while (TRUE) {\r
             if (IsAllCpuRunning ()) {\r
@@ -2019,7 +2020,7 @@ CommandCommunication (
     case DEBUG_COMMAND_CPUID:\r
       Cpuid = (DEBUG_DATA_CPUID *) (DebugHeader + 1);\r
       AsmCpuidEx (\r
-        Cpuid->Eax, Cpuid->Ecx, \r
+        Cpuid->Eax, Cpuid->Ecx,\r
         &CpuidResponse.Eax, &CpuidResponse.Ebx,\r
         &CpuidResponse.Ecx, &CpuidResponse.Edx\r
         );\r
@@ -2028,7 +2029,7 @@ CommandCommunication (
 \r
    case DEBUG_COMMAND_SEARCH_SIGNATURE:\r
       SearchSignature = (DEBUG_DATA_SEARCH_SIGNATURE *) (DebugHeader + 1);\r
-      if ((SearchSignature->Alignment != 0) && \r
+      if ((SearchSignature->Alignment != 0) &&\r
           (SearchSignature->Alignment == GetPowerOfTwo32 (SearchSignature->Alignment))\r
          ) {\r
         if (SearchSignature->Positive) {\r
@@ -2148,7 +2149,7 @@ InterruptProcess (
 \r
   if (MultiProcessorDebugSupport()) {\r
     //\r
-    // If RUN commmand is executing, wait for it done.  \r
+    // If RUN commmand is executing, wait for it done.\r
     //\r
     while (mDebugMpContext.RunCommandSet) {\r
       CpuPause ();\r
@@ -2207,7 +2208,7 @@ InterruptProcess (
       //\r
       // Continue to run the following common code\r
       //\r
-      \r
+\r
     case DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT:\r
     case DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT:\r
     default:\r
@@ -2217,12 +2218,12 @@ InterruptProcess (
       AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
       //\r
       // Only the first breaking processor could send BREAK_POINT to HOST\r
-      // \r
+      //\r
       if (IsFirstBreakProcessor (ProcessorIndex)) {\r
         SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);\r
       }\r
       ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
-      \r
+\r
       if (Vector == DEBUG_INT3_VECTOR) {\r
         //\r
         // go back address located "0xCC"\r
@@ -2359,13 +2360,13 @@ InterruptProcess (
         AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
         //\r
         // Only the first breaking processor could send BREAK_POINT to HOST\r
-        // \r
+        //\r
         if (IsFirstBreakProcessor (ProcessorIndex)) {\r
           SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);\r
         }\r
         ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);\r
       }\r
-      \r
+\r
       CommandCommunication (Vector, CpuContext, BreakReceived);\r
     }\r
     break;\r