2 PCI enumeration support functions declaration for PCI Bus module.
4 Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H_
10 #define _EFI_PCI_ENUMERATOR_SUPPORT_H_
13 This routine is used to check whether the pci device is present.
15 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
16 @param Pci Output buffer for PCI device configuration space.
17 @param Bus PCI bus NO.
18 @param Device PCI device NO.
19 @param Func PCI Func NO.
21 @retval EFI_NOT_FOUND PCI device not present.
22 @retval EFI_SUCCESS PCI device is found.
27 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
35 Collect all the resource information under this root bridge.
37 A database that records all the information about pci device subject to this
38 root bridge will then be created.
40 @param Bridge Parent bridge instance.
41 @param StartBusNumber Bus number of beginning.
43 @retval EFI_SUCCESS PCI device is found.
44 @retval other Some error occurred when reading PCI bridge information.
48 PciPciDeviceInfoCollector (
49 IN PCI_IO_DEVICE
*Bridge
,
50 IN UINT8 StartBusNumber
54 Search required device and create PCI device instance.
56 @param Bridge Parent bridge instance.
57 @param Pci Input PCI device information block.
58 @param Bus PCI bus NO.
59 @param Device PCI device NO.
60 @param Func PCI func NO.
61 @param PciDevice Output of searched PCI device instance.
63 @retval EFI_SUCCESS Successfully created PCI device instance.
64 @retval EFI_OUT_OF_RESOURCES Cannot get PCI device information.
69 IN PCI_IO_DEVICE
*Bridge
,
74 OUT PCI_IO_DEVICE
**PciDevice
78 Create PCI device instance for PCI device.
80 @param Bridge Parent bridge instance.
81 @param Pci Input PCI device information block.
82 @param Bus PCI device Bus NO.
83 @param Device PCI device Device NO.
84 @param Func PCI device's func NO.
86 @return Created PCI device instance.
91 IN PCI_IO_DEVICE
*Bridge
,
99 Create PCI device instance for PCI-PCI bridge.
101 @param Bridge Parent bridge instance.
102 @param Pci Input PCI device information block.
103 @param Bus PCI device Bus NO.
104 @param Device PCI device Device NO.
105 @param Func PCI device's func NO.
107 @return Created PCI device instance.
112 IN PCI_IO_DEVICE
*Bridge
,
120 Create PCI device instance for PCI Card bridge device.
122 @param Bridge Parent bridge instance.
123 @param Pci Input PCI device information block.
124 @param Bus PCI device Bus NO.
125 @param Device PCI device Device NO.
126 @param Func PCI device's func NO.
128 @return Created PCI device instance.
133 IN PCI_IO_DEVICE
*Bridge
,
141 Create device path for pci device.
143 @param ParentDevicePath Parent bridge's path.
144 @param PciIoDevice Pci device instance.
146 @return Device path protocol instance for specific pci device.
149 EFI_DEVICE_PATH_PROTOCOL
*
150 CreatePciDevicePath (
151 IN EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
,
152 IN PCI_IO_DEVICE
*PciIoDevice
156 Check whether the PCI IOV VF bar is existed or not.
158 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
159 @param Offset The offset.
160 @param BarLengthValue The bar length value returned.
161 @param OriginalBarValue The original bar value returned.
163 @retval EFI_NOT_FOUND The bar doesn't exist.
164 @retval EFI_SUCCESS The bar exist.
169 IN PCI_IO_DEVICE
*PciIoDevice
,
171 OUT UINT32
*BarLengthValue
,
172 OUT UINT32
*OriginalBarValue
176 Check whether the bar is existed or not.
178 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
179 @param Offset The offset.
180 @param BarLengthValue The bar length value returned.
181 @param OriginalBarValue The original bar value returned.
183 @retval EFI_NOT_FOUND The bar doesn't exist.
184 @retval EFI_SUCCESS The bar exist.
189 IN PCI_IO_DEVICE
*PciIoDevice
,
191 OUT UINT32
*BarLengthValue
,
192 OUT UINT32
*OriginalBarValue
196 Test whether the device can support given attributes.
198 @param PciIoDevice Pci device instance.
199 @param Command Input command register value, and
200 returned supported register value.
201 @param BridgeControl Input bridge control value for PPB or P2C, and
202 returned supported bridge control value.
203 @param OldCommand Returned and stored old command register offset.
204 @param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
208 PciTestSupportedAttribute (
209 IN PCI_IO_DEVICE
*PciIoDevice
,
210 IN OUT UINT16
*Command
,
211 IN OUT UINT16
*BridgeControl
,
212 OUT UINT16
*OldCommand
,
213 OUT UINT16
*OldBridgeControl
217 Set the supported or current attributes of a PCI device.
219 @param PciIoDevice Structure pointer for PCI device.
220 @param Command Command register value.
221 @param BridgeControl Bridge control value for PPB or P2C.
222 @param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
226 PciSetDeviceAttribute (
227 IN PCI_IO_DEVICE
*PciIoDevice
,
229 IN UINT16 BridgeControl
,
234 Determine if the device can support Fast Back to Back attribute.
236 @param PciIoDevice Pci device instance.
237 @param StatusIndex Status register value.
239 @retval EFI_SUCCESS This device support Fast Back to Back attribute.
240 @retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
244 GetFastBackToBackSupport (
245 IN PCI_IO_DEVICE
*PciIoDevice
,
250 Determine the related attributes of all devices under a Root Bridge.
252 @param PciIoDevice PCI device instance.
256 DetermineDeviceAttribute (
257 IN PCI_IO_DEVICE
*PciIoDevice
261 This routine is used to update the bar information for those incompatible PCI device.
263 @param PciIoDevice Input Pci device instance. Output Pci device instance with updated
265 @param IgnoreOptionRom Output If the option rom of incompatible device need to be ignored.
267 @retval EFI_SUCCESS Successfully updated bar information.
268 @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
273 IN OUT PCI_IO_DEVICE
*PciIoDevice
,
274 OUT BOOLEAN
*IgnoreOptionRom
278 This routine will update the alignment with the new alignment.
280 @param Alignment Input Old alignment. Output updated alignment.
281 @param NewAlignment New alignment.
286 IN OUT UINT64
*Alignment
,
287 IN UINT64 NewAlignment
291 Parse PCI bar information and fill them into PCI device instance.
293 @param PciIoDevice Pci device instance.
294 @param Offset Bar offset.
295 @param BarIndex Bar index.
297 @return Next bar offset.
302 IN PCI_IO_DEVICE
*PciIoDevice
,
308 Parse PCI IOV VF bar information and fill them into PCI device instance.
310 @param PciIoDevice Pci device instance.
311 @param Offset Bar offset.
312 @param BarIndex Bar index.
314 @return Next bar offset.
319 IN PCI_IO_DEVICE
*PciIoDevice
,
325 This routine is used to initialize the bar of a PCI device.
327 @param PciIoDevice Pci device instance.
329 @note It can be called typically when a device is going to be rejected.
333 InitializePciDevice (
334 IN PCI_IO_DEVICE
*PciIoDevice
338 This routine is used to initialize the bar of a PCI-PCI Bridge device.
340 @param PciIoDevice PCI-PCI bridge device instance.
345 IN PCI_IO_DEVICE
*PciIoDevice
349 This routine is used to initialize the bar of a PCI Card Bridge device.
351 @param PciIoDevice PCI Card bridge device.
356 IN PCI_IO_DEVICE
*PciIoDevice
360 Create and initialize general PCI I/O device instance for
361 PCI device/bridge device/hotplug bridge device.
363 @param Bridge Parent bridge instance.
364 @param Pci Input Pci information block.
365 @param Bus Device Bus NO.
366 @param Device Device device NO.
367 @param Func Device func NO.
369 @return Instance of PCI device. NULL means no instance created.
374 IN PCI_IO_DEVICE
*Bridge
,
382 This routine is used to enumerate entire pci bus system
385 It is only called on the second start on the same Root Bridge.
387 @param Controller Parent bridge handler.
389 @retval EFI_SUCCESS PCI enumeration finished successfully.
390 @retval other Some error occurred when enumerating the pci bus system.
395 IN EFI_HANDLE Controller
399 Get bus range from PCI resource descriptor list.
401 @param Descriptors A pointer to the address space descriptor.
402 @param MinBus The min bus returned.
403 @param MaxBus The max bus returned.
404 @param BusRange The bus range returned.
406 @retval EFI_SUCCESS Successfully got bus range.
407 @retval EFI_NOT_FOUND Can not find the specific bus.
412 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
419 This routine can be used to start the root bridge.
421 @param RootBridgeDev Pci device instance.
423 @retval EFI_SUCCESS This device started.
424 @retval other Failed to get PCI Root Bridge I/O protocol.
428 StartManagingRootBridge (
429 IN PCI_IO_DEVICE
*RootBridgeDev
433 This routine can be used to check whether a PCI device should be rejected when light enumeration.
435 @param PciIoDevice Pci device instance.
437 @retval TRUE This device should be rejected.
438 @retval FALSE This device shouldn't be rejected.
442 IsPciDeviceRejected (
443 IN PCI_IO_DEVICE
*PciIoDevice
447 Reset all bus number from specific bridge.
449 @param Bridge Parent specific bridge.
450 @param StartBusNumber Start bus number.
454 ResetAllPpbBusNumber (
455 IN PCI_IO_DEVICE
*Bridge
,
456 IN UINT8 StartBusNumber
460 Dump the PPB padding resource information.
462 @param PciIoDevice PCI IO instance.
463 @param ResourceType The desired resource type to dump.
464 PciBarTypeUnknown means to dump all types of resources.
467 DumpPpbPaddingResource (
468 IN PCI_IO_DEVICE
*PciIoDevice
,
469 IN PCI_BAR_TYPE ResourceType
473 Dump the PCI BAR information.
475 @param PciIoDevice PCI IO instance.
479 IN PCI_IO_DEVICE
*PciIoDevice