]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Bus/Pci/UhciDxe/UhciSched.h
Update prototype of DxeLoadCore().
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / UhciSched.h
... / ...
CommitLineData
1/** @file\r
2\r
3 The definition for EHCI register operation routines.\r
4\r
5Copyright (c) 2007, Intel Corporation\r
6All rights reserved. This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _EFI_UHCI_SCHED_H_\r
17#define _EFI_UHCI_SCHED_H_\r
18\r
19\r
20typedef enum {\r
21 UHCI_ASYNC_INT_SIGNATURE = EFI_SIGNATURE_32 ('u', 'h', 'c', 'a'),\r
22\r
23 //\r
24 // The failure mask for USB transfer return status. If any of\r
25 // these bit is set, the transfer failed. EFI_USB_ERR_NOEXECUTE\r
26 // and EFI_USB_ERR_NAK are not considered as error condition:\r
27 // the transfer is still going on.\r
28 //\r
29 USB_ERR_FAIL_MASK = EFI_USB_ERR_STALL | EFI_USB_ERR_BUFFER |\r
30 EFI_USB_ERR_BABBLE | EFI_USB_ERR_CRC |\r
31 EFI_USB_ERR_TIMEOUT | EFI_USB_ERR_BITSTUFF |\r
32 EFI_USB_ERR_SYSTEM\r
33\r
34}UHCI_ERR_FAIL_MASK;\r
35\r
36//\r
37// Structure to return the result of UHCI QH execution.\r
38// Result is the final result of the QH's QTD. NextToggle\r
39// is the next data toggle to use. Complete is the actual\r
40// length of data transferred.\r
41//\r
42typedef struct {\r
43 UINT32 Result;\r
44 UINT8 NextToggle;\r
45 UINTN Complete;\r
46} UHCI_QH_RESULT;\r
47\r
48typedef struct _UHCI_ASYNC_REQUEST UHCI_ASYNC_REQUEST;\r
49\r
50//\r
51// Structure used to manager the asynchronous interrupt transfers.\r
52//\r
53struct _UHCI_ASYNC_REQUEST{\r
54 UINTN Signature;\r
55 LIST_ENTRY Link;\r
56 UHCI_ASYNC_REQUEST *Recycle;\r
57\r
58 //\r
59 // Endpoint attributes\r
60 //\r
61 UINT8 DevAddr;\r
62 UINT8 EndPoint;\r
63 BOOLEAN IsLow;\r
64 UINTN Interval;\r
65\r
66 //\r
67 // Data and UHC structures\r
68 //\r
69 UHCI_QH_SW *QhSw;\r
70 UHCI_TD_SW *FirstTd;\r
71 UINT8 *Data; // Allocated host memory, not mapped memory\r
72 UINTN DataLen;\r
73 VOID *Mapping;\r
74\r
75 //\r
76 // User callback and its context\r
77 //\r
78 EFI_ASYNC_USB_TRANSFER_CALLBACK Callback;\r
79 VOID *Context;\r
80};\r
81\r
82#define UHCI_ASYNC_INT_FROM_LINK(a) \\r
83 CR (a, UHCI_ASYNC_REQUEST, Link, UHCI_ASYNC_INT_SIGNATURE)\r
84\r
85\r
86/**\r
87 Create Frame List Structure.\r
88\r
89 @param Uhc The UHCI device.\r
90\r
91 @return EFI_OUT_OF_RESOURCES Can't allocate memory resources.\r
92 @return EFI_UNSUPPORTED Map memory fail.\r
93 @return EFI_SUCCESS Success.\r
94\r
95**/\r
96EFI_STATUS\r
97UhciInitFrameList (\r
98 IN USB_HC_DEV *Uhc\r
99 )\r
100;\r
101\r
102/**\r
103 Destory FrameList buffer.\r
104\r
105 @param Uhc The UHCI device.\r
106\r
107 @return None.\r
108\r
109**/\r
110VOID\r
111UhciDestoryFrameList (\r
112 IN USB_HC_DEV *Uhc\r
113 )\r
114;\r
115\r
116\r
117/**\r
118 Convert the poll rate to the maxium 2^n that is smaller\r
119 than Interval.\r
120\r
121 @param Interval The poll rate to convert.\r
122\r
123 @return The converted poll rate.\r
124\r
125**/\r
126UINTN\r
127UhciConvertPollRate (\r
128 IN UINTN Interval\r
129 )\r
130;\r
131\r
132\r
133/**\r
134 Link a queue head (for asynchronous interrupt transfer) to\r
135 the frame list.\r
136\r
137 @param FrameBase The base of the frame list.\r
138 @param Qh The queue head to link into.\r
139\r
140 @return None.\r
141\r
142**/\r
143VOID\r
144UhciLinkQhToFrameList (\r
145 UINT32 *FrameBase,\r
146 UHCI_QH_SW *Qh\r
147 )\r
148;\r
149\r
150\r
151/**\r
152 Unlink QH from the frame list is easier: find all\r
153 the precedence node, and pointer there next to QhSw's\r
154 next.\r
155\r
156 @param FrameBase The base address of the frame list.\r
157 @param Qh The queue head to unlink.\r
158\r
159 @return None.\r
160\r
161**/\r
162VOID\r
163UhciUnlinkQhFromFrameList (\r
164 UINT32 *FrameBase,\r
165 UHCI_QH_SW *Qh\r
166 )\r
167;\r
168\r
169\r
170/**\r
171 Check the result of the transfer.\r
172\r
173 @param Uhc The UHCI device.\r
174 @param Qh The queue head of the transfer.\r
175 @param Td The first TDs of the transfer.\r
176 @param TimeOut TimeOut value in milliseconds.\r
177 @param IsLow Is Low Speed Device.\r
178 @param QhResult The variable to return result.\r
179\r
180 @retval EFI_SUCCESS The transfer finished with success.\r
181 @retval EFI_DEVICE_ERROR Transfer failed.\r
182\r
183**/\r
184EFI_STATUS\r
185UhciExecuteTransfer (\r
186 IN USB_HC_DEV *Uhc,\r
187 IN UHCI_QH_SW *Qh,\r
188 IN UHCI_TD_SW *Td,\r
189 IN UINTN TimeOut,\r
190 IN BOOLEAN IsLow,\r
191 OUT UHCI_QH_RESULT *QhResult\r
192 )\r
193;\r
194\r
195\r
196/**\r
197 Create Async Request node, and Link to List.\r
198\r
199 @param Uhc The UHCI device.\r
200 @param Qh The queue head of the transfer.\r
201 @param FirstTd First TD of the transfer.\r
202 @param DevAddr Device Address.\r
203 @param EndPoint EndPoint Address.\r
204 @param DataLen Data length.\r
205 @param Interval Polling Interval when inserted to frame list.\r
206 @param Mapping Mapping value.\r
207 @param Data Data buffer, unmapped.\r
208 @param Callback Callback after interrupt transfeer.\r
209 @param Context Callback Context passed as function parameter.\r
210 @param IsLow Is Low Speed.\r
211\r
212 @retval EFI_SUCCESS An asynchronous transfer is created.\r
213 @retval EFI_INVALID_PARAMETER Paremeter is error.\r
214 @retval EFI_OUT_OF_RESOURCES Failed because of resource shortage.\r
215\r
216**/\r
217EFI_STATUS\r
218UhciCreateAsyncReq (\r
219 IN USB_HC_DEV *Uhc,\r
220 IN UHCI_QH_SW *Qh,\r
221 IN UHCI_TD_SW *FirstTd,\r
222 IN UINT8 DevAddr,\r
223 IN UINT8 EndPoint,\r
224 IN UINTN DataLen,\r
225 IN UINTN Interval,\r
226 IN VOID *Mapping,\r
227 IN UINT8 *Data,\r
228 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,\r
229 IN VOID *Context,\r
230 IN BOOLEAN IsLow\r
231 )\r
232;\r
233\r
234\r
235/**\r
236 Delete Async Interrupt QH and TDs.\r
237\r
238 @param Uhc The UHCI device.\r
239 @param DevAddr Device Address.\r
240 @param EndPoint EndPoint Address.\r
241 @param Toggle The next data toggle to use.\r
242\r
243 @retval EFI_SUCCESS The request is deleted.\r
244 @retval EFI_INVALID_PARAMETER Paremeter is error.\r
245 @retval EFI_NOT_FOUND The asynchronous isn't found.\r
246\r
247**/\r
248EFI_STATUS\r
249UhciRemoveAsyncReq (\r
250 IN USB_HC_DEV *Uhc,\r
251 IN UINT8 DevAddr,\r
252 IN UINT8 EndPoint,\r
253 OUT UINT8 *Toggle\r
254 )\r
255;\r
256\r
257\r
258/**\r
259 Release all the asynchronous transfers on the lsit.\r
260\r
261 @param Uhc The UHCI device.\r
262\r
263 @return None.\r
264\r
265**/\r
266VOID\r
267UhciFreeAllAsyncReq (\r
268 IN USB_HC_DEV *Uhc\r
269 )\r
270;\r
271\r
272\r
273/**\r
274 Interrupt transfer periodic check handler.\r
275\r
276 @param Event The event of the time.\r
277 @param Context Context of the event, pointer to USB_HC_DEV.\r
278\r
279 @return None.\r
280\r
281**/\r
282VOID\r
283UhciMonitorAsyncReqList (\r
284 IN EFI_EVENT Event,\r
285 IN VOID *Context\r
286 )\r
287;\r
288\r
289#endif\r