]>
Commit | Line | Data |
---|---|---|
4a50cf4e RN |
1 | /** @file\r |
2 | \r | |
3 | The Header file of the Pci Host Bridge Driver.\r | |
4 | \r | |
5 | Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT 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 | |
30 | typedef 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 | |
54 | EFI_STATUS\r | |
55 | EFIAPI\r | |
56 | InitializePciHostBridge (\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 | |
76 | EFI_STATUS\r | |
77 | EFIAPI\r | |
78 | NotifyPhase (\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 | 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 | |
99 | EFI_STATUS\r | |
100 | EFIAPI\r | |
101 | GetNextRootBridge (\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 | |
122 | EFI_STATUS\r | |
123 | EFIAPI\r | |
124 | GetAttributes (\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 | |
144 | EFI_STATUS\r | |
145 | EFIAPI\r | |
146 | StartBusEnumeration (\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 | |
165 | EFI_STATUS\r | |
166 | EFIAPI\r | |
167 | SetBusNumbers (\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 | |
186 | EFI_STATUS\r | |
187 | EFIAPI\r | |
188 | SubmitResources (\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 | |
209 | EFI_STATUS\r | |
210 | EFIAPI\r | |
211 | GetProposedResources (\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 | |
231 | EFI_STATUS\r | |
232 | EFIAPI\r | |
233 | PreprocessController (\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 | |
245 | VOID\r | |
246 | ResourceConflict (\r | |
247 | IN PCI_HOST_BRIDGE_INSTANCE *HostBridge\r | |
248 | );\r | |
249 | \r | |
250 | extern EFI_METRONOME_ARCH_PROTOCOL *mMetronome;\r | |
251 | extern EFI_CPU_IO2_PROTOCOL *mCpuIo;\r | |
252 | #endif\r |