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