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