]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/EhciDxe/EhciUrb.c
Update the copyright notice format
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / EhciUrb.c
index 6d1bf9b3367e2e8351af4e819fd3cd89ef2e0fca..6afb327df165aa81cf559a903a090391fa9e82bf 100644 (file)
@@ -3,8 +3,8 @@
     This file contains URB request, each request is warpped in a\r
     URB (Usb Request Block).\r
 \r
-Copyright (c) 2007 - 2009, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+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
 http://opensource.org/licenses/bsd-license.php\r
@@ -21,7 +21,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   Create a single QTD to hold the data.\r
 \r
   @param  Ehc                   The EHCI device.\r
-  @param  Data                  Current data not associated with a QTD.\r
+  @param  Data                  The cpu memory address of current data not associated with a QTD.\r
+  @param  DataPhy               The pci bus address of current data not associated with a QTD.\r
   @param  DataLen               The length of the data.\r
   @param  PktId                 Packet ID to use in the QTD.\r
   @param  Toggle                Data toggle to use in the QTD.\r
@@ -34,6 +35,7 @@ EHC_QTD *
 EhcCreateQtd (\r
   IN USB2_HC_DEV          *Ehc,\r
   IN UINT8                *Data,\r
+  IN UINT8                *DataPhy,\r
   IN UINTN                DataLen,\r
   IN UINT8                PktId,\r
   IN UINT8                Toggle,\r
@@ -66,7 +68,7 @@ EhcCreateQtd (
   QtdHw->Status     = QTD_STAT_ACTIVE;\r
   QtdHw->Pid        = PktId;\r
   QtdHw->ErrCnt     = QTD_MAX_ERR;\r
-  QtdHw->IOC        = 0;\r
+  QtdHw->Ioc        = 0;\r
   QtdHw->TotalBytes = 0;\r
   QtdHw->DataToggle = Toggle;\r
 \r
@@ -82,10 +84,10 @@ EhcCreateQtd (
       // compute the offset and clear Reserved fields. This is already\r
       // done in the data point.\r
       //\r
-      QtdHw->Page[Index]      = EHC_LOW_32BIT (Data);\r
-      QtdHw->PageHigh[Index]  = EHC_HIGH_32BIT (Data);\r
+      QtdHw->Page[Index]      = EHC_LOW_32BIT (DataPhy);\r
+      QtdHw->PageHigh[Index]  = EHC_HIGH_32BIT (DataPhy);\r
 \r
-      ThisBufLen              = QTD_BUF_LEN - (EHC_LOW_32BIT (Data) & QTD_BUF_MASK);\r
+      ThisBufLen              = QTD_BUF_LEN - (EHC_LOW_32BIT (DataPhy) & QTD_BUF_MASK);\r
 \r
       if (Len + ThisBufLen >= DataLen) {\r
         Len = DataLen;\r
@@ -94,6 +96,7 @@ EhcCreateQtd (
 \r
       Len += ThisBufLen;\r
       Data += ThisBufLen;\r
+      DataPhy += ThisBufLen;\r
     }\r
 \r
     //\r
@@ -375,6 +378,7 @@ EhcCreateQtds (
   UINT8                   Toggle;\r
   UINTN                   Len;\r
   UINT8                   Pid;\r
+  EFI_PHYSICAL_ADDRESS    PhyAddr;\r
 \r
   ASSERT ((Urb != NULL) && (Urb->Qh != NULL));\r
 \r
@@ -390,8 +394,9 @@ EhcCreateQtds (
   StatusQtd = NULL;\r
   AlterNext = QTD_LINK (NULL, TRUE);\r
 \r
+  PhyAddr   = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Ehc->ShortReadStop, sizeof (EHC_QTD));\r
   if (Ep->Direction == EfiUsbDataIn) {\r
-    AlterNext = QTD_LINK (Ehc->ShortReadStop, FALSE);\r
+    AlterNext = QTD_LINK (PhyAddr, FALSE);\r
   }\r
 \r
   //\r
@@ -399,7 +404,7 @@ EhcCreateQtds (
   //\r
   if (Urb->Ep.Type == EHC_CTRL_TRANSFER) {\r
     Len = sizeof (EFI_USB_DEVICE_REQUEST);\r
-    Qtd = EhcCreateQtd (Ehc, Urb->RequestPhy, Len, QTD_PID_SETUP, 0, Ep->MaxPacket);\r
+    Qtd = EhcCreateQtd (Ehc, (UINT8 *)Urb->Request, (UINT8 *)Urb->RequestPhy, Len, QTD_PID_SETUP, 0, Ep->MaxPacket);\r
 \r
     if (Qtd == NULL) {\r
       return EFI_OUT_OF_RESOURCES;\r
@@ -419,14 +424,15 @@ EhcCreateQtds (
       Pid = QTD_PID_INPUT;\r
     }\r
 \r
-    StatusQtd = EhcCreateQtd (Ehc, NULL, 0, Pid, 1, Ep->MaxPacket);\r
+    StatusQtd = EhcCreateQtd (Ehc, NULL, NULL, 0, Pid, 1, Ep->MaxPacket);\r
 \r
     if (StatusQtd == NULL) {\r
       goto ON_ERROR;\r
     }\r
 \r
     if (Ep->Direction == EfiUsbDataIn) {\r
-      AlterNext = QTD_LINK (StatusQtd, FALSE);\r
+      PhyAddr   = UsbHcGetPciAddressForHostMem (Ehc->MemPool, StatusQtd, sizeof (EHC_QTD));\r
+      AlterNext = QTD_LINK (PhyAddr, FALSE);\r
     }\r
 \r
     Toggle = 1;\r
@@ -447,6 +453,7 @@ EhcCreateQtds (
   while (Len < Urb->DataLen) {\r
     Qtd = EhcCreateQtd (\r
             Ehc,\r
+            (UINT8 *) Urb->Data + Len,\r
             (UINT8 *) Urb->DataPhy + Len,\r
             Urb->DataLen - Len,\r
             Pid,\r
@@ -492,14 +499,16 @@ EhcCreateQtds (
     }\r
 \r
     NextQtd             = EFI_LIST_CONTAINER (Entry->ForwardLink, EHC_QTD, QtdList);\r
-    Qtd->QtdHw.NextQtd  = QTD_LINK (NextQtd, FALSE);\r
+    PhyAddr             = UsbHcGetPciAddressForHostMem (Ehc->MemPool, NextQtd, sizeof (EHC_QTD));\r
+    Qtd->QtdHw.NextQtd  = QTD_LINK (PhyAddr, FALSE);\r
   }\r
 \r
   //\r
   // Link the QTDs to the queue head\r
   //\r
   NextQtd           = EFI_LIST_CONTAINER (Qh->Qtds.ForwardLink, EHC_QTD, QtdList);\r
-  Qh->QhHw.NextQtd  = QTD_LINK (NextQtd, FALSE);\r
+  PhyAddr           = UsbHcGetPciAddressForHostMem (Ehc->MemPool, NextQtd, sizeof (EHC_QTD));\r
+  Qh->QhHw.NextQtd  = QTD_LINK (PhyAddr, FALSE);\r
   return EFI_SUCCESS;\r
 \r
 ON_ERROR:\r