2 Supporting functions declaration for PCI devices management.
4 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _EFI_PCI_DEVICE_SUPPORT_H_
10 #define _EFI_PCI_DEVICE_SUPPORT_H_
13 Initialize the PCI devices pool.
17 InitializePciDevicePool (
22 Insert a root bridge into PCI device pool.
24 @param RootBridge A pointer to the PCI_IO_DEVICE.
29 IN PCI_IO_DEVICE
*RootBridge
33 This function is used to insert a PCI device node under
36 @param Bridge The PCI bridge.
37 @param PciDeviceNode The PCI device needs inserting.
42 IN PCI_IO_DEVICE
*Bridge
,
43 IN PCI_IO_DEVICE
*PciDeviceNode
47 Destroy root bridge and remove it from device tree.
49 @param RootBridge The bridge want to be removed.
54 IN PCI_IO_DEVICE
*RootBridge
58 Destroy all the pci device node under the bridge.
59 Bridge itself is not included.
61 @param Bridge A pointer to the PCI_IO_DEVICE.
65 DestroyPciDeviceTree (
66 IN PCI_IO_DEVICE
*Bridge
70 Destroy all device nodes under the root bridge
71 specified by Controller.
73 The root bridge itself is also included.
75 @param Controller Root bridge handle.
77 @retval EFI_SUCCESS Destroy all device nodes successfully.
78 @retval EFI_NOT_FOUND Cannot find any PCI device under specified
83 DestroyRootBridgeByHandle (
84 IN EFI_HANDLE Controller
88 This function registers the PCI IO device.
90 It creates a handle for this PCI IO device (if the handle does not exist), attaches
91 appropriate protocols onto the handle, does necessary initialization, and sets up
92 parent/child relationship with its bus controller.
94 @param Controller An EFI handle for the PCI bus controller.
95 @param PciIoDevice A PCI_IO_DEVICE pointer to the PCI IO device to be registered.
96 @param Handle A pointer to hold the returned EFI handle for the PCI IO device.
98 @retval EFI_SUCCESS The PCI device is successfully registered.
99 @retval other An error occurred when registering the PCI device.
104 IN EFI_HANDLE Controller
,
105 IN PCI_IO_DEVICE
*PciIoDevice
,
106 OUT EFI_HANDLE
*Handle OPTIONAL
110 This function is used to remove the whole PCI devices on the specified bridge from
113 @param RootBridgeHandle The root bridge device handle.
114 @param Bridge The bridge device to be removed.
118 RemoveAllPciDeviceOnBridge (
119 EFI_HANDLE RootBridgeHandle
,
120 PCI_IO_DEVICE
*Bridge
124 This function is used to de-register the PCI IO device.
126 That includes un-installing PciIo protocol from the specified PCI
129 @param Controller An EFI handle for the PCI bus controller.
130 @param Handle PCI device handle.
132 @retval EFI_SUCCESS The PCI device is successfully de-registered.
133 @retval other An error occurred when de-registering the PCI device.
137 DeRegisterPciDevice (
138 IN EFI_HANDLE Controller
,
143 Start to manage the PCI device on the specified root bridge or PCI-PCI Bridge.
145 @param Controller The root bridge handle.
146 @param RootBridge A pointer to the PCI_IO_DEVICE.
147 @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.
148 @param NumberOfChildren Children number.
149 @param ChildHandleBuffer A pointer to the child handle buffer.
151 @retval EFI_NOT_READY Device is not allocated.
152 @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.
153 @retval EFI_NOT_FOUND Can not find the specific device.
154 @retval EFI_SUCCESS Success to start Pci devices on bridge.
158 StartPciDevicesOnBridge (
159 IN EFI_HANDLE Controller
,
160 IN PCI_IO_DEVICE
*RootBridge
,
161 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
,
162 IN OUT UINT8
*NumberOfChildren
,
163 IN OUT EFI_HANDLE
*ChildHandleBuffer
167 Start to manage all the PCI devices it found previously under
168 the entire host bridge.
170 @param Controller The root bridge handle.
172 @retval EFI_NOT_READY Device is not allocated.
173 @retval EFI_SUCCESS Success to start Pci device on host bridge.
178 IN EFI_HANDLE Controller
182 Create root bridge device.
184 @param RootBridgeHandle Specified root bridge handle.
186 @return The crated root bridge device instance, NULL means no
187 root bridge device instance created.
192 IN EFI_HANDLE RootBridgeHandle
196 Get root bridge device instance by specific root bridge handle.
198 @param RootBridgeHandle Given root bridge handle.
200 @return The root bridge device instance, NULL means no root bridge
201 device instance found.
205 GetRootBridgeByHandle (
206 EFI_HANDLE RootBridgeHandle
211 Judge whether Pci device existed.
213 @param Bridge Parent bridge instance.
214 @param PciIoDevice Device instance.
216 @retval TRUE Pci device existed.
217 @retval FALSE Pci device did not exist.
222 IN PCI_IO_DEVICE
*Bridge
,
223 IN PCI_IO_DEVICE
*PciIoDevice
227 Get the active VGA device on the specified Host Bridge.
229 @param HostBridgeHandle Host Bridge handle.
231 @return The active VGA device on the specified Host Bridge.
235 LocateVgaDeviceOnHostBridge (
236 IN EFI_HANDLE HostBridgeHandle
240 Locate the active VGA device under the bridge.
242 @param Bridge PCI IO instance for the bridge.
244 @return The active VGA device.
249 IN PCI_IO_DEVICE
*Bridge
254 Destroy a pci device node.
256 All direct or indirect allocated resource for this node will be freed.
258 @param PciIoDevice A pointer to the PCI_IO_DEVICE to be destroyed.
263 IN PCI_IO_DEVICE
*PciIoDevice