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 (
62 Install protocol gEfiPciHotplugDeviceGuid into hotplug device
65 @param PciIoDevice hotplug device instance
69 InstallPciHotplugGuid (
70 IN PCI_IO_DEVICE
*PciIoDevice
74 UnInstall protocol gEfiPciHotplugDeviceGuid into hotplug device
77 @param PciIoDevice hotplug device instance
81 UninstallPciHotplugGuid (
82 IN PCI_IO_DEVICE
*PciIoDevice
86 Retrieve the BAR information via PciIo interface
88 @param PciIoDevice Pci device instance
92 IN PCI_IO_DEVICE
*PciIoDevice
96 Remove rejected pci device from specific root bridge
99 @param RootBridgeHandle specific parent root bridge handle
100 @param Bridge Bridge device instance
102 @retval EFI_SUCCESS Success operation.
105 RemoveRejectedPciDevices (
106 EFI_HANDLE RootBridgeHandle
,
107 IN PCI_IO_DEVICE
*Bridge
111 Wrapper function for allocating resource for pci host bridge.
113 @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
117 PciHostBridgeResourceAllocator (
118 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
122 PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
123 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
127 PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
128 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
132 Wapper function of scanning pci bus and assign bus number to the given PCI bus system
133 Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug
135 @param Bridge Bridge device instance
136 @param StartBusNumber start point
137 @param SubBusNumber Point to sub bus number
138 @param PaddedBusRange Customized bus number
140 @retval EFI_SUCCESS Success
141 @retval EFI_DEVICE_ERROR Fail to scan bus
145 IN PCI_IO_DEVICE
*Bridge
,
146 IN UINT8 StartBusNumber
,
147 OUT UINT8
*SubBusNumber
,
148 OUT UINT8
*PaddedBusRange
152 PciScanBus_WithHotPlugDeviceSupport (
153 IN PCI_IO_DEVICE
*Bridge
,
154 IN UINT8 StartBusNumber
,
155 OUT UINT8
*SubBusNumber
,
156 OUT UINT8
*PaddedBusRange
160 PciScanBus_WithoutHotPlugDeviceSupport (
161 IN PCI_IO_DEVICE
*Bridge
,
162 IN UINT8 StartBusNumber
,
163 OUT UINT8
*SubBusNumber
,
164 OUT UINT8
*PaddedBusRange
168 Process Option Rom on this host bridge
170 @param Bridge Pci bridge device instance
172 @retval EFI_SUCCESS Success
176 PciRootBridgeP2CProcess (
177 IN PCI_IO_DEVICE
*Bridge
181 Process Option Rom on this host bridge
183 @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
185 @retval EFI_NOT_FOUND Can not find the root bridge instance
186 @retval EFI_SUCCESS Success process
189 PciHostBridgeP2CProcess (
190 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
194 This function is used to enumerate the entire host bridge
197 @param PciResAlloc A pointer to the resource allocate protocol.
199 @retval EFI_OUT_OF_RESOURCES no enough resource
200 @retval EFI_SUCCESS Success
205 PciHostBridgeEnumerator (
206 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*PciResAlloc
210 Read PCI configuration space through EFI_PCI_IO_PROTOCOL.
212 @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
213 @param Width Signifies the width of the memory operations.
214 @Param Address The address within the PCI configuration space for the PCI controller.
215 @param Buffer For read operations, the destination buffer to store the results. For
216 write operations, the source buffer to write data from.
218 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
219 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
220 @retval EFI_INVALID_PARAMETER Buffer is NULL.
221 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
226 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
227 IN EFI_PCI_IO_PROTOCOL_WIDTH Width
,
234 Write PCI configuration space through EFI_PCI_IO_PROTOCOL.
236 @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.
237 @param Width Signifies the width of the memory operations.
238 @Param Address The address within the PCI configuration space for the PCI controller.
239 @param Buffer For read operations, the destination buffer to store the results. For
240 write operations, the source buffer to write data from.
242 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
243 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
244 @retval EFI_INVALID_PARAMETER Buffer is NULL.
245 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
250 IN EFI_PCI_IO_PROTOCOL
*PciIo
,
251 IN EFI_PCI_IO_PROTOCOL_WIDTH Width
,
258 Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
260 @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
261 @param Pci A pointer to PCI_TYPE00.
262 @param Width Signifies the width of the memory operations.
263 @Param Address The address within the PCI configuration space for the PCI controller.
264 @param Buffer For read operations, the destination buffer to store the results. For
265 write operations, the source buffer to write data from.
267 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
268 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
269 @retval EFI_INVALID_PARAMETER Buffer is NULL.
270 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
274 PciRootBridgeIoWrite (
275 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
277 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width
,
284 Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
286 @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.
287 @param Pci A pointer to PCI_TYPE00.
288 @param Width Signifies the width of the memory operations.
289 @Param Address The address within the PCI configuration space for the PCI controller.
290 @param Buffer For read operations, the destination buffer to store the results. For
291 write operations, the source buffer to write data from.
293 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.
294 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.
295 @retval EFI_INVALID_PARAMETER Buffer is NULL.
296 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
300 PciRootBridgeIoRead (
301 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
303 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width
,