]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
Retire PciHotplugDeviceGuid.
[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 /**
198 Check root bridge device is existed or not.
199
200 @param RootBridgeHandle Given root bridge handle.
201
202 @return root bridge device is existed or not.
203 **/
204 BOOLEAN
205 RootBridgeExisted (
206 IN EFI_HANDLE RootBridgeHandle
207 );
208
209 /**
210 Judege whether Pci device existed.
211
212 @param Bridge Parent bridege instance.
213 @param PciIoDevice Device instance.
214
215 @return whether Pci device existed.
216 **/
217 BOOLEAN
218 PciDeviceExisted (
219 IN PCI_IO_DEVICE *Bridge,
220 IN PCI_IO_DEVICE *PciIoDevice
221 );
222
223 /**
224 Active VGA device.
225
226 @param VgaDevice device instance for VGA.
227
228 @return device instance.
229 **/
230 PCI_IO_DEVICE *
231 ActiveVGADeviceOnTheSameSegment (
232 IN PCI_IO_DEVICE *VgaDevice
233 );
234
235 /**
236 Active VGA device on root bridge.
237
238 @param RootBridge Root bridge device instance.
239
240 @return VGA device instance.
241 **/
242 PCI_IO_DEVICE *
243 ActiveVGADeviceOnTheRootBridge (
244 IN PCI_IO_DEVICE *RootBridge
245 );
246
247 /**
248 Get HPC PCI address according to its device path.
249 @param PciRootBridgeIo Root bridege Io instance.
250 @param HpcDevicePath Given searching device path.
251 @param PciAddress Buffer holding searched result.
252
253 @retval EFI_NOT_FOUND Can not find the specific device path.
254 @retval EFI_SUCCESS Success to get the device path.
255 **/
256 EFI_STATUS
257 GetHpcPciAddress (
258 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,
259 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,
260 OUT UINT64 *PciAddress
261 );
262
263 /**
264 Get HPC PCI address according to its device path.
265 @param RootBridge Root bridege Io instance.
266 @param RemainingDevicePath Given searching device path.
267 @param PciAddress Buffer holding searched result.
268
269 @retval EFI_NOT_FOUND Can not find the specific device path.
270 **/
271 EFI_STATUS
272 GetHpcPciAddressFromRootBridge (
273 IN PCI_IO_DEVICE *RootBridge,
274 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,
275 OUT UINT64 *PciAddress
276 );
277
278 /**
279 Destroy a pci device node.
280 Also all direct or indirect allocated resource for this node will be freed.
281
282 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
283
284 **/
285 EFI_STATUS
286 FreePciDevice (
287 IN PCI_IO_DEVICE *PciIoDevice
288 );
289
290 #endif