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