Revision: 15013
          http://sourceforge.net/p/edk2/code/15013
Author:   vanjeff
Date:     2013-12-20 05:49:15 +0000 (Fri, 20 Dec 2013)
Log Message:
-----------
Only save HostSequenceNo for new command in Debug Timer handler.

Signed-off-by: Jeff Fan <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>

Modified Paths:
--------------
    
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c

Modified: 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
===================================================================
--- 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c 
    2013-12-20 05:42:41 UTC (rev 15012)
+++ 
trunk/edk2/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c 
    2013-12-20 05:49:15 UTC (rev 15013)
@@ -374,6 +374,7 @@
     Mailbox->SequenceNo = (UINT8) Value;
     break;
   case DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX:
+    DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Update HostSequenceNo to %x\n", 
Value);
     Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 
*)&Mailbox->HostSequenceNo, sizeof(UINT8))
                                               - CalculateSum8 ((UINT8 
*)&Value, sizeof(UINT8));
     Mailbox->HostSequenceNo = (UINT8) Value;
@@ -572,6 +573,7 @@
   @retval EFI_SUCCESS        Read the symbol in BreakSymbol.
   @retval EFI_CRC_ERROR      CRC check fail.
   @retval EFI_TIMEOUT        Timeout occurs when reading debug packet.
+  @retval EFI_DEVICE_ERROR   Receive the old or responsed packet.
 
 **/
 EFI_STATUS
@@ -581,6 +583,8 @@
   )
 {
   UINT16                     Crc;
+  DEBUG_AGENT_MAILBOX        *Mailbox;
+
   //
   // Has received start symbol, try to read the rest part
   //
@@ -599,9 +603,20 @@
     DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, FALSE, (UINT8 *)DebugHeader, 
DebugHeader->Length);
     return EFI_CRC_ERROR;
   }
-
-  UpdateMailboxContent (GetMailboxPointer(), 
DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo);
-  return EFI_SUCCESS;
+  Mailbox = GetMailboxPointer();
+  if (((DebugHeader->Command & DEBUG_COMMAND_RESPONSE) != 0) &&
+       (DebugHeader->SequenceNo == (UINT8) (Mailbox->HostSequenceNo + 1))) {
+    //
+    // Only updagte HostSequenceNo for new command packet 
+    //
+    UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, 
DebugHeader->SequenceNo);
+    return EFI_SUCCESS;
+  } else {
+    //
+    // If one old command or response packet received, skip it
+    //
+    return EFI_DEVICE_ERROR;
+  }
 }
 
 /**

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to