From aa91de055c5e15a716f3a0ce6bf5a1c28fda9e56 Mon Sep 17 00:00:00 2001 From: erictian Date: Fri, 19 Mar 2010 06:54:35 +0000 Subject: Fix a bug that usb keybarod can not work well when it is inserted at a usb 2.0 hub. It's due to AsyncInterruptList does not update the corresponding QTDHw->Data with pci bus master address. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10286 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c | 38 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 27 deletions(-) (limited to 'MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c') diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c index c2d560b48c..bc7cfb9c90 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c @@ -949,7 +949,6 @@ Uhci2AsyncInterruptTransfer ( EFI_STATUS Status; UINT8 *DataPtr; UINT8 *DataPhy; - VOID *DataMap; UINT8 PktId; Uhc = UHC_FROM_USB2_HC_PROTO (This); @@ -957,7 +956,6 @@ Uhci2AsyncInterruptTransfer ( IntTds = NULL; DataPtr = NULL; DataPhy = NULL; - DataMap = NULL; IsSlowDevice = (BOOLEAN) ((EFI_USB_SPEED_LOW == DeviceSpeed) ? TRUE : FALSE); @@ -998,40 +996,30 @@ Uhci2AsyncInterruptTransfer ( return EFI_DEVICE_ERROR; } + if ((EndPointAddress & 0x80) == 0) { + PktId = OUTPUT_PACKET_ID; + } else { + PktId = INPUT_PACKET_ID; + } + // // Allocate and map source data buffer for bus master access. // - DataPtr = UsbHcAllocateMem (Uhc->MemPool, DataLength); + DataPtr = UsbHcAllocateMem (Uhc->MemPool, DataLength); if (DataPtr == NULL) { return EFI_OUT_OF_RESOURCES; } - OldTpl = gBS->RaiseTPL (UHCI_TPL); - - // - // Map the user data then create a queue head and - // list of TD for it. - // - Status = UhciMapUserData ( - Uhc, - EfiUsbDataIn, - DataPtr, - &DataLength, - &PktId, - &DataPhy, - &DataMap - ); + DataPhy = (UINT8 *)UsbHcGetPciAddressForHostMem (Uhc->MemPool, DataPtr, DataLength); - if (EFI_ERROR (Status)) { - goto FREE_DATA; - } + OldTpl = gBS->RaiseTPL (UHCI_TPL); Qh = UhciCreateQh (Uhc, PollingInterval); if (Qh == NULL) { Status = EFI_OUT_OF_RESOURCES; - goto UNMAP_DATA; + goto FREE_DATA; } IntTds = UhciCreateBulkOrIntTds ( @@ -1066,7 +1054,6 @@ Uhci2AsyncInterruptTransfer ( EndPointAddress, DataLength, PollingInterval, - DataMap, DataPtr, CallBackFunction, Context, @@ -1085,11 +1072,8 @@ Uhci2AsyncInterruptTransfer ( DESTORY_QH: UsbHcFreeMem (Uhc->MemPool, Qh, sizeof (UHCI_QH_SW)); -UNMAP_DATA: - Uhc->PciIo->Unmap (Uhc->PciIo, DataMap); - FREE_DATA: - gBS->FreePool (DataPtr); + UsbHcFreeMem (Uhc->MemPool, DataPtr, DataLength); Uhc->PciIo->Flush (Uhc->PciIo); gBS->RestoreTPL (OldTpl); -- cgit v1.2.3