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