2 Provide FSP API related function.
4 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #include <Guid/FspHeaderFile.h>
19 #include <Library/FspApiLib.h>
20 #include <Library/BaseMemoryLib.h>
23 Wrapper for a thunk to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
26 @param[in] Function The 32bit code entry to be executed.
27 @param[in] Param1 The first parameter to pass to 32bit code.
38 Find FSP header pointer.
40 @param[in] FlashFvFspBase Flash address of FSP FV.
42 @return FSP header pointer.
47 IN EFI_PHYSICAL_ADDRESS FlashFvFspBase
52 CheckPointer
= (UINT8
*) (UINTN
) FlashFvFspBase
;
54 if (((EFI_FIRMWARE_VOLUME_HEADER
*)CheckPointer
)->Signature
!= EFI_FVH_SIGNATURE
) {
58 if (((EFI_FIRMWARE_VOLUME_HEADER
*)CheckPointer
)->ExtHeaderOffset
!= 0) {
59 CheckPointer
= CheckPointer
+ ((EFI_FIRMWARE_VOLUME_HEADER
*)CheckPointer
)->ExtHeaderOffset
;
60 CheckPointer
= CheckPointer
+ ((EFI_FIRMWARE_VOLUME_EXT_HEADER
*)CheckPointer
)->ExtHeaderSize
;
61 CheckPointer
= (UINT8
*) ALIGN_POINTER (CheckPointer
, 8);
63 CheckPointer
= CheckPointer
+ ((EFI_FIRMWARE_VOLUME_HEADER
*)CheckPointer
)->HeaderLength
;
66 if (!CompareGuid (&((EFI_FFS_FILE_HEADER
*)CheckPointer
)->Name
, &gFspHeaderFileGuid
)) {
70 CheckPointer
= CheckPointer
+ sizeof (EFI_FFS_FILE_HEADER
);
72 if (((EFI_RAW_SECTION
*)CheckPointer
)->Type
!= EFI_SECTION_RAW
) {
76 CheckPointer
= CheckPointer
+ sizeof (EFI_RAW_SECTION
);
78 return (FSP_INFO_HEADER
*)CheckPointer
;
82 Call FSP API - FspInit.
84 @param[in] FspHeader FSP header pointer.
85 @param[in] FspInitParams Address pointer to the FSP_INIT_PARAMS structure.
87 @return FSP status returned by FspInit API.
92 IN FSP_INFO_HEADER
*FspHeader
,
93 IN FSP_INIT_PARAMS
*FspInitParams
96 FSP_FSP_INIT FspInitApi
;
99 FspInitApi
= (FSP_FSP_INIT
)(UINTN
)(FspHeader
->ImageBase
+ FspHeader
->FspInitEntryOffset
);
100 FspStatus
= Execute32BitCode ((UINTN
)FspInitApi
, (UINTN
)FspInitParams
);
106 Call FSP API - FspNotifyPhase.
108 @param[in] FspHeader FSP header pointer.
109 @param[in] NotifyPhaseParams Address pointer to the NOTIFY_PHASE_PARAMS structure.
111 @return FSP status returned by FspNotifyPhase API.
116 IN FSP_INFO_HEADER
*FspHeader
,
117 IN NOTIFY_PHASE_PARAMS
*NotifyPhaseParams
120 FSP_NOTIFY_PHASE NotifyPhaseApi
;
121 FSP_STATUS FspStatus
;
123 NotifyPhaseApi
= (FSP_NOTIFY_PHASE
)(UINTN
)(FspHeader
->ImageBase
+ FspHeader
->NotifyPhaseEntryOffset
);
124 FspStatus
= Execute32BitCode ((UINTN
)NotifyPhaseApi
, (UINTN
)NotifyPhaseParams
);