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