]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.h
1. EDK_RELEASE_VERSION removed;
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciLib.h
CommitLineData
3dbba770 1/** @file\r
ead42efc 2\r
3Copyright (c) 2006 - 2007, Intel Corporation\r
4All rights reserved. This program and the accompanying materials\r
5are licensed and made available under the terms and conditions of the BSD License\r
6which accompanies this distribution. The full text of the license may be found at\r
7http://opensource.org/licenses/bsd-license.php\r
8\r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11\r
12Module Name:\r
13\r
14 PciLib.h\r
15\r
16Abstract:\r
17\r
18 PCI Bus Driver Lib header file.\r
19 Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable\r
20 support hot plug.\r
21\r
22Revision History\r
23\r
3dbba770 24**/\r
ead42efc 25\r
eeefcb9d 26#ifndef _EFI_PCI_LIB_H_\r
27#define _EFI_PCI_LIB_H_\r
ead42efc 28\r
29//\r
30// Mask definistions for PCD PcdPciIncompatibleDeviceSupportMask\r
31//\r
32#define PCI_INCOMPATIBLE_ACPI_RESOURCE_SUPPORT 0x01\r
33#define PCI_INCOMPATIBLE_READ_SUPPORT 0x02\r
34#define PCI_INCOMPATIBLE_WRITE_SUPPORT 0x04\r
35#define PCI_INCOMPATIBLE_REGISTER_UPDATE_SUPPORT 0x08\r
36#define PCI_INCOMPATIBLE_ACCESS_WIDTH_SUPPORT 0x0a\r
37\r
a43264f4 38typedef struct {\r
39 EFI_HANDLE Handle;\r
40} EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD;\r
41\r
42typedef struct {\r
43 UINT32 Bar;\r
44 UINT16 DevicePathSize;\r
45 UINT16 ReqResSize;\r
46 UINT16 AllocResSize;\r
47 UINT8 *DevicePath;\r
48 UINT8 *ReqRes;\r
49 UINT8 *AllocRes;\r
50} EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD;\r
51\r
57076f45 52/**\r
53 Install protocol gEfiPciHotPlugRequestProtocolGuid\r
54 @param Status return status of protocol installation.\r
55**/\r
97404058 56VOID\r
ead42efc 57InstallHotPlugRequestProtocol (\r
58 IN EFI_STATUS *Status\r
ed66e1bc 59 );\r
ead42efc 60\r
57076f45 61/**\r
62 Install protocol gEfiPciHotplugDeviceGuid into hotplug device\r
eeefcb9d 63 instance.\r
57076f45 64 \r
eeefcb9d 65 @param PciIoDevice hotplug device instance.\r
57076f45 66 \r
67**/\r
ead42efc 68VOID\r
69InstallPciHotplugGuid (\r
70 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 71 );\r
ead42efc 72\r
57076f45 73/**\r
74 UnInstall protocol gEfiPciHotplugDeviceGuid into hotplug device\r
eeefcb9d 75 instance.\r
57076f45 76 \r
eeefcb9d 77 @param PciIoDevice hotplug device instance.\r
57076f45 78 \r
79**/\r
ead42efc 80VOID\r
81UninstallPciHotplugGuid (\r
82 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 83 );\r
ead42efc 84\r
57076f45 85/**\r
eeefcb9d 86 Retrieve the BAR information via PciIo interface.\r
57076f45 87 \r
eeefcb9d 88 @param PciIoDevice Pci device instance.\r
57076f45 89**/\r
ead42efc 90VOID\r
91GetBackPcCardBar (\r
92 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 93 );\r
ead42efc 94\r
57076f45 95/**\r
96 Remove rejected pci device from specific root bridge\r
97 handle.\r
98 \r
eeefcb9d 99 @param RootBridgeHandle specific parent root bridge handle.\r
100 @param Bridge Bridge device instance.\r
57076f45 101 \r
102 @retval EFI_SUCCESS Success operation.\r
103**/\r
ead42efc 104EFI_STATUS\r
105RemoveRejectedPciDevices (\r
106 EFI_HANDLE RootBridgeHandle,\r
107 IN PCI_IO_DEVICE *Bridge\r
ed66e1bc 108 );\r
ead42efc 109\r
57076f45 110/**\r
111 Wrapper function for allocating resource for pci host bridge.\r
112 \r
eeefcb9d 113 @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
57076f45 114 \r
115**/\r
ead42efc 116EFI_STATUS\r
117PciHostBridgeResourceAllocator (\r
118 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
ed66e1bc 119 );\r
ead42efc 120\r
eeefcb9d 121/**\r
122 Wrapper function for allocating resource for pci host bridge without hotplug device support.\r
123 \r
124 @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
125 \r
126**/\r
ead42efc 127EFI_STATUS\r
128PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (\r
129 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
ed66e1bc 130 );\r
ead42efc 131\r
eeefcb9d 132/**\r
133 Wrapper function for allocating resource for pci host bridge with hotplug device support.\r
134 \r
135 @param PciResAlloc Point to protocol instance EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
136 \r
137**/\r
ead42efc 138EFI_STATUS\r
139PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (\r
140 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
ed66e1bc 141 );\r
ead42efc 142\r
57076f45 143/**\r
144 Wapper function of scanning pci bus and assign bus number to the given PCI bus system\r
eeefcb9d 145 Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug. \r
57076f45 146 \r
eeefcb9d 147 @param Bridge Bridge device instance.\r
148 @param StartBusNumber start point.\r
149 @param SubBusNumber Point to sub bus number.\r
150 @param PaddedBusRange Customized bus number.\r
57076f45 151 \r
eeefcb9d 152 @retval EFI_SUCCESS Success.\r
153 @retval EFI_DEVICE_ERROR Fail to scan bus.\r
57076f45 154**/\r
ead42efc 155EFI_STATUS\r
156PciScanBus (\r
157 IN PCI_IO_DEVICE *Bridge,\r
158 IN UINT8 StartBusNumber,\r
159 OUT UINT8 *SubBusNumber,\r
160 OUT UINT8 *PaddedBusRange\r
ed66e1bc 161 );\r
ead42efc 162\r
eeefcb9d 163/**\r
164 Wapper function of scanning pci bus and assign bus number to the given PCI bus system\r
165 Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug. \r
166 \r
167 @param Bridge Bridge device instance.\r
168 @param StartBusNumber start point.\r
169 @param SubBusNumber Point to sub bus number.\r
170 @param PaddedBusRange Customized bus number.\r
171 \r
172 @retval EFI_SUCCESS Success.\r
173 @retval EFI_DEVICE_ERROR Fail to scan bus.\r
174**/\r
ead42efc 175EFI_STATUS\r
176PciScanBus_WithHotPlugDeviceSupport (\r
177 IN PCI_IO_DEVICE *Bridge,\r
178 IN UINT8 StartBusNumber,\r
179 OUT UINT8 *SubBusNumber,\r
180 OUT UINT8 *PaddedBusRange\r
ed66e1bc 181 );\r
ead42efc 182\r
eeefcb9d 183/**\r
184 Wapper function of scanning pci bus and assign bus number to the given PCI bus system\r
185 Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug. \r
186 \r
187 @param Bridge Bridge device instance.\r
188 @param StartBusNumber start point.\r
189 @param SubBusNumber Point to sub bus number.\r
190 @param PaddedBusRange Customized bus number.\r
191 \r
192 @retval EFI_SUCCESS Success.\r
193 @retval EFI_DEVICE_ERROR Fail to scan bus.\r
194**/\r
ead42efc 195EFI_STATUS\r
196PciScanBus_WithoutHotPlugDeviceSupport (\r
197 IN PCI_IO_DEVICE *Bridge,\r
198 IN UINT8 StartBusNumber,\r
199 OUT UINT8 *SubBusNumber,\r
200 OUT UINT8 *PaddedBusRange\r
ed66e1bc 201 );\r
ead42efc 202\r
57076f45 203/**\r
eeefcb9d 204 Process Option Rom on this host bridge.\r
57076f45 205 \r
eeefcb9d 206 @param Bridge Pci bridge device instance.\r
57076f45 207 \r
eeefcb9d 208 @retval EFI_SUCCESS Success.\r
57076f45 209**/\r
ead42efc 210EFI_STATUS\r
211PciRootBridgeP2CProcess (\r
212 IN PCI_IO_DEVICE *Bridge\r
ed66e1bc 213 );\r
ead42efc 214\r
57076f45 215/**\r
eeefcb9d 216 Process Option Rom on this host bridge.\r
57076f45 217 \r
eeefcb9d 218 @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
57076f45 219 \r
eeefcb9d 220 @retval EFI_NOT_FOUND Can not find the root bridge instance.\r
221 @retval EFI_SUCCESS Success process.\r
57076f45 222**/\r
ead42efc 223EFI_STATUS\r
224PciHostBridgeP2CProcess (\r
225 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
ed66e1bc 226 );\r
ead42efc 227\r
57076f45 228/**\r
229 This function is used to enumerate the entire host bridge\r
eeefcb9d 230 in a given platform.\r
ead42efc 231\r
57076f45 232 @param PciResAlloc A pointer to the resource allocate protocol.\r
ead42efc 233\r
eeefcb9d 234 @retval EFI_OUT_OF_RESOURCES no enough resource.\r
235 @retval EFI_SUCCESS Success.\r
ead42efc 236\r
bcd70414 237**/\r
ead42efc 238EFI_STATUS\r
239PciHostBridgeEnumerator (\r
240 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
ed66e1bc 241 );\r
ead42efc 242\r
243/**\r
244 Read PCI configuration space through EFI_PCI_IO_PROTOCOL.\r
245\r
246 @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.\r
247 @param Width Signifies the width of the memory operations.\r
eeefcb9d 248 @param Address The address within the PCI configuration space for the PCI controller.\r
249 @param Count The number of unit to be read.\r
ead42efc 250 @param Buffer For read operations, the destination buffer to store the results. For\r
251 write operations, the source buffer to write data from.\r
252\r
253 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.\r
254 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.\r
255 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
256 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
257\r
258**/\r
259EFI_STATUS\r
260PciIoRead (\r
261 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
262 IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
263 IN UINT32 Address,\r
264 IN UINTN Count,\r
265 IN OUT VOID *Buffer\r
266 );\r
267\r
268/**\r
269 Write PCI configuration space through EFI_PCI_IO_PROTOCOL.\r
270\r
271 @param PciIo A pointer to the EFI_PCI_O_PROTOCOL.\r
272 @param Width Signifies the width of the memory operations.\r
eeefcb9d 273 @param Address The address within the PCI configuration space for the PCI controller.\r
274 @param Count The number of unit to be write.\r
ead42efc 275 @param Buffer For read operations, the destination buffer to store the results. For\r
276 write operations, the source buffer to write data from.\r
277\r
278 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.\r
279 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.\r
280 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
281 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
282\r
283**/\r
284EFI_STATUS\r
285PciIoWrite (\r
286 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
287 IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
288 IN UINT32 Address,\r
289 IN UINTN Count,\r
290 IN OUT VOID *Buffer\r
291 );\r
292\r
293/**\r
294 Write PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
295\r
296 @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
297 @param Pci A pointer to PCI_TYPE00.\r
298 @param Width Signifies the width of the memory operations.\r
eeefcb9d 299 @param Address The address within the PCI configuration space for the PCI controller.\r
300 @param Count The number of unit to be write.\r
ead42efc 301 @param Buffer For read operations, the destination buffer to store the results. For\r
302 write operations, the source buffer to write data from.\r
303\r
304 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.\r
305 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.\r
306 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
307 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
308\r
309**/\r
310EFI_STATUS\r
311PciRootBridgeIoWrite (\r
312 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r
313 IN PCI_TYPE00 *Pci,\r
314 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
315 IN UINT64 Address,\r
316 IN UINTN Count,\r
317 IN OUT VOID *Buffer\r
318 );\r
319\r
320/**\r
321 Read PCI configuration space through EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
322\r
323 @param PciRootBridgeIo A pointer to the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
324 @param Pci A pointer to PCI_TYPE00.\r
325 @param Width Signifies the width of the memory operations.\r
eeefcb9d 326 @param Address The address within the PCI configuration space for the PCI controller.\r
327 @param Count The number of unit to be read.\r
ead42efc 328 @param Buffer For read operations, the destination buffer to store the results. For\r
329 write operations, the source buffer to write data from.\r
330\r
331 @retval EFI_SUCCESS The data was read from or written to the PCI root bridge.\r
332 @retval EFI_INVALID_PARAMETER Width is invalid for this PCI root bridge.\r
333 @retval EFI_INVALID_PARAMETER Buffer is NULL.\r
334 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
335\r
336**/\r
337EFI_STATUS\r
338PciRootBridgeIoRead (\r
339 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r
eeefcb9d 340 IN PCI_TYPE00 *Pci, OPTIONAL\r
ead42efc 341 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
342 IN UINT64 Address,\r
343 IN UINTN Count,\r
344 IN OUT VOID *Buffer\r
345 );\r
346#endif\r