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