diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-11 02:15:11 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-06-11 02:15:11 +0000 |
commit | 93c0bdec2807cd968a89a0ac01a379a90fa50f93 (patch) | |
tree | 6d5fea7bf8312b2101fe64c295877e20047ed420 /SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h | |
parent | 44538ba5aa759c4039fc6c588d33a7fe03503c3f (diff) | |
download | edk2-platforms-93c0bdec2807cd968a89a0ac01a379a90fa50f93.tar.xz |
This revision can only work with Intel(c) UDK Debugger Tool version 1.2 or greater. Detailed change log is as below:
1. Define the transfer protocol revision mechanism. Increase the revision number to 0.2 and inform user to use the latest one when the HOST software is too old.
New HOST software will implement logic to handle all other revision mismatch cases.
2. Define new debug message packet to print the debug agent trace information by debug port channel.
3. Add check sum mechanism in the communication protocol between TARGET/HOST.
4. Introduced one "try" mechanism to avoid Debug Agent crashed by some invalid HOST command.
5. Enable the late-attach feature: Change the break in from "!" to "\xFC". Add a new short symbol "\xFA" for attach and a new debug command for detach.
6. Support Terminal work on debug port by install EFI Serial IO protocol upon Debug Communication Library.
7. Enable CPUID feature.
8. Enable the hardware data breakpoint.
9. add handshake to improve usb debug cable identify stability issue.
10.Refine all the communication protocol packet to improve extensibility and debugging performance.
a. Use 64bit for IO port address.
b. Add additional Width field to READ_MEMORY/WRITE_MEMORY.
c. Add SEARCH_SIGNATURE support to speed the symbol finding for late attach.
d. Remove READ_GROUP register.
e. Add READ_ALL_REGISTERS support (WinDbg always requests to read all registers).
11.Move AcquireDebugPortControl () in advance to fix resource collision on IpiSentByApFlag.
12.Fix IO break point does not work issue in PEI phase.
13.Avoid BSP/APs collision when they met break point at the same time.
14.Solve a bug of calculating debug handle in sec phase.
15.Use mailbox content at Dxe phase but not clear it and reinitialize again.
16.Fix FP/MMX/XMM/IO/MSR access issue in both Gdb and WinDbg.
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13437 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h')
-rw-r--r-- | SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h | 212 |
1 files changed, 74 insertions, 138 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h index 22bdaa637f..61448448d4 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h +++ b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/DebugAgent.h @@ -31,6 +31,7 @@ #include <Library/LocalApicLib.h>
#include <Library/DebugLib.h>
#include <Library/TimerLib.h>
+#include <Library/PrintLib.h>
#include <TransferProtocol.h>
#include <ImageDebugSupport.h>
@@ -39,9 +40,6 @@ #include "DebugTimer.h"
#include "ArchDebugSupport.h"
-#define DEBUG_AGENT_REVISION ((0 << 16) | 01)
-#define DEBUG_AGENT_CAPABILITIES 0
-
#define DEBUG_INT1_VECTOR 1
#define DEBUG_INT3_VECTOR 3
#define DEBUG_TIMER_VECTOR 32
@@ -55,19 +53,46 @@ extern UINTN Exception0Handle; extern UINTN TimerInterruptHandle;
extern UINT16 ExceptionStubHeaderSize;
-typedef union {
- struct {
- UINT32 HostPresent : 1;
- UINT32 BreakOnNextSmi : 1;
- UINT32 Reserved : 30;
- } Bits;
- UINT32 Uint32;
-} DEBUG_AGENT_FLAG;
+//
+// CPU exception information issued by debug agent
+//
+typedef struct {
+ //
+ // This field is used to save CPU content before executing HOST command
+ //
+ BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
+ //
+ // This filed returens the exception information issued by HOST command
+ //
+ DEBUG_DATA_RESPONSE_GET_EXCEPTION ExceptionContent;
+} DEBUG_AGENT_EXCEPTION_BUFFER;
#pragma pack(1)
typedef struct {
+ //
+ // Lower 32 bits to store the status of DebugAgent
+ //
+ UINT32 HostAttached : 1; // 1: HOST is attached
+ UINT32 AgentInProgress : 1; // 1: Debug Agent is communicating with HOST
+ UINT32 MemoryReady : 1; // 1: Memory is ready
+ UINT32 SteppingFlag : 1; // 1: Agent is running stepping command
+ UINT32 Reserved1 : 28;
+
+ //
+ // Higher 32bits to control the behavior of DebugAgent
+ //
+ UINT32 BreakOnNextSmi : 1; // 1: Break on next SMI
+ UINT32 PrintErrorLevel : 8; // Bitmask of print error level for debug message
+ UINT32 Reserved2 : 23;
+} DEBUG_AGENT_FLAG;
+
+typedef struct {
DEBUG_AGENT_FLAG DebugFlag;
UINT64 DebugPortHandle;
+ //
+ // Pointer to DEBUG_AGENT_EXCEPTION_BUFFER
+ //
+ UINT64 ExceptionBufferPointer;
} DEBUG_AGENT_MAILBOX;
#pragma pack()
@@ -116,30 +141,10 @@ InitializeDebugIdt ( );
/**
- Write specified register into save CPU context.
-
- @param[in] CpuContext Pointer to saved CPU context.
- @param[in] Index Register index value.
- @param[in] Offset Offset in register address range
- @param[in] Width Data width to read.
- @param[in] RegisterBuffer Pointer to input buffer with data.
-
-**/
-VOID
-ArchWriteRegisterBuffer (
- IN DEBUG_CPU_CONTEXT *CpuContext,
- IN UINT8 Index,
- IN UINT8 Offset,
- IN UINT8 Width,
- IN UINT8 *RegisterBuffer
- );
-
-/**
Read register value from saved CPU context.
@param[in] CpuContext Pointer to saved CPU context.
@param[in] Index Register index value.
- @param[in] Offset Offset in register address range
@param[in] Width Data width to read.
@return The address of register value.
@@ -149,14 +154,12 @@ UINT8 * ArchReadRegisterBuffer (
IN DEBUG_CPU_CONTEXT *CpuContext,
IN UINT8 Index,
- IN UINT8 Offset,
IN UINT8 *Width
);
/**
Send packet with response data to HOST.
- @param[in] CpuContext Pointer to saved CPU context.
@param[in] Data Pointer to response data buffer.
@param[in] DataSize Size of response data in byte.
@@ -166,145 +169,78 @@ ArchReadRegisterBuffer ( **/
RETURN_STATUS
SendDataResponsePacket (
- IN DEBUG_CPU_CONTEXT *CpuContext,
IN UINT8 *Data,
IN UINT16 DataSize
);
/**
- Read segment selector by register index.
-
- @param[in] CpuContext Pointer to saved CPU context.
- @param[in] RegisterIndex Register Index.
+ Check if HOST is attached based on Mailbox.
- @return Value of segment selector.
+ @retval TRUE HOST is attached.
+ @retval FALSE HOST is not attached.
**/
-UINT64
-ReadRegisterSelectorByIndex (
- IN DEBUG_CPU_CONTEXT *CpuContext,
- IN UINT8 RegisterIndex
- );
-
-/**
- Read group register of common registers.
-
- @param[in] CpuContext Pointer to saved CPU context.
- @param[in] RegisterGroup Pointer to Group registers.
-
-**/
-VOID
-ReadRegisterGroup (
- IN DEBUG_CPU_CONTEXT *CpuContext,
- IN DEBUG_DATA_REPONSE_READ_REGISTER_GROUP *RegisterGroup
- );
-
-/**
- Read group register of Segment Base.
-
- @param[in] CpuContext Pointer to saved CPU context.
- @param[in] RegisterGroupSegBase Pointer to Group registers.
-
-**/
-VOID
-ReadRegisterGroupSegBase (
- IN DEBUG_CPU_CONTEXT *CpuContext,
- IN DEBUG_DATA_REPONSE_READ_REGISTER_GROUP_SEGBASE *RegisterGroupSegBase
- );
-
-/**
- Read gourp register of Segment Limit.
-
- @param[in] CpuContext Pointer to saved CPU context.
- @param[in] RegisterGroupSegLim Pointer to Group registers.
-
-**/
-VOID
-ReadRegisterGroupSegLim (
- IN DEBUG_CPU_CONTEXT *CpuContext,
- IN DEBUG_DATA_REPONSE_READ_REGISTER_GROUP_SEGLIM *RegisterGroupSegLim
+BOOLEAN
+IsHostAttached (
+ VOID
);
/**
- Read group register by group index.
-
- @param[in] CpuContext Pointer to saved CPU context.
- @param[in] GroupIndex Group Index.
+ Get Debug Agent Mailbox pointer.
- @retval RETURN_SUCCESS Read successfully.
- @retval RETURN_NOT_SUPPORTED Group index cannot be supported.
+ @return Mailbox pointer.
**/
-RETURN_STATUS
-ArchReadRegisterGroup (
- IN DEBUG_CPU_CONTEXT *CpuContext,
- IN UINT8 GroupIndex
+DEBUG_AGENT_MAILBOX *
+GetMailboxPointer (
+ VOID
);
/**
- Send acknowledge packet to HOST.
+ Get debug port handle.
- @param AckCommand Type of Acknowledge packet.
+ @return Debug port handle.
**/
-VOID
-SendAckPacket (
- IN UINT8 AckCommand
+DEBUG_PORT_HANDLE
+GetDebugPortHandle (
+ VOID
);
/**
- Receive acknowledge packet OK from HOST in specified time.
-
- @param[in] Timeout Time out value to wait for acknowlege from HOST.
- The unit is microsecond.
- @param[out] BreakReceived If BreakReceived is not NULL,
- TRUE is retured if break-in symbol received.
- FALSE is retured if break-in symbol not received.
-
- @retval RETRUEN_SUCCESS Succeed to receive acknowlege packet from HOST,
- the type of acknowlege packet saved in Ack.
- @retval RETURN_TIMEOUT Specified timeout value was up.
-
-**/
-RETURN_STATUS
-WaitForAckPacketOK (
- IN UINTN Timeout,
- OUT BOOLEAN *BreakReceived OPTIONAL
- );
+ Read the Attach/Break-in symbols from the debug port.
-/**
- Check if HOST is connected based on Mailbox.
+ @param[in] Handle Pointer to Debug Port handle.
+ @param[out] BreakSymbol Returned break symbol.
- @retval TRUE HOST is connected.
- @retval FALSE HOST is not connected.
+ @retval EFI_SUCCESS Read the symbol in BreakSymbol.
+ @retval EFI_NOT_FOUND No read the break symbol.
**/
-BOOLEAN
-IsHostConnected (
- VOID
+EFI_STATUS
+DebugReadBreakSymbol (
+ IN DEBUG_PORT_HANDLE Handle,
+ OUT UINT8 *BreakSymbol
);
/**
- Get Debug Agent Mailbox pointer.
+ Prints a debug message to the debug port if the specified error level is enabled.
- @return Mailbox pointer.
+ If any bit in ErrorLevel is also set in Mainbox, then print the message specified
+ by Format and the associated variable argument list to the debug port.
-**/
-DEBUG_AGENT_MAILBOX *
-GetMailboxPointer (
- VOID
- );
-
-/**
- Get debug port handle.
-
- @return Debug port handle.
+ @param[in] ErrorLevel The error level of the debug message.
+ @param[in] Format Format string for the debug message to print.
+ @param[in] ... Variable argument list whose contents are accessed
+ based on the format string specified by Format.
**/
-DEBUG_PORT_HANDLE
-GetDebugPortHandle (
- VOID
+VOID
+EFIAPI
+DebugAgentMsgPrint (
+ IN UINT8 ErrorLevel,
+ IN CHAR8 *Format,
+ ...
);
-
#endif
|