summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2013-11-22 06:30:01 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2013-11-22 06:30:01 +0000
commit8cc26df4a60ec3a3b7f9d58ccefc12a1a5b6e199 (patch)
treebb7472ee01a60f805b09d718d952f601b82516d2 /SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
parente41aad152135f27ae1da142454af85a6597719ee (diff)
downloadedk2-platforms-8cc26df4a60ec3a3b7f9d58ccefc12a1a5b6e199.tar.xz
1. DebugAgentLib will install reserved vector table to persist vectors.
2. Update PeCoffExtraActionLib to detect if debug agent initialized or not by checking each IDT entry instead of whole IDT table. 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@14886 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c')
-rw-r--r--SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
index d036880c1d..0388807697 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
+++ b/SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgent/SecPeiDebugAgentLib.c
@@ -16,6 +16,22 @@
BOOLEAN mSkipBreakpoint = FALSE;
+
+EFI_PEI_VECTOR_HANDOFF_INFO_PPI mVectorHandoffInfoPpi = {
+ &mVectorHandoffInfoDebugAgent[0]
+};
+
+//
+// Ppis to be installed
+//
+EFI_PEI_PPI_DESCRIPTOR mVectorHandoffInfoPpiList[] = {
+ {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiVectorHandoffInfoPpiGuid,
+ &mVectorHandoffInfoPpi
+ }
+};
+
EFI_PEI_NOTIFY_DESCRIPTOR mMemoryDiscoveredNotifyList[1] = {
{
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
@@ -408,7 +424,14 @@ InitializeDebugAgent (
//
TriggerSoftInterrupt (MEMORY_READY_SIGNATURE);
}
-
+ //
+ // Install Vector Handoff Info PPI to persist vectors used by Debug Agent
+ //
+ Status = PeiServicesInstallPpi (&mVectorHandoffInfoPpiList[0]);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to install Vector Handoff Info PPI!\n"));
+ CpuDeadLoop ();
+ }
//
// Fix up Debug Port handle address and mailbox address
//
@@ -437,7 +460,10 @@ InitializeDebugAgent (
EFI_SIZE_TO_PAGES (sizeof(DEBUG_AGENT_MAILBOX) + PcdGet16(PcdDebugPortHandleBufferSize)),
&Address
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to allocate pages!\n"));
+ CpuDeadLoop ();
+ }
NewMailbox = (DEBUG_AGENT_MAILBOX *) (UINTN) Address;
//
// Copy Mailbox and Debug Port Handle buffer to new location in ACPI NVS memory, because original Mailbox
@@ -477,6 +503,14 @@ InitializeDebugAgent (
break;
}
//
+ // Install Vector Handoff Info PPI to persist vectors used by Debug Agent
+ //
+ Status = PeiServicesInstallPpi (&mVectorHandoffInfoPpiList[0]);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to install Vector Handoff Info PPI!\n"));
+ CpuDeadLoop ();
+ }
+ //
// Set up IDT entries
//
InitializeDebugIdt ();
@@ -505,7 +539,10 @@ InitializeDebugAgent (
// If memery has been ready, the callback funtion will be invoked immediately
//
Status = PeiServicesNotifyPpi (&mMemoryDiscoveredNotifyList[0]);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "DebugAgent: Failed to register memory discovered callback function!\n"));
+ CpuDeadLoop ();
+ }
//
// Set HOB check flag if memory has not been ready yet
//