]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/PciHostBridgeResourceAllocation.h
Add the following PI 1.2 Protocols to the MdePkg
[mirror_edk2.git] / MdePkg / Include / Protocol / PciHostBridgeResourceAllocation.h
1 /** @file
2 This file declares PCI Host Bridge Resource Allocation Protocol which
3 provides the basic interfaces to abstract a PCI host bridge resource allocation.
4 This protocol is mandatory if the system includes PCI devices.
5
6 Copyright (c) 2007 - 2009, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 @par Revision Reference:
16 This Protocol is defined in UEFI Platform Initialization Specification 1.2
17 Volume 5: Standards
18
19 **/
20
21 #ifndef _PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_H_
22 #define _PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_H_
23
24 //
25 // This file must be included because EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
26 // uses EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS
27 //
28 #include <Protocol/PciRootBridgeIo.h>
29
30 ///
31 /// Global ID for the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
32 ///
33 #define EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GUID \
34 { \
35 0xCF8034BE, 0x6768, 0x4d8b, {0xB7,0x39,0x7C,0xCE,0x68,0x3A,0x9F,0xBE } \
36 }
37
38 ///
39 /// Forward declaration for EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
40 ///
41 typedef struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL;
42
43 /// If this bit is set, then the PCI Root Bridge does not
44 /// support separate windows for Non-prefetchable and Prefetchable
45 /// memory. A PCI bus driver needs to include requests for Prefetchable
46 /// memory in the Non-prefetchable memory pool.
47 ///
48 #define EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM 1
49
50 ///
51 /// If this bit is set, then the PCI Root Bridge supports
52 /// 64 bit memory windows. If this bit is not set,
53 /// the PCI bus driver needs to include requests for 64 bit
54 /// memory address in the corresponding 32 bit memory pool.
55 ///
56 #define EFI_PCI_HOST_BRIDGE_MEM64_DECODE 2
57
58 ///
59 /// A UINT64 value that contains the status of a PCI resource requested
60 /// in the Configuration parameter returned by GetProposedResources()
61 /// The legal values are EFI_RESOURCE_SATISFIED and EFI_RESOURCE_NOT_SATISFIED
62 ///
63 typedef UINT64 EFI_RESOURCE_ALLOCATION_STATUS;
64
65 ///
66 /// The request of this resource type could be fulfilled. Used in the
67 /// Configuration parameter returned by GetProposedResources() to identify
68 /// a PCI resources request that can be satisfied.
69 ///
70 #define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
71
72 ///
73 /// The request of this resource type could not be fulfilled for its
74 /// absence in the host bridge resource pool. Used in the Configuration parameter
75 /// returned by GetProposedResources() to identify a PCI resources request that
76 /// can not be satisfied.
77 ///
78 #define EFI_RESOURCE_NOT_SATISFIED 0xFFFFFFFFFFFFFFFFULL
79
80 ///
81 /// This enum is used to specify the phase of the PCI enumaeration process
82 ///
83 typedef enum {
84 ///
85 /// Reset the host bridge PCI apertures and internal data structures.
86 /// PCI enumerator should issue this notification before starting fresh
87 /// enumeration process. Enumeration cannot be restarted after sending
88 /// any other notification such as EfiPciHostBridgeBeginBusAllocation.
89 ///
90 EfiPciHostBridgeBeginEnumeration,
91
92 ///
93 /// The bus allocation phase is about to begin. No specific action
94 /// is required here. This notification can be used to perform any
95 /// chipset specific programming.
96 ///
97 EfiPciHostBridgeBeginBusAllocation,
98
99 ///
100 /// The bus allocation and bus programming phase is complete. No specific
101 /// action is required here. This notification can be used to perform any
102 /// chipset specific programming.
103 ///
104 EfiPciHostBridgeEndBusAllocation,
105
106 ///
107 /// The resource allocation phase is about to begin.No specific action is
108 /// required here. This notification can be used to perform any chipset specific programming.
109 ///
110 EfiPciHostBridgeBeginResourceAllocation,
111
112 ///
113 /// Allocate resources per previously submitted requests for all the PCI Root
114 /// Bridges. These resource settings are returned on the next call to
115 /// GetProposedResources().
116 ///
117 EfiPciHostBridgeAllocateResources,
118
119 ///
120 /// Program the Host Bridge hardware to decode previously allocated resources
121 /// (proposed resources) for all the PCI Root Bridges.
122 ///
123 EfiPciHostBridgeSetResources,
124
125 ///
126 /// De-allocate previously allocated resources previously for all the PCI
127 /// Root Bridges and reset the I/O and memory apertures to initial state.
128 ///
129 EfiPciHostBridgeFreeResources,
130
131 ///
132 /// The resource allocation phase is completed. No specific action is required
133 /// here. This notification can be used to perform any chipset specific programming.
134 ///
135 EfiPciHostBridgeEndResourceAllocation
136 } EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE;
137
138 ///
139 /// Definitions of 2 notification points.
140 ///
141 typedef enum {
142 ///
143 /// This notification is only applicable to PCI-PCI bridges and
144 /// indicates that the PCI enumerator is about to begin enumerating
145 /// the bus behind the PCI-PCI Bridge. This notification is sent after
146 /// the primary bus number, the secondary bus number and the subordinate
147 /// bus number registers in the PCI-PCI Bridge are programmed to valid
148 /// (not necessary final) values
149 ///
150 EfiPciBeforeChildBusEnumeration,
151
152 ///
153 /// This notification is sent before the PCI enumerator probes BAR registers
154 /// for every valid PCI function.
155 ///
156 EfiPciBeforeResourceCollection
157 } EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE;
158
159 /**
160 These are the notifications from the PCI bus driver that it is about to enter a certain phase of the PCI
161 enumeration process.
162
163 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
164 instance.
165 @param[in] Phase The phase during enumeration
166
167 @retval EFI_SUCCESS The notification was accepted without any errors.
168 @retval EFI_INVALID_PARAMETER The Phase is invalid.
169 @retval EFI_NOT_READY This phase cannot be entered at this time. For example, this error
170 is valid for a Phase of EfiPciHostBridgeAllocateResources if
171 SubmitResources() has not been called for one or more
172 PCI root bridges before this call.
173 @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. This error is valid for
174 a Phase of EfiPciHostBridgeSetResources.
175 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
176 This error is valid for a Phase of EfiPciHostBridgeAllocateResources
177 if the previously submitted resource requests cannot be fulfilled or were only
178 partially fulfilled
179
180 **/
181 typedef
182 EFI_STATUS
183 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_NOTIFY_PHASE)(
184 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
185 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
186 );
187
188 /**
189 Returns the device handle of the next PCI root bridge that is associated with this host bridge.
190
191 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
192 instance.
193 @param[in,out] RootBridgeHandle Returns the device handle of the next PCI root bridge. On input, it holds the
194 RootBridgeHandle that was returned by the most recent call to
195 GetNextRootBridge(). If RootBridgeHandle is NULL on input, the handle
196 for the first PCI root bridge is returned.
197
198 @retval EFI_SUCCESS The requested attribute information was returned.
199 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not an EFI_HANDLE that was returned
200 on a previous call to GetNextRootBridge().
201 @retval EFI_NOT_FOUND There are no more PCI root bridge device handles.
202
203 **/
204 typedef
205 EFI_STATUS
206 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_NEXT_ROOT_BRIDGE)(
207 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
208 IN OUT EFI_HANDLE *RootBridgeHandle
209 );
210
211 /**
212 Returns the allocation attributes of a PCI root bridge.
213
214 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
215 instance.
216 @param[in] RootBridgeHandle The device handle of the PCI root bridge in which the caller is interested.
217 @param[out] Attribute The pointer to attributes of the PCI root bridge.
218
219 @retval EFI_SUCCESS The requested attribute information was returned.
220 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
221 @retval EFI_INVALID_PARAMETER Attributes is NULL.
222
223 **/
224 typedef
225 EFI_STATUS
226 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_ATTRIBUTES)(
227 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
228 IN EFI_HANDLE RootBridgeHandle,
229 OUT UINT64 *Attributes
230 );
231
232 /**
233 Sets up the specified PCI root bridge for the bus enumeration process.
234
235 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
236 instance.
237 @param[in] RootBridgeHandle The PCI root bridge to be set up.
238 @param[out] Configuration Pointer to the pointer to the PCI bus resource descriptor.
239
240 @retval EFI_SUCCESS The PCI root bridge was set up and the bus range was returned in
241 Configuration.
242 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
243 @retval EFI_DEVICE_ERROR Programming failed due to a hardware error.
244 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
245
246 **/
247 typedef
248 EFI_STATUS
249 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_START_BUS_ENUMERATION)(
250 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
251 IN EFI_HANDLE RootBridgeHandle,
252 OUT VOID **Configuration
253 );
254
255 /**
256 Programs the PCI root bridge hardware so that it decodes the specified PCI bus range.
257
258 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
259 instance.
260 @param[in] RootBridgeHandle The PCI root bridge whose bus range is to be programmed.
261 @param[in] Configuration The pointer to the PCI bus resource descriptor..
262
263 @retval EFI_SUCCESS The bus range for the PCI root bridge was programmed.
264 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
265 @retval EFI_INVALID_PARAMETER Configuration is NULL
266 @retval EFI_INVALID_PARAMETER Configuration does not point to a valid ACPI (2.0 & 3.0)
267 resource descriptor.
268 @retval EFI_INVALID_PARAMETER Configuration does not include a valid ACPI 2.0 bus resource
269 descriptor.
270 @retval EFI_INVALID_PARAMETER Configuration includes valid ACPI (2.0 & 3.0) resource
271 descriptors other than bus descriptors.
272 @retval EFI_INVALID_PARAMETER Configuration contains one or more invalid ACPI resource
273 descriptors.
274 @retval EFI_INVALID_PARAMETER "Address Range Minimum" is invalid for this root bridge.
275 @retval EFI_INVALID_PARAMETER "Address Range Length" is invalid for this root bridge.
276 @retval EFI_DEVICE_ERROR Programming failed due to a hardware error.
277
278 **/
279 typedef
280 EFI_STATUS
281 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SET_BUS_NUMBERS)(
282 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
283 IN EFI_HANDLE RootBridgeHandle,
284 IN VOID *Configuration
285 );
286
287 /**
288 Submits the I/O and memory resource requirements for the specified PCI root bridge.
289
290 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
291 instance.
292 @param[in] RootBridgeHandle The PCI root bridge whose I/O and memory resource requirements are being
293 submitted.
294 @param[in] Configuration The pointer to the PCI I/O and PCI memory resource descriptor.
295
296 @retval EFI_SUCCESS The I/O and memory resource requests for a PCI root bridge were
297 accepted.
298 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
299 @retval EFI_INVALID_PARAMETER Configuration is NULL.
300 @retval EFI_INVALID_PARAMETER Configuration does not point to a valid ACPI (2.0 & 3.0)
301 resource descriptor.
302 @retval EFI_INVALID_PARAMETER Configuration includes requests for one or more resource
303 types that are not supported by this PCI root bridge. This error will
304 happen if the caller did not combine resources according to
305 Attributes that were returned by GetAllocAttributes().
306 @retval EFI_INVALID_PARAMETER "Address Range Maximum" is invalid.
307 @retval EFI_INVALID_PARAMETER "Address Range Length" is invalid for this PCI root bridge.
308 @retval EFI_INVALID_PARAMETER "Address Space Granularity" is invalid for this PCI root bridge.
309
310 **/
311 typedef
312 EFI_STATUS
313 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SUBMIT_RESOURCES)(
314 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
315 IN EFI_HANDLE RootBridgeHandle,
316 IN VOID *Configuration
317 );
318
319 /**
320 Returns the proposed resource settings for the specified PCI root bridge.
321
322 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
323 instance.
324 @param[in] RootBridgeHandle The PCI root bridge handle.
325 @param[out] Configuration The pointer to the pointer to the PCI I/O and memory resource descriptor.
326
327 @retval EFI_SUCCESS The requested parameters were returned.
328 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
329 @retval EFI_DEVICE_ERROR Programming failed due to a hardware error.
330 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
331
332 **/
333 typedef
334 EFI_STATUS
335 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_PROPOSED_RESOURCES)(
336 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
337 IN EFI_HANDLE RootBridgeHandle,
338 OUT VOID **Configuration
339 );
340
341 /**
342 Provides the hooks from the PCI bus driver to every PCI controller (device/function) at various
343 stages of the PCI enumeration process that allow the host bridge driver to preinitialize individual
344 PCI controllers before enumeration.
345
346 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
347 @param[in] RootBridgeHandle The associated PCI root bridge handle.
348 @param[in] PciAddress The address of the PCI device on the PCI bus.
349 @param[in] Phase The phase of the PCI device enumeration.
350
351 @retval EFI_SUCCESS The requested parameters were returned.
352 @retval EFI_INVALID_PARAMETER RootBridgeHandle is not a valid root bridge handle.
353 @retval EFI_INVALID_PARAMETER Phase is not a valid phase that is defined in
354 EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE.
355 @retval EFI_DEVICE_ERROR Programming failed due to a hardware error. The PCI enumerator
356 should not enumerate this device, including its child devices if it is
357 a PCI-to-PCI bridge.
358
359 **/
360 typedef
361 EFI_STATUS
362 (EFIAPI *EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_PREPROCESS_CONTROLLER)(
363 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL *This,
364 IN EFI_HANDLE RootBridgeHandle,
365 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
366 IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
367 );
368
369 ///
370 /// Provides the basic interfaces to abstract a PCI host bridge resource allocation.
371 ///
372 struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL {
373 ///
374 /// The notification from the PCI bus enumerator that it is about to enter
375 /// a certain phase during the enumeration process.
376 ///
377 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_NOTIFY_PHASE NotifyPhase;
378
379 ///
380 /// Retrieves the device handle for the next PCI root bridge that is produced by the
381 /// host bridge to which this instance of the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL is attached.
382 ///
383 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_NEXT_ROOT_BRIDGE GetNextRootBridge;
384
385 ///
386 /// Retrieves the allocation-related attributes of a PCI root bridge.
387 ///
388 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_ATTRIBUTES GetAllocAttributes;
389
390 ///
391 /// Sets up a PCI root bridge for bus enumeration.
392 ///
393 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_START_BUS_ENUMERATION StartBusEnumeration;
394
395 ///
396 /// Sets up the PCI root bridge so that it decodes a specific range of bus numbers.
397 ///
398 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SET_BUS_NUMBERS SetBusNumbers;
399
400 ///
401 /// Submits the resource requirements for the specified PCI root bridge.
402 ///
403 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SUBMIT_RESOURCES SubmitResources;
404
405 ///
406 /// Returns the proposed resource assignment for the specified PCI root bridges.
407 ///
408 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_PROPOSED_RESOURCES GetProposedResources;
409
410 ///
411 /// Provides hooks from the PCI bus driver to every PCI controller
412 /// (device/function) at various stages of the PCI enumeration process that
413 /// allow the host bridge driver to preinitialize individual PCI controllers
414 /// before enumeration.
415 ///
416 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_PREPROCESS_CONTROLLER PreprocessController;
417 };
418
419 extern EFI_GUID gEfiPciHostBridgeResourceAllocationProtocolGuid;
420
421 #endif