Only save HostSequenceNo for new command in Debug Timer handler.

Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15013 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jeff Fan 2013-12-20 05:49:15 +00:00 committed by vanjeff
parent f3b113bf61
commit 4692bc0b81
1 changed files with 18 additions and 3 deletions

View File

@ -374,6 +374,7 @@ UpdateMailboxContent (
Mailbox->SequenceNo = (UINT8) Value; Mailbox->SequenceNo = (UINT8) Value;
break; break;
case DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX: 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)) Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->HostSequenceNo, sizeof(UINT8))
- CalculateSum8 ((UINT8 *)&Value, sizeof(UINT8)); - CalculateSum8 ((UINT8 *)&Value, sizeof(UINT8));
Mailbox->HostSequenceNo = (UINT8) Value; Mailbox->HostSequenceNo = (UINT8) Value;
@ -572,6 +573,7 @@ DebugAgentDataMsgPrint (
@retval EFI_SUCCESS Read the symbol in BreakSymbol. @retval EFI_SUCCESS Read the symbol in BreakSymbol.
@retval EFI_CRC_ERROR CRC check fail. @retval EFI_CRC_ERROR CRC check fail.
@retval EFI_TIMEOUT Timeout occurs when reading debug packet. @retval EFI_TIMEOUT Timeout occurs when reading debug packet.
@retval EFI_DEVICE_ERROR Receive the old or responsed packet.
**/ **/
EFI_STATUS EFI_STATUS
@ -581,6 +583,8 @@ ReadRemainingBreakPacket (
) )
{ {
UINT16 Crc; UINT16 Crc;
DEBUG_AGENT_MAILBOX *Mailbox;
// //
// Has received start symbol, try to read the rest part // Has received start symbol, try to read the rest part
// //
@ -599,9 +603,20 @@ ReadRemainingBreakPacket (
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, FALSE, (UINT8 *)DebugHeader, DebugHeader->Length); DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, FALSE, (UINT8 *)DebugHeader, DebugHeader->Length);
return EFI_CRC_ERROR; return EFI_CRC_ERROR;
} }
Mailbox = GetMailboxPointer();
UpdateMailboxContent (GetMailboxPointer(), DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo); 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; return EFI_SUCCESS;
} else {
//
// If one old command or response packet received, skip it
//
return EFI_DEVICE_ERROR;
}
} }
/** /**