3 Copyright (c) 2006 - 2007, 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.
18 PCI Bus Driver Lib header file.
19 Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable
26 #ifndef _EFI_PCI_LIB_H
27 #define _EFI_PCI_LIB_H
30 // Mask definistions for PCD PcdPciIncompatibleDeviceSupportMask
32 #define PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT 0x01
33 #define PCI_INCOMPATIBLE_READ_SUPPORT 0x02
34 #define PCI_INCOMPATIBLE_WRITE_SUPPORT 0x04
35 #define PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT 0x08
36 #define PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT 0x0a
40 } EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD
;
44 UINT16 DevicePathSize
;
50 } EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD
;
53 Install protocol gEfiPciHotPlugRequestProtocolGuid
54 @param Status return status of protocol installation.
57 InstallHotPlugRequestProtocol (
63 Install protocol gEfiPciHotplugDeviceGuid into hotplug device
66 @param PciIoDevice hotplug device instance
70 InstallPciHotplugGuid (
71 IN PCI_IO_DEVICE
*PciIoDevice
76 UnInstall protocol gEfiPciHotplugDeviceGuid into hotplug device
79 @param PciIoDevice hotplug device instance
83 UninstallPciHotplugGuid (
84 IN PCI_IO_DEVICE
*PciIoDevice
89 Retrieve the BAR information via PciIo interface
91 @param PciIoDevice Pci device instance
95 IN PCI_IO_DEVICE
*PciIoDevice
100 Remove rejected pci device from specific root bridge
103 @param RootBridgeHandle specific parent root bridge handle
104 @param Bridge Bridge device instance
106 @retval EFI_SUCCESS Success operation.
109 RemoveRejectedPciDevices (
110 EFI_HANDLE RootBridgeHandle
,
111 IN PCI_IO_DEVICE
*Bridge
116 Wrapper function for allocating resource for pci host bridge.
118 @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
122 PciHostBridgeResourceAllocator (
123 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
128 PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
129 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
134 PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
135 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
140 Wapper function of scanning pci bus and assign bus number to the given PCI bus system
141 Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug
143 @param Bridge Bridge device instance
144 @param StartBusNumber start point
145 @param SubBusNumber Point to sub bus number
146 @param PaddedBusRange Customized bus number
148 @retval EFI_SUCCESS Success
149 @retval EFI_DEVICE_ERROR Fail to scan bus
153 IN PCI_IO_DEVICE
*Bridge
,
154 IN UINT8 StartBusNumber
,
155 OUT UINT8
*SubBusNumber
,
156 OUT UINT8
*PaddedBusRange
161 PciScanBus_WithHotPlugDeviceSupport (
162 IN PCI_IO_DEVICE
*Bridge
,
163 IN UINT8 StartBusNumber
,
164 OUT UINT8
*SubBusNumber
,
165 OUT UINT8
*PaddedBusRange
170 PciScanBus_WithoutHotPlugDeviceSupport (
171 IN PCI_IO_DEVICE
*Bridge
,
172 IN UINT8 StartBusNumber
,
173 OUT UINT8
*SubBusNumber
,
174 OUT UINT8
*PaddedBusRange
179 Process Option Rom on this host bridge
181 @param Bridge Pci bridge device instance
183 @retval EFI_SUCCESS Success
187 PciRootBridgeP2CProcess (
188 IN PCI_IO_DEVICE
*Bridge
193 Process Option Rom on this host bridge
195 @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
197 @retval EFI_NOT_FOUND Can not find the root bridge instance
198 @retval EFI_SUCCESS Success process
201 PciHostBridgeP2CProcess (
202 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
207 This function is used to enumerate the entire host bridge
210 @param PciResAlloc A pointer to the resource allocate protocol.
212 @retval EFI_OUT_OF_RESOURCES no enough resource
213 @retval EFI_SUCCESS Success
218 PciHostBridgeEnumerator (
219 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
224 Read PCI configuration space through EFI_PCI_IO_PROTOCOL.
226 @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
227 @param Width Signifies the width of the memory operations.
228 @Param Address The address within the PCI configuration space for the PCI controller.
229 @param Buffer For read operations, the destination buffer to store the results. For
230 write operations, the source buffer to write data from.
232 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
233 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
234 @retval EFI_INVALID_PARAMETER Buffer is NULL.
235 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
240 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
241 IN EFI_PCI_IO_PROTOCOL_WIDTH Width
,
248 Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
250 @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
251 @param Width Signifies the width of the memory operations.
252 @Param Address The address within the PCI configuration space for the PCI controller.
253 @param Buffer For read operations, the destination buffer to store the results. For
254 write operations, the source buffer to write data from.
256 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
257 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
258 @retval EFI_INVALID_PARAMETER Buffer is NULL.
259 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
264 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
265 IN EFI_PCI_IO_PROTOCOL_WIDTH Width
,
272 Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
274 @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
275 @param Pci A pointer to PCI_TYPE00.
276 @param Width Signifies the width of the memory operations.
277 @Param Address The address within the PCI configuration space for the PCI controller.
278 @param Buffer For read operations, the destination buffer to store the results. For
279 write operations, the source buffer to write data from.
281 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
282 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
283 @retval EFI_INVALID_PARAMETER Buffer is NULL.
284 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
288 PciRootBridgeIoWrite (
289 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
291 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width
,
298 Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
300 @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
301 @param Pci A pointer to PCI_TYPE00.
302 @param Width Signifies the width of the memory operations.
303 @Param Address The address within the PCI configuration space for the PCI controller.
304 @param Buffer For read operations, the destination buffer to store the results. For
305 write operations, the source buffer to write data from.
307 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
308 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
309 @retval EFI_INVALID_PARAMETER Buffer is NULL.
310 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
314 PciRootBridgeIoRead (
315 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
317 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width
,