Re: [edk2-devel][PATCH v1] IntelFsp2Pkg: Adding FspHelperLib
Hi., Instead of Hardcoded FSP ImageBase as 0x1C in FspHelper.nasm, can we have struct from there we can get it. So that in future if the Header is changing assembly code will not get impacted. Regards, Ashraf Ali S Intel Technology India Pvt. Ltd. -Original Message- From: Kuo, Ted Sent: Monday, November 7, 2022 2:14 PM To: devel@edk2.groups.io Cc: Chiu, Chasel ; Desimone, Nathaniel L ; Zeng, Star ; S, Ashraf Ali ; Duggapu, Chinni B ; Chan, Amy Subject: [edk2-devel][PATCH v1] IntelFsp2Pkg: Adding FspHelperLib REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4128 Adding FspHelperLib for platform code to consume. There will be another patch raised later for FspSecCore to consume FspHelperLib. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ashraf Ali S Cc: Chinni B Duggapu Cc: Amy Chan Signed-off-by: Ted Kuo --- IntelFsp2Pkg/FspSecCore/SecFsp.h | 25 +- IntelFsp2Pkg/Include/Library/FspHelperLib.h | 35 + IntelFsp2Pkg/IntelFsp2Pkg.dsc | 2 + .../BaseFspHelperLib/BaseFspHelperLib.inf | 50 +++ .../BaseFspHelperLib/Ia32/FspHelper.nasm | 35 + .../BaseFspHelperLib/X64/FspHelper.nasm | 34 + 6 files changed, 157 insertions(+), 24 deletions(-) create mode 100644 IntelFsp2Pkg/Include/Library/FspHelperLib.h create mode 100644 IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf create mode 100644 IntelFsp2Pkg/Library/BaseFspHelperLib/Ia32/FspHelper.nasm create mode 100644 IntelFsp2Pkg/Library/BaseFspHelperLib/X64/FspHelper.nasm diff --git a/IntelFsp2Pkg/FspSecCore/SecFsp.h b/IntelFsp2Pkg/FspSecCore/SecFsp.h index d7a5976c12..f12769890f 100644 --- a/IntelFsp2Pkg/FspSecCore/SecFsp.h +++ b/IntelFsp2Pkg/FspSecCore/SecFsp.h @@ -17,6 +17,7 @@ #include #include #include +#include #define FSP_MCUD_SIGNATURE SIGNATURE_32 ('M', 'C', 'U', 'D') #define FSP_PER0_SIGNATURE SIGNATURE_32 ('P', 'E', 'R', '0')@@ -64,28 +65,4 @@ FspDataPointerFixUp ( IN UINTN OffsetGap ); -/**- This interface returns the base address of FSP binary.-- @return FSP binary base address.--**/-UINTN-EFIAPI-AsmGetFspBaseAddress (- VOID- );--/**- This interface gets FspInfoHeader pointer-- @return FSP binary base address.--**/-UINTN-EFIAPI-AsmGetFspInfoHeader (- VOID- );- #endifdiff --git a/IntelFsp2Pkg/Include/Library/FspHelperLib.h b/IntelFsp2Pkg/Include/Library/FspHelperLib.h new file mode 100644 index 00..84b74fa7aa --- /dev/null +++ b/IntelFsp2Pkg/Include/Library/FspHelperLib.h @@ -0,0 +1,35 @@ +/** @file+ Header file for FSP Helper Library.++ Copyright (c) 2022, Intel Corporation. All rights reserved.+ SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#ifndef _FSP_HELPER_LIB_H_+#define _FSP_HELPER_LIB_H_++/**+ This interface returns the base address of FSP binary.++ @return FSP binary base address.++**/+UINTN+EFIAPI+AsmGetFspBaseAddress (+ VOID+ );++/**+ This interface gets FspInfoHeader pointer++ @return FSP info header.+**/+UINTN+EFIAPI+AsmGetFspInfoHeader (+ VOID+ );++#endif // _FSP_HELPER_LIB_H_diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc index 0713f0028d..09893d70e8 100644 --- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc @@ -46,6 +46,7 @@ FspSwitchStackLib|IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf FspSecPlatformLib|IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf FspMultiPhaseLib|IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf+ FspHelperLib|IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf [LibraryClasses.common.PEIM] PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf@@ -66,6 +67,7 @@ IntelFsp2Pkg/Library/BaseDebugDeviceLibNull/BaseDebugDeviceLibNull.inf IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf+ IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf IntelFsp2Pkg/FspSecCore/FspSecCoreT.inf IntelFsp2Pkg/FspSecCore/FspSecCoreM.infdiff --git a/IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf b/IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf new file mode 100644 index 00..318ad65330 --- /dev/null +++ b/IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf @@ -0,0 +1,50 @@ +## @file+# FSP Helper Library.+#+# Copyright (c) 2022, Intel Corporation. All rights reserved.+#+# SPDX-License-Identifier: BSD-2-Clause-Patent+#+##+++#+# Defines Section - statements that will be processed to create a Makefile.+#+++[Defines]+ INF_VERSION= 0x00010005+ BASE_NAME
[edk2-devel][PATCH v1] IntelFsp2Pkg: Adding FspHelperLib
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4128 Adding FspHelperLib for platform code to consume. There will be another patch raised later for FspSecCore to consume FspHelperLib. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Star Zeng Cc: Ashraf Ali S Cc: Chinni B Duggapu Cc: Amy Chan Signed-off-by: Ted Kuo --- IntelFsp2Pkg/FspSecCore/SecFsp.h | 25 +- IntelFsp2Pkg/Include/Library/FspHelperLib.h | 35 + IntelFsp2Pkg/IntelFsp2Pkg.dsc | 2 + .../BaseFspHelperLib/BaseFspHelperLib.inf | 50 +++ .../BaseFspHelperLib/Ia32/FspHelper.nasm | 35 + .../BaseFspHelperLib/X64/FspHelper.nasm | 34 + 6 files changed, 157 insertions(+), 24 deletions(-) create mode 100644 IntelFsp2Pkg/Include/Library/FspHelperLib.h create mode 100644 IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf create mode 100644 IntelFsp2Pkg/Library/BaseFspHelperLib/Ia32/FspHelper.nasm create mode 100644 IntelFsp2Pkg/Library/BaseFspHelperLib/X64/FspHelper.nasm diff --git a/IntelFsp2Pkg/FspSecCore/SecFsp.h b/IntelFsp2Pkg/FspSecCore/SecFsp.h index d7a5976c12..f12769890f 100644 --- a/IntelFsp2Pkg/FspSecCore/SecFsp.h +++ b/IntelFsp2Pkg/FspSecCore/SecFsp.h @@ -17,6 +17,7 @@ #include #include #include +#include #define FSP_MCUD_SIGNATURE SIGNATURE_32 ('M', 'C', 'U', 'D') #define FSP_PER0_SIGNATURE SIGNATURE_32 ('P', 'E', 'R', '0') @@ -64,28 +65,4 @@ FspDataPointerFixUp ( IN UINTN OffsetGap ); -/** - This interface returns the base address of FSP binary. - - @return FSP binary base address. - -**/ -UINTN -EFIAPI -AsmGetFspBaseAddress ( - VOID - ); - -/** - This interface gets FspInfoHeader pointer - - @return FSP binary base address. - -**/ -UINTN -EFIAPI -AsmGetFspInfoHeader ( - VOID - ); - #endif diff --git a/IntelFsp2Pkg/Include/Library/FspHelperLib.h b/IntelFsp2Pkg/Include/Library/FspHelperLib.h new file mode 100644 index 00..84b74fa7aa --- /dev/null +++ b/IntelFsp2Pkg/Include/Library/FspHelperLib.h @@ -0,0 +1,35 @@ +/** @file + Header file for FSP Helper Library. + + Copyright (c) 2022, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _FSP_HELPER_LIB_H_ +#define _FSP_HELPER_LIB_H_ + +/** + This interface returns the base address of FSP binary. + + @return FSP binary base address. + +**/ +UINTN +EFIAPI +AsmGetFspBaseAddress ( + VOID + ); + +/** + This interface gets FspInfoHeader pointer + + @return FSP info header. +**/ +UINTN +EFIAPI +AsmGetFspInfoHeader ( + VOID + ); + +#endif // _FSP_HELPER_LIB_H_ diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc index 0713f0028d..09893d70e8 100644 --- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc @@ -46,6 +46,7 @@ FspSwitchStackLib|IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf FspSecPlatformLib|IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf FspMultiPhaseLib|IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf + FspHelperLib|IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf [LibraryClasses.common.PEIM] PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf @@ -66,6 +67,7 @@ IntelFsp2Pkg/Library/BaseDebugDeviceLibNull/BaseDebugDeviceLibNull.inf IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf + IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf IntelFsp2Pkg/FspSecCore/FspSecCoreT.inf IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf diff --git a/IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf b/IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf new file mode 100644 index 00..318ad65330 --- /dev/null +++ b/IntelFsp2Pkg/Library/BaseFspHelperLib/BaseFspHelperLib.inf @@ -0,0 +1,50 @@ +## @file +# FSP Helper Library. +# +# Copyright (c) 2022, Intel Corporation. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + + +# +# Defines Section - statements that will be processed to create a Makefile. +# + + +[Defines] + INF_VERSION= 0x00010005 + BASE_NAME = FspHelperLib + FILE_GUID = 65746991-8a41-4b89-b0f4-eb4e24b5b471 + MODULE_TYPE= BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = FspHelperLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 +# + + +# +# Sources Section - list of files that are required for the build to succeed. +# +