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