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
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.
14 #ifndef _EFI_PCI_DEVICE_SUPPORT_H
15 #define _EFI_PCI_DEVICE_SUPPORT_H
18 Initialize the gPciDevicePool
21 InitializePciDevicePool (
27 Insert a root bridge into PCI device pool
29 @param RootBridge - A pointer to the PCI_IO_DEVICE.
34 PCI_IO_DEVICE
*RootBridge
39 This function is used to insert a PCI device node under
42 @param Bridge A pointer to the PCI_IO_DEVICE.
43 @param PciDeviceNode A pointer to the PCI_IO_DEVICE.
48 PCI_IO_DEVICE
*Bridge
,
49 PCI_IO_DEVICE
*PciDeviceNode
54 Destroy root bridge and remove it from deivce tree.
56 @param RootBridge The bridge want to be removed
61 IN PCI_IO_DEVICE
*RootBridge
66 Destroy all the pci device node under the bridge.
67 Bridge itself is not included.
69 @param Bridge A pointer to the PCI_IO_DEVICE.
73 DestroyPciDeviceTree (
74 IN PCI_IO_DEVICE
*Bridge
79 Destroy all device nodes under the root bridge
80 specified by Controller.
81 The root bridge itself is also included.
83 @param Controller An efi handle.
87 DestroyRootBridgeByHandle (
93 This function registers the PCI IO device. It creates a handle for this PCI IO device
94 (if the handle does not exist), attaches appropriate protocols onto the handle, does
95 necessary initialization, and sets up parent/child relationship with its bus controller.
97 @param Controller - An EFI handle for the PCI bus controller.
98 @param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
99 @param Handle - A pointer to hold the EFI handle for the PCI IO device.
101 @retval EFI_SUCCESS - The PCI device is successfully registered.
102 @retval Others - An error occurred when registering the PCI device.
107 IN EFI_HANDLE Controller
,
108 IN PCI_IO_DEVICE
*PciIoDevice
,
109 OUT EFI_HANDLE
*Handle OPTIONAL
114 This function is used to remove the whole PCI devices from the bridge.
116 @param RootBridgeHandle An efi handle.
117 @param Bridge A pointer to the PCI_IO_DEVICE.
122 RemoveAllPciDeviceOnBridge (
123 EFI_HANDLE RootBridgeHandle
,
124 PCI_IO_DEVICE
*Bridge
130 This function is used to de-register the PCI device from the EFI,
131 That includes un-installing PciIo protocol from the specified PCI
134 @param Controller - controller handle
135 @param Handle - device handle
137 @return Status of de-register pci device
140 DeRegisterPciDevice (
141 IN EFI_HANDLE Controller
,
147 Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
149 @param Controller An efi handle.
150 @param RootBridge A pointer to the PCI_IO_DEVICE.
151 @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
152 @param NumberOfChildren Children number.
153 @param ChildHandleBuffer A pointer to the child handle buffer.
155 @retval EFI_NOT_READY Device is not allocated
156 @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
157 @retval EFI_NOT_FOUND Can not find the specific device
158 @retval EFI_SUCCESS Success to start Pci device on bridge
162 StartPciDevicesOnBridge (
163 IN EFI_HANDLE Controller
,
164 IN PCI_IO_DEVICE
*RootBridge
,
165 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
166 IN OUT UINT8
*NumberOfChildren
,
167 IN OUT EFI_HANDLE
*ChildHandleBuffer
172 Start to manage all the PCI devices it found previously under
173 the entire host bridge.
175 @param Controller - root bridge handle.
180 IN EFI_HANDLE Controller
185 Create root bridge device
187 @param RootBridgeHandle - Parent bridge handle.
189 @return pointer to new root bridge
193 IN EFI_HANDLE RootBridgeHandle
198 Get root bridge device instance by specific handle
200 @param RootBridgeHandle Given root bridge handle
202 @return root bridge device instance
205 GetRootBridgeByHandle (
206 EFI_HANDLE RootBridgeHandle
212 IN EFI_HANDLE RootBridgeHandle
217 Judege whether Pci device existed
219 @param Bridge Parent bridege instance
220 @param PciIoDevice Device instance
222 @return whether Pci device existed
226 IN PCI_IO_DEVICE
*Bridge
,
227 IN PCI_IO_DEVICE
*PciIoDevice
234 @param VgaDevice device instance for VGA
236 @return device instance
239 ActiveVGADeviceOnTheSameSegment (
240 IN PCI_IO_DEVICE
*VgaDevice
245 Active VGA device on root bridge
247 @param RootBridge Root bridge device instance
249 @return VGA device instance
252 ActiveVGADeviceOnTheRootBridge (
253 IN PCI_IO_DEVICE
*RootBridge
258 Get HPC PCI address according to its device path
259 @param PciRootBridgeIo Root bridege Io instance
260 @param HpcDevicePath Given searching device path
261 @param PciAddress Buffer holding searched result
263 @retval EFI_NOT_FOUND Can not find the specific device path.
264 @retval EFI_SUCCESS Success to get the device path
268 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
269 IN EFI_DEVICE_PATH_PROTOCOL
*HpcDevicePath
,
270 OUT UINT64
*PciAddress
275 Get HPC PCI address according to its device path
276 @param RootBridge Root bridege Io instance
277 @param RemainingDevicePath Given searching device path
278 @param PciAddress Buffer holding searched result
280 @retval EFI_NOT_FOUND Can not find the specific device path.
283 GetHpcPciAddressFromRootBridge (
284 IN PCI_IO_DEVICE
*RootBridge
,
285 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
286 OUT UINT64
*PciAddress
291 Destroy a pci device node.
292 Also all direct or indirect allocated resource for this node will be freed.
294 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
299 IN PCI_IO_DEVICE
*PciIoDevice