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