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