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