3 The definition for EHCI register operation routines.
5 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _EFI_UHCI_SCHED_H_
11 #define _EFI_UHCI_SCHED_H_
14 #define UHCI_ASYNC_INT_SIGNATURE SIGNATURE_32 ('u', 'h', 'c', 'a')
16 // The failure mask for USB transfer return status. If any of
17 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE
18 // and EFI_USB_ERR_NAK are not considered as error condition:
19 // the transfer is still going on.
21 #define USB_ERR_FAIL_MASK (EFI_USB_ERR_STALL | EFI_USB_ERR_BUFFER | \
22 EFI_USB_ERR_BABBLE | EFI_USB_ERR_CRC | \
23 EFI_USB_ERR_TIMEOUT | EFI_USB_ERR_BITSTUFF | \
28 // Structure to return the result of UHCI QH execution.
29 // Result is the final result of the QH's QTD. NextToggle
30 // is the next data toggle to use. Complete is the actual
31 // length of data transferred.
39 typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST
;
42 // Structure used to manager the asynchronous interrupt transfers.
44 struct _UHCI_ASYNC_REQUEST
{
47 UHCI_ASYNC_REQUEST
*Recycle
;
50 // Endpoint attributes
58 // Data and UHC structures
62 UINT8
*Data
; // Allocated host memory, not mapped memory
67 // User callback and its context
69 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
;
73 #define UHCI_ASYNC_INT_FROM_LINK(a) \
74 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)
78 Create Frame List Structure.
80 @param Uhc The UHCI device.
82 @return EFI_OUT_OF_RESOURCES Can't allocate memory resources.
83 @return EFI_UNSUPPORTED Map memory fail.
84 @return EFI_SUCCESS Success.
93 Destory FrameList buffer.
95 @param Uhc The UHCI device.
101 UhciDestoryFrameList (
107 Convert the poll rate to the maxium 2^n that is smaller
110 @param Interval The poll rate to convert.
112 @return The converted poll rate.
116 UhciConvertPollRate (
122 Link a queue head (for asynchronous interrupt transfer) to
125 @param Uhc The UHCI device.
126 @param Qh The queue head to link into.
130 UhciLinkQhToFrameList (
137 Unlink QH from the frame list is easier: find all
138 the precedence node, and pointer there next to QhSw's
141 @param Uhc The UHCI device.
142 @param Qh The queue head to unlink.
146 UhciUnlinkQhFromFrameList (
153 Check the result of the transfer.
155 @param Uhc The UHCI device.
156 @param Qh The queue head of the transfer.
157 @param Td The first TDs of the transfer.
158 @param TimeOut TimeOut value in milliseconds.
159 @param IsLow Is Low Speed Device.
160 @param QhResult The variable to return result.
162 @retval EFI_SUCCESS The transfer finished with success.
163 @retval EFI_DEVICE_ERROR Transfer failed.
167 UhciExecuteTransfer (
173 OUT UHCI_QH_RESULT
*QhResult
178 Create Async Request node, and Link to List.
180 @param Uhc The UHCI device.
181 @param Qh The queue head of the transfer.
182 @param FirstTd First TD of the transfer.
183 @param DevAddr Device Address.
184 @param EndPoint EndPoint Address.
185 @param DataLen Data length.
186 @param Interval Polling Interval when inserted to frame list.
187 @param Data Data buffer, unmapped.
188 @param Callback Callback after interrupt transfeer.
189 @param Context Callback Context passed as function parameter.
190 @param IsLow Is Low Speed.
192 @retval EFI_SUCCESS An asynchronous transfer is created.
193 @retval EFI_INVALID_PARAMETER Paremeter is error.
194 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.
201 IN UHCI_TD_SW
*FirstTd
,
207 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback
,
214 Delete Async Interrupt QH and TDs.
216 @param Uhc The UHCI device.
217 @param DevAddr Device Address.
218 @param EndPoint EndPoint Address.
219 @param Toggle The next data toggle to use.
221 @retval EFI_SUCCESS The request is deleted.
222 @retval EFI_INVALID_PARAMETER Paremeter is error.
223 @retval EFI_NOT_FOUND The asynchronous isn't found.
236 Release all the asynchronous transfers on the lsit.
238 @param Uhc The UHCI device.
244 UhciFreeAllAsyncReq (
250 Interrupt transfer periodic check handler.
252 @param Event The event of the time.
253 @param Context Context of the event, pointer to USB_HC_DEV.
260 UhciMonitorAsyncReqList (