2 PCI enumeration support functions declaration for PCI Bus module.
4 Copyright (c) 2006 - 2019, 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
266 @retval EFI_SUCCESS Successfully updated bar information.
267 @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
272 IN OUT PCI_IO_DEVICE
*PciIoDevice
276 This routine will update the alignment with the new alignment.
278 @param Alignment Input Old alignment. Output updated alignment.
279 @param NewAlignment New alignment.
284 IN OUT UINT64
*Alignment
,
285 IN UINT64 NewAlignment
289 Parse PCI bar information and fill them into PCI device instance.
291 @param PciIoDevice Pci device instance.
292 @param Offset Bar offset.
293 @param BarIndex Bar index.
295 @return Next bar offset.
300 IN PCI_IO_DEVICE
*PciIoDevice
,
306 Parse PCI IOV VF bar information and fill them into PCI device instance.
308 @param PciIoDevice Pci device instance.
309 @param Offset Bar offset.
310 @param BarIndex Bar index.
312 @return Next bar offset.
317 IN PCI_IO_DEVICE
*PciIoDevice
,
323 This routine is used to initialize the bar of a PCI device.
325 @param PciIoDevice Pci device instance.
327 @note It can be called typically when a device is going to be rejected.
331 InitializePciDevice (
332 IN PCI_IO_DEVICE
*PciIoDevice
336 This routine is used to initialize the bar of a PCI-PCI Bridge device.
338 @param PciIoDevice PCI-PCI bridge device instance.
343 IN PCI_IO_DEVICE
*PciIoDevice
347 This routine is used to initialize the bar of a PCI Card Bridge device.
349 @param PciIoDevice PCI Card bridge device.
354 IN PCI_IO_DEVICE
*PciIoDevice
358 Create and initialize general PCI I/O device instance for
359 PCI device/bridge device/hotplug bridge device.
361 @param Bridge Parent bridge instance.
362 @param Pci Input Pci information block.
363 @param Bus Device Bus NO.
364 @param Device Device device NO.
365 @param Func Device func NO.
367 @return Instance of PCI device. NULL means no instance created.
372 IN PCI_IO_DEVICE
*Bridge
,
380 This routine is used to enumerate entire pci bus system
383 It is only called on the second start on the same Root Bridge.
385 @param Controller Parent bridge handler.
387 @retval EFI_SUCCESS PCI enumeration finished successfully.
388 @retval other Some error occurred when enumerating the pci bus system.
393 IN EFI_HANDLE Controller
397 Get bus range from PCI resource descriptor list.
399 @param Descriptors A pointer to the address space descriptor.
400 @param MinBus The min bus returned.
401 @param MaxBus The max bus returned.
402 @param BusRange The bus range returned.
404 @retval EFI_SUCCESS Successfully got bus range.
405 @retval EFI_NOT_FOUND Can not find the specific bus.
410 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
417 This routine can be used to start the root bridge.
419 @param RootBridgeDev Pci device instance.
421 @retval EFI_SUCCESS This device started.
422 @retval other Failed to get PCI Root Bridge I/O protocol.
426 StartManagingRootBridge (
427 IN PCI_IO_DEVICE
*RootBridgeDev
431 This routine can be used to check whether a PCI device should be rejected when light enumeration.
433 @param PciIoDevice Pci device instance.
435 @retval TRUE This device should be rejected.
436 @retval FALSE This device shouldn't be rejected.
440 IsPciDeviceRejected (
441 IN PCI_IO_DEVICE
*PciIoDevice
445 Reset all bus number from specific bridge.
447 @param Bridge Parent specific bridge.
448 @param StartBusNumber Start bus number.
452 ResetAllPpbBusNumber (
453 IN PCI_IO_DEVICE
*Bridge
,
454 IN UINT8 StartBusNumber
458 Dump the PPB padding resource information.
460 @param PciIoDevice PCI IO instance.
461 @param ResourceType The desired resource type to dump.
462 PciBarTypeUnknown means to dump all types of resources.
465 DumpPpbPaddingResource (
466 IN PCI_IO_DEVICE
*PciIoDevice
,
467 IN PCI_BAR_TYPE ResourceType