Commit Graph

141 Commits

Author SHA1 Message Date
Star Zeng df67a480eb SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset
When source level debug is enabled, but debug cable is not connected,
XhcResetHC() in XhciReg.c will reset the host controller, the debug
capability registers will be also reset. After the code in
InitializeUsbDebugHardware() sets DCE bit and LSE bit to "1" in DCCTRL,
there will be DMA on 0 (the value of some debug capability registers
for data transfer is 0) address buffer, fault info like below will
appear when IOMMU based on VTd is enabled.

  VER_REG     - 0x00000010
  CAP_REG     - 0x00D2008C40660462
  ECAP_REG    - 0x0000000000F050DA
  GSTS_REG    - 0xC0000000
  RTADDR_REG  - 0x0000000086512000
  CCMD_REG    - 0x2800000000000000
  FSTS_REG    - 0x00000002
  FECTL_REG   - 0xC0000000
  FEDATA_REG  - 0x00000000
  FEADDR_REG  - 0x00000000
  FEUADDR_REG - 0x00000000
  FRCD_REG[0] - 0xC0000006000000A0 0000000000000000
    Fault Info - 0x0000000000000000
    Source - B00 D14 F00
    Type - 1 (read)
    Reason - 6
  IVA_REG     - 0x0000000000000000
  IOTLB_REG   - 0x1200000000000000

This patch is to return error for the case.

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>
2018-03-20 20:23:53 +08:00
Star Zeng 75787f6580 SourceLevelDebugPkg DebugUsb3: Re-Support IOMMU
de8373fa07 could not handle two cases.
1. For the case that the USB3 debug port instance and DMA buffers are
from PEI HOB with IOMMU enabled, it was to reallocate the DMA buffers
by AllocateAddress with the memory type accessible by SMM environment.
But reallocating the DMA buffers by AllocateAddress may fail.

2. At S3 resume, after the code is transferred to PiSmmCpuDxeSmm from
S3Resume2Pei, HOB is still needed to be used for DMA operation, but
PiSmmCpuDxeSmm has no way to get the HOB at S3 resume.

The patch is to re-support IOMMU.
For PEI, allocate granted DMA buffer from IOMMU PPI, register IOMMU PPI
notification to reinitialize hardware with granted DMA buffer if IOMMU
PPI is not present yet.
For DXE, map DMA buffer by PciIo in PciIo notification for early DXE,
and register DxeSmmReadyToLock notification to reinitialize hardware
with granted DXE DMA buffer accessible by SMM environment for late DXE.

DebugAgentLib has been managing the instance as Handle in
HOB/SystemTable. The Handle(instance) from DebugAgentLib can be used
directly in DebugCommunicationLibUsb3. Then DebugCommunicationLibUsb3
could get consistent Handle(instance) from DebugAgentLib.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-03-15 14:14:26 +08:00
Star Zeng f0c562761f SourceLevelDebugPkg DebugCommUsb3: Refine some formats/comments
Refine some formats/comments and remove some unused prototypes.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-03-15 14:14:22 +08:00
Star Zeng 3ecca00330 SourceLevelDebugPkg DebugUsb3: Re-Fix GCC build failures
Fix GCC build failures below.
variable 'EvtTrb' set but not used [-Werror=unused-but-set-variable]
variable 'Index' set but not used [-Werror=unused-but-set-variable]

The build failure could only be caught with -D SOURCE_DEBUG_USE_USB3
build flag.

ad6040ec9b needs to be also reverted
when reverting IOMMU support patches, otherwise there will be conflict.
This patch is to re-do ad6040ec9b.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-03-15 14:14:18 +08:00
Star Zeng 1f279e7a53 Revert "DebugUsb3: Support IOMMU"
This reverts commit de8373fa07.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-03-15 14:14:15 +08:00
Star Zeng 373b1d0ee3 Revert "DebugUsb3: Fix GCC build failures"
This reverts commit ad6040ec9b.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-03-15 14:14:11 +08:00
Star Zeng abea3bca82 Revert "DebugUsb3: Check mUsb3Instance before dereferencing it"
This reverts commit 6ef394ffe2.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2018-03-15 14:14:07 +08:00
Star Zeng 6ef394ffe2 SourceLevelDebugPkg DebugUsb3: Check mUsb3Instance before dereferencing it
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>
2018-02-11 10:32:27 +08:00
Star Zeng ad6040ec9b SourceLevelDebugPkg DebugUsb3: Fix GCC build failures
Fix GCC build failures below.
variable 'EvtTrb' set but not used [-Werror=unused-but-set-variable]
variable 'Index' set but not used [-Werror=unused-but-set-variable]

