* [PATCH] SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset
@ 2018-03-19 12:45 Star Zeng
2018-03-20 1:24 ` Wu, Hao A
0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2018-03-19 12:45 UTC (permalink / raw)
To: edk2-devel; +Cc: Star Zeng, Ruiyu Ni, Hao Wu
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>
---
.../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c
index fb9ca84fc7bc..86ecc2f9dbc7 100644
--- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c
+++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c
@@ -673,11 +673,19 @@ InitializeUsbDebugHardware (
UINTN Index;
UINT8 TotalUsb3Port;
EFI_PHYSICAL_ADDRESS XhciOpRegister;
+ UINT32 Dcddi1;
XhciOpRegister = Handle->XhciOpRegister;
TotalUsb3Port = MmioRead32 (((UINTN) Handle->XhciMmioBase + XHC_HCSPARAMS1_OFFSET)) >> 24;
if (Handle->Initialized == USB3DBG_NOT_ENABLED) {
+ Dcddi1 = XhcReadDebugReg (Handle,XHC_DC_DCDDI1);
+ if (Dcddi1 != (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) | XHCI_DEBUG_DEVICE_PROTOCOL)) {
+ //
+ // The debug capability has been reset by other code, return device error.
+ //
+ return EFI_DEVICE_ERROR;
+ }
//
// If XHCI supports debug capability, hardware resource has been allocated,
// but it has not been enabled, try to enable again.
--
2.7.0.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset
2018-03-19 12:45 [PATCH] SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset Star Zeng
@ 2018-03-20 1:24 ` Wu, Hao A
0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2018-03-20 1:24 UTC (permalink / raw)
To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu, Zeng, Star
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Star
> Zeng
> Sent: Monday, March 19, 2018 8:46 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu; Wu, Hao A; Zeng, Star
> Subject: [edk2] [PATCH] 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>
> ---
> .../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c |
> 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git
> a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommun
> icationLibUsb3Common.c
> b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommun
> icationLibUsb3Common.c
> index fb9ca84fc7bc..86ecc2f9dbc7 100644
> ---
> a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommun
> icationLibUsb3Common.c
> +++
> b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommun
> icationLibUsb3Common.c
> @@ -673,11 +673,19 @@ InitializeUsbDebugHardware (
> UINTN Index;
> UINT8 TotalUsb3Port;
> EFI_PHYSICAL_ADDRESS XhciOpRegister;
> + UINT32 Dcddi1;
>
> XhciOpRegister = Handle->XhciOpRegister;
> TotalUsb3Port = MmioRead32 (((UINTN) Handle->XhciMmioBase +
> XHC_HCSPARAMS1_OFFSET)) >> 24;
>
> if (Handle->Initialized == USB3DBG_NOT_ENABLED) {
> + Dcddi1 = XhcReadDebugReg (Handle,XHC_DC_DCDDI1);
> + if (Dcddi1 != (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) |
> XHCI_DEBUG_DEVICE_PROTOCOL)) {
> + //
> + // The debug capability has been reset by other code, return device error.
> + //
> + return EFI_DEVICE_ERROR;
> + }
> //
> // If XHCI supports debug capability, hardware resource has been allocated,
> // but it has not been enabled, try to enable again.
> --
> 2.7.0.windows.1
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-20 1:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-19 12:45 [PATCH] SourceLevelDebugPkg DebugCommUsb3: Return error when debug cap is reset Star Zeng
2018-03-20 1:24 ` Wu, Hao A
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox