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