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