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