]> git.proxmox.com Git - mirror_edk2.git/blame - 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
CommitLineData
3db51098 1/**@file\r
ead42efc 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
3db51098 12**/\r
ead42efc 13\r
14#ifndef _EFI_PCI_DEVICE_SUPPORT_H\r
15#define _EFI_PCI_DEVICE_SUPPORT_H\r
16\r
a3b8e257 17/**\r
18 Initialize the gPciDevicePool\r
19**/\r
ead42efc 20EFI_STATUS\r
21InitializePciDevicePool (\r
22 VOID\r
ed66e1bc 23 );\r
ead42efc 24\r
a3b8e257 25/**\r
26 Insert a root bridge into PCI device pool\r
ead42efc 27\r
a3b8e257 28 @param RootBridge - A pointer to the PCI_IO_DEVICE.\r
ead42efc 29\r
bcd70414 30**/\r
ead42efc 31EFI_STATUS\r
32InsertRootBridge (\r
33 PCI_IO_DEVICE *RootBridge\r
ed66e1bc 34 );\r
ead42efc 35\r
a3b8e257 36/**\r
37 This function is used to insert a PCI device node under\r
38 a bridge\r
ead42efc 39\r
a3b8e257 40 @param Bridge A pointer to the PCI_IO_DEVICE.\r
41 @param PciDeviceNode A pointer to the PCI_IO_DEVICE.\r
ead42efc 42\r
bcd70414 43**/\r
ead42efc 44EFI_STATUS\r
45InsertPciDevice (\r
46 PCI_IO_DEVICE *Bridge,\r
47 PCI_IO_DEVICE *PciDeviceNode\r
ed66e1bc 48 );\r
ead42efc 49\r
a3b8e257 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
ead42efc 56EFI_STATUS\r
57DestroyRootBridge (\r
58 IN PCI_IO_DEVICE *RootBridge\r
ed66e1bc 59 );\r
ead42efc 60\r
a3b8e257 61/**\r
62 Destroy all the pci device node under the bridge.\r
63 Bridge itself is not included.\r
ead42efc 64\r
a3b8e257 65 @param Bridge A pointer to the PCI_IO_DEVICE.\r
ead42efc 66\r
bcd70414 67**/\r
ead42efc 68EFI_STATUS\r
69DestroyPciDeviceTree (\r
70 IN PCI_IO_DEVICE *Bridge\r
ed66e1bc 71 );\r
ead42efc 72\r
a3b8e257 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
ead42efc 77\r
a3b8e257 78 @param Controller An efi handle.\r
ead42efc 79\r
bcd70414 80**/\r
ead42efc 81EFI_STATUS\r
82DestroyRootBridgeByHandle (\r
83 EFI_HANDLE Controller\r
ed66e1bc 84 );\r
ead42efc 85\r
a3b8e257 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
ead42efc 90\r
a3b8e257 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
ead42efc 94\r
a3b8e257 95 @retval EFI_SUCCESS - The PCI device is successfully registered.\r
96 @retval Others - An error occurred when registering the PCI device.\r
ead42efc 97\r
bcd70414 98**/\r
ead42efc 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
ed66e1bc 104 );\r
ead42efc 105\r
a3b8e257 106/**\r
107 This function is used to remove the whole PCI devices from the bridge.\r
ead42efc 108\r
a3b8e257 109 @param RootBridgeHandle An efi handle.\r
110 @param Bridge A pointer to the PCI_IO_DEVICE.\r
ead42efc 111\r
a3b8e257 112 @retval EFI_SUCCESS\r
bcd70414 113**/\r
ead42efc 114EFI_STATUS\r
115RemoveAllPciDeviceOnBridge (\r
116 EFI_HANDLE RootBridgeHandle,\r
117 PCI_IO_DEVICE *Bridge\r
ed66e1bc 118 );\r
ead42efc 119\r
a3b8e257 120/**\r
ead42efc 121\r
a3b8e257 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
ead42efc 125\r
a3b8e257 126 @param Controller - controller handle\r
127 @param Handle - device handle\r
ead42efc 128\r
a3b8e257 129 @return Status of de-register pci device\r
bcd70414 130**/\r
ead42efc 131EFI_STATUS\r
132DeRegisterPciDevice (\r
133 IN EFI_HANDLE Controller,\r
134 IN EFI_HANDLE Handle\r
ed66e1bc 135 );\r
ead42efc 136\r
a3b8e257 137/**\r
138 Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge\r
ead42efc 139\r
a3b8e257 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
ead42efc 145\r
a3b8e257 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
ead42efc 150\r
bcd70414 151**/\r
ead42efc 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
ed66e1bc 159 );\r
ead42efc 160\r
a3b8e257 161/**\r
162 Start to manage all the PCI devices it found previously under \r
163 the entire host bridge.\r
ead42efc 164\r
a3b8e257 165 @param Controller - root bridge handle.\r
ead42efc 166\r
bcd70414 167**/\r
ead42efc 168EFI_STATUS\r
169StartPciDevices (\r
eb9a9a5e 170 IN EFI_HANDLE Controller\r
ed66e1bc 171 );\r
ead42efc 172\r
a3b8e257 173/**\r
174 Create root bridge device\r
ead42efc 175\r
a3b8e257 176 @param RootBridgeHandle - Parent bridge handle.\r
ead42efc 177\r
a3b8e257 178 @return pointer to new root bridge \r
bcd70414 179**/\r
ead42efc 180PCI_IO_DEVICE *\r
181CreateRootBridge (\r
182 IN EFI_HANDLE RootBridgeHandle\r
ed66e1bc 183 );\r
ead42efc 184\r
a3b8e257 185/**\r
186 Get root bridge device instance by specific handle\r
ead42efc 187\r
a3b8e257 188 @param RootBridgeHandle Given root bridge handle\r
ead42efc 189\r
a3b8e257 190 @return root bridge device instance\r
bcd70414 191**/\r
ead42efc 192PCI_IO_DEVICE *\r
193GetRootBridgeByHandle (\r
194 EFI_HANDLE RootBridgeHandle\r
ed66e1bc 195 );\r
ead42efc 196\r
197BOOLEAN\r
198RootBridgeExisted (\r
199 IN EFI_HANDLE RootBridgeHandle\r
ed66e1bc 200 );\r
ead42efc 201\r
a3b8e257 202/**\r
203 Judege whether Pci device existed\r
204 \r
205 @param Bridge Parent bridege instance \r
206 @param PciIoDevice Device instance\r
207 \r
208 @return whether Pci device existed\r
209**/\r
ead42efc 210BOOLEAN\r
211PciDeviceExisted (\r
212 IN PCI_IO_DEVICE *Bridge,\r
213 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 214 );\r
ead42efc 215\r
a3b8e257 216/**\r
217 Active VGA device\r
218 \r
219 @param VgaDevice device instance for VGA\r
220 \r
221 @return device instance\r
222**/\r
ead42efc 223PCI_IO_DEVICE *\r
224ActiveVGADeviceOnTheSameSegment (\r
225 IN PCI_IO_DEVICE *VgaDevice\r
ed66e1bc 226 );\r
ead42efc 227\r
a3b8e257 228/**\r
229 Active VGA device on root bridge\r
230 \r
231 @param RootBridge Root bridge device instance\r
232 \r
233 @return VGA device instance\r
234**/\r
ead42efc 235PCI_IO_DEVICE *\r
236ActiveVGADeviceOnTheRootBridge (\r
237 IN PCI_IO_DEVICE *RootBridge\r
ed66e1bc 238 );\r
ead42efc 239\r
a3b8e257 240/**\r
241 Get HPC PCI address according to its device path\r
242 @param PciRootBridgeIo Root bridege Io instance\r
243 @param HpcDevicePath Given searching device path\r
244 @param PciAddress Buffer holding searched result\r
245 \r
246 @retval EFI_NOT_FOUND Can not find the specific device path.\r
247 @retval EFI_SUCCESS Success to get the device path\r
248**/\r
ead42efc 249EFI_STATUS\r
250GetHpcPciAddress (\r
251 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r
252 IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r
253 OUT UINT64 *PciAddress\r
ed66e1bc 254 );\r
ead42efc 255\r
a3b8e257 256/**\r
257 Get HPC PCI address according to its device path\r
258 @param RootBridge Root bridege Io instance\r
259 @param RemainingDevicePath Given searching device path\r
260 @param PciAddress Buffer holding searched result\r
261 \r
262 @retval EFI_NOT_FOUND Can not find the specific device path.\r
263**/\r
ead42efc 264EFI_STATUS\r
265GetHpcPciAddressFromRootBridge (\r
266 IN PCI_IO_DEVICE *RootBridge,\r
267 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r
268 OUT UINT64 *PciAddress\r
ed66e1bc 269 );\r
ead42efc 270\r
a3b8e257 271/**\r
272 Destroy a pci device node.\r
273 Also all direct or indirect allocated resource for this node will be freed.\r
ead42efc 274\r
a3b8e257 275 @param PciIoDevice A pointer to the PCI_IO_DEVICE.\r
ead42efc 276\r
bcd70414 277**/\r
ead42efc 278EFI_STATUS\r
279FreePciDevice (\r
280 IN PCI_IO_DEVICE *PciIoDevice\r
ed66e1bc 281 );\r
ead42efc 282\r
283#endif\r