]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/UhciDxe/UhciQueue.c
Fix a bug that usb keybarod can not work well when it is inserted at a usb 2.0 hub.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / UhciQueue.c
index a816956bbedf6fe7cd7ec91d3806777bc9ce6dd7..39dbe4ceb7c535756c5a3b40c284f1a760dd8006 100644 (file)
@@ -2,7 +2,7 @@
 \r
   The UHCI register operation routines.\r
 \r
-Copyright (c) 2007 - 2008, Intel Corporation\r
+Copyright (c) 2007 - 2010, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -164,22 +164,11 @@ UhciLinkTdToQh (
   IN UHCI_TD_SW           *Td\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  UINTN                 Len;\r
   EFI_PHYSICAL_ADDRESS  PhyAddr;\r
-  VOID*                 Map;\r
 \r
-  Len    = sizeof (UHCI_TD_HW);\r
-  Status = Uhc->PciIo->Map (\r
-                         Uhc->PciIo,\r
-                         EfiPciIoOperationBusMasterRead,\r
-                         Td,\r
-                         &Len,\r
-                         &PhyAddr,\r
-                         &Map\r
-                         );\r
+  PhyAddr = UsbHcGetPciAddressForHostMem (Uhc->MemPool, Td, sizeof (UHCI_TD_HW));\r
 \r
-  ASSERT (!EFI_ERROR (Status) && (Qh != NULL) && (Td != NULL));\r
+  ASSERT ((Qh != NULL) && (Td != NULL));\r
 \r
   Qh->QhHw.VerticalLink = QH_VLINK (PhyAddr, FALSE);\r
   Qh->TDs               = (VOID *) Td;\r
@@ -221,22 +210,11 @@ UhciAppendTd (
   IN UHCI_TD_SW     *ThisTd\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  UINTN                 Len;\r
   EFI_PHYSICAL_ADDRESS  PhyAddr;\r
-  VOID*                 Map;\r
 \r
-  Len    = sizeof (UHCI_TD_HW);\r
-  Status = Uhc->PciIo->Map (\r
-                         Uhc->PciIo,\r
-                         EfiPciIoOperationBusMasterRead,\r
-                         ThisTd,\r
-                         &Len,\r
-                         &PhyAddr,\r
-                         &Map\r
-                         );\r
+  PhyAddr = UsbHcGetPciAddressForHostMem (Uhc->MemPool, ThisTd, sizeof (UHCI_TD_HW));\r
 \r
-  ASSERT (!EFI_ERROR (Status) && (PrevTd != NULL) && (ThisTd != NULL));\r
+  ASSERT ((PrevTd != NULL) && (ThisTd != NULL));\r
 \r
   PrevTd->TdHw.NextLink = TD_LINK (PhyAddr, TRUE, FALSE);\r
   PrevTd->NextTd        = (VOID *) ThisTd;\r
@@ -324,6 +302,7 @@ UhciCreateTd (
     return NULL;\r
   }\r
 \r
+  Td->TdHw.NextLink = TD_LINK (NULL, FALSE, TRUE);\r
   Td->NextTd        = NULL;\r
   Td->Data          = NULL;\r
   Td->DataLen       = 0;\r
@@ -428,7 +407,7 @@ UhciCreateDataTd (
   Td->TdHw.ShortPacket  = FALSE;\r
   Td->TdHw.IsIsoch      = FALSE;\r
   Td->TdHw.IntOnCpl     = FALSE;\r
-  Td->TdHw.ErrorCount   = 0X03;\r
+  Td->TdHw.ErrorCount   = 0x03;\r
   Td->TdHw.Status       = USBTD_ACTIVE;\r
   Td->TdHw.LowSpeed     = IsLow ? 1 : 0;\r
   Td->TdHw.DataToggle   = Toggle & 0x01;\r