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