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
,
41 Collect all the resource information under this root bridge
42 A database that records all the information about pci device subject to this
43 root bridge will then be created.
45 @param Bridge Parent bridge instance
46 @param StartBusNumer Bus number of begining
49 PciPciDeviceInfoCollector (
50 IN PCI_IO_DEVICE
*Bridge
,
56 Seach required device and get PCI device info block
58 @param Bridge Parent bridge instance
59 @param Pci Output of PCI device info block
60 @param Bus PCI bus NO.
61 @param Device PCI device NO.
62 @param Func PCI func NO.
63 @param PciDevice output of searched PCI device instance
67 IN PCI_IO_DEVICE
*Bridge
,
72 PCI_IO_DEVICE
**PciDevice
77 Create PCI private data for PCI device
79 @param Bridge Parent bridge instance
80 @param Pci PCI bar block
81 @param Bus PCI device Bus NO.
82 @param Device PCI device DeviceNO.
83 @param Func PCI device's func NO.
85 @return new PCI device's private date structure.
89 IN PCI_IO_DEVICE
*Bridge
,
98 Create private data for bridge device's PPB.
100 @param Bridge Parent bridge
101 @param Pci Pci device block
102 @param Bus Bridge device's bus NO.
103 @param Device Bridge device's device NO.
104 @param Func Bridge device's func NO.
106 @return bridge device instance
110 IN PCI_IO_DEVICE
*Bridge
,
119 Create private data for hotplug bridge device
121 @param Bridge Parent bridge instance
122 @param Pci PCI bar block
123 @param Bus hotplug bridge device's bus NO.
124 @param Device hotplug bridge device's device NO.
125 @param Func hotplug bridge device's Func NO.
127 @return hotplug bridge device instance
131 IN PCI_IO_DEVICE
*Bridge
,
140 Create device path for pci deivce
142 @param ParentDevicePath Parent bridge's path
143 @param PciIoDevice Pci device instance
145 @return device path protocol instance for specific pci device.
147 EFI_DEVICE_PATH_PROTOCOL
*
148 CreatePciDevicePath (
149 IN EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
,
150 IN PCI_IO_DEVICE
*PciIoDevice
155 Check the bar is existed or not.
157 @param PciIoDevice - A pointer to the PCI_IO_DEVICE.
158 @param Offset - The offset.
159 @param BarLengthValue - The bar length value.
160 @param OriginalBarValue - The original bar value.
162 @retval EFI_NOT_FOUND - The bar don't exist.
163 @retval EFI_SUCCESS - The bar exist.
168 IN PCI_IO_DEVICE
*PciIoDevice
,
170 OUT UINT32
*BarLengthValue
,
171 OUT UINT32
*OriginalBarValue
176 Test whether the device can support attributes
178 @param PciIoDevice Pci device instance
179 @param Command Command register value.
180 @param BridgeControl Bridge control value for PPB or P2C.
181 @param OldCommand Old command register offset
182 @param OldBridgeControl Old Bridge control value for PPB or P2C.
187 PciTestSupportedAttribute (
188 IN PCI_IO_DEVICE
*PciIoDevice
,
190 IN UINT16
*BridgeControl
,
191 IN UINT16
*OldCommand
,
192 IN UINT16
*OldBridgeControl
197 Set the supported or current attributes of a PCI device
199 @param PciIoDevice - Structure pointer for PCI device.
200 @param Command - Command register value.
201 @param BridgeControl - Bridge control value for PPB or P2C.
202 @param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.
206 PciSetDeviceAttribute (
207 IN PCI_IO_DEVICE
*PciIoDevice
,
209 IN UINT16 BridgeControl
,
215 Determine if the device can support Fast Back to Back attribute
217 @param PciIoDevice Pci device instance
218 @param StatusIndex Status register value
221 GetFastBackToBackSupport (
222 IN PCI_IO_DEVICE
*PciIoDevice
,
228 Determine the related attributes of all devices under a Root Bridge
230 @param PciIoDevice PCI device instance
234 DetermineDeviceAttribute (
235 IN PCI_IO_DEVICE
*PciIoDevice
240 This routine is used to update the bar information for those incompatible PCI device
242 @param PciIoDevice Pci device instance
243 @return EFI_UNSUPPORTED failed to update Pci Info
247 IN PCI_IO_DEVICE
*PciIoDevice
252 This routine will update the alignment with the new alignment
254 @param Alignment old alignment
255 @param NewAlignment new alignment
260 IN UINT64
*Alignment
,
261 IN UINT64 NewAlignment
268 @param PciIoDevice Pci device instance
269 @param Offset bar offset
270 @param BarIndex bar index
272 @return next bar offset.
276 IN PCI_IO_DEVICE
*PciIoDevice
,
283 This routine is used to initialize the bar of a PCI device
284 It can be called typically when a device is going to be rejected
286 @param PciIoDevice Pci device instance
289 InitializePciDevice (
290 IN PCI_IO_DEVICE
*PciIoDevice
295 Init PPB for bridge device
297 @param PciIoDevice Pci device instance
301 IN PCI_IO_DEVICE
*PciIoDevice
306 Init private data for Hotplug bridge device
308 @param PciIoDevice hotplug bridge device
312 IN PCI_IO_DEVICE
*PciIoDevice
317 Create and initiliaze general PCI I/O device instance for
318 PCI device/bridge device/hotplug bridge device.
320 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
321 @param Pci Pci bar block
322 @param Bus device Bus NO.
323 @param Device device device NO.
324 @param Func device func NO.
326 @return instance of PCI device
330 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
339 This routine is used to enumerate entire pci bus system
341 It is only called on the second start on the same Root Bridge.
343 @param Controller Parent bridge handler
345 @return status of operation.
349 IN EFI_HANDLE Controller
356 @param Descriptors A pointer to the address space descriptor.
357 @param MinBus The min bus.
358 @param MaxBus The max bus.
359 @param BusRange The bus range.
361 @retval EFI_SUCCESS Success operation.
362 @retval EFI_NOT_FOUND can not find the specific bus.
366 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
**Descriptors
,
374 StartManagingRootBridge (
375 IN PCI_IO_DEVICE
*RootBridgeDev
380 This routine can be used to check whether a PCI device should be rejected when light enumeration
382 @param PciIoDevice Pci device instance
384 @retval TRUE This device should be rejected
385 @retval FALSE This device shouldn't be rejected
389 IsPciDeviceRejected (
390 IN PCI_IO_DEVICE
*PciIoDevice