From: Jeff Fan <jeff.fan@intel.com>
To: edk2-devel@lists.01.org
Cc: Feng Tian <feng.tian@intel.com>,
Kinney, Michael D <michael.d.kinney@intel.com>,
Ruiyu Ni <ruiyu.ni@intel.com>
Subject: [PATCH 1/6] UefiCpuPkg/DxeMpInitLib: Support source debugging on AP function
Date: Mon, 26 Dec 2016 19:20:57 +0800 [thread overview]
Message-ID: <20161226112102.25512-2-jeff.fan@intel.com> (raw)
In-Reply-To: <20161226112102.25512-1-jeff.fan@intel.com>
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>
---
UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 2 ++
UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 16 ++++++++++++++++
UefiCpuPkg/Library/MpInitLib/MpLib.c | 4 ++++
UefiCpuPkg/Library/MpInitLib/MpLib.h | 9 +++++++++
UefiCpuPkg/Library/MpInitLib/PeiMpLib.c | 12 ++++++++++++
5 files changed, 43 insertions(+)
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
index 11b2301..cc4f2e9 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf
@@ -43,6 +43,7 @@
[Packages]
MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
UefiCpuPkg/UefiCpuPkg.dec
[LibraryClasses]
@@ -54,6 +55,7 @@
CpuLib
UefiCpuLib
UefiBootServicesTableLib
+ DebugAgentLib
[Guids]
gEfiEventExitBootServicesGuid ## CONSUMES ## Event
diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
index e75c269..1204abd 100644
--- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c
@@ -16,6 +16,7 @@
#include <Library/UefiLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugAgentLib.h>
#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100))
#define AP_SAFE_STACK_SIZE 128
@@ -30,6 +31,21 @@ UINTN mReservedTopOfApStack;
volatile UINT32 mNumberToFinish = 0;
/**
+ Enable Debug Agent to support source debugging on AP function.
+
+**/
+VOID
+EnableDebugAgent (
+ VOID
+ )
+{
+ //
+ // Initialize Debug Agent to support source level debug in DXE phase
+ //
+ InitializeDebugAgent (DEBUG_AGENT_INIT_DXE_AP, NULL, NULL);
+}
+
+/**
Get the pointer to CPU MP Data structure.
@return The pointer to CPU MP Data structure.
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 0495b0f..a21a980 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -539,6 +539,10 @@ ApWakeupFunction (
if (Procedure != NULL) {
SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateBusy);
//
+ // Enable source debugging on AP function
+ //
+ EnableDebugAgent ();
+ //
// Invoke AP function here
//
Procedure (Parameter);
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 9861a5c..b67ea9d 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -575,5 +575,14 @@ RestoreWakeupBuffer(
IN CPU_MP_DATA *CpuMpData
);
+/**
+ Enable Debug Agent to support source debugging on AP function.
+
+**/
+VOID
+EnableDebugAgent (
+ VOID
+ );
+
#endif
diff --git a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
index a4166a4..fb1d48f 100644
--- a/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/PeiMpLib.c
@@ -25,6 +25,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_NOTIFY_DESCRIPTOR mMpInitLibNotifyList = {
CpuMpEndOfPeiCallback
};
+
+/**
+ Enable Debug Agent to support source debugging on AP function.
+
+**/
+VOID
+EnableDebugAgent (
+ VOID
+ )
+{
+}
+
/**
Get pointer to CPU MP Data structure.
--
2.9.3.windows.2
next prev parent reply other threads:[~2016-12-26 11:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-26 11:20 [PATCH 0/6] Support source debugging on DXE AP function Jeff Fan
2016-12-26 11:20 ` Jeff Fan [this message]
2016-12-26 11:20 ` [PATCH 2/6] UefiCpuPkg/MpInitLib: Sync BSP's local APIC timer settings to APs Jeff Fan
2016-12-26 11:20 ` [PATCH 3/6] UefiCpuPkg/MpInitLib: Move save/restore interrupt to SwitchBSPWorker() Jeff Fan
2016-12-26 11:21 ` [PATCH 4/6] UefiCpuPkg/MpInitLib: Swap local APIC timer interrupt state Jeff Fan
2016-12-26 11:21 ` [PATCH 5/6] UefiCpuPkg/MpInitLib: Disable and restore system timer interrupt Jeff Fan
2016-12-26 11:21 ` [PATCH 6/6] UefiCpuPkg/MpInitLib: Set new AP to idle state after switching BSP Jeff Fan
2016-12-28 7:33 ` [PATCH 0/6] Support source debugging on DXE AP function Tian, Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161226112102.25512-2-jeff.fan@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox