1. Remove any references on other files from DebugTimer.c, to avoid un-used symbols linked.
2. Add GLOBAL_REMOVE_IF_UNREFERENCED for all global variables. 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@16298 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -18,16 +18,16 @@
|
|||||||
#include "DebugAgent.h"
|
#include "DebugAgent.h"
|
||||||
#include "Ia32/DebugException.h"
|
#include "Ia32/DebugException.h"
|
||||||
|
|
||||||
CHAR8 mErrorMsgVersionAlert[] = "\rThe SourceLevelDebugPkg you are using requires a newer version of the Intel(R) UDK Debugger Tool.\r\n";
|
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgVersionAlert[] = "\rThe SourceLevelDebugPkg you are using requires a newer version of the Intel(R) UDK Debugger Tool.\r\n";
|
||||||
CHAR8 mErrorMsgSendInitPacket[] = "\rSend INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.4) ...\r\n";
|
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgSendInitPacket[] = "\rSend INIT break packet and try to connect the HOST (Intel(R) UDK Debugger Tool v1.4) ...\r\n";
|
||||||
CHAR8 mErrorMsgConnectOK[] = "HOST connection is successful!\r\n";
|
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectOK[] = "HOST connection is successful!\r\n";
|
||||||
CHAR8 mErrorMsgConnectFail[] = "HOST connection is failed!\r\n";
|
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectFail[] = "HOST connection is failed!\r\n";
|
||||||
CHAR8 mWarningMsgIngoreBreakpoint[] = "Ignore break point in SMM for SMI issued during DXE debugging!\r\n";
|
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mWarningMsgIngoreBreakpoint[] = "Ignore break point in SMM for SMI issued during DXE debugging!\r\n";
|
||||||
|
|
||||||
//
|
//
|
||||||
// Vector Handoff Info list used by Debug Agent for persist
|
// Vector Handoff Info list used by Debug Agent for persist
|
||||||
//
|
//
|
||||||
EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {
|
||||||
{
|
{
|
||||||
DEBUG_EXCEPT_DIVIDE_ERROR, // Vector 0
|
DEBUG_EXCEPT_DIVIDE_ERROR, // Vector 0
|
||||||
EFI_VECTOR_HANDOFF_HOOK_BEFORE,
|
EFI_VECTOR_HANDOFF_HOOK_BEFORE,
|
||||||
@ -130,7 +130,7 @@ EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
|
GLOBAL_REMOVE_IF_UNREFERENCED UINTN mVectorHandoffInfoCount = sizeof (mVectorHandoffInfoDebugAgent) / sizeof (EFI_VECTOR_HANDOFF_INFO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Calculate CRC16 for target data.
|
Calculate CRC16 for target data.
|
||||||
@ -174,7 +174,7 @@ CalculateCrc16 (
|
|||||||
@retval FALSE IDT entries were not setup by Debug Agent.
|
@retval FALSE IDT entries were not setup by Debug Agent.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsDebugAgentInitialzed (
|
IsDebugAgentInitialzed (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@ -191,13 +191,13 @@ IsDebugAgentInitialzed (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Find and report module image info to HOST.
|
Find and report module image info to HOST.
|
||||||
|
|
||||||
@param[in] AlignSize Image aligned size.
|
@param[in] AlignSize Image aligned size.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
FindAndReportModuleImageInfo (
|
FindAndReportModuleImageInfo (
|
||||||
IN UINTN AlignSize
|
IN UINTN AlignSize
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Pe32Data;
|
UINTN Pe32Data;
|
||||||
@ -243,7 +243,7 @@ FindAndReportModuleImageInfo (
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Not found the image base, check the previous aligned address
|
// Not found the image base, check the previous aligned address
|
||||||
//
|
//
|
||||||
Pe32Data -= AlignSize;
|
Pe32Data -= AlignSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ UpdateMailboxChecksum (
|
|||||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Mailbox->CheckSum = CalculateCheckSum8 ((UINT8 *)Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);
|
Mailbox->CheckSum = CalculateCheckSum8 ((UINT8 *)Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -314,16 +314,16 @@ UpdateMailboxChecksum (
|
|||||||
@param[in] Mailbox Debug Agent Mailbox pointer.
|
@param[in] Mailbox Debug Agent Mailbox pointer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
VerifyMailboxChecksum (
|
VerifyMailboxChecksum (
|
||||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT8 CheckSum;
|
UINT8 CheckSum;
|
||||||
|
|
||||||
CheckSum = CalculateCheckSum8 ((UINT8 *) Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);
|
CheckSum = CalculateCheckSum8 ((UINT8 *) Mailbox, sizeof (DEBUG_AGENT_MAILBOX) - 2);
|
||||||
//
|
//
|
||||||
// The checksum updating process may be disturbed by hardware SMI, we need to check CheckSum field
|
// The checksum updating process may be disturbed by hardware SMI, we need to check CheckSum field
|
||||||
// and ToBeCheckSum field to validate the mail box.
|
// and ToBeCheckSum field to validate the mail box.
|
||||||
//
|
//
|
||||||
if (CheckSum != Mailbox->CheckSum && CheckSum != Mailbox->ToBeCheckSum) {
|
if (CheckSum != Mailbox->CheckSum && CheckSum != Mailbox->ToBeCheckSum) {
|
||||||
@ -339,10 +339,10 @@ VerifyMailboxChecksum (
|
|||||||
@param[in] Mailbox Debug Agent Mailbox pointer.
|
@param[in] Mailbox Debug Agent Mailbox pointer.
|
||||||
@param[in] Index Mailbox content index.
|
@param[in] Index Mailbox content index.
|
||||||
@param[in] Value Value to be set into Mailbox.
|
@param[in] Value Value to be set into Mailbox.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
UpdateMailboxContent (
|
UpdateMailboxContent (
|
||||||
IN DEBUG_AGENT_MAILBOX *Mailbox,
|
IN DEBUG_AGENT_MAILBOX *Mailbox,
|
||||||
IN UINTN Index,
|
IN UINTN Index,
|
||||||
IN UINT64 Value
|
IN UINT64 Value
|
||||||
@ -351,7 +351,7 @@ UpdateMailboxContent (
|
|||||||
AcquireMpSpinLock (&mDebugMpContext.MailboxSpinLock);
|
AcquireMpSpinLock (&mDebugMpContext.MailboxSpinLock);
|
||||||
switch (Index) {
|
switch (Index) {
|
||||||
case DEBUG_MAILBOX_DEBUG_FLAG_INDEX:
|
case DEBUG_MAILBOX_DEBUG_FLAG_INDEX:
|
||||||
Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->DebugFlag.Uint64, sizeof(UINT64))
|
Mailbox->ToBeCheckSum = Mailbox->CheckSum + CalculateSum8 ((UINT8 *)&Mailbox->DebugFlag.Uint64, sizeof(UINT64))
|
||||||
- CalculateSum8 ((UINT8 *)&Value, sizeof(UINT64));
|
- CalculateSum8 ((UINT8 *)&Value, sizeof(UINT64));
|
||||||
Mailbox->DebugFlag.Uint64 = Value;
|
Mailbox->DebugFlag.Uint64 = Value;
|
||||||
break;
|
break;
|
||||||
@ -391,10 +391,10 @@ UpdateMailboxContent (
|
|||||||
@param[in] FlagValue Debug flag value.
|
@param[in] FlagValue Debug flag value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetDebugFlag (
|
SetDebugFlag (
|
||||||
IN UINT64 FlagMask,
|
IN UINT64 FlagMask,
|
||||||
IN UINT32 FlagValue
|
IN UINT32 FlagValue
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||||
@ -410,7 +410,7 @@ SetDebugFlag (
|
|||||||
Get debug flag in mailbox.
|
Get debug flag in mailbox.
|
||||||
|
|
||||||
@param[in] FlagMask Debug flag mask value.
|
@param[in] FlagMask Debug flag mask value.
|
||||||
|
|
||||||
@return Debug flag value.
|
@return Debug flag value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -438,12 +438,12 @@ GetDebugFlag (
|
|||||||
VOID
|
VOID
|
||||||
SendDebugMsgPacket (
|
SendDebugMsgPacket (
|
||||||
IN CHAR8 *Buffer,
|
IN CHAR8 *Buffer,
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DEBUG_PACKET_HEADER DebugHeader;
|
DEBUG_PACKET_HEADER DebugHeader;
|
||||||
DEBUG_PORT_HANDLE Handle;
|
DEBUG_PORT_HANDLE Handle;
|
||||||
|
|
||||||
Handle = GetDebugPortHandle();
|
Handle = GetDebugPortHandle();
|
||||||
|
|
||||||
DebugHeader.StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;
|
DebugHeader.StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;
|
||||||
@ -468,7 +468,7 @@ SendDebugMsgPacket (
|
|||||||
|
|
||||||
@param[in] ErrorLevel The error level of the debug message.
|
@param[in] ErrorLevel The error level of the debug message.
|
||||||
@param[in] Format Format string for the debug message to print.
|
@param[in] Format Format string for the debug message to print.
|
||||||
@param[in] ... Variable argument list whose contents are accessed
|
@param[in] ... Variable argument list whose contents are accessed
|
||||||
based on the format string specified by Format.
|
based on the format string specified by Format.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -503,15 +503,15 @@ DebugAgentMsgPrint (
|
|||||||
/**
|
/**
|
||||||
Prints a debug message to the debug output device if the specified error level is enabled.
|
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
|
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
|
||||||
GetDebugPrintErrorLevel (), then print the message specified by Format and the
|
GetDebugPrintErrorLevel (), then print the message specified by Format and the
|
||||||
associated variable argument list to the debug output device.
|
associated variable argument list to the debug output device.
|
||||||
|
|
||||||
If Format is NULL, then ASSERT().
|
If Format is NULL, then ASSERT().
|
||||||
|
|
||||||
@param[in] ErrorLevel The error level of the debug message.
|
@param[in] ErrorLevel The error level of the debug message.
|
||||||
@param[in] IsSend Flag of debug message to declare that the data is being sent or being received.
|
@param[in] IsSend Flag of debug message to declare that the data is being sent or being received.
|
||||||
@param[in] Data Variable argument list whose contents are accessed
|
@param[in] Data Variable argument list whose contents are accessed
|
||||||
@param[in] Length based on the format string specified by Format.
|
@param[in] Length based on the format string specified by Format.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
@ -521,7 +521,7 @@ DebugAgentDataMsgPrint (
|
|||||||
IN UINT8 ErrorLevel,
|
IN UINT8 ErrorLevel,
|
||||||
IN BOOLEAN IsSend,
|
IN BOOLEAN IsSend,
|
||||||
IN UINT8 *Data,
|
IN UINT8 *Data,
|
||||||
IN UINT8 Length
|
IN UINT8 Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 Buffer[DEBUG_DATA_MAXIMUM_REAL_DATA];
|
CHAR8 Buffer[DEBUG_DATA_MAXIMUM_REAL_DATA];
|
||||||
@ -546,7 +546,7 @@ DebugAgentDataMsgPrint (
|
|||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (DestBuffer - Buffer > DEBUG_DATA_MAXIMUM_REAL_DATA - 6) {
|
if (DestBuffer - Buffer > DEBUG_DATA_MAXIMUM_REAL_DATA - 6) {
|
||||||
//
|
//
|
||||||
// If there was no enough space in buffer, send out the debug message,
|
// If there was no enough space in buffer, send out the debug message,
|
||||||
// reserving 6 bytes is for the last data and end characters "]\n".
|
// reserving 6 bytes is for the last data and end characters "]\n".
|
||||||
//
|
//
|
||||||
SendDebugMsgPacket (Buffer, DestBuffer - Buffer);
|
SendDebugMsgPacket (Buffer, DestBuffer - Buffer);
|
||||||
@ -608,7 +608,7 @@ ReadRemainingBreakPacket (
|
|||||||
if (((DebugHeader->Command & DEBUG_COMMAND_RESPONSE) == 0) &&
|
if (((DebugHeader->Command & DEBUG_COMMAND_RESPONSE) == 0) &&
|
||||||
(DebugHeader->SequenceNo == (UINT8) (Mailbox->HostSequenceNo + 1))) {
|
(DebugHeader->SequenceNo == (UINT8) (Mailbox->HostSequenceNo + 1))) {
|
||||||
//
|
//
|
||||||
// Only updagte HostSequenceNo for new command packet
|
// Only updagte HostSequenceNo for new command packet
|
||||||
//
|
//
|
||||||
UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo);
|
UpdateMailboxContent (Mailbox, DEBUG_MAILBOX_HOST_SEQUENCE_NO_INDEX, DebugHeader->SequenceNo);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
@ -639,7 +639,7 @@ IsHostAttached (
|
|||||||
Set HOST connect flag in Mailbox.
|
Set HOST connect flag in Mailbox.
|
||||||
|
|
||||||
@param[in] Attached Attach status.
|
@param[in] Attached Attach status.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SetHostAttached (
|
SetHostAttached (
|
||||||
@ -654,14 +654,14 @@ SetHostAttached (
|
|||||||
Set debug setting of Debug Agent in Mailbox.
|
Set debug setting of Debug Agent in Mailbox.
|
||||||
|
|
||||||
@param DebugSetting Pointer to Debug Setting defined by transfer protocol.
|
@param DebugSetting Pointer to Debug Setting defined by transfer protocol.
|
||||||
|
|
||||||
@retval RETURN_SUCCESS The setting is set successfully.
|
@retval RETURN_SUCCESS The setting is set successfully.
|
||||||
@retval RETURN_UNSUPPORTED The Key value is not supported.
|
@retval RETURN_UNSUPPORTED The Key value is not supported.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
RETURN_STATUS
|
RETURN_STATUS
|
||||||
SetDebugSetting (
|
SetDebugSetting (
|
||||||
IN DEBUG_DATA_SET_DEBUG_SETTING *DebugSetting
|
IN DEBUG_DATA_SET_DEBUG_SETTING *DebugSetting
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
RETURN_STATUS Status;
|
RETURN_STATUS Status;
|
||||||
@ -994,7 +994,7 @@ ReceivePacket (
|
|||||||
} else {
|
} else {
|
||||||
TimeoutForStartSymbol = Timeout;
|
TimeoutForStartSymbol = Timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugHeader = (DEBUG_PACKET_HEADER *) InputPacket;
|
DebugHeader = (DEBUG_PACKET_HEADER *) InputPacket;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
//
|
//
|
||||||
@ -1189,13 +1189,13 @@ GetBreakCause (
|
|||||||
|
|
||||||
if (CpuContext->Dr3 == IO_PORT_BREAKPOINT_ADDRESS) {
|
if (CpuContext->Dr3 == IO_PORT_BREAKPOINT_ADDRESS) {
|
||||||
|
|
||||||
Cause = (UINT8) ((CpuContext->Dr0 == IMAGE_LOAD_SIGNATURE) ?
|
Cause = (UINT8) ((CpuContext->Dr0 == IMAGE_LOAD_SIGNATURE) ?
|
||||||
DEBUG_DATA_BREAK_CAUSE_IMAGE_LOAD : DEBUG_DATA_BREAK_CAUSE_IMAGE_UNLOAD);
|
DEBUG_DATA_BREAK_CAUSE_IMAGE_LOAD : DEBUG_DATA_BREAK_CAUSE_IMAGE_UNLOAD);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOFT_INTERRUPT_SIGNATURE:
|
case SOFT_INTERRUPT_SIGNATURE:
|
||||||
|
|
||||||
if (CpuContext->Dr1 == MEMORY_READY_SIGNATURE) {
|
if (CpuContext->Dr1 == MEMORY_READY_SIGNATURE) {
|
||||||
Cause = DEBUG_DATA_BREAK_CAUSE_MEMORY_READY;
|
Cause = DEBUG_DATA_BREAK_CAUSE_MEMORY_READY;
|
||||||
CpuContext->Dr0 = 0;
|
CpuContext->Dr0 = 0;
|
||||||
@ -1359,7 +1359,7 @@ ReadMemoryAndSendResponsePacket (
|
|||||||
DebugHeader->Crc = CalculateCrc16 ((UINT8 *) DebugHeader, DebugHeader->Length, 0);
|
DebugHeader->Crc = CalculateCrc16 ((UINT8 *) DebugHeader, DebugHeader->Length, 0);
|
||||||
|
|
||||||
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, TRUE, (UINT8 *) DebugHeader, DebugHeader->Length);
|
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, TRUE, (UINT8 *) DebugHeader, DebugHeader->Length);
|
||||||
|
|
||||||
DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, DebugHeader->Length);
|
DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, DebugHeader->Length);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
@ -1439,12 +1439,12 @@ SendBreakCausePacket (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Try to attach the HOST.
|
Try to attach the HOST.
|
||||||
|
|
||||||
Send init break packet to HOST:
|
Send init break packet to HOST:
|
||||||
If no acknowlege received in specified Timeout, return RETURN_TIMEOUT.
|
If no acknowlege received in specified Timeout, return RETURN_TIMEOUT.
|
||||||
If received acknowlege, check the revision of HOST.
|
If received acknowlege, check the revision of HOST.
|
||||||
Set Attach Flag if attach successfully.
|
Set Attach Flag if attach successfully.
|
||||||
|
|
||||||
@param[in] BreakCause Break cause of this break event.
|
@param[in] BreakCause Break cause of this break event.
|
||||||
@param[in] Timeout Time out value to wait for acknowlege from HOST.
|
@param[in] Timeout Time out value to wait for acknowlege from HOST.
|
||||||
The unit is microsecond.
|
The unit is microsecond.
|
||||||
@ -1465,7 +1465,7 @@ AttachHost (
|
|||||||
|
|
||||||
IncompatibilityFlag = FALSE;
|
IncompatibilityFlag = FALSE;
|
||||||
Handle = GetDebugPortHandle();
|
Handle = GetDebugPortHandle();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Send init break and wait ack in Timeout
|
// Send init break and wait ack in Timeout
|
||||||
//
|
//
|
||||||
@ -1483,7 +1483,7 @@ AttachHost (
|
|||||||
DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgVersionAlert, AsciiStrLen (mErrorMsgVersionAlert));
|
DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgVersionAlert, AsciiStrLen (mErrorMsgVersionAlert));
|
||||||
CpuDeadLoop ();
|
CpuDeadLoop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RETURN_ERROR (Status)) {
|
if (RETURN_ERROR (Status)) {
|
||||||
DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgConnectFail, AsciiStrLen (mErrorMsgConnectFail));
|
DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgConnectFail, AsciiStrLen (mErrorMsgConnectFail));
|
||||||
} else {
|
} else {
|
||||||
@ -1497,8 +1497,8 @@ AttachHost (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Send Break point packet to HOST.
|
Send Break point packet to HOST.
|
||||||
|
|
||||||
Only the first breaking processor could sent BREAK_POINT packet.
|
Only the first breaking processor could sent BREAK_POINT packet.
|
||||||
|
|
||||||
@param[in] BreakCause Break cause of this break event.
|
@param[in] BreakCause Break cause of this break event.
|
||||||
@ -1506,7 +1506,7 @@ AttachHost (
|
|||||||
@param[out] BreakReceived If BreakReceived is not NULL,
|
@param[out] BreakReceived If BreakReceived is not NULL,
|
||||||
TRUE is retured if break-in symbol received.
|
TRUE is retured if break-in symbol received.
|
||||||
FALSE is retured if break-in symbol not received.
|
FALSE is retured if break-in symbol not received.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
SendBreakPacketToHost (
|
SendBreakPacketToHost (
|
||||||
@ -1517,9 +1517,9 @@ SendBreakPacketToHost (
|
|||||||
{
|
{
|
||||||
UINT8 InputCharacter;
|
UINT8 InputCharacter;
|
||||||
DEBUG_PORT_HANDLE Handle;
|
DEBUG_PORT_HANDLE Handle;
|
||||||
|
|
||||||
Handle = GetDebugPortHandle();
|
Handle = GetDebugPortHandle();
|
||||||
|
|
||||||
if (IsHostAttached ()) {
|
if (IsHostAttached ()) {
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "processor[%x]:Send Break Packet to HOST.\n", ProcessorIndex);
|
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "processor[%x]:Send Break Packet to HOST.\n", ProcessorIndex);
|
||||||
SendCommandAndWaitForAckOK (DEBUG_COMMAND_BREAK_POINT, READ_PACKET_TIMEOUT, BreakReceived, NULL);
|
SendCommandAndWaitForAckOK (DEBUG_COMMAND_BREAK_POINT, READ_PACKET_TIMEOUT, BreakReceived, NULL);
|
||||||
@ -1530,17 +1530,17 @@ SendBreakPacketToHost (
|
|||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Poll Attach symbols from HOST and ack OK
|
// Poll Attach symbols from HOST and ack OK
|
||||||
//
|
//
|
||||||
do {
|
do {
|
||||||
DebugPortReadBuffer (Handle, &InputCharacter, 1, 0);
|
DebugPortReadBuffer (Handle, &InputCharacter, 1, 0);
|
||||||
} while (InputCharacter != DEBUG_STARTING_SYMBOL_ATTACH);
|
} while (InputCharacter != DEBUG_STARTING_SYMBOL_ATTACH);
|
||||||
SendAckPacket (DEBUG_COMMAND_OK);
|
SendAckPacket (DEBUG_COMMAND_OK);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Try to attach HOST
|
// Try to attach HOST
|
||||||
//
|
//
|
||||||
while (AttachHost (BreakCause, 0, NULL) != RETURN_SUCCESS);
|
while (AttachHost (BreakCause, 0, NULL) != RETURN_SUCCESS);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1601,7 +1601,7 @@ CommandCommunication (
|
|||||||
SetCpuStopFlagByIndex (ProcessorIndex, TRUE);
|
SetCpuStopFlagByIndex (ProcessorIndex, TRUE);
|
||||||
if (mDebugMpContext.ViewPointIndex == ProcessorIndex) {
|
if (mDebugMpContext.ViewPointIndex == ProcessorIndex) {
|
||||||
//
|
//
|
||||||
// Only the current view processor could set AgentInProgress Flag.
|
// Only the current view processor could set AgentInProgress Flag.
|
||||||
//
|
//
|
||||||
IssuedViewPoint = ProcessorIndex;
|
IssuedViewPoint = ProcessorIndex;
|
||||||
}
|
}
|
||||||
@ -1612,7 +1612,7 @@ CommandCommunication (
|
|||||||
// Set AgentInProgress Flag.
|
// Set AgentInProgress Flag.
|
||||||
//
|
//
|
||||||
SetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS, 1);
|
SetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Handle = GetDebugPortHandle();
|
Handle = GetDebugPortHandle();
|
||||||
|
|
||||||
@ -1666,7 +1666,7 @@ CommandCommunication (
|
|||||||
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save CPU content before executing HOST commond
|
// Save CPU content before executing HOST commond
|
||||||
//
|
//
|
||||||
@ -1682,7 +1682,7 @@ CommandCommunication (
|
|||||||
}
|
}
|
||||||
|
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Processor[%x]:Received one command(%x)\n", mDebugMpContext.ViewPointIndex, DebugHeader->Command);
|
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Processor[%x]:Received one command(%x)\n", mDebugMpContext.ViewPointIndex, DebugHeader->Command);
|
||||||
|
|
||||||
switch (DebugHeader->Command) {
|
switch (DebugHeader->Command) {
|
||||||
|
|
||||||
case DEBUG_COMMAND_HALT:
|
case DEBUG_COMMAND_HALT:
|
||||||
@ -1724,7 +1724,7 @@ CommandCommunication (
|
|||||||
// Clear Stepping Flag
|
// Clear Stepping Flag
|
||||||
//
|
//
|
||||||
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 0);
|
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 0);
|
||||||
|
|
||||||
if (!HaltDeferred) {
|
if (!HaltDeferred) {
|
||||||
//
|
//
|
||||||
// If no HALT command received when being in-active mode
|
// If no HALT command received when being in-active mode
|
||||||
@ -1733,7 +1733,7 @@ CommandCommunication (
|
|||||||
Data32 = FindNextPendingBreakCpu ();
|
Data32 = FindNextPendingBreakCpu ();
|
||||||
if (Data32 != -1) {
|
if (Data32 != -1) {
|
||||||
//
|
//
|
||||||
// If there are still others processors being in break state,
|
// If there are still others processors being in break state,
|
||||||
// send OK packet to HOST to finish this go command
|
// send OK packet to HOST to finish this go command
|
||||||
//
|
//
|
||||||
SendAckPacket (DEBUG_COMMAND_OK);
|
SendAckPacket (DEBUG_COMMAND_OK);
|
||||||
@ -1763,7 +1763,7 @@ CommandCommunication (
|
|||||||
SetCpuRunningFlag (TRUE);
|
SetCpuRunningFlag (TRUE);
|
||||||
CpuPause ();
|
CpuPause ();
|
||||||
//
|
//
|
||||||
// Wait for all processors are in running state
|
// Wait for all processors are in running state
|
||||||
//
|
//
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (IsAllCpuRunning ()) {
|
if (IsAllCpuRunning ()) {
|
||||||
@ -2019,7 +2019,7 @@ CommandCommunication (
|
|||||||
case DEBUG_COMMAND_CPUID:
|
case DEBUG_COMMAND_CPUID:
|
||||||
Cpuid = (DEBUG_DATA_CPUID *) (DebugHeader + 1);
|
Cpuid = (DEBUG_DATA_CPUID *) (DebugHeader + 1);
|
||||||
AsmCpuidEx (
|
AsmCpuidEx (
|
||||||
Cpuid->Eax, Cpuid->Ecx,
|
Cpuid->Eax, Cpuid->Ecx,
|
||||||
&CpuidResponse.Eax, &CpuidResponse.Ebx,
|
&CpuidResponse.Eax, &CpuidResponse.Ebx,
|
||||||
&CpuidResponse.Ecx, &CpuidResponse.Edx
|
&CpuidResponse.Ecx, &CpuidResponse.Edx
|
||||||
);
|
);
|
||||||
@ -2028,7 +2028,7 @@ CommandCommunication (
|
|||||||
|
|
||||||
case DEBUG_COMMAND_SEARCH_SIGNATURE:
|
case DEBUG_COMMAND_SEARCH_SIGNATURE:
|
||||||
SearchSignature = (DEBUG_DATA_SEARCH_SIGNATURE *) (DebugHeader + 1);
|
SearchSignature = (DEBUG_DATA_SEARCH_SIGNATURE *) (DebugHeader + 1);
|
||||||
if ((SearchSignature->Alignment != 0) &&
|
if ((SearchSignature->Alignment != 0) &&
|
||||||
(SearchSignature->Alignment == GetPowerOfTwo32 (SearchSignature->Alignment))
|
(SearchSignature->Alignment == GetPowerOfTwo32 (SearchSignature->Alignment))
|
||||||
) {
|
) {
|
||||||
if (SearchSignature->Positive) {
|
if (SearchSignature->Positive) {
|
||||||
@ -2148,7 +2148,7 @@ InterruptProcess (
|
|||||||
|
|
||||||
if (MultiProcessorDebugSupport()) {
|
if (MultiProcessorDebugSupport()) {
|
||||||
//
|
//
|
||||||
// If RUN commmand is executing, wait for it done.
|
// If RUN commmand is executing, wait for it done.
|
||||||
//
|
//
|
||||||
while (mDebugMpContext.RunCommandSet) {
|
while (mDebugMpContext.RunCommandSet) {
|
||||||
CpuPause ();
|
CpuPause ();
|
||||||
@ -2207,7 +2207,7 @@ InterruptProcess (
|
|||||||
//
|
//
|
||||||
// Continue to run the following common code
|
// Continue to run the following common code
|
||||||
//
|
//
|
||||||
|
|
||||||
case DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT:
|
case DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT:
|
||||||
case DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT:
|
case DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT:
|
||||||
default:
|
default:
|
||||||
@ -2217,12 +2217,12 @@ InterruptProcess (
|
|||||||
AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
||||||
//
|
//
|
||||||
// Only the first breaking processor could send BREAK_POINT to HOST
|
// Only the first breaking processor could send BREAK_POINT to HOST
|
||||||
//
|
//
|
||||||
if (IsFirstBreakProcessor (ProcessorIndex)) {
|
if (IsFirstBreakProcessor (ProcessorIndex)) {
|
||||||
SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);
|
SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);
|
||||||
}
|
}
|
||||||
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
||||||
|
|
||||||
if (Vector == DEBUG_INT3_VECTOR) {
|
if (Vector == DEBUG_INT3_VECTOR) {
|
||||||
//
|
//
|
||||||
// go back address located "0xCC"
|
// go back address located "0xCC"
|
||||||
@ -2359,13 +2359,13 @@ InterruptProcess (
|
|||||||
AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
||||||
//
|
//
|
||||||
// Only the first breaking processor could send BREAK_POINT to HOST
|
// Only the first breaking processor could send BREAK_POINT to HOST
|
||||||
//
|
//
|
||||||
if (IsFirstBreakProcessor (ProcessorIndex)) {
|
if (IsFirstBreakProcessor (ProcessorIndex)) {
|
||||||
SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);
|
SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);
|
||||||
}
|
}
|
||||||
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandCommunication (Vector, CpuContext, BreakReceived);
|
CommandCommunication (Vector, CpuContext, BreakReceived);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Multi-Processor support functions implementation.
|
Multi-Processor support functions implementation.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
#include "DebugAgent.h"
|
#include "DebugAgent.h"
|
||||||
|
|
||||||
DEBUG_MP_CONTEXT volatile mDebugMpContext = {0,0,0,{0},{0},0,0,0,0,FALSE,FALSE};
|
GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_MP_CONTEXT volatile mDebugMpContext = {0,0,0,{0},{0},0,0,0,0,FALSE,FALSE};
|
||||||
|
|
||||||
DEBUG_CPU_DATA volatile mDebugCpuData = {0};
|
GLOBAL_REMOVE_IF_UNREFERENCED DEBUG_CPU_DATA volatile mDebugCpuData = {0};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Acquire a spin lock when Multi-processor supported.
|
Acquire a spin lock when Multi-processor supported.
|
||||||
@ -90,7 +90,7 @@ HaltOtherProcessors (
|
|||||||
// Send fixed IPI to other processors.
|
// Send fixed IPI to other processors.
|
||||||
//
|
//
|
||||||
SendFixedIpiAllExcludingSelf (DEBUG_TIMER_VECTOR);
|
SendFixedIpiAllExcludingSelf (DEBUG_TIMER_VECTOR);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -304,7 +304,7 @@ FindNextPendingBreakCpu (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 Index;
|
UINT32 Index;
|
||||||
|
|
||||||
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
|
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
|
||||||
if (mDebugMpContext.CpuBreakMask[Index] != 0) {
|
if (mDebugMpContext.CpuBreakMask[Index] != 0) {
|
||||||
return (UINT32) LowBitSet32 (mDebugMpContext.CpuBreakMask[Index]) + Index * 8;
|
return (UINT32) LowBitSet32 (mDebugMpContext.CpuBreakMask[Index]) + Index * 8;
|
||||||
@ -312,7 +312,7 @@ FindNextPendingBreakCpu (
|
|||||||
}
|
}
|
||||||
return (UINT32)-1;
|
return (UINT32)-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check if all processors are in running status.
|
Check if all processors are in running status.
|
||||||
|
|
||||||
@ -326,7 +326,7 @@ IsAllCpuRunning (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
|
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
|
||||||
if (mDebugMpContext.CpuStopStatusMask[Index] != 0) {
|
if (mDebugMpContext.CpuStopStatusMask[Index] != 0) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -338,13 +338,13 @@ IsAllCpuRunning (
|
|||||||
/**
|
/**
|
||||||
Check if the current processor is the first breaking processor.
|
Check if the current processor is the first breaking processor.
|
||||||
|
|
||||||
If yes, halt other processors.
|
If yes, halt other processors.
|
||||||
|
|
||||||
@param[in] ProcessorIndex Processor index value.
|
@param[in] ProcessorIndex Processor index value.
|
||||||
|
|
||||||
@return TRUE This processor is the first breaking processor.
|
@return TRUE This processor is the first breaking processor.
|
||||||
@return FALSE This processor is not the first breaking processor.
|
@return FALSE This processor is not the first breaking processor.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
IsFirstBreakProcessor (
|
IsFirstBreakProcessor (
|
||||||
@ -367,5 +367,5 @@ IsFirstBreakProcessor (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Code for debug timer to support debug agent library implementation.
|
Code for debug timer to support debug agent library implementation.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -17,8 +17,9 @@
|
|||||||
/**
|
/**
|
||||||
Initialize CPU local APIC timer.
|
Initialize CPU local APIC timer.
|
||||||
|
|
||||||
|
@return 32-bit Local APIC timer init count.
|
||||||
**/
|
**/
|
||||||
VOID
|
UINT32
|
||||||
InitializeDebugTimer (
|
InitializeDebugTimer (
|
||||||
VOID
|
VOID
|
||||||
)
|
)
|
||||||
@ -41,9 +42,7 @@ InitializeDebugTimer (
|
|||||||
|
|
||||||
InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);
|
InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);
|
||||||
|
|
||||||
if (MultiProcessorDebugSupport()) {
|
return InitialCount;
|
||||||
mDebugMpContext.DebugTimerInitCount = InitialCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,7 +67,7 @@ SaveAndSetDebugTimerInterrupt (
|
|||||||
BOOLEAN OldDebugTimerInterruptState;
|
BOOLEAN OldDebugTimerInterruptState;
|
||||||
|
|
||||||
OldDebugTimerInterruptState = GetApicTimerInterruptState ();
|
OldDebugTimerInterruptState = GetApicTimerInterruptState ();
|
||||||
|
|
||||||
if (OldDebugTimerInterruptState != EnableStatus) {
|
if (OldDebugTimerInterruptState != EnableStatus) {
|
||||||
if (EnableStatus) {
|
if (EnableStatus) {
|
||||||
EnableApicTimerInterrupt ();
|
EnableApicTimerInterrupt ();
|
||||||
@ -84,7 +83,7 @@ SaveAndSetDebugTimerInterrupt (
|
|||||||
CpuPause ();
|
CpuPause ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return OldDebugTimerInterruptState;
|
return OldDebugTimerInterruptState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Header file for debug timer to support debug agent library implementation.
|
Header file for debug timer to support debug agent library implementation.
|
||||||
|
|
||||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -16,10 +16,11 @@
|
|||||||
#define _DEBUG_TIMER_H_
|
#define _DEBUG_TIMER_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize debug timer.
|
Initialize CPU local APIC timer.
|
||||||
|
|
||||||
|
@return 32-bit Local APIC timer init count.
|
||||||
**/
|
**/
|
||||||
VOID
|
UINT32
|
||||||
InitializeDebugTimer (
|
InitializeDebugTimer (
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
@ -165,7 +165,7 @@ GetMailboxFromConfigurationTable (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||||
|
|
||||||
Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **) &Mailbox);
|
Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **) &Mailbox);
|
||||||
if (Status == EFI_SUCCESS && Mailbox != NULL) {
|
if (Status == EFI_SUCCESS && Mailbox != NULL) {
|
||||||
VerifyMailboxChecksum (Mailbox);
|
VerifyMailboxChecksum (Mailbox);
|
||||||
@ -364,7 +364,7 @@ InitializeDebugAgent (
|
|||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Disable Debug Timer interrupt
|
// Disable Debug Timer interrupt
|
||||||
//
|
//
|
||||||
SaveAndSetDebugTimerInterrupt (FALSE);
|
SaveAndSetDebugTimerInterrupt (FALSE);
|
||||||
@ -398,16 +398,16 @@ InitializeDebugAgent (
|
|||||||
mSaveIdtTableSize = IdtDescriptor.Limit + 1;
|
mSaveIdtTableSize = IdtDescriptor.Limit + 1;
|
||||||
mSavedIdtTable = AllocateCopyPool (mSaveIdtTableSize, (VOID *) IdtDescriptor.Base);
|
mSavedIdtTable = AllocateCopyPool (mSaveIdtTableSize, (VOID *) IdtDescriptor.Base);
|
||||||
//
|
//
|
||||||
// Initialize Debug Timer hardware
|
// Initialize Debug Timer hardware and save its initial count
|
||||||
//
|
//
|
||||||
InitializeDebugTimer ();
|
mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer ();
|
||||||
//
|
//
|
||||||
// Check if Debug Agent initialized in DXE phase
|
// Check if Debug Agent initialized in DXE phase
|
||||||
//
|
//
|
||||||
Mailbox = GetMailboxFromConfigurationTable ();
|
Mailbox = GetMailboxFromConfigurationTable ();
|
||||||
if (Mailbox == NULL) {
|
if (Mailbox == NULL) {
|
||||||
//
|
//
|
||||||
// Try to get mailbox from GUIDed HOB build in PEI
|
// Try to get mailbox from GUIDed HOB build in PEI
|
||||||
//
|
//
|
||||||
HobList = GetHobList ();
|
HobList = GetHobList ();
|
||||||
Mailbox = GetMailboxFromHob (HobList);
|
Mailbox = GetMailboxFromHob (HobList);
|
||||||
@ -465,7 +465,7 @@ InitializeDebugAgent (
|
|||||||
if (IsHostAttached ()) {
|
if (IsHostAttached ()) {
|
||||||
Print (L"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");
|
Print (L"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");
|
||||||
*(EFI_STATUS *)Context = EFI_ACCESS_DENIED;
|
*(EFI_STATUS *)Context = EFI_ACCESS_DENIED;
|
||||||
//
|
//
|
||||||
// Enable Debug Timer interrupt again
|
// Enable Debug Timer interrupt again
|
||||||
//
|
//
|
||||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||||
@ -496,11 +496,11 @@ InitializeDebugAgent (
|
|||||||
mDxeCoreFlag = TRUE;
|
mDxeCoreFlag = TRUE;
|
||||||
mMultiProcessorDebugSupport = TRUE;
|
mMultiProcessorDebugSupport = TRUE;
|
||||||
//
|
//
|
||||||
// Initialize Debug Timer hardware
|
// Initialize Debug Timer hardware and its initial count
|
||||||
//
|
//
|
||||||
InitializeDebugTimer ();
|
mDebugMpContext.DebugTimerInitCount = InitializeDebugTimer ();
|
||||||
//
|
//
|
||||||
// Try to get mailbox from GUIDed HOB build in PEI
|
// Try to get mailbox from GUIDed HOB build in PEI
|
||||||
//
|
//
|
||||||
HobList = Context;
|
HobList = Context;
|
||||||
Mailbox = GetMailboxFromHob (HobList);
|
Mailbox = GetMailboxFromHob (HobList);
|
||||||
@ -520,7 +520,7 @@ InitializeDebugAgent (
|
|||||||
if (Context != NULL) {
|
if (Context != NULL) {
|
||||||
Ia32Idtr = (IA32_DESCRIPTOR *) Context;
|
Ia32Idtr = (IA32_DESCRIPTOR *) Context;
|
||||||
Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);
|
Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);
|
||||||
MailboxLocation = (UINT64 *) (UINTN) (Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +
|
MailboxLocation = (UINT64 *) (UINTN) (Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +
|
||||||
(Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));
|
(Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));
|
||||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||||
VerifyMailboxChecksum (Mailbox);
|
VerifyMailboxChecksum (Mailbox);
|
||||||
@ -548,7 +548,7 @@ InitializeDebugAgent (
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
//
|
//
|
||||||
// Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this
|
// Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this
|
||||||
// Debug Agent library instance.
|
// Debug Agent library instance.
|
||||||
//
|
//
|
||||||
DEBUG ((EFI_D_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));
|
DEBUG ((EFI_D_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
SEC Core Debug Agent Library instance implementition.
|
SEC Core Debug Agent Library instance implementition.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -14,17 +14,17 @@
|
|||||||
|
|
||||||
#include "SecPeiDebugAgentLib.h"
|
#include "SecPeiDebugAgentLib.h"
|
||||||
|
|
||||||
BOOLEAN mSkipBreakpoint = FALSE;
|
GLOBAL_REMOVE_IF_UNREFERENCED BOOLEAN mSkipBreakpoint = FALSE;
|
||||||
|
|
||||||
|
|
||||||
EFI_PEI_VECTOR_HANDOFF_INFO_PPI mVectorHandoffInfoPpi = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_VECTOR_HANDOFF_INFO_PPI mVectorHandoffInfoPpi = {
|
||||||
&mVectorHandoffInfoDebugAgent[0]
|
&mVectorHandoffInfoDebugAgent[0]
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ppis to be installed
|
// Ppis to be installed
|
||||||
//
|
//
|
||||||
EFI_PEI_PPI_DESCRIPTOR mVectorHandoffInfoPpiList[] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mVectorHandoffInfoPpiList[] = {
|
||||||
{
|
{
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
&gEfiVectorHandoffInfoPpiGuid,
|
&gEfiVectorHandoffInfoPpiGuid,
|
||||||
@ -32,7 +32,7 @@ EFI_PEI_PPI_DESCRIPTOR mVectorHandoffInfoPpiList[] = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
EFI_PEI_NOTIFY_DESCRIPTOR mMemoryDiscoveredNotifyList[1] = {
|
GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mMemoryDiscoveredNotifyList[1] = {
|
||||||
{
|
{
|
||||||
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
&gEfiPeiMemoryDiscoveredPpiGuid,
|
&gEfiPeiMemoryDiscoveredPpiGuid,
|
||||||
@ -98,7 +98,7 @@ DebugReadBreakSymbol (
|
|||||||
*BreakSymbol = *Data8;
|
*BreakSymbol = *Data8;
|
||||||
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Debug Timer attach symbol received %x", *BreakSymbol);
|
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Debug Timer attach symbol received %x", *BreakSymbol);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
if (*Data8 == DEBUG_STARTING_SYMBOL_NORMAL) {
|
if (*Data8 == DEBUG_STARTING_SYMBOL_NORMAL) {
|
||||||
Status = ReadRemainingBreakPacket (Handle, &DebugHeader);
|
Status = ReadRemainingBreakPacket (Handle, &DebugHeader);
|
||||||
if (Status == EFI_SUCCESS) {
|
if (Status == EFI_SUCCESS) {
|
||||||
@ -111,7 +111,7 @@ DebugReadBreakSymbol (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ GetMailboxPointer (
|
|||||||
UINT64 *MailboxLocationInIdt;
|
UINT64 *MailboxLocationInIdt;
|
||||||
UINT64 *MailboxLocationInHob;
|
UINT64 *MailboxLocationInHob;
|
||||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get mailbox from IDT entry firstly
|
// Get mailbox from IDT entry firstly
|
||||||
//
|
//
|
||||||
@ -198,7 +198,7 @@ GetMailboxPointer (
|
|||||||
// If mailbox was setup in SEC or the current CPU arch is different from the init arch
|
// If mailbox was setup in SEC or the current CPU arch is different from the init arch
|
||||||
// Debug Agent initialized, return the mailbox from IDT entry directly.
|
// Debug Agent initialized, return the mailbox from IDT entry directly.
|
||||||
// Otherwise, we need to check the mailbox location saved in GUIDed HOB further.
|
// Otherwise, we need to check the mailbox location saved in GUIDed HOB further.
|
||||||
//
|
//
|
||||||
return Mailbox;
|
return Mailbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ GetDebugPortHandle (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
DEBUG_AGENT_MAILBOX *DebugAgentMailbox;
|
DEBUG_AGENT_MAILBOX *DebugAgentMailbox;
|
||||||
|
|
||||||
DebugAgentMailbox = GetMailboxPointer ();
|
DebugAgentMailbox = GetMailboxPointer ();
|
||||||
|
|
||||||
return (DEBUG_PORT_HANDLE) (UINTN)(DebugAgentMailbox->DebugPortHandle);
|
return (DEBUG_PORT_HANDLE) (UINTN)(DebugAgentMailbox->DebugPortHandle);
|
||||||
@ -266,7 +266,7 @@ DebugAgentCallbackMemoryDiscoveredPpi (
|
|||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||||
BOOLEAN InterruptStatus;
|
BOOLEAN InterruptStatus;
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
DEBUG_AGENT_MAILBOX *NewMailbox;
|
DEBUG_AGENT_MAILBOX *NewMailbox;
|
||||||
UINT64 *MailboxLocationInHob;
|
UINT64 *MailboxLocationInHob;
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ DebugAgentCallbackMemoryDiscoveredPpi (
|
|||||||
// Restore interrupt state.
|
// Restore interrupt state.
|
||||||
//
|
//
|
||||||
SetInterruptState (InterruptStatus);
|
SetInterruptState (InterruptStatus);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -374,8 +374,8 @@ InitializeDebugAgent (
|
|||||||
UINT64 DebugPortHandle;
|
UINT64 DebugPortHandle;
|
||||||
UINT64 MailboxLocation;
|
UINT64 MailboxLocation;
|
||||||
UINT64 *MailboxLocationPointer;
|
UINT64 *MailboxLocationPointer;
|
||||||
EFI_PHYSICAL_ADDRESS Address;
|
EFI_PHYSICAL_ADDRESS Address;
|
||||||
|
|
||||||
DisableInterrupts ();
|
DisableInterrupts ();
|
||||||
|
|
||||||
switch (InitFlag) {
|
switch (InitFlag) {
|
||||||
@ -591,7 +591,7 @@ InitializeDebugAgent (
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
//
|
//
|
||||||
// Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this
|
// Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this
|
||||||
// Debug Agent library instance.
|
// Debug Agent library instance.
|
||||||
//
|
//
|
||||||
DEBUG ((EFI_D_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));
|
DEBUG ((EFI_D_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));
|
||||||
@ -659,7 +659,7 @@ InitializeDebugAgentPhase2 (
|
|||||||
|
|
||||||
if (Phase2Context->InitFlag == DEBUG_AGENT_INIT_PREMEM_SEC) {
|
if (Phase2Context->InitFlag == DEBUG_AGENT_INIT_PREMEM_SEC) {
|
||||||
//
|
//
|
||||||
// If Temporary RAM region is below 128 MB, then send message to
|
// If Temporary RAM region is below 128 MB, then send message to
|
||||||
// host to disable low memory filtering.
|
// host to disable low memory filtering.
|
||||||
//
|
//
|
||||||
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Phase2Context->Context;
|
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Phase2Context->Context;
|
||||||
|
Reference in New Issue
Block a user