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