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 (
26 Insert a root bridge into PCI device pool
28 @param RootBridge - A pointer to the PCI_IO_DEVICE.
33 PCI_IO_DEVICE
*RootBridge
37 This function is used to insert a PCI device node under
40 @param Bridge A pointer to the PCI_IO_DEVICE.
41 @param PciDeviceNode A pointer to the PCI_IO_DEVICE.
46 PCI_IO_DEVICE
*Bridge
,
47 PCI_IO_DEVICE
*PciDeviceNode
51 Destroy root bridge and remove it from deivce tree.
53 @param RootBridge The bridge want to be removed
58 IN PCI_IO_DEVICE
*RootBridge
62 Destroy all the pci device node under the bridge.
63 Bridge itself is not included.
65 @param Bridge A pointer to the PCI_IO_DEVICE.
69 DestroyPciDeviceTree (
70 IN PCI_IO_DEVICE
*Bridge
74 Destroy all device nodes under the root bridge
75 specified by Controller.
76 The root bridge itself is also included.
78 @param Controller An efi handle.
82 DestroyRootBridgeByHandle (
87 This function registers the PCI IO device. It creates a handle for this PCI IO device
88 (if the handle does not exist), attaches appropriate protocols onto the handle, does
89 necessary initialization, and sets up parent/child relationship with its bus controller.
91 @param Controller - An EFI handle for the PCI bus controller.
92 @param PciIoDevice - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
93 @param Handle - A pointer to hold the EFI handle for the PCI IO device.
95 @retval EFI_SUCCESS - The PCI device is successfully registered.
96 @retval Others - An error occurred when registering the PCI device.
101 IN EFI_HANDLE Controller
,
102 IN PCI_IO_DEVICE
*PciIoDevice
,
103 OUT EFI_HANDLE
*Handle OPTIONAL
107 This function is used to remove the whole PCI devices from the bridge.
109 @param RootBridgeHandle An efi handle.
110 @param Bridge A pointer to the PCI_IO_DEVICE.
115 RemoveAllPciDeviceOnBridge (
116 EFI_HANDLE RootBridgeHandle
,
117 PCI_IO_DEVICE
*Bridge
122 This function is used to de-register the PCI device from the EFI,
123 That includes un-installing PciIo protocol from the specified PCI
126 @param Controller - controller handle
127 @param Handle - device handle
129 @return Status of de-register pci device
132 DeRegisterPciDevice (
133 IN EFI_HANDLE Controller
,
138 Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge
140 @param Controller An efi handle.
141 @param RootBridge A pointer to the PCI_IO_DEVICE.
142 @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
143 @param NumberOfChildren Children number.
144 @param ChildHandleBuffer A pointer to the child handle buffer.
146 @retval EFI_NOT_READY Device is not allocated
147 @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
148 @retval EFI_NOT_FOUND Can not find the specific device
149 @retval EFI_SUCCESS Success to start Pci device on bridge
153 StartPciDevicesOnBridge (
154 IN EFI_HANDLE Controller
,
155 IN PCI_IO_DEVICE
*RootBridge
,
156 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
157 IN OUT UINT8
*NumberOfChildren
,
158 IN OUT EFI_HANDLE
*ChildHandleBuffer
162 Start to manage all the PCI devices it found previously under
163 the entire host bridge.
165 @param Controller - root bridge handle.
170 IN EFI_HANDLE Controller
174 Create root bridge device
176 @param RootBridgeHandle - Parent bridge handle.
178 @return pointer to new root bridge
182 IN EFI_HANDLE RootBridgeHandle
186 Get root bridge device instance by specific handle.
188 @param RootBridgeHandle Given root bridge handle.
190 @return root bridge device instance.
193 GetRootBridgeByHandle (
194 EFI_HANDLE RootBridgeHandle
199 IN EFI_HANDLE RootBridgeHandle
203 Judege whether Pci device existed.
205 @param Bridge Parent bridege instance.
206 @param PciIoDevice Device instance.
208 @return whether Pci device existed.
212 IN PCI_IO_DEVICE
*Bridge
,
213 IN PCI_IO_DEVICE
*PciIoDevice
219 @param VgaDevice device instance for VGA.
221 @return device instance.
224 ActiveVGADeviceOnTheSameSegment (
225 IN PCI_IO_DEVICE
*VgaDevice
229 Active VGA device on root bridge.
231 @param RootBridge Root bridge device instance.
233 @return VGA device instance.
236 ActiveVGADeviceOnTheRootBridge (
237 IN PCI_IO_DEVICE
*RootBridge
241 Get HPC PCI address according to its device path.
242 @param PciRootBridgeIo Root bridege Io instance.
243 @param HpcDevicePath Given searching device path.
244 @param PciAddress Buffer holding searched result.
246 @retval EFI_NOT_FOUND Can not find the specific device path.
247 @retval EFI_SUCCESS Success to get the device path.
251 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
*PciRootBridgeIo
,
252 IN EFI_DEVICE_PATH_PROTOCOL
*HpcDevicePath
,
253 OUT UINT64
*PciAddress
257 Get HPC PCI address according to its device path.
258 @param RootBridge Root bridege Io instance.
259 @param RemainingDevicePath Given searching device path.
260 @param PciAddress Buffer holding searched result.
262 @retval EFI_NOT_FOUND Can not find the specific device path.
265 GetHpcPciAddressFromRootBridge (
266 IN PCI_IO_DEVICE
*RootBridge
,
267 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
268 OUT UINT64
*PciAddress
272 Destroy a pci device node.
273 Also all direct or indirect allocated resource for this node will be freed.
275 @param PciIoDevice A pointer to the PCI_IO_DEVICE.
280 IN PCI_IO_DEVICE
*PciIoDevice