2 Provide common utility functions to PciHostBridgeLib instances in
3 ArmVirtPkg and OvmfPkg.
5 Copyright (C) 2016, Red Hat, Inc.
6 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
7 Copyright (c) 2020, Huawei Corporation. All rights reserved.<BR>
9 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #ifndef __PCI_HOST_BRIDGE_UTILITY_LIB_H__
14 #define __PCI_HOST_BRIDGE_UTILITY_LIB_H__
17 #include <Library/PciHostBridgeLib.h>
21 Utility function to initialize a PCI_ROOT_BRIDGE structure.
23 @param[in] Supports Supported attributes.
25 @param[in] Attributes Initial attributes.
27 @param[in] AllocAttributes Allocation attributes.
29 @param[in] DmaAbove4G DMA above 4GB memory.
31 @param[in] NoExtendedConfigSpace No Extended Config Space.
33 @param[in] RootBusNumber The bus number to store in RootBus.
35 @param[in] MaxSubBusNumber The inclusive maximum bus number that can
36 be assigned to any subordinate bus found
37 behind any PCI bridge hanging off this
40 The caller is repsonsible for ensuring
41 that RootBusNumber <= MaxSubBusNumber. If
42 RootBusNumber equals MaxSubBusNumber, then
43 the root bus has no room for subordinate
46 @param[in] Io IO aperture.
48 @param[in] Mem MMIO aperture.
50 @param[in] MemAbove4G MMIO aperture above 4G.
52 @param[in] PMem Prefetchable MMIO aperture.
54 @param[in] PMemAbove4G Prefetchable MMIO aperture above 4G.
56 @param[out] RootBus The PCI_ROOT_BRIDGE structure (allocated
57 by the caller) that should be filled in by
60 @retval EFI_SUCCESS Initialization successful. A device path
61 consisting of an ACPI device path node,
62 with UID = RootBusNumber, has been
63 allocated and linked into RootBus.
65 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
69 PciHostBridgeUtilityInitRootBridge (
72 IN UINT64 AllocAttributes
,
73 IN BOOLEAN DmaAbove4G
,
74 IN BOOLEAN NoExtendedConfigSpace
,
75 IN UINT8 RootBusNumber
,
76 IN UINT8 MaxSubBusNumber
,
77 IN PCI_ROOT_BRIDGE_APERTURE
*Io
,
78 IN PCI_ROOT_BRIDGE_APERTURE
*Mem
,
79 IN PCI_ROOT_BRIDGE_APERTURE
*MemAbove4G
,
80 IN PCI_ROOT_BRIDGE_APERTURE
*PMem
,
81 IN PCI_ROOT_BRIDGE_APERTURE
*PMemAbove4G
,
82 OUT PCI_ROOT_BRIDGE
*RootBus
87 Utility function to uninitialize a PCI_ROOT_BRIDGE structure set up with
88 PciHostBridgeUtilityInitRootBridge().
90 @param[in] RootBus The PCI_ROOT_BRIDGE structure, allocated by the caller and
91 initialized with PciHostBridgeUtilityInitRootBridge(),
92 that should be uninitialized. This function doesn't free
97 PciHostBridgeUtilityUninitRootBridge (
98 IN PCI_ROOT_BRIDGE
*RootBus
103 Utility function to inform the platform that the resource conflict happens.
105 @param[in] Configuration Pointer to PCI I/O and PCI memory resource
106 descriptors. The Configuration contains the
107 resources for all the root bridges. The resource
108 for each root bridge is terminated with END
109 descriptor and an additional END is appended
110 indicating the end of the entire resources. The
111 resource descriptor field values follow the
113 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
118 PciHostBridgeUtilityResourceConflict (
119 IN VOID
*Configuration
123 #endif // __PCI_HOST_BRIDGE_UTILITY_LIB_H__