]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFsp2Pkg/Include/FspEas/FspApi.h
IntelFsp2Pkg/FspApi.h: Add comment for structure definition.
[mirror_edk2.git] / IntelFsp2Pkg / Include / FspEas / FspApi.h
1 /** @file
2 Intel FSP API definition from Intel Firmware Support Package External
3 Architecture Specification v2.0.
4
5 Copyright (c) 2014 - 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.
10
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.
13
14 **/
15
16 #ifndef _FSP_API_H_
17 #define _FSP_API_H_
18
19 #pragma pack(1)
20 ///
21 /// FSP_UPD_HEADER Configuration.
22 ///
23 typedef struct {
24 ///
25 /// UPD Region Signature. This signature will be
26 /// "XXXXXX_T" for FSP-T
27 /// "XXXXXX_M" for FSP-M
28 /// "XXXXXX_S" for FSP-S
29 /// Where XXXXXX is an unique signature
30 ///
31 UINT64 Signature;
32 ///
33 /// Revision of the Data structure. For FSP v2.0 value is 1.
34 ///
35 UINT8 Revision;
36 UINT8 Reserved[23];
37 } FSP_UPD_HEADER;
38
39 ///
40 /// FSPM_ARCH_UPD Configuration.
41 ///
42 typedef struct {
43 ///
44 /// Revision of the structure. For FSP v2.0 value is 1.
45 ///
46 UINT8 Revision;
47 UINT8 Reserved[3];
48 ///
49 /// Pointer to the non-volatile storage (NVS) data buffer.
50 /// If it is NULL it indicates the NVS data is not available.
51 ///
52 VOID *NvsBufferPtr;
53 ///
54 /// Pointer to the temporary stack base address to be
55 /// consumed inside FspMemoryInit() API.
56 ///
57 VOID *StackBase;
58 ///
59 /// Temporary stack size to be consumed inside
60 /// FspMemoryInit() API.
61 ///
62 UINT32 StackSize;
63 ///
64 /// Size of memory to be reserved by FSP below "top
65 /// of low usable memory" for bootloader usage.
66 ///
67 UINT32 BootLoaderTolumSize;
68 ///
69 /// Current boot mode.
70 ///
71 UINT32 BootMode;
72 UINT8 Reserved1[8];
73 } FSPM_ARCH_UPD;
74
75 ///
76 /// FSPT_UPD_COMMON Configuration.
77 ///
78 typedef struct {
79 ///
80 /// FSP_UPD_HEADER Configuration.
81 ///
82 FSP_UPD_HEADER FspUpdHeader;
83 } FSPT_UPD_COMMON;
84
85 ///
86 /// FSPM_UPD_COMMON Configuration.
87 ///
88 typedef struct {
89 ///
90 /// FSP_UPD_HEADER Configuration.
91 ///
92 FSP_UPD_HEADER FspUpdHeader;
93 ///
94 /// FSPM_ARCH_UPD Configuration.
95 ///
96 FSPM_ARCH_UPD FspmArchUpd;
97 } FSPM_UPD_COMMON;
98
99 ///
100 /// FSPS_UPD_COMMON Configuration.
101 ///
102 typedef struct {
103 ///
104 /// FSP_UPD_HEADER Configuration.
105 ///
106 FSP_UPD_HEADER FspUpdHeader;
107 } FSPS_UPD_COMMON;
108
109 ///
110 /// Enumeration of FSP_INIT_PHASE for NOTIFY_PHASE.
111 ///
112 typedef enum {
113 ///
114 /// This stage is notified when the bootloader completes the
115 /// PCI enumeration and the resource allocation for the
116 /// PCI devices is complete.
117 ///
118 EnumInitPhaseAfterPciEnumeration = 0x20,
119 ///
120 /// This stage is notified just before the bootloader hand-off
121 /// to the OS loader.
122 ///
123 EnumInitPhaseReadyToBoot = 0x40,
124 ///
125 /// This stage is notified just before the firmware/Preboot
126 /// environment transfers management of all system resources
127 /// to the OS or next level execution environment.
128 ///
129 EnumInitPhaseEndOfFirmware = 0xF0
130 } FSP_INIT_PHASE;
131
132 ///
133 /// Definition of NOTIFY_PHASE_PARAMS.
134 ///
135 typedef struct {
136 ///
137 /// Notification phase used for NotifyPhase API
138 ///
139 FSP_INIT_PHASE Phase;
140 } NOTIFY_PHASE_PARAMS;
141
142 #pragma pack()
143
144 /**
145 This FSP API is called soon after coming out of reset and before memory and stack is
146 available. This FSP API will load the microcode update, enable code caching for the
147 region specified by the boot loader and also setup a temporary stack to be used until
148 main memory is initialized.
149
150 A hardcoded stack can be set up with the following values, and the "esp" register
151 initialized to point to this hardcoded stack.
152 1. The return address where the FSP will return control after setting up a temporary
153 stack.
154 2. A pointer to the input parameter structure
155
156 However, since the stack is in ROM and not writeable, this FSP API cannot be called
157 using the "call" instruction, but needs to be jumped to.
158
159 @param[in] FsptUpdDataPtr Pointer to the FSPT_UPD data structure.
160
161 @retval EFI_SUCCESS Temporary RAM was initialized successfully.
162 @retval EFI_INVALID_PARAMETER Input parameters are invalid.
163 @retval EFI_UNSUPPORTED The FSP calling conditions were not met.
164 @retval EFI_DEVICE_ERROR Temp RAM initialization failed.
165
166 If this function is successful, the FSP initializes the ECX and EDX registers to point to
167 a temporary but writeable memory range available to the boot loader and returns with
168 FSP_SUCCESS in register EAX. Register ECX points to the start of this temporary
169 memory range and EDX points to the end of the range. Boot loader is free to use the
170 whole range described. Typically the boot loader can reload the ESP register to point
171 to the end of this returned range so that it can be used as a standard stack.
172 **/
173 typedef
174 EFI_STATUS
175 (EFIAPI *FSP_TEMP_RAM_INIT) (
176 IN VOID *FsptUpdDataPtr
177 );
178
179 /**
180 This FSP API is used to notify the FSP about the different phases in the boot process.
181 This allows the FSP to take appropriate actions as needed during different initialization
182 phases. The phases will be platform dependent and will be documented with the FSP
183 release. The current FSP supports two notify phases:
184 Post PCI enumeration
185 Ready To Boot
186
187 @param[in] NotifyPhaseParamPtr Address pointer to the NOTIFY_PHASE_PRAMS
188
189 @retval EFI_SUCCESS The notification was handled successfully.
190 @retval EFI_UNSUPPORTED The notification was not called in the proper order.
191 @retval EFI_INVALID_PARAMETER The notification code is invalid.
192 **/
193 typedef
194 EFI_STATUS
195 (EFIAPI *FSP_NOTIFY_PHASE) (
196 IN NOTIFY_PHASE_PARAMS *NotifyPhaseParamPtr
197 );
198
199 /**
200 This FSP API is called after TempRamInit and initializes the memory.
201 This FSP API accepts a pointer to a data structure that will be platform dependent
202 and defined for each FSP binary. This will be documented in Integration guide with
203 each FSP release.
204 After FspMemInit completes its execution, it passes the pointer to the HobList and
205 returns to the boot loader from where it was called. BootLoader is responsible to
206 migrate it's stack and data to Memory.
207 FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to
208 complete the silicon initialization and provides bootloader an opportunity to get
209 control after system memory is available and before the temporary RAM is torn down.
210
211 @param[in] FspmUpdDataPtr Pointer to the FSPM_UPD data sructure.
212 @param[out] HobListPtr Pointer to receive the address of the HOB list.
213
214 @retval EFI_SUCCESS FSP execution environment was initialized successfully.
215 @retval EFI_INVALID_PARAMETER Input parameters are invalid.
216 @retval EFI_UNSUPPORTED The FSP calling conditions were not met.
217 @retval EFI_DEVICE_ERROR FSP initialization failed.
218 @retval EFI_OUT_OF_RESOURCES Stack range requested by FSP is not met.
219 @retval FSP_STATUS_RESET_REQUIREDx A reset is reuired. These status codes will not be returned during S3.
220 **/
221 typedef
222 EFI_STATUS
223 (EFIAPI *FSP_MEMORY_INIT) (
224 IN VOID *FspmUpdDataPtr,
225 OUT VOID **HobListPtr
226 );
227
228
229 /**
230 This FSP API is called after FspMemoryInit API. This FSP API tears down the temporary
231 memory setup by TempRamInit API. This FSP API accepts a pointer to a data structure
232 that will be platform dependent and defined for each FSP binary. This will be
233 documented in Integration Guide.
234 FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to
235 complete the silicon initialization and provides bootloader an opportunity to get
236 control after system memory is available and before the temporary RAM is torn down.
237
238 @param[in] TempRamExitParamPtr Pointer to the Temp Ram Exit parameters structure.
239 This structure is normally defined in the Integration Guide.
240 And if it is not defined in the Integration Guide, pass NULL.
241
242 @retval EFI_SUCCESS FSP execution environment was initialized successfully.
243 @retval EFI_INVALID_PARAMETER Input parameters are invalid.
244 @retval EFI_UNSUPPORTED The FSP calling conditions were not met.
245 @retval EFI_DEVICE_ERROR FSP initialization failed.
246 **/
247 typedef
248 EFI_STATUS
249 (EFIAPI *FSP_TEMP_RAM_EXIT) (
250 IN VOID *TempRamExitParamPtr
251 );
252
253
254 /**
255 This FSP API is called after TempRamExit API.
256 FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to complete the
257 silicon initialization.
258
259 @param[in] FspsUpdDataPtr Pointer to the FSPS_UPD data structure.
260 If NULL, FSP will use the default parameters.
261
262 @retval EFI_SUCCESS FSP execution environment was initialized successfully.
263 @retval EFI_INVALID_PARAMETER Input parameters are invalid.
264 @retval EFI_UNSUPPORTED The FSP calling conditions were not met.
265 @retval EFI_DEVICE_ERROR FSP initialization failed.
266 @retval FSP_STATUS_RESET_REQUIREDx A reset is reuired. These status codes will not be returned during S3.
267 **/
268 typedef
269 EFI_STATUS
270 (EFIAPI *FSP_SILICON_INIT) (
271 IN VOID *FspsUpdDataPtr
272 );
273
274 #endif