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