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