SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not

This patch is to use the Context to indicate SMM Debug Agent support
or not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must point to a
BOOLEAN if it's not NULL.

Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
This commit is contained in:
Jiaxin Wu 2023-12-15 16:36:18 +08:00 committed by mergify[bot]
parent 54c662845f
commit 7b3b39a2e4

View File

@ -159,8 +159,9 @@ RestoreDebugRegister (
If InitFlag is DEBUG_AGENT_INIT_SMM, it will override IDT table entries
and initialize debug port. It will get debug agent Mailbox from GUIDed HOB,
it it exists, debug agent wiil copied it into the local Mailbox in SMM space.
it will override IDT table entries and initialize debug port. Context will be
NULL.
it will override IDT table entries and initialize debug port. Context must
point to a BOOLEAN if it's not NULL, which indicates SMM Debug Agent supported
or not.
If InitFlag is DEBUG_AGENT_INIT_ENTER_SMI, debug agent will save Debug
Registers and get local Mailbox in SMM space. Context will be NULL.
If InitFlag is DEBUG_AGENT_INIT_EXIT_SMI, debug agent will restore Debug
@ -205,6 +206,10 @@ InitializeDebugAgent (
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "DebugAgent: Cannot install configuration table for persisted vector handoff info!\n"));
if (Context != NULL) {
*(BOOLEAN *)Context = FALSE;
}
CpuDeadLoop ();
}
@ -215,6 +220,10 @@ InitializeDebugAgent (
if ((Status == EFI_SUCCESS) && (Mailbox != NULL)) {
VerifyMailboxChecksum (Mailbox);
mMailboxPointer = Mailbox;
if (Context != NULL) {
*(BOOLEAN *)Context = TRUE;
}
break;
}
@ -224,6 +233,10 @@ InitializeDebugAgent (
Mailbox = GetMailboxFromHob ();
if (Mailbox != NULL) {
mMailboxPointer = Mailbox;
if (Context != NULL) {
*(BOOLEAN *)Context = TRUE;
}
break;
}
@ -275,6 +288,10 @@ InitializeDebugAgent (
//
CopyMem ((VOID *)IdtDescriptor.Base, &IdtEntry, 33 * sizeof (IA32_IDT_GATE_DESCRIPTOR));
if (Context != NULL) {
*(BOOLEAN *)Context = TRUE;
}
break;
case DEBUG_AGENT_INIT_ENTER_SMI: