]>
Commit | Line | Data |
---|---|---|
eeefcb9d | 1 | /** @file\r |
ead42efc | 2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
3db51098 | 12 | **/\r |
ead42efc | 13 | \r |
ead42efc | 14 | \r |
eeefcb9d | 15 | #ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H_\r |
16 | #define _EFI_PCI_ENUMERATOR_SUPPORT_H_\r | |
ead42efc | 17 | \r |
a3b8e257 | 18 | /**\r |
19 | This routine is used to check whether the pci device is present.\r | |
20 | \r | |
21 | @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL\r | |
22 | @param Pci Output buffer for PCI device structure\r | |
23 | @param Bus PCI bus NO\r | |
24 | @param Device PCI device NO\r | |
25 | @param Func PCI Func NO\r | |
26 | \r | |
27 | @retval EFI_NOT_FOUND device not present\r | |
28 | @retval EFI_SUCCESS device is found.\r | |
29 | **/\r | |
ead42efc | 30 | EFI_STATUS\r |
31 | PciDevicePresent (\r | |
32 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r | |
33 | PCI_TYPE00 *Pci,\r | |
34 | UINT8 Bus,\r | |
35 | UINT8 Device,\r | |
36 | UINT8 Func\r | |
ed66e1bc | 37 | );\r |
ead42efc | 38 | \r |
a3b8e257 | 39 | /**\r |
40 | Collect all the resource information under this root bridge\r | |
41 | A database that records all the information about pci device subject to this\r | |
42 | root bridge will then be created.\r | |
43 | \r | |
44 | @param Bridge Parent bridge instance\r | |
eeefcb9d | 45 | @param StartBusNumber Bus number of begining \r |
a3b8e257 | 46 | **/\r |
ead42efc | 47 | EFI_STATUS\r |
48 | PciPciDeviceInfoCollector (\r | |
49 | IN PCI_IO_DEVICE *Bridge,\r | |
50 | UINT8 StartBusNumber\r | |
ed66e1bc | 51 | );\r |
ead42efc | 52 | \r |
a3b8e257 | 53 | /**\r |
54 | Seach required device and get PCI device info block\r | |
55 | \r | |
56 | @param Bridge Parent bridge instance\r | |
57 | @param Pci Output of PCI device info block\r | |
58 | @param Bus PCI bus NO.\r | |
59 | @param Device PCI device NO.\r | |
60 | @param Func PCI func NO.\r | |
61 | @param PciDevice output of searched PCI device instance\r | |
62 | **/\r | |
ead42efc | 63 | EFI_STATUS\r |
64 | PciSearchDevice (\r | |
eeefcb9d | 65 | IN PCI_IO_DEVICE *Bridge,\r |
66 | IN PCI_TYPE00 *Pci,\r | |
67 | IN UINT8 Bus,\r | |
68 | IN UINT8 Device,\r | |
69 | IN UINT8 Func,\r | |
70 | OUT PCI_IO_DEVICE **PciDevice\r | |
ed66e1bc | 71 | );\r |
ead42efc | 72 | \r |
a3b8e257 | 73 | /**\r |
74 | Create PCI private data for PCI device\r | |
75 | \r | |
76 | @param Bridge Parent bridge instance\r | |
77 | @param Pci PCI bar block\r | |
78 | @param Bus PCI device Bus NO.\r | |
79 | @param Device PCI device DeviceNO.\r | |
80 | @param Func PCI device's func NO.\r | |
81 | \r | |
82 | @return new PCI device's private date structure.\r | |
83 | **/\r | |
ead42efc | 84 | PCI_IO_DEVICE *\r |
85 | GatherDeviceInfo (\r | |
86 | IN PCI_IO_DEVICE *Bridge,\r | |
87 | IN PCI_TYPE00 *Pci,\r | |
88 | UINT8 Bus,\r | |
89 | UINT8 Device,\r | |
90 | UINT8 Func\r | |
ed66e1bc | 91 | );\r |
ead42efc | 92 | \r |
a3b8e257 | 93 | /**\r |
94 | Create private data for bridge device's PPB.\r | |
95 | \r | |
96 | @param Bridge Parent bridge \r | |
97 | @param Pci Pci device block\r | |
98 | @param Bus Bridge device's bus NO.\r | |
99 | @param Device Bridge device's device NO.\r | |
100 | @param Func Bridge device's func NO.\r | |
101 | \r | |
97404058 | 102 | @return bridge device instance.\r |
a3b8e257 | 103 | **/\r |
ead42efc | 104 | PCI_IO_DEVICE *\r |
105 | GatherPpbInfo (\r | |
106 | IN PCI_IO_DEVICE *Bridge,\r | |
107 | IN PCI_TYPE00 *Pci,\r | |
108 | UINT8 Bus,\r | |
109 | UINT8 Device,\r | |
110 | UINT8 Func\r | |
ed66e1bc | 111 | );\r |
ead42efc | 112 | \r |
a3b8e257 | 113 | /**\r |
114 | Create private data for hotplug bridge device\r | |
115 | \r | |
116 | @param Bridge Parent bridge instance\r | |
117 | @param Pci PCI bar block\r | |
118 | @param Bus hotplug bridge device's bus NO.\r | |
119 | @param Device hotplug bridge device's device NO.\r | |
120 | @param Func hotplug bridge device's Func NO.\r | |
121 | \r | |
122 | @return hotplug bridge device instance\r | |
123 | **/\r | |
ead42efc | 124 | PCI_IO_DEVICE *\r |
125 | GatherP2CInfo (\r | |
126 | IN PCI_IO_DEVICE *Bridge,\r | |
127 | IN PCI_TYPE00 *Pci,\r | |
128 | UINT8 Bus,\r | |
129 | UINT8 Device,\r | |
130 | UINT8 Func\r | |
ed66e1bc | 131 | );\r |
ead42efc | 132 | \r |
a3b8e257 | 133 | /**\r |
134 | Create device path for pci deivce\r | |
135 | \r | |
97404058 | 136 | @param ParentDevicePath Parent bridge's path.\r |
137 | @param PciIoDevice Pci device instance.\r | |
a3b8e257 | 138 | \r |
139 | @return device path protocol instance for specific pci device.\r | |
140 | **/\r | |
ead42efc | 141 | EFI_DEVICE_PATH_PROTOCOL *\r |
142 | CreatePciDevicePath (\r | |
143 | IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r | |
144 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 145 | );\r |
ead42efc | 146 | \r |
a3b8e257 | 147 | /**\r |
148 | Check the bar is existed or not.\r | |
ead42efc | 149 | \r |
a3b8e257 | 150 | @param PciIoDevice - A pointer to the PCI_IO_DEVICE.\r |
151 | @param Offset - The offset.\r | |
152 | @param BarLengthValue - The bar length value.\r | |
153 | @param OriginalBarValue - The original bar value.\r | |
ead42efc | 154 | \r |
a3b8e257 | 155 | @retval EFI_NOT_FOUND - The bar don't exist.\r |
156 | @retval EFI_SUCCESS - The bar exist.\r | |
ead42efc | 157 | \r |
bcd70414 | 158 | **/\r |
ead42efc | 159 | EFI_STATUS\r |
160 | BarExisted (\r | |
161 | IN PCI_IO_DEVICE *PciIoDevice,\r | |
162 | IN UINTN Offset,\r | |
163 | OUT UINT32 *BarLengthValue,\r | |
164 | OUT UINT32 *OriginalBarValue\r | |
ed66e1bc | 165 | );\r |
ead42efc | 166 | \r |
a3b8e257 | 167 | /**\r |
168 | Test whether the device can support attributes \r | |
169 | \r | |
170 | @param PciIoDevice Pci device instance\r | |
171 | @param Command Command register value.\r | |
172 | @param BridgeControl Bridge control value for PPB or P2C.\r | |
173 | @param OldCommand Old command register offset\r | |
174 | @param OldBridgeControl Old Bridge control value for PPB or P2C.\r | |
175 | \r | |
97404058 | 176 | @return EFI_SUCCESS.\r |
a3b8e257 | 177 | **/\r |
ead42efc | 178 | EFI_STATUS\r |
179 | PciTestSupportedAttribute (\r | |
180 | IN PCI_IO_DEVICE *PciIoDevice,\r | |
181 | IN UINT16 *Command,\r | |
182 | IN UINT16 *BridgeControl,\r | |
183 | IN UINT16 *OldCommand,\r | |
184 | IN UINT16 *OldBridgeControl\r | |
ed66e1bc | 185 | );\r |
ead42efc | 186 | \r |
a3b8e257 | 187 | /**\r |
188 | Set the supported or current attributes of a PCI device\r | |
189 | \r | |
190 | @param PciIoDevice - Structure pointer for PCI device.\r | |
191 | @param Command - Command register value.\r | |
192 | @param BridgeControl - Bridge control value for PPB or P2C.\r | |
193 | @param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.\r | |
194 | \r | |
195 | **/\r | |
ead42efc | 196 | EFI_STATUS\r |
197 | PciSetDeviceAttribute (\r | |
198 | IN PCI_IO_DEVICE *PciIoDevice,\r | |
199 | IN UINT16 Command,\r | |
200 | IN UINT16 BridgeControl,\r | |
201 | IN UINTN Option\r | |
ed66e1bc | 202 | );\r |
ead42efc | 203 | \r |
a3b8e257 | 204 | /**\r |
205 | Determine if the device can support Fast Back to Back attribute\r | |
206 | \r | |
97404058 | 207 | @param PciIoDevice Pci device instance.\r |
208 | @param StatusIndex Status register value.\r | |
a3b8e257 | 209 | **/\r |
ead42efc | 210 | EFI_STATUS\r |
211 | GetFastBackToBackSupport (\r | |
212 | IN PCI_IO_DEVICE *PciIoDevice,\r | |
213 | IN UINT8 StatusIndex\r | |
ed66e1bc | 214 | );\r |
ead42efc | 215 | \r |
a3b8e257 | 216 | /**\r |
217 | Determine the related attributes of all devices under a Root Bridge\r | |
218 | \r | |
97404058 | 219 | @param PciIoDevice PCI device instance.\r |
a3b8e257 | 220 | \r |
221 | **/\r | |
ead42efc | 222 | EFI_STATUS\r |
223 | DetermineDeviceAttribute (\r | |
224 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 225 | );\r |
ead42efc | 226 | \r |
a3b8e257 | 227 | /**\r |
228 | This routine is used to update the bar information for those incompatible PCI device\r | |
229 | \r | |
97404058 | 230 | @param PciIoDevice Pci device instance.\r |
231 | @return EFI_UNSUPPORTED failed to update Pci Info.\r | |
a3b8e257 | 232 | **/\r |
ead42efc | 233 | EFI_STATUS\r |
234 | UpdatePciInfo (\r | |
235 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 236 | );\r |
ead42efc | 237 | \r |
a3b8e257 | 238 | /**\r |
239 | This routine will update the alignment with the new alignment\r | |
240 | \r | |
97404058 | 241 | @param Alignment old alignment.\r |
242 | @param NewAlignment new alignment.\r | |
a3b8e257 | 243 | \r |
244 | **/\r | |
ead42efc | 245 | VOID\r |
246 | SetNewAlign (\r | |
247 | IN UINT64 *Alignment,\r | |
248 | IN UINT64 NewAlignment\r | |
ed66e1bc | 249 | );\r |
ead42efc | 250 | \r |
a3b8e257 | 251 | /**\r |
252 | Parse PCI bar bit.\r | |
253 | \r | |
97404058 | 254 | @param PciIoDevice Pci device instance.\r |
255 | @param Offset bar offset.\r | |
256 | @param BarIndex bar index.\r | |
a3b8e257 | 257 | \r |
258 | @return next bar offset.\r | |
259 | **/\r | |
ead42efc | 260 | UINTN\r |
261 | PciParseBar (\r | |
262 | IN PCI_IO_DEVICE *PciIoDevice,\r | |
263 | IN UINTN Offset,\r | |
264 | IN UINTN BarIndex\r | |
ed66e1bc | 265 | );\r |
ead42efc | 266 | \r |
a3b8e257 | 267 | /**\r |
268 | This routine is used to initialize the bar of a PCI device\r | |
97404058 | 269 | It can be called typically when a device is going to be rejected.\r |
ead42efc | 270 | \r |
97404058 | 271 | @param PciIoDevice Pci device instance.\r |
bcd70414 | 272 | **/\r |
ead42efc | 273 | EFI_STATUS\r |
274 | InitializePciDevice (\r | |
275 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 276 | );\r |
ead42efc | 277 | \r |
a3b8e257 | 278 | /**\r |
279 | Init PPB for bridge device\r | |
280 | \r | |
97404058 | 281 | @param PciIoDevice Pci device instance.\r |
a3b8e257 | 282 | **/\r |
ead42efc | 283 | EFI_STATUS\r |
284 | InitializePpb (\r | |
285 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 286 | );\r |
ead42efc | 287 | \r |
a3b8e257 | 288 | /**\r |
289 | Init private data for Hotplug bridge device\r | |
290 | \r | |
97404058 | 291 | @param PciIoDevice hotplug bridge device.\r |
a3b8e257 | 292 | **/\r |
ead42efc | 293 | EFI_STATUS\r |
294 | InitializeP2C (\r | |
295 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 296 | );\r |
ead42efc | 297 | \r |
a3b8e257 | 298 | /**\r |
299 | Create and initiliaze general PCI I/O device instance for\r | |
300 | PCI device/bridge device/hotplug bridge device.\r | |
301 | \r | |
97404058 | 302 | @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r |
a3b8e257 | 303 | @param Pci Pci bar block\r |
304 | @param Bus device Bus NO.\r | |
305 | @param Device device device NO.\r | |
306 | @param Func device func NO.\r | |
307 | \r | |
97404058 | 308 | @return instance of PCI device.\r |
a3b8e257 | 309 | **/\r |
ead42efc | 310 | PCI_IO_DEVICE *\r |
311 | CreatePciIoDevice (\r | |
312 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r | |
313 | IN PCI_TYPE00 *Pci,\r | |
314 | UINT8 Bus,\r | |
315 | UINT8 Device,\r | |
316 | UINT8 Func\r | |
ed66e1bc | 317 | );\r |
ead42efc | 318 | \r |
a3b8e257 | 319 | /**\r |
320 | This routine is used to enumerate entire pci bus system\r | |
321 | in a given platform\r | |
322 | It is only called on the second start on the same Root Bridge.\r | |
ead42efc | 323 | \r |
97404058 | 324 | @param Controller Parent bridge handler.\r |
a3b8e257 | 325 | \r |
326 | @return status of operation.\r | |
bcd70414 | 327 | **/\r |
ead42efc | 328 | EFI_STATUS\r |
329 | PciEnumeratorLight (\r | |
330 | IN EFI_HANDLE Controller\r | |
ed66e1bc | 331 | );\r |
ead42efc | 332 | \r |
a3b8e257 | 333 | /**\r |
334 | Get bus range.\r | |
335 | \r | |
336 | @param Descriptors A pointer to the address space descriptor.\r | |
337 | @param MinBus The min bus.\r | |
338 | @param MaxBus The max bus.\r | |
339 | @param BusRange The bus range.\r | |
340 | \r | |
341 | @retval EFI_SUCCESS Success operation.\r | |
342 | @retval EFI_NOT_FOUND can not find the specific bus.\r | |
343 | **/\r | |
ead42efc | 344 | EFI_STATUS\r |
345 | PciGetBusRange (\r | |
346 | IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r | |
347 | OUT UINT16 *MinBus,\r | |
348 | OUT UINT16 *MaxBus,\r | |
349 | OUT UINT16 *BusRange\r | |
ed66e1bc | 350 | );\r |
ead42efc | 351 | \r |
eeefcb9d | 352 | /**\r |
353 | This routine can be used to start the root bridge.\r | |
354 | \r | |
355 | @param RootBridgeDev Pci device instance.\r | |
356 | \r | |
357 | @retval EFI_SUCCESS This device started.\r | |
358 | \r | |
359 | **/\r | |
ead42efc | 360 | EFI_STATUS\r |
361 | StartManagingRootBridge (\r | |
362 | IN PCI_IO_DEVICE *RootBridgeDev\r | |
ed66e1bc | 363 | );\r |
ead42efc | 364 | \r |
a3b8e257 | 365 | /**\r |
366 | This routine can be used to check whether a PCI device should be rejected when light enumeration\r | |
ead42efc | 367 | \r |
97404058 | 368 | @param PciIoDevice Pci device instance.\r |
ead42efc | 369 | \r |
97404058 | 370 | @retval TRUE This device should be rejected.\r |
371 | @retval FALSE This device shouldn't be rejected.\r | |
a3b8e257 | 372 | \r |
bcd70414 | 373 | **/\r |
ead42efc | 374 | BOOLEAN\r |
375 | IsPciDeviceRejected (\r | |
376 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 377 | );\r |
ead42efc | 378 | \r |
379 | #endif\r |