]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
41251ef3aba11e4b6eea02a2c3cb5c6459606928
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / PciBusDxe / PciDeviceSupport.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 #ifndef _EFI_PCI_DEVICE_SUPPORT_H
15 #define _EFI_PCI_DEVICE_SUPPORT_H
16
17 /**
18 Initialize the gPciDevicePool
19 **/
20 EFI_STATUS
21 InitializePciDevicePool (
22 VOID
23 )
24 ;
25
26 /**
27 Insert a root bridge into PCI device pool
28
29 @param RootBridge - A pointer to the PCI_IO_DEVICE.
30
31 **/
32 EFI_STATUS
33 InsertRootBridge (
34 PCI_IO_DEVICE *RootBridge
35 )
36 ;
37
38 /**
39 This function is used to insert a PCI device node under
40 a bridge
41
42 @param Bridge A pointer to the PCI_IO_DEVICE.
43 @param PciDeviceNode A pointer to the PCI_IO_DEVICE.
44
45 **/
46 EFI_STATUS
47 InsertPciDevice (
48 PCI_IO_DEVICE *Bridge,
49 PCI_IO_DEVICE *PciDeviceNode
50 )
51 ;
52
53 /**
54 Destroy root bridge and remove it from deivce tree.
55
56 @param RootBridge The bridge want to be removed
57
58 **/
59 EFI_STATUS
60 DestroyRootBridge (
61 IN PCI_IO_DEVICE *RootBridge
62 )
63 ;
64
65 /**
66 Destroy all the pci device node under the bridge.
67 Bridge itself is not included.
68
69 @param Bridge A pointer to the PCI_IO_DEVICE.
70
71 **/
72 EFI_STATUS
73 DestroyPciDeviceTree (
74 IN PCI_IO_DEVICE *Bridge
75 )
76 ;
77
78 /**
79 Destroy all device nodes under the root bridge
80 specified by Controller.
81 The root bridge itself is also included.
82
83 @param Controller An efi handle.
84
85 **/
86 EFI_STATUS
87 DestroyRootBridgeByHandle (
88 EFI_HANDLE Controller
89 )
90 ;
91
92 /**
93 This function registers the PCI IO device. It creates a handle for this PCI IO device
94 (if the handle does not exist), attaches appropriate protocols onto the handle, does
95 necessary initialization, and sets up parent/child relationship with its bus controller.
96
97 @param Controller - An EFI handle for the PCI bus controller.
98 @param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
99 @param Handle - A pointer to hold the EFI handle for the PCI IO device.
100
101 @retval EFI_SUCCESS - The PCI device is successfully registered.
102 @retval Others - An error occurred when registering the PCI device.
103
104 **/
105 EFI_STATUS
106 RegisterPciDevice (
107 IN EFI_HANDLE Controller,
108 IN PCI_IO_DEVICE *PciIoDevice,
109 OUT EFI_HANDLE *Handle OPTIONAL
110 )
111 ;
112
113 /**
114 This function is used to remove the whole PCI devices from the bridge.
115
116 @param RootBridgeHandle An efi handle.
117 @param Bridge A pointer to the PCI_IO_DEVICE.
118
119 @retval EFI_SUCCESS
120 **/
121 EFI_STATUS
122 RemoveAllPciDeviceOnBridge (
123 EFI_HANDLE RootBridgeHandle,
124 PCI_IO_DEVICE *Bridge
125 )
126 ;
127
128 /**
129
130 This function is used to de-register the PCI device from the EFI,
131 That includes un-installing PciIo protocol from the specified PCI
132 device handle.
133
134 @param Controller - controller handle
135 @param Handle - device handle
136
137 @return Status of de-register pci device
138 **/
139 EFI_STATUS
140 DeRegisterPciDevice (
141 IN EFI_HANDLE Controller,
142 IN EFI_HANDLE Handle
143 )
144 ;
145
146 /**
147 Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
148
149 @param Controller An efi handle.
150 @param RootBridge A pointer to the PCI_IO_DEVICE.
151 @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
152 @param NumberOfChildren Children number.
153 @param ChildHandleBuffer A pointer to the child handle buffer.
154
155 @retval EFI_NOT_READY Device is not allocated
156 @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
157 @retval EFI_NOT_FOUND Can not find the specific device
158 @retval EFI_SUCCESS Success to start Pci device on bridge
159
160 **/
161 EFI_STATUS
162 StartPciDevicesOnBridge (
163 IN EFI_HANDLE Controller,
164 IN PCI_IO_DEVICE *RootBridge,
165 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
166 IN OUT UINT8 *NumberOfChildren,
167 IN OUT EFI_HANDLE *ChildHandleBuffer
168 )
169 ;
170
171 /**
172 Start to manage all the PCI devices it found previously under
173 the entire host bridge.
174
175 @param Controller - root bridge handle.
176
177 **/
178 EFI_STATUS
179 StartPciDevices (
180 IN EFI_HANDLE Controller
181 )
182 ;
183
184 /**
185 Create root bridge device
186
187 @param RootBridgeHandle - Parent bridge handle.
188
189 @return pointer to new root bridge
190 **/
191 PCI_IO_DEVICE *
192 CreateRootBridge (
193 IN EFI_HANDLE RootBridgeHandle
194 )
195 ;
196
197 /**
198 Get root bridge device instance by specific handle
199
200 @param RootBridgeHandle Given root bridge handle
201
202 @return root bridge device instance
203 **/
204 PCI_IO_DEVICE *
205 GetRootBridgeByHandle (
206 EFI_HANDLE RootBridgeHandle
207 )
208 ;
209
210 BOOLEAN
211 RootBridgeExisted (
212 IN EFI_HANDLE RootBridgeHandle
213 )
214 ;
215
216 /**
217 Judege whether Pci device existed
218
219 @param Bridge Parent bridege instance
220 @param PciIoDevice Device instance
221
222 @return whether Pci device existed
223 **/
224 BOOLEAN
225 PciDeviceExisted (
226 IN PCI_IO_DEVICE *Bridge,
227 IN PCI_IO_DEVICE *PciIoDevice
228 )
229 ;
230
231 /**
232 Active VGA device
233
234 @param VgaDevice device instance for VGA
235
236 @return device instance
237 **/
238 PCI_IO_DEVICE *
239 ActiveVGADeviceOnTheSameSegment (
240 IN PCI_IO_DEVICE *VgaDevice
241 )
242 ;
243
244 /**
245 Active VGA device on root bridge
246
247 @param RootBridge Root bridge device instance
248
249 @return VGA device instance
250 **/
251 PCI_IO_DEVICE *
252 ActiveVGADeviceOnTheRootBridge (
253 IN PCI_IO_DEVICE *RootBridge
254 )
255 ;
256
257 /**
258 Get HPC PCI address according to its device path
259 @param PciRootBridgeIo Root bridege Io instance
260 @param HpcDevicePath Given searching device path
261 @param PciAddress Buffer holding searched result
262
263 @retval EFI_NOT_FOUND Can not find the specific device path.
264 @retval EFI_SUCCESS Success to get the device path
265 **/
266 EFI_STATUS
267 GetHpcPciAddress (
268 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
269 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
270 OUT UINT64 *PciAddress
271 )
272 ;
273
274 /**
275 Get HPC PCI address according to its device path
276 @param RootBridge Root bridege Io instance
277 @param RemainingDevicePath Given searching device path
278 @param PciAddress Buffer holding searched result
279
280 @retval EFI_NOT_FOUND Can not find the specific device path.
281 **/
282 EFI_STATUS
283 GetHpcPciAddressFromRootBridge (
284 IN PCI_IO_DEVICE *RootBridge,
285 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
286 OUT UINT64 *PciAddress
287 )
288 ;
289
290 /**
291 Destroy a pci device node.
292 Also all direct or indirect allocated resource for this node will be freed.
293
294 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
295
296 **/
297 EFI_STATUS
298 FreePciDevice (
299 IN PCI_IO_DEVICE *PciIoDevice
300 )
301 ;
302
303 #endif