TianoCore EDK2 master
Loading...
Searching...
No Matches
UhciSched.c File Reference
#include "Uhci.h"

Go to the source code of this file.

Functions

EFI_STATUS UhciInitFrameList (IN USB_HC_DEV *Uhc)
 
VOID UhciDestoryFrameList (IN USB_HC_DEV *Uhc)
 
UINTN UhciConvertPollRate (IN UINTN Interval)
 
VOID UhciLinkQhToFrameList (USB_HC_DEV *Uhc, UHCI_QH_SW *Qh)
 
VOID UhciUnlinkQhFromFrameList (USB_HC_DEV *Uhc, UHCI_QH_SW *Qh)
 
BOOLEAN UhciCheckTdStatus (IN USB_HC_DEV *Uhc, IN UHCI_TD_SW *Td, IN BOOLEAN IsLow, OUT UHCI_QH_RESULT *QhResult)
 
EFI_STATUS UhciExecuteTransfer (IN USB_HC_DEV *Uhc, IN UHCI_QH_SW *Qh, IN UHCI_TD_SW *Td, IN UINTN TimeOut, IN BOOLEAN IsLow, OUT UHCI_QH_RESULT *QhResult)
 
VOID UhciUpdateAsyncReq (IN USB_HC_DEV *Uhc, IN UHCI_ASYNC_REQUEST *AsyncReq, IN UINT32 Result, IN UINT32 NextToggle)
 
EFI_STATUS UhciCreateAsyncReq (IN USB_HC_DEV *Uhc, IN UHCI_QH_SW *Qh, IN UHCI_TD_SW *FirstTd, IN UINT8 DevAddr, IN UINT8 EndPoint, IN UINTN DataLen, IN UINTN Interval, IN UINT8 *Data, IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, IN VOID *Context, IN BOOLEAN IsLow)
 
VOID UhciFreeAsyncReq (IN USB_HC_DEV *Uhc, IN UHCI_ASYNC_REQUEST *AsyncReq)
 
VOID UhciUnlinkAsyncReq (IN USB_HC_DEV *Uhc, IN UHCI_ASYNC_REQUEST *AsyncReq, IN BOOLEAN FreeNow)
 
EFI_STATUS UhciRemoveAsyncReq (IN USB_HC_DEV *Uhc, IN UINT8 DevAddr, IN UINT8 EndPoint, OUT UINT8 *Toggle)
 
VOID UhciRecycleAsyncReq (IN USB_HC_DEV *Uhc)
 
VOID UhciFreeAllAsyncReq (IN USB_HC_DEV *Uhc)
 
VOID EFIAPI UhciMonitorAsyncReqList (IN EFI_EVENT Event, IN VOID *Context)
 

Detailed Description

The EHCI register operation routines.

Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file UhciSched.c.

Function Documentation

◆ UhciCheckTdStatus()

BOOLEAN UhciCheckTdStatus ( IN USB_HC_DEV Uhc,
IN UHCI_TD_SW Td,
IN BOOLEAN  IsLow,
OUT UHCI_QH_RESULT QhResult 
)

Check TDs Results.

Parameters
UhcThis UHCI device.
TdUHCI_TD_SW to check.
IsLowIs Low Speed Device.
QhResultReturn the result of this TD list.
Returns
Whether the TD's result is finialized.

Definition at line 417 of file UhciSched.c.

◆ UhciConvertPollRate()

UINTN UhciConvertPollRate ( IN UINTN  Interval)

Convert the poll rate to the maximum 2^n that is smaller than Interval.

Parameters
IntervalThe poll rate to convert.
Returns
The converted poll rate.

Definition at line 209 of file UhciSched.c.

◆ UhciCreateAsyncReq()

EFI_STATUS UhciCreateAsyncReq ( IN USB_HC_DEV Uhc,
IN UHCI_QH_SW Qh,
IN UHCI_TD_SW FirstTd,
IN UINT8  DevAddr,
IN UINT8  EndPoint,
IN UINTN  DataLen,
IN UINTN  Interval,
IN UINT8 *  Data,
IN EFI_ASYNC_USB_TRANSFER_CALLBACK  Callback,
IN VOID *  Context,
IN BOOLEAN  IsLow 
)

Create Async Request node, and Link to List.

Parameters
UhcThe UHCI device.
QhThe queue head of the transfer.
FirstTdFirst TD of the transfer.
DevAddrDevice Address.
EndPointEndPoint Address.
DataLenData length.
IntervalPolling Interval when inserted to frame list.
DataData buffer, unmapped.
CallbackCallback after interrupt transfeer.
ContextCallback Context passed as function parameter.
IsLowIs Low Speed.
Return values
EFI_SUCCESSAn asynchronous transfer is created.
EFI_INVALID_PARAMETERParemeter is error.
EFI_OUT_OF_RESOURCESFailed because of resource shortage.

Definition at line 683 of file UhciSched.c.

◆ UhciDestoryFrameList()

VOID UhciDestoryFrameList ( IN USB_HC_DEV Uhc)

Destory FrameList buffer.

Parameters
UhcThe UHCI device.

Definition at line 159 of file UhciSched.c.

◆ UhciExecuteTransfer()

EFI_STATUS UhciExecuteTransfer ( IN USB_HC_DEV Uhc,
IN UHCI_QH_SW Qh,
IN UHCI_TD_SW Td,
IN UINTN  TimeOut,
IN BOOLEAN  IsLow,
OUT UHCI_QH_RESULT QhResult 
)

