SourceLevelDebugPkg: Use CPU Local APIC timer to handle timeout.
Use CPU Local APIC timer to handle timeout when read data from debug port, instead of the TimerLib in Debug Communication lib instances. It could remove much duplicated code in Debug Communication Lib instances. Contributed-under: TianoCore Contribution Agreement 1.0 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@17089 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -60,6 +60,7 @@
|
||||
// Timeout value for reading packet (unit is microsecond)
|
||||
//
|
||||
#define READ_PACKET_TIMEOUT (500 * 1000)
|
||||
#define DEBUG_TIMER_INTERVAL (100 * 1000)
|
||||
|
||||
#define SOFT_INTERRUPT_SIGNATURE SIGNATURE_32('S','O','F','T')
|
||||
#define SYSTEM_RESET_SIGNATURE SIGNATURE_32('S','Y','S','R')
|
||||
@ -102,6 +103,7 @@ typedef struct {
|
||||
#define DEBUG_MAILBOX_LAST_ACK 4
|
||||
#define DEBUG_MAILBOX_SEQUENCE_NO_INDEX 5
|
||||
#define DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX 6
|
||||
#define DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY 7
|
||||
|
||||
#pragma pack(1)
|
||||
typedef union {
|
||||
@ -137,6 +139,7 @@ typedef struct {
|
||||
UINT8 LastAck; // The last ack packet type
|
||||
UINT8 SequenceNo;
|
||||
UINT8 HostSequenceNo;
|
||||
UINT32 DebugTimerFrequency;
|
||||
UINT8 CheckSum; // Mailbox checksum
|
||||
UINT8 ToBeCheckSum; // To be Mailbox checksum at the next
|
||||
} DEBUG_AGENT_MAILBOX;
|
||||
@ -469,5 +472,30 @@ ReadRemainingBreakPacket (
|
||||
IN OUT DEBUG_PACKET_HEADER *DebugHeader
|
||||
);
|
||||
|
||||
/**
|
||||
Read data from debug channel and save the data in buffer.
|
||||
|
||||
Reads NumberOfBytes data bytes from a debug device into the buffer
|
||||
specified by Buffer. The number of bytes actually read is returned.
|
||||
If the return value is less than NumberOfBytes, then the rest operation failed.
|
||||
If NumberOfBytes is zero, then return 0.
|
||||
|
||||
@param Handle Debug port handle.
|
||||
@param Buffer Pointer to the data buffer to store the data read from the debug device.
|
||||
@param NumberOfBytes Number of bytes which will be read.
|
||||
@param Timeout Timeout value for reading from debug device. It unit is Microsecond.
|
||||
|
||||
@retval 0 Read data failed, no data is to be read.
|
||||
@retval >0 Actual number of bytes read from debug device.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
DebugAgentReadBuffer (
|
||||
IN DEBUG_PORT_HANDLE Handle,
|
||||
IN OUT UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes,
|
||||
IN UINTN Timeout
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user