mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
Add InitFlag member in DEBUG_AGENT_PHASE2_CONTEXT to pass into InitializeDebugAgentPhase2().
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@14929 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
32e817c995
commit
5ab7f883fb
@ -402,6 +402,7 @@ InitializeDebugAgent (
|
||||
|
||||
InitializeDebugTimer ();
|
||||
|
||||
Phase2Context.InitFlag = InitFlag;
|
||||
Phase2Context.Context = Context;
|
||||
Phase2Context.Function = Function;
|
||||
DebugPortInitialize ((VOID *) &Phase2Context, InitializeDebugAgentPhase2);
|
||||
@ -487,14 +488,13 @@ InitializeDebugAgent (
|
||||
// Update IDT entry to save the location saved mailbox pointer
|
||||
//
|
||||
SetLocationSavedMailboxPointerInIdtEntry (MailboxLocationPointer);
|
||||
//
|
||||
// Enable CPU interrupts so debug timer interrupts can be delivered
|
||||
//
|
||||
EnableInterrupts ();
|
||||
|
||||
break;
|
||||
|
||||
case DEBUG_AGENT_INIT_PEI:
|
||||
if (Context == NULL) {
|
||||
DEBUG ((EFI_D_ERROR, "DebugAgent: Input parameter Context cannot be NULL!\n"));
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
//
|
||||
// Check if Debug Agent has initialized before
|
||||
//
|
||||
@ -550,6 +550,7 @@ InitializeDebugAgent (
|
||||
SetDebugFlag (DEBUG_AGENT_FLAG_CHECK_MAILBOX_IN_HOB, 1);
|
||||
}
|
||||
|
||||
Phase2Context.InitFlag = InitFlag;
|
||||
Phase2Context.Context = Context;
|
||||
Phase2Context.Function = Function;
|
||||
DebugPortInitialize ((VOID *) &Phase2Context, InitializeDebugAgentPhase2);
|
||||
@ -598,6 +599,9 @@ InitializeDebugAgent (
|
||||
break;
|
||||
}
|
||||
|
||||
//
|
||||
// Enable CPU interrupts so debug timer interrupts can be delivered
|
||||
//
|
||||
EnableInterrupts ();
|
||||
|
||||
//
|
||||
@ -606,6 +610,12 @@ InitializeDebugAgent (
|
||||
if (Function != NULL) {
|
||||
Function (Context);
|
||||
}
|
||||
//
|
||||
// Set return status for DEBUG_AGENT_INIT_PEI
|
||||
//
|
||||
if (InitFlag == DEBUG_AGENT_INIT_PEI) {
|
||||
*(EFI_STATUS *)Context = EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -635,7 +645,7 @@ InitializeDebugAgentPhase2 (
|
||||
MailboxLocation = GetLocationSavedMailboxPointerInIdtEntry ();
|
||||
Mailbox = (DEBUG_AGENT_MAILBOX *)(UINTN)(*MailboxLocation);
|
||||
BufferSize = PcdGet16(PcdDebugPortHandleBufferSize);
|
||||
if (Phase2Context->Function == NULL && DebugPortHandle != NULL && BufferSize != 0) {
|
||||
if (Phase2Context->InitFlag == DEBUG_AGENT_INIT_PEI) {
|
||||
NewDebugPortHandle = (UINT64)(UINTN)AllocateCopyPool (BufferSize, DebugPortHandle);
|
||||
} else {
|
||||
NewDebugPortHandle = (UINT64)(UINTN)DebugPortHandle;
|
||||
@ -647,25 +657,23 @@ InitializeDebugAgentPhase2 (
|
||||
//
|
||||
TriggerSoftInterrupt (SYSTEM_RESET_SIGNATURE);
|
||||
|
||||
//
|
||||
// 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;
|
||||
if ((UINTN)SecCoreData->TemporaryRamBase < BASE_128MB && IsHostAttached ()) {
|
||||
SetDebugFlag (DEBUG_AGENT_FLAG_MEMORY_READY, 1);
|
||||
TriggerSoftInterrupt (MEMORY_READY_SIGNATURE);
|
||||
}
|
||||
|
||||
//
|
||||
// Enable CPU interrupts so debug timer interrupts can be delivered
|
||||
//
|
||||
EnableInterrupts ();
|
||||
|
||||
//
|
||||
// Call continuation function if it is not NULL.
|
||||
//
|
||||
if (Phase2Context->Function != NULL) {
|
||||
if (Phase2Context->InitFlag == DEBUG_AGENT_INIT_PREMEM_SEC) {
|
||||
//
|
||||
// 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;
|
||||
if ((UINTN)SecCoreData->TemporaryRamBase < BASE_128MB && IsHostAttached ()) {
|
||||
SetDebugFlag (DEBUG_AGENT_FLAG_MEMORY_READY, 1);
|
||||
TriggerSoftInterrupt (MEMORY_READY_SIGNATURE);
|
||||
}
|
||||
//
|
||||
// Enable CPU interrupts so debug timer interrupts can be delivered
|
||||
//
|
||||
EnableInterrupts ();
|
||||
//
|
||||
// Call continuation function if it is not NULL.
|
||||
//
|
||||
Phase2Context->Function (Phase2Context->Context);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "DebugAgent.h"
|
||||
|
||||
typedef struct {
|
||||
UINT32 InitFlag;
|
||||
VOID *Context;
|
||||
DEBUG_AGENT_CONTINUE Function;
|
||||
} DEBUG_AGENT_PHASE2_CONTEXT;
|
||||
|
Loading…
x
Reference in New Issue
Block a user