From d8043ce905a5832f911361ef30be28765afbdc6b Mon Sep 17 00:00:00 2001 From: "Yao, Jiewen" Date: Wed, 11 Feb 2015 04:41:46 +0000 Subject: Update IntelFspWrapperPkg according to FSP1.1. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: "Yao, Jiewen" git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16826 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/BaseFspApiLib/BaseFspApiLib.inf | 1 + .../Library/BaseFspApiLib/FspApiLib.c | 118 ++++++++++++++++++--- .../Library/BaseFspApiLib/IA32/DispatchExecute.c | 12 +-- .../Library/BaseFspApiLib/X64/DispatchExecute.c | 6 +- 4 files changed, 113 insertions(+), 24 deletions(-) (limited to 'IntelFspWrapperPkg/Library/BaseFspApiLib') diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf b/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf index 2608bf1043..2df1683599 100644 --- a/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf +++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/BaseFspApiLib.inf @@ -61,6 +61,7 @@ IntelFspWrapperPkg/IntelFspWrapperPkg.dec [LibraryClasses] + BaseLib [Guids] gFspHeaderFileGuid ## CONSUMES ## GUID diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c b/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c index abe61b7aff..162d244665 100644 --- a/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c +++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/FspApiLib.c @@ -1,7 +1,7 @@ /** @file Provide FSP API related function. - Copyright (c) 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -17,6 +17,7 @@ #include #include +#include #include /** @@ -26,9 +27,9 @@ @param[in] Function The 32bit code entry to be executed. @param[in] Param1 The first parameter to pass to 32bit code. - @return FSP_STATUS. + @return EFI_STATUS. **/ -FSP_STATUS +EFI_STATUS Execute32BitCode ( IN UINT64 Function, IN UINT64 Param1 @@ -84,22 +85,25 @@ FspFindFspHeader ( @param[in] FspHeader FSP header pointer. @param[in] FspInitParams Address pointer to the FSP_INIT_PARAMS structure. - @return FSP status returned by FspInit API. + @return EFI status returned by FspInit API. **/ -FSP_STATUS +EFI_STATUS EFIAPI CallFspInit ( IN FSP_INFO_HEADER *FspHeader, IN FSP_INIT_PARAMS *FspInitParams ) { - FSP_FSP_INIT FspInitApi; - FSP_STATUS FspStatus; + FSP_INIT FspInitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; - FspInitApi = (FSP_FSP_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspInitEntryOffset); - FspStatus = Execute32BitCode ((UINTN)FspInitApi, (UINTN)FspInitParams); + FspInitApi = (FSP_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspInitEntryOffset); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)FspInitApi, (UINTN)FspInitParams); + SetInterruptState (InterruptState); - return FspStatus; + return Status; } /** @@ -108,9 +112,9 @@ CallFspInit ( @param[in] FspHeader FSP header pointer. @param[in] NotifyPhaseParams Address pointer to the NOTIFY_PHASE_PARAMS structure. - @return FSP status returned by FspNotifyPhase API. + @return EFI status returned by FspNotifyPhase API. **/ -FSP_STATUS +EFI_STATUS EFIAPI CallFspNotifyPhase ( IN FSP_INFO_HEADER *FspHeader, @@ -118,10 +122,94 @@ CallFspNotifyPhase ( ) { FSP_NOTIFY_PHASE NotifyPhaseApi; - FSP_STATUS FspStatus; + EFI_STATUS Status; + BOOLEAN InterruptState; NotifyPhaseApi = (FSP_NOTIFY_PHASE)(UINTN)(FspHeader->ImageBase + FspHeader->NotifyPhaseEntryOffset); - FspStatus = Execute32BitCode ((UINTN)NotifyPhaseApi, (UINTN)NotifyPhaseParams); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)NotifyPhaseApi, (UINTN)NotifyPhaseParams); + SetInterruptState (InterruptState); - return FspStatus; + return Status; +} + +/** + Call FSP API - FspMemoryInit. + + @param[in] FspHeader FSP header pointer. + @param[in,out] FspMemoryInitParams Address pointer to the FSP_MEMORY_INIT_PARAMS structure. + + @return EFI status returned by FspMemoryInit API. +**/ +EFI_STATUS +EFIAPI +CallFspMemoryInit ( + IN FSP_INFO_HEADER *FspHeader, + IN OUT FSP_MEMORY_INIT_PARAMS *FspMemoryInitParams + ) +{ + FSP_MEMORY_INIT FspMemoryInitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; + + FspMemoryInitApi = (FSP_MEMORY_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspMemoryInitEntryOffset); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)FspMemoryInitApi, (UINTN)FspMemoryInitParams); + SetInterruptState (InterruptState); + + return Status; +} + +/** + Call FSP API - TempRamExit. + + @param[in] FspHeader FSP header pointer. + @param[in,out] TempRamExitParam Address pointer to the TempRamExit parameters structure. + + @return EFI status returned by TempRamExit API. +**/ +EFI_STATUS +EFIAPI +CallTempRamExit ( + IN FSP_INFO_HEADER *FspHeader, + IN OUT VOID *TempRamExitParam + ) +{ + FSP_TEMP_RAM_EXIT TempRamExitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; + + TempRamExitApi = (FSP_TEMP_RAM_EXIT)(UINTN)(FspHeader->ImageBase + FspHeader->TempRamExitEntryOffset); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)TempRamExitApi, (UINTN)TempRamExitParam); + SetInterruptState (InterruptState); + + return Status; +} + +/** + Call FSP API - FspSiliconInit. + + @param[in] FspHeader FSP header pointer. + @param[in,out] FspSiliconInitParam Address pointer to the Silicon Init parameters structure. + + @return EFI status returned by FspSiliconInit API. +**/ +EFI_STATUS +EFIAPI +CallFspSiliconInit ( + IN FSP_INFO_HEADER *FspHeader, + IN OUT VOID *FspSiliconInitParam + ) +{ + FSP_SILICON_INIT FspSiliconInitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; + + FspSiliconInitApi = (FSP_SILICON_INIT)(UINTN)(FspHeader->ImageBase + FspHeader->FspSiliconInitEntryOffset); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)FspSiliconInitApi, (UINTN)FspSiliconInitParam); + SetInterruptState (InterruptState); + + return Status; } diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c b/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c index 15d0a023b8..8bc3501b50 100644 --- a/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c +++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/IA32/DispatchExecute.c @@ -1,7 +1,7 @@ /** @file Execute 32-bit code in Protected Mode. - Copyright (c) 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -16,8 +16,8 @@ #include typedef -FSP_STATUS -(FSPAPI *FSP_FUNCTION) ( +EFI_STATUS +(EFIAPI *FSP_FUNCTION) ( IN VOID *Param1 ); @@ -28,16 +28,16 @@ FSP_STATUS @param[in] Function The 32bit code entry to be executed. @param[in] Param1 The first parameter to pass to 32bit code. - @return FSP_STATUS. + @return EFI_STATUS. **/ -FSP_STATUS +EFI_STATUS Execute32BitCode ( IN UINT64 Function, IN UINT64 Param1 ) { FSP_FUNCTION EntryFunc; - FSP_STATUS Status; + EFI_STATUS Status; EntryFunc = (FSP_FUNCTION) (UINTN) (Function); Status = EntryFunc ((VOID *)(UINTN)Param1); diff --git a/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c b/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c index 17a9ebc8b5..e2f4422534 100644 --- a/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c +++ b/IntelFspWrapperPkg/Library/BaseFspApiLib/X64/DispatchExecute.c @@ -3,7 +3,7 @@ Provide a thunk function to transition from long mode to compatibility mode to execute 32-bit code and then transit back to long mode. - Copyright (c) 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -81,9 +81,9 @@ AsmExecute32BitCode ( @param[in] Function The 32bit code entry to be executed. @param[in] Param1 The first parameter to pass to 32bit code. - @return FSP_STATUS. + @return EFI_STATUS. **/ -FSP_STATUS +EFI_STATUS Execute32BitCode ( IN UINT64 Function, IN UINT64 Param1 -- cgit v1.2.3