]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Bus/Pci/EhciDxe/EhciSched.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / EhciDxe / EhciSched.h
... / ...
CommitLineData
1/** @file\r
2\r
3 This file contains the definination for host controller schedule routines.\r
4\r
5Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
6SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9\r
10#ifndef _EFI_EHCI_SCHED_H_\r
11#define _EFI_EHCI_SCHED_H_\r
12\r
13/**\r
14 Initialize the schedule data structure such as frame list.\r
15\r
16 @param Ehc The EHCI device to init schedule data for.\r
17\r
18 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource to init schedule data.\r
19 @retval EFI_SUCCESS The schedule data is initialized.\r
20\r
21**/\r
22EFI_STATUS\r
23EhcInitSched (\r
24 IN USB2_HC_DEV *Ehc\r
25 );\r
26\r
27/**\r
28 Free the schedule data. It may be partially initialized.\r
29\r
30 @param Ehc The EHCI device.\r
31\r
32**/\r
33VOID\r
34EhcFreeSched (\r
35 IN USB2_HC_DEV *Ehc\r
36 );\r
37\r
38/**\r
39 Link the queue head to the asynchronous schedule list.\r
40 UEFI only supports one CTRL/BULK transfer at a time\r
41 due to its interfaces. This simplifies the AsynList\r
42 management: A reclamation header is always linked to\r
43 the AsyncListAddr, the only active QH is appended to it.\r
44\r
45 @param Ehc The EHCI device.\r
46 @param Qh The queue head to link.\r
47\r
48**/\r
49VOID\r
50EhcLinkQhToAsync (\r
51 IN USB2_HC_DEV *Ehc,\r
52 IN EHC_QH *Qh\r
53 );\r
54\r
55/**\r
56 Unlink a queue head from the asynchronous schedule list.\r
57 Need to synchronize with hardware.\r
58\r
59 @param Ehc The EHCI device.\r
60 @param Qh The queue head to unlink.\r
61\r
62**/\r
63VOID\r
64EhcUnlinkQhFromAsync (\r
65 IN USB2_HC_DEV *Ehc,\r
66 IN EHC_QH *Qh\r
67 );\r
68\r
69/**\r
70 Link a queue head for interrupt transfer to the periodic\r
71 schedule frame list. This code is very much the same as\r
72 that in UHCI.\r
73\r
74 @param Ehc The EHCI device.\r
75 @param Qh The queue head to link.\r
76\r
77**/\r
78VOID\r
79EhcLinkQhToPeriod (\r
80 IN USB2_HC_DEV *Ehc,\r
81 IN EHC_QH *Qh\r
82 );\r
83\r
84/**\r
85 Unlink an interrupt queue head from the periodic\r
86 schedule frame list.\r
87\r
88 @param Ehc The EHCI device.\r
89 @param Qh The queue head to unlink.\r
90\r
91**/\r
92VOID\r
93EhcUnlinkQhFromPeriod (\r
94 IN USB2_HC_DEV *Ehc,\r
95 IN EHC_QH *Qh\r
96 );\r
97\r
98/**\r
99 Execute the transfer by polling the URB. This is a synchronous operation.\r
100\r
101 @param Ehc The EHCI device.\r
102 @param Urb The URB to execute.\r
103 @param TimeOut The time to wait before abort, in millisecond.\r
104\r
105 @retval EFI_DEVICE_ERROR The transfer failed due to transfer error.\r
106 @retval EFI_TIMEOUT The transfer failed due to time out.\r
107 @retval EFI_SUCCESS The transfer finished OK.\r
108\r
109**/\r
110EFI_STATUS\r
111EhcExecTransfer (\r
112 IN USB2_HC_DEV *Ehc,\r
113 IN URB *Urb,\r
114 IN UINTN TimeOut\r
115 );\r
116\r
117/**\r
118 Delete a single asynchronous interrupt transfer for\r
119 the device and endpoint.\r
120\r
121 @param Ehc The EHCI device.\r
122 @param DevAddr The address of the target device.\r
123 @param EpNum The endpoint of the target.\r
124 @param DataToggle Return the next data toggle to use.\r
125\r
126 @retval EFI_SUCCESS An asynchronous transfer is removed.\r
127 @retval EFI_NOT_FOUND No transfer for the device is found.\r
128\r
129**/\r
130EFI_STATUS\r
131EhciDelAsyncIntTransfer (\r
132 IN USB2_HC_DEV *Ehc,\r
133 IN UINT8 DevAddr,\r
134 IN UINT8 EpNum,\r
135 OUT UINT8 *DataToggle\r
136 );\r
137\r
138/**\r
139 Remove all the asynchronous interrutp transfers.\r
140\r
141 @param Ehc The EHCI device.\r
142\r
143**/\r
144VOID\r
145EhciDelAllAsyncIntTransfers (\r
146 IN USB2_HC_DEV *Ehc\r
147 );\r
148\r
149/**\r
150 Insert a single asynchronous interrupt transfer for\r
151 the device and endpoint.\r
152\r
153 @param Ehc The EHCI device.\r
154 @param DevAddr The device address.\r
155 @param EpAddr Endpoint addrress & its direction.\r
156 @param DevSpeed The device speed.\r
157 @param Toggle Initial data toggle to use.\r
158 @param MaxPacket The max packet length of the endpoint.\r
159 @param Hub The transaction translator to use.\r
160 @param DataLen The length of data buffer.\r
161 @param Callback The function to call when data is transferred.\r
162 @param Context The context to the callback.\r
163 @param Interval The interval for interrupt transfer.\r
164\r
165 @return Created URB or NULL.\r
166\r
167**/\r
168URB *\r
169EhciInsertAsyncIntTransfer (\r
170 IN USB2_HC_DEV *Ehc,\r
171 IN UINT8 DevAddr,\r
172 IN UINT8 EpAddr,\r
173 IN UINT8 DevSpeed,\r
174 IN UINT8 Toggle,\r
175 IN UINTN MaxPacket,\r
176 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Hub,\r
177 IN UINTN DataLen,\r
178 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback,\r
179 IN VOID *Context,\r
180 IN UINTN Interval\r
181 );\r
182\r
183/**\r
184 Interrupt transfer periodic check handler.\r
185\r
186 @param Event Interrupt event.\r
187 @param Context Pointer to USB2_HC_DEV.\r
188\r
189**/\r
190VOID\r
191EFIAPI\r
192EhcMonitorAsyncRequests (\r
193 IN EFI_EVENT Event,\r
194 IN VOID *Context\r
195 );\r
196\r
197#endif\r