]> git.proxmox.com Git - mirror_edk2.git/blame - EdkModulePkg/Bus/Usb/UsbBus/Dxe/usbbus.h
Clean up MSA file of the checked in modules which include:
[mirror_edk2.git] / EdkModulePkg / Bus / Usb / UsbBus / Dxe / usbbus.h
CommitLineData
878ddf1f 1/*++\r
2Copyright (c) 2006, Intel Corporation \r
3All rights reserved. This program and the accompanying materials \r
4are licensed and made available under the terms and conditions of the BSD License \r
5which accompanies this distribution. The full text of the license may be found at \r
6http://opensource.org/licenses/bsd-license.php \r
7 \r
8THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
9WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
10\r
11 Module Name:\r
12\r
13 usbbus.h\r
14\r
15 Abstract:\r
16\r
17 Header file for USB bus driver Interface\r
18\r
19 Revision History\r
20\r
21\r
22\r
23--*/\r
24\r
25#ifndef _EFI_USB_BUS_H\r
26#define _EFI_USB_BUS_H\r
27\r
28\r
f0ec738d 29#include <IndustryStandard/Usb.h>\r
30#include "hub.h"\r
31#include "usbutil.h"\r
878ddf1f 32\r
71a62114 33\r
713ace4c 34extern UINTN gUSBDebugLevel;\r
35extern UINTN gUSBErrorLevel;\r
71a62114 36\r
878ddf1f 37\r
562d2849 38#define MICROSECOND 10000\r
39#define ONESECOND (1000 * MICROSECOND)\r
878ddf1f 40#define BUSPOLLING_PERIOD ONESECOND\r
41//\r
42// We define some maximun value here\r
43//\r
44#define USB_MAXCONFIG 8\r
45#define USB_MAXALTSETTING 4\r
46#define USB_MAXINTERFACES 32\r
47#define USB_MAXENDPOINTS 16\r
48#define USB_MAXSTRINGS 16\r
49#define USB_MAXLANID 16\r
50#define USB_MAXCHILDREN 8\r
51#define USB_MAXCONTROLLERS 4\r
52\r
53#define USB_IO_CONTROLLER_SIGNATURE EFI_SIGNATURE_32 ('u', 's', 'b', 'd')\r
54\r
55typedef struct {\r
56 LIST_ENTRY Link;\r
57 UINT16 StringIndex;\r
58 CHAR16 *String;\r
59} STR_LIST_ENTRY;\r
60\r
61typedef struct {\r
62 LIST_ENTRY Link;\r
63 UINT16 Toggle;\r
64 EFI_USB_ENDPOINT_DESCRIPTOR EndpointDescriptor;\r
65} ENDPOINT_DESC_LIST_ENTRY;\r
66\r
67typedef struct {\r
68 LIST_ENTRY Link;\r
69 EFI_USB_INTERFACE_DESCRIPTOR InterfaceDescriptor;\r
70 LIST_ENTRY EndpointDescListHead;\r
71} INTERFACE_DESC_LIST_ENTRY;\r
72\r
73typedef struct {\r
74 LIST_ENTRY Link;\r
75 EFI_USB_CONFIG_DESCRIPTOR CongfigDescriptor;\r
76 LIST_ENTRY InterfaceDescListHead;\r
77 UINTN ActiveInterface;\r
78} CONFIG_DESC_LIST_ENTRY;\r
79\r
80//\r
81// Forward declaring\r
82//\r
83struct usb_io_device;\r
84\r
85//\r
86// This is used to form the USB Controller Handle\r
87//\r
88typedef struct usb_io_controller_device {\r
89 UINTN Signature;\r
90 EFI_HANDLE Handle;\r
91 EFI_USB_IO_PROTOCOL UsbIo;\r
92 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
93 EFI_HANDLE HostController;\r
94 UINT8 CurrentConfigValue;\r
95 UINT8 InterfaceNumber;\r
96 struct usb_io_device *UsbDevice;\r
97\r
98 BOOLEAN IsUsbHub;\r
99 BOOLEAN IsManagedByDriver;\r
100\r
101 //\r
102 // Fields specified for USB Hub\r
103 //\r
104 EFI_EVENT HubNotify;\r
105 UINT8 HubEndpointAddress;\r
106 UINT8 StatusChangePort;\r
107 UINT8 DownstreamPorts;\r
108\r
109 UINT8 ParentPort;\r
110 struct usb_io_controller_device *Parent;\r
111 struct usb_io_device *Children[USB_MAXCHILDREN];\r
112} USB_IO_CONTROLLER_DEVICE;\r
113\r
114#define USB_IO_CONTROLLER_DEVICE_FROM_USB_IO_THIS(a) \\r
115 CR(a, USB_IO_CONTROLLER_DEVICE, UsbIo, USB_IO_CONTROLLER_SIGNATURE)\r
116\r
117//\r
118// This is used to keep the topology of USB bus\r
119//\r
120struct _usb_bus_controller_device;\r
121\r
122typedef struct usb_io_device {\r
562d2849 123 UINT8 DeviceAddress;\r
124 BOOLEAN IsConfigured;\r
125 BOOLEAN IsSlowDevice;\r
126 UINT8 DeviceSpeed;\r
127 EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator;\r
128 EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor;\r
129 LIST_ENTRY ConfigDescListHead;\r
130 CONFIG_DESC_LIST_ENTRY *ActiveConfig;\r
131 UINT16 LangID[USB_MAXLANID];\r
878ddf1f 132\r
562d2849 133 struct _usb_bus_controller_device *BusController;\r
878ddf1f 134\r
135 //\r
136 // Track the controller handle\r
137 //\r
562d2849 138 UINT8 NumOfControllers;\r
139 USB_IO_CONTROLLER_DEVICE *UsbController[USB_MAXCONTROLLERS];\r
878ddf1f 140\r
141} USB_IO_DEVICE;\r
142\r
143//\r
144// Usb Bus Controller device strcuture\r
145//\r
146#define EFI_USB_BUS_PROTOCOL_GUID \\r
147 { 0x2B2F68CC, 0x0CD2, 0x44cf, { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } }\r
148\r
149typedef struct _EFI_USB_BUS_PROTOCOL {\r
150 UINT64 Reserved;\r
151} EFI_USB_BUS_PROTOCOL;\r
152\r
153#define USB_BUS_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('u', 'b', 'u', 's')\r
154\r
155typedef struct _usb_bus_controller_device {\r
156 UINTN Signature;\r
157\r
158 EFI_USB_BUS_PROTOCOL BusIdentify;\r
562d2849 159 EFI_USB2_HC_PROTOCOL *Usb2HCInterface;\r
878ddf1f 160 EFI_USB_HC_PROTOCOL *UsbHCInterface;\r
161 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
162 UINT8 AddressPool[16];\r
163 USB_IO_DEVICE *Root;\r
562d2849 164 BOOLEAN Hc2ProtocolSupported;\r
878ddf1f 165} USB_BUS_CONTROLLER_DEVICE;\r
166\r
167#define USB_BUS_CONTROLLER_DEVICE_FROM_THIS(a) \\r
168 CR(a, USB_BUS_CONTROLLER_DEVICE, BusIdentify, USB_BUS_DEVICE_SIGNATURE)\r
169\r
170\r
171//\r
172// Global Variables\r
173//\r
174extern EFI_DRIVER_BINDING_PROTOCOL gUsbBusDriverBinding;\r
175extern EFI_COMPONENT_NAME_PROTOCOL gUsbBusComponentName;\r
878ddf1f 176\r
92dda53e 177//\r
178// EFI_DRIVER_BINDING_PROTOCOL Protocol Interface\r
179//\r
180EFI_STATUS\r
181EFIAPI\r
182UsbBusControllerDriverSupported (\r
183 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
184 IN EFI_HANDLE Controller,\r
185 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
186 );\r
187\r
188EFI_STATUS\r
189EFIAPI\r
190UsbBusControllerDriverStart (\r
191 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
192 IN EFI_HANDLE Controller,\r
193 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
194 );\r
195\r
196EFI_STATUS\r
197EFIAPI\r
198UsbBusControllerDriverStop (\r
199 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
200 IN EFI_HANDLE Controller,\r
201 IN UINTN NumberOfChildren,\r
202 IN EFI_HANDLE *ChildHandleBuffer\r
203 );\r
204\r
205//\r
206// EFI Component Name Functions\r
207//\r
208EFI_STATUS\r
209EFIAPI\r
210UsbBusComponentNameGetDriverName (\r
211 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
212 IN CHAR8 *Language,\r
213 OUT CHAR16 **DriverName\r
214 );\r
215\r
216EFI_STATUS\r
217EFIAPI\r
218UsbBusComponentNameGetControllerName (\r
219 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
220 IN EFI_HANDLE ControllerHandle,\r
221 IN EFI_HANDLE ChildHandle, OPTIONAL\r
222 IN CHAR8 *Language,\r
223 OUT CHAR16 **ControllerName\r
224 );\r
225\r
878ddf1f 226//\r
227// Usb Device Configuration functions\r
228//\r
229BOOLEAN\r
230IsHub (\r
231 IN USB_IO_CONTROLLER_DEVICE *Dev\r
562d2849 232 )\r
233/*++\r
234 \r
235 Routine Description:\r
236 Tell if a usb controller is a hub controller.\r
237 \r
238 Arguments:\r
239 Dev - UsbIoController device structure.\r
240 \r
241 Returns:\r
242 TRUE/FALSE\r
243--*/\r
244;\r
878ddf1f 245\r
246EFI_STATUS\r
247UsbGetStringtable (\r
248 IN USB_IO_DEVICE *UsbIoDevice\r
562d2849 249 )\r
250/*++\r
251 \r
252 Routine Description:\r
253 Get the string table stored in a usb device.\r
254 \r
255 Arguments:\r
256 Dev - UsbIoController device structure.\r
257 \r
258 Returns:\r
259 EFI_SUCCESS\r
260 EFI_UNSUPPORTED\r
261 EFI_OUT_OF_RESOURCES\r
262 \r
263--*/\r
264;\r
878ddf1f 265\r
266EFI_STATUS\r
267UsbGetAllConfigurations (\r
268 IN USB_IO_DEVICE *UsbIoDevice\r
562d2849 269 )\r
270/*++\r
271\r
272 Routine Description:\r
273 This function is to parse all the configuration descriptor.\r
274 \r
275 Arguments:\r
276 UsbIoDevice - USB_IO_DEVICE device structure.\r
277 \r
278 Returns:\r
279 EFI_SUCCESS\r
280 EFI_DEVICE_ERROR\r
281 EFI_OUT_OF_RESOURCES \r
282\r
283--*/\r
284;\r
878ddf1f 285\r
286EFI_STATUS\r
287UsbSetConfiguration (\r
288 IN USB_IO_DEVICE *Dev,\r
289 IN UINTN ConfigurationValue\r
562d2849 290 )\r
291/*++\r
292\r
293 Routine Description:\r
294 Set the device to a configuration value.\r
295 \r
296 Arguments:\r
297 UsbIoDev - USB_IO_DEVICE to be set configuration\r
298 ConfigrationValue - The configuration value to be set to that device\r
299 \r
300 Returns:\r
301 EFI_SUCCESS\r
302 EFI_DEVICE_ERROR\r
303 \r
304--*/\r
305;\r
878ddf1f 306\r
307EFI_STATUS\r
308UsbSetDefaultConfiguration (\r
309 IN USB_IO_DEVICE *Dev\r
562d2849 310 )\r
311/*++\r
312\r
313 Routine Description:\r
314 Set the device to a default configuration value.\r
315 \r
316 Arguments:\r
317 UsbIoDev - USB_IO_DEVICE to be set configuration\r
318 \r
319 Returns\r
320 EFI_SUCCESS\r
321 EFI_DEVICE_ERROR\r
322 \r
323--*/\r
324;\r
878ddf1f 325\r
326//\r
327// Device Deconfiguration functions\r
328//\r
329VOID\r
330UsbDestroyAllConfiguration (\r
331 IN USB_IO_DEVICE *UsbIoDevice\r
562d2849 332 )\r
333/*++\r
334\r
335 Routine Description:\r
336 Delete all configuration data when device is not used.\r
337 \r
338 Arguments:\r
339 UsbIoDevice - USB_IO_DEVICE to be set configuration\r
340 \r
341 Returns:\r
342 VOID\r
343 \r
344--*/\r
345;\r
878ddf1f 346\r
347EFI_STATUS\r
348DoHubConfig (\r
349 IN USB_IO_CONTROLLER_DEVICE *HubIoDevice\r
562d2849 350 )\r
351/*++\r
352 \r
353 Routine Description:\r
354 Configure the hub\r
355 \r
356 Arguments:\r
357 HubController - Indicating the hub controller device that\r
358 will be configured\r
359 \r
360 Returns:\r
361 EFI_SUCCESS\r
362 EFI_DEVICE_ERROR\r
363 \r
364--*/\r
365\r
366;\r
878ddf1f 367\r
368VOID\r
369GetDeviceEndPointMaxPacketLength (\r
370 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
371 IN UINT8 EndpointAddr,\r
562d2849 372 OUT UINTN *MaxPacketLength\r
373 )\r
374/*++\r
375\r
376 Routine Description:\r
377 Get the Max Packet Length of the speified Endpoint.\r
378\r
379 Arguments:\r
380 UsbIo - Given Usb Controller device.\r
381 EndpointAddr - Given Endpoint address.\r
382 MaxPacketLength - The max packet length of that endpoint\r
383\r
384 Returns:\r
385 N/A\r
386\r
387--*/\r
388;\r
878ddf1f 389\r
390VOID\r
391GetDataToggleBit (\r
392 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
393 IN UINT8 EndpointAddr,\r
394 OUT UINT8 *DataToggle\r
562d2849 395 )\r
396/*++\r
397\r
398 Routine Description:\r
399 Get the datatoggle of a specified endpoint.\r
400\r
401 Arguments:\r
402 UsbIo - Given Usb Controller device.\r
403 EndpointAddr - Given Endpoint address.\r
404 DataToggle - The current data toggle of that endpoint\r
405\r
406 Returns:\r
407 VOID\r
408 \r
409--*/\r
410;\r
878ddf1f 411\r
412VOID\r
413SetDataToggleBit (\r
414 IN EFI_USB_IO_PROTOCOL *UsbIo,\r
415 IN UINT8 EndpointAddr,\r
416 IN UINT8 DataToggle\r
562d2849 417 )\r
418/*++\r
419\r
420 Routine Description:\r
421 Set the datatoggle of a specified endpoint\r
422\r
423 Arguments:\r
424 UsbIo - Given Usb Controller device.\r
425 EndpointAddr - Given Endpoint address.\r
426 DataToggle - The current data toggle of that endpoint to be set\r
427\r
428 Returns:\r
429 VOID\r
430\r
431--*/\r
432;\r
878ddf1f 433\r
562d2849 434INTERFACE_DESC_LIST_ENTRY *\r
878ddf1f 435FindInterfaceListEntry (\r
436 IN EFI_USB_IO_PROTOCOL *This\r
562d2849 437 )\r
438/*++\r
439\r
440 Routine Description:\r
441 Find Interface ListEntry.\r
878ddf1f 442\r
562d2849 443 Arguments:\r
444 This - EFI_USB_IO_PROTOCOL \r
445 \r
446 Returns:\r
447 INTERFACE_DESC_LIST_ENTRY pointer\r
448\r
449--*/\r
450;\r
451\r
452ENDPOINT_DESC_LIST_ENTRY *\r
878ddf1f 453FindEndPointListEntry (\r
454 IN EFI_USB_IO_PROTOCOL *This,\r
455 IN UINT8 EndPointAddress\r
562d2849 456 )\r
457/*++\r
458\r
459 Routine Description:\r
460 Find EndPoint ListEntry.\r
878ddf1f 461\r
562d2849 462 Arguments:\r
463 This - EFI_USB_IO_PROTOCOL \r
464 EndpointAddr - Endpoint address.\r
465 \r
466 Returns:\r
467 ENDPOINT_DESC_LIST_ENTRY pointer\r
468\r
469--*/\r
470;\r
878ddf1f 471\r
472EFI_STATUS\r
473IsDeviceDisconnected (\r
474 IN USB_IO_CONTROLLER_DEVICE *UsbIoController,\r
475 IN OUT BOOLEAN *Disconnected\r
562d2849 476 )\r
477/*++\r
478\r
479 Routine Description:\r
480 Reset if the device is disconencted or not\r
481\r
482 Arguments:\r
483 UsbIoController - Indicating the Usb Controller Device.\r
484 Disconnected - Indicate whether the device is disconencted or not\r
485\r
486 Returns:\r
487 EFI_SUCCESS\r
488 EFI_DEVICE_ERROR\r
489\r
490--*/\r
491;\r
878ddf1f 492\r
493EFI_STATUS\r
494UsbDeviceDeConfiguration (\r
495 IN USB_IO_DEVICE *UsbIoDevice\r
562d2849 496 )\r
497/*++\r
498\r
499 Routine Description:\r
500 Remove Device, Device Handles, Uninstall Protocols.\r
501\r
502 Arguments:\r
503 UsbIoDevice - The device to be deconfigured.\r
504\r
505 Returns: \r
506 EFI_SUCCESS\r
507 EFI_DEVICE_ERROR\r
508\r
509--*/\r
510;\r
878ddf1f 511\r
562d2849 512EFI_STATUS\r
513EFIAPI\r
514UsbVirtualHcGetCapability (\r
515 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
516 OUT UINT8 *MaxSpeed,\r
517 OUT UINT8 *PortNumber,\r
518 OUT UINT8 *Is64BitCapable\r
519 )\r
520/*++\r
521 \r
522 Routine Description:\r
523 \r
524 Virtual interface to Retrieves the capablility of root hub ports \r
525 for both Hc2 and Hc protocol.\r
526 \r
527 Arguments:\r
528 \r
529 UsbBusDev - A pointer to bus controller of the device.\r
530 MaxSpeed - A pointer to the number of the host controller.\r
531 PortNumber - A pointer to the number of the root hub ports.\r
532 Is64BitCapable - A pointer to the flag for whether controller supports \r
533 64-bit memory addressing.\r
534 \r
535 Returns:\r
536 \r
537 EFI_SUCCESS \r
538 The host controller capability were retrieved successfully.\r
539 EFI_INVALID_PARAMETER \r
540 MaxSpeed or PortNumber or Is64BitCapable is NULL.\r
541 EFI_DEVICE_ERROR \r
542 An error was encountered while attempting to retrieve the capabilities. \r
543 \r
544--*/\r
545;\r
546\r
547EFI_STATUS\r
548EFIAPI\r
549UsbVirtualHcReset (\r
550 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
551 IN UINT16 Attributes\r
552 )\r
553/*++\r
554 \r
555 Routine Description:\r
556 \r
557 Virtual interface to provides software reset for the USB host controller\r
558 for both Hc2 and Hc protocol.\r
559 \r
560 Arguments:\r
561 \r
562 UsbBusDev - A pointer to bus controller of the device.\r
563 Attributes - A bit mask of the reset operation to perform. \r
564 See below for a list of the supported bit mask values.\r
565 \r
566 #define EFI_USB_HC_RESET_GLOBAL 0x0001 // Hc2 and Hc\r
567 #define EFI_USB_HC_RESET_HOST_CONTROLLER 0x0002 // Hc2 and Hc\r
568 #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG 0x0004 // Hc2\r
569 #define EFI_USB_HC_RESET_HOST_WITH_DEBUG 0x0008 // Hc2\r
570\r
571 EFI_USB_HC_RESET_GLOBAL \r
572 If this bit is set, a global reset signal will be sent to the USB bus.\r
573 This resets all of the USB bus logic, including the USB host \r
574 controller hardware and all the devices attached on the USB bus.\r
575 EFI_USB_HC_RESET_HOST_CONTROLLER \r
576 If this bit is set, the USB host controller hardware will be reset. \r
577 No reset signal will be sent to the USB bus.\r
578 EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG\r
579 If this bit is set, a global reset signal will be sent to the USB bus.\r
580 This resets all of the USB bus logic, including the USB host \r
581 controller hardware and all the devices attached on the USB bus. \r
582 If this is an EHCI controller and the debug port has configured, then \r
583 this is will still reset the host controller.\r
584 EFI_USB_HC_RESET_HOST_WITH_DEBUG\r
585 If this bit is set, the USB host controller hardware will be reset. \r
586 If this is an EHCI controller and the debug port has been configured,\r
587 then this will still reset the host controller.\r
588 \r
589 Returns:\r
590 \r
591 EFI_SUCCESS \r
592 The reset operation succeeded.\r
593 EFI_INVALID_PARAMETER \r
594 Attributes is not valid.\r
595 EFI_UNSUPPOURTED\r
596 The type of reset specified by Attributes is not currently supported by\r
597 the host controller hardware.\r
598 EFI_ACCESS_DENIED\r
599 Reset operation is rejected due to the debug port being configured and \r
600 active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or \r
601 EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Atrributes can be used to\r
602 perform reset operation for this host controller.\r
603 EFI_DEVICE_ERROR \r
604 An error was encountered while attempting to perform \r
605 the reset operation.\r
606 \r
607--*/\r
608;\r
609\r
610EFI_STATUS\r
611EFIAPI\r
612UsbVirtualHcGetState (\r
613 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
614 OUT EFI_USB_HC_STATE *State\r
615 )\r
616/*++\r
617 \r
618 Routine Description:\r
619 \r
620 Virtual interface to retrieves current state of the USB host controller\r
621 for both Hc2 and Hc protocol.\r
622 \r
623 Arguments:\r
624 \r
625 UsbBusDev - A pointer to bus controller of the device.\r
626 State - A pointer to the EFI_USB_HC_STATE data structure that \r
627 indicates current state of the USB host controller. \r
628 Type EFI_USB_HC_STATE is defined below.\r
629 \r
630 typedef enum {\r
631 EfiUsbHcStateHalt,\r
632 EfiUsbHcStateOperational,\r
633 EfiUsbHcStateSuspend,\r
634 EfiUsbHcStateMaximum\r
635 } EFI_USB_HC_STATE;\r
636 \r
637 Returns:\r
638 \r
639 EFI_SUCCESS \r
640 The state information of the host controller was returned in State.\r
641 EFI_INVALID_PARAMETER \r
642 State is NULL.\r
643 EFI_DEVICE_ERROR \r
644 An error was encountered while attempting to retrieve the \r
645 host controller's current state. \r
646 \r
647--*/\r
648;\r
649\r
650EFI_STATUS\r
651EFIAPI\r
652UsbVirtualHcSetState (\r
653 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
654 IN EFI_USB_HC_STATE State\r
655 )\r
656/*++\r
657 \r
658 Routine Description:\r
659 \r
660 Virtual interface to sets the USB host controller to a specific state\r
661 for both Hc2 and Hc protocol.\r
662 \r
663 Arguments:\r
664 \r
665 UsbBusDev - A pointer to bus controller of the device.\r
666 State - Indicates the state of the host controller that will be set.\r
667 \r
668 Returns:\r
669 \r
670 EFI_SUCCESS \r
671 The USB host controller was successfully placed in the state \r
672 specified by State.\r
673 EFI_INVALID_PARAMETER \r
674 State is invalid.\r
675 EFI_DEVICE_ERROR \r
676 Failed to set the state specified by State due to device error. \r
677 \r
678--*/\r
679;\r
680\r
681EFI_STATUS\r
682EFIAPI\r
683UsbVirtualHcGetRootHubPortStatus (\r
684 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
685 IN UINT8 PortNumber,\r
686 OUT EFI_USB_PORT_STATUS *PortStatus\r
687 )\r
688/*++\r
689 \r
690 Routine Description:\r
691 \r
692 Virtual interface to retrieves the current status of a USB root hub port\r
693 both for Hc2 and Hc protocol.\r
694 \r
695 Arguments:\r
696 \r
697 UsbBusDev - A pointer to bus controller of the device.\r
698 PortNumber - Specifies the root hub port from which the status \r
699 is to be retrieved. This value is zero-based. For example, \r
700 if a root hub has two ports, then the first port is numbered 0,\r
701 and the second port is numbered 1.\r
702 PortStatus - A pointer to the current port status bits and \r
703 port status change bits. \r
704 \r
705 Returns:\r
706 \r
707 EFI_SUCCESS The status of the USB root hub port specified by PortNumber \r
708 was returned in PortStatus.\r
709 EFI_INVALID_PARAMETER PortNumber is invalid. \r
710 EFI_DEVICE_ERROR Can't read register \r
711 \r
712--*/\r
713;\r
714\r
715EFI_STATUS\r
716EFIAPI\r
717UsbVirtualHcSetRootHubPortFeature (\r
718 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
719 IN UINT8 PortNumber,\r
720 IN EFI_USB_PORT_FEATURE PortFeature\r
721 )\r
722/*++\r
723 \r
724 Routine Description:\r
725 Virual interface to sets a feature for the specified root hub port\r
726 for both Hc2 and Hc protocol.\r
727 \r
728 Arguments:\r
729 \r
730 UsbBusDev - A pointer to bus controller of the device.\r
731 PortNumber - Specifies the root hub port whose feature \r
732 is requested to be set.\r
733 PortFeature - Indicates the feature selector associated \r
734 with the feature set request. \r
735 \r
736 Returns:\r
737 \r
738 EFI_SUCCESS \r
739 The feature specified by PortFeature was set for the \r
740 USB root hub port specified by PortNumber.\r
741 EFI_INVALID_PARAMETER \r
742 PortNumber is invalid or PortFeature is invalid.\r
743 EFI_DEVICE_ERROR\r
744 Can't read register\r
745 \r
746--*/\r
747;\r
748\r
749EFI_STATUS\r
750EFIAPI\r
751UsbVirtualHcClearRootHubPortFeature (\r
752 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
753 IN UINT8 PortNumber,\r
754 IN EFI_USB_PORT_FEATURE PortFeature\r
755 )\r
756/*++\r
757 \r
758 Routine Description:\r
759 \r
760 Virtual interface to clears a feature for the specified root hub port\r
761 for both Hc2 and Hc protocol.\r
762 \r
763 Arguments:\r
764 \r
765 UsbBusDev - A pointer to bus controller of the device.\r
766 PortNumber - Specifies the root hub port whose feature \r
767 is requested to be cleared.\r
768 PortFeature - Indicates the feature selector associated with the \r
769 feature clear request.\r
770 \r
771 Returns:\r
772 \r
773 EFI_SUCCESS \r
774 The feature specified by PortFeature was cleared for the \r
775 USB root hub port specified by PortNumber.\r
776 EFI_INVALID_PARAMETER \r
777 PortNumber is invalid or PortFeature is invalid.\r
778 EFI_DEVICE_ERROR\r
779 Can't read register\r
780 \r
781--*/\r
782;\r
783\r
784EFI_STATUS\r
785EFIAPI\r
786UsbVirtualHcControlTransfer (\r
787 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
788 IN UINT8 DeviceAddress,\r
789 IN UINT8 DeviceSpeed,\r
790 IN UINTN MaximumPacketLength,\r
791 IN EFI_USB_DEVICE_REQUEST *Request,\r
792 IN EFI_USB_DATA_DIRECTION TransferDirection,\r
793 IN OUT VOID *Data,\r
794 IN OUT UINTN *DataLength,\r
795 IN UINTN TimeOut,\r
796 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
797 OUT UINT32 *TransferResult\r
798 )\r
799/*++\r
800 \r
801 Routine Description:\r
802 \r
803 Virtual interface to submits control transfer to a target USB device\r
804 for both Hc2 and Hc protocol.\r
805 \r
806 Arguments:\r
807 \r
808 UsbBusDev - A pointer to bus controller of the device.\r
809 DeviceAddress - Represents the address of the target device on the USB,\r
810 which is assigned during USB enumeration.\r
811 DeviceSpeed - Indicates target device speed.\r
812 MaximumPacketLength - Indicates the maximum packet size that the \r
813 default control transfer endpoint is capable of \r
814 sending or receiving.\r
815 Request - A pointer to the USB device request that will be sent \r
816 to the USB device. \r
817 TransferDirection - Specifies the data direction for the transfer.\r
818 There are three values available, DataIn, DataOut \r
819 and NoData.\r
820 Data - A pointer to the buffer of data that will be transmitted \r
821 to USB device or received from USB device.\r
822 DataLength - Indicates the size, in bytes, of the data buffer \r
823 specified by Data.\r
824 TimeOut - Indicates the maximum time, in microseconds, \r
825 which the transfer is allowed to complete.\r
826 Translator - A pointr to the transaction translator data.\r
827 TransferResult - A pointer to the detailed result information generated \r
828 by this control transfer.\r
829 \r
830 Returns:\r
831 \r
832 EFI_SUCCESS \r
833 The control transfer was completed successfully.\r
834 EFI_OUT_OF_RESOURCES \r
835 The control transfer could not be completed due to a lack of resources.\r
836 EFI_INVALID_PARAMETER \r
837 Some parameters are invalid.\r
838 EFI_TIMEOUT \r
839 The control transfer failed due to timeout.\r
840 EFI_DEVICE_ERROR \r
841 The control transfer failed due to host controller or device error. \r
842 Caller should check TranferResult for detailed error information.\r
843\r
844--*/\r
845;\r
846\r
847EFI_STATUS\r
848EFIAPI\r
849UsbVirtualHcBulkTransfer (\r
850 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
851 IN UINT8 DeviceAddress,\r
852 IN UINT8 EndPointAddress,\r
853 IN UINT8 DeviceSpeed,\r
854 IN UINTN MaximumPacketLength,\r
855 IN UINT8 DataBuffersNumber,\r
856 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
857 IN OUT UINTN *DataLength,\r
858 IN OUT UINT8 *DataToggle,\r
859 IN UINTN TimeOut,\r
860 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
861 OUT UINT32 *TransferResult\r
862 )\r
863/*++\r
864 \r
865 Routine Description:\r
866 \r
867 Virtual interface to submits bulk transfer to a bulk endpoint of a USB device\r
868 both for Hc2 and Hc protocol.\r
869 \r
870 Arguments:\r
871 \r
872 UsbBusDev - A pointer to bus controller of the device.\r
873 DeviceAddress - Represents the address of the target device on the USB,\r
874 which is assigned during USB enumeration. \r
875 EndPointAddress - The combination of an endpoint number and an \r
876 endpoint direction of the target USB device. \r
877 Each endpoint address supports data transfer in \r
878 one direction except the control endpoint \r
879 (whose default endpoint address is 0). \r
880 It is the caller's responsibility to make sure that \r
881 the EndPointAddress represents a bulk endpoint. \r
882 DeviceSpeed - Indicates device speed. The supported values are EFI_USB_SPEED_FULL\r
883 and EFI_USB_SPEED_HIGH.\r
884 MaximumPacketLength - Indicates the maximum packet size the target endpoint\r
885 is capable of sending or receiving. \r
886 DataBuffersNumber - Number of data buffers prepared for the transfer.\r
887 Data - Array of pointers to the buffers of data that will be transmitted \r
888 to USB device or received from USB device. \r
889 DataLength - When input, indicates the size, in bytes, of the data buffer\r
890 specified by Data. When output, indicates the actually \r
891 transferred data size. \r
892 DataToggle - A pointer to the data toggle value. On input, it indicates \r
893 the initial data toggle value the bulk transfer should adopt;\r
894 on output, it is updated to indicate the data toggle value \r
895 of the subsequent bulk transfer. \r
896 Translator - A pointr to the transaction translator data. \r
897 TimeOut - Indicates the maximum time, in microseconds, which the \r
898 transfer is allowed to complete. \r
899 TransferResult - A pointer to the detailed result information of the \r
900 bulk transfer.\r
901\r
902 Returns:\r
903 \r
904 EFI_SUCCESS \r
905 The bulk transfer was completed successfully.\r
906 EFI_OUT_OF_RESOURCES \r
907 The bulk transfer could not be submitted due to lack of resource.\r
908 EFI_INVALID_PARAMETER \r
909 Some parameters are invalid.\r
910 EFI_TIMEOUT \r
911 The bulk transfer failed due to timeout.\r
912 EFI_DEVICE_ERROR \r
913 The bulk transfer failed due to host controller or device error.\r
914 Caller should check TranferResult for detailed error information.\r
915\r
916--*/\r
917;\r
918\r
919EFI_STATUS\r
920EFIAPI\r
921UsbVirtualHcAsyncInterruptTransfer (\r
922 IN USB_BUS_CONTROLLER_DEVICE * UsbBusDev,\r
923 IN UINT8 DeviceAddress,\r
924 IN UINT8 EndPointAddress,\r
925 IN UINT8 DeviceSpeed,\r
926 IN UINTN MaximumPacketLength,\r
927 IN BOOLEAN IsNewTransfer,\r
928 IN OUT UINT8 *DataToggle,\r
929 IN UINTN PollingInterval,\r
930 IN UINTN DataLength,\r
931 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR * Translator,\r
932 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction,\r
933 IN VOID *Context OPTIONAL\r
934 )\r
935/*++\r
936 \r
937 Routine Description:\r
938 \r
939 Virtual interface to submits an asynchronous interrupt transfer to an \r
940 interrupt endpoint of a USB device for both Hc2 and Hc protocol.\r
941 \r
942 Arguments:\r
943 \r
944 UsbBusDev - A pointer to bus controller of the device.\r
945 DeviceAddress - Represents the address of the target device on the USB,\r
946 which is assigned during USB enumeration. \r
947 EndPointAddress - The combination of an endpoint number and an endpoint \r
948 direction of the target USB device. Each endpoint address \r
949 supports data transfer in one direction except the \r
950 control endpoint (whose default endpoint address is 0). \r
951 It is the caller's responsibility to make sure that \r
952 the EndPointAddress represents an interrupt endpoint. \r
953 DeviceSpeed - Indicates device speed.\r
954 MaximumPacketLength - Indicates the maximum packet size the target endpoint\r
955 is capable of sending or receiving. \r
956 IsNewTransfer - If TRUE, an asynchronous interrupt pipe is built between\r
957 the host and the target interrupt endpoint. \r
958 If FALSE, the specified asynchronous interrupt pipe \r
959 is canceled. \r
960 DataToggle - A pointer to the data toggle value. On input, it is valid \r
961 when IsNewTransfer is TRUE, and it indicates the initial \r
962 data toggle value the asynchronous interrupt transfer \r
963 should adopt. \r
964 On output, it is valid when IsNewTransfer is FALSE, \r
965 and it is updated to indicate the data toggle value of \r
966 the subsequent asynchronous interrupt transfer. \r
967 PollingInterval - Indicates the interval, in milliseconds, that the \r
968 asynchronous interrupt transfer is polled. \r
969 This parameter is required when IsNewTransfer is TRUE. \r
970 DataLength - Indicates the length of data to be received at the \r
971 rate specified by PollingInterval from the target \r
972 asynchronous interrupt endpoint. This parameter \r
973 is only required when IsNewTransfer is TRUE. \r
974 Translator - A pointr to the transaction translator data.\r
975 CallBackFunction - The Callback function.This function is called at the \r
976 rate specified by PollingInterval.This parameter is \r
977 only required when IsNewTransfer is TRUE. \r
978 Context - The context that is passed to the CallBackFunction.\r
979 - This is an optional parameter and may be NULL.\r
980 \r
981 Returns:\r
982 \r
983 EFI_SUCCESS \r
984 The asynchronous interrupt transfer request has been successfully \r
985 submitted or canceled.\r
986 EFI_INVALID_PARAMETER \r
987 Some parameters are invalid.\r
988 EFI_OUT_OF_RESOURCES \r
989 The request could not be completed due to a lack of resources. \r
990 EFI_DEVICE_ERROR\r
991 Can't read register\r
992 \r
993--*/\r
994;\r
995\r
996EFI_STATUS\r
997EFIAPI\r
998UsbVirtualHcSyncInterruptTransfer (\r
999 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
1000 IN UINT8 DeviceAddress,\r
1001 IN UINT8 EndPointAddress,\r
1002 IN UINT8 DeviceSpeed,\r
1003 IN UINTN MaximumPacketLength,\r
1004 IN OUT VOID *Data,\r
1005 IN OUT UINTN *DataLength,\r
1006 IN OUT UINT8 *DataToggle,\r
1007 IN UINTN TimeOut,\r
1008 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
1009 OUT UINT32 *TransferResult\r
1010 )\r
1011/*++\r
1012 \r
1013 Routine Description:\r
1014 \r
1015 Vitual interface to submits synchronous interrupt transfer to an interrupt endpoint \r
1016 of a USB device for both Hc2 and Hc protocol.\r
1017 \r
1018 Arguments:\r
1019 \r
1020 UsbBusDev - A pointer to bus controller of the device.\r
1021 DeviceAddress - Represents the address of the target device on the USB, \r
1022 which is assigned during USB enumeration.\r
1023 EndPointAddress - The combination of an endpoint number and an endpoint \r
1024 direction of the target USB device. Each endpoint \r
1025 address supports data transfer in one direction \r
1026 except the control endpoint (whose default \r
1027 endpoint address is 0). It is the caller's responsibility\r
1028 to make sure that the EndPointAddress represents \r
1029 an interrupt endpoint. \r
1030 DeviceSpeed - Indicates device speed.\r
1031 MaximumPacketLength - Indicates the maximum packet size the target endpoint \r
1032 is capable of sending or receiving.\r
1033 Data - A pointer to the buffer of data that will be transmitted \r
1034 to USB device or received from USB device.\r
1035 DataLength - On input, the size, in bytes, of the data buffer specified \r
1036 by Data. On output, the number of bytes transferred.\r
1037 DataToggle - A pointer to the data toggle value. On input, it indicates\r
1038 the initial data toggle value the synchronous interrupt \r
1039 transfer should adopt; \r
1040 on output, it is updated to indicate the data toggle value \r
1041 of the subsequent synchronous interrupt transfer. \r
1042 TimeOut - Indicates the maximum time, in microseconds, which the \r
1043 transfer is allowed to complete.\r
1044 Translator - A pointr to the transaction translator data.\r
1045 TransferResult - A pointer to the detailed result information from \r
1046 the synchronous interrupt transfer. \r
1047\r
1048 Returns:\r
1049 \r
1050 EFI_SUCCESS \r
1051 The synchronous interrupt transfer was completed successfully.\r
1052 EFI_OUT_OF_RESOURCES \r
1053 The synchronous interrupt transfer could not be submitted due \r
1054 to lack of resource.\r
1055 EFI_INVALID_PARAMETER \r
1056 Some parameters are invalid.\r
1057 EFI_TIMEOUT \r
1058 The synchronous interrupt transfer failed due to timeout.\r
1059 EFI_DEVICE_ERROR \r
1060 The synchronous interrupt transfer failed due to host controller \r
1061 or device error. Caller should check TranferResult for detailed \r
1062 error information. \r
1063 \r
1064--*/\r
1065;\r
1066\r
1067EFI_STATUS\r
1068EFIAPI\r
1069UsbVirtualHcIsochronousTransfer (\r
1070 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
1071 IN UINT8 DeviceAddress,\r
1072 IN UINT8 EndPointAddress,\r
1073 IN UINT8 DeviceSpeed,\r
1074 IN UINTN MaximumPacketLength,\r
1075 IN UINT8 DataBuffersNumber,\r
1076 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
1077 IN UINTN DataLength,\r
1078 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
1079 OUT UINT32 *TransferResult\r
1080 )\r
1081/*++\r
1082 \r
1083 Routine Description:\r
1084 \r
1085 Virtual interface to submits isochronous transfer to a target USB device\r
1086 for both Hc2 and Hc protocol.\r
1087 \r
1088 Arguments:\r
1089 \r
1090 UsbBusDev - A pointer to bus controller of the device.\r
1091 DeviceAddress - Represents the address of the target device on the USB,\r
1092 which is assigned during USB enumeration.\r
1093 EndPointAddress - End point address\r
1094 DeviceSpeed - Indicates device speed.\r
1095 MaximumPacketLength - Indicates the maximum packet size that the \r
1096 default control transfer endpoint is capable of \r
1097 sending or receiving.\r
1098 DataBuffersNumber - Number of data buffers prepared for the transfer.\r
1099 Data - Array of pointers to the buffers of data that will be \r
1100 transmitted to USB device or received from USB device.\r
1101 DataLength - Indicates the size, in bytes, of the data buffer \r
1102 specified by Data.\r
1103 Translator - A pointr to the transaction translator data.\r
1104 TransferResult - A pointer to the detailed result information generated \r
1105 by this control transfer. \r
1106 \r
1107 Returns:\r
1108 \r
1109 EFI_UNSUPPORTED \r
1110\r
1111--*/\r
1112;\r
1113\r
1114EFI_STATUS\r
1115EFIAPI\r
1116UsbVirtualHcAsyncIsochronousTransfer (\r
1117 IN USB_BUS_CONTROLLER_DEVICE *UsbBusDev,\r
1118 IN UINT8 DeviceAddress,\r
1119 IN UINT8 EndPointAddress,\r
1120 IN UINT8 DeviceSpeed,\r
1121 IN UINTN MaximumPacketLength,\r
1122 IN UINT8 DataBuffersNumber,\r
1123 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],\r
1124 IN UINTN DataLength,\r
1125 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
1126 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
1127 IN VOID *Context\r
1128 )\r
1129/*++\r
1130 \r
1131 Routine Description:\r
1132 \r
1133 Vitual interface to submits Async isochronous transfer to a target USB device\r
1134 for both Hc2 and Hc protocol.\r
1135 \r
1136 Arguments:\r
1137 \r
1138 UsbBusDev - A pointer to bus controller of the device.\r
1139 DeviceAddress - Represents the address of the target device on the USB,\r
1140 which is assigned during USB enumeration.\r
1141 EndPointAddress - End point address\r
1142 DeviceSpeed - Indicates device speed.\r
1143 MaximumPacketLength - Indicates the maximum packet size that the \r
1144 default control transfer endpoint is capable of \r
1145 sending or receiving.\r
1146 DataBuffersNumber - Number of data buffers prepared for the transfer.\r
1147 Data - Array of pointers to the buffers of data that will be transmitted \r
1148 to USB device or received from USB device.\r
1149 DataLength - Indicates the size, in bytes, of the data buffer \r
1150 specified by Data.\r
1151 Translator - A pointr to the transaction translator data.\r
1152 IsochronousCallBack - When the transfer complete, the call back function will be called\r
1153 Context - Pass to the call back function as parameter\r
1154 \r
1155 Returns:\r
1156 \r
1157 EFI_UNSUPPORTED \r
1158\r
1159--*/\r
1160;\r
878ddf1f 1161\r
617de480 1162EFI_STATUS\r
1163EFIAPI\r
1164UsbPortReset (\r
1165 IN EFI_USB_IO_PROTOCOL *This\r
1166 )\r
1167/*++\r
1168\r
1169 Routine Description:\r
1170 Resets and reconfigures the USB controller. This function will\r
1171 work for all USB devices except USB Hub Controllers.\r
1172\r
1173 Arguments:\r
1174 This - Indicates the calling context.\r
1175\r
1176 Returns:\r
1177 EFI_SUCCESS\r
1178 EFI_INVALID_PARAMETER\r
1179 EFI_DEVICE_ERROR\r
1180\r
1181--*/\r
1182;\r
1183\r
1184VOID\r
1185InitializeUsbIoInstance (\r
1186 IN USB_IO_CONTROLLER_DEVICE *UsbIoController\r
1187 )\r
1188/*++\r
1189\r
1190Routine Description:\r
1191\r
1192 Initialize the instance of UsbIo controller\r
1193\r
1194Arguments:\r
1195\r
1196 UsbIoController - A pointer to controller structure of UsbIo\r
1197\r
1198Returns:\r
1199\r
1200--*/\r
1201;\r
1202\r
878ddf1f 1203#endif\r