]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
Just like EhciDxe, do not reset host controller when debug capability is enabled...
[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 - 2013, 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
201 struct _USB_XHCI_INSTANCE {
202 UINT32 Signature;
203 EFI_PCI_IO_PROTOCOL *PciIo;
204 UINT64 OriginalPciAttributes;
205 USBHC_MEM_POOL *MemPool;
206
207 EFI_USB2_HC_PROTOCOL Usb2Hc;
208
209 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
210
211 //
212 // ExitBootServicesEvent is used to set OS semaphore and
213 // stop the XHC DMA operation after exit boot service.
214 //
215 EFI_EVENT ExitBootServiceEvent;
216 EFI_EVENT PollTimer;
217 LIST_ENTRY AsyncIntTransfers;
218
219 UINT8 CapLength; ///< Capability Register Length
220 XHC_HCSPARAMS1 HcSParams1; ///< Structural Parameters 1
221 XHC_HCSPARAMS2 HcSParams2; ///< Structural Parameters 2
222 XHC_HCCPARAMS HcCParams; ///< Capability Parameters
223 UINT32 DBOff; ///< Doorbell Offset
224 UINT32 RTSOff; ///< Runtime Register Space Offset
225 UINT16 MaxInterrupt;
226 UINT32 PageSize;
227 UINT64 *ScratchBuf;
228 VOID *ScratchMap;
229 UINT32 MaxScratchpadBufs;
230 UINT64 *ScratchEntry;
231 UINTN *ScratchEntryMap;
232 UINT32 ExtCapRegBase;
233 UINT32 UsbLegSupOffset;
234 UINT32 DebugCapSupOffset;
235 UINT64 *DCBAA;
236 VOID *DCBAAMap;
237 UINT32 MaxSlotsEn;
238 //
239 // Cmd Transfer Ring
240 //
241 TRANSFER_RING CmdRing;
242 //
243 // EventRing
244 //
245 EVENT_RING EventRing;
246 //
247 // Misc
248 //
249 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
250
251 //
252 // Store device contexts managed by XHCI instance
253 // The array supports up to 255 devices, entry 0 is reserved and should not be used.
254 //
255 USB_DEV_CONTEXT UsbDevContext[256];
256 };
257
258
259 extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;
260 extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;
261 extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;
262
263 /**
264 Test to see if this driver supports ControllerHandle. Any
265 ControllerHandle that has Usb2HcProtocol installed will
266 be supported.
267
268 @param This Protocol instance pointer.
269 @param Controller Handle of device to test.
270 @param RemainingDevicePath Not used.
271
272 @return EFI_SUCCESS This driver supports this device.
273 @return EFI_UNSUPPORTED This driver does not support this device.
274
275 **/
276 EFI_STATUS
277 EFIAPI
278 XhcDriverBindingSupported (
279 IN EFI_DRIVER_BINDING_PROTOCOL *This,
280 IN EFI_HANDLE Controller,
281 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
282 );
283
284 /**
285 Starting the Usb XHCI Driver.
286
287 @param This Protocol instance pointer.
288 @param Controller Handle of device to test.
289 @param RemainingDevicePath Not used.
290
291 @return EFI_SUCCESS supports this device.
292 @return EFI_UNSUPPORTED do not support this device.
293 @return EFI_DEVICE_ERROR cannot be started due to device Error.
294 @return EFI_OUT_OF_RESOURCES cannot allocate resources.
295
296 **/
297 EFI_STATUS
298 EFIAPI
299 XhcDriverBindingStart (
300 IN EFI_DRIVER_BINDING_PROTOCOL *This,
301 IN EFI_HANDLE Controller,
302 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
303 );
304
305 /**
306 Stop this driver on ControllerHandle. Support stoping any child handles
307 created by this driver.
308
309 @param This Protocol instance pointer.
310 @param Controller Handle of device to stop driver on.
311 @param NumberOfChildren Number of Children in the ChildHandleBuffer.
312 @param ChildHandleBuffer List of handles for the children we need to stop.
313
314 @return EFI_SUCCESS Success.
315 @return EFI_DEVICE_ERROR Fail.
316
317 **/
318 EFI_STATUS
319 EFIAPI
320 XhcDriverBindingStop (
321 IN EFI_DRIVER_BINDING_PROTOCOL *This,
322 IN EFI_HANDLE Controller,
323 IN UINTN NumberOfChildren,
324 IN EFI_HANDLE *ChildHandleBuffer
325 );
326
327 /**
328 Retrieves the capability of root hub ports.
329
330 @param This The EFI_USB2_HC_PROTOCOL instance.
331 @param MaxSpeed Max speed supported by the controller.
332 @param PortNumber Number of the root hub ports.
333 @param Is64BitCapable Whether the controller supports 64-bit memory
334 addressing.
335
336 @retval EFI_SUCCESS Host controller capability were retrieved successfully.
337 @retval EFI_INVALID_PARAMETER Either of the three capability pointer is NULL.
338
339 **/
340 EFI_STATUS
341 EFIAPI
342 XhcGetCapability (
343 IN EFI_USB2_HC_PROTOCOL *This,
344 OUT UINT8 *MaxSpeed,
345 OUT UINT8 *PortNumber,
346 OUT UINT8 *Is64BitCapable
347 );
348
349 /**
350 Provides software reset for the USB host controller.
351
352 @param This This EFI_USB2_HC_PROTOCOL instance.
353 @param Attributes A bit mask of the reset operation to perform.
354
355 @retval EFI_SUCCESS The reset operation succeeded.
356 @retval EFI_INVALID_PARAMETER Attributes is not valid.
357 @retval EFI_UNSUPPOURTED The type of reset specified by Attributes is
358 not currently supported by the host controller.
359 @retval EFI_DEVICE_ERROR Host controller isn't halted to reset.
360
361 **/
362 EFI_STATUS
363 EFIAPI
364 XhcReset (
365 IN EFI_USB2_HC_PROTOCOL *This,
366 IN UINT16 Attributes
367 );
368
369 /**
370 Retrieve the current state of the USB host controller.
371
372 @param This This EFI_USB2_HC_PROTOCOL instance.
373 @param State Variable to return the current host controller
374 state.
375
376 @retval EFI_SUCCESS Host controller state was returned in State.
377 @retval EFI_INVALID_PARAMETER State is NULL.
378 @retval EFI_DEVICE_ERROR An error was encountered while attempting to
379 retrieve the host controller's current state.
380
381 **/
382 EFI_STATUS
383 EFIAPI
384 XhcGetState (
385 IN EFI_USB2_HC_PROTOCOL *This,
386 OUT EFI_USB_HC_STATE *State
387 );
388
389 /**
390 Sets the USB host controller to a specific state.
391
392 @param This This EFI_USB2_HC_PROTOCOL instance.
393 @param State The state of the host controller that will be set.
394
395 @retval EFI_SUCCESS The USB host controller was successfully placed
396 in the state specified by State.
397 @retval EFI_INVALID_PARAMETER State is invalid.
398 @retval EFI_DEVICE_ERROR Failed to set the state due to device error.
399
400 **/
401 EFI_STATUS
402 EFIAPI
403 XhcSetState (
404 IN EFI_USB2_HC_PROTOCOL *This,
405 IN EFI_USB_HC_STATE State
406 );
407
408 /**
409 Retrieves the current status of a USB root hub port.
410
411 @param This This EFI_USB2_HC_PROTOCOL instance.
412 @param PortNumber The root hub port to retrieve the state from.
413 This value is zero-based.
414 @param PortStatus Variable to receive the port state.
415
416 @retval EFI_SUCCESS The status of the USB root hub port specified.
417 by PortNumber was returned in PortStatus.
418 @retval EFI_INVALID_PARAMETER PortNumber is invalid.
419 @retval EFI_DEVICE_ERROR Can't read register.
420
421 **/
422 EFI_STATUS
423 EFIAPI
424 XhcGetRootHubPortStatus (
425 IN EFI_USB2_HC_PROTOCOL *This,
426 IN UINT8 PortNumber,
427 OUT EFI_USB_PORT_STATUS *PortStatus
428 );
429
430 /**
431 Sets a feature for the specified root hub port.
432
433 @param This This EFI_USB2_HC_PROTOCOL instance.
434 @param PortNumber Root hub port to set.
435 @param PortFeature Feature to set.
436
437 @retval EFI_SUCCESS The feature specified by PortFeature was set.
438 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
439 @retval EFI_DEVICE_ERROR Can't read register.
440
441 **/
442 EFI_STATUS
443 EFIAPI
444 XhcSetRootHubPortFeature (
445 IN EFI_USB2_HC_PROTOCOL *This,
446 IN UINT8 PortNumber,
447 IN EFI_USB_PORT_FEATURE PortFeature
448 );
449
450 /**
451 Clears a feature for the specified root hub port.
452
453 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
454 @param PortNumber Specifies the root hub port whose feature is
455 requested to be cleared.
456 @param PortFeature Indicates the feature selector associated with the
457 feature clear request.
458
459 @retval EFI_SUCCESS The feature specified by PortFeature was cleared
460 for the USB root hub port specified by PortNumber.
461 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.
462 @retval EFI_DEVICE_ERROR Can't read register.
463
464 **/
465 EFI_STATUS
466 EFIAPI
467 XhcClearRootHubPortFeature (
468 IN EFI_USB2_HC_PROTOCOL *This,
469 IN UINT8 PortNumber,
470 IN EFI_USB_PORT_FEATURE PortFeature
471 );
472
473 /**
474 Submits control transfer to a target USB device.
475
476 @param This This EFI_USB2_HC_PROTOCOL instance.
477 @param DeviceAddress The target device address.
478 @param DeviceSpeed Target device speed.
479 @param MaximumPacketLength Maximum packet size the default control transfer
480 endpoint is capable of sending or receiving.
481 @param Request USB device request to send.
482 @param TransferDirection Specifies the data direction for the data stage
483 @param Data Data buffer to be transmitted or received from USB
484 device.
485 @param DataLength The size (in bytes) of the data buffer.
486 @param Timeout Indicates the maximum timeout, in millisecond.
487 @param Translator Transaction translator to be used by this device.
488 @param TransferResult Return the result of this control transfer.
489
490 @retval EFI_SUCCESS Transfer was completed successfully.
491 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resources.
492 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
493 @retval EFI_TIMEOUT Transfer failed due to timeout.
494 @retval EFI_DEVICE_ERROR Transfer failed due to host controller or device error.
495
496 **/
497 EFI_STATUS
498 EFIAPI
499 XhcControlTransfer (
500 IN EFI_USB2_HC_PROTOCOL *This,
501 IN UINT8 DeviceAddress,
502 IN UINT8 DeviceSpeed,
503 IN UINTN MaximumPacketLength,
504 IN EFI_USB_DEVICE_REQUEST *Request,
505 IN EFI_USB_DATA_DIRECTION TransferDirection,
506 IN OUT VOID *Data,
507 IN OUT UINTN *DataLength,
508 IN UINTN Timeout,
509 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
510 OUT UINT32 *TransferResult
511 );
512
513 /**
514 Submits bulk transfer to a bulk endpoint of a USB device.
515
516 @param This This EFI_USB2_HC_PROTOCOL instance.
517 @param DeviceAddress Target device address.
518 @param EndPointAddress Endpoint number and its direction in bit 7.
519 @param DeviceSpeed Device speed, Low speed device doesn't support bulk
520 transfer.
521 @param MaximumPacketLength Maximum packet size the endpoint is capable of
522 sending or receiving.
523 @param DataBuffersNumber Number of data buffers prepared for the transfer.
524 @param Data Array of pointers to the buffers of data to transmit
525 from or receive into.
526 @param DataLength The lenght of the data buffer.
527 @param DataToggle On input, the initial data toggle for the transfer;
528 On output, it is updated to to next data toggle to
529 use of the subsequent bulk transfer.
530 @param Timeout Indicates the maximum time, in millisecond, which
531 the transfer is allowed to complete.
532 @param Translator A pointr to the transaction translator data.
533 @param TransferResult A pointer to the detailed result information of the
534 bulk transfer.
535
536 @retval EFI_SUCCESS The transfer was completed successfully.
537 @retval EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
538 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
539 @retval EFI_TIMEOUT The transfer failed due to timeout.
540 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
541
542 **/
543 EFI_STATUS
544 EFIAPI
545 XhcBulkTransfer (
546 IN EFI_USB2_HC_PROTOCOL *This,
547 IN UINT8 DeviceAddress,
548 IN UINT8 EndPointAddress,
549 IN UINT8 DeviceSpeed,
550 IN UINTN MaximumPacketLength,
551 IN UINT8 DataBuffersNumber,
552 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
553 IN OUT UINTN *DataLength,
554 IN OUT UINT8 *DataToggle,
555 IN UINTN Timeout,
556 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
557 OUT UINT32 *TransferResult
558 );
559
560 /**
561 Submits an asynchronous interrupt transfer to an
562 interrupt endpoint of a USB device.
563
564 @param This This EFI_USB2_HC_PROTOCOL instance.
565 @param DeviceAddress Target device address.
566 @param EndPointAddress Endpoint number and its direction encoded in bit 7
567 @param DeviceSpeed Indicates device speed.
568 @param MaximumPacketLength Maximum packet size the target endpoint is capable
569 @param IsNewTransfer If TRUE, to submit an new asynchronous interrupt
570 transfer If FALSE, to remove the specified
571 asynchronous interrupt.
572 @param DataToggle On input, the initial data toggle to use; on output,
573 it is updated to indicate the next data toggle.
574 @param PollingInterval The he interval, in milliseconds, that the transfer
575 is polled.
576 @param DataLength The length of data to receive at the rate specified
577 by PollingInterval.
578 @param Translator Transaction translator to use.
579 @param CallBackFunction Function to call at the rate specified by
580 PollingInterval.
581 @param Context Context to CallBackFunction.
582
583 @retval EFI_SUCCESS The request has been successfully submitted or canceled.
584 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
585 @retval EFI_OUT_OF_RESOURCES The request failed due to a lack of resources.
586 @retval EFI_DEVICE_ERROR The transfer failed due to host controller error.
587
588 **/
589 EFI_STATUS
590 EFIAPI
591 XhcAsyncInterruptTransfer (
592 IN EFI_USB2_HC_PROTOCOL *This,
593 IN UINT8 DeviceAddress,
594 IN UINT8 EndPointAddress,
595 IN UINT8 DeviceSpeed,
596 IN UINTN MaximumPacketLength,
597 IN BOOLEAN IsNewTransfer,
598 IN OUT UINT8 *DataToggle,
599 IN UINTN PollingInterval,
600 IN UINTN DataLength,
601 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
602 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,
603 IN VOID *Context OPTIONAL
604 );
605
606 /**
607 Submits synchronous interrupt transfer to an interrupt endpoint
608 of a USB device.
609
610 @param This This EFI_USB2_HC_PROTOCOL instance.
611 @param DeviceAddress Target device address.
612 @param EndPointAddress Endpoint number and its direction encoded in bit 7
613 @param DeviceSpeed Indicates device speed.
614 @param MaximumPacketLength Maximum packet size the target endpoint is capable
615 of sending or receiving.
616 @param Data Buffer of data that will be transmitted to USB
617 device or received from USB device.
618 @param DataLength On input, the size, in bytes, of the data buffer; On
619 output, the number of bytes transferred.
620 @param DataToggle On input, the initial data toggle to use; on output,
621 it is updated to indicate the next data toggle.
622 @param Timeout Maximum time, in second, to complete.
623 @param Translator Transaction translator to use.
624 @param TransferResult Variable to receive the transfer result.
625
626 @return EFI_SUCCESS The transfer was completed successfully.
627 @return EFI_OUT_OF_RESOURCES The transfer failed due to lack of resource.
628 @return EFI_INVALID_PARAMETER Some parameters are invalid.
629 @return EFI_TIMEOUT The transfer failed due to timeout.
630 @return EFI_DEVICE_ERROR The failed due to host controller or device error
631
632 **/
633 EFI_STATUS
634 EFIAPI
635 XhcSyncInterruptTransfer (
636 IN EFI_USB2_HC_PROTOCOL *This,
637 IN UINT8 DeviceAddress,
638 IN UINT8 EndPointAddress,
639 IN UINT8 DeviceSpeed,
640 IN UINTN MaximumPacketLength,
641 IN OUT VOID *Data,
642 IN OUT UINTN *DataLength,
643 IN OUT UINT8 *DataToggle,
644 IN UINTN Timeout,
645 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
646 OUT UINT32 *TransferResult
647 );
648
649 /**
650 Submits isochronous transfer to a target USB device.
651
652 @param This This EFI_USB2_HC_PROTOCOL instance.
653 @param DeviceAddress Target device address.
654 @param EndPointAddress End point address with its direction.
655 @param DeviceSpeed Device speed, Low speed device doesn't support this
656 type.
657 @param MaximumPacketLength Maximum packet size that the endpoint is capable of
658 sending or receiving.
659 @param DataBuffersNumber Number of data buffers prepared for the transfer.
660 @param Data Array of pointers to the buffers of data that will
661 be transmitted to USB device or received from USB
662 device.
663 @param DataLength The size, in bytes, of the data buffer.
664 @param Translator Transaction translator to use.
665 @param TransferResult Variable to receive the transfer result.
666
667 @return EFI_UNSUPPORTED Isochronous transfer is unsupported.
668
669 **/
670 EFI_STATUS
671 EFIAPI
672 XhcIsochronousTransfer (
673 IN EFI_USB2_HC_PROTOCOL *This,
674 IN UINT8 DeviceAddress,
675 IN UINT8 EndPointAddress,
676 IN UINT8 DeviceSpeed,
677 IN UINTN MaximumPacketLength,
678 IN UINT8 DataBuffersNumber,
679 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
680 IN UINTN DataLength,
681 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
682 OUT UINT32 *TransferResult
683 );
684
685 /**
686 Submits Async isochronous transfer to a target USB device.
687
688 @param This This EFI_USB2_HC_PROTOCOL instance.
689 @param DeviceAddress Target device address.
690 @param EndPointAddress End point address with its direction.
691 @param DeviceSpeed Device speed, Low speed device doesn't support this
692 type.
693 @param MaximumPacketLength Maximum packet size that the endpoint is capable of
694 sending or receiving.
695 @param DataBuffersNumber Number of data buffers prepared for the transfer.
696 @param Data Array of pointers to the buffers of data that will
697 be transmitted to USB device or received from USB
698 device.
699 @param DataLength The size, in bytes, of the data buffer.
700 @param Translator Transaction translator to use.
701 @param IsochronousCallBack Function to be called when the transfer complete.
702 @param Context Context passed to the call back function as
703 parameter.
704
705 @return EFI_UNSUPPORTED Isochronous transfer isn't supported.
706
707 **/
708 EFI_STATUS
709 EFIAPI
710 XhcAsyncIsochronousTransfer (
711 IN EFI_USB2_HC_PROTOCOL *This,
712 IN UINT8 DeviceAddress,
713 IN UINT8 EndPointAddress,
714 IN UINT8 DeviceSpeed,
715 IN UINTN MaximumPacketLength,
716 IN UINT8 DataBuffersNumber,
717 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
718 IN UINTN DataLength,
719 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
720 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
721 IN VOID *Context
722 );
723
724 #endif