3 The Header file of the Pci Host Bridge Driver.
5 Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _PCI_HOST_BRIDGE_H_
17 #define _PCI_HOST_BRIDGE_H_
21 #include <IndustryStandard/Acpi.h>
22 #include <Library/UefiDriverEntryPoint.h>
23 #include <Library/MemoryAllocationLib.h>
24 #include <Library/PciHostBridgeLib.h>
25 #include <Protocol/PciHostBridgeResourceAllocation.h>
27 #include "PciRootBridge.h"
29 #define PCI_HOST_BRIDGE_SIGNATURE SIGNATURE_32 ('p', 'h', 'b', 'g')
33 LIST_ENTRY RootBridges
;
35 EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL ResAlloc
;
36 } PCI_HOST_BRIDGE_INSTANCE
;
38 #define PCI_HOST_BRIDGE_FROM_THIS(a) CR (a, PCI_HOST_BRIDGE_INSTANCE, ResAlloc, PCI_HOST_BRIDGE_SIGNATURE)
45 Entry point of this driver.
47 @param ImageHandle - Image handle of this driver.
48 @param SystemTable - Pointer to standard EFI system table.
50 @retval EFI_SUCCESS - Succeed.
51 @retval EFI_DEVICE_ERROR - Fail to install PCI_ROOT_BRIDGE_IO protocol.
56 InitializePciHostBridge (
57 IN EFI_HANDLE ImageHandle
,
58 IN EFI_SYSTEM_TABLE
*SystemTable
62 // HostBridge Resource Allocation interface
66 Enter a certain phase of the PCI enumeration process.
68 @param This The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL instance.
69 @param Phase The phase during enumeration.
71 @retval EFI_SUCCESS Succeed.
72 @retval EFI_INVALID_PARAMETER Wrong phase parameter passed in.
73 @retval EFI_NOT_READY Resources have not been submitted yet.
79 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
80 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase
85 Return the device handle of the next PCI root bridge that is associated with
88 @param This The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
89 @param RootBridgeHandle Returns the device handle of the next PCI Root Bridge.
90 On input, it holds the RootBridgeHandle returned by the most
91 recent call to GetNextRootBridge().The handle for the first
92 PCI Root Bridge is returned if RootBridgeHandle is NULL on input.
94 @retval EFI_SUCCESS Succeed.
95 @retval EFI_NOT_FOUND Next PCI root bridge not found.
96 @retval EFI_INVALID_PARAMETER Wrong parameter passed in.
102 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
103 IN OUT EFI_HANDLE
*RootBridgeHandle
108 Returns the attributes of a PCI Root Bridge.
110 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
111 @param RootBridgeHandle - The device handle of the PCI Root Bridge
112 that the caller is interested in
113 @param Attributes - The pointer to attributes of the PCI Root Bridge
115 @retval EFI_SUCCESS - Succeed.
116 @retval EFI_INVALID_PARAMETER - Attributes parameter passed in is NULL or
117 @retval RootBridgeHandle is not an EFI_HANDLE
118 @retval that was returned on a previous call to
119 @retval GetNextRootBridge().
125 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
126 IN EFI_HANDLE RootBridgeHandle
,
127 OUT UINT64
*Attributes
132 This is the request from the PCI enumerator to set up
133 the specified PCI Root Bridge for bus enumeration process.
135 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
136 @param RootBridgeHandle - The PCI Root Bridge to be set up.
137 @param Configuration - Pointer to the pointer to the PCI bus resource descriptor.
139 @retval EFI_SUCCESS - Succeed.
140 @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
141 @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
146 StartBusEnumeration (
147 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
148 IN EFI_HANDLE RootBridgeHandle
,
149 OUT VOID
**Configuration
154 This function programs the PCI Root Bridge hardware so that
155 it decodes the specified PCI bus range.
157 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
158 @param RootBridgeHandle - The PCI Root Bridge whose bus range is to be programmed.
159 @param Configuration - The pointer to the PCI bus resource descriptor.
161 @retval EFI_SUCCESS - Succeed.
162 @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.
168 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
169 IN EFI_HANDLE RootBridgeHandle
,
170 IN VOID
*Configuration
175 Submits the I/O and memory resource requirements for the specified PCI Root Bridge.
177 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance
178 @param RootBridgeHandle - The PCI Root Bridge whose I/O and memory resource requirements
180 @param Configuration - The pointer to the PCI I/O and PCI memory resource descriptor
182 @retval EFI_SUCCESS - Succeed.
183 @retval EFI_INVALID_PARAMETER - Wrong parameters passed in.
189 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
190 IN EFI_HANDLE RootBridgeHandle
,
191 IN VOID
*Configuration
196 This function returns the proposed resource settings for the specified
199 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
200 @param RootBridgeHandle - The PCI Root Bridge handle.
201 @param Configuration - The pointer to the pointer to the PCI I/O
202 and memory resource descriptor.
204 @retval EFI_SUCCESS - Succeed.
205 @retval EFI_OUT_OF_RESOURCES - Not enough pool to be allocated.
206 @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
211 GetProposedResources (
212 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
213 IN EFI_HANDLE RootBridgeHandle
,
214 OUT VOID
**Configuration
219 This function is called for all the PCI controllers that the PCI
220 bus driver finds. Can be used to Preprogram the controller.
222 @param This - The EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_ PROTOCOL instance.
223 @param RootBridgeHandle - The PCI Root Bridge handle.
224 @param PciAddress - Address of the controller on the PCI bus.
225 @param Phase - The Phase during resource allocation.
227 @retval EFI_SUCCESS - Succeed.
228 @retval EFI_INVALID_PARAMETER - RootBridgeHandle is not a valid handle.
233 PreprocessController (
234 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
*This
,
235 IN EFI_HANDLE RootBridgeHandle
,
236 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress
,
237 IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase
241 This routine constructs the resource descriptors for all root bridges and call PciHostBridgeResourceConflict().
243 @param HostBridge The Host Bridge Instance where the resource adjustment happens.
247 IN PCI_HOST_BRIDGE_INSTANCE
*HostBridge
250 extern EFI_METRONOME_ARCH_PROTOCOL
*mMetronome
;
251 extern EFI_CPU_IO2_PROTOCOL
*mCpuIo
;