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