]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
remove some const modifier to spec compliance.
[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
3d0a2385 5Copyright (c) 2004 - 2011, 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
63// The unit of roothub is 100us, means 1s as interval, and\r
64// the unit of hub is 1ms, means 64ms as interval.\r
65//\r
66#define USB_ROOTHUB_POLL_INTERVAL (1000 * 10000U)\r
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
78#define USB_WAIT_PORT_STS_CHANGE_STALL (5 * USB_BUS_1_MILLISECOND)\r
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
84#define USB_SET_DEVICE_ADDRESS_STALL (20 * USB_BUS_1_MILLISECOND)\r
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
102#define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)\r
103#define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND)\r
104\r
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
113#define USB_SET_ROOT_PORT_ENABLE_STALL (20 * USB_BUS_1_MILLISECOND)\r
114\r
115//\r
116// Send general device request timeout.\r
117// \r
118// The USB Specification 2.0, section 11.24.1 recommends a value of\r
119// 50 milliseconds. We use a value of 100 milliseconds to work\r
120// around slower hubs and devices.\r
121//\r
122#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 100\r
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
133#define USB_BUS_TPL TPL_NOTIFY\r
e237e7ae 134\r
f3f2e05d 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
138#define USB_BIT(a) ((UINTN)(1 << (a)))\r
139#define USB_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r
140\r
141#define EFI_USB_BUS_PROTOCOL_GUID \\r
84b5c78e 142 {0x2B2F68CC, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75}}\r
e237e7ae 143\r
144#define USB_INTERFACE_FROM_USBIO(a) \\r
145 CR(a, USB_INTERFACE, UsbIo, USB_INTERFACE_SIGNATURE)\r
146\r
147#define USB_BUS_FROM_THIS(a) \\r
148 CR(a, USB_BUS, BusId, USB_BUS_SIGNATURE)\r
149\r
150//\r
151// Used to locate USB_BUS\r
152//\r
153typedef struct _EFI_USB_BUS_PROTOCOL {\r
154 UINT64 Reserved;\r
155} EFI_USB_BUS_PROTOCOL;\r
156\r
157\r
158//\r
159// Stands for the real USB device. Each device may\r
160// has several seperately working interfaces.\r
161//\r
c52fa98c 162struct _USB_DEVICE {\r
e237e7ae 163 USB_BUS *Bus;\r
164\r
165 //\r
166 // Configuration information\r
167 //\r
168 UINT8 Speed;\r
169 UINT8 Address;\r
170 UINT8 MaxPacket0;\r
171\r
172 //\r
173 // The device's descriptors and its configuration\r
174 //\r
175 USB_DEVICE_DESC *DevDesc;\r
176 USB_CONFIG_DESC *ActiveConfig;\r
177\r
178 UINT16 LangId [USB_MAX_LANG_ID];\r
179 UINT16 TotalLangId;\r
180\r
181 UINT8 NumOfInterface;\r
182 USB_INTERFACE *Interfaces [USB_MAX_INTERFACE];\r
183\r
184 //\r
185 // Parent child relationship\r
186 //\r
187 EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;\r
188\r
189 UINT8 ParentAddr;\r
190 USB_INTERFACE *ParentIf;\r
191 UINT8 ParentPort; // Start at 0\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
e237e7ae 198 UINTN Signature;\r
199 USB_DEVICE *Device;\r
200 USB_INTERFACE_DESC *IfDesc;\r
201 USB_INTERFACE_SETTING *IfSetting;\r
202\r
203 //\r
204 // Handles and protocols\r
205 //\r
206 EFI_HANDLE Handle;\r
207 EFI_USB_IO_PROTOCOL UsbIo;\r
208 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
209 BOOLEAN IsManaged;\r
210\r
211 //\r
212 // Hub device special data\r
213 //\r
214 BOOLEAN IsHub;\r
215 USB_HUB_API *HubApi;\r
216 UINT8 NumOfPort;\r
217 EFI_EVENT HubNotify;\r
218\r
219 //\r
220 // Data used only by normal hub devices\r
221 //\r
222 USB_ENDPOINT_DESC *HubEp;\r
223 UINT8 *ChangeMap;\r
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
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
e237e7ae 237 UINTN Signature;\r
238 EFI_USB_BUS_PROTOCOL BusId;\r
239\r
240 //\r
241 // Managed USB host controller\r
242 //\r
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
247\r
248 //\r
249 // An array of device that is on the bus. Devices[0] is\r
250 // for root hub. Device with address i is at Devices[i].\r
251 //\r
252 USB_DEVICE *Devices[USB_MAX_DEVICES];\r
ecb575d9 253\r
254 //\r
255 // USB Bus driver need to control the recursive connect policy of the bus, only those wanted\r
256 // usb child device will be recursively connected.\r
257 //\r
258 // WantedUsbIoDPList tracks the Usb child devices which user want to recursivly fully connecte,\r
259 // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structrure is\r
260 // DEVICE_PATH_LIST_ITEM\r
261 //\r
262 LIST_ENTRY WantedUsbIoDPList;\r
263\r
c52fa98c 264};\r
e237e7ae 265\r
9920ae74 266//\r
267// USB Hub Api\r
268//\r
269struct _USB_HUB_API{\r
270 USB_HUB_INIT Init;\r
271 USB_HUB_GET_PORT_STATUS GetPortStatus;\r
272 USB_HUB_CLEAR_PORT_CHANGE ClearPortChange;\r
273 USB_HUB_SET_PORT_FEATURE SetPortFeature;\r
274 USB_HUB_CLEAR_PORT_FEATURE ClearPortFeature;\r
275 USB_HUB_RESET_PORT ResetPort;\r
276 USB_HUB_RELEASE Release;\r
277};\r
278\r
ecb575d9 279#define USB_US_LAND_ID 0x0409\r
280\r
f3f2e05d 281#define DEVICE_PATH_LIST_ITEM_SIGNATURE SIGNATURE_32('d','p','l','i')\r
ecb575d9 282typedef struct _DEVICE_PATH_LIST_ITEM{\r
283 UINTN Signature;\r
284 LIST_ENTRY Link;\r
285 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
286} DEVICE_PATH_LIST_ITEM;\r
287\r
288typedef struct {\r
289 USB_CLASS_DEVICE_PATH UsbClass;\r
290 EFI_DEVICE_PATH_PROTOCOL End;\r
291} USB_CLASS_FORMAT_DEVICE_PATH;\r
292\r
8616fc4c 293/**\r
294 Free a DEVICE_PATH_LIST_ITEM list.\r
295\r
296 @param UsbIoDPList a DEVICE_PATH_LIST_ITEM list pointer.\r
297\r
298 @retval EFI_INVALID_PARAMETER If parameters are invalid, return this value.\r
299 @retval EFI_SUCCESS If free operation is successful, return this value.\r
300\r
301**/\r
ecb575d9 302EFI_STATUS\r
303EFIAPI\r
304UsbBusFreeUsbDPList (\r
305 IN LIST_ENTRY *UsbIoDPList\r
306 );\r
307\r
8616fc4c 308/**\r
309 Store a wanted usb child device info (its Usb part of device path) which is indicated by\r
310 RemainingDevicePath in a Usb bus which is indicated by UsbBusId.\r
311\r
312 @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r
313 @param RemainingDevicePath The remaining device patch.\r
314\r
315 @retval EFI_SUCCESS Add operation is successful.\r
316 @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
317\r
318**/\r
ecb575d9 319EFI_STATUS\r
320EFIAPI\r
321UsbBusAddWantedUsbIoDP (\r
322 IN EFI_USB_BUS_PROTOCOL *UsbBusId,\r
323 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
324 );\r
325\r
8616fc4c 326/**\r
327 Check whether a usb child device is the wanted device in a bus.\r
328\r
329 @param Bus The Usb bus's private data pointer.\r
330 @param UsbIf The usb child device inferface.\r
331\r
332 @retval True If a usb child device is the wanted device in a bus.\r
333 @retval False If a usb child device is *NOT* the wanted device in a bus.\r
334\r
335**/\r
ecb575d9 336BOOLEAN\r
337EFIAPI\r
338UsbBusIsWantedUsbIO (\r
339 IN USB_BUS *Bus,\r
340 IN USB_INTERFACE *UsbIf\r
341 );\r
342\r
8616fc4c 343/**\r
344 Recursively connnect every wanted usb child device to ensure they all fully connected.\r
345 Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
346\r
347 @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r
348\r
349 @retval EFI_SUCCESS Connect is done successfully.\r
350 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
351\r
352**/\r
ecb575d9 353EFI_STATUS\r
354EFIAPI\r
355UsbBusRecursivelyConnectWantedUsbIo (\r
356 IN EFI_USB_BUS_PROTOCOL *UsbBusId\r
357 );\r
358\r
aa79b0b3 359/**\r
360 USB_IO function to execute a control transfer. This\r
361 function will execute the USB transfer. If transfer\r
362 successes, it will sync the internal state of USB bus\r
363 with device state.\r
364\r
365 @param This The USB_IO instance\r
366 @param Request The control transfer request\r
367 @param Direction Direction for data stage\r
368 @param Timeout The time to wait before timeout\r
369 @param Data The buffer holding the data\r
370 @param DataLength Then length of the data\r
371 @param UsbStatus USB result\r
372\r
373 @retval EFI_INVALID_PARAMETER The parameters are invalid\r
374 @retval EFI_SUCCESS The control transfer succeded.\r
375 @retval Others Failed to execute the transfer\r
376\r
377**/\r
378EFI_STATUS\r
379EFIAPI\r
380UsbIoControlTransfer (\r
381 IN EFI_USB_IO_PROTOCOL *This,\r
382 IN EFI_USB_DEVICE_REQUEST *Request,\r
383 IN EFI_USB_DATA_DIRECTION Direction,\r
384 IN UINT32 Timeout,\r
385 IN OUT VOID *Data, OPTIONAL\r
386 IN UINTN DataLength, OPTIONAL\r
387 OUT UINT32 *UsbStatus\r
388 );\r
389\r
390/**\r
391 Execute a bulk transfer to the device endpoint.\r
392\r
393 @param This The USB IO instance.\r
394 @param Endpoint The device endpoint.\r
395 @param Data The data to transfer.\r
396 @param DataLength The length of the data to transfer.\r
397 @param Timeout Time to wait before timeout.\r
398 @param UsbStatus The result of USB transfer.\r
399\r
400 @retval EFI_SUCCESS The bulk transfer is OK.\r
401 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
402 @retval Others Failed to execute transfer, reason returned in\r
403 UsbStatus.\r
404\r
405**/\r
406EFI_STATUS\r
407EFIAPI\r
408UsbIoBulkTransfer (\r
409 IN EFI_USB_IO_PROTOCOL *This,\r
410 IN UINT8 Endpoint,\r
411 IN OUT VOID *Data,\r
412 IN OUT UINTN *DataLength,\r
413 IN UINTN Timeout,\r
414 OUT UINT32 *UsbStatus\r
415 );\r
416\r
417/**\r
418 Execute a synchronous interrupt transfer.\r
419\r
420 @param This The USB IO instance.\r
421 @param Endpoint The device endpoint.\r
422 @param Data The data to transfer.\r
423 @param DataLength The length of the data to transfer.\r
424 @param Timeout Time to wait before timeout.\r
425 @param UsbStatus The result of USB transfer.\r
426\r
427 @retval EFI_SUCCESS The synchronous interrupt transfer is OK.\r
428 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
429 @retval Others Failed to execute transfer, reason returned in\r
430 UsbStatus.\r
431\r
432**/\r
433EFI_STATUS\r
434EFIAPI\r
435UsbIoSyncInterruptTransfer (\r
436 IN EFI_USB_IO_PROTOCOL *This,\r
437 IN UINT8 Endpoint,\r
438 IN OUT VOID *Data,\r
439 IN OUT UINTN *DataLength,\r
440 IN UINTN Timeout,\r
441 OUT UINT32 *UsbStatus\r
442 );\r
443\r
444/**\r
445 Queue a new asynchronous interrupt transfer, or remove the old\r
446 request if (IsNewTransfer == FALSE).\r
447\r
448 @param This The USB_IO instance.\r
449 @param Endpoint The device endpoint.\r
450 @param IsNewTransfer Whether this is a new request, if it's old, remove\r
451 the request.\r
452 @param PollInterval The interval to poll the transfer result, (in ms).\r
453 @param DataLength The length of perodic data transfer.\r
454 @param Callback The function to call periodicaly when transfer is\r
455 ready.\r
456 @param Context The context to the callback.\r
457\r
458 @retval EFI_SUCCESS New transfer is queued or old request is removed.\r
459 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
460 @retval Others Failed to queue the new request or remove the old\r
461 request.\r
462\r
463**/\r
464EFI_STATUS\r
465EFIAPI\r
466UsbIoAsyncInterruptTransfer (\r
467 IN EFI_USB_IO_PROTOCOL *This,\r
468 IN UINT8 Endpoint,\r
469 IN BOOLEAN IsNewTransfer,\r
470 IN UINTN PollInterval, OPTIONAL\r
471 IN UINTN DataLength, OPTIONAL\r
472 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, OPTIONAL\r
473 IN VOID *Context OPTIONAL\r
474 );\r
475\r
476/**\r
477 Execute a synchronous isochronous transfer.\r
478\r
479 @param This The USB IO instance.\r
480 @param DeviceEndpoint The device endpoint.\r
481 @param Data The data to transfer.\r
482 @param DataLength The length of the data to transfer.\r
483 @param UsbStatus The result of USB transfer.\r
484\r
485 @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r
486\r
487**/\r
488EFI_STATUS\r
489EFIAPI\r
490UsbIoIsochronousTransfer (\r
491 IN EFI_USB_IO_PROTOCOL *This,\r
492 IN UINT8 DeviceEndpoint,\r
493 IN OUT VOID *Data,\r
494 IN UINTN DataLength,\r
495 OUT UINT32 *Status\r
496 );\r
497\r
498/**\r
499 Queue an asynchronous isochronous transfer.\r
500\r
501 @param This The USB_IO instance.\r
502 @param DeviceEndpoint The device endpoint.\r
503 @param Data The data to transfer.\r
504 @param DataLength The length of perodic data transfer.\r
505 @param IsochronousCallBack The function to call periodicaly when transfer is\r
506 ready.\r
507 @param Context The context to the callback.\r
508\r
509 @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r
510\r
511**/\r
512EFI_STATUS\r
513EFIAPI\r
514UsbIoAsyncIsochronousTransfer (\r
515 IN EFI_USB_IO_PROTOCOL *This,\r
516 IN UINT8 DeviceEndpoint,\r
517 IN OUT VOID *Data,\r
518 IN UINTN DataLength,\r
519 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
520 IN VOID *Context OPTIONAL\r
521 );\r
522\r
523/**\r
524 Retrieve the device descriptor of the device.\r
525\r
526 @param This The USB IO instance.\r
527 @param Descriptor The variable to receive the device descriptor.\r
528\r
529 @retval EFI_SUCCESS The device descriptor is returned.\r
530 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
531\r
532**/\r
533EFI_STATUS\r
534EFIAPI\r
535UsbIoGetDeviceDescriptor (\r
536 IN EFI_USB_IO_PROTOCOL *This,\r
537 OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor\r
538 );\r
539\r
540/**\r
541 Return the configuration descriptor of the current active configuration.\r
542\r
543 @param This The USB IO instance.\r
544 @param Descriptor The USB configuration descriptor.\r
545\r
546 @retval EFI_SUCCESS The active configuration descriptor is returned.\r
547 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
548 @retval EFI_NOT_FOUND Currently no active configuration is selected.\r
549\r
550**/\r
551EFI_STATUS\r
552EFIAPI\r
553UsbIoGetActiveConfigDescriptor (\r
554 IN EFI_USB_IO_PROTOCOL *This,\r
555 OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor\r
556 );\r
557\r
558/**\r
559 Retrieve the active interface setting descriptor for this USB IO instance.\r
560\r
561 @param This The USB IO instance.\r
562 @param Descriptor The variable to receive active interface setting.\r
563\r
564 @retval EFI_SUCCESS The active interface setting is returned.\r
565 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
566\r
567**/\r
568EFI_STATUS\r
569EFIAPI\r
570UsbIoGetInterfaceDescriptor (\r
571 IN EFI_USB_IO_PROTOCOL *This,\r
572 OUT EFI_USB_INTERFACE_DESCRIPTOR *Descriptor\r
573 );\r
574\r
575/**\r
576 Retrieve the endpoint descriptor from this interface setting.\r
577\r
578 @param This The USB IO instance.\r
579 @param Index The index (start from zero) of the endpoint to\r
580 retrieve.\r
581 @param Descriptor The variable to receive the descriptor.\r
582\r
583 @retval EFI_SUCCESS The endpoint descriptor is returned.\r
584 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
585\r
586**/\r
587EFI_STATUS\r
588EFIAPI\r
589UsbIoGetEndpointDescriptor (\r
590 IN EFI_USB_IO_PROTOCOL *This,\r
591 IN UINT8 Index,\r
592 OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor\r
593 );\r
594\r
595/**\r
596 Retrieve the supported language ID table from the device.\r
597\r
598 @param This The USB IO instance.\r
599 @param LangIDTable The table to return the language IDs.\r
84909ad4 600 @param TableSize The size, in bytes, of the table LangIDTable.\r
aa79b0b3 601\r
602 @retval EFI_SUCCESS The language ID is return.\r
603\r
604**/\r
605EFI_STATUS\r
606EFIAPI\r
607UsbIoGetSupportedLanguages (\r
608 IN EFI_USB_IO_PROTOCOL *This,\r
609 OUT UINT16 **LangIDTable,\r
610 OUT UINT16 *TableSize\r
611 );\r
612\r
613/**\r
614 Retrieve an indexed string in the language of LangID.\r
615\r
616 @param This The USB IO instance.\r
617 @param LangID The language ID of the string to retrieve.\r
618 @param StringIndex The index of the string.\r
619 @param String The variable to receive the string.\r
620\r
621 @retval EFI_SUCCESS The string is returned.\r
622 @retval EFI_NOT_FOUND No such string existed.\r
623\r
624**/\r
625EFI_STATUS\r
626EFIAPI\r
627UsbIoGetStringDescriptor (\r
628 IN EFI_USB_IO_PROTOCOL *This,\r
629 IN UINT16 LangID,\r
630 IN UINT8 StringIndex,\r
631 OUT CHAR16 **String\r
632 );\r
633\r
634/**\r
635 Reset the device, then if that succeeds, reconfigure the\r
636 device with its address and current active configuration.\r
637\r
638 @param This The USB IO instance.\r
639\r
640 @retval EFI_SUCCESS The device is reset and configured.\r
641 @retval Others Failed to reset the device.\r
642\r
643**/\r
644EFI_STATUS\r
645EFIAPI\r
646UsbIoPortReset (\r
647 IN EFI_USB_IO_PROTOCOL *This\r
648 );\r
649\r
650/**\r
651 Install Usb Bus Protocol on host controller, and start the Usb bus.\r
652\r
653 @param This The USB bus driver binding instance.\r
654 @param Controller The controller to check.\r
655 @param RemainingDevicePath The remaining device patch.\r
656\r
657 @retval EFI_SUCCESS The controller is controlled by the usb bus.\r
658 @retval EFI_ALREADY_STARTED The controller is already controlled by the usb bus.\r
659 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
660\r
661**/\r
662EFI_STATUS\r
663EFIAPI\r
664UsbBusBuildProtocol (\r
665 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
666 IN EFI_HANDLE Controller,\r
667 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
668 );\r
669\r
670/**\r
671 The USB bus driver entry pointer.\r
672\r
673 @param ImageHandle The driver image handle.\r
674 @param SystemTable The system table.\r
675\r
676 @return EFI_SUCCESS The component name protocol is installed.\r
677 @return Others Failed to init the usb driver.\r
678\r
679**/\r
680EFI_STATUS\r
681EFIAPI\r
682UsbBusDriverEntryPoint (\r
683 IN EFI_HANDLE ImageHandle,\r
684 IN EFI_SYSTEM_TABLE *SystemTable\r
685 );\r
686\r
687/**\r
688 Check whether USB bus driver support this device.\r
689\r
690 @param This The USB bus driver binding protocol.\r
691 @param Controller The controller handle to check.\r
692 @param RemainingDevicePath The remaining device path.\r
693\r
694 @retval EFI_SUCCESS The bus supports this controller.\r
695 @retval EFI_UNSUPPORTED This device isn't supported.\r
696\r
697**/\r
698EFI_STATUS\r
699EFIAPI\r
700UsbBusControllerDriverSupported (\r
701 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
702 IN EFI_HANDLE Controller,\r
703 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
704 );\r
705\r
706/**\r
707 Start to process the controller.\r
708\r
709 @param This The USB bus driver binding instance.\r
710 @param Controller The controller to check.\r
711 @param RemainingDevicePath The remaining device patch.\r
712\r
713 @retval EFI_SUCCESS The controller is controlled by the usb bus.\r
714 @retval EFI_ALREADY_STARTED The controller is already controlled by the usb\r
715 bus.\r
716 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
717\r
718**/\r
719EFI_STATUS\r
720EFIAPI\r
721UsbBusControllerDriverStart (\r
722 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
723 IN EFI_HANDLE Controller,\r
724 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
725 );\r
726\r
727/**\r
728 Stop handle the controller by this USB bus driver.\r
729\r
730 @param This The USB bus driver binding protocol.\r
731 @param Controller The controller to release.\r
732 @param NumberOfChildren The child of USB bus that opened controller\r
733 BY_CHILD.\r
734 @param ChildHandleBuffer The array of child handle.\r
735\r
736 @retval EFI_SUCCESS The controller or children are stopped.\r
737 @retval EFI_DEVICE_ERROR Failed to stop the driver.\r
738\r
739**/\r
740EFI_STATUS\r
741EFIAPI\r
742UsbBusControllerDriverStop (\r
743 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
744 IN EFI_HANDLE Controller,\r
745 IN UINTN NumberOfChildren,\r
746 IN EFI_HANDLE *ChildHandleBuffer\r
747 );\r
748\r
62b9bb55 749extern EFI_USB_IO_PROTOCOL mUsbIoProtocol;\r
750extern EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding;\r
751extern EFI_COMPONENT_NAME_PROTOCOL mUsbBusComponentName;\r
752extern EFI_COMPONENT_NAME2_PROTOCOL mUsbBusComponentName2;\r
e237e7ae 753\r
754#endif\r