]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
MdeModulePkg XhciDxe: XHCI multiple interface alternate setting support.
[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 - 2014, 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 // Convert millisecond to microsecond.
51 //
52 #define XHC_1_MILLISECOND (1000)
53 //
54 // XHC generic timeout experience values.
55 // The unit is microsecond, setting it as 10ms.
56 //
57 #define XHC_GENERIC_TIMEOUT (10 * 1000)
58 //
59 // XHC reset timeout experience values.
60 // The unit is microsecond, setting it as 1s.
61 //
62 #define XHC_RESET_TIMEOUT (1000 * 1000)
63 //
64 // XHC delay experience value for polling operation.
65 // The unit is microsecond, set it as 1ms.
66 //
67 #define XHC_POLL_DELAY (1000)
68 //
69 // XHC async transfer timer interval, set by experience.
70 // The unit is 100us, takes 50ms as interval.
71 //
72 #define XHC_ASYNC_TIMER_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(50)
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 doule 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
266
267 extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;
268 extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;
269 extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;
270
271 /**
272 Test to see if this driver supports ControllerHandle. Any
273 ControllerHandle that has Usb2HcProtocol installed will
274 be supported.
275
276 @param This Protocol instance pointer.
277 @param Controller Handle of device to test.
278 @param RemainingDevicePath Not used.
279
280 @return EFI_SUCCESS This driver supports this device.
281 @return EFI_UNSUPPORTED This driver does not support this device.
282
283 **/
284 EFI_STATUS
285 EFIAPI
286 XhcDriverBindingSupported (
287 IN EFI_DRIVER_BINDING_PROTOCOL *This,
288 IN EFI_HANDLE Controller,
289 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
290 );
291
292 /**
293 Starting the Usb XHCI Driver.
294
295 @param This Protocol instance pointer.
296 @param Controller Handle of device to test.
297 @param RemainingDevicePath Not used.
298
299 @return EFI_SUCCESS supports this device.
300 @return EFI_UNSUPPORTED do not support this device.
301 @return EFI_DEVICE_ERROR cannot be started due to device Error.
302 @return EFI_OUT_OF_RESOURCES cannot allocate resources.
303
304 **/
305 EFI_STATUS
306 EFIAPI
307 XhcDriverBindingStart (
308 IN EFI_DRIVER_BINDING_PROTOCOL *This,
309 IN EFI_HANDLE Controller,
310 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
311 );
312
313 /**
314 Stop this driver on ControllerHandle. Support stoping any child handles
315 created by this driver.
316
317 @param This Protocol instance pointer.
318 @param Controller Handle of device to stop driver on.
319 @param NumberOfChildren Number of Children in the ChildHandleBuffer.
320 @param ChildHandleBuffer List of handles for the children we need to stop.
321
322 @return EFI_SUCCESS Success.
323 @return EFI_DEVICE_ERROR Fail.
324
325 **/
326 EFI_STATUS
327 EFIAPI
328 XhcDriverBindingStop (
329 IN EFI_DRIVER_BINDING_PROTOCOL *This,
330 IN EFI_HANDLE Controller,
331 IN UINTN NumberOfChildren,
332 IN EFI_HANDLE *ChildHandleBuffer
333 );
334
335 /**
336 Retrieves the capability of root hub ports.
337
338 @param This The EFI_USB2_HC_PROTOCOL instance.
339 @param MaxSpeed Max speed supported by the controller.
340 @param PortNumber Number of the root hub ports.
341 @param Is64BitCapable Whether the controller supports 64-bit memory
342 addressing.
343
344 @retval EFI_SUCCESS Host controller capability were retrieved successfully.
345 @retval EFI_INVALID_PARAMETER Either of the three capability pointer is NULL.
346
347 **/
348 EFI_STATUS
349 EFIAPI
350 XhcGetCapability (
351 IN EFI_USB2_HC_PROTOCOL *This,
352 OUT UINT8 *MaxSpeed,
353 OUT UINT8 *PortNumber,
354 OUT UINT8 *Is64BitCapable
355 );
356
357 /**
358 Provides software reset for the USB host controller.
359
360 @param This This EFI_USB2_HC_PROTOCOL instance.
361 @param Attributes A bit mask of the reset operation to perform.
362
363 @retval EFI_SUCCESS The reset operation succeeded.
364 @retval EFI_INVALID_PARAMETER Attributes is not valid.
365 @retval EFI_UNSUPPOURTED The type of reset specified by Attributes is
366 not currently supported by the host controller.
367 @retval EFI_DEVICE_ERROR Host controller isn't halted to reset.
368
369 **/
370 EFI_STATUS
371 EFIAPI
372 XhcReset (
373 IN EFI_USB2_HC_PROTOCOL *This,
374 IN UINT16 Attributes
375 );
376
377 /**
378 Retrieve the current state of the USB host controller.
379
380 @param This This EFI_USB2_HC_PROTOCOL instance.
381 @param State Variable to return the current host controller
382 state.
383
384 @retval EFI_SUCCESS Host controller state was returned in State.
385 @retval EFI_INVALID_PARAMETER State is NULL.
386 @retval EFI_DEVICE_ERROR An error was encountered while attempting to
387 retrieve the host controller's current state.
388
389 **/
390 EFI_STATUS
391 EFIAPI
392 XhcGetState (
393 IN EFI_USB2_HC_PROTOCOL *This,
394 OUT EFI_USB_HC_STATE *State
395 );
396
397 /**
398 Sets the USB host controller to a specific state.
399
400 @param This This EFI_USB2_HC_PROTOCOL instance.
401 @param State The state of the host controller that will be set.
402
403 @retval EFI_SUCCESS The USB host controller was successfully placed
404 in the state specified by State.
405 @retval EFI_INVALID_PARAMETER State is invalid.
406 @retval EFI_DEVICE_ERROR Failed to set the state due to device error.
407
408 **/
409 EFI_STATUS
410 EFIAPI
411 XhcSetState (
412 IN EFI_USB2_HC_PROTOCOL *This,
413 IN EFI_USB_HC_STATE State
414 );
415
416 /**
417 Retrieves the current status of a USB root hub port.
418
419 @param This This EFI_USB2_HC_PROTOCOL instance.
420 @param PortNumber The root hub port to retrieve the state from.
421 This value is zero-based.
422 @param PortStatus Variable to receive the port state.
423
424 @retval EFI_SUCCESS The status of the USB root hub port specified.
425 by PortNumber was returned in PortStatus.
426 @retval EFI_INVALID_PARAMETER PortNumber is invalid.
427 @retval EFI_DEVICE_ERROR Can't read register.
428
429 **/
430 EFI_STATUS
431 EFIAPI
432 XhcGetRootHubPortStatus (
433 IN EFI_USB2_HC_PROTOCOL *This,
434 IN UINT8 PortNumber,
435 OUT EFI_USB_PORT_STATUS *PortStatus
436 );
437
438 /**
439 Sets a feature for the specified root hub port.
440
441 @param This This EFI_USB2_HC_PROTOCOL instance.
442 @param PortNumber Root hub port to set.
443 @param PortFeature Feature to set.
444
445 @retval EFI_SUCCESS The feature specified by PortFeature was set.
446 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
447 @retval EFI_DEVICE_ERROR Can't read register.
448
449 **/
450 EFI_STATUS
451 EFIAPI
452 XhcSetRootHubPortFeature (
453 IN EFI_USB2_HC_PROTOCOL *This,
454 IN UINT8 PortNumber,
455 IN EFI_USB_PORT_FEATURE PortFeature
456 );
457
458 /**
459 Clears a feature for the specified root hub port.
460
461 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
462 @param PortNumber Specifies the root hub port whose feature is
463 requested to be cleared.
464 @param PortFeature Indicates the feature selector associated with the
465 feature clear request.
466
467 @retval EFI_SUCCESS The feature specified by PortFeature was cleared
468 for the USB root hub port specified by PortNumber.
469 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
470 @retval EFI_DEVICE_ERROR Can't read register.
471
472 **/
473 EFI_STATUS
474 EFIAPI
475 XhcClearRootHubPortFeature (
476 IN EFI_USB2_HC_PROTOCOL *This,
477 IN UINT8 PortNumber,
478 IN EFI_USB_PORT_FEATURE PortFeature
479 );
480
481 /**
482 Submits control transfer to a target USB device.
483
484 @param This This EFI_USB2_HC_PROTOCOL instance.
485 @param DeviceAddress The target device address.
486 @param DeviceSpeed Target device speed.
487 @param MaximumPacketLength Maximum packet size the default control transfer
488 endpoint is capable of sending or receiving.
489 @param Request USB device request to send.
490 @param TransferDirection Specifies the data direction for the data stage
491 @param Data Data buffer to be transmitted or received from USB
492 device.
493 @param DataLength The size (in bytes) of the data buffer.
494 @param Timeout Indicates the maximum timeout, in millisecond.
495 @param Translator Transaction translator to be used by this device.
496 @param TransferResult Return the result of this control transfer.
497
498 @retval EFI_SUCCESS Transfer was completed successfully.
499 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.
500 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
501 @retval EFI_TIMEOUT Transfer failed due to timeout.
502 @retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.
503
504 **/
505 EFI_STATUS
506 EFIAPI
507 XhcControlTransfer (
508 IN EFI_USB2_HC_PROTOCOL *This,
509 IN UINT8 DeviceAddress,
510 IN UINT8 DeviceSpeed,
511 IN UINTN MaximumPacketLength,
512 IN EFI_USB_DEVICE_REQUEST *Request,
513 IN EFI_USB_DATA_DIRECTION TransferDirection,
514 IN OUT VOID *Data,
515 IN OUT UINTN *DataLength,
516 IN UINTN Timeout,
517 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
518 OUT UINT32 *TransferResult
519 );
520
521 /**
522 Submits bulk transfer to a bulk endpoint of a USB device.
523
524 @param This This EFI_USB2_HC_PROTOCOL instance.
525 @param DeviceAddress Target device address.
526 @param EndPointAddress Endpoint number and its direction in bit 7.
527 @param DeviceSpeed Device speed, Low speed device doesn't support bulk
528 transfer.
529 @param MaximumPacketLength Maximum packet size the endpoint is capable of
530 sending or receiving.
531 @param DataBuffersNumber Number of data buffers prepared for the transfer.
532 @param Data Array of pointers to the buffers of data to transmit
533 from or receive into.
534 @param DataLength The lenght of the data buffer.
535 @param DataToggle On input, the initial data toggle for the transfer;
536 On output, it is updated to to next data toggle to
537 use of the subsequent bulk transfer.
538 @param Timeout Indicates the maximum time, in millisecond, which
539 the transfer is allowed to complete.
540 @param Translator A pointr to the transaction translator data.
541 @param TransferResult A pointer to the detailed result information of the
542 bulk transfer.
543
544 @retval EFI_SUCCESS The transfer was completed successfully.
545 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
546 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
547 @retval EFI_TIMEOUT The transfer failed due to timeout.
548 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
549
550 **/
551 EFI_STATUS
552 EFIAPI
553 XhcBulkTransfer (
554 IN EFI_USB2_HC_PROTOCOL *This,
555 IN UINT8 DeviceAddress,
556 IN UINT8 EndPointAddress,
557 IN UINT8 DeviceSpeed,
558 IN UINTN MaximumPacketLength,
559 IN UINT8 DataBuffersNumber,
560 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
561 IN OUT UINTN *DataLength,
562 IN OUT UINT8 *DataToggle,
563 IN UINTN Timeout,
564 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
565 OUT UINT32 *TransferResult
566 );
567
568 /**
569 Submits an asynchronous interrupt transfer to an
570 interrupt endpoint of a USB device.
571
572 @param This This EFI_USB2_HC_PROTOCOL instance.
573 @param DeviceAddress Target device address.
574 @param EndPointAddress Endpoint number and its direction encoded in bit 7
575 @param DeviceSpeed Indicates device speed.
576 @param MaximumPacketLength Maximum packet size the target endpoint is capable
577 @param IsNewTransfer If TRUE, to submit an new asynchronous interrupt
578 transfer If FALSE, to remove the specified
579 asynchronous interrupt.
580 @param DataToggle On input, the initial data toggle to use; on output,
581 it is updated to indicate the next data toggle.
582 @param PollingInterval The he interval, in milliseconds, that the transfer
583 is polled.
584 @param DataLength The length of data to receive at the rate specified
585 by PollingInterval.
586 @param Translator Transaction translator to use.
587 @param CallBackFunction Function to call at the rate specified by
588 PollingInterval.
589 @param Context Context to CallBackFunction.
590
591 @retval EFI_SUCCESS The request has been successfully submitted or canceled.
592 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
593 @retval EFI_OUT_OF_RESOURCES The request failed due to a lack of resources.
594 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
595
596 **/
597 EFI_STATUS
598 EFIAPI
599 XhcAsyncInterruptTransfer (
600 IN EFI_USB2_HC_PROTOCOL *This,
601 IN UINT8 DeviceAddress,
602 IN UINT8 EndPointAddress,
603 IN UINT8 DeviceSpeed,
604 IN UINTN MaximumPacketLength,
605 IN BOOLEAN IsNewTransfer,
606 IN OUT UINT8 *DataToggle,
607 IN UINTN PollingInterval,
608 IN UINTN DataLength,
609 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
610 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
611 IN VOID *Context OPTIONAL
612 );
613
614 /**
615 Submits synchronous interrupt transfer to an interrupt endpoint
616 of a USB device.
617
618 @param This This EFI_USB2_HC_PROTOCOL instance.
619 @param DeviceAddress Target device address.
620 @param EndPointAddress Endpoint number and its direction encoded in bit 7
621 @param DeviceSpeed Indicates device speed.
622 @param MaximumPacketLength Maximum packet size the target endpoint is capable
623 of sending or receiving.
624 @param Data Buffer of data that will be transmitted to USB
625 device or received from USB device.
626 @param DataLength On input, the size, in bytes, of the data buffer; On
627 output, the number of bytes transferred.
628 @param DataToggle On input, the initial data toggle to use; on output,
629 it is updated to indicate the next data toggle.
630 @param Timeout Maximum time, in second, to complete.
631 @param Translator Transaction translator to use.
632 @param TransferResult Variable to receive the transfer result.
633
634 @return EFI_SUCCESS The transfer was completed successfully.
635 @return EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
636 @return EFI_INVALID_PARAMETER Some parameters are invalid.
637 @return EFI_TIMEOUT The transfer failed due to timeout.
638 @return EFI_DEVICE_ERROR The failed due to host controller or device error
639
640 **/
641 EFI_STATUS
642 EFIAPI
643 XhcSyncInterruptTransfer (
644 IN EFI_USB2_HC_PROTOCOL *This,
645 IN UINT8 DeviceAddress,
646 IN UINT8 EndPointAddress,
647 IN UINT8 DeviceSpeed,
648 IN UINTN MaximumPacketLength,
649 IN OUT VOID *Data,
650 IN OUT UINTN *DataLength,
651 IN OUT UINT8 *DataToggle,
652 IN UINTN Timeout,
653 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
654 OUT UINT32 *TransferResult
655 );
656
657 /**
658 Submits isochronous transfer to a target USB device.
659
660 @param This This EFI_USB2_HC_PROTOCOL instance.
661 @param DeviceAddress Target device address.
662 @param EndPointAddress End point address with its direction.
663 @param DeviceSpeed Device speed, Low speed device doesn't support this
664 type.
665 @param MaximumPacketLength Maximum packet size that the endpoint is capable of
666 sending or receiving.
667 @param DataBuffersNumber Number of data buffers prepared for the transfer.
668 @param Data Array of pointers to the buffers of data that will
669 be transmitted to USB device or received from USB
670 device.
671 @param DataLength The size, in bytes, of the data buffer.
672 @param Translator Transaction translator to use.
673 @param TransferResult Variable to receive the transfer result.
674
675 @return EFI_UNSUPPORTED Isochronous transfer is unsupported.
676
677 **/
678 EFI_STATUS
679 EFIAPI
680 XhcIsochronousTransfer (
681 IN EFI_USB2_HC_PROTOCOL *This,
682 IN UINT8 DeviceAddress,
683 IN UINT8 EndPointAddress,
684 IN UINT8 DeviceSpeed,
685 IN UINTN MaximumPacketLength,
686 IN UINT8 DataBuffersNumber,
687 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
688 IN UINTN DataLength,
689 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
690 OUT UINT32 *TransferResult
691 );
692
693 /**
694 Submits Async isochronous transfer to a target USB device.
695
696 @param This This EFI_USB2_HC_PROTOCOL instance.
697 @param DeviceAddress Target device address.
698 @param EndPointAddress End point address with its direction.
699 @param DeviceSpeed Device speed, Low speed device doesn't support this
700 type.
701 @param MaximumPacketLength Maximum packet size that the endpoint is capable of
702 sending or receiving.
703 @param DataBuffersNumber Number of data buffers prepared for the transfer.
704 @param Data Array of pointers to the buffers of data that will
705 be transmitted to USB device or received from USB
706 device.
707 @param DataLength The size, in bytes, of the data buffer.
708 @param Translator Transaction translator to use.
709 @param IsochronousCallBack Function to be called when the transfer complete.
710 @param Context Context passed to the call back function as
711 parameter.
712
713 @return EFI_UNSUPPORTED Isochronous transfer isn't supported.
714
715 **/
716 EFI_STATUS
717 EFIAPI
718 XhcAsyncIsochronousTransfer (
719 IN EFI_USB2_HC_PROTOCOL *This,
720 IN UINT8 DeviceAddress,
721 IN UINT8 EndPointAddress,
722 IN UINT8 DeviceSpeed,
723 IN UINTN MaximumPacketLength,
724 IN UINT8 DataBuffersNumber,
725 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
726 IN UINTN DataLength,
727 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
728 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
729 IN VOID *Context
730 );
731
732 #endif