The build failure could only be caught with -D SOURCE_DEBUG_USE_USB3
build flag.

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>
2018-02-09 10:50:04 +08:00
Star Zeng de8373fa07 SourceLevelDebugPkg DebugUsb3: Support IOMMU
For PEI, allocate granted DMA buffer from IOMMU PPI.
For DXE, map DMA buffer by PciIo.

Cc: Jiewen Yao <jiewen.yao@intel.com>
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: Ruiyu Ni <ruiyu.ni@intel.com>
2018-02-08 16:43:55 +08:00
Star Zeng f4043414da SourceLevelDebugPkg DebugUsb3: Fix some typos
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>
2018-02-08 16:43:55 +08:00
Star Zeng a2acb04ca6 SourceLevelDebugPkg DebugAgentLib: Rename IsBsp to DebugAgentIsBsp
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>
2018-02-08 16:43:54 +08:00
Liming Gao 7a3ed289f2 SourceLevelDebugPkg: Convert source file to DOS format
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-28 12:48:04 +08:00
Michael Kinney 2b55daaef0 SourceLevelDebugPkg/SecPeiDebugAgentLib: Fix duplicate symbol
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-12-08 13:31:47 +08:00
Liming Gao 222c49300d SourceLevelDebugPkg: Update SmmDebugAgentLib to restore APIC timer
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-10-16 11:23:16 +08:00
Star Zeng 9c6a26d643 SourceLevelDebugPkg/DebugCommLibUsb3: Remove IntelFrameworkPkg.dec
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>
2017-09-04 10:37:56 +08:00
Star Zeng 364f63c065 SourceLevelDebugPkg/DebugCommLibUsb3Pei: Make sure alloc physical mem
PI 1.6 has supported pre permanent memory page allocation,
to make sure the allocated memory is physical memory for DMA,
the patch is to check memory discovered PPI installed or not first
before calling AllocatePages.

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: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
2017-09-04 10:37:46 +08:00
Hao Wu c00ad62378 SourceLevelDebugPkg: Use Pcd for the revision of transfer protocol
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-09-04 09:01:16 +08:00
Michael D Kinney 2a98de0344 edk2: Move License.txt file to root
https://bugzilla.tianocore.org/show_bug.cgi?id=642

Add top level License.txt file with the BSD 2-Clause
License that is used by the majority of the EKD II open
source project content.  Merge copyright statements
from the BSD 2-Clause License files in each package
directory and remove the duplication License.txt
file from package directories.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2017-08-03 11:02:17 -07:00
Michael D Kinney bbdd3bad1b edk2: Move TianoCore Contribution Agreement to root
https://bugzilla.tianocore.org/show_bug.cgi?id=629

Move Contributions.txt that contains the TianoCore
Contribution Agreement 1.0 to the root of the edk2
repository and remove the duplicate Contributions.txt
files from all packages.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2017-08-03 11:01:53 -07:00
Jeff Fan 9e981317be PeCoffGetEntryPointLib: Fix spelling issue
*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-26 08:58:18 +08:00
Jeff Fan c54a6e6feb SourceLevelDebugPkg/DebugAgent.c: Consume PeCoffSerachImageBase()
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-04-07 09:43:53 +08:00
Hao Wu 3ee1680978 SourceLevelDebugPkg: Refine casting expression result to bigger size
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>
2017-03-06 14:33:25 +08:00
Jeff Fan 6fee83fbca SourceLevelDebugPkg: Avoid to re-init IDT table again at SMI entry
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-11-30 14:34:45 +08:00
Gary Lin 74cdb367ad SourceLevelDebugPkg: Fix typos in comments
- 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-10-24 09:10:15 +08:00
Jeff Fan a742e1865d UefiCpuPkg/LocalApic.h: Remove duplicated/conflicted definitions
#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-08-17 19:54:41 +08:00
Hao Wu 7f024f21ff SourceLevelDebugPkg DSC: Add build option to disable deprecated APIs
Add the following definition in the [BuildOptions] section in package DSC
files to disable APIs that are deprecated:

[BuildOptions]
  *_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
