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