MdeModulePkg/XhciDxe: Check timeout URB again after stopping endpoint
[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
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
26b85012
FT
64// TRSTRCY delay requirement in usb 2.0 spec chapter 7.1.7.5.\r
65// The unit is microsecond, setting it as 10ms.\r
66//\r
67#define XHC_RESET_RECOVERY_DELAY (10 * 1000)\r
68//\r
a9292c13 69// XHC async transfer timer interval, set by experience.\r
3ee12d88 70// The unit is 100us, takes 1ms as interval.\r
a9292c13 71//\r
3ee12d88 72#define XHC_ASYNC_TIMER_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1)\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
ed356b9e 92// Iterate through the double linked list. This is delete-safe.\r
92870c98 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
49be9c3c 246 URB *PendingUrb;\r
92870c98 247 //\r
248 // Cmd Transfer Ring\r
249 //\r
250 TRANSFER_RING CmdRing;\r
251 //\r
6b4483cd 252 // EventRing\r
92870c98 253 //\r
6b4483cd 254 EVENT_RING EventRing;\r
92870c98 255 //\r
256 // Misc\r
257 //\r
258 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
259\r
92870c98 260 //\r
a9292c13 261 // Store device contexts managed by XHCI instance\r
262 // The array supports up to 255 devices, entry 0 is reserved and should not be used.\r
92870c98 263 //\r
a9292c13 264 USB_DEV_CONTEXT UsbDevContext[256];\r
5c1b371a
AB
265\r
266 BOOLEAN Support64BitDma; // Whether 64 bit DMA may be used with this device\r
92870c98 267};\r
268\r
a9292c13 269\r
92870c98 270extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;\r
271extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;\r
272extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;\r
92870c98 273\r
274/**\r
275 Test to see if this driver supports ControllerHandle. Any\r
276 ControllerHandle that has Usb2HcProtocol installed will\r
277 be supported.\r
278\r
279 @param This Protocol instance pointer.\r
280 @param Controller Handle of device to test.\r
281 @param RemainingDevicePath Not used.\r
282\r
283 @return EFI_SUCCESS This driver supports this device.\r
284 @return EFI_UNSUPPORTED This driver does not support this device.\r
285\r
286**/\r
287EFI_STATUS\r
288EFIAPI\r
289XhcDriverBindingSupported (\r
290 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
291 IN EFI_HANDLE Controller,\r
292 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
293 );\r
294\r
295/**\r
296 Starting the Usb XHCI Driver.\r
297\r
298 @param This Protocol instance pointer.\r
299 @param Controller Handle of device to test.\r
300 @param RemainingDevicePath Not used.\r
301\r
302 @return EFI_SUCCESS supports this device.\r
303 @return EFI_UNSUPPORTED do not support this device.\r
304 @return EFI_DEVICE_ERROR cannot be started due to device Error.\r
305 @return EFI_OUT_OF_RESOURCES cannot allocate resources.\r
306\r
307**/\r
308EFI_STATUS\r
309EFIAPI\r
310XhcDriverBindingStart (\r
311 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
312 IN EFI_HANDLE Controller,\r
313 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
314 );\r
315\r
316/**\r
ed356b9e 317 Stop this driver on ControllerHandle. Support stopping any child handles\r
92870c98 318 created by this driver.\r
319\r
320 @param This Protocol instance pointer.\r
321 @param Controller Handle of device to stop driver on.\r
322 @param NumberOfChildren Number of Children in the ChildHandleBuffer.\r
323 @param ChildHandleBuffer List of handles for the children we need to stop.\r
324\r
325 @return EFI_SUCCESS Success.\r
326 @return EFI_DEVICE_ERROR Fail.\r
327\r
328**/\r
329EFI_STATUS\r
330EFIAPI\r
331XhcDriverBindingStop (\r
332 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
333 IN EFI_HANDLE Controller,\r
334 IN UINTN NumberOfChildren,\r
335 IN EFI_HANDLE *ChildHandleBuffer\r
336 );\r
337\r
a9292c13 338/**\r
339 Retrieves the capability of root hub ports.\r
340\r
341 @param This The EFI_USB2_HC_PROTOCOL instance.\r
342 @param MaxSpeed Max speed supported by the controller.\r
343 @param PortNumber Number of the root hub ports.\r
344 @param Is64BitCapable Whether the controller supports 64-bit memory\r
345 addressing.\r
346\r
347 @retval EFI_SUCCESS Host controller capability were retrieved successfully.\r
348 @retval EFI_INVALID_PARAMETER Either of the three capability pointer is NULL.\r
349\r
350**/\r
351EFI_STATUS\r
352EFIAPI\r
353XhcGetCapability (\r
354 IN EFI_USB2_HC_PROTOCOL *This,\r
355 OUT UINT8 *MaxSpeed,\r
356 OUT UINT8 *PortNumber,\r
357 OUT UINT8 *Is64BitCapable\r
358 );\r
359\r
360/**\r
361 Provides software reset for the USB host controller.\r
362\r
363 @param This This EFI_USB2_HC_PROTOCOL instance.\r
364 @param Attributes A bit mask of the reset operation to perform.\r
365\r
366 @retval EFI_SUCCESS The reset operation succeeded.\r
367 @retval EFI_INVALID_PARAMETER Attributes is not valid.\r
368 @retval EFI_UNSUPPOURTED The type of reset specified by Attributes is\r
369 not currently supported by the host controller.\r
370 @retval EFI_DEVICE_ERROR Host controller isn't halted to reset.\r
371\r
372**/\r
373EFI_STATUS\r
374EFIAPI\r
375XhcReset (\r
376 IN EFI_USB2_HC_PROTOCOL *This,\r
377 IN UINT16 Attributes\r
378 );\r
379\r
380/**\r
381 Retrieve the current state of the USB host controller.\r
382\r
383 @param This This EFI_USB2_HC_PROTOCOL instance.\r
384 @param State Variable to return the current host controller\r
385 state.\r
386\r
387 @retval EFI_SUCCESS Host controller state was returned in State.\r
388 @retval EFI_INVALID_PARAMETER State is NULL.\r
389 @retval EFI_DEVICE_ERROR An error was encountered while attempting to\r
390 retrieve the host controller's current state.\r
391\r
392**/\r
393EFI_STATUS\r
394EFIAPI\r
395XhcGetState (\r
396 IN EFI_USB2_HC_PROTOCOL *This,\r
397 OUT EFI_USB_HC_STATE *State\r
398 );\r
399\r
400/**\r
401 Sets the USB host controller to a specific state.\r
402\r
403 @param This This EFI_USB2_HC_PROTOCOL instance.\r
404 @param State The state of the host controller that will be set.\r
405\r
406 @retval EFI_SUCCESS The USB host controller was successfully placed\r
407 in the state specified by State.\r
408 @retval EFI_INVALID_PARAMETER State is invalid.\r
409 @retval EFI_DEVICE_ERROR Failed to set the state due to device error.\r
410\r
411**/\r
412EFI_STATUS\r
413EFIAPI\r
414XhcSetState (\r
415 IN EFI_USB2_HC_PROTOCOL *This,\r
416 IN EFI_USB_HC_STATE State\r
417 );\r
418\r
419/**\r
420 Retrieves the current status of a USB root hub port.\r
421\r
422 @param This This EFI_USB2_HC_PROTOCOL instance.\r
423 @param PortNumber The root hub port to retrieve the state from.\r
424 This value is zero-based.\r
425 @param PortStatus Variable to receive the port state.\r
426\r
427 @retval EFI_SUCCESS The status of the USB root hub port specified.\r
428 by PortNumber was returned in PortStatus.\r
429 @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
430 @retval EFI_DEVICE_ERROR Can't read register.\r
431\r
432**/\r
433EFI_STATUS\r
434EFIAPI\r
435XhcGetRootHubPortStatus (\r
436 IN EFI_USB2_HC_PROTOCOL *This,\r
437 IN UINT8 PortNumber,\r
438 OUT EFI_USB_PORT_STATUS *PortStatus\r
439 );\r
440\r
92870c98 441/**\r
442 Sets a feature for the specified root hub port.\r
443\r
444 @param This This EFI_USB2_HC_PROTOCOL instance.\r
445 @param PortNumber Root hub port to set.\r
446 @param PortFeature Feature to set.\r
447\r
448 @retval EFI_SUCCESS The feature specified by PortFeature was set.\r
449 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
450 @retval EFI_DEVICE_ERROR Can't read register.\r
451\r
452**/\r
453EFI_STATUS\r
454EFIAPI\r
455XhcSetRootHubPortFeature (\r
456 IN EFI_USB2_HC_PROTOCOL *This,\r
457 IN UINT8 PortNumber,\r
458 IN EFI_USB_PORT_FEATURE PortFeature\r
459 );\r
460\r
461/**\r
462 Clears a feature for the specified root hub port.\r
463\r
464 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.\r
465 @param PortNumber Specifies the root hub port whose feature is\r
466 requested to be cleared.\r
467 @param PortFeature Indicates the feature selector associated with the\r
468 feature clear request.\r
469\r
470 @retval EFI_SUCCESS The feature specified by PortFeature was cleared\r
471 for the USB root hub port specified by PortNumber.\r
472 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
473 @retval EFI_DEVICE_ERROR Can't read register.\r
474\r
475**/\r
476EFI_STATUS\r
477EFIAPI\r
478XhcClearRootHubPortFeature (\r
479 IN EFI_USB2_HC_PROTOCOL *This,\r
480 IN UINT8 PortNumber,\r
481 IN EFI_USB_PORT_FEATURE PortFeature\r
482 );\r
483\r
a9292c13 484/**\r
485 Submits control transfer to a target USB device.\r
486\r
487 @param This This EFI_USB2_HC_PROTOCOL instance.\r
488 @param DeviceAddress The target device address.\r
489 @param DeviceSpeed Target device speed.\r
490 @param MaximumPacketLength Maximum packet size the default control transfer\r
491 endpoint is capable of sending or receiving.\r
492 @param Request USB device request to send.\r
493 @param TransferDirection Specifies the data direction for the data stage\r
494 @param Data Data buffer to be transmitted or received from USB\r
495 device.\r
496 @param DataLength The size (in bytes) of the data buffer.\r
497 @param Timeout Indicates the maximum timeout, in millisecond.\r
498 @param Translator Transaction translator to be used by this device.\r
499 @param TransferResult Return the result of this control transfer.\r
500\r
501 @retval EFI_SUCCESS Transfer was completed successfully.\r
502 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.\r
503 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
504 @retval EFI_TIMEOUT Transfer failed due to timeout.\r
505 @retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.\r
506\r
507**/\r
508EFI_STATUS\r
509EFIAPI\r
510XhcControlTransfer (\r
511 IN EFI_USB2_HC_PROTOCOL *This,\r
512 IN UINT8 DeviceAddress,\r
513 IN UINT8 DeviceSpeed,\r
514 IN UINTN MaximumPacketLength,\r
515 IN EFI_USB_DEVICE_REQUEST *Request,\r
516 IN EFI_USB_DATA_DIRECTION TransferDirection,\r
517 IN OUT VOID *Data,\r
518 IN OUT UINTN *DataLength,\r
519 IN UINTN Timeout,\r
520 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
521 OUT UINT32 *TransferResult\r
522 );\r
523\r
524/**\r
525 Submits bulk transfer to a bulk endpoint of a USB device.\r
526\r
527 @param This This EFI_USB2_HC_PROTOCOL instance.\r
528 @param DeviceAddress Target device address.\r
529 @param EndPointAddress Endpoint number and its direction in bit 7.\r
530 @param DeviceSpeed Device speed, Low speed device doesn't support bulk\r
531 transfer.\r
532 @param MaximumPacketLength Maximum packet size the endpoint is capable of\r
533 sending or receiving.\r
534 @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
535 @param Data Array of pointers to the buffers of data to transmit\r
536 from or receive into.\r
537 @param DataLength The lenght of the data buffer.\r
538 @param DataToggle On input, the initial data toggle for the transfer;\r
539 On output, it is updated to to next data toggle to\r
540 use of the subsequent bulk transfer.\r
541 @param Timeout Indicates the maximum time, in millisecond, which\r
542 the transfer is allowed to complete.\r
543 @param Translator A pointr to the transaction translator data.\r
544 @param TransferResult A pointer to the detailed result information of the\r
545 bulk transfer.\r
546\r
547 @retval EFI_SUCCESS The transfer was completed successfully.\r
548 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
549 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
550 @retval EFI_TIMEOUT The transfer failed due to timeout.\r
551 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
552\r
553**/\r
554EFI_STATUS\r
555EFIAPI\r
556XhcBulkTransfer (\r
557 IN EFI_USB2_HC_PROTOCOL *This,\r
558 IN UINT8 DeviceAddress,\r
559 IN UINT8 EndPointAddress,\r
560 IN UINT8 DeviceSpeed,\r
561 IN UINTN MaximumPacketLength,\r
562 IN UINT8 DataBuffersNumber,\r
563 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
564 IN OUT UINTN *DataLength,\r
565 IN OUT UINT8 *DataToggle,\r
566 IN UINTN Timeout,\r
567 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
568 OUT UINT32 *TransferResult\r
569 );\r
570\r
571/**\r
572 Submits an asynchronous interrupt transfer to an\r
573 interrupt endpoint of a USB device.\r
574\r
575 @param This This EFI_USB2_HC_PROTOCOL instance.\r
576 @param DeviceAddress Target device address.\r
577 @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
578 @param DeviceSpeed Indicates device speed.\r
579 @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
580 @param IsNewTransfer If TRUE, to submit an new asynchronous interrupt\r
581 transfer If FALSE, to remove the specified\r
582 asynchronous interrupt.\r
583 @param DataToggle On input, the initial data toggle to use; on output,\r
584 it is updated to indicate the next data toggle.\r
585 @param PollingInterval The he interval, in milliseconds, that the transfer\r
586 is polled.\r
587 @param DataLength The length of data to receive at the rate specified\r
588 by PollingInterval.\r
589 @param Translator Transaction translator to use.\r
590 @param CallBackFunction Function to call at the rate specified by\r
591 PollingInterval.\r
592 @param Context Context to CallBackFunction.\r
593\r
594 @retval EFI_SUCCESS The request has been successfully submitted or canceled.\r
595 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
596 @retval EFI_OUT_OF_RESOURCES The request failed due to a lack of resources.\r
597 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.\r
598\r
599**/\r
600EFI_STATUS\r
601EFIAPI\r
602XhcAsyncInterruptTransfer (\r
603 IN EFI_USB2_HC_PROTOCOL *This,\r
604 IN UINT8 DeviceAddress,\r
605 IN UINT8 EndPointAddress,\r
606 IN UINT8 DeviceSpeed,\r
607 IN UINTN MaximumPacketLength,\r
608 IN BOOLEAN IsNewTransfer,\r
609 IN OUT UINT8 *DataToggle,\r
610 IN UINTN PollingInterval,\r
611 IN UINTN DataLength,\r
612 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
613 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,\r
614 IN VOID *Context OPTIONAL\r
615 );\r
616\r
617/**\r
618 Submits synchronous interrupt transfer to an interrupt endpoint\r
619 of a USB device.\r
620\r
621 @param This This EFI_USB2_HC_PROTOCOL instance.\r
622 @param DeviceAddress Target device address.\r
623 @param EndPointAddress Endpoint number and its direction encoded in bit 7\r
624 @param DeviceSpeed Indicates device speed.\r
625 @param MaximumPacketLength Maximum packet size the target endpoint is capable\r
626 of sending or receiving.\r
627 @param Data Buffer of data that will be transmitted to USB\r
628 device or received from USB device.\r
629 @param DataLength On input, the size, in bytes, of the data buffer; On\r
630 output, the number of bytes transferred.\r
631 @param DataToggle On input, the initial data toggle to use; on output,\r
632 it is updated to indicate the next data toggle.\r
633 @param Timeout Maximum time, in second, to complete.\r
634 @param Translator Transaction translator to use.\r
635 @param TransferResult Variable to receive the transfer result.\r
636\r
637 @return EFI_SUCCESS The transfer was completed successfully.\r
638 @return EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.\r
639 @return EFI_INVALID_PARAMETER Some parameters are invalid.\r
640 @return EFI_TIMEOUT The transfer failed due to timeout.\r
641 @return EFI_DEVICE_ERROR The failed due to host controller or device error\r
642\r
643**/\r
644EFI_STATUS\r
645EFIAPI\r
646XhcSyncInterruptTransfer (\r
647 IN EFI_USB2_HC_PROTOCOL *This,\r
648 IN UINT8 DeviceAddress,\r
649 IN UINT8 EndPointAddress,\r
650 IN UINT8 DeviceSpeed,\r
651 IN UINTN MaximumPacketLength,\r
652 IN OUT VOID *Data,\r
653 IN OUT UINTN *DataLength,\r
654 IN OUT UINT8 *DataToggle,\r
655 IN UINTN Timeout,\r
656 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
657 OUT UINT32 *TransferResult\r
658 );\r
659\r
660/**\r
661 Submits isochronous transfer to a target USB device.\r
662\r
663 @param This This EFI_USB2_HC_PROTOCOL instance.\r
664 @param DeviceAddress Target device address.\r
665 @param EndPointAddress End point address with its direction.\r
666 @param DeviceSpeed Device speed, Low speed device doesn't support this\r
667 type.\r
668 @param MaximumPacketLength Maximum packet size that the endpoint is capable of\r
669 sending or receiving.\r
670 @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
671 @param Data Array of pointers to the buffers of data that will\r
672 be transmitted to USB device or received from USB\r
673 device.\r
674 @param DataLength The size, in bytes, of the data buffer.\r
675 @param Translator Transaction translator to use.\r
676 @param TransferResult Variable to receive the transfer result.\r
677\r
678 @return EFI_UNSUPPORTED Isochronous transfer is unsupported.\r
679\r
680**/\r
681EFI_STATUS\r
682EFIAPI\r
683XhcIsochronousTransfer (\r
684 IN EFI_USB2_HC_PROTOCOL *This,\r
685 IN UINT8 DeviceAddress,\r
686 IN UINT8 EndPointAddress,\r
687 IN UINT8 DeviceSpeed,\r
688 IN UINTN MaximumPacketLength,\r
689 IN UINT8 DataBuffersNumber,\r
690 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
691 IN UINTN DataLength,\r
692 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
693 OUT UINT32 *TransferResult\r
694 );\r
695\r
696/**\r
697 Submits Async isochronous transfer to a target USB device.\r
698\r
699 @param This This EFI_USB2_HC_PROTOCOL instance.\r
700 @param DeviceAddress Target device address.\r
701 @param EndPointAddress End point address with its direction.\r
702 @param DeviceSpeed Device speed, Low speed device doesn't support this\r
703 type.\r
704 @param MaximumPacketLength Maximum packet size that the endpoint is capable of\r
705 sending or receiving.\r
706 @param DataBuffersNumber Number of data buffers prepared for the transfer.\r
707 @param Data Array of pointers to the buffers of data that will\r
708 be transmitted to USB device or received from USB\r
709 device.\r
710 @param DataLength The size, in bytes, of the data buffer.\r
711 @param Translator Transaction translator to use.\r
712 @param IsochronousCallBack Function to be called when the transfer complete.\r
713 @param Context Context passed to the call back function as\r
714 parameter.\r
715\r
716 @return EFI_UNSUPPORTED Isochronous transfer isn't supported.\r
717\r
718**/\r
719EFI_STATUS\r
720EFIAPI\r
721XhcAsyncIsochronousTransfer (\r
722 IN EFI_USB2_HC_PROTOCOL *This,\r
723 IN UINT8 DeviceAddress,\r
724 IN UINT8 EndPointAddress,\r
725 IN UINT8 DeviceSpeed,\r
726 IN UINTN MaximumPacketLength,\r
727 IN UINT8 DataBuffersNumber,\r
728 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
729 IN UINTN DataLength,\r
730 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
731 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
732 IN VOID *Context\r
733 );\r
734\r
92870c98 735#endif\r