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