1 /** @file
2   Intel FSP API definition from Intel Firmware Support Package External
3   Architecture Specification v2.0 and above.
4 
5   Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>
6   SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8 **/
9 
10 #ifndef _FSP_API_H_
11 #define _FSP_API_H_
12 
13 #include <Pi/PiStatusCode.h>
14 #include <Base.h>
15 
16 ///
17 /// FSP Reset Status code
18 /// These are defined in FSP EAS v2.4 section 13.2.2 - OEM Status Code
19 /// @{
20 
21 #define ENCODE_RESET_REQUEST(ResetType)  \
22         ((EFI_STATUS)((MAX_BIT >> 1) | (ResetType)))
23 #define FSP_STATUS_RESET_REQUIRED_COLD  ENCODE_RESET_REQUEST(1)
24 #define FSP_STATUS_RESET_REQUIRED_WARM  ENCODE_RESET_REQUEST(2)
25 #define FSP_STATUS_RESET_REQUIRED_3     ENCODE_RESET_REQUEST(3)
26 #define FSP_STATUS_RESET_REQUIRED_4     ENCODE_RESET_REQUEST(4)
27 #define FSP_STATUS_RESET_REQUIRED_5     ENCODE_RESET_REQUEST(5)
28 #define FSP_STATUS_RESET_REQUIRED_6     ENCODE_RESET_REQUEST(6)
29 #define FSP_STATUS_RESET_REQUIRED_7     ENCODE_RESET_REQUEST(7)
30 #define FSP_STATUS_RESET_REQUIRED_8     ENCODE_RESET_REQUEST(8)
31 #define FSP_STATUS_VARIABLE_REQUEST     ENCODE_RESET_REQUEST(10)
32 /// @}
33 
34 ///
35 /// FSP Event related definition.
36 ///
37 #define FSP_EVENT_CODE  0xF5000000
38 #define FSP_POST_CODE   (FSP_EVENT_CODE | 0x00F80000)
39 
40 /*
41   FSP may optionally include the capability of generating events messages to aid in the debugging of firmware issues.
42   These events fall under three catagories: Error, Progress, and Debug. The event reporting mechanism follows the
43   status code services described in section 6 and 7 of the PI Specification v1.7 Volume 3.
44 
45   @param[in] Type                   Indicates the type of event being reported.
46                                     See MdePkg/Include/Pi/PiStatusCode.h for the definition of EFI_STATUS_CODE_TYPE.
47   @param[in] Value                  Describes the current status of a hardware or software entity.
48                                     This includes information about the class and subclass that is used to classify the entity as well as an operation.
49                                     For progress events, the operation is the current activity. For error events, it is the exception.
50                                     For debug events, it is not defined at this time.
51                                     See MdePkg/Include/Pi/PiStatusCode.h for the definition of EFI_STATUS_CODE_VALUE.
52   @param[in] Instance               The enumeration of a hardware or software entity within the system.
53                                     A system may contain multiple entities that match a class/subclass pairing. The instance differentiates between them.
54                                     An instance of 0 indicates that instance information is unavailable, not meaningful, or not relevant.
55                                     Valid instance numbers start with 1.
56   @param[in] *CallerId              This parameter can be used to identify the sub-module within the FSP generating the event.
57                                     This parameter may be NULL.
58   @param[in] *Data                  This optional parameter may be used to pass additional data. The contents can have event-specific data.
59                                     For example, the FSP provides a EFI_STATUS_CODE_STRING_DATA instance to this parameter when sending debug messages.
60                                     This parameter is NULL when no additional data is provided.
61 
62   @retval EFI_SUCCESS               The event was handled successfully.
63   @retval EFI_INVALID_PARAMETER     Input parameters are invalid.
64   @retval EFI_DEVICE_ERROR          The event handler failed.
65 */
66 typedef
67 EFI_STATUS
68 (EFIAPI *FSP_EVENT_HANDLER)(
69   IN          EFI_STATUS_CODE_TYPE   Type,
70   IN          EFI_STATUS_CODE_VALUE  Value,
71   IN          UINT32                 Instance,
72   IN OPTIONAL EFI_GUID               *CallerId,
73   IN OPTIONAL EFI_STATUS_CODE_DATA   *Data
74   );
75 
76 /*
77   Handler for FSP-T debug log messages, provided by the bootloader.
78 
79   @param[in] DebugMessage           A pointer to the debug message to be written to the log.
80   @param[in] MessageLength          Number of bytes to written to the debug log.
81 
82   @retval UINT32                    The return value indicates the number of bytes actually written to
83                                     the debug log. If the return value is less than MessageLength,
84                                     an error occurred.
85 */
86 typedef
87 UINT32
88 (EFIAPI *FSP_DEBUG_HANDLER)(
89   IN CHAR8 *DebugMessage,
90   IN UINT32                 MessageLength
91   );
92 
93 #pragma pack(1)
94 ///
95 /// FSP_UPD_HEADER Configuration.
96 ///
97 typedef struct {
98   ///
99   /// UPD Region Signature. This signature will be
100   /// "XXXXXX_T" for FSP-T
101   /// "XXXXXX_M" for FSP-M
102   /// "XXXXXX_S" for FSP-S
103   /// "XXXXXX_I" for FSP-I
104   /// Where XXXXXX is an unique signature
105   ///
106   UINT64    Signature;
107   ///
108   /// Revision of the Data structure.
109   ///   For FSP spec 2.0/2.1, this value is 1 and only FSPM_UPD having ARCH_UPD.
110   ///   For FSP spec 2.2 and above, this value is 2 and ARCH_UPD present in all UPD structures.
111   ///
112   UINT8     Revision;
113   UINT8     Reserved[23];
114 } FSP_UPD_HEADER;
115 
116 ///
117 /// FSPT_ARCH_UPD Configuration.
118 ///
119 typedef struct {
120   ///
121   /// Revision of the structure is 1 for this version of the specification.
122   ///
123   UINT8                Revision;
124   UINT8                Reserved[3];
125   ///
126   /// Length of the structure in bytes. The current value for this field is 32.
127   ///
128   UINT32               Length;
129   ///
130   /// FspDebugHandler Optional debug handler for the bootloader to receive debug messages
131   /// occurring during FSP execution.
132   ///
133   FSP_DEBUG_HANDLER    FspDebugHandler;
134   UINT8                Reserved1[20];
135 } FSPT_ARCH_UPD;
136 
137 ///
138 /// FSPT_ARCH2_UPD Configuration for FSP 2.4 and above.
139 ///
140 typedef struct {
141   ///
142   /// Revision of the structure is 2 for this version of the specification.
143   ///
144   UINT8                   Revision;
145   UINT8                   Reserved[3];
146   ///
147   /// Length of the structure in bytes. The current value for this field is 32.
148   ///
149   UINT32                  Length;
150   ///
151   /// FspDebugHandler Optional debug handler for the bootloader to receive debug messages
152   /// occurring during FSP execution.
153   ///
154   EFI_PHYSICAL_ADDRESS    FspDebugHandler;
155   UINT8                   Reserved1[16];
156 } FSPT_ARCH2_UPD;
157 
158 ///
159 /// FSPM_ARCH_UPD Configuration.
160 ///
161 typedef struct {
162   ///
163   /// Revision of the structure. For FSP v2.0 value is 1.
164   ///
165   UINT8                Revision;
166   UINT8                Reserved[3];
167   ///
168   /// Pointer to the non-volatile storage (NVS) data buffer.
169   /// If it is NULL it indicates the NVS data is not available.
170   ///
171   /// Note: This ought to be VOID*, but that won't allow calling this binary on x86_64.
172   ///
173   UINT32                      NvsBufferPtr;
174   ///
175   /// Pointer to the temporary stack base address to be
176   /// consumed inside FspMemoryInit() API.
177   ///
178   /// Note: This ought to be VOID*, but that won't allow calling this binary on x86_64.
179   ///
180   UINT32                      StackBase;
181   ///
182   /// Temporary stack size to be consumed inside
183   /// FspMemoryInit() API.
184   ///
185   UINT32               StackSize;
186   ///
187   /// Size of memory to be reserved by FSP below "top
188   /// of low usable memory" for bootloader usage.
189   ///
190   UINT32               BootLoaderTolumSize;
191   ///
192   /// Current boot mode.
193   ///
194   UINT32               BootMode;
195   ///
196   /// Optional event handler for the bootloader to be informed of events occurring during FSP execution.
197   /// This value is only valid if Revision is >= 2.
198   ///
199   /// Note: This ought to be FSP_EVENT_HANDLER*, but that won't allow calling this binary on x86_64.
200   ///
201   UINT32                      FspEventHandler;
202   UINT8                       Reserved1[4];
203 } FSPM_ARCH_UPD;
204 
205 ///
206 /// FSPM_ARCH2_UPD Configuration for FSP 2.4 and above.
207 ///
208 typedef struct {
209   ///
210   /// Revision of the structure is 3 for this version of the specification.
211   ///
212   UINT8                   Revision;
213   UINT8                   Reserved[3];
214   ///
215   /// Length of the structure in bytes. The current value for this field is 64.
216   ///
217   UINT32                  Length;
218   ///
219   /// Pointer to the non-volatile storage (NVS) data buffer.
220   /// If it is NULL it indicates the NVS data is not available.
221   /// This value is deprecated starting with v2.4 of the FSP specification,
222   /// and will be removed in an upcoming version of the FSP specification.
223   ///
224   EFI_PHYSICAL_ADDRESS    NvsBufferPtr;
225   ///
226   /// Pointer to the temporary stack base address to be
227   /// consumed inside FspMemoryInit() API.
228   ///
229   EFI_PHYSICAL_ADDRESS    StackBase;
230   ///
231   /// Temporary stack size to be consumed inside
232   /// FspMemoryInit() API.
233   ///
234   UINT64                  StackSize;
235   ///
236   /// Size of memory to be reserved by FSP below "top
237   /// of low usable memory" for bootloader usage.
238   ///
239   UINT32                  BootLoaderTolumSize;
240   ///
241   /// Current boot mode.
242   ///
243   UINT32                  BootMode;
244   ///
245   /// Optional event handler for the bootloader to be informed of events occurring during FSP execution.
246   /// This value is only valid if Revision is >= 2.
247   ///
248   EFI_PHYSICAL_ADDRESS    FspEventHandler;
249   UINT8                   Reserved1[16];
250 } FSPM_ARCH2_UPD;
251 
252 ///
253 /// FSPS_ARCH_UPD Configuration.
254 ///
255 typedef struct {
256   ///
257   /// Revision of the structure is 1 for this version of the specification.
258   ///
259   UINT8                Revision;
260   UINT8                Reserved[3];
261   ///
262   /// Length of the structure in bytes. The current value for this field is 32.
263   ///
264   UINT32               Length;
265   ///
266   /// FspEventHandler Optional event handler for the bootloader to be informed of events
267   /// occurring during FSP execution.
268   ///
269   FSP_EVENT_HANDLER    FspEventHandler;
270   ///
271   /// A FSP binary may optionally implement multi-phase silicon initialization,
272   /// This is only supported if the FspMultiPhaseSiInitEntryOffset field in FSP_INFO_HEADER
273   /// is non-zero.
274   /// To enable multi-phase silicon initialization, the bootloader must set
275   /// EnableMultiPhaseSiliconInit to a non-zero value.
276   ///
277   UINT8                EnableMultiPhaseSiliconInit;
278   UINT8                Reserved1[19];
279 } FSPS_ARCH_UPD;
280 
281 ///
282 /// FSPS_ARCH2_UPD Configuration for FSP 2.4 and above.
283 ///
284 typedef struct {
285   ///
286   /// Revision of the structure is 2 for this version of the specification.
287   ///
288   UINT8                   Revision;
289   UINT8                   Reserved[3];
290   ///
291   /// Length of the structure in bytes. The current value for this field is 32.
292   ///
293   UINT32                  Length;
294   ///
295   /// FspEventHandler Optional event handler for the bootloader to be informed of events
296   /// occurring during FSP execution.
297   ///
298   EFI_PHYSICAL_ADDRESS    FspEventHandler;
299   UINT8                   Reserved1[16];
300 } FSPS_ARCH2_UPD;
301 
302 ///
303 /// FSPI_ARCH_UPD Configuration.
304 ///
305 typedef struct {
306   ///
307   /// Revision of the structure is 1 for this version of the specification.
308   ///
309   UINT8                   Revision;
310   UINT8                   Reserved[3];
311   ///
312   /// Length of the structure in bytes. The current value for this field is 64.
313   ///
314   UINT32                  Length;
315   ///
316   /// The physical memory-mapped base address of the bootloader SMM firmware volume (FV).
317   ///
318   EFI_PHYSICAL_ADDRESS    BootloaderSmmFvBaseAddress;
319   ///
320   /// The length in bytes of the bootloader SMM firmware volume (FV).
321   ///
322   UINT64                  BootloaderSmmFvLength;
323   ///
324   /// The physical memory-mapped base address of the bootloader SMM FV context data.
325   /// This data is provided to bootloader SMM drivers through a HOB by the FSP MM Foundation.
326   ///
327   EFI_PHYSICAL_ADDRESS    BootloaderSmmFvContextData;
328   ///
329   /// The length in bytes of the bootloader SMM FV context data.
330   /// This data is provided to bootloader SMM drivers through a HOB by the FSP MM Foundation.
331   ///
332   UINT16                  BootloaderSmmFvContextDataLength;
333   UINT8                   Reserved1[30];
334 } FSPI_ARCH_UPD;
335 
336 ///
337 /// FSPT_UPD_COMMON Configuration.
338 ///
339 typedef struct {
340   ///
341   /// FSP_UPD_HEADER Configuration.
342   ///
343   FSP_UPD_HEADER    FspUpdHeader;
344 } FSPT_UPD_COMMON;
345 
346 ///
347 /// FSPT_UPD_COMMON Configuration for FSP spec. 2.2 and above.
348 ///
349 typedef struct {
350   ///
351   /// FSP_UPD_HEADER Configuration.
352   ///
353   FSP_UPD_HEADER    FspUpdHeader;
354 
355   ///
356   /// FSPT_ARCH_UPD Configuration.
357   ///
358   FSPT_ARCH_UPD     FsptArchUpd;
359 } FSPT_UPD_COMMON_FSP22;
360 
361 ///
362 /// FSPT_UPD_COMMON Configuration for FSP spec. 2.4 and above.
363 ///
364 typedef struct {
365   ///
366   /// FSP_UPD_HEADER Configuration.
367   ///
368   FSP_UPD_HEADER    FspUpdHeader;
369 
370   ///
371   /// FSPT_ARCH2_UPD Configuration.
372   ///
373   FSPT_ARCH2_UPD    FsptArchUpd;
374 } FSPT_UPD_COMMON_FSP24;
375 
376 ///
377 /// FSPM_UPD_COMMON Configuration.
378 ///
379 typedef struct {
380   ///
381   /// FSP_UPD_HEADER Configuration.
382   ///
383   FSP_UPD_HEADER    FspUpdHeader;
384   ///
385   /// FSPM_ARCH_UPD Configuration.
386   ///
387   FSPM_ARCH_UPD     FspmArchUpd;
388 } FSPM_UPD_COMMON;
389 
390 ///
391 /// FSPM_UPD_COMMON Configuration for FSP spec. 2.4 and above.
392 ///
393 typedef struct {
394   ///
395   /// FSP_UPD_HEADER Configuration.
396   ///
397   FSP_UPD_HEADER    FspUpdHeader;
398   ///
399   /// FSPM_ARCH2_UPD Configuration.
400   ///
401   FSPM_ARCH2_UPD    FspmArchUpd;
402 } FSPM_UPD_COMMON_FSP24;
403 
404 ///
405 /// FSPS_UPD_COMMON Configuration.
406 ///
407 typedef struct {
408   ///
409   /// FSP_UPD_HEADER Configuration.
410   ///
411   FSP_UPD_HEADER    FspUpdHeader;
412 } FSPS_UPD_COMMON;
413 
414 ///
415 /// FSPS_UPD_COMMON Configuration for FSP spec. 2.2 and above.
416 ///
417 typedef struct {
418   ///
419   /// FSP_UPD_HEADER Configuration.
420   ///
421   FSP_UPD_HEADER    FspUpdHeader;
422 
423   ///
424   /// FSPS_ARCH_UPD Configuration.
425   ///
426   FSPS_ARCH_UPD     FspsArchUpd;
427 } FSPS_UPD_COMMON_FSP22;
428 
429 ///
430 /// FSPS_UPD_COMMON Configuration for FSP spec. 2.4 and above.
431 ///
432 typedef struct {
433   ///
434   /// FSP_UPD_HEADER Configuration.
435   ///
436   FSP_UPD_HEADER    FspUpdHeader;
437 
438   ///
439   /// FSPS_ARCH2_UPD Configuration.
440   ///
441   FSPS_ARCH2_UPD    FspsArchUpd;
442 } FSPS_UPD_COMMON_FSP24;
443 
444 ///
445 /// FSPI_UPD_COMMON Configuration.
446 ///
447 typedef struct {
448   ///
449   /// FSP_UPD_HEADER Configuration.
450   ///
451   FSP_UPD_HEADER    FspUpdHeader;
452 
453   ///
454   /// FSPI_ARCH_UPD Configuration.
455   ///
456   FSPI_ARCH_UPD     FspiArchUpd;
457 } FSPI_UPD_COMMON;
458 
459 ///
460 /// Enumeration of FSP_INIT_PHASE for NOTIFY_PHASE.
461 ///
462 typedef enum {
463   ///
464   /// This stage is notified when the bootloader completes the
465   /// PCI enumeration and the resource allocation for the
466   /// PCI devices is complete.
467   ///
468   EnumInitPhaseAfterPciEnumeration = 0x20,
469   ///
470   /// This stage is notified just before the bootloader hand-off
471   /// to the OS loader.
472   ///
473   EnumInitPhaseReadyToBoot = 0x40,
474   ///
475   /// This stage is notified just before the firmware/Preboot
476   /// environment transfers management of all system resources
477   /// to the OS or next level execution environment.
478   ///
479   EnumInitPhaseEndOfFirmware = 0xF0
480 } FSP_INIT_PHASE;
481 
482 ///
483 /// Definition of NOTIFY_PHASE_PARAMS.
484 ///
485 typedef struct {
486   ///
487   /// Notification phase used for NotifyPhase API
488   ///
489   FSP_INIT_PHASE    Phase;
490 } NOTIFY_PHASE_PARAMS;
491 
492 ///
493 /// Action definition for FspMultiPhaseSiInit API
494 ///
495 typedef enum {
496   EnumMultiPhaseGetNumberOfPhases       = 0x0,
497   EnumMultiPhaseExecutePhase            = 0x1,
498   EnumMultiPhaseGetVariableRequestInfo  = 0x2,
499   EnumMultiPhaseCompleteVariableRequest = 0x3
500 } FSP_MULTI_PHASE_ACTION;
501 
502 typedef enum {
503   EnumFspVariableRequestGetVariable         = 0x0,
504   EnumFspVariableRequestGetNextVariableName = 0x1,
505   EnumFspVariableRequestSetVariable         = 0x2,
506   EnumFspVariableRequestQueryVariableInfo   = 0x3
507 } FSP_VARIABLE_REQUEST_TYPE;
508 
509 #pragma pack(16)
510 typedef struct {
511   IN     FSP_VARIABLE_REQUEST_TYPE    VariableRequest;
512   IN OUT CHAR16                       *VariableName;
513   IN OUT UINT64                       *VariableNameSize;
514   IN OUT EFI_GUID                     *VariableGuid;
515   IN OUT UINT32                       *Attributes;
516   IN OUT UINT64                       *DataSize;
517   IN OUT VOID                         *Data;
518   OUT    UINT64                       *MaximumVariableStorageSize;
519   OUT    UINT64                       *RemainingVariableStorageSize;
520   OUT    UINT64                       *MaximumVariableSize;
521 } FSP_MULTI_PHASE_VARIABLE_REQUEST_INFO_PARAMS;
522 
523 typedef struct {
524   EFI_STATUS    VariableRequestStatus;
525 } FSP_MULTI_PHASE_COMPLETE_VARIABLE_REQUEST_PARAMS;
526 #pragma pack()
527 
528 ///
529 /// Data structure returned by FSP when bootloader calling
530 /// FspMultiPhaseSiInit API with action 0 (EnumMultiPhaseGetNumberOfPhases)
531 ///
532 typedef struct {
533   UINT32    NumberOfPhases;
534   UINT32    PhasesExecuted;
535 } FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS;
536 
537 ///
538 /// FspMultiPhaseSiInit function parameter.
539 ///
540 /// For action 0 (EnumMultiPhaseGetNumberOfPhases):
541 ///   - PhaseIndex must be 0.
542 ///   - MultiPhaseParamPtr should point to an instance of FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS.
543 ///
544 /// For action 1 (EnumMultiPhaseExecutePhase):
545 ///   - PhaseIndex will be the phase that will be executed by FSP.
546 ///   - MultiPhaseParamPtr shall be NULL.
547 ///
548 typedef struct {
549   IN     FSP_MULTI_PHASE_ACTION    MultiPhaseAction;
550   IN     UINT32                    PhaseIndex;
551   IN OUT VOID                      *MultiPhaseParamPtr;
552 } FSP_MULTI_PHASE_PARAMS;
553 
554 #pragma pack()
555 
556 /**
557   This FSP API is called soon after coming out of reset and before memory and stack is
558   available. This FSP API will load the microcode update, enable code caching for the
559   region specified by the boot loader and also setup a temporary stack to be used until
560   main memory is initialized.
561 
562   A hardcoded stack can be set up with the following values, and the "esp" register
563   initialized to point to this hardcoded stack.
564   1. The return address where the FSP will return control after setting up a temporary
565      stack.
566   2. A pointer to the input parameter structure
567 
568   However, since the stack is in ROM and not writeable, this FSP API cannot be called
569   using the "call" instruction, but needs to be jumped to.
570 
571   @param[in] FsptUpdDataPtr     Pointer to the FSPT_UPD data structure.
572 
573   @retval EFI_SUCCESS           Temporary RAM was initialized successfully.
574   @retval EFI_INVALID_PARAMETER Input parameters are invalid.
575   @retval EFI_UNSUPPORTED       The FSP calling conditions were not met.
576   @retval EFI_DEVICE_ERROR      Temp RAM initialization failed.
577 
578   If this function is successful, the FSP initializes the ECX and EDX registers to point to
579   a temporary but writeable memory range available to the boot loader and returns with
580   FSP_SUCCESS in register EAX. Register ECX points to the start of this temporary
581   memory range and EDX points to the end of the range. Boot loader is free to use the
582   whole range described. Typically the boot loader can reload the ESP register to point
583   to the end of this returned range so that it can be used as a standard stack.
584 **/
585 typedef
586 EFI_STATUS
587 (EFIAPI *FSP_TEMP_RAM_INIT)(
588   IN  VOID    *FsptUpdDataPtr
589   );
590 
591 /**
592   This FSP API is used to notify the FSP about the different phases in the boot process.
593   This allows the FSP to take appropriate actions as needed during different initialization
594   phases. The phases will be platform dependent and will be documented with the FSP
595   release. The current FSP supports two notify phases:
596     Post PCI enumeration
597     Ready To Boot
598 
599   @param[in] NotifyPhaseParamPtr Address pointer to the NOTIFY_PHASE_PRAMS
600 
601   @retval EFI_SUCCESS           The notification was handled successfully.
602   @retval EFI_UNSUPPORTED       The notification was not called in the proper order.
603   @retval EFI_INVALID_PARAMETER The notification code is invalid.
604 **/
605 typedef
606 EFI_STATUS
607 (EFIAPI *FSP_NOTIFY_PHASE)(
608   IN NOTIFY_PHASE_PARAMS *NotifyPhaseParamPtr
609   );
610 
611 /**
612   This FSP API is called after TempRamInit and initializes the memory.
613   This FSP API accepts a pointer to a data structure that will be platform dependent
614   and defined for each FSP binary. This will be documented in Integration guide with
615   each FSP release.
616   After FspMemInit completes its execution, it passes the pointer to the HobList and
617   returns to the boot loader from where it was called. BootLoader is responsible to
618   migrate its stack and data to Memory.
619   FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to
620   complete the silicon initialization and provides bootloader an opportunity to get
621   control after system memory is available and before the temporary RAM is torn down.
622 
623   @param[in]  FspmUpdDataPtr          Pointer to the FSPM_UPD data structure.
624   @param[out] HobListPtr              Pointer to receive the address of the HOB list.
625 
626   @retval EFI_SUCCESS                 FSP execution environment was initialized successfully.
627   @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
628   @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
629   @retval EFI_DEVICE_ERROR            FSP initialization failed.
630   @retval EFI_OUT_OF_RESOURCES        Stack range requested by FSP is not met.
631   @retval FSP_STATUS_RESET_REQUIREDx  A reset is required. These status codes will not be returned during S3.
632 **/
633 typedef
634 EFI_STATUS
635 (EFIAPI *FSP_MEMORY_INIT)(
636   IN  VOID    *FspmUpdDataPtr,
637   OUT VOID    **HobListPtr
638   );
639 
640 /**
641   This FSP API is called after FspMemoryInit API. This FSP API tears down the temporary
642   memory setup by TempRamInit API. This FSP API accepts a pointer to a data structure
643   that will be platform dependent and defined for each FSP binary. This will be
644   documented in Integration Guide.
645   FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to
646   complete the silicon initialization and provides bootloader an opportunity to get
647   control after system memory is available and before the temporary RAM is torn down.
648 
649   @param[in] TempRamExitParamPtr Pointer to the Temp Ram Exit parameters structure.
650                                  This structure is normally defined in the Integration Guide.
651                                  And if it is not defined in the Integration Guide, pass NULL.
652 
653   @retval EFI_SUCCESS            FSP execution environment was initialized successfully.
654   @retval EFI_INVALID_PARAMETER  Input parameters are invalid.
655   @retval EFI_UNSUPPORTED        The FSP calling conditions were not met.
656   @retval EFI_DEVICE_ERROR       FSP initialization failed.
657 **/
658 typedef
659 EFI_STATUS
660 (EFIAPI *FSP_TEMP_RAM_EXIT)(
661   IN  VOID    *TempRamExitParamPtr
662   );
663 
664 /**
665   This FSP API is called after TempRamExit API.
666   FspMemoryInit, TempRamExit and FspSiliconInit APIs provide an alternate method to complete the
667   silicon initialization.
668 
669   @param[in] FspsUpdDataPtr     Pointer to the FSPS_UPD data structure.
670                                 If NULL, FSP will use the default parameters.
671 
672   @retval EFI_SUCCESS                 FSP execution environment was initialized successfully.
673   @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
674   @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
675   @retval EFI_DEVICE_ERROR            FSP initialization failed.
676   @retval FSP_STATUS_RESET_REQUIREDx  A reset is required. These status codes will not be returned during S3.
677 **/
678 typedef
679 EFI_STATUS
680 (EFIAPI *FSP_SILICON_INIT)(
681   IN  VOID    *FspsUpdDataPtr
682   );
683 
684 /**
685   This FSP API is expected to be called after FspSiliconInit but before FspNotifyPhase.
686   This FSP API provides multi-phase silicon initialization; which brings greater modularity
687   beyond the existing FspSiliconInit() API. Increased modularity is achieved by adding an
688   extra API to FSP-S. This allows the bootloader to add board specific initialization steps
689   throughout the SiliconInit flow as needed.
690 
691   @param[in,out] FSP_MULTI_PHASE_PARAMS   For action - EnumMultiPhaseGetNumberOfPhases:
692                                             FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr will contain
693                                             how many phases supported by FSP.
694                                           For action - EnumMultiPhaseExecutePhase:
695                                             FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr shall be NULL.
696   @retval EFI_SUCCESS                     FSP execution environment was initialized successfully.
697   @retval EFI_INVALID_PARAMETER           Input parameters are invalid.
698   @retval EFI_UNSUPPORTED                 The FSP calling conditions were not met.
699   @retval EFI_DEVICE_ERROR                FSP initialization failed.
700   @retval FSP_STATUS_RESET_REQUIREDx      A reset is required. These status codes will not be returned during S3.
701 **/
702 typedef
703 EFI_STATUS
704 (EFIAPI *FSP_MULTI_PHASE_SI_INIT)(
705   IN FSP_MULTI_PHASE_PARAMS     *MultiPhaseSiInitParamPtr
706   );
707 
708 /**
709   This FSP API initializes SMM and provide any OS runtime silicon services,
710   including Reliability, Availability, and Serviceability (RAS) features implemented by the CPU.
711 
712   @param[in] FspiUpdDataPtr     Pointer to the FSPI_UPD data structure.
713                                 If NULL, FSP will use the default parameters.
714 
715   @retval EFI_SUCCESS                 FSP execution environment was initialized successfully.
716   @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
717   @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
718   @retval EFI_DEVICE_ERROR            FSP initialization failed.
719   @retval FSP_STATUS_RESET_REQUIREDx  A reset is required. These status codes will not be returned during S3.
720 **/
721 typedef
722 EFI_STATUS
723 (EFIAPI *FSP_SMM_INIT)(
724   IN VOID          *FspiUpdDataPtr
725   );
726 
727 /**
728   This FSP API provides multi-phase memory and silicon initialization, which brings greater modularity to the existing
729   FspMemoryInit() and FspSiliconInit() API. Increased modularity is achieved by adding an extra API to FSP-M and FSP-S.
730   This allows the bootloader to add board specific initialization steps throughout the MemoryInit and SiliconInit flows as needed.
731   The FspMemoryInit() API is always called before FspMultiPhaseMemInit(); it is the first phase of memory initialization. Similarly,
732   the FspSiliconInit() API is always called before FspMultiPhaseSiInit(); it is the first phase of silicon initialization.
733   After the first phase, subsequent phases are invoked by calling the FspMultiPhaseMem/SiInit() API.
734   The FspMultiPhaseMemInit() API may only be called after the FspMemoryInit() API and before the FspSiliconInit() API;
735   or in the case that FSP-T is being used, before the TempRamExit() API. The FspMultiPhaseSiInit() API may only be called after
736   the FspSiliconInit() API and before NotifyPhase() API; or in the case that FSP-I is being used, before the FspSmmInit() API.
737   The multi-phase APIs may not be called at any other time.
738 
739   @param[in,out] FSP_MULTI_PHASE_PARAMS   For action - EnumMultiPhaseGetNumberOfPhases:
740                                             FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr will contain
741                                             how many phases supported by FSP.
742                                           For action - EnumMultiPhaseExecutePhase:
743                                             FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr shall be NULL.
744   @retval EFI_SUCCESS                     FSP execution environment was initialized successfully.
745   @retval EFI_INVALID_PARAMETER           Input parameters are invalid.
746   @retval EFI_UNSUPPORTED                 The FSP calling conditions were not met.
747   @retval EFI_DEVICE_ERROR                FSP initialization failed.
748   @retval FSP_STATUS_RESET_REQUIRED_*     A reset is required. These status codes will not be returned during S3.
749   @retval FSP_STATUS_VARIABLE_REQUEST     A variable request has been made by FSP that needs boot loader handling.
750 **/
751 typedef
752 EFI_STATUS
753 (EFIAPI *FSP_MULTI_PHASE_INIT)(
754   IN FSP_MULTI_PHASE_PARAMS     *MultiPhaseInitParamPtr
755   );
756 
757 #endif
758