2016-08-08 11:00:11 +08:00
Liming Gao 9ae1572caf SourceLevelDebugPkg DebugAgentLib: Add nasm source file into LIB INF files.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-06-28 09:52:25 +08:00
Liming Gao 6f5f7e9903 SourceLevelDebugPkg DebugAgentLib: Convert X64/AsmFuncs.asm
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-28 09:52:24 +08:00
Liming Gao a338fb2235 SourceLevelDebugPkg DebugAgentLib: Convert Ia32/AsmFuncs.asm
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-06-28 09:52:24 +08:00
Liming Gao c6d06fdf43 SourceLevelDebugPkg PeCoffExtraActionLibDebug: Add nasm source file into INF
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-06-28 09:52:23 +08:00
Liming Gao de16b5ca08 SourceLevelDebugPkg PeCoffExtraActionLibDebug: Convert X64/IntHandler.asm
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
X64/IntHandler.asm to X64/IntHandler.nasm.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-06-28 09:52:22 +08:00
Liming Gao 3d73842f45 SourceLevelDebugPkg PeCoffExtraActionLibDebug: Convert Ia32/IntHandler.asm
The BaseTools/Scripts/ConvertMasmToNasm.py script was used to convert
Ia32/IntHandler.asm to Ia32/IntHandler.nasm.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
2016-06-28 09:52:22 +08:00
Jeff Fan f3ee38dd95 SourceLevelDebugPkg/SmmDebugAgent: mMailboxPointer is used before set
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-04-06 09:13:18 +08:00
Laszlo Ersek 491ae24559 SourceLevelDebugPkg: DebugCommunicationLibUsb: remove set but unused variables
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>
2016-03-25 10:52:53 +01:00
Laszlo Ersek c30d65e080 SourceLevelDebugPkg: DebugAgentCommon: remove set but unused variables
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>
2016-03-25 10:52:52 +01:00
Eric Dong 95055567a6 SourceLevelDebugPkg: DebugCommunicationLibUsb3: Update local variable type.
Update the local variable type to avoid potential data overflow.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Hao Wu <hao.wu@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19734 6f19259b-4bc3-4df7-8a09-765794883524
2016-01-25 03:33:45 +00:00
Hao Wu c516b14549 SourceLevelDebugPkg: Add NOOPT target in SourceLevelDebugPkg.dsc
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19680 6f19259b-4bc3-4df7-8a09-765794883524
2016-01-19 04:07:52 +00:00
Liming Gao ffe9df8812 SourceLevelDebugPkg: Correct gEfiDebugAgentGuid usage in DxeDebugAgentLib
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-17 08:29:58 +00:00
Jordan Justen 4542f67ed8 SourceLevelDebugPkg: Convert all .uni files to utf-8
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-12-15 04:58:48 +00:00
Michael Kinney df60fb4cc2 SourceLevelDebugPkg: DebugAgent: Set Local APIC SoftwareEnable
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-10-30 17:53:53 +00:00
Ruiyu Ni be73a0c483 SourceLevelDebugPkg: Change revision to 4 to compress packet
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@18535 6f19259b-4bc3-4df7-8a09-765794883524
2015-09-24 03:08:00 +00:00
Ruiyu Ni 9f6bc0f297 SourceLevelDebugPkg: Change the debug message to "v1.5" from "v1.4"
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-09-24 03:07:04 +00:00
Jeff Fan 8a079ef232 SourceLevelDebugPkg/DebugTimer: Timer count value 0 not calculated
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-27 02:08:56 +00:00
Jeff Fan 3b9468ef28 SourceLevelDebugPkg/DebugTimer: Fix the issue if CurrentTimer = Timer
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-08-27 02:05:20 +00:00
Ruiyu Ni 29b3a74986 SourceLevelDebugPkg: Update package version to 0.96 to reflect new changes
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Fan Jeff <jeff.fan@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18275 6f19259b-4bc3-4df7-8a09-765794883524
2015-08-24 06:38:24 +00:00
Qiu Shumin af163e9968 SourceLevelDebugPkg: Add missing PCD usage information in UNI files.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18085 6f19259b-4bc3-4df7-8a09-765794883524
2015-07-28 01:52:33 +00:00
Jeff Fan 2638c11107 SourceLevelDebugPkg/SecPeiDebugAgentLib: Restore CPU interrupt state
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-10 05:48:19 +00:00
Brian J. Johnson 3b87e3881e SourceLevelDebugPkg: Fix PEI timer interrupt regression
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-09 02:29:58 +00:00
Brian J. Johnson 0bb5d7a55b SourceLevelDebugPkg: Fix PEI debug timer regression
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-07-03 02:29:01 +00:00