]> git.proxmox.com Git - mirror_edk2.git/blame - 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
913cb9dc 1/** @file\r
2\r
78c2ffb5 3 This file contains the definination for host controller schedule routines.\r
4\r
4f792685 5Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
913cb9dc 7\r
78c2ffb5 8**/\r
913cb9dc 9\r
78c2ffb5 10#ifndef _EFI_EHCI_SCHED_H_\r
11#define _EFI_EHCI_SCHED_H_\r
913cb9dc 12\r
78c2ffb5 13/**\r
14 Initialize the schedule data structure such as frame list.\r
913cb9dc 15\r
78c2ffb5 16 @param Ehc The EHCI device to init schedule data for.\r
913cb9dc 17\r
78c2ffb5 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
913cb9dc 20\r
78c2ffb5 21**/\r
913cb9dc 22EFI_STATUS\r
23EhcInitSched (\r
1436aea4 24 IN USB2_HC_DEV *Ehc\r
ed66e1bc 25 );\r
913cb9dc 26\r
913cb9dc 27/**\r
28 Free the schedule data. It may be partially initialized.\r
29\r
78c2ffb5 30 @param Ehc The EHCI device.\r
913cb9dc 31\r
913cb9dc 32**/\r
33VOID\r
34EhcFreeSched (\r
1436aea4 35 IN USB2_HC_DEV *Ehc\r
ed66e1bc 36 );\r
913cb9dc 37\r
913cb9dc 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
78c2ffb5 45 @param Ehc The EHCI device.\r
46 @param Qh The queue head to link.\r
913cb9dc 47\r
913cb9dc 48**/\r
49VOID\r
50EhcLinkQhToAsync (\r
1436aea4
MK
51 IN USB2_HC_DEV *Ehc,\r
52 IN EHC_QH *Qh\r
ed66e1bc 53 );\r
913cb9dc 54\r
913cb9dc 55/**\r
56 Unlink a queue head from the asynchronous schedule list.\r
78c2ffb5 57 Need to synchronize with hardware.\r
913cb9dc 58\r
78c2ffb5 59 @param Ehc The EHCI device.\r
60 @param Qh The queue head to unlink.\r
913cb9dc 61\r
913cb9dc 62**/\r
63VOID\r
64EhcUnlinkQhFromAsync (\r
1436aea4
MK
65 IN USB2_HC_DEV *Ehc,\r
66 IN EHC_QH *Qh\r
ed66e1bc 67 );\r
913cb9dc 68\r
913cb9dc 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
78c2ffb5 74 @param Ehc The EHCI device.\r
75 @param Qh The queue head to link.\r
913cb9dc 76\r
913cb9dc 77**/\r
78VOID\r
79EhcLinkQhToPeriod (\r
1436aea4
MK
80 IN USB2_HC_DEV *Ehc,\r
81 IN EHC_QH *Qh\r
ed66e1bc 82 );\r
913cb9dc 83\r
913cb9dc 84/**\r
85 Unlink an interrupt queue head from the periodic\r
78c2ffb5 86 schedule frame list.\r
913cb9dc 87\r
78c2ffb5 88 @param Ehc The EHCI device.\r
89 @param Qh The queue head to unlink.\r
913cb9dc 90\r
913cb9dc 91**/\r
92VOID\r
93EhcUnlinkQhFromPeriod (\r
1436aea4
MK
94 IN USB2_HC_DEV *Ehc,\r
95 IN EHC_QH *Qh\r
ed66e1bc 96 );\r
913cb9dc 97\r
913cb9dc 98/**\r
99 Execute the transfer by polling the URB. This is a synchronous operation.\r
100\r
78c2ffb5 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
913cb9dc 104\r
78c2ffb5 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
913cb9dc 108\r
109**/\r
110EFI_STATUS\r
111EhcExecTransfer (\r
1436aea4
MK
112 IN USB2_HC_DEV *Ehc,\r
113 IN URB *Urb,\r
114 IN UINTN TimeOut\r
ed66e1bc 115 );\r
913cb9dc 116\r
913cb9dc 117/**\r
118 Delete a single asynchronous interrupt transfer for\r
78c2ffb5 119 the device and endpoint.\r
913cb9dc 120\r
78c2ffb5 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
913cb9dc 125\r
78c2ffb5 126 @retval EFI_SUCCESS An asynchronous transfer is removed.\r
127 @retval EFI_NOT_FOUND No transfer for the device is found.\r
913cb9dc 128\r
129**/\r
130EFI_STATUS\r
131EhciDelAsyncIntTransfer (\r
1436aea4
MK
132 IN USB2_HC_DEV *Ehc,\r
133 IN UINT8 DevAddr,\r
134 IN UINT8 EpNum,\r
135 OUT UINT8 *DataToggle\r
ed66e1bc 136 );\r
913cb9dc 137\r
913cb9dc 138/**\r
78c2ffb5 139 Remove all the asynchronous interrutp transfers.\r
913cb9dc 140\r
78c2ffb5 141 @param Ehc The EHCI device.\r
913cb9dc 142\r
913cb9dc 143**/\r
144VOID\r
145EhciDelAllAsyncIntTransfers (\r
1436aea4 146 IN USB2_HC_DEV *Ehc\r
ed66e1bc 147 );\r
913cb9dc 148\r
4f792685
SZ
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
1436aea4
MK
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
4f792685 181 );\r
913cb9dc 182\r
913cb9dc 183/**\r
78c2ffb5 184 Interrupt transfer periodic check handler.\r
913cb9dc 185\r
78c2ffb5 186 @param Event Interrupt event.\r
187 @param Context Pointer to USB2_HC_DEV.\r
913cb9dc 188\r
913cb9dc 189**/\r
190VOID\r
6d3ea23f 191EFIAPI\r
597f4ee2 192EhcMonitorAsyncRequests (\r
1436aea4
MK
193 IN EFI_EVENT Event,\r
194 IN VOID *Context\r
ed66e1bc 195 );\r
913cb9dc 196\r
197#endif\r