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