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
\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