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