]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.h
clean up the un-suitable ';' location when declaring the functions.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciEnumeratorSupport.h
CommitLineData
3db51098 1/**@file\r
ead42efc 2\r
3Copyright (c) 2006, 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
3db51098 12**/\r
ead42efc 13\r
ead42efc 14\r
15#ifndef _EFI_PCI_ENUMERATOR_SUPPORT_H\r
16#define _EFI_PCI_ENUMERATOR_SUPPORT_H\r
17\r
a3b8e257 18/**\r
19 This routine is used to check whether the pci device is present.\r
20 \r
21 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL\r
22 @param Pci Output buffer for PCI device structure\r
23 @param Bus PCI bus NO\r
24 @param Device PCI device NO\r
25 @param Func PCI Func NO\r
26 \r
27 @retval EFI_NOT_FOUND device not present\r
28 @retval EFI_SUCCESS device is found.\r
29**/\r
ead42efc 30EFI_STATUS\r
31PciDevicePresent (\r
32 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r
33 PCI_TYPE00 *Pci,\r
34 UINT8 Bus,\r
35 UINT8 Device,\r
36 UINT8 Func\r
ed66e1bc 37 );\r
ead42efc 38\r
a3b8e257 39/**\r
40 Collect all the resource information under this root bridge\r
41 A database that records all the information about pci device subject to this\r
42 root bridge will then be created.\r
43 \r
44 @param Bridge Parent bridge instance\r
45 @param StartBusNumer Bus number of begining \r
46**/\r
ead42efc 47EFI_STATUS\r
48PciPciDeviceInfoCollector (\r
49 IN PCI_IO_DEVICE *Bridge,\r
50 UINT8 StartBusNumber\r
ed66e1bc 51 );\r
ead42efc 52\r
a3b8e257 53/**\r
54 Seach required device and get PCI device info block\r
55 \r
56 @param Bridge Parent bridge instance\r
57 @param Pci Output of PCI device info block\r
58 @param Bus PCI bus NO.\r
59 @param Device PCI device NO.\r
60 @param Func PCI func NO.\r
61 @param PciDevice output of searched PCI device instance\r
62**/\r
ead42efc 63EFI_STATUS\r
64PciSearchDevice (\r
65 IN PCI_IO_DEVICE *Bridge,\r
66 PCI_TYPE00 *Pci,\r
67 UINT8 Bus,\r
68 UINT8 Device,\r
69 UINT8 Func,\r
70 PCI_IO_DEVICE **PciDevice\r
ed66e1bc 71 );\r
ead42efc 72\r
a3b8e257 73/**\r
74 Create PCI private data for PCI device\r
75 \r
76 @param Bridge Parent bridge instance\r
77 @param Pci PCI bar block\r
78 @param Bus PCI device Bus NO.\r
79 @param Device PCI device DeviceNO.\r
80 @param Func PCI device's func NO.\r
81 \r
82 @return new PCI device's private date structure.\r
83**/\r
ead42efc 84PCI_IO_DEVICE *\r
85GatherDeviceInfo (\r
86 IN PCI_IO_DEVICE *Bridge,\r
87 IN PCI_TYPE00 *Pci,\r
88 UINT8 Bus,\r
89 UINT8 Device,\r
90 UINT8 Func\r
ed66e1bc 91 );\r
ead42efc 92\r
a3b8e257 93/**\r
94 Create private data for bridge device's PPB.\r
95 \r
96 @param Bridge Parent bridge \r
97 @param Pci Pci device block\r
98 @param Bus Bridge device's bus NO.\r
99 @param Device Bridge device's device NO.\r
100 @param Func Bridge device's func NO.\r
101 \r
102 @return bridge device instance\r
103**/\r
ead42efc 104PCI_IO_DEVICE *\r
105GatherPpbInfo (\r
106 IN PCI_IO_DEVICE *Bridge,\r
107 IN PCI_TYPE00 *Pci,\r
108 UINT8 Bus,\r
109 UINT8 Device,\r
110 UINT8 Func\r
ed66e1bc 111 );\r
ead42efc 112\r
a3b8e257 113/**\r
114 Create private data for hotplug bridge device\r
115 \r
116 @param Bridge Parent bridge instance\r
117 @param Pci PCI bar block\r
118 @param Bus hotplug bridge device's bus NO.\r
119 @param Device hotplug bridge device's device NO.\r
120 @param Func hotplug bridge device's Func NO.\r
121 \r
122 @return hotplug bridge device instance\r
123**/\r
ead42efc 124PCI_IO_DEVICE *\r
125GatherP2CInfo (\r
126 IN PCI_IO_DEVICE *Bridge,\r
127 IN PCI_TYPE00 *Pci,\r
128 UINT8 Bus,\r
129 UINT8 Device,\r
130 UINT8 Func\r
ed66e1bc 131 );\r
ead42efc 132\r
a3b8e257 133/**\r
134 Create device path for pci deivce\r
135 \r
136 @param ParentDevicePath Parent bridge's path\r
137 @param PciIoDevice Pci device instance\r
138 \r
139 @return device path protocol instance for specific pci device.\r
140**/\r
ead42efc 141EFI_DEVICE_PATH_PROTOCOL *\r
142CreatePciDevicePath (\r
143 IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
144 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 145 );\r
ead42efc 146\r
a3b8e257 147/**\r
148 Check the bar is existed or not.\r
ead42efc 149\r
a3b8e257 150 @param PciIoDevice - A pointer to the PCI_IO_DEVICE.\r
151 @param Offset - The offset.\r
152 @param BarLengthValue - The bar length value.\r
153 @param OriginalBarValue - The original bar value.\r
ead42efc 154\r
a3b8e257 155 @retval EFI_NOT_FOUND - The bar don't exist.\r
156 @retval EFI_SUCCESS - The bar exist.\r
ead42efc 157\r
bcd70414 158**/\r
ead42efc 159EFI_STATUS\r
160BarExisted (\r
161 IN PCI_IO_DEVICE *PciIoDevice,\r
162 IN UINTN Offset,\r
163 OUT UINT32 *BarLengthValue,\r
164 OUT UINT32 *OriginalBarValue\r
ed66e1bc 165 );\r
ead42efc 166\r
a3b8e257 167/**\r
168 Test whether the device can support attributes \r
169 \r
170 @param PciIoDevice Pci device instance\r
171 @param Command Command register value.\r
172 @param BridgeControl Bridge control value for PPB or P2C.\r
173 @param OldCommand Old command register offset\r
174 @param OldBridgeControl Old Bridge control value for PPB or P2C.\r
175 \r
176 @return EFI_SUCCESS\r
177**/\r
ead42efc 178EFI_STATUS\r
179PciTestSupportedAttribute (\r
180 IN PCI_IO_DEVICE *PciIoDevice,\r
181 IN UINT16 *Command,\r
182 IN UINT16 *BridgeControl,\r
183 IN UINT16 *OldCommand,\r
184 IN UINT16 *OldBridgeControl\r
ed66e1bc 185 );\r
ead42efc 186\r
a3b8e257 187/**\r
188 Set the supported or current attributes of a PCI device\r
189 \r
190 @param PciIoDevice - Structure pointer for PCI device.\r
191 @param Command - Command register value.\r
192 @param BridgeControl - Bridge control value for PPB or P2C.\r
193 @param Option - Make a choice of EFI_SET_SUPPORTS or EFI_SET_ATTRIBUTES.\r
194 \r
195**/\r
ead42efc 196EFI_STATUS\r
197PciSetDeviceAttribute (\r
198 IN PCI_IO_DEVICE *PciIoDevice,\r
199 IN UINT16 Command,\r
200 IN UINT16 BridgeControl,\r
201 IN UINTN Option\r
ed66e1bc 202 );\r
ead42efc 203\r
a3b8e257 204/**\r
205 Determine if the device can support Fast Back to Back attribute\r
206 \r
207 @param PciIoDevice Pci device instance\r
208 @param StatusIndex Status register value\r
209**/\r
ead42efc 210EFI_STATUS\r
211GetFastBackToBackSupport (\r
212 IN PCI_IO_DEVICE *PciIoDevice,\r
213 IN UINT8 StatusIndex\r
ed66e1bc 214 );\r
ead42efc 215\r
a3b8e257 216/**\r
217 Determine the related attributes of all devices under a Root Bridge\r
218 \r
219 @param PciIoDevice PCI device instance\r
220 \r
221**/\r
ead42efc 222EFI_STATUS\r
223DetermineDeviceAttribute (\r
224 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 225 );\r
ead42efc 226\r
a3b8e257 227/**\r
228 This routine is used to update the bar information for those incompatible PCI device\r
229 \r
230 @param PciIoDevice Pci device instance\r
231 @return EFI_UNSUPPORTED failed to update Pci Info\r
232**/\r
ead42efc 233EFI_STATUS\r
234UpdatePciInfo (\r
235 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 236 );\r
ead42efc 237\r
a3b8e257 238/**\r
239 This routine will update the alignment with the new alignment\r
240 \r
241 @param Alignment old alignment\r
242 @param NewAlignment new alignment\r
243 \r
244**/\r
ead42efc 245VOID\r
246SetNewAlign (\r
247 IN UINT64 *Alignment,\r
248 IN UINT64 NewAlignment\r
ed66e1bc 249 );\r
ead42efc 250\r
a3b8e257 251/**\r
252 Parse PCI bar bit.\r
253 \r
254 @param PciIoDevice Pci device instance\r
255 @param Offset bar offset\r
256 @param BarIndex bar index\r
257 \r
258 @return next bar offset.\r
259**/\r
ead42efc 260UINTN\r
261PciParseBar (\r
262 IN PCI_IO_DEVICE *PciIoDevice,\r
263 IN UINTN Offset,\r
264 IN UINTN BarIndex\r
ed66e1bc 265 );\r
ead42efc 266\r
a3b8e257 267/**\r
268 This routine is used to initialize the bar of a PCI device\r
269 It can be called typically when a device is going to be rejected\r
ead42efc 270\r
a3b8e257 271 @param PciIoDevice Pci device instance\r
bcd70414 272**/\r
ead42efc 273EFI_STATUS\r
274InitializePciDevice (\r
275 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 276 );\r
ead42efc 277\r
a3b8e257 278/**\r
279 Init PPB for bridge device\r
280 \r
281 @param PciIoDevice Pci device instance\r
282**/\r
ead42efc 283EFI_STATUS\r
284InitializePpb (\r
285 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 286 );\r
ead42efc 287\r
a3b8e257 288/**\r
289 Init private data for Hotplug bridge device\r
290 \r
291 @param PciIoDevice hotplug bridge device\r
292**/\r
ead42efc 293EFI_STATUS\r
294InitializeP2C (\r
295 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 296 );\r
ead42efc 297\r
a3b8e257 298/**\r
299 Create and initiliaze general PCI I/O device instance for\r
300 PCI device/bridge device/hotplug bridge device.\r
301 \r
302 @param PciRootBridgeIo Pointer to instance of EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL\r
303 @param Pci Pci bar block\r
304 @param Bus device Bus NO.\r
305 @param Device device device NO.\r
306 @param Func device func NO.\r
307 \r
308 @return instance of PCI device\r
309**/\r
ead42efc 310PCI_IO_DEVICE *\r
311CreatePciIoDevice (\r
312 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r
313 IN PCI_TYPE00 *Pci,\r
314 UINT8 Bus,\r
315 UINT8 Device,\r
316 UINT8 Func\r
ed66e1bc 317 );\r
ead42efc 318\r
a3b8e257 319/**\r
320 This routine is used to enumerate entire pci bus system\r
321 in a given platform\r
322 It is only called on the second start on the same Root Bridge.\r
ead42efc 323\r
a3b8e257 324 @param Controller Parent bridge handler\r
325 \r
326 @return status of operation.\r
bcd70414 327**/\r
ead42efc 328EFI_STATUS\r
329PciEnumeratorLight (\r
330 IN EFI_HANDLE Controller\r
ed66e1bc 331 );\r
ead42efc 332\r
a3b8e257 333/**\r
334 Get bus range.\r
335 \r
336 @param Descriptors A pointer to the address space descriptor.\r
337 @param MinBus The min bus.\r
338 @param MaxBus The max bus.\r
339 @param BusRange The bus range.\r
340 \r
341 @retval EFI_SUCCESS Success operation.\r
342 @retval EFI_NOT_FOUND can not find the specific bus.\r
343**/\r
ead42efc 344EFI_STATUS\r
345PciGetBusRange (\r
346 IN EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r
347 OUT UINT16 *MinBus,\r
348 OUT UINT16 *MaxBus,\r
349 OUT UINT16 *BusRange\r
ed66e1bc 350 );\r
ead42efc 351\r
352EFI_STATUS\r
353StartManagingRootBridge (\r
354 IN PCI_IO_DEVICE *RootBridgeDev\r
ed66e1bc 355 );\r
ead42efc 356\r
a3b8e257 357/**\r
358 This routine can be used to check whether a PCI device should be rejected when light enumeration\r
ead42efc 359\r
a3b8e257 360 @param PciIoDevice Pci device instance\r
ead42efc 361\r
a3b8e257 362 @retval TRUE This device should be rejected\r
363 @retval FALSE This device shouldn't be rejected\r
364 \r
bcd70414 365**/\r
ead42efc 366BOOLEAN\r
367IsPciDeviceRejected (\r
368 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 369 );\r
ead42efc 370\r
371#endif\r