10#define _DEBUG_AGENT_H_
38#include "ArchDebugSupport.h"
39#include "DebugException.h"
44#define DEBUG_AGENT_INIT_PEI 9
45#define DEBUG_AGENT_INIT_DXE_LOAD 10
46#define DEBUG_AGENT_INIT_DXE_UNLOAD 11
47#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12
49#define DEBUG_INT1_VECTOR DEBUG_EXCEPT_DEBUG
50#define DEBUG_INT3_VECTOR DEBUG_EXCEPT_BREAKPOINT
51#define DEBUG_TIMER_VECTOR 32
52#define DEBUG_MAILBOX_VECTOR 33
57#define READ_PACKET_TIMEOUT (500 * 1000)
58#define DEBUG_TIMER_INTERVAL (100 * 1000)
60#define SOFT_INTERRUPT_SIGNATURE SIGNATURE_32('S','O','F','T')
61#define SYSTEM_RESET_SIGNATURE SIGNATURE_32('S','Y','S','R')
62#define MEMORY_READY_SIGNATURE SIGNATURE_32('M','E','M','R')
64extern UINTN Exception0Handle;
65extern UINTN TimerInterruptHandle;
66extern UINT32 ExceptionStubHeaderSize;
67extern BOOLEAN mSkipBreakpoint;
69extern UINTN mVectorHandoffInfoCount;
78 BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
85#define DEBUG_AGENT_FLAG_HOST_ATTACHED BIT0
86#define DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS BIT1
87#define DEBUG_AGENT_FLAG_MEMORY_READY BIT2
88#define DEBUG_AGENT_FLAG_STEPPING BIT3
89#define DEBUG_AGENT_FLAG_CHECK_MAILBOX_IN_HOB BIT4
90#define DEBUG_AGENT_FLAG_INIT_ARCH BIT5|BIT6
91#define DEBUG_AGENT_FLAG_INTERRUPT_FLAG BIT7
92#define DEBUG_AGENT_FLAG_BREAK_ON_NEXT_SMI BIT32
93#define DEBUG_AGENT_FLAG_PRINT_ERROR_LEVEL (BIT33|BIT34|BIT35|BIT36)
94#define DEBUG_AGENT_FLAG_BREAK_BOOT_SCRIPT BIT37
96#define DEBUG_MAILBOX_DEBUG_FLAG_INDEX 1
97#define DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX 2
98#define DEBUG_MAILBOX_EXCEPTION_BUFFER_POINTER_INDEX 3
99#define DEBUG_MAILBOX_LAST_ACK 4
100#define DEBUG_MAILBOX_SEQUENCE_NO_INDEX 5
101#define DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX 6
102#define DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY 7
110 UINT32 HostAttached : 1;
111 UINT32 AgentInProgress : 1;
112 UINT32 MemoryReady : 1;
113 UINT32 SteppingFlag : 1;
114 UINT32 CheckMailboxInHob : 1;
116 UINT32 InterruptFlag : 1;
117 UINT32 Reserved1 : 24;
121 UINT32 BreakOnNextSmi : 1;
122 UINT32 PrintErrorLevel : 4;
123 UINT32 BreakOnBootScript : 1;
124 UINT32 Reserved2 : 26;
131 UINT64 DebugPortHandle;
135 UINT64 ExceptionBufferPointer;
138 UINT8 HostSequenceNo;
139 UINT32 DebugTimerFrequency;
161 UINT32 LimitLow : 16;
168 UINT32 LimitHigh : 4;
171 UINT32 DefaultSize : 1;
172 UINT32 Granularity : 1;
269 IN DEBUG_PORT_HANDLE Handle,
270 OUT UINT8 *BreakSymbol
427 IN VOID *ExceptionHandler
467 IN DEBUG_PORT_HANDLE Handle,
490 IN DEBUG_PORT_HANDLE Handle,
491 IN OUT UINT8 *Buffer,
UINTN DebugAgentReadBuffer(IN DEBUG_PORT_HANDLE Handle, IN OUT UINT8 *Buffer, IN UINTN NumberOfBytes, IN UINTN Timeout)
VOID UpdateMailboxContent(IN DEBUG_AGENT_MAILBOX *Mailbox, IN UINTN Index, IN UINT64 Value)
UINT32 GetDebugFlag(IN UINT64 FlagMask)
VOID EFIAPI DebugAgentMsgPrint(IN UINT8 ErrorLevel, IN CHAR8 *Format,...)
BOOLEAN IsHostAttached(VOID)
DEBUG_AGENT_MAILBOX * GetMailboxPointer(VOID)
VOID VerifyMailboxChecksum(IN DEBUG_AGENT_MAILBOX *Mailbox)
BOOLEAN MultiProcessorDebugSupport(VOID)
RETURN_STATUS SendDataResponsePacket(IN UINT8 *Data, IN UINT16 DataSize, IN OUT DEBUG_PACKET_HEADER *DebugHeader)
VOID UpdateMailboxChecksum(IN DEBUG_AGENT_MAILBOX *Mailbox)
VOID EFIAPI DebugAgentDataMsgPrint(IN UINT8 ErrorLevel, IN BOOLEAN IsSend, IN UINT8 *Data, IN UINT8 Length)
VOID SetDebugFlag(IN UINT64 FlagMask, IN UINT32 FlagValue)
VOID FindAndReportModuleImageInfo(IN UINTN AlignSize)
VOID * GetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum)
BOOLEAN IsDebugAgentInitialzed(VOID)
DEBUG_PORT_HANDLE GetDebugPortHandle(VOID)
VOID TriggerSoftInterrupt(IN UINT32 Signature)
EFI_STATUS ReadRemainingBreakPacket(IN DEBUG_PORT_HANDLE Handle, IN OUT DEBUG_PACKET_HEADER *DebugHeader)
EFI_STATUS DebugReadBreakSymbol(IN DEBUG_PORT_HANDLE Handle, OUT UINT8 *BreakSymbol)
UINT8 * ArchReadRegisterBuffer(IN DEBUG_CPU_CONTEXT *CpuContext, IN UINT8 Index, IN UINT8 *Width)
VOID InitializeDebugIdt(VOID)
VOID SetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum, IN VOID *ExceptionHandler)
UINT32 GateType
Gate Type. See #defines above.
UINT32 Reserved_0
Reserved.
UINT32 OffsetLow
Offset bits 15..0.
UINT32 OffsetHigh
Offset bits 31..16.