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