2 Supporting functions declaration for PCI devices management.
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _EFI_PCI_DEVICE_SUPPORT_H_
16 #define _EFI_PCI_DEVICE_SUPPORT_H_
19 Initialize the PCI devices pool.
23 InitializePciDevicePool (
28 Insert a root bridge into PCI device pool.
30 @param RootBridge A pointer to the PCI_IO_DEVICE.
35 IN PCI_IO_DEVICE
*RootBridge
39 This function is used to insert a PCI device node under
42 @param Bridge The PCI bridge.
43 @param PciDeviceNode The PCI device needs inserting.
48 IN PCI_IO_DEVICE
*Bridge
,
49 IN PCI_IO_DEVICE
*PciDeviceNode
53 Destroy root bridge and remove it from deivce tree.
55 @param RootBridge The bridge want to be removed.
60 IN PCI_IO_DEVICE
*RootBridge
64 Destroy all the pci device node under the bridge.
65 Bridge itself is not included.
67 @param Bridge A pointer to the PCI_IO_DEVICE.
71 DestroyPciDeviceTree (
72 IN PCI_IO_DEVICE
*Bridge
76 Destroy all device nodes under the root bridge
77 specified by Controller.
79 The root bridge itself is also included.
81 @param Controller Root bridge handle.
83 @retval EFI_SUCCESS Destory all devcie nodes successfully.
84 @retval EFI_NOT_FOUND Cannot find any PCI device under specified
89 DestroyRootBridgeByHandle (
90 IN EFI_HANDLE Controller
94 This function registers the PCI IO device.
96 It creates a handle for this PCI IO device (if the handle does not exist), attaches
97 appropriate protocols onto the handle, does necessary initialization, and sets up
98 parent/child relationship with its bus controller.
100 @param Controller An EFI handle for the PCI bus controller.
101 @param PciIoDevice A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
102 @param Handle A pointer to hold the returned EFI handle for the PCI IO device.
104 @retval EFI_SUCCESS The PCI device is successfully registered.
105 @retval other An error occurred when registering the PCI device.
110 IN EFI_HANDLE Controller
,
111 IN PCI_IO_DEVICE
*PciIoDevice
,
112 OUT EFI_HANDLE
*Handle OPTIONAL
116 This function is used to remove the whole PCI devices on the specified bridge from
119 @param RootBridgeHandle The root bridge device handle.
120 @param Bridge The bridge device to be removed.
124 RemoveAllPciDeviceOnBridge (
125 EFI_HANDLE RootBridgeHandle
,
126 PCI_IO_DEVICE
*Bridge
130 This function is used to de-register the PCI IO device.
132 That includes un-installing PciIo protocol from the specified PCI
135 @param Controller An EFI handle for the PCI bus controller.
136 @param Handle PCI device handle.
138 @retval EFI_SUCCESS The PCI device is successfully de-registered.
139 @retval other An error occurred when de-registering the PCI device.
143 DeRegisterPciDevice (
144 IN EFI_HANDLE Controller
,
149 Start to manage the PCI device on the specified root bridge or PCI-PCI Bridge.
151 @param Controller The root bridge handle.
152 @param RootBridge A pointer to the PCI_IO_DEVICE.
153 @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
154 @param NumberOfChildren Children number.
155 @param ChildHandleBuffer A pointer to the child handle buffer.
157 @retval EFI_NOT_READY Device is not allocated.
158 @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
159 @retval EFI_NOT_FOUND Can not find the specific device.
160 @retval EFI_SUCCESS Success to start Pci devices on bridge.
164 StartPciDevicesOnBridge (
165 IN EFI_HANDLE Controller
,
166 IN PCI_IO_DEVICE
*RootBridge
,
167 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
168 IN OUT UINT8
*NumberOfChildren
,
169 IN OUT EFI_HANDLE
*ChildHandleBuffer
173 Start to manage all the PCI devices it found previously under
174 the entire host bridge.
176 @param Controller The root bridge handle.
178 @retval EFI_NOT_READY Device is not allocated.
179 @retval EFI_SUCCESS Success to start Pci device on host bridge.
184 IN EFI_HANDLE Controller
188 Create root bridge device.
190 @param RootBridgeHandle Specified root bridge hanle.
192 @return The crated root bridge device instance, NULL means no
193 root bridge device instance created.
198 IN EFI_HANDLE RootBridgeHandle
202 Get root bridge device instance by specific root bridge handle.
204 @param RootBridgeHandle Given root bridge handle.
206 @return The root bridge device instance, NULL means no root bridge
207 device instance found.
211 GetRootBridgeByHandle (
212 EFI_HANDLE RootBridgeHandle
217 Judege whether Pci device existed.
219 @param Bridge Parent bridege instance.
220 @param PciIoDevice Device instance.
222 @retval TRUE Pci device existed.
223 @retval FALSE Pci device did not exist.
228 IN PCI_IO_DEVICE
*Bridge
,
229 IN PCI_IO_DEVICE
*PciIoDevice
233 Get the active VGA device on the same segment.
235 @param VgaDevice PCI IO instance for the VGA device.
237 @return The active VGA device on the same segment.
241 ActiveVGADeviceOnTheSameSegment (
242 IN PCI_IO_DEVICE
*VgaDevice
246 Get the active VGA device on the root bridge.
248 @param RootBridge PCI IO instance for the root bridge.
250 @return The active VGA device.
254 ActiveVGADeviceOnTheRootBridge (
255 IN PCI_IO_DEVICE
*RootBridge
259 Get HPC PCI address according to its device path.
261 @param RootBridge Root bridege Io instance.
262 @param RemainingDevicePath Given searching device path.
263 @param PciAddress Buffer holding searched result.
265 @retval EFI_SUCCESS PCI address was stored in PciAddress.
266 @retval EFI_NOT_FOUND Can not find the specific device path.
270 GetHpcPciAddressFromRootBridge (
271 IN PCI_IO_DEVICE
*RootBridge
,
272 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
273 OUT UINT64
*PciAddress
277 Destroy a pci device node.
279 All direct or indirect allocated resource for this node will be freed.
281 @param PciIoDevice A pointer to the PCI_IO_DEVICE to be destoried.
286 IN PCI_IO_DEVICE
*PciIoDevice