]>
Commit | Line | Data |
---|---|---|
97404058 | 1 | /** @file\r |
ead42efc | 2 | \r |
3 | Copyright (c) 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
3db51098 | 12 | **/\r |
ead42efc | 13 | \r |
eeefcb9d | 14 | #ifndef _EFI_PCI_DEVICE_SUPPORT_H_\r |
15 | #define _EFI_PCI_DEVICE_SUPPORT_H_\r | |
ead42efc | 16 | \r |
a3b8e257 | 17 | /**\r |
97404058 | 18 | Initialize the gPciDevicePool.\r |
a3b8e257 | 19 | **/\r |
ead42efc | 20 | EFI_STATUS\r |
21 | InitializePciDevicePool (\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 | 31 | EFI_STATUS\r |
32 | InsertRootBridge (\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 | 44 | EFI_STATUS\r |
45 | InsertPciDevice (\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 | 56 | EFI_STATUS\r |
57 | DestroyRootBridge (\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 | 68 | EFI_STATUS\r |
69 | DestroyPciDeviceTree (\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 | 81 | EFI_STATUS\r |
82 | DestroyRootBridgeByHandle (\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 | 99 | EFI_STATUS\r |
100 | RegisterPciDevice (\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 | 114 | EFI_STATUS\r |
115 | RemoveAllPciDeviceOnBridge (\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 | 131 | EFI_STATUS\r |
132 | DeRegisterPciDevice (\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 | 152 | EFI_STATUS\r |
153 | StartPciDevicesOnBridge (\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 | 168 | EFI_STATUS\r |
169 | StartPciDevices (\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 | 180 | PCI_IO_DEVICE *\r |
181 | CreateRootBridge (\r | |
182 | IN EFI_HANDLE RootBridgeHandle\r | |
ed66e1bc | 183 | );\r |
ead42efc | 184 | \r |
a3b8e257 | 185 | /**\r |
97404058 | 186 | Get root bridge device instance by specific handle.\r |
ead42efc | 187 | \r |
97404058 | 188 | @param RootBridgeHandle Given root bridge handle.\r |
ead42efc | 189 | \r |
97404058 | 190 | @return root bridge device instance.\r |
bcd70414 | 191 | **/\r |
ead42efc | 192 | PCI_IO_DEVICE *\r |
193 | GetRootBridgeByHandle (\r | |
194 | EFI_HANDLE RootBridgeHandle\r | |
ed66e1bc | 195 | );\r |
ead42efc | 196 | \r |
eeefcb9d | 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 | |
ead42efc | 204 | BOOLEAN\r |
205 | RootBridgeExisted (\r | |
206 | IN EFI_HANDLE RootBridgeHandle\r | |
ed66e1bc | 207 | );\r |
ead42efc | 208 | \r |
a3b8e257 | 209 | /**\r |
97404058 | 210 | Judege whether Pci device existed.\r |
a3b8e257 | 211 | \r |
97404058 | 212 | @param Bridge Parent bridege instance. \r |
213 | @param PciIoDevice Device instance.\r | |
a3b8e257 | 214 | \r |
97404058 | 215 | @return whether Pci device existed.\r |
a3b8e257 | 216 | **/\r |
ead42efc | 217 | BOOLEAN\r |
218 | PciDeviceExisted (\r | |
219 | IN PCI_IO_DEVICE *Bridge,\r | |
220 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 221 | );\r |
ead42efc | 222 | \r |
a3b8e257 | 223 | /**\r |
97404058 | 224 | Active VGA device.\r |
a3b8e257 | 225 | \r |
97404058 | 226 | @param VgaDevice device instance for VGA.\r |
a3b8e257 | 227 | \r |
97404058 | 228 | @return device instance.\r |
a3b8e257 | 229 | **/\r |
ead42efc | 230 | PCI_IO_DEVICE *\r |
231 | ActiveVGADeviceOnTheSameSegment (\r | |
232 | IN PCI_IO_DEVICE *VgaDevice\r | |
ed66e1bc | 233 | );\r |
ead42efc | 234 | \r |
a3b8e257 | 235 | /**\r |
97404058 | 236 | Active VGA device on root bridge.\r |
a3b8e257 | 237 | \r |
97404058 | 238 | @param RootBridge Root bridge device instance.\r |
a3b8e257 | 239 | \r |
97404058 | 240 | @return VGA device instance.\r |
a3b8e257 | 241 | **/\r |
ead42efc | 242 | PCI_IO_DEVICE *\r |
243 | ActiveVGADeviceOnTheRootBridge (\r | |
244 | IN PCI_IO_DEVICE *RootBridge\r | |
ed66e1bc | 245 | );\r |
ead42efc | 246 | \r |
a3b8e257 | 247 | /**\r |
97404058 | 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 | |
a3b8e257 | 252 | \r |
253 | @retval EFI_NOT_FOUND Can not find the specific device path.\r | |
97404058 | 254 | @retval EFI_SUCCESS Success to get the device path.\r |
a3b8e257 | 255 | **/\r |
ead42efc | 256 | EFI_STATUS\r |
257 | GetHpcPciAddress (\r | |
258 | IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo,\r | |
259 | IN EFI_DEVICE_PATH_PROTOCOL *HpcDevicePath,\r | |
260 | OUT UINT64 *PciAddress\r | |
ed66e1bc | 261 | );\r |
ead42efc | 262 | \r |
a3b8e257 | 263 | /**\r |
97404058 | 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 | |
a3b8e257 | 268 | \r |
269 | @retval EFI_NOT_FOUND Can not find the specific device path.\r | |
270 | **/\r | |
ead42efc | 271 | EFI_STATUS\r |
272 | GetHpcPciAddressFromRootBridge (\r | |
273 | IN PCI_IO_DEVICE *RootBridge,\r | |
274 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath,\r | |
275 | OUT UINT64 *PciAddress\r | |
ed66e1bc | 276 | );\r |
ead42efc | 277 | \r |
a3b8e257 | 278 | /**\r |
279 | Destroy a pci device node.\r | |
280 | Also all direct or indirect allocated resource for this node will be freed.\r | |
ead42efc | 281 | \r |
a3b8e257 | 282 | @param PciIoDevice A pointer to the PCI_IO_DEVICE.\r |
ead42efc | 283 | \r |
bcd70414 | 284 | **/\r |
ead42efc | 285 | EFI_STATUS\r |
286 | FreePciDevice (\r | |
287 | IN PCI_IO_DEVICE *PciIoDevice\r | |
ed66e1bc | 288 | );\r |
ead42efc | 289 | \r |
290 | #endif\r |