]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / XhciDxe / Xhci.h
CommitLineData
92870c98 1/** @file\r
2\r
3 Provides some data structure definitions used by the XHCI host controller driver.\r
4\r
49be9c3c 5Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.<BR>\r
dc528558 6Copyright (c) Microsoft Corporation.<BR>\r
9d510e61 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
92870c98 8\r
9**/\r
10\r
11#ifndef _EFI_XHCI_H_\r
12#define _EFI_XHCI_H_\r
13\r
14#include <Uefi.h>\r
15\r
16#include <Protocol/Usb2HostController.h>\r
17#include <Protocol/PciIo.h>\r
18\r
19#include <Guid/EventGroup.h>\r
20\r
21#include <Library/BaseLib.h>\r
22#include <Library/BaseMemoryLib.h>\r
23#include <Library/UefiDriverEntryPoint.h>\r
24#include <Library/UefiBootServicesTableLib.h>\r
25#include <Library/MemoryAllocationLib.h>\r
26#include <Library/UefiLib.h>\r
92870c98 27#include <Library/DebugLib.h>\r
37623a5c 28#include <Library/ReportStatusCodeLib.h>\r
92870c98 29\r
30#include <IndustryStandard/Pci.h>\r
31\r
1436aea4
MK
32typedef struct _USB_XHCI_INSTANCE USB_XHCI_INSTANCE;\r
33typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;\r
92870c98 34\r
35#include "XhciReg.h"\r
36#include "XhciSched.h"\r
37#include "ComponentName.h"\r
1847ed0b 38#include "UsbHcMem.h"\r
92870c98 39\r
ca243131
FT
40//\r
41// The unit is microsecond, setting it as 1us.\r
42//\r
1436aea4 43#define XHC_1_MICROSECOND (1)\r
92870c98 44//\r
26cd2d6d 45// The unit is microsecond, setting it as 1ms.\r
92870c98 46//\r
1436aea4 47#define XHC_1_MILLISECOND (1000)\r
92870c98 48//\r
a9292c13 49// XHC generic timeout experience values.\r
26cd2d6d 50// The unit is millisecond, setting it as 10s.\r
92870c98 51//\r
1436aea4 52#define XHC_GENERIC_TIMEOUT (10 * 1000)\r
92870c98 53//\r
a9292c13 54// XHC reset timeout experience values.\r
26cd2d6d 55// The unit is millisecond, setting it as 1s.\r
92870c98 56//\r
1436aea4 57#define XHC_RESET_TIMEOUT (1000)\r
92870c98 58//\r
26b85012
FT
59// TRSTRCY delay requirement in usb 2.0 spec chapter 7.1.7.5.\r
60// The unit is microsecond, setting it as 10ms.\r
61//\r
1436aea4 62#define XHC_RESET_RECOVERY_DELAY (10 * 1000)\r
26b85012 63//\r
a9292c13 64// XHC async transfer timer interval, set by experience.\r
3ee12d88 65// The unit is 100us, takes 1ms as interval.\r
a9292c13 66//\r
1436aea4 67#define XHC_ASYNC_TIMER_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1)\r
92870c98 68\r
69//\r
70// XHC raises TPL to TPL_NOTIFY to serialize all its operations\r
71// to protect shared data structures.\r
72//\r
1436aea4 73#define XHC_TPL TPL_NOTIFY\r
92870c98 74\r
1436aea4
MK
75#define CMD_RING_TRB_NUMBER 0x100\r
76#define TR_RING_TRB_NUMBER 0x100\r
77#define ERST_NUMBER 0x01\r
78#define EVENT_RING_TRB_NUMBER 0x200\r
92870c98 79\r
1436aea4
MK
80#define CMD_INTER 0\r
81#define CTRL_INTER 1\r
82#define BULK_INTER 2\r
83#define INT_INTER 3\r
84#define INT_INTER_ASYNC 4\r
92870c98 85\r
1436aea4 86#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)\r
92870c98 87\r
1436aea4
MK
88#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))\r
89#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINTN)(Addr64), 32) & 0xFFFFFFFF))\r
90#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r
92870c98 91\r
92#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \\r
93 (XHC_BIT_IS_SET(XhcReadOpReg ((Xhc), (Offset)), (Bit)))\r
94\r
1436aea4 95#define XHCI_IS_DATAIN(EndpointAddr) XHC_BIT_IS_SET((EndpointAddr), 0x80)\r
92870c98 96\r
1436aea4
MK
97#define XHCI_INSTANCE_SIG SIGNATURE_32 ('x', 'h', 'c', 'i')\r
98#define XHC_FROM_THIS(a) CR(a, USB_XHCI_INSTANCE, Usb2Hc, XHCI_INSTANCE_SIG)\r
92870c98 99\r
100#define USB_DESC_TYPE_HUB 0x29\r
101#define USB_DESC_TYPE_HUB_SUPER_SPEED 0x2a\r
102\r
a9292c13 103//\r
104// The RequestType in EFI_USB_DEVICE_REQUEST is composed of\r
105// three fields: One bit direction, 2 bit type, and 5 bit\r
106// target.\r
107//\r
108#define USB_REQUEST_TYPE(Dir, Type, Target) \\r
109 ((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))\r
110\r
92870c98 111//\r
112// Xhci Data and Ctrl Structures\r
113//\r
114#pragma pack(1)\r
115typedef struct {\r
1436aea4
MK
116 UINT8 ProgInterface;\r
117 UINT8 SubClassCode;\r
118 UINT8 BaseCode;\r
92870c98 119} USB_CLASSC;\r
120\r
121typedef struct {\r
1436aea4
MK
122 UINT8 Length;\r
123 UINT8 DescType;\r
124 UINT8 NumPorts;\r
125 UINT16 HubCharacter;\r
126 UINT8 PwrOn2PwrGood;\r
127 UINT8 HubContrCurrent;\r
128 UINT8 Filler[16];\r
92870c98 129} EFI_USB_HUB_DESCRIPTOR;\r
130#pragma pack()\r
131\r
a9292c13 132struct _USB_DEV_CONTEXT {\r
133 //\r
134 // Whether this entry in UsbDevContext array is used or not.\r
135 //\r
1436aea4 136 BOOLEAN Enabled;\r
a9292c13 137 //\r
138 // The slot id assigned to the new device through XHCI's Enable_Slot cmd.\r
139 //\r
1436aea4 140 UINT8 SlotId;\r
a9292c13 141 //\r
142 // The route string presented an attached usb device.\r
143 //\r
1436aea4 144 USB_DEV_ROUTE RouteString;\r
a9292c13 145 //\r
146 // The route string of parent device if it exists. Otherwise it's zero.\r
147 //\r
1436aea4 148 USB_DEV_ROUTE ParentRouteString;\r
a9292c13 149 //\r
150 // The actual device address assigned by XHCI through Address_Device command.\r
151 //\r
1436aea4 152 UINT8 XhciDevAddr;\r
a9292c13 153 //\r
154 // The requested device address from UsbBus driver through Set_Address standard usb request.\r
155 // As XHCI spec replaces this request with Address_Device command, we have to record the\r
156 // requested device address and establish a mapping relationship with the actual device address.\r
157 // Then UsbBus driver just need to be aware of the requested device address to access usb device\r
158 // through EFI_USB2_HC_PROTOCOL. Xhci driver would be responsible for translating it to actual\r
159 // device address and access the actual device.\r
160 //\r
1436aea4 161 UINT8 BusDevAddr;\r
a9292c13 162 //\r
163 // The pointer to the input device context.\r
164 //\r
1436aea4 165 VOID *InputContext;\r
a9292c13 166 //\r
167 // The pointer to the output device context.\r
168 //\r
1436aea4 169 VOID *OutputContext;\r
a9292c13 170 //\r
171 // The transfer queue for every endpoint.\r
172 //\r
1436aea4 173 VOID *EndpointTransferRing[31];\r
a9292c13 174 //\r
175 // The device descriptor which is stored to support XHCI's Evaluate_Context cmd.\r
176 //\r
1436aea4 177 EFI_USB_DEVICE_DESCRIPTOR DevDesc;\r
a9292c13 178 //\r
179 // As a usb device may include multiple configuration descriptors, we dynamically allocate an array\r
180 // to store them.\r
181 // Note that every configuration descriptor stored here includes those lower level descriptors,\r
182 // such as Interface descriptor, Endpoint descriptor, and so on.\r
183 // These information is used to support XHCI's Config_Endpoint cmd.\r
184 //\r
1436aea4 185 EFI_USB_CONFIG_DESCRIPTOR **ConfDesc;\r
e1f2dfec
SZ
186 //\r
187 // A device has an active Configuration.\r
188 //\r
1436aea4 189 UINT8 ActiveConfiguration;\r
e1f2dfec
SZ
190 //\r
191 // Every interface has an active AlternateSetting.\r
192 //\r
1436aea4 193 UINT8 *ActiveAlternateSetting;\r
a9292c13 194};\r
195\r
196struct _USB_XHCI_INSTANCE {\r
1436aea4
MK
197 UINT32 Signature;\r
198 EFI_PCI_IO_PROTOCOL *PciIo;\r
199 UINT64 OriginalPciAttributes;\r
200 USBHC_MEM_POOL *MemPool;\r
92870c98 201\r
1436aea4 202 EFI_USB2_HC_PROTOCOL Usb2Hc;\r
92870c98 203\r
1436aea4 204 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
92870c98 205\r
206 //\r
207 // ExitBootServicesEvent is used to set OS semaphore and\r
208 // stop the XHC DMA operation after exit boot service.\r
209 //\r
1436aea4
MK
210 EFI_EVENT ExitBootServiceEvent;\r
211 EFI_EVENT PollTimer;\r
212 LIST_ENTRY AsyncIntTransfers;\r
213\r
214 UINT8 CapLength; ///< Capability Register Length\r
215 XHC_HCSPARAMS1 HcSParams1; ///< Structural Parameters 1\r
216 XHC_HCSPARAMS2 HcSParams2; ///< Structural Parameters 2\r
217 XHC_HCCPARAMS HcCParams; ///< Capability Parameters\r
218 UINT32 DBOff; ///< Doorbell Offset\r
219 UINT32 RTSOff; ///< Runtime Register Space Offset\r
220 UINT16 MaxInterrupt;\r
221 UINT32 PageSize;\r
222 UINT64 *ScratchBuf;\r
223 VOID *ScratchMap;\r
224 UINT32 MaxScratchpadBufs;\r
225 UINT64 *ScratchEntry;\r
226 UINTN *ScratchEntryMap;\r
227 UINT32 ExtCapRegBase;\r
228 UINT32 UsbLegSupOffset;\r
229 UINT32 DebugCapSupOffset;\r
230 UINT64 *DCBAA;\r
231 VOID *DCBAAMap;\r
232 UINT32 MaxSlotsEn;\r
233 URB *PendingUrb;\r
92870c98 234 //\r
235 // Cmd Transfer Ring\r
236 //\r
1436aea4 237 TRANSFER_RING CmdRing;\r
92870c98 238 //\r
6b4483cd 239 // EventRing\r
92870c98 240 //\r
1436aea4 241 EVENT_RING EventRing;\r
92870c98 242 //\r
243 // Misc\r
244 //\r
1436aea4 245 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
92870c98 246\r
92870c98 247 //\r
a9292c13 248 // Store device contexts managed by XHCI instance\r
249 // The array supports up to 255 devices, entry 0 is reserved and should not be used.\r
92870c98 250 //\r
1436aea4 251 USB_DEV_CONTEXT UsbDevContext[256];\r
5c1b371a 252\r
1436aea4 253 BOOLEAN Support64BitDma; // Whether 64 bit DMA may be used with this device\r
92870c98 254};\r
255\r
1436aea4
MK
256extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;\r
257extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;\r
258extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;\r
92870c98 259\r
260/**\r
261 Test to see if this driver supports ControllerHandle. Any\r
262 ControllerHandle that has Usb2HcProtocol installed will\r
263 be supported.\r
264\r
265 @param This Protocol instance pointer.\r
266 @param Controller Handle of device to test.\r
267 @param RemainingDevicePath Not used.\r
268\r
269 @return EFI_SUCCESS This driver supports this device.\r
270 @return EFI_UNSUPPORTED This driver does not support this device.\r
271\r
272**/\r
273EFI_STATUS\r
274EFIAPI\r
275XhcDriverBindingSupported (\r
1436aea4
MK
276 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
277 IN EFI_HANDLE Controller,\r
278 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
92870c98 279 );\r
280\r
281/**\r
282 Starting the Usb XHCI Driver.\r
283\r
284 @param This Protocol instance pointer.\r
285 @param Controller Handle of device to test.\r
286 @param RemainingDevicePath Not used.\r
287\r
288 @return EFI_SUCCESS supports this device.\r
289 @return EFI_UNSUPPORTED do not support this device.\r
290 @return EFI_DEVICE_ERROR cannot be started due to device Error.\r
291 @return EFI_OUT_OF_RESOURCES cannot allocate resources.\r
292\r
293**/\r
294EFI_STATUS\r
295EFIAPI\r
296XhcDriverBindingStart (\r
1436aea4
MK
297 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
298 IN EFI_HANDLE Controller,\r
299 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
92870c98 300 );\r
301\r
302/**\r
ed356b9e 303 Stop this driver on ControllerHandle. Support stopping any child handles\r
92870c98 304 created by this driver.\r
305\r
306 @param This Protocol instance pointer.\r
307 @param Controller Handle of device to stop driver on.\r
308 @param NumberOfChildren Number of Children in the ChildHandleBuffer.\r
309 @param ChildHandleBuffer List of handles for the children we need to stop.\r
310\r
311 @return EFI_SUCCESS Success.\r
312 @return EFI_DEVICE_ERROR Fail.\r
313\r
314**/\r
315EFI_STATUS\r
316EFIAPI\r
317XhcDriverBindingStop (\r
1436aea4
MK
318 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
319 IN EFI_HANDLE Controller,\r
320 IN UINTN NumberOfChildren,\r
321 IN EFI_HANDLE *ChildHandleBuffer\r
92870c98 322 );\r
323\r
a9292c13 324/**\r
325 Retrieves the capability of root hub ports.\r
326\r
327 @param This The EFI_USB2_HC_PROTOCOL instance.\r
328 @param MaxSpeed Max speed supported by the controller.\r
329 @param PortNumber Number of the root hub ports.\r
330 @param Is64BitCapable Whether the controller supports 64-bit memory\r
331 addressing.\r
332\r
333 @retval EFI_SUCCESS Host controller capability were retrieved successfully.\r
334 @retval EFI_INVALID_PARAMETER Either of the three capability pointer is NULL.\r
335\r
336**/\r
337EFI_STATUS\r
338EFIAPI\r
339XhcGetCapability (\r
340 IN EFI_USB2_HC_PROTOCOL *This,\r
341 OUT UINT8 *MaxSpeed,\r
342 OUT UINT8 *PortNumber,\r
343 OUT UINT8 *Is64BitCapable\r
344 );\r
345\r
346/**\r
347 Provides software reset for the USB host controller.\r
348\r
349 @param This This EFI_USB2_HC_PROTOCOL instance.\r
350 @param Attributes A bit mask of the reset operation to perform.\r
351\r
352 @retval EFI_SUCCESS The reset operation succeeded.\r
353 @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
354 @retval EFI_UNSUPPOURTED The type of reset specified by Attributes is\r
355 not currently supported by the host controller.\r
356 @retval EFI_DEVICE_ERROR Host controller isn't halted to reset.\r
357\r
358**/\r
359EFI_STATUS\r
360EFIAPI\r
361XhcReset (\r
362 IN EFI_USB2_HC_PROTOCOL *This,\r
363 IN UINT16 Attributes\r
364 );\r
365\r
366/**\r
367 Retrieve the current state of the USB host controller.\r
368\r
369 @param This This EFI_USB2_HC_PROTOCOL instance.\r
370 @param State Variable to return the current host controller\r
371 state.\r
372\r
373 @retval EFI_SUCCESS Host controller state was returned in State.\r
374 @retval EFI_INVALID_PARAMETER State is NULL.\r
375 @retval EFI_DEVICE_ERROR An error was encountered while attempting to\r
376 retrieve the host controller's current state.\r
377\r
378**/\r
379EFI_STATUS\r
380EFIAPI\r
381XhcGetState (\r
382 IN EFI_USB2_HC_PROTOCOL *This,\r
383 OUT EFI_USB_HC_STATE *State\r
384 );\r
385\r
386/**\r
387 Sets the USB host controller to a specific state.\r
388\r
389 @param This This EFI_USB2_HC_PROTOCOL instance.\r
390 @param State The state of the host controller that will be set.\r
391\r
392 @retval EFI_SUCCESS The USB host controller was successfully placed\r
393 in the state specified by State.\r
394 @retval EFI_INVALID_PARAMETER State is invalid.\r
395 @retval EFI_DEVICE_ERROR Failed to set the state due to device error.\r
396\r
397**/\r
398EFI_STATUS\r
399EFIAPI\r
400XhcSetState (\r
401 IN EFI_USB2_HC_PROTOCOL *This,\r
402 IN EFI_USB_HC_STATE State\r
403 );\r
404\r
405/**\r
406 Retrieves the current status of a USB root hub port.\r
407\r
408 @param This This EFI_USB2_HC_PROTOCOL instance.\r
409 @param PortNumber The root hub port to retrieve the state from.\r
410 This value is zero-based.\r
411 @param PortStatus Variable to receive the port state.\r
412\r
413 @retval EFI_SUCCESS The status of the USB root hub port specified.\r
414 by PortNumber was returned in PortStatus.\r
415 @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
416 @retval EFI_DEVICE_ERROR Can't read register.\r
417\r
418**/\r
419EFI_STATUS\r
420EFIAPI\r
421XhcGetRootHubPortStatus (\r
422 IN EFI_USB2_HC_PROTOCOL *This,\r
423 IN UINT8 PortNumber,\r
424 OUT EFI_USB_PORT_STATUS *PortStatus\r
425 );\r
426\r
92870c98 427/**\r
428 Sets a feature for the specified root hub port.\r
429\r
430 @param This This EFI_USB2_HC_PROTOCOL instance.\r
431 @param PortNumber Root hub port to set.\r
432 @param PortFeature Feature to set.\r
433\r
434 @retval EFI_SUCCESS The feature specified by PortFeature was set.\r
435 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
436 @retval EFI_DEVICE_ERROR Can't read register.\r
437\r
438**/\r
439EFI_STATUS\r
440EFIAPI\r
441XhcSetRootHubPortFeature (\r
442 IN EFI_USB2_HC_PROTOCOL *This,\r
443 IN UINT8 PortNumber,\r
444 IN EFI_USB_PORT_FEATURE PortFeature\r
445 );\r
446\r
447/**\r
448 Clears a feature for the specified root hub port.\r
449\r
450 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
451 @param PortNumber Specifies the root hub port whose feature is\r
452 requested to be cleared.\r
453 @param PortFeature Indicates the feature selector associated with the\r
454 feature clear request.\r
455\r
456 @retval EFI_SUCCESS The feature specified by PortFeature was cleared\r
457 for the USB root hub port specified by PortNumber.\r
458 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
459 @retval EFI_DEVICE_ERROR Can't read register.\r
460\r
461**/\r
462EFI_STATUS\r
463EFIAPI\r
464XhcClearRootHubPortFeature (\r
465 IN EFI_USB2_HC_PROTOCOL *This,\r
466 IN UINT8 PortNumber,\r
467 IN EFI_USB_PORT_FEATURE PortFeature\r
468 );\r
469\r
a9292c13 470/**\r
471 Submits control transfer to a target USB device.\r
472\r
473 @param This This EFI_USB2_HC_PROTOCOL instance.\r
474 @param DeviceAddress The target device address.\r
475 @param DeviceSpeed Target device speed.\r
476 @param MaximumPacketLength Maximum packet size the default control transfer\r
477 endpoint is capable of sending or receiving.\r
478 @param Request USB device request to send.\r
479 @param TransferDirection Specifies the data direction for the data stage\r
480 @param Data Data buffer to be transmitted or received from USB\r
481 device.\r
482 @param DataLength The size (in bytes) of the data buffer.\r
483 @param Timeout Indicates the maximum timeout, in millisecond.\r
484 @param Translator Transaction translator to be used by this device.\r
485 @param TransferResult Return the result of this control transfer.\r
486\r
487 @retval EFI_SUCCESS Transfer was completed successfully.\r
488 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.\r
489 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
490 @retval EFI_TIMEOUT Transfer failed due to timeout.\r
491 @retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.\r
492\r
493**/\r
494EFI_STATUS\r
495EFIAPI\r
496XhcControlTransfer (\r
497 IN EFI_USB2_HC_PROTOCOL *This,\r
498 IN UINT8 DeviceAddress,\r
499 IN UINT8 DeviceSpeed,\r
500 IN UINTN MaximumPacketLength,\r
501 IN EFI_USB_DEVICE_REQUEST *Request,\r
502 IN EFI_USB_DATA_DIRECTION TransferDirection,\r
503 IN OUT VOID *Data,\r
504 IN OUT UINTN *DataLength,\r
505 IN UINTN Timeout,\r
506 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
507 OUT UINT32 *TransferResult\r
508 );\r
509\r
510/**\r
511 Submits bulk transfer to a bulk endpoint of a USB device.\r
512\r
513 @param This This EFI_USB2_HC_PROTOCOL instance.\r
514 @param DeviceAddress Target device address.\r
515 @param EndPointAddress Endpoint number and its direction in bit 7.\r
516 @param DeviceSpeed Device speed, Low speed device doesn't support bulk\r
517 transfer.\r
518 @param MaximumPacketLength Maximum packet size the endpoint is capable of\r
519 sending or receiving.\r
520 @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
521 @param Data Array of pointers to the buffers of data to transmit\r
522 from or receive into.\r
523 @param DataLength The lenght of the data buffer.\r
524 @param DataToggle On input, the initial data toggle for the transfer;\r
525 On output, it is updated to to next data toggle to\r
526 use of the subsequent bulk transfer.\r
527 @param Timeout Indicates the maximum time, in millisecond, which\r
528 the transfer is allowed to complete.\r
529 @param Translator A pointr to the transaction translator data.\r
530 @param TransferResult A pointer to the detailed result information of the\r
531 bulk transfer.\r
532\r
533 @retval EFI_SUCCESS The transfer was completed successfully.\r
534 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
535 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
536 @retval EFI_TIMEOUT The transfer failed due to timeout.\r
537 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
538\r
539**/\r
540EFI_STATUS\r
541EFIAPI\r
542XhcBulkTransfer (\r
543 IN EFI_USB2_HC_PROTOCOL *This,\r
544 IN UINT8 DeviceAddress,\r
545 IN UINT8 EndPointAddress,\r
546 IN UINT8 DeviceSpeed,\r
547 IN UINTN MaximumPacketLength,\r
548 IN UINT8 DataBuffersNumber,\r
549 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
550 IN OUT UINTN *DataLength,\r
551 IN OUT UINT8 *DataToggle,\r
552 IN UINTN Timeout,\r
553 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
554 OUT UINT32 *TransferResult\r
555 );\r
556\r
557/**\r
558 Submits an asynchronous interrupt transfer to an\r
559 interrupt endpoint of a USB device.\r
560\r
561 @param This This EFI_USB2_HC_PROTOCOL instance.\r
562 @param DeviceAddress Target device address.\r
563 @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
564 @param DeviceSpeed Indicates device speed.\r
565 @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
566 @param IsNewTransfer If TRUE, to submit an new asynchronous interrupt\r
567 transfer If FALSE, to remove the specified\r
568 asynchronous interrupt.\r
569 @param DataToggle On input, the initial data toggle to use; on output,\r
570 it is updated to indicate the next data toggle.\r
571 @param PollingInterval The he interval, in milliseconds, that the transfer\r
572 is polled.\r
573 @param DataLength The length of data to receive at the rate specified\r
574 by PollingInterval.\r
575 @param Translator Transaction translator to use.\r
576 @param CallBackFunction Function to call at the rate specified by\r
577 PollingInterval.\r
578 @param Context Context to CallBackFunction.\r
579\r
580 @retval EFI_SUCCESS The request has been successfully submitted or canceled.\r
581 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
582 @retval EFI_OUT_OF_RESOURCES The request failed due to a lack of resources.\r
583 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
584\r
585**/\r
586EFI_STATUS\r
587EFIAPI\r
588XhcAsyncInterruptTransfer (\r
589 IN EFI_USB2_HC_PROTOCOL *This,\r
590 IN UINT8 DeviceAddress,\r
591 IN UINT8 EndPointAddress,\r
592 IN UINT8 DeviceSpeed,\r
593 IN UINTN MaximumPacketLength,\r
594 IN BOOLEAN IsNewTransfer,\r
595 IN OUT UINT8 *DataToggle,\r
596 IN UINTN PollingInterval,\r
597 IN UINTN DataLength,\r
598 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
599 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,\r
600 IN VOID *Context OPTIONAL\r
601 );\r
602\r
603/**\r
604 Submits synchronous interrupt transfer to an interrupt endpoint\r
605 of a USB device.\r
606\r
607 @param This This EFI_USB2_HC_PROTOCOL instance.\r
608 @param DeviceAddress Target device address.\r
609 @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
610 @param DeviceSpeed Indicates device speed.\r
611 @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
612 of sending or receiving.\r
613 @param Data Buffer of data that will be transmitted to USB\r
614 device or received from USB device.\r
615 @param DataLength On input, the size, in bytes, of the data buffer; On\r
616 output, the number of bytes transferred.\r
617 @param DataToggle On input, the initial data toggle to use; on output,\r
618 it is updated to indicate the next data toggle.\r
619 @param Timeout Maximum time, in second, to complete.\r
620 @param Translator Transaction translator to use.\r
621 @param TransferResult Variable to receive the transfer result.\r
622\r
623 @return EFI_SUCCESS The transfer was completed successfully.\r
624 @return EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
625 @return EFI_INVALID_PARAMETER Some parameters are invalid.\r
626 @return EFI_TIMEOUT The transfer failed due to timeout.\r
627 @return EFI_DEVICE_ERROR The failed due to host controller or device error\r
628\r
629**/\r
630EFI_STATUS\r
631EFIAPI\r
632XhcSyncInterruptTransfer (\r
633 IN EFI_USB2_HC_PROTOCOL *This,\r
634 IN UINT8 DeviceAddress,\r
635 IN UINT8 EndPointAddress,\r
636 IN UINT8 DeviceSpeed,\r
637 IN UINTN MaximumPacketLength,\r
638 IN OUT VOID *Data,\r
639 IN OUT UINTN *DataLength,\r
640 IN OUT UINT8 *DataToggle,\r
641 IN UINTN Timeout,\r
642 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
643 OUT UINT32 *TransferResult\r
644 );\r
645\r
646/**\r
647 Submits isochronous transfer to a target USB device.\r
648\r
649 @param This This EFI_USB2_HC_PROTOCOL instance.\r
650 @param DeviceAddress Target device address.\r
651 @param EndPointAddress End point address with its direction.\r
652 @param DeviceSpeed Device speed, Low speed device doesn't support this\r
653 type.\r
654 @param MaximumPacketLength Maximum packet size that the endpoint is capable of\r
655 sending or receiving.\r
656 @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
657 @param Data Array of pointers to the buffers of data that will\r
658 be transmitted to USB device or received from USB\r
659 device.\r
660 @param DataLength The size, in bytes, of the data buffer.\r
661 @param Translator Transaction translator to use.\r
662 @param TransferResult Variable to receive the transfer result.\r
663\r
664 @return EFI_UNSUPPORTED Isochronous transfer is unsupported.\r
665\r
666**/\r
667EFI_STATUS\r
668EFIAPI\r
669XhcIsochronousTransfer (\r
670 IN EFI_USB2_HC_PROTOCOL *This,\r
671 IN UINT8 DeviceAddress,\r
672 IN UINT8 EndPointAddress,\r
673 IN UINT8 DeviceSpeed,\r
674 IN UINTN MaximumPacketLength,\r
675 IN UINT8 DataBuffersNumber,\r
676 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
677 IN UINTN DataLength,\r
678 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
679 OUT UINT32 *TransferResult\r
680 );\r
681\r
682/**\r
683 Submits Async isochronous transfer to a target USB device.\r
684\r
685 @param This This EFI_USB2_HC_PROTOCOL instance.\r
686 @param DeviceAddress Target device address.\r
687 @param EndPointAddress End point address with its direction.\r
688 @param DeviceSpeed Device speed, Low speed device doesn't support this\r
689 type.\r
690 @param MaximumPacketLength Maximum packet size that the endpoint is capable of\r
691 sending or receiving.\r
692 @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
693 @param Data Array of pointers to the buffers of data that will\r
694 be transmitted to USB device or received from USB\r
695 device.\r
696 @param DataLength The size, in bytes, of the data buffer.\r
697 @param Translator Transaction translator to use.\r
698 @param IsochronousCallBack Function to be called when the transfer complete.\r
699 @param Context Context passed to the call back function as\r
700 parameter.\r
701\r
702 @return EFI_UNSUPPORTED Isochronous transfer isn't supported.\r
703\r
704**/\r
705EFI_STATUS\r
706EFIAPI\r
707XhcAsyncIsochronousTransfer (\r
708 IN EFI_USB2_HC_PROTOCOL *This,\r
709 IN UINT8 DeviceAddress,\r
710 IN UINT8 EndPointAddress,\r
711 IN UINT8 DeviceSpeed,\r
712 IN UINTN MaximumPacketLength,\r
713 IN UINT8 DataBuffersNumber,\r
714 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
715 IN UINTN DataLength,\r
716 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
717 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
718 IN VOID *Context\r
719 );\r
720\r
92870c98 721#endif\r