summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Library
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2014-11-10 08:47:49 +0000
committerniruiyu <niruiyu@Edk2>2014-11-10 08:47:49 +0000
commitace354f10ba7ca424a96512b634ebee8225014f1 (patch)
treefc4611a0901260070ff4823e7e2ed7e3b8b5fd43 /SourceLevelDebugPkg/Library
parent1ff1dd0ff97b05bf88e50120ba49b435601d5ee8 (diff)
downloadedk2-ace354f10ba7ca424a96512b634ebee8225014f1.zip
edk2-ace354f10ba7ca424a96512b634ebee8225014f1.tar.gz
edk2-ace354f10ba7ca424a96512b634ebee8225014f1.tar.bz2
Fix a bug in DebugAgent that hang happens when the ACK for GO is lost.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16322 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg/Library')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
index a22494f..9987890 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.c
@@ -605,19 +605,20 @@ ReadRemainingBreakPacket (
return EFI_CRC_ERROR;
}
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;
+ if (IS_REQUEST (DebugHeader)) {
+ if (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;
+ }
+ if (DebugHeader->SequenceNo == Mailbox->HostSequenceNo) {
+ return EFI_SUCCESS;
+ }
}
+
+ return EFI_DEVICE_ERROR;
}
/**
@@ -1646,7 +1647,7 @@ CommandCommunication (
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "TARGET: Try to get command from HOST...\n");
Status = ReceivePacket ((UINT8 *)DebugHeader, &BreakReceived, NULL, READ_PACKET_TIMEOUT, TRUE);
- if (Status != RETURN_SUCCESS || (DebugHeader->Command & DEBUG_COMMAND_RESPONSE) != 0) {
+ if (Status != RETURN_SUCCESS || !IS_REQUEST (DebugHeader)) {
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command[%x] sequenceno[%x] returned status is [%x] \n", DebugHeader->Command, DebugHeader->SequenceNo, Status);
DebugAgentMsgPrint (DEBUG_AGENT_WARNING, "TARGET: Get command failed or it's response packet not expected! \n");
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);