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