3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 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 structure
24 @param Device PCI device NO
25 @param Func PCI Func NO
27 @retval EFI_NOT_FOUND device not present
28 @retval EFI_SUCCESS device is found.
32 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
40 Collect all the resource information under this root bridge
41 A database that records all the information about pci device subject to this
42 root bridge will then be created.
44 @param Bridge Parent bridge instance
45 @param StartBusNumber Bus number of begining
48 PciPciDeviceInfoCollector (
49 IN PCI_IO_DEVICE
*Bridge
,
54 Seach required device and get PCI device info block
56 @param Bridge Parent bridge instance
57 @param Pci Output of PCI device info 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
65 IN PCI_IO_DEVICE
*Bridge
,
70 OUT PCI_IO_DEVICE
**PciDevice
74 Create PCI private data for PCI device
76 @param Bridge Parent bridge instance
77 @param Pci PCI bar block
78 @param Bus PCI device Bus NO.
79 @param Device PCI device DeviceNO.
80 @param Func PCI device's func NO.
82 @return new PCI device's private date structure.
86 IN PCI_IO_DEVICE
*Bridge
,
94 Create private data for bridge device's PPB.
96 @param Bridge Parent bridge
97 @param Pci Pci device block
98 @param Bus Bridge device's bus NO.
99 @param Device Bridge device's device NO.
100 @param Func Bridge device's func NO.
102 @return bridge device instance.
106 IN PCI_IO_DEVICE
*Bridge
,
114 Create private data for hotplug bridge device
116 @param Bridge Parent bridge instance
117 @param Pci PCI bar block
118 @param Bus hotplug bridge device's bus NO.
119 @param Device hotplug bridge device's device NO.
120 @param Func hotplug bridge device's Func NO.
122 @return hotplug bridge device instance
126 IN PCI_IO_DEVICE
*Bridge
,
134 Create device path for pci deivce
136 @param ParentDevicePath Parent bridge's path.
137 @param PciIoDevice Pci device instance.
139 @return device path protocol instance for specific pci device.
141 EFI_DEVICE_PATH_PROTOCOL
*
142 CreatePciDevicePath (
143 IN EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
,
144 IN PCI_IO_DEVICE
*PciIoDevice
148 Check the bar is existed or not.
150 @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
151 @param Offset - The offset.
152 @param BarLengthValue - The bar length value.
153 @param OriginalBarValue - The original bar value.
155 @retval EFI_NOT_FOUND - The bar don't exist.
156 @retval EFI_SUCCESS - The bar exist.
161 IN PCI_IO_DEVICE
*PciIoDevice
,
163 OUT UINT32
*BarLengthValue
,
164 OUT UINT32
*OriginalBarValue
168 Test whether the device can support attributes
170 @param PciIoDevice Pci device instance
171 @param Command Command register value.
172 @param BridgeControl Bridge control value for PPB or P2C.
173 @param OldCommand Old command register offset
174 @param OldBridgeControl Old Bridge control value for PPB or P2C.
179 PciTestSupportedAttribute (
180 IN PCI_IO_DEVICE
*PciIoDevice
,
182 IN UINT16
*BridgeControl
,
183 IN UINT16
*OldCommand
,
184 IN UINT16
*OldBridgeControl
188 Set the supported or current attributes of a PCI device
190 @param PciIoDevice - Structure pointer for PCI device.
191 @param Command - Command register value.
192 @param BridgeControl - Bridge control value for PPB or P2C.
193 @param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
197 PciSetDeviceAttribute (
198 IN PCI_IO_DEVICE
*PciIoDevice
,
200 IN UINT16 BridgeControl
,
205 Determine if the device can support Fast Back to Back attribute
207 @param PciIoDevice Pci device instance.
208 @param StatusIndex Status register value.
211 GetFastBackToBackSupport (
212 IN PCI_IO_DEVICE
*PciIoDevice
,
217 Determine the related attributes of all devices under a Root Bridge
219 @param PciIoDevice PCI device instance.
223 DetermineDeviceAttribute (
224 IN PCI_IO_DEVICE
*PciIoDevice
228 This routine is used to update the bar information for those incompatible PCI device
230 @param PciIoDevice Pci device instance.
231 @return EFI_UNSUPPORTED failed to update Pci Info.
235 IN PCI_IO_DEVICE
*PciIoDevice
239 This routine will update the alignment with the new alignment
241 @param Alignment old alignment.
242 @param NewAlignment new alignment.
247 IN UINT64
*Alignment
,
248 IN UINT64 NewAlignment
254 @param PciIoDevice Pci device instance.
255 @param Offset bar offset.
256 @param BarIndex bar index.
258 @return next bar offset.
262 IN PCI_IO_DEVICE
*PciIoDevice
,
268 This routine is used to initialize the bar of a PCI device
269 It can be called typically when a device is going to be rejected.
271 @param PciIoDevice Pci device instance.
274 InitializePciDevice (
275 IN PCI_IO_DEVICE
*PciIoDevice
279 Init PPB for bridge device
281 @param PciIoDevice Pci device instance.
285 IN PCI_IO_DEVICE
*PciIoDevice
289 Init private data for Hotplug bridge device
291 @param PciIoDevice hotplug bridge device.
295 IN PCI_IO_DEVICE
*PciIoDevice
299 Create and initiliaze general PCI I/O device instance for
300 PCI device/bridge device/hotplug bridge device.
302 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
303 @param Pci Pci bar block
304 @param Bus device Bus NO.
305 @param Device device device NO.
306 @param Func device func NO.
308 @return instance of PCI device.
312 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
320 This routine is used to enumerate entire pci bus system
322 It is only called on the second start on the same Root Bridge.
324 @param Controller Parent bridge handler.
326 @return status of operation.
330 IN EFI_HANDLE Controller
336 @param Descriptors A pointer to the address space descriptor.
337 @param MinBus The min bus.
338 @param MaxBus The max bus.
339 @param BusRange The bus range.
341 @retval EFI_SUCCESS Success operation.
342 @retval EFI_NOT_FOUND can not find the specific bus.
346 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
353 This routine can be used to start the root bridge.
355 @param RootBridgeDev Pci device instance.
357 @retval EFI_SUCCESS This device started.
361 StartManagingRootBridge (
362 IN PCI_IO_DEVICE
*RootBridgeDev
366 This routine can be used to check whether a PCI device should be rejected when light enumeration
368 @param PciIoDevice Pci device instance.
370 @retval TRUE This device should be rejected.
371 @retval FALSE This device shouldn't be rejected.
375 IsPciDeviceRejected (
376 IN PCI_IO_DEVICE
*PciIoDevice