[efi] Expose unused USB devices via EFI_USB_IO_PROTOCOL
[ipxe.git] / src / include / ipxe / efi / efi_usb.h
1 #ifndef _IPXE_EFI_USB_H
2 #define _IPXE_EFI_USB_H
3
4 /** @file
5 *
6 * USB I/O protocol
7 *
8 */
9
10 #include <ipxe/list.h>
11 #include <ipxe/efi/efi.h>
12 #include <ipxe/efi/efi_driver.h>
13 #include <ipxe/efi/Protocol/UsbIo.h>
14 #include <ipxe/usb.h>
15
16 /** An EFI USB device */
17 struct efi_usb_device {
18 /** Name */
19 const char *name;
20 /** The underlying USB device */
21 struct usb_device *usb;
22 /** The underlying EFI device */
23 struct efi_device *efidev;
24 /** Configuration descriptor */
25 struct usb_configuration_descriptor *config;
26 /** Supported languages */
27 struct usb_descriptor_header *languages;
28 /** List of interfaces */
29 struct list_head interfaces;
30 };
31
32 /** An EFI USB device interface */
33 struct efi_usb_interface {
34 /** Name */
35 char name[32];
36 /** Containing USB device */
37 struct efi_usb_device *usbdev;
38 /** List of interfaces */
39 struct list_head list;
40
41 /** Interface number */
42 unsigned int interface;
43 /** Alternate setting */
44 unsigned int alternate;
45 /** EFI handle */
46 EFI_HANDLE handle;
47 /** USB I/O protocol */
48 EFI_USB_IO_PROTOCOL usbio;
49 /** Device path */
50 EFI_DEVICE_PATH_PROTOCOL *path;
51
52 /** Opened endpoints */
53 struct efi_usb_endpoint *endpoint[32];
54 };
55
56 /** An EFI USB device endpoint */
57 struct efi_usb_endpoint {
58 /** EFI USB device interface */
59 struct efi_usb_interface *usbintf;
60 /** USB endpoint */
61 struct usb_endpoint ep;
62
63 /** Most recent synchronous completion status */
64 int rc;
65
66 /** Asynchronous timer event */
67 EFI_EVENT event;
68 /** Asynchronous callback handler */
69 EFI_ASYNC_USB_TRANSFER_CALLBACK callback;
70 /** Asynchronous callback context */
71 void *context;
72 };
73
74 /** Asynchronous transfer fill level
75 *
76 * This is a policy decision.
77 */
78 #define EFI_USB_ASYNC_FILL 2
79
80 #endif /* _IPXE_EFI_USB_H */