]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciBusDxe / PciLib.h
CommitLineData
9060e3ec 1/** @file\r
2 Internal library declaration for PCI Bus module.\r
3\r
0785c619 4Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
9060e3ec 6\r
7**/\r
8\r
9#ifndef _EFI_PCI_LIB_H_\r
10#define _EFI_PCI_LIB_H_\r
11\r
9060e3ec 12typedef struct {\r
1436aea4 13 EFI_HANDLE Handle;\r
9060e3ec 14} EFI_DEVICE_HANDLE_EXTENDED_DATA_PAYLOAD;\r
15\r
16typedef struct {\r
1436aea4
MK
17 UINT32 Bar;\r
18 UINT16 DevicePathSize;\r
19 UINT16 ReqResSize;\r
20 UINT16 AllocResSize;\r
21 UINT8 *DevicePath;\r
22 UINT8 *ReqRes;\r
23 UINT8 *AllocRes;\r
9060e3ec 24} EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD;\r
25\r
0785c619
LH
26typedef enum {\r
27 PciResizableBarMin = 0x00,\r
28 PciResizableBarMax = 0xFF\r
29} PCI_RESIZABLE_BAR_OPERATION;\r
9060e3ec 30\r
31/**\r
32 Retrieve the PCI Card device BAR information via PciIo interface.\r
33\r
34 @param PciIoDevice PCI Card device instance.\r
35\r
36**/\r
37VOID\r
38GetBackPcCardBar (\r
1436aea4 39 IN PCI_IO_DEVICE *PciIoDevice\r
9060e3ec 40 );\r
41\r
42/**\r
43 Remove rejected pci device from specific root bridge\r
44 handle.\r
45\r
46 @param RootBridgeHandle Specific parent root bridge handle.\r
47 @param Bridge Bridge device instance.\r
48\r
49**/\r
50VOID\r
51RemoveRejectedPciDevices (\r
1436aea4
MK
52 IN EFI_HANDLE RootBridgeHandle,\r
53 IN PCI_IO_DEVICE *Bridge\r
9060e3ec 54 );\r
55\r
56/**\r
57 Submits the I/O and memory resource requirements for the specified PCI Host Bridge.\r
58\r
59 @param PciResAlloc Point to protocol instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
60\r
61 @retval EFI_SUCCESS Successfully finished resource allocation.\r
62 @retval EFI_NOT_FOUND Cannot get root bridge instance.\r
63 @retval EFI_OUT_OF_RESOURCES Platform failed to program the resources if no hot plug supported.\r
64 @retval other Some error occurred when allocating resources for the PCI Host Bridge.\r
65\r
66 @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.\r
67\r
68**/\r
69EFI_STATUS\r
70PciHostBridgeResourceAllocator (\r
1436aea4 71 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
9060e3ec 72 );\r
73\r
306bbe82 74/**\r
75 Allocate NumberOfBuses buses and return the next available PCI bus number.\r
76\r
77 @param Bridge Bridge device instance.\r
78 @param StartBusNumber Current available PCI bus number.\r
79 @param NumberOfBuses Number of buses enumerated below the StartBusNumber.\r
80 @param NextBusNumber Next available PCI bus number.\r
81\r
82 @retval EFI_SUCCESS Available bus number resource is enough. Next available PCI bus number\r
83 is returned in NextBusNumber.\r
84 @retval EFI_OUT_OF_RESOURCES Available bus number resource is not enough for allocation.\r
85\r
86**/\r
87EFI_STATUS\r
88PciAllocateBusNumber (\r
1436aea4
MK
89 IN PCI_IO_DEVICE *Bridge,\r
90 IN UINT8 StartBusNumber,\r
91 IN UINT8 NumberOfBuses,\r
92 OUT UINT8 *NextBusNumber\r
306bbe82 93 );\r
94\r
9060e3ec 95/**\r
96 Scan pci bus and assign bus number to the given PCI bus system.\r
97\r
98 @param Bridge Bridge device instance.\r
99 @param StartBusNumber start point.\r
100 @param SubBusNumber Point to sub bus number.\r
101 @param PaddedBusRange Customized bus number.\r
102\r
103 @retval EFI_SUCCESS Successfully scanned and assigned bus number.\r
104 @retval other Some error occurred when scanning pci bus.\r
105\r
106 @note Feature flag PcdPciBusHotplugDeviceSupport determine whether need support hotplug.\r
107\r
108**/\r
109EFI_STATUS\r
110PciScanBus (\r
1436aea4
MK
111 IN PCI_IO_DEVICE *Bridge,\r
112 IN UINT8 StartBusNumber,\r
113 OUT UINT8 *SubBusNumber,\r
114 OUT UINT8 *PaddedBusRange\r
9060e3ec 115 );\r
116\r
117/**\r
118 Process Option Rom on the specified root bridge.\r
119\r
120 @param Bridge Pci root bridge device instance.\r
121\r
122 @retval EFI_SUCCESS Success process.\r
123 @retval other Some error occurred when processing Option Rom on the root bridge.\r
124\r
125**/\r
126EFI_STATUS\r
127PciRootBridgeP2CProcess (\r
1436aea4 128 IN PCI_IO_DEVICE *Bridge\r
9060e3ec 129 );\r
130\r
131/**\r
132 Process Option Rom on the specified host bridge.\r
133\r
134 @param PciResAlloc Pointer to instance of EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
135\r
136 @retval EFI_SUCCESS Success process.\r
137 @retval EFI_NOT_FOUND Can not find the root bridge instance.\r
138 @retval other Some error occurred when processing Option Rom on the host bridge.\r
139\r
140**/\r
141EFI_STATUS\r
142PciHostBridgeP2CProcess (\r
1436aea4 143 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
9060e3ec 144 );\r
145\r
146/**\r
147 This function is used to enumerate the entire host bridge\r
148 in a given platform.\r
149\r
150 @param PciResAlloc A pointer to the PCI Host Resource Allocation protocol.\r
151\r
152 @retval EFI_SUCCESS Successfully enumerated the host bridge.\r
153 @retval EFI_OUT_OF_RESOURCES No enough memory available.\r
154 @retval other Some error occurred when enumerating the host bridge.\r
155\r
156**/\r
157EFI_STATUS\r
158PciHostBridgeEnumerator (\r
159 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *PciResAlloc\r
160 );\r
161\r
0785c619
LH
162/**\r
163 This function is used to program the Resizable BAR Register.\r
164\r
165 @param PciIoDevice A pointer to the PCI_IO_DEVICE.\r
166 @param ResizableBarOp PciResizableBarMax: Set BAR to max size\r
167 PciResizableBarMin: set BAR to min size.\r
168\r
169 @retval EFI_SUCCESS Successfully enumerated the host bridge.\r
170 @retval other Some error occurred when enumerating the host bridge.\r
171\r
172**/\r
173EFI_STATUS\r
174PciProgramResizableBar (\r
175 IN PCI_IO_DEVICE *PciIoDevice,\r
176 IN PCI_RESIZABLE_BAR_OPERATION ResizableBarOp\r
177 );\r
1436aea4 178\r
9060e3ec 179#endif\r