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