summaryrefslogtreecommitdiff
path: root/SourceLevelDebugPkg/Library/DebugAgent
AgeCommit message (Collapse)AuthorFilesLines
2023-12-26SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or notJiaxin Wu1-2/+19
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>
2022-10-06SourceLevelDebugPkg: Fix spelling errorsMichael Kubacki3-16/+16
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4091 Fixes spelling errors in the package so the SpellCheck CI plugin can be enabled. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-03-01SourceLevelDebugPkg: Replace Opcode with the corresponding instructions.Jason2-6/+6
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790 Replace Opcode with the corresponding instructions. The code changes have been verified with CompareBuild.py tool, which can be used to compare the results of two different EDK II builds to determine if they generate the same binaries. (tool link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild) Signed-off-by: Jason Lou <yun.lou@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2021-12-07SourceLevelDebugPkg: Apply uncrustify changesMichael Kubacki17-1960/+2077
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SourceLevelDebugPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-12-07SourceLevelDebugPkg: Change OPTIONAL keyword usage styleMichael D Kinney4-6/+6
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
2021-12-07SourceLevelDebugPkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney6-28/+25
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2020-02-10SourceLevelDebugPkg/DebugAgent: Fix various typosAntoine Coeur11-49/+49
Fix various typos in documentation, comments and debug strings. Cc: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Antoine Coeur <coeur@gmx.fr> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com> Message-Id: <20200207010831.9046-72-philmd@redhat.com>
2019-04-09SourceLevelDebugPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney27-183/+27
https://bugzilla.tianocore.org/show_bug.cgi?id=1373 Replace BSD 2-Clause License with BSD+Patent License. This change is based on the following emails: https://lists.01.org/pipermail/edk2-devel/2019-February/036260.html https://lists.01.org/pipermail/edk2-devel/2018-October/030385.html RFCs with detailed process for the license change: V3: https://lists.01.org/pipermail/edk2-devel/2019-March/038116.html V2: https://lists.01.org/pipermail/edk2-devel/2019-March/037669.html V1: https://lists.01.org/pipermail/edk2-devel/2019-March/037500.html Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2019-04-03SourceLevelDebugPkg/DebugAgent: Remove AsmFuncs.S in INFZhang, Shenglei2-4/+0
AsmFuncs.S is removed at c7d22535f7dc90b8fef70153ef98549228569680. And also it should be removed in SecPeiDebugAgentLib.inf and SmmDebugAgentLib.inf. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2019-04-03SourceLevelDebugPkg/DebugAgentCommon: Remove .S filesShenglei Zhang3-848/+0
.nasm file has been added for X86 arch. .S assembly code is not required any more. https://bugzilla.tianocore.org/show_bug.cgi?id=1594 Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2018-06-28SourceLevelDebugPkg: Clean up source filesLiming Gao12-99/+99
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-06-07SourceLevelDebugPkg: Remove X86 ASM and S filesLiming Gao5-836/+3
NASM has replaced ASM and S files. 1. Remove ASM from all modules. 2. Remove S files from the drivers only. 3. https://bugzilla.tianocore.org/show_bug.cgi?id=881 After NASM is updated, S files can be removed from Library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2018-02-08SourceLevelDebugPkg DebugAgentLib: Rename IsBsp to DebugAgentIsBspStar Zeng3-8/+8
For avoiding function name confliction, rename IsBsp to DebugAgentIsBsp. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-12-28SourceLevelDebugPkg: Convert source file to DOS formatLiming Gao1-2/+2
Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Wu Hao A <hao.a.wu@intel.com> Reviewed-by: Wu Hao A <hao.a.wu@intel.com>
2017-12-08SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbolMichael Kinney1-2/+2
https://bugzilla.tianocore.org/show_bug.cgi?id=573 https://bugzilla.tianocore.org/show_bug.cgi?id=796 The same issue is reported again by GCC. Resend this patch again. This patch renames the duplicated function name to fix it. The SecPeiDebugAgentLib uses the global variable mMemoryDiscoveredNotifyList for a PPI notification on the Memory Discovered PPI. This same variable name is used in the DxeIplPeim for the same PPI notification. The XCODE5 tool chain detects this duplicate symbol when the OVMF platform is built with the flag -D SOURCE_DEBUG_ENABLE. The fix is to rename this global variable in the SecPeiDebugAgentLib library. Cc: Andrew Fish <afish@apple.com> Cc: Jeff Fan <jeff.fan@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
2017-10-16SourceLevelDebugPkg: Update SmmDebugAgentLib to restore APIC timerLiming Gao1-5/+16
In enter SMI, APIC timer may be initialized. After exit SMI, APIC timer will be restore. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-09-04SourceLevelDebugPkg: Use Pcd for the revision of transfer protocolHao Wu4-6/+9
V3 changes: Add detailed description for the usage of the Pcd in package DEC file. Update the comment for the introduced Pcd in module INF files. V2 changes: Instead of using a global variable, use a Pcd for transfer protocol revision. Previously, the revision of the debug agent transfer protocol is reflected by a macro. This commit introduces a Pcd to reflect the revision in order to avoid the comparison of two macros, which will generate a constant result detected by code checkers. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2017-04-26PeCoffGetEntryPointLib: Fix spelling issueJeff Fan1-1/+1
*Serach* should be *Search* Cc: Liming Gao <liming.gao@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
2017-04-07SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()Jeff Fan1-44/+6
Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2017-03-06SourceLevelDebugPkg: Refine casting expression result to bigger sizeHao Wu3-10/+10
There are cases that the operands of an expression are all with rank less than UINT64/INT64 and the result of the expression is explicitly cast to UINT64/INT64 to fit the target size. An example will be: UINT32 a,b; // a and b can be any unsigned int type with rank less than UINT64, like // UINT8, UINT16, etc. UINT64 c; c = (UINT64) (a + b); Some static code checkers may warn that the expression result might overflow within the rank of "int" (integer promotions) and the result is then cast to a bigger size. The commit refines codes by the following rules: 1). When the expression is possible to overflow the range of unsigned int/ int: c = (UINT64)a + b; 2). When the expression will not overflow within the rank of "int", remove the explicit type casts: c = a + b; 3). When the expression will be cast to pointer of possible greater size: UINT32 a,b; VOID *c; c = (VOID *)(UINTN)(a + b); --> c = (VOID *)((UINTN)a + b); 4). When one side of a comparison expression contains only operands with rank less than UINT32: UINT8 a; UINT16 b; UINTN c; if ((UINTN)(a + b) > c) {...} --> if (((UINT32)a + b) > c) {...} For rule 4), if we remove the 'UINTN' type cast like: if (a + b > c) {...} The VS compiler will complain with warning C4018 (signed/unsigned mismatch, level 3 warning) due to promoting 'a + b' to type 'int'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2016-11-30SourceLevelDebugPkg: Avoid to re-init IDT table again at SMI entryJeff Fan1-1/+9
Current SmmDebugAgentLib will initialize IDT table to support source debugging at each time SMI entry on SMM BSP. Actually, we only need to initialize IDT table at first time SMI entry. Add one flag to avoid re-initializing IDT table. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-10-24SourceLevelDebugPkg: Fix typos in commentsGary Lin2-5/+5
- descrption -> description - Libary -> Library - funciton -> function - paramter -> parameter - triggerred -> triggered - hanlde -> handle Cc: Jeff Fan <jeff.fan@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2016-08-17UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitionsJeff Fan2-3/+7
#define MSR_IA32_APIC_BASE_ADDRESS is duplicated with #define MSR_IA32_APIC_BASE defined in UefiCpuPkg/Include/Register/ArchitecturalMsr.h, so we could remove it and update the modules to use MSR_IA32_APIC_BASE from ArchitecturalMsr.h. Structure MSR_IA32_APIC_BASE conflicts with #define MSR_IA32_APIC_BASE defined in UefiCpuPkg/Include/Register/ArchitecturalMsr.h, so we could remove it and update the modules to use structure MSR_IA32_APIC_BASE_REGISTER from ArchitecturalMsr.h. v5: 1. Update SourceLevelDebugPkg to use APIC Base MSR from ArchitecturalMsr.h. Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Tested-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Michael Kinney <michael.d.kinney@intel.com>
2016-06-28SourceLevelDebugPkg DebugAgentLib: Add nasm source file into LIB INF files.Liming Gao3-9/+15
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-06-28SourceLevelDebugPkg DebugAgentLib: Convert X64/AsmFuncs.asmLiming Gao1-0/+405
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert X64/AsmFuncs.asm to X64/AsmFuncs.nasm. And, manually update the wrong replacement with 0H. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-06-28SourceLevelDebugPkg DebugAgentLib: Convert Ia32/AsmFuncs.asmLiming Gao1-0/+419
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert Ia32/AsmFuncs.asm to Ia32/AsmFuncs.nasm. And, manually update the wrong replacement with 0H. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-04-06SourceLevelDebugPkg/SmmDebugAgent: mMailboxPointer is used before setJeff Fan1-2/+2
mMailboxPointer is used before it is initialization. This issue only happens when SmmDebugAgent is initialized without PeiDebugAgent or DxeDebugAgent initialization. The fix is to use Mailbox instead. Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-03-25SourceLevelDebugPkg: DebugAgentCommon: remove set but unused variablesLaszlo Ersek1-3/+0
Cc: Jeff Fan <jeff.fan@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com>
2015-12-17SourceLevelDebugPkg: Correct gEfiDebugAgentGuid usage in DxeDebugAgentLibLiming Gao1-1/+1
DxeDebugAgentLib instance produces gEfiDebugAgentGuid system table. Its usage should be PRODUCES instead of SOMETIMES_PRODUCES. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19316 6f19259b-4bc3-4df7-8a09-765794883524
2015-12-15SourceLevelDebugPkg: Convert all .uni files to utf-8Jordan Justen3-0/+0
To convert these files I ran: $ python3 BaseTools/Scripts/ConvertUni.py SourceLevelDebugPkg Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jordan Justen <jordan.l.justen@intel.com> Reviewed-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19263 6f19259b-4bc3-4df7-8a09-765794883524
2015-10-30SourceLevelDebugPkg: DebugAgent: Set Local APIC SoftwareEnableMichael Kinney3-0/+3
Update DebugAgent to make sure the Local APIC SoftwareEnable bit is set before using the Local APIC Timer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18712 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-24SourceLevelDebugPkg: Change the debug message to "v1.5" from "v1.4"Ruiyu Ni1-1/+1
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18534 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-27SourceLevelDebugPkg/DebugTimer: Timer count value 0 not calculatedJeff Fan2-9/+9
Actually, TimerCycle is APIC timer's initial count. Timer count value 0 is missed when calculating Delta value. Contributed-under: TianoCore Contribution Agreement 1.0 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@18329 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-27SourceLevelDebugPkg/DebugTimer: Fix the issue if CurrentTimer = TimerJeff Fan1-1/+3
If CPU runs fast and timer runs slow, two GetApicTimerCurrentCount() may return the same timer count value. We need to consider timer roll-over not happened. Otherwise, one false timeout flag will be set. Contributed-under: TianoCore Contribution Agreement 1.0 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@18328 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-10SourceLevelDebugPkg/SecPeiDebugAgentLib: Restore CPU interrupt stateJeff Fan1-10/+19
In DEBUG_AGENT_INIT_POSTMEM_SEC case, caller may disable/restore CPU interrupt to protect the stack/heap migration. SecPeiDebugAgentLib cannot always enable CPU interrupt. Otherwise system may crash during stack/heap migration. SecPeiDebugAgentLib should restore original CPU interrupt state in DEBUG_AGENT_INIT_POSTMEM_SEC case. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Brian J. Johnson <bjohnson@sgi.com> Tested-by: Brian J. Johnson <bjohnson@sgi.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17916 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-09SourceLevelDebugPkg: Fix PEI timer interrupt regressionBrian J. Johnson1-2/+4
Recent changes to debug timer initialization (commit 2befbc82, svn 17572) modified the Sec/Pei InitializeDebugAgent() routine to enable debug timer interrupts. This causes problems in the DEBUG_AGENT_INIT_POSTMEM_SEC case: the callers appear to assume that if they block timer interrupts before the call, interrupts will remain blocked afterwards. It is not always safe to have interrupts enabled on return from InitializeDebugAgent(). For instance, after calling InitializeDebugAgent(), OvmfPkg's TemporaryRamMigration() moves the stack, heap, and IDT to RAM, then switches to the new stack. Only then does it reenable timer interrupts. Taking an interrupt during this process can corrupt state, causing crashes. Do not unmask the debug timer interrupt in the DEBUG_AGENT_INIT_POSTMEM_SEC case. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brian J. Johnson <bjohnson@sgi.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17893 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-03SourceLevelDebugPkg: Fix PEI debug timer regressionBrian J. Johnson1-0/+4
Recent changes to debug timer handling ended up leaving the timer disabled in PEI. This made it impossible to stop execution in PEI externally via the debugger. Enable the timer when InitializeDebugAgent calls InitializeDebugAgentPhase2, as well as when it returns directly. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Brian J. Johnson <bjohnson@sgi.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17819 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-26SourceLevelDebugPkg/DebugAgent: Add typecast to fix sign extensionJeff Fan3-3/+3
OffsetHigh is 16bit value and its type is UINT32 and defined in structure. It will be 32bit int type after do 16-bit left-shift operation. Then it will sign extension if cast it to UINT64 if its high bit is 1. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Scott Duplichan <scott@notabs.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17716 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-10SourceLevelDebugPkg/DxeDebugAgent: Initialize Local APIC TimerJeff Fan1-0/+10
Now Debug Agent library uses Local APIC Timer to implement time-out mechanism. For AP, its local APIC timer may not work. This fix is to initialize Local APIC timer if it doesn't work as expected when debugging AP function. Contributed-under: TianoCore Contribution Agreement 1.0 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@17604 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-08SourceLevelDebugPkg/DebugAgent: Disable Debug Timer as earlyJeff Fan5-1/+22
InitializeApicTimer() will enable Local APIC timer interrupt. Even though we disable CPU interrupt at the beginning and enable CPU Interrupt after debug agent initialized completely, some Boot Service may invoke RestoreTpl () which may enable CPU interrupt. We should disable Local APIC timer in InitializeDebugTimer () to avoid Debug Timer interrupt happens during debug port and debug agent initialization phase. And enable Debug Timer interrupt after debug agent is initialized. Contributed-under: TianoCore Contribution Agreement 1.0 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@17572 6f19259b-4bc3-4df7-8a09-765794883524
2015-06-04SourceLevelDebugPkg/DebugAgent: Check PcdDebugPortHandleBufferSizeJeff Fan2-2/+2
Check PcdDebugPortHandleBufferSize before allocate buffer. PeriodicMode is BOOLEAN type, needn't to use == TRUE in if condition. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17558 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-25SourceLevelDebugPkg/DebugTimer: Dump Debug Timer parameterJeff Fan6-14/+19
Add one parameter DumpFlag to indicate if need to dump Local APIC time's parameter. Contributed-under: TianoCore Contribution Agreement 1.0 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@17501 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-25SourceLevelDebugPkg/SmmDebugAgent: Initialize Local APIC TimerJeff Fan1-1/+11
Now Debug Agent library uses Local APIC Timer to implement time-out mechanism. In SMM, SMM BSP maybe not be the one in DXE phase, its local APIC timer may not work. This fix is to initialize Local APIC timer if it doesn't work as expected at SMM entry. Contributed-under: TianoCore Contribution Agreement 1.0 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@17500 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-18SourceLevelDebugPkg: Fix Serial Port connection cannot be setupRuiyu Ni1-21/+25
The root cause is SerialPortDebugCommunicationLib returns NULL debug port handle causing the CompressData() doesn't send the compressed data. The fix doesn't rely on the debug port handle value and uses Send parameter to indicate whether to send the compressed data. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17464 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-18SourceLevelDebugPkg/DebugAgentDxe: Move help info from DxeDebugAgentJeff Fan1-29/+0
Now DxeDebugAgent Library instance will print help information on how to load DebugAgentDxe.efi in UEFI shell. But it is printed after Target connected to Host side. This fix is to move help info print to DebugAgentDxe module before Target tries to connect HOST. It could help developer to get useful information as early as possible. Contributed-under: TianoCore Contribution Agreement 1.0 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@17458 6f19259b-4bc3-4df7-8a09-765794883524
2015-05-18SourceLevelDebugPkg/DxeDebugAgent: Initialize Local APIC Timer earlyJeff Fan1-20/+19
Now Debug Agent library uses Local APIC Timer to implement time-out mechanism. But it does not initialize Local APIC Timer before transfer data with HOST. This fix is to move Local APIC Timer initialization to SetupDebugAgentEnvironment(). This fix also updates function header and fixed one typo of SetupDebugAgentEnvironment() name. Contributed-under: TianoCore Contribution Agreement 1.0 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@17457 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-27SourceLevelDebugPkg/DebugAgent: Support IA32 processors without DE or ↵Michael Kinney7-14/+71
FXSAVE/FXRESTOR Use CPUID Leaf 01 to detect support for debug extensions and FXSAVE/FXRESTOR instructions. Do not enable those features in CR4 if they are not supported. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17220 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-27MdePkg/DebugAgent: Support IA32 processors without MSR_IA32_APIC_BASE_ADDRESSMichael Kinney1-2/+11
Avoid use of Local APIC Base Address MSR (MSR_IA32_APIC_BASE_ADDRESS) if there is only 1 CPU present. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Kinney <michael.d.kinney@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17218 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-27SourceLevelDebugPkg/DebugAgent: Add some comments and debug messageJeff Fan1-4/+22
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17206 6f19259b-4bc3-4df7-8a09-765794883524
2015-04-27SourceLevelDebugPkg/DebugAgent: Clear/Restore EFLAGS.IFJeff Fan1-8/+41
Clear EFLAGS.IF before executing Stepping command and save original value in DEBUG_AGENT_FLAG. It could avoid pending interrupt issued during executing Stepping command. Restore EFLAGS.IF after Stepping command execution finished. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17204 6f19259b-4bc3-4df7-8a09-765794883524