X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FEhciDxe%2FEhciSched.c;h=58d4a303dc78265906e76cccf12c4ffa7b5b8bce;hb=8776881fe8fc4d810be60a3bb76674cb43a1d402;hp=349b5c233a955d838cf29bc56328505fef341168;hpb=41e8ff2781f3ca14f73ef5f39e781ccba8cb373d;p=mirror_edk2.git diff --git a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c index 349b5c233a..58d4a303dc 100644 --- a/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c +++ b/MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.c @@ -1,6 +1,8 @@ /** @file -Copyright (c) 2007, Intel Corporation + EHCI transfer scheduling routines. + +Copyright (c) 2007 - 2010, 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 @@ -9,31 +11,20 @@ http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - - EhciSched.c - -Abstract: - - EHCI transfer scheduling routines - -Revision History - **/ #include "Ehci.h" /** - Create helper QTD/QH for the EHCI device + Create helper QTD/QH for the EHCI device. - @param Ehc The EHCI device + @param Ehc The EHCI device. - @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for helper QTD/QH - @retval EFI_SUCCESS Helper QH/QTD are created + @retval EFI_OUT_OF_RESOURCES Failed to allocate resource for helper QTD/QH. + @retval EFI_SUCCESS Helper QH/QTD are created. **/ -STATIC EFI_STATUS EhcCreateHelpQ ( IN USB2_HC_DEV *Ehc @@ -43,11 +34,12 @@ EhcCreateHelpQ ( EHC_QH *Qh; QH_HW *QhHw; EHC_QTD *Qtd; + EFI_PHYSICAL_ADDRESS PciAddr; // // Create an inactive Qtd to terminate the short packet read. // - Qtd = EhcCreateQtd (Ehc, NULL, 0, QTD_PID_INPUT, 0, 64); + Qtd = EhcCreateQtd (Ehc, NULL, NULL, 0, QTD_PID_INPUT, 0, 64); if (Qtd == NULL) { return EFI_OUT_OF_RESOURCES; @@ -77,10 +69,12 @@ EhcCreateHelpQ ( return EFI_OUT_OF_RESOURCES; } + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Qh, sizeof (EHC_QH)); QhHw = &Qh->QhHw; - QhHw->HorizonLink = QH_LINK (QhHw, EHC_TYPE_QH, FALSE); + QhHw->HorizonLink = QH_LINK (PciAddr + OFFSET_OF(EHC_QH, QhHw), EHC_TYPE_QH, FALSE); QhHw->Status = QTD_STAT_HALTED; QhHw->ReclaimHead = 1; + Qh->NextQh = Qh; Ehc->ReclaimHead = Qh; // @@ -102,14 +96,13 @@ EhcCreateHelpQ ( } - /** - Initialize the schedule data structure such as frame list + Initialize the schedule data structure such as frame list. - @param Ehc The EHCI device to init schedule data for + @param Ehc The EHCI device to init schedule data. - @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data - @retval EFI_SUCCESS The schedule data is initialized + @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data. + @retval EFI_SUCCESS The schedule data is initialized. **/ EFI_STATUS @@ -124,8 +117,8 @@ EhcInitSched ( UINTN Pages; UINTN Bytes; UINTN Index; - UINT32 *Desc; EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS PciAddr; // // First initialize the periodical schedule data: @@ -166,10 +159,17 @@ EhcInitSched ( return EFI_OUT_OF_RESOURCES; } - Ehc->PeriodFrameHost = Buf; - Ehc->PeriodFrame = (VOID *) ((UINTN) PhyAddr); + Ehc->PeriodFrame = Buf; Ehc->PeriodFrameMap = Map; - Ehc->High32bitAddr = EHC_HIGH_32BIT (PhyAddr); + + // + // Program the FRAMELISTBASE register with the low 32 bit addr + // + EhcWriteOpReg (Ehc, EHC_FRAME_BASE_OFFSET, EHC_LOW_32BIT (PhyAddr)); + // + // Program the CTRLDSSEGMENT register with the high 32 bit addr + // + EhcWriteOpReg (Ehc, EHC_CTRLDSSEG_OFFSET, EHC_HIGH_32BIT (PhyAddr)); // // Init memory pool management then create the helper @@ -179,47 +179,79 @@ EhcInitSched ( Ehc->MemPool = UsbHcInitMemPool ( PciIo, EHC_BIT_IS_SET (Ehc->HcCapParams, HCCP_64BIT), - Ehc->High32bitAddr + EHC_HIGH_32BIT (PhyAddr) ); if (Ehc->MemPool == NULL) { - return EFI_OUT_OF_RESOURCES; + Status = EFI_OUT_OF_RESOURCES; + goto ErrorExit1; } Status = EhcCreateHelpQ (Ehc); if (EFI_ERROR (Status)) { - return Status; + goto ErrorExit; } // // Initialize the frame list entries then set the registers // - Desc = (UINT32 *) Ehc->PeriodFrame; + Ehc->PeriodFrameHost = AllocateZeroPool (EHC_FRAME_LEN * sizeof (UINTN)); + if (Ehc->PeriodFrameHost == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto ErrorExit; + } + + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Ehc->PeriodOne, sizeof (EHC_QH)); for (Index = 0; Index < EHC_FRAME_LEN; Index++) { - Desc[Index] = QH_LINK (Ehc->PeriodOne, EHC_TYPE_QH, FALSE); + // + // Store the pci bus address of the QH in period frame list which will be accessed by pci bus master. + // + ((UINT32 *)(Ehc->PeriodFrame))[Index] = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); + // + // Store the host address of the QH in period frame list which will be accessed by host. + // + ((UINTN *)(Ehc->PeriodFrameHost))[Index] = (UINTN)Ehc->PeriodOne; } - EhcWriteOpReg (Ehc, EHC_FRAME_BASE_OFFSET, EHC_LOW_32BIT (Ehc->PeriodFrame)); - // // Second initialize the asynchronous schedule: // Only need to set the AsynListAddr register to // the reclamation header // - EhcWriteOpReg (Ehc, EHC_ASYNC_HEAD_OFFSET, EHC_LOW_32BIT (Ehc->ReclaimHead)); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Ehc->ReclaimHead, sizeof (EHC_QH)); + EhcWriteOpReg (Ehc, EHC_ASYNC_HEAD_OFFSET, EHC_LOW_32BIT (PciAddr)); return EFI_SUCCESS; -} +ErrorExit: + if (Ehc->PeriodOne != NULL) { + UsbHcFreeMem (Ehc->MemPool, Ehc->PeriodOne, sizeof (EHC_QH)); + Ehc->PeriodOne = NULL; + } + + if (Ehc->ReclaimHead != NULL) { + UsbHcFreeMem (Ehc->MemPool, Ehc->ReclaimHead, sizeof (EHC_QH)); + Ehc->ReclaimHead = NULL; + } + + if (Ehc->ShortReadStop != NULL) { + UsbHcFreeMem (Ehc->MemPool, Ehc->ShortReadStop, sizeof (EHC_QTD)); + Ehc->ShortReadStop = NULL; + } + +ErrorExit1: + PciIo->FreeBuffer (PciIo, Pages, Buf); + PciIo->Unmap (PciIo, Map); + + return Status; +} /** Free the schedule data. It may be partially initialized. - @param Ehc The EHCI device - - @return None + @param Ehc The EHCI device. **/ VOID @@ -261,13 +293,17 @@ EhcFreeSched ( PciIo->FreeBuffer ( PciIo, EFI_SIZE_TO_PAGES (EFI_PAGE_SIZE), - Ehc->PeriodFrameHost + Ehc->PeriodFrame ); Ehc->PeriodFrame = NULL; } -} + if (Ehc->PeriodFrameHost != NULL) { + FreePool (Ehc->PeriodFrameHost); + Ehc->PeriodFrameHost = NULL; + } +} /** @@ -277,10 +313,8 @@ EhcFreeSched ( management: A reclamation header is always linked to the AsyncListAddr, the only active QH is appended to it. - @param Ehc The EHCI device - @param Qh The queue head to link - - @return None + @param Ehc The EHCI device. + @param Qh The queue head to link. **/ VOID @@ -290,6 +324,7 @@ EhcLinkQhToAsync ( ) { EHC_QH *Head; + EFI_PHYSICAL_ADDRESS PciAddr; // // Append the queue head after the reclaim header, then @@ -301,19 +336,19 @@ EhcLinkQhToAsync ( Qh->NextQh = Head->NextQh; Head->NextQh = Qh; - Qh->QhHw.HorizonLink = QH_LINK (Head, EHC_TYPE_QH, FALSE);; - Head->QhHw.HorizonLink = QH_LINK (Qh, EHC_TYPE_QH, FALSE); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Qh->NextQh, sizeof (EHC_QH)); + Qh->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Head->NextQh, sizeof (EHC_QH)); + Head->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); } /** Unlink a queue head from the asynchronous schedule list. - Need to synchronize with hardware - - @param Ehc The EHCI device - @param Qh The queue head to unlink + Need to synchronize with hardware. - @return None + @param Ehc The EHCI device. + @param Qh The queue head to unlink. **/ VOID @@ -324,6 +359,7 @@ EhcUnlinkQhFromAsync ( { EHC_QH *Head; EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS PciAddr; ASSERT (Ehc->ReclaimHead->NextQh == Qh); @@ -337,7 +373,8 @@ EhcUnlinkQhFromAsync ( Head->NextQh = Qh->NextQh; Qh->NextQh = NULL; - Head->QhHw.HorizonLink = QH_LINK (Head, EHC_TYPE_QH, FALSE); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Head->NextQh, sizeof (EHC_QH)); + Head->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); // // Set and wait the door bell to synchronize with the hardware @@ -345,7 +382,7 @@ EhcUnlinkQhFromAsync ( Status = EhcSetAndWaitDoorBell (Ehc, EHC_GENERIC_TIMEOUT); if (EFI_ERROR (Status)) { - EHC_ERROR (("EhcUnlinkQhFromAsync: Failed to synchronize with doorbell\n")); + DEBUG ((EFI_D_ERROR, "EhcUnlinkQhFromAsync: Failed to synchronize with doorbell\n")); } } @@ -355,10 +392,8 @@ EhcUnlinkQhFromAsync ( schedule frame list. This code is very much the same as that in UHCI. - @param Ehc The EHCI device - @param Qh The queue head to link - - @return None + @param Ehc The EHCI device. + @param Qh The queue head to link. **/ VOID @@ -367,20 +402,18 @@ EhcLinkQhToPeriod ( IN EHC_QH *Qh ) { - UINT32 *Frames; UINTN Index; EHC_QH *Prev; EHC_QH *Next; - - Frames = Ehc->PeriodFrame; + EFI_PHYSICAL_ADDRESS PciAddr; for (Index = 0; Index < EHC_FRAME_LEN; Index += Qh->Interval) { // // First QH can't be NULL because we always keep PeriodOne // heads on the frame list // - ASSERT (!EHC_LINK_TERMINATED (Frames[Index])); - Next = EHC_ADDR (Ehc->High32bitAddr, Frames[Index]); + ASSERT (!EHC_LINK_TERMINATED (((UINT32*)Ehc->PeriodFrame)[Index])); + Next = (EHC_QH*)((UINTN*)Ehc->PeriodFrameHost)[Index]; Prev = NULL; // @@ -428,7 +461,8 @@ EhcLinkQhToPeriod ( Prev->NextQh = Qh; Qh->QhHw.HorizonLink = Prev->QhHw.HorizonLink; - Prev->QhHw.HorizonLink = QH_LINK (Qh, EHC_TYPE_QH, FALSE); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Qh, sizeof (EHC_QH)); + Prev->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); break; } @@ -439,14 +473,18 @@ EhcLinkQhToPeriod ( // if (Qh->NextQh == NULL) { Qh->NextQh = Next; - Qh->QhHw.HorizonLink = QH_LINK (Next, EHC_TYPE_QH, FALSE); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Next, sizeof (EHC_QH)); + Qh->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); } + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Qh, sizeof (EHC_QH)); + if (Prev == NULL) { - Frames[Index] = QH_LINK (Qh, EHC_TYPE_QH, FALSE); + ((UINT32*)Ehc->PeriodFrame)[Index] = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); + ((UINTN*)Ehc->PeriodFrameHost)[Index] = (UINTN)Qh; } else { Prev->NextQh = Qh; - Prev->QhHw.HorizonLink = QH_LINK (Qh, EHC_TYPE_QH, FALSE); + Prev->QhHw.HorizonLink = QH_LINK (PciAddr, EHC_TYPE_QH, FALSE); } } } @@ -454,12 +492,10 @@ EhcLinkQhToPeriod ( /** Unlink an interrupt queue head from the periodic - schedule frame list + schedule frame list. - @param Ehc The EHCI device - @param Qh The queue head to unlink - - @return None + @param Ehc The EHCI device. + @param Qh The queue head to unlink. **/ VOID @@ -468,20 +504,17 @@ EhcUnlinkQhFromPeriod ( IN EHC_QH *Qh ) { - UINT32 *Frames; UINTN Index; EHC_QH *Prev; EHC_QH *This; - Frames = Ehc->PeriodFrame; - for (Index = 0; Index < EHC_FRAME_LEN; Index += Qh->Interval) { // // Frame link can't be NULL because we always keep PeroidOne // on the frame list // - ASSERT (!EHC_LINK_TERMINATED (Frames[Index])); - This = EHC_ADDR (Ehc->High32bitAddr, Frames[Index]); + ASSERT (!EHC_LINK_TERMINATED (((UINT32*)Ehc->PeriodFrame)[Index])); + This = (EHC_QH*)((UINTN*)Ehc->PeriodFrameHost)[Index]; Prev = NULL; // @@ -505,7 +538,8 @@ EhcUnlinkQhFromPeriod ( // // Qh is the first entry in the frame // - Frames[Index] = Qh->QhHw.HorizonLink; + ((UINT32*)Ehc->PeriodFrame)[Index] = Qh->QhHw.HorizonLink; + ((UINTN*)Ehc->PeriodFrameHost)[Index] = (UINTN)Qh->NextQh; } else { Prev->NextQh = Qh->NextQh; Prev->QhHw.HorizonLink = Qh->QhHw.HorizonLink; @@ -514,18 +548,16 @@ EhcUnlinkQhFromPeriod ( } - /** Check the URB's execution result and update the URB's result accordingly. - @param Ehc The EHCI device - @param Urb The URB to check result + @param Ehc The EHCI device. + @param Urb The URB to check result. @return Whether the result of URB transfer is finialized. **/ -STATIC BOOLEAN EhcCheckUrbResult ( IN USB2_HC_DEV *Ehc, @@ -537,6 +569,7 @@ EhcCheckUrbResult ( QTD_HW *QtdHw; UINT8 State; BOOLEAN Finished; + EFI_PHYSICAL_ADDRESS PciAddr; ASSERT ((Ehc != NULL) && (Urb != NULL) && (Urb->Qh != NULL)); @@ -598,7 +631,7 @@ EhcCheckUrbResult ( } if ((QtdHw->TotalBytes != 0) && (QtdHw->Pid == QTD_PID_INPUT)) { - EHC_DUMP_QH ((Urb->Qh, "Short packet read", FALSE)); + EhcDumpQh (Urb->Qh, "Short packet read", FALSE); // // Short packet read condition. If it isn't a setup transfer, @@ -606,14 +639,15 @@ EhcCheckUrbResult ( // ShortReadStop. If it is a setup transfer, need to check the // Status Stage of the setup transfer to get the finial result // - if (QtdHw->AltNext == QTD_LINK (Ehc->ShortReadStop, FALSE)) { - EHC_DEBUG (("EhcCheckUrbResult: Short packet read, break\n")); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, Ehc->ShortReadStop, sizeof (EHC_QTD)); + if (QtdHw->AltNext == QTD_LINK (PciAddr, FALSE)) { + DEBUG ((EFI_D_INFO, "EhcCheckUrbResult: Short packet read, break\n")); Finished = TRUE; goto ON_EXIT; } - EHC_DEBUG (("EhcCheckUrbResult: Short packet read, continue\n")); + DEBUG ((EFI_D_INFO, "EhcCheckUrbResult: Short packet read, continue\n")); } } } @@ -637,13 +671,13 @@ ON_EXIT: /** Execute the transfer by polling the URB. This is a synchronous operation. - @param Ehc The EHCI device - @param Urb The URB to execute - @param TimeOut The time to wait before abort, in millisecond. + @param Ehc The EHCI device. + @param Urb The URB to execute. + @param TimeOut The time to wait before abort, in millisecond. - @return EFI_DEVICE_ERROR : The transfer failed due to transfer error - @return EFI_TIMEOUT : The transfer failed due to time out - @return EFI_SUCCESS : The transfer finished OK + @return EFI_DEVICE_ERROR The transfer failed due to transfer error. + @return EFI_TIMEOUT The transfer failed due to time out. + @return EFI_SUCCESS The transfer finished OK. **/ EFI_STATUS @@ -673,14 +707,14 @@ EhcExecTransfer ( } if (!Finished) { - EHC_ERROR (("EhcExecTransfer: transfer not finished in %dms\n", TimeOut)); - EHC_DUMP_QH ((Urb->Qh, NULL, FALSE)); + DEBUG ((EFI_D_ERROR, "EhcExecTransfer: transfer not finished in %dms\n", (UINT32)TimeOut)); + EhcDumpQh (Urb->Qh, NULL, FALSE); Status = EFI_TIMEOUT; } else if (Urb->Result != EFI_USB_NOERROR) { - EHC_ERROR (("EhcExecTransfer: transfer failed with %x\n", Urb->Result)); - EHC_DUMP_QH ((Urb->Qh, NULL, FALSE)); + DEBUG ((EFI_D_ERROR, "EhcExecTransfer: transfer failed with %x\n", Urb->Result)); + EhcDumpQh (Urb->Qh, NULL, FALSE); Status = EFI_DEVICE_ERROR; } @@ -691,15 +725,15 @@ EhcExecTransfer ( /** Delete a single asynchronous interrupt transfer for - the device and endpoint + the device and endpoint. - @param Ehc The EHCI device - @param DevAddr The address of the target device - @param EpNum The endpoint of the target - @param DataToggle Return the next data toggle to use + @param Ehc The EHCI device. + @param DevAddr The address of the target device. + @param EpNum The endpoint of the target. + @param DataToggle Return the next data toggle to use. - @retval EFI_SUCCESS An asynchronous transfer is removed - @retval EFI_NOT_FOUND No transfer for the device is found + @retval EFI_SUCCESS An asynchronous transfer is removed. + @retval EFI_NOT_FOUND No transfer for the device is found. **/ EFI_STATUS @@ -715,7 +749,7 @@ EhciDelAsyncIntTransfer ( URB *Urb; EFI_USB_DATA_DIRECTION Direction; - Direction = ((EpNum & 0x80) ? EfiUsbDataIn : EfiUsbDataOut); + Direction = (((EpNum & 0x80) != 0) ? EfiUsbDataIn : EfiUsbDataOut); EpNum &= 0x0F; EFI_LIST_FOR_EACH_SAFE (Entry, Next, &Ehc->AsyncIntTransfers) { @@ -744,11 +778,9 @@ EhciDelAsyncIntTransfer ( /** - Remove all the asynchronous interrutp transfers - - @param Ehc The EHCI device + Remove all the asynchronous interrutp transfers. - @return None + @param Ehc The EHCI device. **/ VOID @@ -771,30 +803,23 @@ EhciDelAllAsyncIntTransfers ( } } -STATIC -EFI_STATUS -EhcFlushAsyncIntMap ( - IN USB2_HC_DEV *Ehc, - IN URB *Urb - ) -/*++ - -Routine Description: - Flush data from PCI controller specific address to mapped system +/** + Flush data from PCI controller specific address to mapped system memory address. -Arguments: + @param Ehc The EHCI device. + @param Urb The URB to unmap. - Ehc - The EHCI device - Urb - The URB to unmap - -Returns: + @retval EFI_SUCCESS Success to flush data to mapped system memory. + @retval EFI_DEVICE_ERROR Fail to flush data to mapped system memory. - EFI_SUCCESS - Success to flush data to mapped system memory - EFI_DEVICE_ERROR - Fail to flush data to mapped system memory - ---*/ +**/ +EFI_STATUS +EhcFlushAsyncIntMap ( + IN USB2_HC_DEV *Ehc, + IN URB *Urb + ) { EFI_STATUS Status; EFI_PHYSICAL_ADDRESS PhyAddr; @@ -811,7 +836,7 @@ Returns: } else { MapOp = EfiPciIoOperationBusMasterRead; } - + Status = PciIo->Unmap (PciIo, Urb->DataMap); if (EFI_ERROR (Status)) { goto ON_ERROR; @@ -833,18 +858,16 @@ ON_ERROR: } - /** - Update the queue head for next round of asynchronous transfer + Update the queue head for next round of asynchronous transfer. - @param Urb The URB to update - - @return None + @param Ehc The EHCI device. + @param Urb The URB to update. **/ -STATIC VOID EhcUpdateAsyncRequest ( + IN USB2_HC_DEV *Ehc, IN URB *Urb ) { @@ -854,6 +877,7 @@ EhcUpdateAsyncRequest ( EHC_QTD *Qtd; QTD_HW *QtdHw; UINTN Index; + EFI_PHYSICAL_ADDRESS PciAddr; Qtd = NULL; @@ -897,7 +921,7 @@ EhcUpdateAsyncRequest ( QhHw->Pid = 0; QhHw->ErrCnt = 0; QhHw->CurPage = 0; - QhHw->IOC = 0; + QhHw->Ioc = 0; QhHw->TotalBytes = 0; for (Index = 0; Index < 5; Index++) { @@ -905,7 +929,8 @@ EhcUpdateAsyncRequest ( QhHw->PageHigh[Index] = 0; } - QhHw->NextQtd = QTD_LINK (FirstQtd, FALSE); + PciAddr = UsbHcGetPciAddressForHostMem (Ehc->MemPool, FirstQtd, sizeof (EHC_QTD)); + QhHw->NextQtd = QTD_LINK (PciAddr, FALSE); } return ; @@ -913,16 +938,15 @@ EhcUpdateAsyncRequest ( /** - Interrupt transfer periodic check handler + Interrupt transfer periodic check handler. - @param Event Interrupt event - @param Context Pointer to USB2_HC_DEV - - @return None + @param Event Interrupt event. + @param Context Pointer to USB2_HC_DEV. **/ VOID -EhcMoniteAsyncRequests ( +EFIAPI +EhcMonitorAsyncRequests ( IN EFI_EVENT Event, IN VOID *Context ) @@ -953,14 +977,14 @@ EhcMoniteAsyncRequests ( } // - // Flush any PCI posted write transactions from a PCI host + // Flush any PCI posted write transactions from a PCI host // bridge to system memory. // Status = EhcFlushAsyncIntMap (Ehc, Urb); if (EFI_ERROR (Status)) { - EHC_ERROR (("EhcMoniteAsyncRequests: Fail to Flush AsyncInt Mapped Memeory\n")); + DEBUG ((EFI_D_ERROR, "EhcMonitorAsyncRequests: Fail to Flush AsyncInt Mapped Memeory\n")); } - + // // Allocate a buffer then copy the transferred data for user. // If failed to allocate the buffer, update the URB for next @@ -974,14 +998,14 @@ EhcMoniteAsyncRequests ( ProcBuf = AllocatePool (Urb->Completed); if (ProcBuf == NULL) { - EhcUpdateAsyncRequest (Urb); + EhcUpdateAsyncRequest (Ehc, Urb); continue; } CopyMem (ProcBuf, Urb->Data, Urb->Completed); } - EhcUpdateAsyncRequest (Urb); + EhcUpdateAsyncRequest (Ehc, Urb); // // Leave error recovery to its related device driver. A @@ -1004,7 +1028,7 @@ EhcMoniteAsyncRequests ( } if (ProcBuf != NULL) { - gBS->FreePool (ProcBuf); + FreePool (ProcBuf); } }