]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/PciPlatform.h
4c47ee6a52b727139d3ccb9163b242d7ed635597
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / PciPlatform.h
1 /** @file
2 This file declares PlatfromOpRom protocols which provides the interface between
3 the PCI bus driver/PCI Host Bridge Resource Allocation driver and a platform-specific
4 driver to describe the unique features of a platform. This
5 protocol is optional.
6
7 Copyright (c) 2007 - 2009, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 @par Revision Reference:
17 This protocol is defined in PCI Platform Support Specification
18 Version 0.9
19
20 **/
21
22 #ifndef _PCI_PLATFORM_H_
23 #define _PCI_PLATFORM_H_
24
25 #include <Protocol/PciHostBridgeResourceAllocation.h>
26
27 //
28 // Protocol for GUID.
29 //
30
31 #define EFI_PCI_PLATFORM_PROTOCOL_GUID \
32 { 0x7d75280, 0x27d4, 0x4d69, {0x90, 0xd0, 0x56, 0x43, 0xe2, 0x38, 0xb3, 0x41} }
33
34 typedef struct _EFI_PCI_PLATFORM_PROTOCOL EFI_PCI_PLATFORM_PROTOCOL;
35
36 typedef UINT32 EFI_PCI_PLATFORM_POLICY;
37
38 //
39 // There are 4 legal combinations of following bit values:
40 // EFI_RESERVE_NONE_IO_ALIAS,
41 // EFI_RESERVE_ISA_IO_ALIAS | EFI_RESERVE_VGA_IO_ALIAS,
42 // EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_ALIAS,
43 // EFI_RESERVE_ISA_IO_NO_ALIAS | EFI_RESERVE_VGA_IO_NO_ALIAS
44 //
45 #define EFI_RESERVE_NONE_IO_ALIAS 0x0000
46 #define EFI_RESERVE_ISA_IO_ALIAS 0x0001
47 #define EFI_RESERVE_ISA_IO_NO_ALIAS 0x0002
48 #define EFI_RESERVE_VGA_IO_ALIAS 0x0004
49 #define EFI_RESERVE_VGA_IO_NO_ALIAS 0x0008
50
51 ///
52 /// EFI_PCI_CHIPSET_EXECUTION_PHASE is used to call a platform protocol and execute
53 /// platform-specific code.
54 ///
55 typedef enum {
56 ///
57 /// The phase that indicates the entry point to the PCI Bus Notify phase. This
58 /// platform hook is called before the PCI bus driver calls the
59 /// EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL driver.
60 ///
61 ChipsetEntry,
62 ///
63 /// The phase that indicates the exit point to the Chipset Notify phase before
64 /// returning to the PCI Bus Driver Notify phase. This platform hook is called after
65 /// the PCI bus driver calls the EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL
66 /// driver.
67 ///
68 ChipsetExit,
69 MaximumChipsetPhase
70 } EFI_PCI_CHIPSET_EXECUTION_PHASE;
71
72
73 /**
74 The notification from the PCI bus enumerator to the platform that it is
75 about to enter a certain phase during the enumeration process.
76
77 The PlatformNotify() function can be used to notify the platform driver so that
78 it can perform platform-specific actions. No specific actions are required.
79 Eight notification points are defined at this time. More synchronization points
80 may be added as required in the future. The PCI bus driver calls the platform driver
81 twice for every Phase-once before the PCI Host Bridge Resource Allocation Protocol
82 driver is notified, and once after the PCI Host Bridge Resource Allocation Protocol
83 driver has been notified.
84 This member function may not perform any error checking on the input parameters. It
85 also does not return any error codes. If this member function detects any error condition,
86 it needs to handle those errors on its own because there is no way to surface any
87 errors to the caller.
88
89 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
90 @param HostBridge The handle of the host bridge controller.
91 @param Phase The phase of the PCI bus enumeration.
92 @param ChipsetPhase Defines the execution phase of the PCI chipset driver.
93
94 @retval EFI_SUCCESS The function completed successfully.
95
96 **/
97 typedef
98 EFI_STATUS
99 (EFIAPI *EFI_PCI_PLATFORM_PHASE_NOTIFY)(
100 IN EFI_PCI_PLATFORM_PROTOCOL *This,
101 IN EFI_HANDLE HostBridge,
102 IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase,
103 IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
104 );
105
106
107 /**
108 The notification from the PCI bus enumerator to the platform for each PCI
109 controller at several predefined points during PCI controller initialization.
110
111 The PlatformPrepController() function can be used to notify the platform driver so that
112 it can perform platform-specific actions. No specific actions are required.
113 Several notification points are defined at this time. More synchronization points may be
114 added as required in the future. The PCI bus driver calls the platform driver twice for
115 every PCI controller-once before the PCI Host Bridge Resource Allocation Protocol driver
116 is notified, and once after the PCI Host Bridge Resource Allocation Protocol driver has
117 been notified.
118 This member function may not perform any error checking on the input parameters. It also
119 does not return any error codes. If this member function detects any error condition, it
120 needs to handle those errors on its own because there is no way to surface any errors to
121 the caller.
122
123 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
124 @param HostBridge The associated PCI host bridge handle.
125 @param RootBridge The associated PCI root bridge handle.
126 @param PciAddress The address of the PCI device on the PCI bus.
127 @param Phase The phase of the PCI controller enumeration.
128 @param ChipsetPhase Defines the execution phase of the PCI chipset driver.
129
130 @retval EFI_SUCCESS The function completed successfully.
131
132 **/
133 typedef
134 EFI_STATUS
135 (EFIAPI *EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER)(
136 IN EFI_PCI_PLATFORM_PROTOCOL *This,
137 IN EFI_HANDLE HostBridge,
138 IN EFI_HANDLE RootBridge,
139 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress,
140 IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase,
141 IN EFI_PCI_CHIPSET_EXECUTION_PHASE ChipsetPhase
142 );
143
144
145 /**
146 Retrieves the platform policy regarding enumeration.
147
148 The GetPlatformPolicy() function retrieves the platform policy regarding PCI
149 enumeration. The PCI bus driver and the PCI Host Bridge Resource Allocation Protocol
150 driver can call this member function to retrieve the policy.
151
152 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
153 @param PciPolicy The platform policy with respect to VGA and ISA aliasing.
154
155 @retval EFI_SUCCESS The function completed successfully.
156 @retval EFI_INVALID_PARAMETER PciPolicy is NULL.
157
158 **/
159 typedef
160 EFI_STATUS
161 (EFIAPI *EFI_PCI_PLATFORM_GET_PLATFORM_POLICY)(
162 IN EFI_PCI_PLATFORM_PROTOCOL *This,
163 OUT EFI_PCI_PLATFORM_POLICY *PciPolicy
164 );
165
166
167 /**
168 Gets the PCI device's option ROM from a platform-specific location.
169
170 The GetPciRom() function gets the PCI device's option ROM from a platform-specific location.
171 The option ROM will be loaded into memory. This member function is used to return an image
172 that is packaged as a PCI 2.2 option ROM. The image may contain both legacy and EFI option
173 ROMs. See the UEFI 2.0 Specification for details. This member function can be used to return
174 option ROM images for embedded controllers. Option ROMs for embedded controllers are typically
175 stored in platform-specific storage, and this member function can retrieve it from that storage
176 and return it to the PCI bus driver. The PCI bus driver will call this member function before
177 scanning the ROM that is attached to any controller, which allows a platform to specify a ROM
178 image that is different from the ROM image on a PCI card.
179
180 @param This Pointer to the EFI_PCI_PLATFORM_PROTOCOL instance.
181 @param PciHandle The handle of the PCI device.
182 @param RomImage If the call succeeds, the pointer to the pointer to the option ROM image.
183 Otherwise, this field is undefined. The memory for RomImage is allocated
184 by EFI_PCI_PLATFORM_PROTOCOL.GetPciRom() using the EFI Boot Service AllocatePool().
185 It is the caller's responsibility to free the memory using the EFI Boot Service
186 FreePool(), when the caller is done with the option ROM.
187 @param RomSize If the call succeeds, a pointer to the size of the option ROM size. Otherwise,
188 this field is undefined.
189
190 @retval EFI_SUCCESS The option ROM was available for this device and loaded into memory.
191 @retval EFI_NOT_FOUND No option ROM was available for this device.
192 @retval EFI_OUT_OF_RESOURCES No memory was available to load the option ROM.
193 @retval EFI_DEVICE_ERROR An error occurred in getting the option ROM.
194
195 **/
196 typedef
197 EFI_STATUS
198 (EFIAPI *EFI_PCI_PLATFORM_GET_PCI_ROM)(
199 IN EFI_PCI_PLATFORM_PROTOCOL *This,
200 IN EFI_HANDLE PciHandle,
201 OUT VOID **RomImage,
202 OUT UINTN *RomSize
203 );
204
205 ///
206 /// This protocol provides the interface between the PCI bus driver/PCI Host
207 /// Bridge Resource Allocation driver and a platform-specific driver to describe
208 /// the unique features of a platform.
209 ///
210 struct _EFI_PCI_PLATFORM_PROTOCOL {
211 ///
212 /// The notification from the PCI bus enumerator to the platform that it is about to
213 /// enter a certain phase during the enumeration process.
214 ///
215 EFI_PCI_PLATFORM_PHASE_NOTIFY PlatformNotify;
216 ///
217 /// The notification from the PCI bus enumerator to the platform for each PCI
218 /// controller at several predefined points during PCI controller initialization.
219 ///
220 EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER PlatformPrepController;
221 ///
222 /// Retrieves the platform policy regarding enumeration.
223 ///
224 EFI_PCI_PLATFORM_GET_PLATFORM_POLICY GetPlatformPolicy;
225 ///
226 /// Gets the PCI device\92s option ROM from a platform-specific location.
227 ///
228 EFI_PCI_PLATFORM_GET_PCI_ROM GetPciRom;
229 };
230
231 extern EFI_GUID gEfiPciPlatformProtocolGuid;
232
233 #endif