]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridge.h
MdeModulePkg/PciHostBridge: Add IOMMU support.
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / PciHostBridgeDxe / PciHostBridge.h
... / ...
CommitLineData
1/** @file\r
2\r
3 The Header file of the Pci Host Bridge Driver.\r
4\r
5Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _PCI_HOST_BRIDGE_H_\r
17#define _PCI_HOST_BRIDGE_H_\r
18\r
19\r
20#include <PiDxe.h>\r
21#include <IndustryStandard/Acpi.h>\r
22#include <Library/UefiDriverEntryPoint.h>\r
23#include <Library/MemoryAllocationLib.h>\r
24#include <Library/PciHostBridgeLib.h>\r
25#include <Protocol/PciHostBridgeResourceAllocation.h>\r
26\r
27#include "PciRootBridge.h"\r
28\r
29#define PCI_HOST_BRIDGE_SIGNATURE SIGNATURE_32 ('p', 'h', 'b', 'g')\r
30typedef struct {\r
31 UINTN Signature;\r
32 EFI_HANDLE Handle;\r
33 LIST_ENTRY RootBridges;\r
34 BOOLEAN CanRestarted;\r
35 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL ResAlloc;\r
36} PCI_HOST_BRIDGE_INSTANCE;\r
37\r
38#define PCI_HOST_BRIDGE_FROM_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)\r
39\r
40//\r
41// Driver Entry Point\r
42//\r
43/**\r
44\r
45 Entry point of this driver.\r
46\r
47 @param ImageHandle - Image handle of this driver.\r
48 @param SystemTable - Pointer to standard EFI system table.\r
49\r
50 @retval EFI_SUCCESS - Succeed.\r
51 @retval EFI_DEVICE_ERROR - Fail to install PCI_ROOT_BRIDGE_IO protocol.\r
52\r
53**/\r
54EFI_STATUS\r
55EFIAPI\r
56InitializePciHostBridge (\r
57 IN EFI_HANDLE ImageHandle,\r
58 IN EFI_SYSTEM_TABLE *SystemTable\r
59 );\r
60\r
61//\r
62// HostBridge Resource Allocation interface\r
63//\r
64/**\r
65\r
66 Enter a certain phase of the PCI enumeration process.\r
67\r
68 @param This The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.\r
69 @param Phase The phase during enumeration.\r
70\r
71 @retval EFI_SUCCESS Succeed.\r
72 @retval EFI_INVALID_PARAMETER Wrong phase parameter passed in.\r
73 @retval EFI_NOT_READY Resources have not been submitted yet.\r
74\r
75**/\r
76EFI_STATUS\r
77EFIAPI\r
78NotifyPhase (\r
79 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
80 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase\r
81 );\r
82\r
83/**\r
84\r
85 Return the device handle of the next PCI root bridge that is associated with\r
86 this Host Bridge.\r
87\r
88 @param This The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
89 @param RootBridgeHandle Returns the device handle of the next PCI Root Bridge.\r
90 On input, it holds the RootBridgeHandle returned by the most\r
91 recent call to GetNextRootBridge().The handle for the first\r
92 PCI Root Bridge is returned if RootBridgeHandle is NULL on input.\r
93\r
94 @retval EFI_SUCCESS Succeed.\r
95 @retval EFI_NOT_FOUND Next PCI root bridge not found.\r
96 @retval EFI_INVALID_PARAMETER Wrong parameter passed in.\r
97\r
98**/\r
99EFI_STATUS\r
100EFIAPI\r
101GetNextRootBridge (\r
102 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
103 IN OUT EFI_HANDLE *RootBridgeHandle\r
104 );\r
105\r
106/**\r
107\r
108 Returns the attributes of a PCI Root Bridge.\r
109\r
110 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance\r
111 @param RootBridgeHandle - The device handle of the PCI Root Bridge\r
112 that the caller is interested in\r
113 @param Attributes - The pointer to attributes of the PCI Root Bridge\r
114\r
115 @retval EFI_SUCCESS - Succeed.\r
116 @retval EFI_INVALID_PARAMETER - Attributes parameter passed in is NULL or\r
117 @retval RootBridgeHandle is not an EFI_HANDLE\r
118 @retval that was returned on a previous call to\r
119 @retval GetNextRootBridge().\r
120\r
121**/\r
122EFI_STATUS\r
123EFIAPI\r
124GetAttributes (\r
125 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
126 IN EFI_HANDLE RootBridgeHandle,\r
127 OUT UINT64 *Attributes\r
128 );\r
129\r
130/**\r
131\r
132 This is the request from the PCI enumerator to set up\r
133 the specified PCI Root Bridge for bus enumeration process.\r
134\r
135 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
136 @param RootBridgeHandle - The PCI Root Bridge to be set up.\r
137 @param Configuration - Pointer to the pointer to the PCI bus resource descriptor.\r
138\r
139 @retval EFI_SUCCESS - Succeed.\r
140 @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.\r
141 @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.\r
142\r
143**/\r
144EFI_STATUS\r
145EFIAPI\r
146StartBusEnumeration (\r
147 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
148 IN EFI_HANDLE RootBridgeHandle,\r
149 OUT VOID **Configuration\r
150 );\r
151\r
152/**\r
153\r
154 This function programs the PCI Root Bridge hardware so that\r
155 it decodes the specified PCI bus range.\r
156\r
157 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
158 @param RootBridgeHandle - The PCI Root Bridge whose bus range is to be programmed.\r
159 @param Configuration - The pointer to the PCI bus resource descriptor.\r
160\r
161 @retval EFI_SUCCESS - Succeed.\r
162 @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.\r
163\r
164**/\r
165EFI_STATUS\r
166EFIAPI\r
167SetBusNumbers (\r
168 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
169 IN EFI_HANDLE RootBridgeHandle,\r
170 IN VOID *Configuration\r
171 );\r
172\r
173/**\r
174\r
175 Submits the I/O and memory resource requirements for the specified PCI Root Bridge.\r
176\r
177 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance\r
178 @param RootBridgeHandle - The PCI Root Bridge whose I/O and memory resource requirements\r
179 are being submitted\r
180 @param Configuration - The pointer to the PCI I/O and PCI memory resource descriptor\r
181\r
182 @retval EFI_SUCCESS - Succeed.\r
183 @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.\r
184\r
185**/\r
186EFI_STATUS\r
187EFIAPI\r
188SubmitResources (\r
189 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
190 IN EFI_HANDLE RootBridgeHandle,\r
191 IN VOID *Configuration\r
192 );\r
193\r
194/**\r
195\r
196 This function returns the proposed resource settings for the specified\r
197 PCI Root Bridge.\r
198\r
199 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
200 @param RootBridgeHandle - The PCI Root Bridge handle.\r
201 @param Configuration - The pointer to the pointer to the PCI I/O\r
202 and memory resource descriptor.\r
203\r
204 @retval EFI_SUCCESS - Succeed.\r
205 @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.\r
206 @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.\r
207\r
208**/\r
209EFI_STATUS\r
210EFIAPI\r
211GetProposedResources (\r
212 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
213 IN EFI_HANDLE RootBridgeHandle,\r
214 OUT VOID **Configuration\r
215 );\r
216\r
217/**\r
218\r
219 This function is called for all the PCI controllers that the PCI\r
220 bus driver finds. Can be used to Preprogram the controller.\r
221\r
222 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.\r
223 @param RootBridgeHandle - The PCI Root Bridge handle.\r
224 @param PciAddress - Address of the controller on the PCI bus.\r
225 @param Phase - The Phase during resource allocation.\r
226\r
227 @retval EFI_SUCCESS - Succeed.\r
228 @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.\r
229\r
230**/\r
231EFI_STATUS\r
232EFIAPI\r
233PreprocessController (\r
234 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,\r
235 IN EFI_HANDLE RootBridgeHandle,\r
236 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,\r
237 IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase\r
238 );\r
239\r
240/**\r
241 This routine constructs the resource descriptors for all root bridges and call PciHostBridgeResourceConflict().\r
242\r
243 @param HostBridge The Host Bridge Instance where the resource adjustment happens.\r
244**/\r
245VOID\r
246ResourceConflict (\r
247 IN PCI_HOST_BRIDGE_INSTANCE *HostBridge\r
248 );\r
249\r
250extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;\r
251extern EFI_CPU_IO2_PROTOCOL *mCpuIo;\r
252#endif\r