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