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.
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
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.
15 @par Revision Reference:
16 This Protocol is defined in UEFI Platform Initialization Specification 1.2
21 #ifndef _PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_H_
22 #define _PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_H_
25 // This file must be included because EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
26 // uses EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS
28 #include <Protocol/PciRootBridgeIo.h>
31 /// Global ID for the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
33 #define EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GUID \
35 0xCF8034BE, 0x6768, 0x4d8b, {0xB7,0x39,0x7C,0xCE,0x68,0x3A,0x9F,0xBE } \
39 /// Forward declaration for EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
41 typedef struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
;
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.
48 #define EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM 1
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.
56 #define EFI_PCI_HOST_BRIDGE_MEM64_DECODE 2
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
63 typedef UINT64 EFI_RESOURCE_ALLOCATION_STATUS
;
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.
70 #define EFI_RESOURCE_SATISFIED 0x0000000000000000ULL
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.
78 #define EFI_RESOURCE_NOT_SATISFIED 0xFFFFFFFFFFFFFFFFULL
81 /// This enum is used to specify the phase of the PCI enumaeration process
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.
90 EfiPciHostBridgeBeginEnumeration
,
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.
97 EfiPciHostBridgeBeginBusAllocation
,
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.
104 EfiPciHostBridgeEndBusAllocation
,
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.
110 EfiPciHostBridgeBeginResourceAllocation
,
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().
117 EfiPciHostBridgeAllocateResources
,
120 /// Program the Host Bridge hardware to decode previously allocated resources
121 /// (proposed resources) for all the PCI Root Bridges.
123 EfiPciHostBridgeSetResources
,
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.
129 EfiPciHostBridgeFreeResources
,
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.
135 EfiPciHostBridgeEndResourceAllocation
136 } EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE
;
139 /// Definitions of 2 notification points.
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
150 EfiPciBeforeChildBusEnumeration
,
153 /// This notification is sent before the PCI enumerator probes BAR registers
154 /// for every valid PCI function.
156 EfiPciBeforeResourceCollection
157 } EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE
;
160 These are the notifications from the PCI bus driver that it is about to enter a certain phase of the PCI
163 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
165 @param[in] Phase The phase during enumeration
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
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
189 Returns the device handle of the next PCI root bridge that is associated with this host bridge.
191 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
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.
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.
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
212 Returns the allocation attributes of a PCI root bridge.
214 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
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.
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.
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
233 Sets up the specified PCI root bridge for the bus enumeration process.
235 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
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.
240 @retval EFI_SUCCESS The PCI root bridge was set up and the bus range was returned in
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.
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
256 Programs the PCI root bridge hardware so that it decodes the specified PCI bus range.
258 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
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..
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)
268 @retval EFI_INVALID_PARAMETER Configuration does not include a valid ACPI 2.0 bus resource
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
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.
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
288 Submits the I/O and memory resource requirements for the specified PCI root bridge.
290 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
292 @param[in] RootBridgeHandle The PCI root bridge whose I/O and memory resource requirements are being
294 @param[in] Configuration The pointer to the PCI I/O and PCI memory resource descriptor.
296 @retval EFI_SUCCESS The I/O and memory resource requests for a PCI root bridge were
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)
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.
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
320 Returns the proposed resource settings for the specified PCI root bridge.
322 @param[in] This Pointer to the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
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.
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.
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
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.
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.
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
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
370 /// Provides the basic interfaces to abstract a PCI host bridge resource allocation.
372 struct _EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
{
374 /// The notification from the PCI bus enumerator that it is about to enter
375 /// a certain phase during the enumeration process.
377 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_NOTIFY_PHASE NotifyPhase
;
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.
383 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_NEXT_ROOT_BRIDGE GetNextRootBridge
;
386 /// Retrieves the allocation-related attributes of a PCI root bridge.
388 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_ATTRIBUTES GetAllocAttributes
;
391 /// Sets up a PCI root bridge for bus enumeration.
393 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_START_BUS_ENUMERATION StartBusEnumeration
;
396 /// Sets up the PCI root bridge so that it decodes a specific range of bus numbers.
398 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SET_BUS_NUMBERS SetBusNumbers
;
401 /// Submits the resource requirements for the specified PCI root bridge.
403 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_SUBMIT_RESOURCES SubmitResources
;
406 /// Returns the proposed resource assignment for the specified PCI root bridges.
408 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_GET_PROPOSED_RESOURCES GetProposedResources
;
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.
416 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL_PREPROCESS_CONTROLLER PreprocessController
;
419 extern EFI_GUID gEfiPciHostBridgeResourceAllocationProtocolGuid
;