]> git.proxmox.com Git - mirror_edk2.git/blob - QuarkSocPkg/QuarkSouthCluster/Usb/Ohci/Dxe/OhciUrb.h
6bf2fe7e54a20295922f0c4eaa1172e732a0dafe
[mirror_edk2.git] / QuarkSocPkg / QuarkSouthCluster / Usb / Ohci / Dxe / OhciUrb.h
1 /** @file
2 Provides some data struct used by OHCI controller driver.
3
4 Copyright (c) 2013-2015 Intel Corporation.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10
11 #ifndef _OHCI_URB_H
12 #define _OHCI_URB_H
13
14 #include "Descriptor.h"
15
16
17 //
18 // Func List
19 //
20
21
22 /**
23
24 Create a TD
25
26 @Param Ohc UHC private data
27
28 @retval TD structure pointer
29
30 **/
31 TD_DESCRIPTOR *
32 OhciCreateTD (
33 IN USB_OHCI_HC_DEV *Ohc
34 );
35
36 /**
37
38 Free a TD
39
40 @Param Ohc UHC private data
41 @Param Td Pointer to a TD to free
42
43 @retval EFI_SUCCESS TD freed
44
45 **/
46 EFI_STATUS
47 OhciFreeTD (
48 IN USB_OHCI_HC_DEV *Ohc,
49 IN TD_DESCRIPTOR *Td
50 );
51
52 /**
53
54 Create a ED
55
56 @Param Ohc Device private data
57
58 @retval ED descriptor pointer
59
60 **/
61 ED_DESCRIPTOR *
62 OhciCreateED (
63 USB_OHCI_HC_DEV *Ohc
64 );
65
66
67 /**
68
69 Free a ED
70
71 @Param Ohc UHC private data
72 @Param Ed Pointer to a ED to free
73
74 @retval EFI_SUCCESS ED freed
75
76 **/
77
78 EFI_STATUS
79 OhciFreeED (
80 IN USB_OHCI_HC_DEV *Ohc,
81 IN ED_DESCRIPTOR *Ed
82 );
83
84 /**
85
86 Free ED
87
88 @Param Ohc Device private data
89 @Param Ed Pointer to a ED to free
90
91 @retval EFI_SUCCESS ED freed
92
93 **/
94 EFI_STATUS
95 OhciFreeAllTDFromED (
96 IN USB_OHCI_HC_DEV *Ohc,
97 IN ED_DESCRIPTOR *Ed
98 );
99
100 /**
101
102 Find a working ED match the requirement
103
104 @Param EdHead Head of the ED list
105 @Param DeviceAddress Device address to search
106 @Param EndPointNum End point num to search
107 @Param EdDir ED Direction to search
108
109 @retval ED descriptor searched
110
111 **/
112
113 ED_DESCRIPTOR *
114 OhciFindWorkingEd (
115 IN ED_DESCRIPTOR *EdHead,
116 IN UINT8 DeviceAddress,
117 IN UINT8 EndPointNum,
118 IN UINT8 EdDir
119 );
120
121
122 /**
123
124 Initialize interrupt list.
125
126 @Param Ohc Device private data
127
128 @retval EFI_SUCCESS Initialization done
129
130 **/
131 EFI_STATUS
132 OhciInitializeInterruptList (
133 USB_OHCI_HC_DEV *Ohc
134 );
135
136 /**
137
138 Attach an ED
139
140 @Param Ed Ed to be attached
141 @Param NewEd Ed to attach
142
143 @retval EFI_SUCCESS NewEd attached to Ed
144 @retval EFI_INVALID_PARAMETER Ed is NULL
145
146 **/
147 EFI_STATUS
148 OhciAttachED (
149 IN ED_DESCRIPTOR *Ed,
150 IN ED_DESCRIPTOR *NewEd
151 );
152
153 /**
154
155 Count ED number on a ED chain
156
157 @Param Ed Head of the ED chain
158
159 @retval ED number on the chain
160
161 **/
162
163 UINTN
164 CountEdNum (
165 IN ED_DESCRIPTOR *Ed
166 );
167
168 /**
169
170 Find the minimal burn ED list on a specific depth level
171
172 @Param Ohc Device private data
173 @Param Depth Depth level
174
175 @retval ED list found
176
177 **/
178
179 ED_DESCRIPTOR *
180 OhciFindMinInterruptEDList (
181 IN USB_OHCI_HC_DEV *Ohc,
182 IN UINT32 Depth
183 );
184
185 /**
186
187 Attach an ED to an ED list
188
189 @Param OHC UHC private data
190 @Param ListType Type of the ED list
191 @Param Ed ED to attach
192 @Param EdList ED list to be attached
193
194 @retval EFI_SUCCESS ED attached to ED list
195
196 **/
197 ED_DESCRIPTOR *
198 OhciAttachEDToList (
199 IN USB_OHCI_HC_DEV *Ohc,
200 IN DESCRIPTOR_LIST_TYPE ListType,
201 IN ED_DESCRIPTOR *Ed,
202 IN ED_DESCRIPTOR *EdList
203 );
204
205 /**
206
207 Remove interrupt EDs that match requirement
208
209 @Param Ohc UHC private data
210 @Param IntEd The address of Interrupt endpoint
211
212 @retval EFI_SUCCESS EDs match requirement removed
213
214 **/
215
216 EFI_STATUS
217 OhciFreeInterruptEdByEd (
218 IN USB_OHCI_HC_DEV *Ohc,
219 IN ED_DESCRIPTOR *IntEd
220 );
221
222 /**
223
224 Remove interrupt EDs that match requirement
225
226 @Param Ohc UHC private data
227 @Param FunctionAddress Requirement on function address
228 @Param EndPointNum Requirement on end point number
229
230 @retval EFI_SUCCESS EDs match requirement removed
231
232 **/
233 EFI_STATUS
234 OhciFreeInterruptEdByAddr (
235 IN USB_OHCI_HC_DEV *Ohc,
236 IN UINT8 FunctionAddress,
237 IN UINT8 EndPointNum
238 );
239
240
241 /**
242
243 Link Td2 to the end of Td1
244
245 @Param Td1 TD to be linked
246 @Param Td2 TD to link
247
248 @retval EFI_SUCCESS TD successfully linked
249 @retval EFI_INVALID_PARAMETER Td1 is NULL
250
251 **/
252 EFI_STATUS
253 OhciLinkTD (
254 IN TD_DESCRIPTOR *Td1,
255 IN TD_DESCRIPTOR *Td2
256 );
257
258
259 /**
260
261 Attach TD list to ED
262
263 @Param Ed ED which TD list attach on
264 @Param HeadTd Head of the TD list to attach
265
266 @retval EFI_SUCCESS TD list attached on the ED
267
268 **/
269 EFI_STATUS
270 OhciAttachTDListToED (
271 IN ED_DESCRIPTOR *Ed,
272 IN TD_DESCRIPTOR *HeadTd
273 );
274
275
276 /**
277
278 Set value to ED specific field
279
280 @Param Ed ED to be set
281 @Param Field Field to be set
282 @Param Value Value to set
283
284 @retval EFI_SUCCESS Value set
285
286 **/
287 EFI_STATUS
288 OhciSetEDField (
289 IN ED_DESCRIPTOR *Ed,
290 IN UINT32 Field,
291 IN UINT32 Value
292 );
293
294
295 /**
296
297 Get value from an ED's specific field
298
299 @Param Ed ED pointer
300 @Param Field Field to get value from
301
302 @retval Value of the field
303
304 **/
305 UINT32
306 OhciGetEDField (
307 IN ED_DESCRIPTOR *Ed,
308 IN UINT32 Field
309 );
310
311
312 /**
313
314 Set value to TD specific field
315
316 @Param Td TD to be set
317 @Param Field Field to be set
318 @Param Value Value to set
319
320 @retval EFI_SUCCESS Value set
321
322 **/
323 EFI_STATUS
324 OhciSetTDField (
325 IN TD_DESCRIPTOR *Td,
326 IN UINT32 Field,
327 IN UINT32 Value
328 );
329
330
331 /**
332
333 Get value from ED specific field
334
335 @Param Td TD pointer
336 @Param Field Field to get value from
337
338 @retval Value of the field
339
340 **/
341
342 UINT32
343 OhciGetTDField (
344 IN TD_DESCRIPTOR *Td,
345 IN UINT32 Field
346 );
347 /**
348
349 Free the Ed,Td,buffer that were created during transferring
350
351 @Param Ohc Device private data
352 **/
353
354 VOID
355 OhciFreeDynamicIntMemory(
356 IN USB_OHCI_HC_DEV *Ohc
357 );
358
359 /**
360
361 Free the Ed that were initilized during driver was starting,
362 those memory were used as interrupt ED head
363
364 @Param Ohc Device private data
365
366
367 **/
368 VOID
369 OhciFreeFixedIntMemory (
370 IN USB_OHCI_HC_DEV *Ohc
371 );
372 /**
373
374 Release all OHCI used memory when OHCI going to quit
375
376 @Param Ohc Device private data
377
378 @retval EFI_SUCCESS Memory released
379
380 **/
381
382 EFI_STATUS
383 OhciFreeIntTransferMemory (
384 IN USB_OHCI_HC_DEV *Ohc
385 );
386
387 #endif