This file contains URB request, each request is warpped in a\r
URB (Usb Request Block).\r
\r
-Copyright (c) 2007, 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
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
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
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
// 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
\r
Len += ThisBufLen;\r
Data += ThisBufLen;\r
+ DataPhy += ThisBufLen;\r
}\r
\r
//\r
@param Ep The queue head's related endpoint.\r
@param QhHw The queue head to initialize.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
EhcInitIntQh (\r
@param Ehc The EHCI device.\r
@param Qtds The list head of the QTD.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
EhcFreeQtds (\r
@param Ehc The EHCI device.\r
@param Urb The URB to free.\r
\r
- @return None.\r
-\r
**/\r
VOID\r
EhcFreeUrb (\r
UINT8 Toggle;\r
UINTN Len;\r
UINT8 Pid;\r
+ EFI_PHYSICAL_ADDRESS PhyAddr;\r
\r
ASSERT ((Urb != NULL) && (Urb->Qh != NULL));\r
\r
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
//\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
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
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
}\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