SourceLevelDebugPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SourceLevelDebugPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
b878648967
commit
c1e126b119
@ -8,15 +8,15 @@
|
||||
|
||||
#include "DxeDebugAgentLib.h"
|
||||
|
||||
DEBUG_AGENT_MAILBOX mMailbox;
|
||||
DEBUG_AGENT_MAILBOX *mMailboxPointer = NULL;
|
||||
IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33];
|
||||
BOOLEAN mDxeCoreFlag = FALSE;
|
||||
BOOLEAN mMultiProcessorDebugSupport = FALSE;
|
||||
VOID *mSavedIdtTable = NULL;
|
||||
UINTN mSaveIdtTableSize = 0;
|
||||
BOOLEAN mDebugAgentInitialized = FALSE;
|
||||
BOOLEAN mSkipBreakpoint = FALSE;
|
||||
DEBUG_AGENT_MAILBOX mMailbox;
|
||||
DEBUG_AGENT_MAILBOX *mMailboxPointer = NULL;
|
||||
IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33];
|
||||
BOOLEAN mDxeCoreFlag = FALSE;
|
||||
BOOLEAN mMultiProcessorDebugSupport = FALSE;
|
||||
VOID *mSavedIdtTable = NULL;
|
||||
UINTN mSaveIdtTableSize = 0;
|
||||
BOOLEAN mDebugAgentInitialized = FALSE;
|
||||
BOOLEAN mSkipBreakpoint = FALSE;
|
||||
|
||||
/**
|
||||
Check if debug agent support multi-processor.
|
||||
@ -46,32 +46,33 @@ InternalConstructorWorker (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
BOOLEAN DebugTimerInterruptState;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
DEBUG_AGENT_MAILBOX *NewMailbox;
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
EFI_VECTOR_HANDOFF_INFO *VectorHandoffInfo;
|
||||
EFI_STATUS Status;
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
BOOLEAN DebugTimerInterruptState;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
DEBUG_AGENT_MAILBOX *NewMailbox;
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
EFI_VECTOR_HANDOFF_INFO *VectorHandoffInfo;
|
||||
|
||||
//
|
||||
// Check persisted vector handoff info
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
Status = EFI_SUCCESS;
|
||||
GuidHob = GetFirstGuidHob (&gEfiVectorHandoffInfoPpiGuid);
|
||||
if (GuidHob != NULL && !mDxeCoreFlag) {
|
||||
if ((GuidHob != NULL) && !mDxeCoreFlag) {
|
||||
//
|
||||
// Check if configuration table is installed or not if GUIDed HOB existed,
|
||||
// only when Debug Agent is not linked by DXE Core
|
||||
//
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **) &VectorHandoffInfo);
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID **)&VectorHandoffInfo);
|
||||
}
|
||||
if (GuidHob == NULL || Status != EFI_SUCCESS) {
|
||||
|
||||
if ((GuidHob == NULL) || (Status != EFI_SUCCESS)) {
|
||||
//
|
||||
// Install configuration table for persisted vector handoff info if GUIDed HOB cannot be found or
|
||||
// configuration table does not exist
|
||||
//
|
||||
Status = gBS->InstallConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID *) &mVectorHandoffInfoDebugAgent[0]);
|
||||
Status = gBS->InstallConfigurationTable (&gEfiVectorHandoffTableGuid, (VOID *)&mVectorHandoffInfoDebugAgent[0]);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "DebugAgent: Cannot install configuration table for persisted vector handoff info!\n"));
|
||||
CpuDeadLoop ();
|
||||
@ -84,12 +85,12 @@ InternalConstructorWorker (
|
||||
InstallSerialIo ();
|
||||
|
||||
Address = 0;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiACPIMemoryNVS,
|
||||
EFI_SIZE_TO_PAGES (sizeof(DEBUG_AGENT_MAILBOX) + PcdGet16(PcdDebugPortHandleBufferSize)),
|
||||
&Address
|
||||
);
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateAnyPages,
|
||||
EfiACPIMemoryNVS,
|
||||
EFI_SIZE_TO_PAGES (sizeof (DEBUG_AGENT_MAILBOX) + PcdGet16 (PcdDebugPortHandleBufferSize)),
|
||||
&Address
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "DebugAgent: Cannot install configuration table for mailbox!\n"));
|
||||
CpuDeadLoop ();
|
||||
@ -97,14 +98,14 @@ InternalConstructorWorker (
|
||||
|
||||
DebugTimerInterruptState = SaveAndSetDebugTimerInterrupt (FALSE);
|
||||
|
||||
NewMailbox = (DEBUG_AGENT_MAILBOX *) (UINTN) Address;
|
||||
NewMailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)Address;
|
||||
//
|
||||
// Copy Mailbox and Debug Port Handle buffer to new location in ACPI NVS memory, because original Mailbox
|
||||
// and Debug Port Handle buffer may be free at runtime, SMM debug agent needs to access them
|
||||
//
|
||||
Mailbox = GetMailboxPointer ();
|
||||
CopyMem (NewMailbox, Mailbox, sizeof (DEBUG_AGENT_MAILBOX));
|
||||
CopyMem (NewMailbox + 1, (VOID *)(UINTN)Mailbox->DebugPortHandle, PcdGet16(PcdDebugPortHandleBufferSize));
|
||||
CopyMem (NewMailbox + 1, (VOID *)(UINTN)Mailbox->DebugPortHandle, PcdGet16 (PcdDebugPortHandleBufferSize));
|
||||
//
|
||||
// Update Debug Port Handle in new Mailbox
|
||||
//
|
||||
@ -113,7 +114,7 @@ InternalConstructorWorker (
|
||||
|
||||
DebugTimerInterruptState = SaveAndSetDebugTimerInterrupt (DebugTimerInterruptState);
|
||||
|
||||
Status = gBS->InstallConfigurationTable (&gEfiDebugAgentGuid, (VOID *) mMailboxPointer);
|
||||
Status = gBS->InstallConfigurationTable (&gEfiDebugAgentGuid, (VOID *)mMailboxPointer);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "DebugAgent: Failed to install configuration for mailbox!\n"));
|
||||
CpuDeadLoop ();
|
||||
@ -157,11 +158,11 @@ GetMailboxFromConfigurationTable (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
EFI_STATUS Status;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **) &Mailbox);
|
||||
if (Status == EFI_SUCCESS && Mailbox != NULL) {
|
||||
Status = EfiGetSystemConfigurationTable (&gEfiDebugAgentGuid, (VOID **)&Mailbox);
|
||||
if ((Status == EFI_SUCCESS) && (Mailbox != NULL)) {
|
||||
VerifyMailboxChecksum (Mailbox);
|
||||
return Mailbox;
|
||||
} else {
|
||||
@ -179,19 +180,20 @@ GetMailboxFromConfigurationTable (
|
||||
**/
|
||||
DEBUG_AGENT_MAILBOX *
|
||||
GetMailboxFromHob (
|
||||
IN VOID *HobStart
|
||||
IN VOID *HobStart
|
||||
)
|
||||
{
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
UINT64 *MailboxLocation;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
UINT64 *MailboxLocation;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
|
||||
GuidHob = GetNextGuidHob (&gEfiDebugAgentGuid, HobStart);
|
||||
if (GuidHob == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
MailboxLocation = (UINT64 *) (GET_GUID_HOB_DATA(GuidHob));
|
||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||
|
||||
MailboxLocation = (UINT64 *)(GET_GUID_HOB_DATA (GuidHob));
|
||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||
VerifyMailboxChecksum (Mailbox);
|
||||
|
||||
return Mailbox;
|
||||
@ -225,7 +227,7 @@ GetDebugPortHandle (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return (DEBUG_PORT_HANDLE) (UINTN)(GetMailboxPointer ()->DebugPortHandle);
|
||||
return (DEBUG_PORT_HANDLE)(UINTN)(GetMailboxPointer ()->DebugPortHandle);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -240,13 +242,13 @@ GetDebugPortHandle (
|
||||
**/
|
||||
VOID
|
||||
SetupDebugAgentEnvironment (
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||
IN DEBUG_AGENT_MAILBOX *Mailbox
|
||||
)
|
||||
{
|
||||
IA32_DESCRIPTOR Idtr;
|
||||
UINT16 IdtEntryCount;
|
||||
UINT64 DebugPortHandle;
|
||||
UINT32 DebugTimerFrequency;
|
||||
IA32_DESCRIPTOR Idtr;
|
||||
UINT16 IdtEntryCount;
|
||||
UINT64 DebugPortHandle;
|
||||
UINT32 DebugTimerFrequency;
|
||||
|
||||
if (mMultiProcessorDebugSupport) {
|
||||
InitializeSpinLock (&mDebugMpContext.MpContextSpinLock);
|
||||
@ -255,26 +257,26 @@ SetupDebugAgentEnvironment (
|
||||
//
|
||||
// Clear Break CPU index value
|
||||
//
|
||||
mDebugMpContext.BreakAtCpuIndex = (UINT32) -1;
|
||||
mDebugMpContext.BreakAtCpuIndex = (UINT32)-1;
|
||||
}
|
||||
|
||||
//
|
||||
// Get original IDT address and size.
|
||||
//
|
||||
AsmReadIdtr ((IA32_DESCRIPTOR *) &Idtr);
|
||||
IdtEntryCount = (UINT16) ((Idtr.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR));
|
||||
AsmReadIdtr ((IA32_DESCRIPTOR *)&Idtr);
|
||||
IdtEntryCount = (UINT16)((Idtr.Limit + 1) / sizeof (IA32_IDT_GATE_DESCRIPTOR));
|
||||
if (IdtEntryCount < 33) {
|
||||
ZeroMem (&mIdtEntryTable, sizeof (IA32_IDT_GATE_DESCRIPTOR) * 33);
|
||||
//
|
||||
// Copy original IDT table into new one
|
||||
//
|
||||
CopyMem (&mIdtEntryTable, (VOID *) Idtr.Base, Idtr.Limit + 1);
|
||||
CopyMem (&mIdtEntryTable, (VOID *)Idtr.Base, Idtr.Limit + 1);
|
||||
//
|
||||
// Load new IDT table
|
||||
//
|
||||
Idtr.Limit = (UINT16) (sizeof (IA32_IDT_GATE_DESCRIPTOR) * 33 - 1);
|
||||
Idtr.Base = (UINTN) &mIdtEntryTable;
|
||||
AsmWriteIdtr ((IA32_DESCRIPTOR *) &Idtr);
|
||||
Idtr.Limit = (UINT16)(sizeof (IA32_IDT_GATE_DESCRIPTOR) * 33 - 1);
|
||||
Idtr.Base = (UINTN)&mIdtEntryTable;
|
||||
AsmWriteIdtr ((IA32_DESCRIPTOR *)&Idtr);
|
||||
}
|
||||
|
||||
//
|
||||
@ -294,6 +296,7 @@ SetupDebugAgentEnvironment (
|
||||
} else {
|
||||
ZeroMem (&mMailbox, sizeof (DEBUG_AGENT_MAILBOX));
|
||||
}
|
||||
|
||||
mMailboxPointer = &mMailbox;
|
||||
}
|
||||
|
||||
@ -305,7 +308,7 @@ SetupDebugAgentEnvironment (
|
||||
//
|
||||
// Initialize debug communication port
|
||||
//
|
||||
DebugPortHandle = (UINT64) (UINTN)DebugPortInitialize ((VOID *)(UINTN)mMailboxPointer->DebugPortHandle, NULL);
|
||||
DebugPortHandle = (UINT64)(UINTN)DebugPortInitialize ((VOID *)(UINTN)mMailboxPointer->DebugPortHandle, NULL);
|
||||
UpdateMailboxContent (mMailboxPointer, DEBUG_MAILBOX_DEBUG_PORT_HANDLE_INDEX, DebugPortHandle);
|
||||
|
||||
if (Mailbox == NULL) {
|
||||
@ -326,7 +329,6 @@ SetupDebugAgentEnvironment (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize debug agent.
|
||||
|
||||
@ -352,15 +354,15 @@ InitializeDebugAgent (
|
||||
IN DEBUG_AGENT_CONTINUE Function OPTIONAL
|
||||
)
|
||||
{
|
||||
UINT64 *MailboxLocation;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
BOOLEAN InterruptStatus;
|
||||
VOID *HobList;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
IA32_DESCRIPTOR *Ia32Idtr;
|
||||
IA32_IDT_ENTRY *Ia32IdtEntry;
|
||||
BOOLEAN PeriodicMode;
|
||||
UINTN TimerCycle;
|
||||
UINT64 *MailboxLocation;
|
||||
DEBUG_AGENT_MAILBOX *Mailbox;
|
||||
BOOLEAN InterruptStatus;
|
||||
VOID *HobList;
|
||||
IA32_DESCRIPTOR IdtDescriptor;
|
||||
IA32_DESCRIPTOR *Ia32Idtr;
|
||||
IA32_IDT_ENTRY *Ia32IdtEntry;
|
||||
BOOLEAN PeriodicMode;
|
||||
UINTN TimerCycle;
|
||||
|
||||
if (InitFlag == DEBUG_AGENT_INIT_DXE_AP) {
|
||||
//
|
||||
@ -369,14 +371,15 @@ InitializeDebugAgent (
|
||||
InitializeLocalApicSoftwareEnable (TRUE);
|
||||
GetApicTimerState (NULL, &PeriodicMode, NULL);
|
||||
TimerCycle = GetApicTimerInitCount ();
|
||||
if (!PeriodicMode || TimerCycle == 0) {
|
||||
if (!PeriodicMode || (TimerCycle == 0)) {
|
||||
InitializeDebugTimer (NULL, FALSE);
|
||||
}
|
||||
|
||||
//
|
||||
// Invoked by AP, enable interrupt to let AP could receive IPI from other processors
|
||||
//
|
||||
EnableInterrupts ();
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
@ -396,149 +399,151 @@ InitializeDebugAgent (
|
||||
MailboxLocation = NULL;
|
||||
|
||||
switch (InitFlag) {
|
||||
case DEBUG_AGENT_INIT_DXE_LOAD:
|
||||
//
|
||||
// Check if Debug Agent has been initialized before
|
||||
//
|
||||
if (IsDebugAgentInitialzed ()) {
|
||||
DEBUG ((DEBUG_INFO, "Debug Agent: The former agent will be overwritten by the new one!\n"));
|
||||
}
|
||||
|
||||
case DEBUG_AGENT_INIT_DXE_LOAD:
|
||||
//
|
||||
// Check if Debug Agent has been initialized before
|
||||
//
|
||||
if (IsDebugAgentInitialzed ()) {
|
||||
DEBUG ((DEBUG_INFO, "Debug Agent: The former agent will be overwritten by the new one!\n"));
|
||||
}
|
||||
mMultiProcessorDebugSupport = TRUE;
|
||||
//
|
||||
// Save original IDT table
|
||||
//
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
mSaveIdtTableSize = IdtDescriptor.Limit + 1;
|
||||
mSavedIdtTable = AllocateCopyPool (mSaveIdtTableSize, (VOID *)IdtDescriptor.Base);
|
||||
//
|
||||
// Check if Debug Agent initialized in DXE phase
|
||||
//
|
||||
Mailbox = GetMailboxFromConfigurationTable ();
|
||||
if (Mailbox == NULL) {
|
||||
//
|
||||
// Try to get mailbox from GUIDed HOB build in PEI
|
||||
//
|
||||
HobList = GetHobList ();
|
||||
Mailbox = GetMailboxFromHob (HobList);
|
||||
}
|
||||
|
||||
mMultiProcessorDebugSupport = TRUE;
|
||||
//
|
||||
// Save original IDT table
|
||||
//
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
mSaveIdtTableSize = IdtDescriptor.Limit + 1;
|
||||
mSavedIdtTable = AllocateCopyPool (mSaveIdtTableSize, (VOID *) IdtDescriptor.Base);
|
||||
//
|
||||
// Check if Debug Agent initialized in DXE phase
|
||||
//
|
||||
Mailbox = GetMailboxFromConfigurationTable ();
|
||||
if (Mailbox == NULL) {
|
||||
//
|
||||
// Set up Debug Agent Environment and try to connect HOST if required
|
||||
//
|
||||
SetupDebugAgentEnvironment (Mailbox);
|
||||
//
|
||||
// For DEBUG_AGENT_INIT_S3, needn't to install configuration table and EFI Serial IO protocol
|
||||
// For DEBUG_AGENT_INIT_DXE_CORE, InternalConstructorWorker() will invoked in Constructor()
|
||||
//
|
||||
InternalConstructorWorker ();
|
||||
//
|
||||
// Enable Debug Timer interrupt
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||
//
|
||||
// Enable interrupt to receive Debug Timer interrupt
|
||||
//
|
||||
EnableInterrupts ();
|
||||
|
||||
mDebugAgentInitialized = TRUE;
|
||||
FindAndReportModuleImageInfo (SIZE_4KB);
|
||||
|
||||
*(EFI_STATUS *)Context = EFI_SUCCESS;
|
||||
|
||||
break;
|
||||
|
||||
case DEBUG_AGENT_INIT_DXE_UNLOAD:
|
||||
if (mDebugAgentInitialized) {
|
||||
if (IsHostAttached ()) {
|
||||
*(EFI_STATUS *)Context = EFI_ACCESS_DENIED;
|
||||
//
|
||||
// Enable Debug Timer interrupt again
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||
} else {
|
||||
//
|
||||
// Restore original IDT table
|
||||
//
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
IdtDescriptor.Limit = (UINT16)(mSaveIdtTableSize - 1);
|
||||
CopyMem ((VOID *)IdtDescriptor.Base, mSavedIdtTable, mSaveIdtTableSize);
|
||||
AsmWriteIdtr (&IdtDescriptor);
|
||||
FreePool (mSavedIdtTable);
|
||||
mDebugAgentInitialized = FALSE;
|
||||
*(EFI_STATUS *)Context = EFI_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
*(EFI_STATUS *)Context = EFI_NOT_STARTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Restore interrupt state.
|
||||
//
|
||||
SetInterruptState (InterruptStatus);
|
||||
break;
|
||||
|
||||
case DEBUG_AGENT_INIT_DXE_CORE:
|
||||
mDxeCoreFlag = TRUE;
|
||||
mMultiProcessorDebugSupport = TRUE;
|
||||
//
|
||||
// Try to get mailbox from GUIDed HOB build in PEI
|
||||
//
|
||||
HobList = GetHobList ();
|
||||
HobList = Context;
|
||||
Mailbox = GetMailboxFromHob (HobList);
|
||||
}
|
||||
//
|
||||
// Set up Debug Agent Environment and try to connect HOST if required
|
||||
//
|
||||
SetupDebugAgentEnvironment (Mailbox);
|
||||
//
|
||||
// For DEBUG_AGENT_INIT_S3, needn't to install configuration table and EFI Serial IO protocol
|
||||
// For DEBUG_AGENT_INIT_DXE_CORE, InternalConstructorWorker() will invoked in Constructor()
|
||||
//
|
||||
InternalConstructorWorker ();
|
||||
//
|
||||
// Enable Debug Timer interrupt
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||
//
|
||||
// Enable interrupt to receive Debug Timer interrupt
|
||||
//
|
||||
EnableInterrupts ();
|
||||
//
|
||||
// Set up Debug Agent Environment and try to connect HOST if required
|
||||
//
|
||||
SetupDebugAgentEnvironment (Mailbox);
|
||||
//
|
||||
// Enable Debug Timer interrupt
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||
//
|
||||
// Enable interrupt to receive Debug Timer interrupt
|
||||
//
|
||||
EnableInterrupts ();
|
||||
|
||||
mDebugAgentInitialized = TRUE;
|
||||
FindAndReportModuleImageInfo (SIZE_4KB);
|
||||
break;
|
||||
|
||||
*(EFI_STATUS *)Context = EFI_SUCCESS;
|
||||
case DEBUG_AGENT_INIT_S3:
|
||||
|
||||
break;
|
||||
|
||||
case DEBUG_AGENT_INIT_DXE_UNLOAD:
|
||||
if (mDebugAgentInitialized) {
|
||||
if (IsHostAttached ()) {
|
||||
*(EFI_STATUS *)Context = EFI_ACCESS_DENIED;
|
||||
//
|
||||
// Enable Debug Timer interrupt again
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||
} else {
|
||||
//
|
||||
// Restore original IDT table
|
||||
//
|
||||
AsmReadIdtr (&IdtDescriptor);
|
||||
IdtDescriptor.Limit = (UINT16) (mSaveIdtTableSize - 1);
|
||||
CopyMem ((VOID *) IdtDescriptor.Base, mSavedIdtTable, mSaveIdtTableSize);
|
||||
AsmWriteIdtr (&IdtDescriptor);
|
||||
FreePool (mSavedIdtTable);
|
||||
mDebugAgentInitialized = FALSE;
|
||||
*(EFI_STATUS *)Context = EFI_SUCCESS;
|
||||
if (Context != NULL) {
|
||||
Ia32Idtr = (IA32_DESCRIPTOR *)Context;
|
||||
Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);
|
||||
MailboxLocation = (UINT64 *)((UINTN)Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +
|
||||
((UINTN)Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));
|
||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||
VerifyMailboxChecksum (Mailbox);
|
||||
}
|
||||
} else {
|
||||
*(EFI_STATUS *)Context = EFI_NOT_STARTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Restore interrupt state.
|
||||
//
|
||||
SetInterruptState (InterruptStatus);
|
||||
break;
|
||||
|
||||
case DEBUG_AGENT_INIT_DXE_CORE:
|
||||
mDxeCoreFlag = TRUE;
|
||||
mMultiProcessorDebugSupport = TRUE;
|
||||
//
|
||||
// Try to get mailbox from GUIDed HOB build in PEI
|
||||
//
|
||||
HobList = Context;
|
||||
Mailbox = GetMailboxFromHob (HobList);
|
||||
//
|
||||
// Set up Debug Agent Environment and try to connect HOST if required
|
||||
//
|
||||
SetupDebugAgentEnvironment (Mailbox);
|
||||
//
|
||||
// Enable Debug Timer interrupt
|
||||
//
|
||||
SaveAndSetDebugTimerInterrupt (TRUE);
|
||||
//
|
||||
// Enable interrupt to receive Debug Timer interrupt
|
||||
//
|
||||
EnableInterrupts ();
|
||||
|
||||
break;
|
||||
|
||||
case DEBUG_AGENT_INIT_S3:
|
||||
|
||||
if (Context != NULL) {
|
||||
Ia32Idtr = (IA32_DESCRIPTOR *) Context;
|
||||
Ia32IdtEntry = (IA32_IDT_ENTRY *)(Ia32Idtr->Base);
|
||||
MailboxLocation = (UINT64 *) ((UINTN) Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetLow +
|
||||
((UINTN) Ia32IdtEntry[DEBUG_MAILBOX_VECTOR].Bits.OffsetHigh << 16));
|
||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||
VerifyMailboxChecksum (Mailbox);
|
||||
}
|
||||
//
|
||||
// Save Mailbox pointer in global variable
|
||||
//
|
||||
mMailboxPointer = Mailbox;
|
||||
//
|
||||
// Set up Debug Agent Environment and try to connect HOST if required
|
||||
//
|
||||
SetupDebugAgentEnvironment (Mailbox);
|
||||
//
|
||||
// Disable interrupt
|
||||
//
|
||||
DisableInterrupts ();
|
||||
FindAndReportModuleImageInfo (SIZE_4KB);
|
||||
if (GetDebugFlag (DEBUG_AGENT_FLAG_BREAK_BOOT_SCRIPT) == 1) {
|
||||
//
|
||||
// If Boot Script entry break is set, code will be break at here.
|
||||
// Save Mailbox pointer in global variable
|
||||
//
|
||||
CpuBreakpoint ();
|
||||
}
|
||||
break;
|
||||
mMailboxPointer = Mailbox;
|
||||
//
|
||||
// Set up Debug Agent Environment and try to connect HOST if required
|
||||
//
|
||||
SetupDebugAgentEnvironment (Mailbox);
|
||||
//
|
||||
// Disable interrupt
|
||||
//
|
||||
DisableInterrupts ();
|
||||
FindAndReportModuleImageInfo (SIZE_4KB);
|
||||
if (GetDebugFlag (DEBUG_AGENT_FLAG_BREAK_BOOT_SCRIPT) == 1) {
|
||||
//
|
||||
// If Boot Script entry break is set, code will be break at here.
|
||||
//
|
||||
CpuBreakpoint ();
|
||||
}
|
||||
|
||||
default:
|
||||
//
|
||||
// Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this
|
||||
// Debug Agent library instance.
|
||||
//
|
||||
DEBUG ((DEBUG_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));
|
||||
CpuDeadLoop ();
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
//
|
||||
// Only DEBUG_AGENT_INIT_PREMEM_SEC and DEBUG_AGENT_INIT_POSTMEM_SEC are allowed for this
|
||||
// Debug Agent library instance.
|
||||
//
|
||||
DEBUG ((DEBUG_ERROR, "Debug Agent: The InitFlag value is not allowed!\n"));
|
||||
CpuDeadLoop ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user