TianoCore EDK2 master
|
#include <Register/LocalApic.h>
#include <Guid/DebugAgentGuid.h>
#include <Guid/VectorHandoffTable.h>
#include <Ppi/VectorHandoffInfo.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/ResetSystemLib.h>
#include <Library/IoLib.h>
#include <Library/HobLib.h>
#include <Library/DebugCommunicationLib.h>
#include <Library/DebugAgentLib.h>
#include <Library/PcdLib.h>
#include <Library/SynchronizationLib.h>
#include <Library/LocalApicLib.h>
#include <Library/DebugLib.h>
#include <Library/TimerLib.h>
#include <Library/PrintLib.h>
#include <Library/PeCoffGetEntryPointLib.h>
#include <Library/PeCoffExtraActionLib.h>
#include <Register/ArchitecturalMsr.h>
#include <TransferProtocol.h>
#include <ImageDebugSupport.h>
#include "DebugMp.h"
#include "DebugTimer.h"
#include "ArchDebugSupport.h"
#include "DebugException.h"
Go to the source code of this file.
Data Structures | |
struct | DEBUG_AGENT_EXCEPTION_BUFFER |
union | DEBUG_AGENT_FLAG |
struct | DEBUG_AGENT_MAILBOX |
union | IA32_IDT_ENTRY |
union | IA32_GDT |
Functions | |
VOID | InitializeDebugIdt (VOID) |
UINT8 * | ArchReadRegisterBuffer (IN DEBUG_CPU_CONTEXT *CpuContext, IN UINT8 Index, IN UINT8 *Width) |
RETURN_STATUS | SendDataResponsePacket (IN UINT8 *Data, IN UINT16 DataSize, IN OUT DEBUG_PACKET_HEADER *DebugHeader) |
BOOLEAN | IsHostAttached (VOID) |
DEBUG_AGENT_MAILBOX * | GetMailboxPointer (VOID) |
DEBUG_PORT_HANDLE | GetDebugPortHandle (VOID) |
EFI_STATUS | DebugReadBreakSymbol (IN DEBUG_PORT_HANDLE Handle, OUT UINT8 *BreakSymbol) |
VOID EFIAPI | DebugAgentMsgPrint (IN UINT8 ErrorLevel, IN CHAR8 *Format,...) |
VOID | TriggerSoftInterrupt (IN UINT32 Signature) |
BOOLEAN | MultiProcessorDebugSupport (VOID) |
VOID | FindAndReportModuleImageInfo (IN UINTN AlignSize) |
BOOLEAN | IsDebugAgentInitialzed (VOID) |
VOID | UpdateMailboxChecksum (IN DEBUG_AGENT_MAILBOX *Mailbox) |
VOID | VerifyMailboxChecksum (IN DEBUG_AGENT_MAILBOX *Mailbox) |
VOID | SetDebugFlag (IN UINT64 FlagMask, IN UINT32 FlagValue) |
UINT32 | GetDebugFlag (IN UINT64 FlagMask) |
VOID | UpdateMailboxContent (IN DEBUG_AGENT_MAILBOX *Mailbox, IN UINTN Index, IN UINT64 Value) |
VOID * | GetExceptionHandlerInIdtEntry (IN UINTN ExceptionNum) |
VOID | SetExceptionHandlerInIdtEntry (IN UINTN ExceptionNum, IN VOID *ExceptionHandler) |
VOID EFIAPI | DebugAgentDataMsgPrint (IN UINT8 ErrorLevel, IN BOOLEAN IsSend, IN UINT8 *Data, IN UINT8 Length) |
EFI_STATUS | ReadRemainingBreakPacket (IN DEBUG_PORT_HANDLE Handle, IN OUT DEBUG_PACKET_HEADER *DebugHeader) |
UINTN | DebugAgentReadBuffer (IN DEBUG_PORT_HANDLE Handle, IN OUT UINT8 *Buffer, IN UINTN NumberOfBytes, IN UINTN Timeout) |
Variables | |
UINTN | Exception0Handle |
UINTN | TimerInterruptHandle |
UINT32 | ExceptionStubHeaderSize |
BOOLEAN | mSkipBreakpoint |
EFI_VECTOR_HANDOFF_INFO | mVectorHandoffInfoDebugAgent [] |
UINTN | mVectorHandoffInfoCount |
Command header of for Debug Agent library instance.
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DebugAgent.h.
#define DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS BIT1 |
Definition at line 86 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_BREAK_BOOT_SCRIPT BIT37 |
Definition at line 94 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_BREAK_ON_NEXT_SMI BIT32 |
Definition at line 92 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_CHECK_MAILBOX_IN_HOB BIT4 |
Definition at line 89 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_HOST_ATTACHED BIT0 |
Definition at line 85 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_INIT_ARCH BIT5|BIT6 |
Definition at line 90 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_INTERRUPT_FLAG BIT7 |
Definition at line 91 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_MEMORY_READY BIT2 |
Definition at line 87 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_PRINT_ERROR_LEVEL (BIT33|BIT34|BIT35|BIT36) |
Definition at line 93 of file DebugAgent.h.
#define DEBUG_AGENT_FLAG_STEPPING BIT3 |
Definition at line 88 of file DebugAgent.h.
#define DEBUG_AGENT_INIT_DXE_LOAD 10 |
Definition at line 45 of file DebugAgent.h.
#define DEBUG_AGENT_INIT_DXE_UNLOAD 11 |
Definition at line 46 of file DebugAgent.h.
#define DEBUG_AGENT_INIT_PEI 9 |
Definition at line 44 of file DebugAgent.h.
#define DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64 12 |
Definition at line 47 of file DebugAgent.h.
#define DEBUG_INT1_VECTOR DEBUG_EXCEPT_DEBUG |
Definition at line 49 of file DebugAgent.h.
#define DEBUG_INT3_VECTOR DEBUG_EXCEPT_BREAKPOINT |
Definition at line 50 of file DebugAgent.h.
#define DEBUG_MAILBOX_DEBUG_FLAG_INDEX 1 |
Definition at line 96 of file DebugAgent.h.
#define DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX 2 |
Definition at line 97 of file DebugAgent.h.
#define DEBUG_MAILBOX_DEBUG_TIMER_FREQUENCY 7 |
Definition at line 102 of file DebugAgent.h.
#define DEBUG_MAILBOX_EXCEPTION_BUFFER_POINTER_INDEX 3 |
Definition at line 98 of file DebugAgent.h.
#define DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX 6 |
Definition at line 101 of file DebugAgent.h.
#define DEBUG_MAILBOX_LAST_ACK 4 |
Definition at line 99 of file DebugAgent.h.
#define DEBUG_MAILBOX_SEQUENCE_NO_INDEX 5 |
Definition at line 100 of file DebugAgent.h.
#define DEBUG_MAILBOX_VECTOR 33 |
Definition at line 52 of file DebugAgent.h.
#define DEBUG_TIMER_INTERVAL (100 * 1000) |
Definition at line 58 of file DebugAgent.h.
#define DEBUG_TIMER_VECTOR 32 |
Definition at line 51 of file DebugAgent.h.
#define MEMORY_READY_SIGNATURE SIGNATURE_32('M','E','M','R') |
Definition at line 62 of file DebugAgent.h.
#define READ_PACKET_TIMEOUT (500 * 1000) |
Definition at line 57 of file DebugAgent.h.
#define SOFT_INTERRUPT_SIGNATURE SIGNATURE_32('S','O','F','T') |
Definition at line 60 of file DebugAgent.h.
#define SYSTEM_RESET_SIGNATURE SIGNATURE_32('S','Y','S','R') |
Definition at line 61 of file DebugAgent.h.
UINT8 * ArchReadRegisterBuffer | ( | IN DEBUG_CPU_CONTEXT * | CpuContext, |
IN UINT8 | Index, | ||
IN UINT8 * | Width | ||
) |
Read register value from saved CPU context.
[in] | CpuContext | Pointer to saved CPU context. |
[in] | Index | Register index value. |
[in] | Width | Data width to read. |
VOID EFIAPI DebugAgentDataMsgPrint | ( | IN UINT8 | ErrorLevel, |
IN BOOLEAN | IsSend, | ||
IN UINT8 * | Data, | ||
IN UINT8 | Length | ||
) |
Prints a debug message to the debug output device if the specified error level is enabled.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function GetDebugPrintErrorLevel (), then print the message specified by Format and the associated variable argument list to the debug output device.
If Format is NULL, then ASSERT().
[in] | ErrorLevel | The error level of the debug message. |
[in] | IsSend | Flag of debug message to declare that the data is being sent or being received. |
[in] | Data | Variable argument list whose contents are accessed |
[in] | Length | based on the format string specified by Format. |
Definition at line 561 of file DebugAgent.c.
Prints a debug message to the debug port if the specified error level is enabled.
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.
[in] | ErrorLevel | The error level of the debug message. |
[in] | Format | Format string for the debug message to print. |
[in] | ... | Variable argument list whose contents are accessed based on the format string specified by Format. |
Definition at line 518 of file DebugAgent.c.
UINTN DebugAgentReadBuffer | ( | IN DEBUG_PORT_HANDLE | Handle, |
IN OUT UINT8 * | Buffer, | ||
IN UINTN | NumberOfBytes, | ||
IN UINTN | Timeout | ||
) |
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.
Handle | Debug port handle. |
Buffer | Pointer to the data buffer to store the data read from the debug device. |
NumberOfBytes | Number of bytes which will be read. |
Timeout | Timeout value for reading from debug device. It unit is Microsecond. |
0 | Read data failed, no data is to be read. |
>0 | Actual number of bytes read from debug device. |
EFI_STATUS DebugReadBreakSymbol | ( | IN DEBUG_PORT_HANDLE | Handle, |
OUT UINT8 * | BreakSymbol | ||
) |
Read the Attach/Break-in symbols from the debug port.
[in] | Handle | Pointer to Debug Port handle. |
[out] | BreakSymbol | Returned break symbol. |
EFI_SUCCESS | Read the symbol in BreakSymbol. |
EFI_NOT_FOUND | No read the break symbol. |
Read the Attach/Break-in symbols.
[in] | Handle | Pointer to Debug Port handle. |
[out] | BreakSymbol | Returned break symbol. |
EFI_SUCCESS | Read the symbol in BreakSymbol. |
EFI_NOT_FOUND | No read the break symbol. |
Definition at line 806 of file SerialIo.c.
Find and report module image info to HOST.
[in] | AlignSize | Image aligned size. |
Definition at line 193 of file DebugAgent.c.
UINT32 GetDebugFlag | ( | IN UINT64 | FlagMask | ) |
Get debug flag in mailbox.
[in] | FlagMask | Debug flag mask value. |
Definition at line 458 of file DebugAgent.c.
DEBUG_PORT_HANDLE GetDebugPortHandle | ( | VOID | ) |
Retrieve exception handler from IDT table by ExceptionNum.
[in] | ExceptionNum | Exception number |
Definition at line 76 of file ArchDebugSupport.c.
DEBUG_AGENT_MAILBOX * GetMailboxPointer | ( | VOID | ) |
Get Debug Agent Mailbox pointer.
Definition at line 209 of file DxeDebugAgentLib.c.
VOID InitializeDebugIdt | ( | VOID | ) |
Initialize IDT entries to support source level debug.
Definition at line 16 of file ArchDebugSupport.c.
BOOLEAN IsDebugAgentInitialzed | ( | VOID | ) |
Read IDT entry to check if IDT entries are setup by Debug Agent.
TRUE | IDT entries were setup by Debug Agent. |
FALSE | IDT entries were not setup by Debug Agent. |
Definition at line 172 of file DebugAgent.c.
BOOLEAN IsHostAttached | ( | VOID | ) |
Check if HOST is attached based on Mailbox.
TRUE | HOST is attached. |
FALSE | HOST is not attached. |
Definition at line 676 of file DebugAgent.c.
BOOLEAN MultiProcessorDebugSupport | ( | VOID | ) |
Check if debug agent support multi-processor.
TRUE | Multi-processor is supported. |
FALSE | Multi-processor is not supported. |
Definition at line 29 of file DxeDebugAgentLib.c.
EFI_STATUS ReadRemainingBreakPacket | ( | IN DEBUG_PORT_HANDLE | Handle, |
IN OUT DEBUG_PACKET_HEADER * | DebugHeader | ||
) |
Read remaining debug packet except for the start symbol
[in] | Handle | Pointer to Debug Port handle. |
[in,out] | DebugHeader | Debug header buffer including start symbol. |
EFI_SUCCESS | Read the symbol in BreakSymbol. |
EFI_CRC_ERROR | CRC check fail. |
EFI_TIMEOUT | Timeout occurs when reading debug packet. |
Read remaining debug packet except for the start symbol
[in] | Handle | Pointer to Debug Port handle. |
[in,out] | DebugHeader | Debug header buffer including start symbol. |
EFI_SUCCESS | Read the symbol in BreakSymbol. |
EFI_CRC_ERROR | CRC check fail. |
EFI_TIMEOUT | Timeout occurs when reading debug packet. |
EFI_DEVICE_ERROR | Receive the old or response packet. |
Definition at line 623 of file DebugAgent.c.
RETURN_STATUS SendDataResponsePacket | ( | IN UINT8 * | Data, |
IN UINT16 | DataSize, | ||
IN OUT DEBUG_PACKET_HEADER * | DebugHeader | ||
) |
Send packet with response data to HOST.
[in] | Data | Pointer to response data buffer. |
[in] | DataSize | Size of response data in byte. |
[in,out] | DebugHeader | Pointer to a buffer for creating response packet and receiving ACK packet, to minimize the stack usage. |
RETURN_SUCCESS | Response data was sent successfully. |
RETURN_DEVICE_ERROR | Cannot receive DEBUG_COMMAND_OK from HOST. |
Send packet with response data to HOST.
[in] | Data | Pointer to response data buffer. |
[in] | DataSize | Size of response data in byte. |
[in,out] | DebugHeader | Pointer to a buffer for creating response packet and receiving ACK packet, to minimize the stack usage. |
RETURN_SUCCESS | Response data was sent successfully. |
Definition at line 1688 of file DebugAgent.c.
Set debug flag in mailbox.
[in] | FlagMask | Debug flag mask value. |
[in] | FlagValue | Debug flag value. |
Definition at line 435 of file DebugAgent.c.
Set exception handler in IDT table by ExceptionNum.
[in] | ExceptionNum | Exception number |
[in] | ExceptionHandler | Exception Handler to be set |
Definition at line 98 of file ArchDebugSupport.c.
VOID TriggerSoftInterrupt | ( | IN UINT32 | Signature | ) |
Trigger one software interrupt to debug agent to handle it.
[in] | Signature | Software interrupt signature. |
Definition at line 218 of file DebugAgent.c.
VOID UpdateMailboxChecksum | ( | IN DEBUG_AGENT_MAILBOX * | Mailbox | ) |
Calculate Mailbox checksum and update the checksum field.
[in] | Mailbox | Debug Agent Mailbox pointer. |
Definition at line 257 of file DebugAgent.c.
VOID UpdateMailboxContent | ( | IN DEBUG_AGENT_MAILBOX * | Mailbox, |
IN UINTN | Index, | ||
IN UINT64 | Value | ||
) |
Update Mailbox content by index.
[in] | Mailbox | Debug Agent Mailbox pointer. |
[in] | Index | Mailbox content index. |
[in] | Value | Value to be set into mail box. |
Update Mailbox content by index.
[in] | Mailbox | Debug Agent Mailbox pointer. |
[in] | Index | Mailbox content index. |
[in] | Value | Value to be set into Mailbox. |
Definition at line 300 of file DebugAgent.c.
VOID VerifyMailboxChecksum | ( | IN DEBUG_AGENT_MAILBOX * | Mailbox | ) |
Verify Mailbox checksum.
If checksum error, print debug message and run init dead loop.
[in] | Mailbox | Debug Agent Mailbox pointer. |
Definition at line 273 of file DebugAgent.c.
|
extern |
Definition at line 19 of file DxeDebugAgentLib.c.
|
extern |
Definition at line 127 of file DebugAgent.c.
|
extern |
Definition at line 24 of file DebugAgent.c.