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