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