2 PCI emumeration support functions declaration for PCI Bus module.
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H_
16 #define _EFI_PCI_ENUMERATOR_SUPPORT_H_
19 This routine is used to check whether the pci device is present.
21 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
22 @param Pci Output buffer for PCI device configuration space.
23 @param Bus PCI bus NO.
24 @param Device PCI device NO.
25 @param Func PCI Func NO.
27 @retval EFI_NOT_FOUND PCI device not present.
28 @retval EFI_SUCCESS PCI device is found.
33 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
41 Collect all the resource information under this root bridge.
43 A database that records all the information about pci device subject to this
44 root bridge will then be created.
46 @param Bridge Parent bridge instance.
47 @param StartBusNumber Bus number of begining.
49 @retval EFI_SUCCESS PCI device is found.
50 @retval other Some error occurred when reading PCI bridge information.
54 PciPciDeviceInfoCollector (
55 IN PCI_IO_DEVICE
*Bridge
,
56 IN UINT8 StartBusNumber
60 Seach required device and create PCI device instance.
62 @param Bridge Parent bridge instance.
63 @param Pci Input PCI device information block.
64 @param Bus PCI bus NO.
65 @param Device PCI device NO.
66 @param Func PCI func NO.
67 @param PciDevice Output of searched PCI device instance.
69 @retval EFI_SUCCESS Successfully created PCI device instance.
70 @retval EFI_OUT_OF_RESOURCES Cannot get PCI device information.
75 IN PCI_IO_DEVICE
*Bridge
,
80 OUT PCI_IO_DEVICE
**PciDevice
84 Create PCI device instance for PCI device.
86 @param Bridge Parent bridge instance.
87 @param Pci Input PCI device information block.
88 @param Bus PCI device Bus NO.
89 @param Device PCI device Device NO.
90 @param Func PCI device's func NO.
92 @return Created PCI device instance.
97 IN PCI_IO_DEVICE
*Bridge
,
105 Create PCI device instance for PCI-PCI bridge.
107 @param Bridge Parent bridge instance.
108 @param Pci Input PCI device information block.
109 @param Bus PCI device Bus NO.
110 @param Device PCI device Device NO.
111 @param Func PCI device's func NO.
113 @return Created PCI device instance.
118 IN PCI_IO_DEVICE
*Bridge
,
126 Create PCI device instance for PCI Card bridge device.
128 @param Bridge Parent bridge instance.
129 @param Pci Input PCI device information block.
130 @param Bus PCI device Bus NO.
131 @param Device PCI device Device NO.
132 @param Func PCI device's func NO.
134 @return Created PCI device instance.
139 IN PCI_IO_DEVICE
*Bridge
,
147 Create device path for pci deivce.
149 @param ParentDevicePath Parent bridge's path.
150 @param PciIoDevice Pci device instance.
152 @return device path protocol instance for specific pci device.
155 EFI_DEVICE_PATH_PROTOCOL
*
156 CreatePciDevicePath (
157 IN EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
,
158 IN PCI_IO_DEVICE
*PciIoDevice
162 Check whether the PCI IOV VF bar is existed or not.
164 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
165 @param Offset The offset.
166 @param BarLengthValue The bar length value returned.
167 @param OriginalBarValue The original bar value returned.
169 @retval EFI_NOT_FOUND The bar doesn't exist.
170 @retval EFI_SUCCESS The bar exist.
175 IN PCI_IO_DEVICE
*PciIoDevice
,
177 OUT UINT32
*BarLengthValue
,
178 OUT UINT32
*OriginalBarValue
182 Check whether the bar is existed or not.
184 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
185 @param Offset The offset.
186 @param BarLengthValue The bar length value returned.
187 @param OriginalBarValue The original bar value returned.
189 @retval EFI_NOT_FOUND The bar doesn't exist.
190 @retval EFI_SUCCESS The bar exist.
195 IN PCI_IO_DEVICE
*PciIoDevice
,
197 OUT UINT32
*BarLengthValue
,
198 OUT UINT32
*OriginalBarValue
202 Test whether the device can support given attributes.
204 @param PciIoDevice Pci device instance.
205 @param Command Input command register value, and
206 returned supported register value.
207 @param BridgeControl Inout bridge control value for PPB or P2C, and
208 returned supported bridge control value.
209 @param OldCommand Returned and stored old command register offset.
210 @param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
214 PciTestSupportedAttribute (
215 IN PCI_IO_DEVICE
*PciIoDevice
,
216 IN OUT UINT16
*Command
,
217 IN OUT UINT16
*BridgeControl
,
218 OUT UINT16
*OldCommand
,
219 OUT UINT16
*OldBridgeControl
223 Set the supported or current attributes of a PCI device.
225 @param PciIoDevice Structure pointer for PCI device.
226 @param Command Command register value.
227 @param BridgeControl Bridge control value for PPB or P2C.
228 @param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
232 PciSetDeviceAttribute (
233 IN PCI_IO_DEVICE
*PciIoDevice
,
235 IN UINT16 BridgeControl
,
240 Determine if the device can support Fast Back to Back attribute.
242 @param PciIoDevice Pci device instance.
243 @param StatusIndex Status register value.
245 @retval EFI_SUCCESS This device support Fast Back to Back attribute.
246 @retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
250 GetFastBackToBackSupport (
251 IN PCI_IO_DEVICE
*PciIoDevice
,
256 Determine the related attributes of all devices under a Root Bridge.
258 @param PciIoDevice PCI device instance.
262 DetermineDeviceAttribute (
263 IN PCI_IO_DEVICE
*PciIoDevice
267 This routine is used to update the bar information for those incompatible PCI device.
269 @param PciIoDevice Input Pci device instance. Output Pci device instance with updated
272 @retval EFI_SUCCESS Successfully updated bar information.
273 @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
278 IN OUT PCI_IO_DEVICE
*PciIoDevice
282 This routine will update the alignment with the new alignment.
284 @param Alignment Input Old alignment. Output updated alignment.
285 @param NewAlignment New alignment.
290 IN OUT UINT64
*Alignment
,
291 IN UINT64 NewAlignment
295 Parse PCI bar information and fill them into PCI device instance.
297 @param PciIoDevice Pci device instance.
298 @param Offset Bar offset.
299 @param BarIndex Bar index.
301 @return Next bar offset.
306 IN PCI_IO_DEVICE
*PciIoDevice
,
312 Parse PCI IOV VF bar information and fill them into PCI device instance.
314 @param PciIoDevice Pci device instance.
315 @param Offset Bar offset.
316 @param BarIndex Bar index.
318 @return Next bar offset.
323 IN PCI_IO_DEVICE
*PciIoDevice
,
329 This routine is used to initialize the bar of a PCI device.
331 @param PciIoDevice Pci device instance.
333 @note It can be called typically when a device is going to be rejected.
337 InitializePciDevice (
338 IN PCI_IO_DEVICE
*PciIoDevice
342 This routine is used to initialize the bar of a PCI-PCI Bridge device.
344 @param PciIoDevice PCI-PCI bridge device instance.
349 IN PCI_IO_DEVICE
*PciIoDevice
353 This routine is used to initialize the bar of a PCI Card Bridge device.
355 @param PciIoDevice PCI Card bridge device.
360 IN PCI_IO_DEVICE
*PciIoDevice
364 Create and initiliaze general PCI I/O device instance for
365 PCI device/bridge device/hotplug bridge device.
367 @param Bridge Parent bridge instance.
368 @param Pci Input Pci information block.
369 @param Bus Device Bus NO.
370 @param Device Device device NO.
371 @param Func Device func NO.
373 @return Instance of PCI device. NULL means no instance created.
378 IN PCI_IO_DEVICE
*Bridge
,
386 This routine is used to enumerate entire pci bus system
389 It is only called on the second start on the same Root Bridge.
391 @param Controller Parent bridge handler.
393 @retval EFI_SUCCESS PCI enumeration finished successfully.
394 @retval other Some error occurred when enumerating the pci bus system.
399 IN EFI_HANDLE Controller
403 Get bus range from PCI resource descriptor list.
405 @param Descriptors A pointer to the address space descriptor.
406 @param MinBus The min bus returned.
407 @param MaxBus The max bus returned.
408 @param BusRange The bus range returned.
410 @retval EFI_SUCCESS Successfully got bus range.
411 @retval EFI_NOT_FOUND Can not find the specific bus.
416 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
423 This routine can be used to start the root bridge.
425 @param RootBridgeDev Pci device instance.
427 @retval EFI_SUCCESS This device started.
428 @retval other Failed to get PCI Root Bridge I/O protocol.
432 StartManagingRootBridge (
433 IN PCI_IO_DEVICE
*RootBridgeDev
437 This routine can be used to check whether a PCI device should be rejected when light enumeration.
439 @param PciIoDevice Pci device instance.
441 @retval TRUE This device should be rejected.
442 @retval FALSE This device shouldn't be rejected.
446 IsPciDeviceRejected (
447 IN PCI_IO_DEVICE
*PciIoDevice
451 Reset all bus number from specific bridge.
453 @param Bridge Parent specific bridge.
454 @param StartBusNumber Start bus number.
458 ResetAllPpbBusNumber (
459 IN PCI_IO_DEVICE
*Bridge
,
460 IN UINT8 StartBusNumber