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