From 93723244c8e1fe78ea2b0a7402548bfd07765d50 Mon Sep 17 00:00:00 2001 From: niruiyu Date: Thu, 18 Apr 2013 05:56:04 +0000 Subject: [PATCH] Enhance DebugCommunicationLibUsb to reset the debug port when the PORT_ENABLE bit is not set. Signed-off-by: Ruiyu Ni Reviewed-by: Feng Tian git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14289 6f19259b-4bc3-4df7-8a09-765794883524 --- .../DebugCommunicationLibUsb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c index c08d45b787..54aaa71d75 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c @@ -674,10 +674,16 @@ InitializeUsbDebugHardware ( // if (((MmioRead32((UINTN)&UsbDebugPortRegister->ControlStatus) & (USB_DEBUG_PORT_OWNER | USB_DEBUG_PORT_IN_USE)) != (USB_DEBUG_PORT_OWNER | USB_DEBUG_PORT_IN_USE)) || (Handle->Initialized == USBDBG_RESET)) { + DEBUG (( + EFI_D_INFO, + "UsbDbg: Need to reset the host controller. ControlStatus = %08x\n", + MmioRead32((UINTN)&UsbDebugPortRegister->ControlStatus) + )); // // If the host controller is halted, then reset and restart it. // if ((MmioRead32((UINTN)UsbStatus) & BIT12) != 0) { + DEBUG ((EFI_D_INFO, "UsbDbg: Reset the host controller.\n")); // // reset the host controller. // @@ -712,7 +718,9 @@ InitializeUsbDebugHardware ( return RETURN_NOT_FOUND; } - if (Handle->Initialized != USBDBG_INIT_DONE) { + if (Handle->Initialized != USBDBG_INIT_DONE || + (MmioRead32 ((UINTN) &UsbDebugPortRegister->ControlStatus) & USB_DEBUG_PORT_ENABLE) == 0) { + DEBUG ((EFI_D_INFO, "UsbDbg: Reset the debug port.\n")); // // Reset the debug port // -- 2.39.2