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