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:
Jeff Fan 2014-11-04 01:29:20 +00:00 committed by vanjeff
parent 26830e8579
commit 4fe43eb3e9
6 changed files with 118 additions and 118 deletions

View File

@ -18,16 +18,16 @@
#include "DebugAgent.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";
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";
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 mErrorMsgVersionAlert[] = "\rThe SourceLevelDebugPkg you are using requires a newer version of the Intel(R) UDK Debugger Tool.\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";
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectOK[] = "HOST connection is successful!\r\n";
GLOBAL_REMOVE_IF_UNREFERENCED CHAR8 mErrorMsgConnectFail[] = "HOST connection is failed!\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
//
EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {
GLOBAL_REMOVE_IF_UNREFERENCED EFI_VECTOR_HANDOFF_INFO mVectorHandoffInfoDebugAgent[] = {
{
DEBUG_EXCEPT_DIVIDE_ERROR, // Vector 0
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.
@ -174,7 +174,7 @@ CalculateCrc16 (
@retval FALSE IDT entries were not setup by Debug Agent.
**/
BOOLEAN
BOOLEAN
IsDebugAgentInitialzed (
VOID
)
@ -191,13 +191,13 @@ IsDebugAgentInitialzed (
/**
Find and report module image info to HOST.
@param[in] AlignSize Image aligned size.
**/
VOID
VOID
FindAndReportModuleImageInfo (
IN UINTN AlignSize
IN UINTN AlignSize
)
{
UINTN Pe32Data;
@ -243,7 +243,7 @@ FindAndReportModuleImageInfo (
//
// Not found the image base, check the previous aligned address
//
//
Pe32Data -= AlignSize;
}
@ -303,7 +303,7 @@ UpdateMailboxChecksum (
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.
**/
VOID
VOID
VerifyMailboxChecksum (
IN DEBUG_AGENT_MAILBOX *Mailbox
)
{
UINT8 CheckSum;
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.
//
if (CheckSum != Mailbox->CheckSum && CheckSum != Mailbox->ToBeCheckSum) {
@ -339,10 +339,10 @@ VerifyMailboxChecksum (
@param[in] Mailbox Debug Agent Mailbox pointer.
@param[in] Index Mailbox content index.
@param[in] Value Value to be set into Mailbox.
**/
VOID
UpdateMailboxContent (
UpdateMailboxContent (
IN DEBUG_AGENT_MAILBOX *Mailbox,
IN UINTN Index,
IN UINT64 Value
@ -351,7 +351,7 @@ UpdateMailboxContent (
AcquireMpSpinLock (&mDebugMpContext.MailboxSpinLock);
switch (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));
Mailbox->DebugFlag.Uint64 = Value;
break;
@ -391,10 +391,10 @@ UpdateMailboxContent (
@param[in] FlagValue Debug flag value.
**/
VOID
VOID
SetDebugFlag (
IN UINT64 FlagMask,
IN UINT32 FlagValue
IN UINT32 FlagValue
)
{
DEBUG_AGENT_MAILBOX *Mailbox;
@ -410,7 +410,7 @@ SetDebugFlag (
Get debug flag in mailbox.
@param[in] FlagMask Debug flag mask value.
@return Debug flag value.
**/
@ -438,12 +438,12 @@ GetDebugFlag (
VOID
SendDebugMsgPacket (
IN CHAR8 *Buffer,
IN UINTN Length
IN UINTN Length
)
{
DEBUG_PACKET_HEADER DebugHeader;
DEBUG_PORT_HANDLE Handle;
Handle = GetDebugPortHandle();
DebugHeader.StartSymbol = DEBUG_STARTING_SYMBOL_NORMAL;
@ -468,7 +468,7 @@ SendDebugMsgPacket (
@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
@param[in] ... Variable argument list whose contents are accessed
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.
If any bit in ErrorLevel is also set in DebugPrintErrorLevelLib function
GetDebugPrintErrorLevel (), then print the message specified by Format and the
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().
@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] 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.
**/
@ -521,7 +521,7 @@ DebugAgentDataMsgPrint (
IN UINT8 ErrorLevel,
IN BOOLEAN IsSend,
IN UINT8 *Data,
IN UINT8 Length
IN UINT8 Length
)
{
CHAR8 Buffer[DEBUG_DATA_MAXIMUM_REAL_DATA];
@ -546,7 +546,7 @@ DebugAgentDataMsgPrint (
while (TRUE) {
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".
//
SendDebugMsgPacket (Buffer, DestBuffer - Buffer);
@ -608,7 +608,7 @@ ReadRemainingBreakPacket (
if (((DebugHeader->Command & DEBUG_COMMAND_RESPONSE) == 0) &&
(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);
return EFI_SUCCESS;
@ -639,7 +639,7 @@ IsHostAttached (
Set HOST connect flag in Mailbox.
@param[in] Attached Attach status.
**/
VOID
SetHostAttached (
@ -654,14 +654,14 @@ SetHostAttached (
Set debug setting of Debug Agent in Mailbox.
@param DebugSetting Pointer to Debug Setting defined by transfer protocol.
@retval RETURN_SUCCESS The setting is set successfully.
@retval RETURN_UNSUPPORTED The Key value is not supported.
**/
RETURN_STATUS
SetDebugSetting (
IN DEBUG_DATA_SET_DEBUG_SETTING *DebugSetting
IN DEBUG_DATA_SET_DEBUG_SETTING *DebugSetting
)
{
RETURN_STATUS Status;
@ -994,7 +994,7 @@ ReceivePacket (
} else {
TimeoutForStartSymbol = Timeout;
}
DebugHeader = (DEBUG_PACKET_HEADER *) InputPacket;
while (TRUE) {
//
@ -1189,13 +1189,13 @@ GetBreakCause (
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);
}
break;
case SOFT_INTERRUPT_SIGNATURE:
if (CpuContext->Dr1 == MEMORY_READY_SIGNATURE) {
Cause = DEBUG_DATA_BREAK_CAUSE_MEMORY_READY;
CpuContext->Dr0 = 0;
@ -1359,7 +1359,7 @@ ReadMemoryAndSendResponsePacket (
DebugHeader->Crc = CalculateCrc16 ((UINT8 *) DebugHeader, DebugHeader->Length, 0);
DebugAgentDataMsgPrint (DEBUG_AGENT_VERBOSE, TRUE, (UINT8 *) DebugHeader, DebugHeader->Length);
DebugPortWriteBuffer (Handle, (UINT8 *) DebugHeader, DebugHeader->Length);
while (TRUE) {
@ -1439,12 +1439,12 @@ SendBreakCausePacket (
/**
Try to attach the HOST.
Send init break packet to HOST:
If no acknowlege received in specified Timeout, return RETURN_TIMEOUT.
If received acknowlege, check the revision of HOST.
Set Attach Flag if attach successfully.
If no acknowlege received in specified Timeout, return RETURN_TIMEOUT.
If received acknowlege, check the revision of HOST.
Set Attach Flag if attach successfully.
@param[in] BreakCause Break cause of this break event.
@param[in] Timeout Time out value to wait for acknowlege from HOST.
The unit is microsecond.
@ -1465,7 +1465,7 @@ AttachHost (
IncompatibilityFlag = FALSE;
Handle = GetDebugPortHandle();
//
// Send init break and wait ack in Timeout
//
@ -1483,7 +1483,7 @@ AttachHost (
DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgVersionAlert, AsciiStrLen (mErrorMsgVersionAlert));
CpuDeadLoop ();
}
if (RETURN_ERROR (Status)) {
DebugPortWriteBuffer (Handle, (UINT8 *) mErrorMsgConnectFail, AsciiStrLen (mErrorMsgConnectFail));
} 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.
@param[in] BreakCause Break cause of this break event.
@ -1506,7 +1506,7 @@ AttachHost (
@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.
**/
VOID
SendBreakPacketToHost (
@ -1517,9 +1517,9 @@ SendBreakPacketToHost (
{
UINT8 InputCharacter;
DEBUG_PORT_HANDLE Handle;
Handle = GetDebugPortHandle();
if (IsHostAttached ()) {
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "processor[%x]:Send Break Packet to HOST.\n", ProcessorIndex);
SendCommandAndWaitForAckOK (DEBUG_COMMAND_BREAK_POINT, READ_PACKET_TIMEOUT, BreakReceived, NULL);
@ -1530,17 +1530,17 @@ SendBreakPacketToHost (
//
//
// Poll Attach symbols from HOST and ack OK
//
//
do {
DebugPortReadBuffer (Handle, &InputCharacter, 1, 0);
} while (InputCharacter != DEBUG_STARTING_SYMBOL_ATTACH);
SendAckPacket (DEBUG_COMMAND_OK);
//
// Try to attach HOST
//
while (AttachHost (BreakCause, 0, NULL) != RETURN_SUCCESS);
}
}
@ -1601,7 +1601,7 @@ CommandCommunication (
SetCpuStopFlagByIndex (ProcessorIndex, TRUE);
if (mDebugMpContext.ViewPointIndex == ProcessorIndex) {
//
// Only the current view processor could set AgentInProgress Flag.
// Only the current view processor could set AgentInProgress Flag.
//
IssuedViewPoint = ProcessorIndex;
}
@ -1612,7 +1612,7 @@ CommandCommunication (
// Set AgentInProgress Flag.
//
SetDebugFlag (DEBUG_AGENT_FLAG_AGENT_IN_PROGRESS, 1);
}
}
Handle = GetDebugPortHandle();
@ -1666,7 +1666,7 @@ CommandCommunication (
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
continue;
}
//
// 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);
switch (DebugHeader->Command) {
case DEBUG_COMMAND_HALT:
@ -1724,7 +1724,7 @@ CommandCommunication (
// Clear Stepping Flag
//
SetDebugFlag (DEBUG_AGENT_FLAG_STEPPING, 0);
if (!HaltDeferred) {
//
// If no HALT command received when being in-active mode
@ -1733,7 +1733,7 @@ CommandCommunication (
Data32 = FindNextPendingBreakCpu ();
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
//
SendAckPacket (DEBUG_COMMAND_OK);
@ -1763,7 +1763,7 @@ CommandCommunication (
SetCpuRunningFlag (TRUE);
CpuPause ();
//
// Wait for all processors are in running state
// Wait for all processors are in running state
//
while (TRUE) {
if (IsAllCpuRunning ()) {
@ -2019,7 +2019,7 @@ CommandCommunication (
case DEBUG_COMMAND_CPUID:
Cpuid = (DEBUG_DATA_CPUID *) (DebugHeader + 1);
AsmCpuidEx (
Cpuid->Eax, Cpuid->Ecx,
Cpuid->Eax, Cpuid->Ecx,
&CpuidResponse.Eax, &CpuidResponse.Ebx,
&CpuidResponse.Ecx, &CpuidResponse.Edx
);
@ -2028,7 +2028,7 @@ CommandCommunication (
case DEBUG_COMMAND_SEARCH_SIGNATURE:
SearchSignature = (DEBUG_DATA_SEARCH_SIGNATURE *) (DebugHeader + 1);
if ((SearchSignature->Alignment != 0) &&
if ((SearchSignature->Alignment != 0) &&
(SearchSignature->Alignment == GetPowerOfTwo32 (SearchSignature->Alignment))
) {
if (SearchSignature->Positive) {
@ -2148,7 +2148,7 @@ InterruptProcess (
if (MultiProcessorDebugSupport()) {
//
// If RUN commmand is executing, wait for it done.
// If RUN commmand is executing, wait for it done.
//
while (mDebugMpContext.RunCommandSet) {
CpuPause ();
@ -2207,7 +2207,7 @@ InterruptProcess (
//
// Continue to run the following common code
//
case DEBUG_DATA_BREAK_CAUSE_HW_BREAKPOINT:
case DEBUG_DATA_BREAK_CAUSE_SW_BREAKPOINT:
default:
@ -2217,12 +2217,12 @@ InterruptProcess (
AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
//
// Only the first breaking processor could send BREAK_POINT to HOST
//
//
if (IsFirstBreakProcessor (ProcessorIndex)) {
SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);
}
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
if (Vector == DEBUG_INT3_VECTOR) {
//
// go back address located "0xCC"
@ -2359,13 +2359,13 @@ InterruptProcess (
AcquireMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
//
// Only the first breaking processor could send BREAK_POINT to HOST
//
//
if (IsFirstBreakProcessor (ProcessorIndex)) {
SendBreakPacketToHost (BreakCause, ProcessorIndex, &BreakReceived);
}
ReleaseMpSpinLock (&mDebugMpContext.DebugPortSpinLock);
}
CommandCommunication (Vector, CpuContext, BreakReceived);
}
break;

View File

@ -1,7 +1,7 @@
/** @file
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
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
@ -14,9 +14,9 @@
#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.
@ -90,7 +90,7 @@ HaltOtherProcessors (
// Send fixed IPI to other processors.
//
SendFixedIpiAllExcludingSelf (DEBUG_TIMER_VECTOR);
}
/**
@ -304,7 +304,7 @@ FindNextPendingBreakCpu (
)
{
UINT32 Index;
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
if (mDebugMpContext.CpuBreakMask[Index] != 0) {
return (UINT32) LowBitSet32 (mDebugMpContext.CpuBreakMask[Index]) + Index * 8;
@ -312,7 +312,7 @@ FindNextPendingBreakCpu (
}
return (UINT32)-1;
}
/**
Check if all processors are in running status.
@ -326,7 +326,7 @@ IsAllCpuRunning (
)
{
UINTN Index;
for (Index = 0; Index < DEBUG_CPU_MAX_COUNT / 8; Index ++) {
if (mDebugMpContext.CpuStopStatusMask[Index] != 0) {
return FALSE;
@ -338,13 +338,13 @@ IsAllCpuRunning (
/**
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.
@return TRUE This processor is the first breaking processor.
@return FALSE This processor is not the first breaking processor.
**/
BOOLEAN
IsFirstBreakProcessor (
@ -367,5 +367,5 @@ IsFirstBreakProcessor (
}
}
return TRUE;
}
}

View File

@ -1,7 +1,7 @@
/** @file
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
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
@ -17,8 +17,9 @@
/**
Initialize CPU local APIC timer.
@return 32-bit Local APIC timer init count.
**/
VOID
UINT32
InitializeDebugTimer (
VOID
)
@ -41,9 +42,7 @@ InitializeDebugTimer (
InitializeApicTimer (ApicTimerDivisor, InitialCount, TRUE, DEBUG_TIMER_VECTOR);
if (MultiProcessorDebugSupport()) {
mDebugMpContext.DebugTimerInitCount = InitialCount;
}
return InitialCount;
}
/**
@ -68,7 +67,7 @@ SaveAndSetDebugTimerInterrupt (
BOOLEAN OldDebugTimerInterruptState;
OldDebugTimerInterruptState = GetApicTimerInterruptState ();
if (OldDebugTimerInterruptState != EnableStatus) {
if (EnableStatus) {
EnableApicTimerInterrupt ();
@ -84,7 +83,7 @@ SaveAndSetDebugTimerInterrupt (
CpuPause ();
}
}
return OldDebugTimerInterruptState;
}

View File

@ -1,7 +1,7 @@
/** @file
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
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
@ -16,10 +16,11 @@
#define _DEBUG_TIMER_H_
/**
Initialize debug timer.
Initialize CPU local APIC timer.
@return 32-bit Local APIC timer init count.
**/
VOID
UINT32
InitializeDebugTimer (
VOID
);

View File

@ -165,7 +165,7 @@ GetMailboxFromConfigurationTable (
{
EFI_STATUS Status;
DEBUG_AGENT_MAILBOX *Mailbox;
Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **) &Mailbox);
if (Status == EFI_SUCCESS && Mailbox != NULL) {
VerifyMailboxChecksum (Mailbox);
@ -364,7 +364,7 @@ InitializeDebugAgent (
return ;
}
//
//
// Disable Debug Timer interrupt
//
SaveAndSetDebugTimerInterrupt (FALSE);
@ -398,16 +398,16 @@ InitializeDebugAgent (
mSaveIdtTableSize = IdtDescriptor.Limit + 1;
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
//
Mailbox = GetMailboxFromConfigurationTable ();
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 ();
Mailbox = GetMailboxFromHob (HobList);
@ -465,7 +465,7 @@ InitializeDebugAgent (
if (IsHostAttached ()) {
Print (L"Debug Agent: Host is still connected, please de-attach TARGET firstly!\r\n");
*(EFI_STATUS *)Context = EFI_ACCESS_DENIED;
//
//
// Enable Debug Timer interrupt again
//
SaveAndSetDebugTimerInterrupt (TRUE);
@ -496,11 +496,11 @@ InitializeDebugAgent (
mDxeCoreFlag = 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;
Mailbox = GetMailboxFromHob (HobList);
@ -520,7 +520,7 @@ InitializeDebugAgent (
if (Context != NULL) {
Ia32Idtr = (IA32_DESCRIPTOR *) Context;
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));
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
VerifyMailboxChecksum (Mailbox);
@ -548,7 +548,7 @@ InitializeDebugAgent (
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 ((EFI_D_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));

View File

@ -1,7 +1,7 @@
/** @file
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
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
@ -14,17 +14,17 @@
#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]
};
//
// 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),
&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),
&gEfiPeiMemoryDiscoveredPpiGuid,
@ -98,7 +98,7 @@ DebugReadBreakSymbol (
*BreakSymbol = *Data8;
DebugAgentMsgPrint (DEBUG_AGENT_INFO, "Debug Timer attach symbol received %x", *BreakSymbol);
return EFI_SUCCESS;
}
}
if (*Data8 == DEBUG_STARTING_SYMBOL_NORMAL) {
Status = ReadRemainingBreakPacket (Handle, &DebugHeader);
if (Status == EFI_SUCCESS) {
@ -111,7 +111,7 @@ DebugReadBreakSymbol (
}
}
}
return EFI_NOT_FOUND;
}
@ -183,7 +183,7 @@ GetMailboxPointer (
UINT64 *MailboxLocationInIdt;
UINT64 *MailboxLocationInHob;
DEBUG_AGENT_MAILBOX *Mailbox;
//
// 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
// Debug Agent initialized, return the mailbox from IDT entry directly.
// Otherwise, we need to check the mailbox location saved in GUIDed HOB further.
//
//
return Mailbox;
}
@ -239,7 +239,7 @@ GetDebugPortHandle (
)
{
DEBUG_AGENT_MAILBOX *DebugAgentMailbox;
DebugAgentMailbox = GetMailboxPointer ();
return (DEBUG_PORT_HANDLE) (UINTN)(DebugAgentMailbox->DebugPortHandle);
@ -266,7 +266,7 @@ DebugAgentCallbackMemoryDiscoveredPpi (
EFI_STATUS Status;
DEBUG_AGENT_MAILBOX *Mailbox;
BOOLEAN InterruptStatus;
EFI_PHYSICAL_ADDRESS Address;
EFI_PHYSICAL_ADDRESS Address;
DEBUG_AGENT_MAILBOX *NewMailbox;
UINT64 *MailboxLocationInHob;
@ -320,7 +320,7 @@ DebugAgentCallbackMemoryDiscoveredPpi (
// Restore interrupt state.
//
SetInterruptState (InterruptStatus);
return EFI_SUCCESS;
}
@ -374,8 +374,8 @@ InitializeDebugAgent (
UINT64 DebugPortHandle;
UINT64 MailboxLocation;
UINT64 *MailboxLocationPointer;
EFI_PHYSICAL_ADDRESS Address;
EFI_PHYSICAL_ADDRESS Address;
DisableInterrupts ();
switch (InitFlag) {
@ -591,7 +591,7 @@ InitializeDebugAgent (
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 ((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 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.
//
SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Phase2Context->Context;