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