Enhance DebugCommunicationLibUsb to reset the debug port when the PORT_ENABLE bit is not set.

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
This commit is contained in:
niruiyu 2013-04-18 05:56:04 +00:00
parent dca18202a1
commit 93723244c8
1 changed files with 9 additions and 1 deletions

View File

@ -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
//