]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/DxeMpInitLib: Support source debugging on AP function
authorJeff Fan <jeff.fan@intel.com>
Mon, 26 Dec 2016 08:28:58 +0000 (16:28 +0800)
committerJeff Fan <jeff.fan@intel.com>
Wed, 28 Dec 2016 07:37:57 +0000 (15:37 +0800)
The current DxeDebugAgentLib supports source debugging on AP function. This
update is to update DxeMpInitLib to consume Debug Agent Library by
DEBUG_AGENT_INIT_DXE_AP flag. Thus, we could source debugging AP function
invoked by CPU MP Protocol.

However, current SecPeiDebugAgentLib does not support source debugging on AP
function invoked by CPU MP PPI. I have submitted one bugzilla to add this
support at https://bugzilla.tianocore.org/show_bug.cgi?id=308.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Kinney Michael D <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
UefiCpuPkg/Library/MpInitLib/MpLib.c
UefiCpuPkg/Library/MpInitLib/MpLib.h
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c

index 11b230174ec8ab88bd7098be0cda08c38251f16e..cc4f2e93beb5771bcfe0535fb09c0fb79716d6cd 100644 (file)
@@ -43,6 +43,7 @@
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
   UefiCpuPkg/UefiCpuPkg.dec\r
 \r
 [LibraryClasses]\r
@@ -54,6 +55,7 @@
   CpuLib\r
   UefiCpuLib\r
   UefiBootServicesTableLib\r
+  DebugAgentLib\r
 \r
 [Guids]\r
   gEfiEventExitBootServicesGuid                 ## CONSUMES  ## Event\r
index e75c26930db3b12a07d996e627efdd3a6e00a8ab..1204abd577b2fdd5425d761f0edf0d0764dbace1 100644 (file)
@@ -16,6 +16,7 @@
 \r
 #include <Library/UefiLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DebugAgentLib.h>\r
 \r
 #define  AP_CHECK_INTERVAL     (EFI_TIMER_PERIOD_MILLISECONDS (100))\r
 #define  AP_SAFE_STACK_SIZE    128\r
@@ -29,6 +30,21 @@ VOID             *mReservedApLoopFunc = NULL;
 UINTN            mReservedTopOfApStack;\r
 volatile UINT32  mNumberToFinish = 0;\r
 \r
+/**\r
+  Enable Debug Agent to support source debugging on AP function.\r
+\r
+**/\r
+VOID\r
+EnableDebugAgent (\r
+  VOID\r
+  )\r
+{\r
+  //\r
+  // Initialize Debug Agent to support source level debug in DXE phase\r
+  //\r
+  InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_AP, NULL, NULL);\r
+}\r
+\r
 /**\r
   Get the pointer to CPU MP Data structure.\r
 \r
index 0495b0f8a4bda8a27273cb7eb078a0c33fbdfd1d..a21a980b58b1f48f5642608237c32fceb1f936c5 100644 (file)
@@ -539,6 +539,10 @@ ApWakeupFunction (
         if (Procedure != NULL) {\r
           SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateBusy);\r
           //\r
+          // Enable source debugging on AP function\r
+          //         \r
+          EnableDebugAgent ();\r
+          //\r
           // Invoke AP function here\r
           //\r
           Procedure (Parameter);\r
index 9861a5c859300a88b891621026ee202d92f01765..b67ea9d11ff3cbac8f349942778f87c034a77826 100644 (file)
@@ -575,5 +575,14 @@ RestoreWakeupBuffer(
   IN CPU_MP_DATA              *CpuMpData\r
   );\r
 \r
+/**\r
+  Enable Debug Agent to support source debugging on AP function.\r
+\r
+**/\r
+VOID\r
+EnableDebugAgent (\r
+  VOID\r
+  );\r
+\r
 #endif\r
 \r
index a4166a4bc67a5d9e3c673745ee3073a93c85b5fb..fb1d48fad848f6d3d36fef81e97e93cc55c1a01a 100644 (file)
@@ -25,6 +25,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mMpInitLibNotifyList = {
   CpuMpEndOfPeiCallback\r
 };\r
 \r
+\r
+/**\r
+  Enable Debug Agent to support source debugging on AP function.\r
+\r
+**/\r
+VOID\r
+EnableDebugAgent (\r
+  VOID\r
+  )\r
+{\r
+}\r
+\r
 /**\r
   Get pointer to CPU MP Data structure.\r
 \r