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