]>
Commit | Line | Data |
---|---|---|
a33a2f62 JY |
1 | /** @file\r |
2 | Intel FSP API definition from Intel Firmware Support Package External\r | |
3 | Architecture Specification, April 2014, revision 001.\r | |
4 | \r | |
d5fb1edf | 5 | Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r |
a33a2f62 JY |
6 | This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _FSP_API_H_\r | |
17 | #define _FSP_API_H_\r | |
18 | \r | |
d5fb1edf | 19 | #define FSP_STATUS EFI_STATUS\r |
a33a2f62 JY |
20 | #define FSPAPI EFIAPI\r |
21 | \r | |
22 | /**\r | |
23 | FSP Init continuation function prototype.\r | |
24 | Control will be returned to this callback function after FspInit API call.\r | |
25 | \r | |
26 | @param[in] Status Status of the FSP INIT API.\r | |
27 | @param[in] HobBufferPtr Pointer to the HOB data structure defined in the PI specification.\r | |
28 | **/\r | |
29 | typedef\r | |
30 | VOID\r | |
31 | (* CONTINUATION_PROC) (\r | |
d5fb1edf | 32 | IN EFI_STATUS Status,\r |
a33a2f62 JY |
33 | IN VOID *HobListPtr\r |
34 | );\r | |
35 | \r | |
36 | #pragma pack(1)\r | |
37 | \r | |
38 | typedef struct {\r | |
39 | ///\r | |
40 | /// Base address of the microcode region.\r | |
41 | ///\r | |
42 | UINT32 MicrocodeRegionBase;\r | |
43 | ///\r | |
44 | /// Length of the microcode region.\r | |
45 | ///\r | |
46 | UINT32 MicrocodeRegionLength;\r | |
47 | ///\r | |
48 | /// Base address of the cacheable flash region.\r | |
49 | ///\r | |
50 | UINT32 CodeRegionBase;\r | |
51 | ///\r | |
52 | /// Length of the cacheable flash region.\r | |
53 | ///\r | |
54 | UINT32 CodeRegionLength;\r | |
55 | } FSP_TEMP_RAM_INIT_PARAMS;\r | |
56 | \r | |
57 | typedef struct {\r | |
58 | ///\r | |
59 | /// Non-volatile storage buffer pointer.\r | |
60 | ///\r | |
61 | VOID *NvsBufferPtr;\r | |
62 | ///\r | |
63 | /// Runtime buffer pointer\r | |
64 | ///\r | |
65 | VOID *RtBufferPtr;\r | |
66 | ///\r | |
67 | /// Continuation function address\r | |
68 | ///\r | |
69 | CONTINUATION_PROC ContinuationFunc;\r | |
70 | } FSP_INIT_PARAMS;\r | |
71 | \r | |
72 | typedef struct {\r | |
73 | ///\r | |
74 | /// Stack top pointer used by the bootloader.\r | |
75 | /// The new stack frame will be set up at this location after FspInit API call.\r | |
76 | ///\r | |
77 | UINT32 *StackTop;\r | |
78 | ///\r | |
79 | /// Current system boot mode.\r | |
80 | ///\r | |
81 | UINT32 BootMode;\r | |
82 | ///\r | |
83 | /// User platform configuraiton data region pointer.\r | |
84 | ///\r | |
85 | VOID *UpdDataRgnPtr;\r | |
86 | ///\r | |
87 | /// Reserved\r | |
88 | ///\r | |
89 | UINT32 Reserved[7];\r | |
90 | } FSP_INIT_RT_COMMON_BUFFER;\r | |
91 | \r | |
92 | typedef enum {\r | |
93 | ///\r | |
94 | /// Notification code for post PCI enuermation\r | |
95 | ///\r | |
96 | EnumInitPhaseAfterPciEnumeration = 0x20,\r | |
97 | ///\r | |
98 | /// Notification code before transfering control to the payload\r | |
99 | ///\r | |
100 | EnumInitPhaseReadyToBoot = 0x40\r | |
101 | } FSP_INIT_PHASE;\r | |
102 | \r | |
103 | typedef struct {\r | |
104 | ///\r | |
105 | /// Notification phase used for NotifyPhase API\r | |
106 | ///\r | |
107 | FSP_INIT_PHASE Phase;\r | |
108 | } NOTIFY_PHASE_PARAMS;\r | |
109 | \r | |
d5fb1edf JY |
110 | typedef struct {\r |
111 | ///\r | |
112 | /// Non-volatile storage buffer pointer.\r | |
113 | ///\r | |
114 | VOID *NvsBufferPtr;\r | |
115 | ///\r | |
116 | /// Runtime buffer pointer\r | |
117 | ///\r | |
118 | VOID *RtBufferPtr;\r | |
119 | ///\r | |
120 | /// Pointer to the HOB data structure defined in the PI specification\r | |
121 | ///\r | |
122 | VOID **HobListPtr;\r | |
123 | } FSP_MEMORY_INIT_PARAMS;\r | |
124 | \r | |
a33a2f62 JY |
125 | #pragma pack()\r |
126 | \r | |
127 | /**\r | |
128 | This FSP API is called soon after coming out of reset and before memory and stack is\r | |
129 | available. This FSP API will load the microcode update, enable code caching for the\r | |
130 | region specified by the boot loader and also setup a temporary stack to be used until\r | |
131 | main memory is initialized.\r | |
132 | \r | |
133 | A hardcoded stack can be set up with the following values, and the "esp" register\r | |
134 | initialized to point to this hardcoded stack.\r | |
135 | 1. The return address where the FSP will return control after setting up a temporary\r | |
136 | stack.\r | |
137 | 2. A pointer to the input parameter structure\r | |
138 | \r | |
139 | However, since the stack is in ROM and not writeable, this FSP API cannot be called\r | |
140 | using the "call" instruction, but needs to be jumped to.\r | |
141 | \r | |
142 | @param[in] TempRaminitParamPtr Address pointer to the FSP_TEMP_RAM_INIT_PARAMS structure.\r | |
143 | \r | |
d5fb1edf JY |
144 | @retval EFI_SUCCESS Temp RAM was initialized successfully.\r |
145 | @retval EFI_INVALID_PARAMETER Input parameters are invalid..\r | |
146 | @retval EFI_NOT_FOUND No valid microcode was found in the microcode region.\r | |
147 | @retval EFI_UNSUPPORTED The FSP calling conditions were not met.\r | |
148 | @retval EFI_DEVICE_ERROR Temp RAM initialization failed.\r | |
a33a2f62 JY |
149 | \r |
150 | If this function is successful, the FSP initializes the ECX and EDX registers to point to\r | |
151 | a temporary but writeable memory range available to the boot loader and returns with\r | |
152 | FSP_SUCCESS in register EAX. Register ECX points to the start of this temporary\r | |
153 | memory range and EDX points to the end of the range. Boot loader is free to use the\r | |
154 | whole range described. Typically the boot loader can reload the ESP register to point\r | |
155 | to the end of this returned range so that it can be used as a standard stack.\r | |
156 | **/\r | |
157 | typedef\r | |
d5fb1edf JY |
158 | EFI_STATUS\r |
159 | (EFIAPI *FSP_TEMP_RAM_INIT) (\r | |
a33a2f62 JY |
160 | IN FSP_TEMP_RAM_INIT_PARAMS *FspTempRamInitPtr\r |
161 | );\r | |
162 | \r | |
163 | /**\r | |
164 | This FSP API is called after TempRamInitEntry. This FSP API initializes the memory,\r | |
165 | the CPU and the chipset to enable normal operation of these devices. This FSP API\r | |
166 | accepts a pointer to a data structure that will be platform dependent and defined for\r | |
167 | each FSP binary. This will be documented in the Integration Guide for each FSP\r | |
168 | release.\r | |
169 | The boot loader provides a continuation function as a parameter when calling FspInit.\r | |
170 | After FspInit completes its execution, it does not return to the boot loader from where\r | |
171 | it was called but instead returns control to the boot loader by calling the continuation\r | |
172 | function which is passed to FspInit as an argument.\r | |
173 | \r | |
174 | @param[in] FspInitParamPtr Address pointer to the FSP_INIT_PARAMS structure.\r | |
175 | \r | |
d5fb1edf JY |
176 | @retval EFI_SUCCESS FSP execution environment was initialized successfully.\r |
177 | @retval EFI_INVALID_PARAMETER Input parameters are invalid.\r | |
178 | @retval EFI_UNSUPPORTED The FSP calling conditions were not met.\r | |
179 | @retval EFI_DEVICE_ERROR FSP initialization failed.\r | |
a33a2f62 JY |
180 | **/\r |
181 | typedef\r | |
d5fb1edf JY |
182 | EFI_STATUS\r |
183 | (EFIAPI *FSP_INIT) (\r | |
a33a2f62 JY |
184 | IN OUT FSP_INIT_PARAMS *FspInitParamPtr\r |
185 | );\r | |
186 | \r | |
d5fb1edf JY |
187 | #define FSP_FSP_INIT FSP_INIT\r |
188 | \r | |
a33a2f62 JY |
189 | /**\r |
190 | This FSP API is used to notify the FSP about the different phases in the boot process.\r | |
191 | This allows the FSP to take appropriate actions as needed during different initialization\r | |
192 | phases. The phases will be platform dependent and will be documented with the FSP\r | |
193 | release. The current FSP supports two notify phases:\r | |
194 | Post PCI enumeration\r | |
195 | Ready To Boot\r | |
196 | \r | |
197 | @param[in] NotifyPhaseParamPtr Address pointer to the NOTIFY_PHASE_PRAMS\r | |
198 | \r | |
d5fb1edf JY |
199 | @retval EFI_SUCCESS The notification was handled successfully.\r |
200 | @retval EFI_UNSUPPORTED The notification was not called in the proper order.\r | |
201 | @retval EFI_INVALID_PARAMETER The notification code is invalid.\r | |
a33a2f62 JY |
202 | **/\r |
203 | typedef\r | |
d5fb1edf JY |
204 | EFI_STATUS\r |
205 | (EFIAPI *FSP_NOTIFY_PHASE) (\r | |
a33a2f62 JY |
206 | IN NOTIFY_PHASE_PARAMS *NotifyPhaseParamPtr\r |
207 | );\r | |
208 | \r | |
d5fb1edf JY |
209 | /**\r |
210 | This FSP API is called after TempRamInit and initializes the memory.\r | |
211 | This FSP API accepts a pointer to a data structure that will be platform dependent\r | |
212 | and defined for each FSP binary. This will be documented in Integration guide with\r | |
213 | each FSP release.\r | |
214 | After FspMemInit completes its execution, it passes the pointer to the HobList and\r | |
215 | returns to the boot loader from where it was called. Bootloader is responsible to \r | |
6ca9135a | 216 | migrate it's stack and data to Memory.\r |
d5fb1edf JY |
217 | FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to\r |
218 | complete the silicon initialization and provides bootloader an opportunity to get\r | |
219 | control after system memory is available and before the temporary RAM is torn down.\r | |
220 | These APIs are mutually exclusive to the FspInit API.\r | |
221 | \r | |
222 | @param[in][out] FspMemoryInitParamPtr Address pointer to the FSP_MEMORY_INIT_PARAMS\r | |
223 | structure.\r | |
224 | \r | |
225 | @retval EFI_SUCCESS FSP execution environment was initialized successfully.\r | |
226 | @retval EFI_INVALID_PARAMETER Input parameters are invalid.\r | |
227 | @retval EFI_UNSUPPORTED The FSP calling conditions were not met.\r | |
228 | @retval EFI_DEVICE_ERROR FSP initialization failed.\r | |
229 | **/\r | |
230 | typedef\r | |
231 | EFI_STATUS\r | |
232 | (EFIAPI *FSP_MEMORY_INIT) (\r | |
233 | IN OUT FSP_MEMORY_INIT_PARAMS *FspMemoryInitParamPtr\r | |
234 | );\r | |
235 | \r | |
236 | \r | |
237 | /**\r | |
238 | This FSP API is called after FspMemoryInit API. This FSP API tears down the temporary\r | |
239 | memory setup by TempRamInit API. This FSP API accepts a pointer to a data structure\r | |
240 | that will be platform dependent and defined for each FSP binary. This will be\r | |
241 | documented in Integration Guide.\r | |
242 | FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to\r | |
243 | complete the silicon initialization and provides bootloader an opportunity to get\r | |
244 | control after system memory is available and before the temporary RAM is torn down.\r | |
245 | These APIs are mutually exclusive to the FspInit API.\r | |
246 | \r | |
247 | @param[in][out] TempRamExitParamPtr Pointer to the Temp Ram Exit parameters structure.\r | |
248 | This structure is normally defined in the Integration Guide.\r | |
249 | And if it is not defined in the Integration Guide, pass NULL.\r | |
250 | \r | |
251 | @retval EFI_SUCCESS FSP execution environment was initialized successfully.\r | |
252 | @retval EFI_INVALID_PARAMETER Input parameters are invalid.\r | |
253 | @retval EFI_UNSUPPORTED The FSP calling conditions were not met.\r | |
254 | @retval EFI_DEVICE_ERROR FSP initialization failed.\r | |
255 | **/\r | |
256 | typedef\r | |
257 | EFI_STATUS\r | |
258 | (EFIAPI *FSP_TEMP_RAM_EXIT) (\r | |
259 | IN OUT VOID *TempRamExitParamPtr\r | |
260 | );\r | |
261 | \r | |
262 | \r | |
263 | /**\r | |
264 | This FSP API is called after TempRamExit API.\r | |
265 | FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to complete the\r | |
266 | silicon initialization.\r | |
267 | These APIs are mutually exclusive to the FspInit API.\r | |
268 | \r | |
269 | @param[in][out] FspSiliconInitParamPtr Pointer to the Silicon Init parameters structure.\r | |
270 | This structure is normally defined in the Integration Guide.\r | |
271 | And if it is not defined in the Integration Guide, pass NULL.\r | |
272 | \r | |
273 | @retval EFI_SUCCESS FSP execution environment was initialized successfully.\r | |
274 | @retval EFI_INVALID_PARAMETER Input parameters are invalid.\r | |
275 | @retval EFI_UNSUPPORTED The FSP calling conditions were not met.\r | |
276 | @retval EFI_DEVICE_ERROR FSP initialization failed.\r | |
277 | **/\r | |
278 | typedef\r | |
279 | EFI_STATUS\r | |
280 | (EFIAPI *FSP_SILICON_INIT) (\r | |
281 | IN OUT VOID *FspSiliconInitParamPtr\r | |
282 | );\r | |
283 | \r | |
a33a2f62 | 284 | ///\r |
d5fb1edf JY |
285 | /// FSP API Return Status Code for backward compatibility with v1.0\r |
286 | ///@{\r | |
287 | #define FSP_SUCCESS EFI_SUCCESS\r | |
288 | #define FSP_INVALID_PARAMETER EFI_INVALID_PARAMETER\r | |
289 | #define FSP_UNSUPPORTED EFI_UNSUPPORTED\r | |
290 | #define FSP_NOT_READY EFI_NOT_READY\r | |
291 | #define FSP_DEVICE_ERROR EFI_DEVICE_ERROR\r | |
292 | #define FSP_OUT_OF_RESOURCES EFI_OUT_OF_RESOURCES\r | |
293 | #define FSP_VOLUME_CORRUPTED EFI_VOLUME_CORRUPTED\r | |
294 | #define FSP_NOT_FOUND EFI_NOT_FOUND\r | |
295 | #define FSP_TIMEOUT EFI_TIMEOUT\r | |
296 | #define FSP_ABORTED EFI_ABORTED\r | |
297 | #define FSP_INCOMPATIBLE_VERSION EFI_INCOMPATIBLE_VERSION\r | |
298 | #define FSP_SECURITY_VIOLATION EFI_SECURITY_VIOLATION\r | |
299 | #define FSP_CRC_ERROR EFI_CRC_ERROR\r | |
300 | ///@}\r | |
a33a2f62 JY |
301 | \r |
302 | #endif\r |