]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Enhance DebugCommunicationLibUsb to reset the debug port when the PORT_ENABLE bit...
authorniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Apr 2013 05:56:04 +0000 (05:56 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Apr 2013 05:56:04 +0000 (05:56 +0000)
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14289 6f19259b-4bc3-4df7-8a09-765794883524

SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c

index c08d45b7871fe4cecc6e8b6bc1d23d14911e8367..54aaa71d750b55028572b687c8f4db13744410b4 100644 (file)
@@ -674,10 +674,16 @@ InitializeUsbDebugHardware (
   //\r
   if (((MmioRead32((UINTN)&UsbDebugPortRegister->ControlStatus) & (USB_DEBUG_PORT_OWNER | USB_DEBUG_PORT_IN_USE))\r
        != (USB_DEBUG_PORT_OWNER | USB_DEBUG_PORT_IN_USE)) || (Handle->Initialized == USBDBG_RESET)) {\r
+    DEBUG ((\r
+      EFI_D_INFO,\r
+      "UsbDbg: Need to reset the host controller. ControlStatus = %08x\n",\r
+      MmioRead32((UINTN)&UsbDebugPortRegister->ControlStatus)\r
+      ));\r
     //\r
     // If the host controller is halted, then reset and restart it.\r
     //\r
     if ((MmioRead32((UINTN)UsbStatus) & BIT12) != 0) {\r
+      DEBUG ((EFI_D_INFO, "UsbDbg: Reset the host controller.\n"));\r
       //\r
       // reset the host controller.\r
       //\r
@@ -712,7 +718,9 @@ InitializeUsbDebugHardware (
     return RETURN_NOT_FOUND;\r
   }\r
 \r
-  if (Handle->Initialized != USBDBG_INIT_DONE) {\r
+  if (Handle->Initialized != USBDBG_INIT_DONE ||\r
+      (MmioRead32 ((UINTN) &UsbDebugPortRegister->ControlStatus) & USB_DEBUG_PORT_ENABLE) == 0) {\r
+    DEBUG ((EFI_D_INFO, "UsbDbg: Reset the debug port.\n"));\r
     //\r
     // Reset the debug port\r
     //\r