]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Include/Library/PciHostBridgeUtilityLib.h
OvmfPkg/PciHostBridgeLib: Extract InitRootBridge() / UninitRootBridge()
[mirror_edk2.git] / OvmfPkg / Include / Library / PciHostBridgeUtilityLib.h
CommitLineData
7a6172f8
JC
1/** @file\r
2 Provide common utility functions to PciHostBridgeLib instances in\r
3 ArmVirtPkg and OvmfPkg.\r
4\r
5 Copyright (C) 2016, Red Hat, Inc.\r
6 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
7 Copyright (c) 2020, Huawei Corporation. All rights reserved.<BR>\r
8\r
9 SPDX-License-Identifier: BSD-2-Clause-Patent\r
10\r
11**/\r
12\r
13#ifndef __PCI_HOST_BRIDGE_UTILITY_LIB_H__\r
14#define __PCI_HOST_BRIDGE_UTILITY_LIB_H__\r
15\r
16\r
7ac1f28d
JC
17#include <Library/PciHostBridgeLib.h>\r
18\r
19\r
20/**\r
21 Utility function to initialize a PCI_ROOT_BRIDGE structure.\r
22\r
23 @param[in] Supports Supported attributes.\r
24\r
25 @param[in] Attributes Initial attributes.\r
26\r
27 @param[in] AllocAttributes Allocation attributes.\r
28\r
29 @param[in] RootBusNumber The bus number to store in RootBus.\r
30\r
31 @param[in] MaxSubBusNumber The inclusive maximum bus number that can be\r
32 assigned to any subordinate bus found behind any\r
33 PCI bridge hanging off this root bus.\r
34\r
35 The caller is repsonsible for ensuring that\r
36 RootBusNumber <= MaxSubBusNumber. If\r
37 RootBusNumber equals MaxSubBusNumber, then the\r
38 root bus has no room for subordinate buses.\r
39\r
40 @param[in] Io IO aperture.\r
41\r
42 @param[in] Mem MMIO aperture.\r
43\r
44 @param[in] MemAbove4G MMIO aperture above 4G.\r
45\r
46 @param[in] PMem Prefetchable MMIO aperture.\r
47\r
48 @param[in] PMemAbove4G Prefetchable MMIO aperture above 4G.\r
49\r
50 @param[out] RootBus The PCI_ROOT_BRIDGE structure (allocated by the\r
51 caller) that should be filled in by this\r
52 function.\r
53\r
54 @retval EFI_SUCCESS Initialization successful. A device path\r
55 consisting of an ACPI device path node, with\r
56 UID = RootBusNumber, has been allocated and\r
57 linked into RootBus.\r
58\r
59 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
60**/\r
61EFI_STATUS\r
62EFIAPI\r
63PciHostBridgeUtilityInitRootBridge (\r
64 IN UINT64 Supports,\r
65 IN UINT64 Attributes,\r
66 IN UINT64 AllocAttributes,\r
67 IN UINT8 RootBusNumber,\r
68 IN UINT8 MaxSubBusNumber,\r
69 IN PCI_ROOT_BRIDGE_APERTURE *Io,\r
70 IN PCI_ROOT_BRIDGE_APERTURE *Mem,\r
71 IN PCI_ROOT_BRIDGE_APERTURE *MemAbove4G,\r
72 IN PCI_ROOT_BRIDGE_APERTURE *PMem,\r
73 IN PCI_ROOT_BRIDGE_APERTURE *PMemAbove4G,\r
74 OUT PCI_ROOT_BRIDGE *RootBus\r
75 );\r
76\r
77\r
78/**\r
79 Utility function to uninitialize a PCI_ROOT_BRIDGE structure set up with\r
80 PciHostBridgeUtilityInitRootBridge().\r
81\r
82 @param[in] RootBus The PCI_ROOT_BRIDGE structure, allocated by the caller and\r
83 initialized with PciHostBridgeUtilityInitRootBridge(),\r
84 that should be uninitialized. This function doesn't free\r
85 RootBus.\r
86**/\r
87VOID\r
88EFIAPI\r
89PciHostBridgeUtilityUninitRootBridge (\r
90 IN PCI_ROOT_BRIDGE *RootBus\r
91 );\r
92\r
93\r
7a6172f8
JC
94/**\r
95 Utility function to inform the platform that the resource conflict happens.\r
96\r
97 @param[in] Configuration Pointer to PCI I/O and PCI memory resource\r
98 descriptors. The Configuration contains the\r
99 resources for all the root bridges. The resource\r
100 for each root bridge is terminated with END\r
101 descriptor and an additional END is appended\r
102 indicating the end of the entire resources. The\r
103 resource descriptor field values follow the\r
104 description in\r
105 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL\r
106 .SubmitResources().\r
107**/\r
108VOID\r
109EFIAPI\r
110PciHostBridgeUtilityResourceConflict (\r
111 IN VOID *Configuration\r
112 );\r
113\r
114\r
115#endif // __PCI_HOST_BRIDGE_UTILITY_LIB_H__\r