summaryrefslogtreecommitdiffstats
path: root/SourceLevelDebugPkg/Library
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2023-12-15 16:36:18 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-12-26 07:18:26 +0000
commit7b3b39a2e4bdb0f216d539fa1271c49063c49df2 (patch)
treeb0c038e9d5ad680bb0c64e224833a3640564d3f1 /SourceLevelDebugPkg/Library
parent54c662845f5dfa3f1146b0c345b91615b0e77af2 (diff)
downloadedk2-7b3b39a2e4bdb0f216d539fa1271c49063c49df2.tar.gz
edk2-7b3b39a2e4bdb0f216d539fa1271c49063c49df2.tar.bz2
edk2-7b3b39a2e4bdb0f216d539fa1271c49063c49df2.zip
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>
Diffstat (limited to 'SourceLevelDebugPkg/Library')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
index f49a592d27..cc5bb957f7 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c
@@ -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: