]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
UefiCpuPkg/PiSmmCpu: Correct exception message.
[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
ed356b9e 87// Iterate through the double linked list. This is delete-safe.\r
92870c98 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
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