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