From 16d718a55b65b1f51d450226879c48f709e5a791 Mon Sep 17 00:00:00 2001 From: erictian Date: Wed, 7 Mar 2012 08:39:35 +0000 Subject: =?UTF-8?q?MdeModulePkg:=20add=20support=20for=20ORICO=20PEUS3-2P?= =?UTF-8?q?=20card=201)=20Fix=20a=20bug=20on=20missing=20hub=20context=20e?= =?UTF-8?q?valuation=20operation.=202)=20If=20the=20usb=20keyboard=20devic?= =?UTF-8?q?e=20configuration=20has=20been=20set=20successfully,=20then=20d?= =?UTF-8?q?on=E2=80=99t=20set=20configuration=20again.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: erictian Reviewed-by: li-elvin git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13087 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 28 ++++++++++++++++------------ MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 6 +++--- 2 files changed, 19 insertions(+), 15 deletions(-) (limited to 'MdeModulePkg/Bus/Pci') diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 8cbb7bab07..0c08301e9b 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -1,7 +1,7 @@ /** @file The XHCI controller driver. -Copyright (c) 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -873,10 +873,12 @@ XhcControlTransfer ( if (*TransferResult == EFI_USB_NOERROR) { Status = EFI_SUCCESS; - } else if ((*TransferResult == EFI_USB_ERR_STALL) || - (*TransferResult == EFI_USB_ERR_TIMEOUT)) { + } else if (*TransferResult == EFI_USB_ERR_STALL) { RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb); ASSERT_EFI_ERROR (RecoveryStatus); + Status = EFI_DEVICE_ERROR; + goto FREE_URB; + } else { goto FREE_URB; } @@ -886,7 +888,8 @@ XhcControlTransfer ( // Hook Set_Config request from UsbBus as we need configure device endpoint. // if ((Request->Request == USB_REQ_GET_DESCRIPTOR) && - (Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE))) { + ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)) || + ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_DEVICE))))) { DescriptorType = (UINT8)(Request->Value >> 8); if ((DescriptorType == USB_DESC_TYPE_DEVICE) && (*DataLength == sizeof (EFI_USB_DEVICE_DESCRIPTOR))) { ASSERT (Data != NULL); @@ -920,10 +923,11 @@ XhcControlTransfer ( Xhc->UsbDevContext[SlotId].ConfDesc[Index] = AllocateZeroPool(*DataLength); CopyMem (Xhc->UsbDevContext[SlotId].ConfDesc[Index], Data, *DataLength); } - } else if ((DescriptorType == USB_DESC_TYPE_HUB) || - (DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) { + } else if (((DescriptorType == USB_DESC_TYPE_HUB) || + (DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) && (*DataLength > 2)) { ASSERT (Data != NULL); HubDesc = (EFI_USB_HUB_DESCRIPTOR *)Data; + ASSERT (HubDesc->NumPorts <= 15); // // The bit 5,6 of HubCharacter field of Hub Descriptor is TTT. // @@ -932,8 +936,8 @@ XhcControlTransfer ( // // Don't support multi-TT feature for super speed hub now. // - MTT = 1; - ASSERT (FALSE); + MTT = 0; + DEBUG ((EFI_D_ERROR, "XHCI: Don't support multi-TT feature for Hub now. (force to disable MTT)\n")); } else { MTT = 0; } @@ -1152,10 +1156,10 @@ XhcBulkTransfer ( if (*TransferResult == EFI_USB_NOERROR) { Status = EFI_SUCCESS; - } else if ((*TransferResult == EFI_USB_ERR_STALL) || - (*TransferResult == EFI_USB_ERR_TIMEOUT)) { + } else if (*TransferResult == EFI_USB_ERR_STALL) { RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb); ASSERT_EFI_ERROR (RecoveryStatus); + Status = EFI_DEVICE_ERROR; } FreePool (Urb); @@ -1451,10 +1455,10 @@ XhcSyncInterruptTransfer ( if (*TransferResult == EFI_USB_NOERROR) { Status = EFI_SUCCESS; - } else if ((*TransferResult == EFI_USB_ERR_STALL) || - (*TransferResult == EFI_USB_ERR_TIMEOUT)) { + } else if (*TransferResult == EFI_USB_ERR_STALL) { RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb); ASSERT_EFI_ERROR (RecoveryStatus); + Status = EFI_DEVICE_ERROR; } FreePool (Urb); diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 6d4044a09b..372702d3f0 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -2,7 +2,7 @@ XHCI transfer scheduling routines. -Copyright (c) 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1489,8 +1489,8 @@ XhcSyncEventRing ( // Some 3rd party XHCI external cards don't support single 64-bytes width register access, // So divide it to two 32-bytes width register access. // - XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET, Low | BIT3); - XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET + 4, High); + XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET, XHC_LOW_32BIT (EvtRing->EventRingDequeue) | BIT3); + XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET + 4, XHC_HIGH_32BIT (EvtRing->EventRingDequeue)); } return EFI_SUCCESS; -- cgit v1.2.3