summaryrefslogtreecommitdiffstats
path: root/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c
Commit message (Collapse)AuthorAgeFilesLines
* SourceLevelDebugPkg: Replace BSD License with BSD+Patent LicenseMichael D Kinney2019-04-091-7/+1
| | | | | | | | | | | | | | | | | | | | 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>
* SourceLevelDebugPkg: Clean up source filesLiming Gao2018-06-281-34/+34
| | | | | | | | | | 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>
* SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is resetStar Zeng2018-03-201-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* SourceLevelDebugPkg DebugUsb3: Re-Support IOMMUStar Zeng2018-03-151-91/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | de8373fa07f87ca735139bb86c51e2c29fb1d956 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>
* SourceLevelDebugPkg DebugCommUsb3: Refine some formats/commentsStar Zeng2018-03-151-8/+8
| | | | | | | | | | | 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>
* SourceLevelDebugPkg DebugUsb3: Re-Fix GCC build failuresStar Zeng2018-03-151-2/+0
| | | | | | | | | | | | | | | | | | | | 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. ad6040ec9b5bbc462762331f9738b8e42c0b9c80 needs to be also reverted when reverting IOMMU support patches, otherwise there will be conflict. This patch is to re-do ad6040ec9b5bbc462762331f9738b8e42c0b9c80. 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>
* Revert "DebugUsb3: Support IOMMU"Star Zeng2018-03-151-107/+115
| | | | | | | | | | | This reverts commit de8373fa07f87ca735139bb86c51e2c29fb1d956. 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>
* Revert "DebugUsb3: Fix GCC build failures"Star Zeng2018-03-151-0/+2
| | | | | | | | | | | This reverts commit ad6040ec9b5bbc462762331f9738b8e42c0b9c80. 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>
* SourceLevelDebugPkg DebugUsb3: Fix GCC build failuresStar Zeng2018-02-091-2/+0
| | | | | | | | | | | | | | | 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>
* SourceLevelDebugPkg DebugUsb3: Support IOMMUStar Zeng2018-02-081-115/+107
| | | | | | | | | | | | 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>
* SourceLevelDebugPkg DebugUsb3: Fix some typosStar Zeng2018-02-081-4/+4
| | | | | | | | 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>
* SourceLevelDebugPkg: Fix typos in commentsGary Lin2016-10-241-3/+3
| | | | | | | | | | | | | | | | - 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>
* SourceLevelDebugPkg: Use CPU Local APIC timer to handle timeout.Jeff Fan2015-04-011-185/+11
| | | | | | | | | | | | | | | Use CPU Local APIC timer to handle timeout when read data from debug port, instead of the TimerLib in Debug Communication lib instances. It could remove much duplicated code in Debug Communication Lib instances. 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@17089 6f19259b-4bc3-4df7-8a09-765794883524
* Use MaxPacketSize as the initial buffer size to read data.Elvin Li2015-02-051-25/+29
| | | | | | | | | | | | If host sends more than 8 bytes of data, BABBLE error would happen if USB3 debug library uses 8 byte of buffer to read data. We need use MaxPacketSize in USB3 debug descriptor to create buffer and read data into this buffer. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Elvin Li <elvin.li@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16762 6f19259b-4bc3-4df7-8a09-765794883524
* Add DebugCommunicationLibUsb3 for USB3.0 source level debug support.Elvin Li2014-10-221-0/+1236
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Elvin Li <elvin.li@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16224 6f19259b-4bc3-4df7-8a09-765794883524