]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/XhciDxe/Xhci.h
Restore the correct cursor status after finish creating the dialog.
[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
234 UINT64 *DCBAA;\r
1847ed0b 235 VOID *DCBAAMap;\r
92870c98 236 UINT32 MaxSlotsEn;\r
237 //\r
238 // Cmd Transfer Ring\r
239 //\r
240 TRANSFER_RING CmdRing;\r
241 //\r
6b4483cd 242 // EventRing\r
92870c98 243 //\r
6b4483cd 244 EVENT_RING EventRing;\r
92870c98 245 //\r
246 // Misc\r
247 //\r
248 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
249\r
92870c98 250 //\r
a9292c13 251 // Store device contexts managed by XHCI instance\r
252 // The array supports up to 255 devices, entry 0 is reserved and should not be used.\r
92870c98 253 //\r
a9292c13 254 USB_DEV_CONTEXT UsbDevContext[256];\r
92870c98 255};\r
256\r
a9292c13 257\r
92870c98 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
278 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
279 IN EFI_HANDLE Controller,\r
280 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
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
299 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
300 IN EFI_HANDLE Controller,\r
301 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
302 );\r
303\r
304/**\r
305 Stop this driver on ControllerHandle. Support stoping any child handles\r
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
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
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