]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbBus.h
CommitLineData
e237e7ae 1/** @file\r
8616fc4c 2\r
3 Usb Bus Driver Binding and Bus IO Protocol.\r
4\r
d1102dba 5Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
e237e7ae 7\r
e237e7ae 8**/\r
9\r
10#ifndef _EFI_USB_BUS_H_\r
11#define _EFI_USB_BUS_H_\r
12\r
60c93673 13#include <Uefi.h>\r
ed7748fe 14\r
e237e7ae 15#include <Protocol/Usb2HostController.h>\r
16#include <Protocol/UsbHostController.h>\r
17#include <Protocol/UsbIo.h>\r
18#include <Protocol/DevicePath.h>\r
ed7748fe 19\r
77442a5a 20#include <Library/BaseLib.h>\r
e237e7ae 21#include <Library/DebugLib.h>\r
22#include <Library/BaseMemoryLib.h>\r
23#include <Library/UefiDriverEntryPoint.h>\r
24#include <Library/UefiBootServicesTableLib.h>\r
25#include <Library/UefiLib.h>\r
26#include <Library/DevicePathLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
3d0a2385 28#include <Library/ReportStatusCodeLib.h>\r
e237e7ae 29\r
e237e7ae 30#include <IndustryStandard/Usb.h>\r
31\r
32typedef struct _USB_DEVICE USB_DEVICE;\r
33typedef struct _USB_INTERFACE USB_INTERFACE;\r
34typedef struct _USB_BUS USB_BUS;\r
35typedef struct _USB_HUB_API USB_HUB_API;\r
36\r
e237e7ae 37#include "UsbUtility.h"\r
38#include "UsbDesc.h"\r
39#include "UsbHub.h"\r
40#include "UsbEnumer.h"\r
41\r
1ccdbf2a 42//\r
43// USB bus timeout experience values\r
44//\r
45\r
1436aea4
MK
46#define USB_MAX_LANG_ID 16\r
47#define USB_MAX_INTERFACE 16\r
48#define USB_MAX_DEVICES 128\r
1ccdbf2a 49\r
1436aea4 50#define USB_BUS_1_MILLISECOND 1000\r
1ccdbf2a 51\r
52//\r
53// Roothub and hub's polling interval, set by experience,\r
c843ef67 54// The unit of roothub is 100us, means 100ms as interval, and\r
1ccdbf2a 55// the unit of hub is 1ms, means 64ms as interval.\r
56//\r
1436aea4
MK
57#define USB_ROOTHUB_POLL_INTERVAL (100 * 10000U)\r
58#define USB_HUB_POLL_INTERVAL 64\r
1ccdbf2a 59\r
60//\r
61// Wait for port stable to work, refers to specification\r
62// [USB20-9.1.2]\r
63//\r
64#define USB_WAIT_PORT_STABLE_STALL (100 * USB_BUS_1_MILLISECOND)\r
65\r
66//\r
67// Wait for port statue reg change, set by experience\r
68//\r
1436aea4 69#define USB_WAIT_PORT_STS_CHANGE_STALL (100)\r
1ccdbf2a 70\r
71//\r
72// Wait for set device address, refers to specification\r
73// [USB20-9.2.6.3, it says 2ms]\r
74//\r
1436aea4 75#define USB_SET_DEVICE_ADDRESS_STALL (2 * USB_BUS_1_MILLISECOND)\r
1ccdbf2a 76\r
77//\r
78// Wait for retry max packet size, set by experience\r
79//\r
80#define USB_RETRY_MAX_PACK_SIZE_STALL (100 * USB_BUS_1_MILLISECOND)\r
81\r
82//\r
83// Wait for hub port power-on, refers to specification\r
84// [USB20-11.23.2]\r
85//\r
1436aea4 86#define USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND)\r
1ccdbf2a 87\r
88//\r
89// Wait for port reset, refers to specification\r
90// [USB20-7.1.7.5, it says 10ms for hub and 50ms for\r
91// root hub]\r
92//\r
71619ac2 93// According to USB2.0, Chapter 11.5.1.5 Resetting,\r
94// the worst case for TDRST is 20ms\r
95//\r
96#define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)\r
1ccdbf2a 97#define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND)\r
98\r
71619ac2 99//\r
100// Wait for port recovery to accept SetAddress, refers to specification\r
101// [USB20-7.1.7.5, it says 10 ms for TRSTRCY]\r
102//\r
1436aea4 103#define USB_SET_PORT_RECOVERY_STALL (10 * USB_BUS_1_MILLISECOND)\r
71619ac2 104\r
1ccdbf2a 105//\r
106// Wait for clear roothub port reset, set by experience\r
107//\r
108#define USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)\r
109\r
110//\r
111// Wait for set roothub port enable, set by experience\r
112//\r
1436aea4 113#define USB_SET_ROOT_PORT_ENABLE_STALL (20 * USB_BUS_1_MILLISECOND)\r
1ccdbf2a 114\r
115//\r
116// Send general device request timeout.\r
d1102dba 117//\r
1ccdbf2a 118// The USB Specification 2.0, section 11.24.1 recommends a value of\r
20142bd6 119// 50 milliseconds. We use a value of 500 milliseconds to work\r
1ccdbf2a 120// around slower hubs and devices.\r
121//\r
1436aea4 122#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 500\r
1ccdbf2a 123\r
124//\r
125// Send clear feature request timeout, set by experience\r
126//\r
127#define USB_CLEAR_FEATURE_REQUEST_TIMEOUT 10\r
ecb575d9 128\r
8616fc4c 129//\r
130// Bus raises TPL to TPL_NOTIFY to serialize all its operations\r
131// to protect shared data structures.\r
132//\r
1436aea4 133#define USB_BUS_TPL TPL_NOTIFY\r
e237e7ae 134\r
1436aea4
MK
135#define USB_INTERFACE_SIGNATURE SIGNATURE_32 ('U', 'S', 'B', 'I')\r
136#define USB_BUS_SIGNATURE SIGNATURE_32 ('U', 'S', 'B', 'B')\r
e237e7ae 137\r
1436aea4
MK
138#define USB_BIT(a) ((UINTN)(1 << (a)))\r
139#define USB_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r
e237e7ae 140\r
e237e7ae 141#define USB_INTERFACE_FROM_USBIO(a) \\r
142 CR(a, USB_INTERFACE, UsbIo, USB_INTERFACE_SIGNATURE)\r
143\r
144#define USB_BUS_FROM_THIS(a) \\r
145 CR(a, USB_BUS, BusId, USB_BUS_SIGNATURE)\r
146\r
147//\r
148// Used to locate USB_BUS\r
c8ad2d7a
LG
149// UsbBusProtocol is the private protocol.\r
150// gEfiCallerIdGuid will be used as its protocol guid.\r
e237e7ae 151//\r
152typedef struct _EFI_USB_BUS_PROTOCOL {\r
1436aea4 153 UINT64 Reserved;\r
e237e7ae 154} EFI_USB_BUS_PROTOCOL;\r
155\r
e237e7ae 156//\r
157// Stands for the real USB device. Each device may\r
13a623cf 158// has several separately working interfaces.\r
e237e7ae 159//\r
c52fa98c 160struct _USB_DEVICE {\r
1436aea4 161 USB_BUS *Bus;\r
e237e7ae 162\r
163 //\r
164 // Configuration information\r
165 //\r
1436aea4
MK
166 UINT8 Speed;\r
167 UINT8 Address;\r
168 UINT32 MaxPacket0;\r
e237e7ae 169\r
170 //\r
171 // The device's descriptors and its configuration\r
172 //\r
1436aea4
MK
173 USB_DEVICE_DESC *DevDesc;\r
174 USB_CONFIG_DESC *ActiveConfig;\r
e237e7ae 175\r
1436aea4
MK
176 UINT16 LangId[USB_MAX_LANG_ID];\r
177 UINT16 TotalLangId;\r
e237e7ae 178\r
1436aea4
MK
179 UINT8 NumOfInterface;\r
180 USB_INTERFACE *Interfaces[USB_MAX_INTERFACE];\r
e237e7ae 181\r
182 //\r
183 // Parent child relationship\r
184 //\r
1436aea4 185 EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;\r
e237e7ae 186\r
1436aea4
MK
187 UINT8 ParentAddr;\r
188 USB_INTERFACE *ParentIf;\r
189 UINT8 ParentPort; // Start at 0\r
190 UINT8 Tier;\r
191 BOOLEAN DisconnectFail;\r
c52fa98c 192};\r
e237e7ae 193\r
194//\r
195// Stands for different functions of USB device\r
196//\r
c52fa98c 197struct _USB_INTERFACE {\r
1436aea4
MK
198 UINTN Signature;\r
199 USB_DEVICE *Device;\r
200 USB_INTERFACE_DESC *IfDesc;\r
201 USB_INTERFACE_SETTING *IfSetting;\r
e237e7ae 202\r
203 //\r
204 // Handles and protocols\r
205 //\r
1436aea4
MK
206 EFI_HANDLE Handle;\r
207 EFI_USB_IO_PROTOCOL UsbIo;\r
208 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
209 BOOLEAN IsManaged;\r
e237e7ae 210\r
211 //\r
212 // Hub device special data\r
213 //\r
1436aea4
MK
214 BOOLEAN IsHub;\r
215 USB_HUB_API *HubApi;\r
216 UINT8 NumOfPort;\r
217 EFI_EVENT HubNotify;\r
e237e7ae 218\r
219 //\r
220 // Data used only by normal hub devices\r
221 //\r
1436aea4
MK
222 USB_ENDPOINT_DESC *HubEp;\r
223 UINT8 *ChangeMap;\r
e237e7ae 224\r
225 //\r
226 // Data used only by root hub to hand over device to\r
227 // companion UHCI driver if low/full speed devices are\r
228 // connected to EHCI.\r
229 //\r
1436aea4 230 UINT8 MaxSpeed;\r
c52fa98c 231};\r
e237e7ae 232\r
233//\r
234// Stands for the current USB Bus\r
235//\r
c52fa98c 236struct _USB_BUS {\r
1436aea4
MK
237 UINTN Signature;\r
238 EFI_USB_BUS_PROTOCOL BusId;\r
e237e7ae 239\r
240 //\r
241 // Managed USB host controller\r
242 //\r
1436aea4
MK
243 EFI_HANDLE HostHandle;\r
244 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
245 EFI_USB2_HC_PROTOCOL *Usb2Hc;\r
246 EFI_USB_HC_PROTOCOL *UsbHc;\r
e237e7ae 247\r
a9292c13 248 //\r
249 // Recorded the max supported usb devices.\r
250 // XHCI can support up to 255 devices.\r
251 // EHCI/UHCI/OHCI supports up to 127 devices.\r
252 //\r
1436aea4 253 UINT32 MaxDevices;\r
e237e7ae 254 //\r
255 // An array of device that is on the bus. Devices[0] is\r
256 // for root hub. Device with address i is at Devices[i].\r
257 //\r
1436aea4 258 USB_DEVICE *Devices[256];\r
ecb575d9 259\r
260 //\r
261 // USB Bus driver need to control the recursive connect policy of the bus, only those wanted\r
262 // usb child device will be recursively connected.\r
263 //\r
13a623cf
AC
264 // WantedUsbIoDPList tracks the Usb child devices which user want to recursively fully connecte,\r
265 // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structure is\r
ecb575d9 266 // DEVICE_PATH_LIST_ITEM\r
267 //\r
1436aea4 268 LIST_ENTRY WantedUsbIoDPList;\r
c52fa98c 269};\r
e237e7ae 270\r
9920ae74 271//\r
272// USB Hub Api\r
273//\r
1436aea4
MK
274struct _USB_HUB_API {\r
275 USB_HUB_INIT Init;\r
276 USB_HUB_GET_PORT_STATUS GetPortStatus;\r
277 USB_HUB_CLEAR_PORT_CHANGE ClearPortChange;\r
278 USB_HUB_SET_PORT_FEATURE SetPortFeature;\r
279 USB_HUB_CLEAR_PORT_FEATURE ClearPortFeature;\r
280 USB_HUB_RESET_PORT ResetPort;\r
281 USB_HUB_RELEASE Release;\r
9920ae74 282};\r
283\r
1436aea4 284#define USB_US_LAND_ID 0x0409\r
ecb575d9 285\r
1436aea4
MK
286#define DEVICE_PATH_LIST_ITEM_SIGNATURE SIGNATURE_32('d','p','l','i')\r
287typedef struct _DEVICE_PATH_LIST_ITEM {\r
288 UINTN Signature;\r
289 LIST_ENTRY Link;\r
290 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
ecb575d9 291} DEVICE_PATH_LIST_ITEM;\r
292\r
293typedef struct {\r
1436aea4
MK
294 USB_CLASS_DEVICE_PATH UsbClass;\r
295 EFI_DEVICE_PATH_PROTOCOL End;\r
ecb575d9 296} USB_CLASS_FORMAT_DEVICE_PATH;\r
297\r
8616fc4c 298/**\r
299 Free a DEVICE_PATH_LIST_ITEM list.\r
300\r
301 @param UsbIoDPList a DEVICE_PATH_LIST_ITEM list pointer.\r
302\r
303 @retval EFI_INVALID_PARAMETER If parameters are invalid, return this value.\r
304 @retval EFI_SUCCESS If free operation is successful, return this value.\r
305\r
306**/\r
ecb575d9 307EFI_STATUS\r
308EFIAPI\r
309UsbBusFreeUsbDPList (\r
1436aea4 310 IN LIST_ENTRY *UsbIoDPList\r
ecb575d9 311 );\r
312\r
8616fc4c 313/**\r
314 Store a wanted usb child device info (its Usb part of device path) which is indicated by\r
315 RemainingDevicePath in a Usb bus which is indicated by UsbBusId.\r
316\r
317 @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r
318 @param RemainingDevicePath The remaining device patch.\r
319\r
320 @retval EFI_SUCCESS Add operation is successful.\r
321 @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
322\r
323**/\r
ecb575d9 324EFI_STATUS\r
325EFIAPI\r
326UsbBusAddWantedUsbIoDP (\r
1436aea4
MK
327 IN EFI_USB_BUS_PROTOCOL *UsbBusId,\r
328 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
ecb575d9 329 );\r
330\r
8616fc4c 331/**\r
332 Check whether a usb child device is the wanted device in a bus.\r
333\r
334 @param Bus The Usb bus's private data pointer.\r
13a623cf 335 @param UsbIf The usb child device interface.\r
8616fc4c 336\r
337 @retval True If a usb child device is the wanted device in a bus.\r
338 @retval False If a usb child device is *NOT* the wanted device in a bus.\r
339\r
340**/\r
ecb575d9 341BOOLEAN\r
342EFIAPI\r
343UsbBusIsWantedUsbIO (\r
1436aea4
MK
344 IN USB_BUS *Bus,\r
345 IN USB_INTERFACE *UsbIf\r
ecb575d9 346 );\r
347\r
8616fc4c 348/**\r
13a623cf 349 Recursively connect every wanted usb child device to ensure they all fully connected.\r
8616fc4c 350 Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
351\r
352 @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r
353\r
354 @retval EFI_SUCCESS Connect is done successfully.\r
355 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
356\r
357**/\r
ecb575d9 358EFI_STATUS\r
359EFIAPI\r
360UsbBusRecursivelyConnectWantedUsbIo (\r
1436aea4 361 IN EFI_USB_BUS_PROTOCOL *UsbBusId\r
ecb575d9 362 );\r
363\r
aa79b0b3 364/**\r
365 USB_IO function to execute a control transfer. This\r
366 function will execute the USB transfer. If transfer\r
367 successes, it will sync the internal state of USB bus\r
368 with device state.\r
369\r
370 @param This The USB_IO instance\r
371 @param Request The control transfer request\r
372 @param Direction Direction for data stage\r
373 @param Timeout The time to wait before timeout\r
374 @param Data The buffer holding the data\r
375 @param DataLength Then length of the data\r
376 @param UsbStatus USB result\r
377\r
378 @retval EFI_INVALID_PARAMETER The parameters are invalid\r
379 @retval EFI_SUCCESS The control transfer succeded.\r
380 @retval Others Failed to execute the transfer\r
381\r
382**/\r
383EFI_STATUS\r
384EFIAPI\r
385UsbIoControlTransfer (\r
386 IN EFI_USB_IO_PROTOCOL *This,\r
387 IN EFI_USB_DEVICE_REQUEST *Request,\r
388 IN EFI_USB_DATA_DIRECTION Direction,\r
389 IN UINT32 Timeout,\r
e3917e22
MK
390 IN OUT VOID *Data OPTIONAL,\r
391 IN UINTN DataLength OPTIONAL,\r
aa79b0b3 392 OUT UINT32 *UsbStatus\r
393 );\r
394\r
395/**\r
396 Execute a bulk transfer to the device endpoint.\r
397\r
398 @param This The USB IO instance.\r
399 @param Endpoint The device endpoint.\r
400 @param Data The data to transfer.\r
401 @param DataLength The length of the data to transfer.\r
402 @param Timeout Time to wait before timeout.\r
403 @param UsbStatus The result of USB transfer.\r
404\r
405 @retval EFI_SUCCESS The bulk transfer is OK.\r
406 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
407 @retval Others Failed to execute transfer, reason returned in\r
408 UsbStatus.\r
409\r
410**/\r
411EFI_STATUS\r
412EFIAPI\r
413UsbIoBulkTransfer (\r
1436aea4
MK
414 IN EFI_USB_IO_PROTOCOL *This,\r
415 IN UINT8 Endpoint,\r
416 IN OUT VOID *Data,\r
417 IN OUT UINTN *DataLength,\r
418 IN UINTN Timeout,\r
419 OUT UINT32 *UsbStatus\r
aa79b0b3 420 );\r
421\r
422/**\r
423 Execute a synchronous interrupt transfer.\r
424\r
425 @param This The USB IO instance.\r
426 @param Endpoint The device endpoint.\r
427 @param Data The data to transfer.\r
428 @param DataLength The length of the data to transfer.\r
429 @param Timeout Time to wait before timeout.\r
430 @param UsbStatus The result of USB transfer.\r
431\r
432 @retval EFI_SUCCESS The synchronous interrupt transfer is OK.\r
433 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
434 @retval Others Failed to execute transfer, reason returned in\r
435 UsbStatus.\r
436\r
437**/\r
438EFI_STATUS\r
439EFIAPI\r
440UsbIoSyncInterruptTransfer (\r
1436aea4
MK
441 IN EFI_USB_IO_PROTOCOL *This,\r
442 IN UINT8 Endpoint,\r
443 IN OUT VOID *Data,\r
444 IN OUT UINTN *DataLength,\r
445 IN UINTN Timeout,\r
446 OUT UINT32 *UsbStatus\r
aa79b0b3 447 );\r
448\r
449/**\r
450 Queue a new asynchronous interrupt transfer, or remove the old\r
451 request if (IsNewTransfer == FALSE).\r
452\r
453 @param This The USB_IO instance.\r
454 @param Endpoint The device endpoint.\r
455 @param IsNewTransfer Whether this is a new request, if it's old, remove\r
456 the request.\r
457 @param PollInterval The interval to poll the transfer result, (in ms).\r
458 @param DataLength The length of perodic data transfer.\r
13a623cf 459 @param Callback The function to call periodically when transfer is\r
aa79b0b3 460 ready.\r
461 @param Context The context to the callback.\r
462\r
463 @retval EFI_SUCCESS New transfer is queued or old request is removed.\r
464 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
465 @retval Others Failed to queue the new request or remove the old\r
466 request.\r
467\r
468**/\r
469EFI_STATUS\r
470EFIAPI\r
471UsbIoAsyncInterruptTransfer (\r
472 IN EFI_USB_IO_PROTOCOL *This,\r
473 IN UINT8 Endpoint,\r
474 IN BOOLEAN IsNewTransfer,\r
e3917e22
MK
475 IN UINTN PollInterval OPTIONAL,\r
476 IN UINTN DataLength OPTIONAL,\r
477 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback OPTIONAL,\r
aa79b0b3 478 IN VOID *Context OPTIONAL\r
479 );\r
480\r
481/**\r
482 Execute a synchronous isochronous transfer.\r
483\r
484 @param This The USB IO instance.\r
485 @param DeviceEndpoint The device endpoint.\r
486 @param Data The data to transfer.\r
487 @param DataLength The length of the data to transfer.\r
488 @param UsbStatus The result of USB transfer.\r
489\r
490 @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r
491\r
492**/\r
493EFI_STATUS\r
494EFIAPI\r
495UsbIoIsochronousTransfer (\r
1436aea4
MK
496 IN EFI_USB_IO_PROTOCOL *This,\r
497 IN UINT8 DeviceEndpoint,\r
498 IN OUT VOID *Data,\r
499 IN UINTN DataLength,\r
500 OUT UINT32 *Status\r
aa79b0b3 501 );\r
502\r
503/**\r
504 Queue an asynchronous isochronous transfer.\r
505\r
506 @param This The USB_IO instance.\r
507 @param DeviceEndpoint The device endpoint.\r
508 @param Data The data to transfer.\r
509 @param DataLength The length of perodic data transfer.\r
13a623cf 510 @param IsochronousCallBack The function to call periodically when transfer is\r
aa79b0b3 511 ready.\r
512 @param Context The context to the callback.\r
513\r
514 @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r
515\r
516**/\r
517EFI_STATUS\r
518EFIAPI\r
519UsbIoAsyncIsochronousTransfer (\r
520 IN EFI_USB_IO_PROTOCOL *This,\r
521 IN UINT8 DeviceEndpoint,\r
522 IN OUT VOID *Data,\r
523 IN UINTN DataLength,\r
524 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
525 IN VOID *Context OPTIONAL\r
526 );\r
527\r
528/**\r
529 Retrieve the device descriptor of the device.\r
530\r
531 @param This The USB IO instance.\r
532 @param Descriptor The variable to receive the device descriptor.\r
533\r
534 @retval EFI_SUCCESS The device descriptor is returned.\r
535 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
536\r
537**/\r
538EFI_STATUS\r
539EFIAPI\r
540UsbIoGetDeviceDescriptor (\r
1436aea4
MK
541 IN EFI_USB_IO_PROTOCOL *This,\r
542 OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor\r
aa79b0b3 543 );\r
544\r
545/**\r
546 Return the configuration descriptor of the current active configuration.\r
547\r
548 @param This The USB IO instance.\r
549 @param Descriptor The USB configuration descriptor.\r
550\r
551 @retval EFI_SUCCESS The active configuration descriptor is returned.\r
552 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
553 @retval EFI_NOT_FOUND Currently no active configuration is selected.\r
554\r
555**/\r
556EFI_STATUS\r
557EFIAPI\r
558UsbIoGetActiveConfigDescriptor (\r
1436aea4
MK
559 IN EFI_USB_IO_PROTOCOL *This,\r
560 OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor\r
aa79b0b3 561 );\r
562\r
563/**\r
564 Retrieve the active interface setting descriptor for this USB IO instance.\r
565\r
566 @param This The USB IO instance.\r
567 @param Descriptor The variable to receive active interface setting.\r
568\r
569 @retval EFI_SUCCESS The active interface setting is returned.\r
570 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
571\r
572**/\r
573EFI_STATUS\r
574EFIAPI\r
575UsbIoGetInterfaceDescriptor (\r
576 IN EFI_USB_IO_PROTOCOL *This,\r
577 OUT EFI_USB_INTERFACE_DESCRIPTOR *Descriptor\r
578 );\r
579\r
580/**\r
581 Retrieve the endpoint descriptor from this interface setting.\r
582\r
583 @param This The USB IO instance.\r
584 @param Index The index (start from zero) of the endpoint to\r
585 retrieve.\r
586 @param Descriptor The variable to receive the descriptor.\r
587\r
588 @retval EFI_SUCCESS The endpoint descriptor is returned.\r
589 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
590\r
591**/\r
592EFI_STATUS\r
593EFIAPI\r
594UsbIoGetEndpointDescriptor (\r
1436aea4
MK
595 IN EFI_USB_IO_PROTOCOL *This,\r
596 IN UINT8 Index,\r
597 OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor\r
aa79b0b3 598 );\r
599\r
600/**\r
601 Retrieve the supported language ID table from the device.\r
602\r
603 @param This The USB IO instance.\r
604 @param LangIDTable The table to return the language IDs.\r
84909ad4 605 @param TableSize The size, in bytes, of the table LangIDTable.\r
aa79b0b3 606\r
607 @retval EFI_SUCCESS The language ID is return.\r
608\r
609**/\r
610EFI_STATUS\r
611EFIAPI\r
612UsbIoGetSupportedLanguages (\r
1436aea4
MK
613 IN EFI_USB_IO_PROTOCOL *This,\r
614 OUT UINT16 **LangIDTable,\r
615 OUT UINT16 *TableSize\r
aa79b0b3 616 );\r
617\r
618/**\r
619 Retrieve an indexed string in the language of LangID.\r
620\r
621 @param This The USB IO instance.\r
622 @param LangID The language ID of the string to retrieve.\r
623 @param StringIndex The index of the string.\r
624 @param String The variable to receive the string.\r
625\r
626 @retval EFI_SUCCESS The string is returned.\r
627 @retval EFI_NOT_FOUND No such string existed.\r
628\r
629**/\r
630EFI_STATUS\r
631EFIAPI\r
632UsbIoGetStringDescriptor (\r
1436aea4
MK
633 IN EFI_USB_IO_PROTOCOL *This,\r
634 IN UINT16 LangID,\r
635 IN UINT8 StringIndex,\r
636 OUT CHAR16 **String\r
aa79b0b3 637 );\r
638\r
639/**\r
640 Reset the device, then if that succeeds, reconfigure the\r
641 device with its address and current active configuration.\r
642\r
643 @param This The USB IO instance.\r
644\r
645 @retval EFI_SUCCESS The device is reset and configured.\r
646 @retval Others Failed to reset the device.\r
647\r
648**/\r
649EFI_STATUS\r
650EFIAPI\r
651UsbIoPortReset (\r
652 IN EFI_USB_IO_PROTOCOL *This\r
653 );\r
654\r
655/**\r
656 Install Usb Bus Protocol on host controller, and start the Usb bus.\r
657\r
658 @param This The USB bus driver binding instance.\r
659 @param Controller The controller to check.\r
660 @param RemainingDevicePath The remaining device patch.\r
661\r
662 @retval EFI_SUCCESS The controller is controlled by the usb bus.\r
663 @retval EFI_ALREADY_STARTED The controller is already controlled by the usb bus.\r
664 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
665\r
666**/\r
667EFI_STATUS\r
668EFIAPI\r
669UsbBusBuildProtocol (\r
670 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
671 IN EFI_HANDLE Controller,\r
672 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
673 );\r
674\r
675/**\r
676 The USB bus driver entry pointer.\r
677\r
678 @param ImageHandle The driver image handle.\r
679 @param SystemTable The system table.\r
680\r
681 @return EFI_SUCCESS The component name protocol is installed.\r
682 @return Others Failed to init the usb driver.\r
683\r
684**/\r
685EFI_STATUS\r
686EFIAPI\r
687UsbBusDriverEntryPoint (\r
1436aea4
MK
688 IN EFI_HANDLE ImageHandle,\r
689 IN EFI_SYSTEM_TABLE *SystemTable\r
aa79b0b3 690 );\r
691\r
692/**\r
693 Check whether USB bus driver support this device.\r
694\r
695 @param This The USB bus driver binding protocol.\r
696 @param Controller The controller handle to check.\r
697 @param RemainingDevicePath The remaining device path.\r
698\r
699 @retval EFI_SUCCESS The bus supports this controller.\r
700 @retval EFI_UNSUPPORTED This device isn't supported.\r
701\r
702**/\r
703EFI_STATUS\r
704EFIAPI\r
705UsbBusControllerDriverSupported (\r
706 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
707 IN EFI_HANDLE Controller,\r
708 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
709 );\r
710\r
711/**\r
712 Start to process the controller.\r
713\r
714 @param This The USB bus driver binding instance.\r
715 @param Controller The controller to check.\r
716 @param RemainingDevicePath The remaining device patch.\r
717\r
718 @retval EFI_SUCCESS The controller is controlled by the usb bus.\r
719 @retval EFI_ALREADY_STARTED The controller is already controlled by the usb\r
720 bus.\r
721 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
722\r
723**/\r
724EFI_STATUS\r
725EFIAPI\r
726UsbBusControllerDriverStart (\r
727 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
728 IN EFI_HANDLE Controller,\r
729 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
730 );\r
731\r
732/**\r
733 Stop handle the controller by this USB bus driver.\r
734\r
735 @param This The USB bus driver binding protocol.\r
736 @param Controller The controller to release.\r
737 @param NumberOfChildren The child of USB bus that opened controller\r
738 BY_CHILD.\r
739 @param ChildHandleBuffer The array of child handle.\r
740\r
741 @retval EFI_SUCCESS The controller or children are stopped.\r
742 @retval EFI_DEVICE_ERROR Failed to stop the driver.\r
743\r
744**/\r
745EFI_STATUS\r
746EFIAPI\r
747UsbBusControllerDriverStop (\r
748 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
749 IN EFI_HANDLE Controller,\r
750 IN UINTN NumberOfChildren,\r
751 IN EFI_HANDLE *ChildHandleBuffer\r
752 );\r
753\r
1436aea4
MK
754extern EFI_USB_IO_PROTOCOL mUsbIoProtocol;\r
755extern EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding;\r
756extern EFI_COMPONENT_NAME_PROTOCOL mUsbBusComponentName;\r
757extern EFI_COMPONENT_NAME2_PROTOCOL mUsbBusComponentName2;\r
e237e7ae 758\r
759#endif\r