Check the result of the transfer.

Parameters
UhcThe UHCI device.
QhThe queue head of the transfer.
TdThe first TDs of the transfer.
TimeOutTimeOut value in milliseconds.
IsLowIs Low Speed Device.
QhResultThe variable to return result.
Return values
EFI_SUCCESSThe transfer finished with success.
EFI_DEVICE_ERRORTransfer failed.

Definition at line 558 of file UhciSched.c.

◆ UhciFreeAllAsyncReq()

VOID UhciFreeAllAsyncReq ( IN USB_HC_DEV Uhc)

Release all the asynchronous transfers on the lsit.

Parameters
UhcThe UHCI device.

Definition at line 907 of file UhciSched.c.

◆ UhciFreeAsyncReq()

VOID UhciFreeAsyncReq ( IN USB_HC_DEV Uhc,
IN UHCI_ASYNC_REQUEST AsyncReq 
)

Free an asynchronous request's resource such as memory.

Parameters
UhcThe UHCI device.
AsyncReqThe asynchronous request to free.

Definition at line 739 of file UhciSched.c.

◆ UhciInitFrameList()

EFI_STATUS UhciInitFrameList ( IN USB_HC_DEV Uhc)

Create Frame List Structure.

Parameters
UhcUHCI device.
Return values
EFI_OUT_OF_RESOURCESCan't allocate memory resources.
EFI_UNSUPPORTEDMap memory fail.
EFI_SUCCESSSuccess.

Definition at line 23 of file UhciSched.c.

◆ UhciLinkQhToFrameList()

VOID UhciLinkQhToFrameList ( USB_HC_DEV Uhc,
UHCI_QH_SW Qh 
)

Link a queue head (for asynchronous interrupt transfer) to the frame list.

Parameters
UhcThe UHCI device.
QhThe queue head to link into.

Definition at line 247 of file UhciSched.c.

◆ UhciMonitorAsyncReqList()

VOID EFIAPI UhciMonitorAsyncReqList ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Interrupt transfer periodic check handler.

Parameters
EventThe event of the time.
ContextContext of the event, pointer to USB_HC_DEV.

Definition at line 943 of file UhciSched.c.

◆ UhciRecycleAsyncReq()

VOID UhciRecycleAsyncReq ( IN USB_HC_DEV Uhc)

Recycle the asynchronouse request. When a queue head is unlinked from frame list, host controller hardware may still hold a cached pointer to it. To synchronize with hardware, the request is released in two steps: first it is linked to the UHC's RecycleWait list. At the next time UhciMonitorAsyncReqList is fired, it is moved to UHC's Recylelist. Then, at another timer activation, all the requests on Recycle list is freed. This guarrantes that each unlink queue head keeps existing for at least 50ms, far enough for the hardware to clear its cache.

Parameters
UhcThe UHCI device.

Definition at line 881 of file UhciSched.c.

◆ UhciRemoveAsyncReq()

EFI_STATUS UhciRemoveAsyncReq ( IN USB_HC_DEV Uhc,
IN UINT8  DevAddr,
IN UINT8  EndPoint,
OUT UINT8 *  Toggle 
)

Delete Async Interrupt QH and TDs.

Parameters
UhcThe UHCI device.
DevAddrDevice Address.
EndPointEndPoint Address.
ToggleThe next data toggle to use.
Return values
EFI_SUCCESSThe request is deleted.
EFI_INVALID_PARAMETERParemeter is error.
EFI_NOT_FOUNDThe asynchronous isn't found.

Definition at line 808 of file UhciSched.c.

◆ UhciUnlinkAsyncReq()

VOID UhciUnlinkAsyncReq ( IN USB_HC_DEV Uhc,
IN UHCI_ASYNC_REQUEST AsyncReq,
IN BOOLEAN  FreeNow 
)

Unlink an asynchronous request's from UHC's asynchronus list. also remove the queue head from the frame list. If FreeNow, release its resource also. Otherwise, add the request to the UHC's recycle list to wait for a while before release the memory. Until then, hardware won't hold point to the request.

Parameters
UhcThe UHCI device.
AsyncReqThe asynchronous request to free.
FreeNowIf TRUE, free the resource immediately, otherwise add the request to recycle wait list.

Definition at line 770 of file UhciSched.c.

◆ UhciUnlinkQhFromFrameList()

VOID UhciUnlinkQhFromFrameList ( USB_HC_DEV Uhc,
UHCI_QH_SW Qh 
)

Unlink QH from the frame list is easier: find all the precedence node, and pointer there next to QhSw's next.

Parameters
UhcThe UHCI device.
QhThe queue head to unlink.

Definition at line 355 of file UhciSched.c.

◆ UhciUpdateAsyncReq()

VOID UhciUpdateAsyncReq ( IN USB_HC_DEV Uhc,
IN UHCI_ASYNC_REQUEST AsyncReq,
IN UINT32  Result,
IN UINT32  NextToggle 
)

Update Async Request, QH and TDs.

Parameters
UhcThe UHCI device.
AsyncReqThe UHCI asynchronous transfer to update.
ResultTransfer reslut.
NextToggleThe toggle of next data.

Definition at line 627 of file UhciSched.c.