2 PCI emumeration support functions declaration for PCI Bus module.
4 Copyright (c) 2006 - 2009, Intel Corporation
5 All rights reserved. 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 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 Test whether the device can support given attributes.
184 @param PciIoDevice Pci device instance.
185 @param Command Input command register value, and
186 returned supported register value.
187 @param BridgeControl Inout bridge control value for PPB or P2C, and
188 returned supported bridge control value.
189 @param OldCommand Returned and stored old command register offset.
190 @param OldBridgeControl Returned and stored old Bridge control value for PPB or P2C.
194 PciTestSupportedAttribute (
195 IN PCI_IO_DEVICE
*PciIoDevice
,
196 IN OUT UINT16
*Command
,
197 IN OUT UINT16
*BridgeControl
,
198 OUT UINT16
*OldCommand
,
199 OUT UINT16
*OldBridgeControl
203 Set the supported or current attributes of a PCI device.
205 @param PciIoDevice Structure pointer for PCI device.
206 @param Command Command register value.
207 @param BridgeControl Bridge control value for PPB or P2C.
208 @param Option Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
212 PciSetDeviceAttribute (
213 IN PCI_IO_DEVICE
*PciIoDevice
,
215 IN UINT16 BridgeControl
,
220 Determine if the device can support Fast Back to Back attribute.
222 @param PciIoDevice Pci device instance.
223 @param StatusIndex Status register value.
225 @retval EFI_SUCCESS This device support Fast Back to Back attribute.
226 @retval EFI_UNSUPPORTED This device doesn't support Fast Back to Back attribute.
230 GetFastBackToBackSupport (
231 IN PCI_IO_DEVICE
*PciIoDevice
,
236 Determine the related attributes of all devices under a Root Bridge.
238 @param PciIoDevice PCI device instance.
242 DetermineDeviceAttribute (
243 IN PCI_IO_DEVICE
*PciIoDevice
247 This routine is used to update the bar information for those incompatible PCI device.
249 @param PciIoDevice Pci device instance.
251 @retval EFI_SUCCESS Successfully updated bar information.
252 @retval EFI_UNSUPPORTED Given PCI device doesn't belong to incompatible PCI device list.
253 @retval other Failed to check incompatibility device.
258 IN PCI_IO_DEVICE
*PciIoDevice
262 This routine will update the alignment with the new alignment.
264 @param Alignment Old alignment.
265 @param NewAlignment New alignment.
270 IN UINT64
*Alignment
,
271 IN UINT64 NewAlignment
275 Parse PCI bar information and fill them into PCI device instance.
277 @param PciIoDevice Pci device instance.
278 @param Offset Bar offset.
279 @param BarIndex Bar index.
281 @return Next bar offset.
286 IN PCI_IO_DEVICE
*PciIoDevice
,
292 This routine is used to initialize the bar of a PCI device.
294 @param PciIoDevice Pci device instance.
296 @note It can be called typically when a device is going to be rejected.
300 InitializePciDevice (
301 IN PCI_IO_DEVICE
*PciIoDevice
305 This routine is used to initialize the bar of a PCI-PCI Bridge device.
307 @param PciIoDevice PCI-PCI bridge device instance.
312 IN PCI_IO_DEVICE
*PciIoDevice
316 This routine is used to initialize the bar of a PCI Card Bridge device.
318 @param PciIoDevice PCI Card bridge device.
323 IN PCI_IO_DEVICE
*PciIoDevice
327 Create and initiliaze general PCI I/O device instance for
328 PCI device/bridge device/hotplug bridge device.
330 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
331 @param Pci Input Pci information block.
332 @param Bus Device Bus NO.
333 @param Device Device device NO.
334 @param Func Device func NO.
336 @return Instance of PCI device. NULL means no instance created.
341 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
349 This routine is used to enumerate entire pci bus system
352 It is only called on the second start on the same Root Bridge.
354 @param Controller Parent bridge handler.
356 @retval EFI_SUCCESS PCI enumeration finished successfully.
357 @retval other Some error occurred when enumerating the pci bus system.
362 IN EFI_HANDLE Controller
366 Get bus range from PCI resource descriptor list.
368 @param Descriptors A pointer to the address space descriptor.
369 @param MinBus The min bus returned.
370 @param MaxBus The max bus returned.
371 @param BusRange The bus range returned.
373 @retval EFI_SUCCESS Successfully got bus range.
374 @retval EFI_NOT_FOUND Can not find the specific bus.
379 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
386 This routine can be used to start the root bridge.
388 @param RootBridgeDev Pci device instance.
390 @retval EFI_SUCCESS This device started.
391 @retval other Failed to get PCI Root Bridge I/O protocol.
395 StartManagingRootBridge (
396 IN PCI_IO_DEVICE
*RootBridgeDev
400 This routine can be used to check whether a PCI device should be rejected when light enumeration.
402 @param PciIoDevice Pci device instance.
404 @retval TRUE This device should be rejected.
405 @retval FALSE This device shouldn't be rejected.
409 IsPciDeviceRejected (
410 IN PCI_IO_DEVICE
*PciIoDevice
414 Reset all bus number from specific bridge.
416 @param Bridge Parent specific bridge.
417 @param StartBusNumber Start bus number.
421 ResetAllPpbBusNumber (
422 IN PCI_IO_DEVICE
*Bridge
,
423 IN UINT8 StartBusNumber