]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbEnumer.h
1 /** @file
2
3 USB bus enumeration interface.
4
5 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #ifndef _USB_ENUMERATION_H_
11 #define _USB_ENUMERATION_H_
12
13 //
14 // Advance the byte and bit to the next bit, adjust byte accordingly.
15 //
16 #define USB_NEXT_BIT(Byte, Bit) \
17 do { \
18 (Bit)++; \
19 if ((Bit) > 7) { \
20 (Byte)++; \
21 (Bit) = 0; \
22 } \
23 } while (0)
24
25 //
26 // Common interface used by usb bus enumeration process.
27 // This interface is defined to mask the difference between
28 // the root hub and normal hub. So, bus enumeration code
29 // can be shared by both root hub and normal hub
30 //
31 typedef
32 EFI_STATUS
33 (*USB_HUB_INIT) (
34 IN USB_INTERFACE *UsbIf
35 );
36
37 //
38 // Get the port status. This function is required to
39 // ACK the port change bits although it will return
40 // the port changes in PortState. Bus enumeration code
41 // doesn't need to ACK the port change bits.
42 //
43 typedef
44 EFI_STATUS
45 (*USB_HUB_GET_PORT_STATUS) (
46 IN USB_INTERFACE *UsbIf,
47 IN UINT8 Port,
48 OUT EFI_USB_PORT_STATUS *PortState
49 );
50
51 typedef
52 VOID
53 (*USB_HUB_CLEAR_PORT_CHANGE) (
54 IN USB_INTERFACE *HubIf,
55 IN UINT8 Port
56 );
57
58 typedef
59 EFI_STATUS
60 (*USB_HUB_SET_PORT_FEATURE) (
61 IN USB_INTERFACE *UsbIf,
62 IN UINT8 Port,
63 IN EFI_USB_PORT_FEATURE Feature
64 );
65
66 typedef
67 EFI_STATUS
68 (*USB_HUB_CLEAR_PORT_FEATURE) (
69 IN USB_INTERFACE *UsbIf,
70 IN UINT8 Port,
71 IN EFI_USB_PORT_FEATURE Feature
72 );
73
74 typedef
75 EFI_STATUS
76 (*USB_HUB_RESET_PORT) (
77 IN USB_INTERFACE *UsbIf,
78 IN UINT8 Port
79 );
80
81 typedef
82 EFI_STATUS
83 (*USB_HUB_RELEASE) (
84 IN USB_INTERFACE *UsbIf
85 );
86
87 /**
88 Return the endpoint descriptor in this interface.
89
90 @param UsbIf The interface to search in.
91 @param EpAddr The address of the endpoint to return.
92
93 @return The endpoint descriptor or NULL.
94
95 **/
96 USB_ENDPOINT_DESC *
97 UsbGetEndpointDesc (
98 IN USB_INTERFACE *UsbIf,
99 IN UINT8 EpAddr
100 );
101
102 /**
103 Select an alternate setting for the interface.
104 Each interface can have several mutually exclusive
105 settings. Only one setting is active. It will
106 also reset its endpoints' toggle to zero.
107
108 @param IfDesc The interface descriptor to set.
109 @param Alternate The alternate setting number to locate.
110
111 @retval EFI_NOT_FOUND There is no setting with this alternate index.
112 @retval EFI_SUCCESS The interface is set to Alternate setting.
113
114 **/
115 EFI_STATUS
116 UsbSelectSetting (
117 IN USB_INTERFACE_DESC *IfDesc,
118 IN UINT8 Alternate
119 );
120
121 /**
122 Select a new configuration for the device. Each
123 device may support several configurations.
124
125 @param Device The device to select configuration.
126 @param ConfigIndex The index of the configuration ( != 0).
127
128 @retval EFI_NOT_FOUND There is no configuration with the index.
129 @retval EFI_OUT_OF_RESOURCES Failed to allocate resource.
130 @retval EFI_SUCCESS The configuration is selected.
131
132 **/
133 EFI_STATUS
134 UsbSelectConfig (
135 IN USB_DEVICE *Device,
136 IN UINT8 ConfigIndex
137 );
138
139 /**
140 Remove the current device configuration.
141
142 @param Device The USB device to remove configuration from.
143
144 @return None.
145
146 **/
147 EFI_STATUS
148 UsbRemoveConfig (
149 IN USB_DEVICE *Device
150 );
151
152 /**
153 Remove the device and all its children from the bus.
154
155 @param Device The device to remove.
156
157 @retval EFI_SUCCESS The device is removed.
158
159 **/
160 EFI_STATUS
161 UsbRemoveDevice (
162 IN USB_DEVICE *Device
163 );
164
165 /**
166 Enumerate all the changed hub ports.
167
168 @param Event The event that is triggered.
169 @param Context The context to the event.
170
171 @return None.
172
173 **/
174 VOID
175 EFIAPI
176 UsbHubEnumeration (
177 IN EFI_EVENT Event,
178 IN VOID *Context
179 );
180
181 /**
182 Enumerate all the changed hub ports.
183
184 @param Event The event that is triggered.
185 @param Context The context to the event.
186
187 @return None.
188
189 **/
190 VOID
191 EFIAPI
192 UsbRootHubEnumeration (
193 IN EFI_EVENT Event,
194 IN VOID *Context
195 );
196
197 #endif