Re: [edk2-devel] [Patch V2 5/8] TigerlakeOpenBoardPkg: Add modules
Reviewed-by: Sai Chaganty -Original Message- From: Luo, Heng Sent: Tuesday, February 09, 2021 12:46 AM To: devel@edk2.groups.io Cc: Chaganty, Rangasai V ; Desimone, Nathaniel L Subject: [Patch V2 5/8] TigerlakeOpenBoardPkg: Add modules REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3175 Adds the following modules: * BiosInfo Cc: Sai Chaganty Cc: Nate DeSimone Signed-off-by: Heng Luo --- Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c | 200 Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf | 83 +++ 2 files changed, 283 insertions(+) diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c new file mode 100644 index 00..46c3d439c2 --- /dev/null +++ b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c @@ -0,0 +1,200 @@ +/** @file + Driver for BIOS Info support. + + Copyright (c) 2021, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BASE_FV_SIZE 10 + +#define FSP_WRAPPER_FV_SIZE 3 + +#define TSN_MAC_ADDRESS_FV_SIZE 0 + +#define BIOS_INFO_STRUCT_SIZE (BASE_FV_SIZE + FSP_WRAPPER_FV_SIZE + TSN_MAC_ADDRESS_FV_SIZE) + + +/* + BIOS_INFO structure is the base of the firmware volume layout for Intel platform BIOS implementation + so security checker module can run based on the structure and throw warnings, error or deadloop + when any unexpected firmware volumes are detected. + + BIOS_INFO is recommended to support full entries of firmware volumes present in a flash + with right type, attribute, version, flash map base address and size, + all associated information which is defined by BIOS_INFO_STRUCT structure. + - IBB firmware volumes, which are expected to be measured or/and verified +by hardware base security solution to meet SecureBoot chain of trust +(Intel BootGuard for example), have attribute 0x0. + - Post IBB firmware volumes, which are expected to be measured or/and verified +by BIOS (TCG code for measurement, RSA2048SHA256Sign algorithm for verification for example), +have attribute BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB. + - Else, follows Firmware Interface Table specification. +*/ +#pragma pack (1) +typedef struct { + BIOS_INFO_HEADER Header; + BIOS_INFO_STRUCT Entry[BIOS_INFO_STRUCT_SIZE]; +} BIOS_INFO; +#pragma pack () + +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { + { +BIOS_INFO_SIGNATURE, +BIOS_INFO_STRUCT_SIZE, +0, + }, + { +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT, + 0x0100, + FixedPcdGet32 (PcdFlashNvStorageVariableSize) + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize), + FixedPcdGet32 (PcdFlashNvStorageVariableBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvAdvancedSize), + FixedPcdGet32 (PcdFlashFvAdvancedBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvOptionalSize), + FixedPcdGet32 (PcdFlashFvOptionalBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvOsBootSize), + FixedPcdGet32 (PcdFlashFvOsBootBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvUefiBootSize), + FixedPcdGet32 (PcdFlashFvUefiBootBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvPostMemorySize), + FixedPcdGet32 (PcdFlashFvPostMemoryBase) +}, +{ + /* +Note : +Startup ACM is one of the binaries in FvFirmwareBinaries, +so put type 07 but not type 02. +FIT table will contain a type 02 entry with actual address +of ACM binary (it is passed as an input to FitGen tool). + */ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT, + 0x0100, + FixedPcdGet32 (PcdFlashFvFirmwareBinariesSize), + FixedPcdGet32 (PcdFlashFvFirmwareBinariesBase) +}, +{ +
Re: [edk2-devel] [Patch V2 5/8] TigerlakeOpenBoardPkg: Add modules
Reviewed-by: Sai Chaganty -Original Message- From: Luo, Heng Sent: Tuesday, February 09, 2021 12:46 AM To: devel@edk2.groups.io Cc: Chaganty, Rangasai V ; Desimone, Nathaniel L Subject: [Patch V2 5/8] TigerlakeOpenBoardPkg: Add modules REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3175 Adds the following modules: * BiosInfo Cc: Sai Chaganty Cc: Nate DeSimone Signed-off-by: Heng Luo --- Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c | 200 Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf | 83 +++ 2 files changed, 283 insertions(+) diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c new file mode 100644 index 00..46c3d439c2 --- /dev/null +++ b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c @@ -0,0 +1,200 @@ +/** @file + Driver for BIOS Info support. + + Copyright (c) 2021, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BASE_FV_SIZE 10 + +#define FSP_WRAPPER_FV_SIZE 3 + +#define TSN_MAC_ADDRESS_FV_SIZE 0 + +#define BIOS_INFO_STRUCT_SIZE (BASE_FV_SIZE + FSP_WRAPPER_FV_SIZE + TSN_MAC_ADDRESS_FV_SIZE) + + +/* + BIOS_INFO structure is the base of the firmware volume layout for Intel platform BIOS implementation + so security checker module can run based on the structure and throw warnings, error or deadloop + when any unexpected firmware volumes are detected. + + BIOS_INFO is recommended to support full entries of firmware volumes present in a flash + with right type, attribute, version, flash map base address and size, + all associated information which is defined by BIOS_INFO_STRUCT structure. + - IBB firmware volumes, which are expected to be measured or/and verified +by hardware base security solution to meet SecureBoot chain of trust +(Intel BootGuard for example), have attribute 0x0. + - Post IBB firmware volumes, which are expected to be measured or/and verified +by BIOS (TCG code for measurement, RSA2048SHA256Sign algorithm for verification for example), +have attribute BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB. + - Else, follows Firmware Interface Table specification. +*/ +#pragma pack (1) +typedef struct { + BIOS_INFO_HEADER Header; + BIOS_INFO_STRUCT Entry[BIOS_INFO_STRUCT_SIZE]; +} BIOS_INFO; +#pragma pack () + +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { + { +BIOS_INFO_SIGNATURE, +BIOS_INFO_STRUCT_SIZE, +0, + }, + { +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT, + 0x0100, + FixedPcdGet32 (PcdFlashNvStorageVariableSize) + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize), + FixedPcdGet32 (PcdFlashNvStorageVariableBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvAdvancedSize), + FixedPcdGet32 (PcdFlashFvAdvancedBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvOptionalSize), + FixedPcdGet32 (PcdFlashFvOptionalBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvOsBootSize), + FixedPcdGet32 (PcdFlashFvOsBootBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvUefiBootSize), + FixedPcdGet32 (PcdFlashFvUefiBootBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvPostMemorySize), + FixedPcdGet32 (PcdFlashFvPostMemoryBase) +}, +{ + /* +Note : +Startup ACM is one of the binaries in FvFirmwareBinaries, +so put type 07 but not type 02. +FIT table will contain a type 02 entry with actual address +of ACM binary (it is passed as an input to FitGen tool). + */ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT, + 0x0100, + FixedPcdGet32 (PcdFlashFvFirmwareBinariesSize), + FixedPcdGet32 (PcdFlashFvFirmwareBinariesBase) +}, +{ +
[edk2-devel] [Patch V2 5/8] TigerlakeOpenBoardPkg: Add modules
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3175 Adds the following modules: * BiosInfo Cc: Sai Chaganty Cc: Nate DeSimone Signed-off-by: Heng Luo --- Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c | 200 Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf | 83 +++ 2 files changed, 283 insertions(+) diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c new file mode 100644 index 00..46c3d439c2 --- /dev/null +++ b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c @@ -0,0 +1,200 @@ +/** @file + Driver for BIOS Info support. + + Copyright (c) 2021, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define BASE_FV_SIZE 10 + +#define FSP_WRAPPER_FV_SIZE 3 + +#define TSN_MAC_ADDRESS_FV_SIZE 0 + +#define BIOS_INFO_STRUCT_SIZE (BASE_FV_SIZE + FSP_WRAPPER_FV_SIZE + TSN_MAC_ADDRESS_FV_SIZE) + + +/* + BIOS_INFO structure is the base of the firmware volume layout for Intel platform BIOS implementation + so security checker module can run based on the structure and throw warnings, error or deadloop + when any unexpected firmware volumes are detected. + + BIOS_INFO is recommended to support full entries of firmware volumes present in a flash + with right type, attribute, version, flash map base address and size, + all associated information which is defined by BIOS_INFO_STRUCT structure. + - IBB firmware volumes, which are expected to be measured or/and verified +by hardware base security solution to meet SecureBoot chain of trust +(Intel BootGuard for example), have attribute 0x0. + - Post IBB firmware volumes, which are expected to be measured or/and verified +by BIOS (TCG code for measurement, RSA2048SHA256Sign algorithm for verification for example), +have attribute BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB. + - Else, follows Firmware Interface Table specification. +*/ +#pragma pack (1) +typedef struct { + BIOS_INFO_HEADER Header; + BIOS_INFO_STRUCT Entry[BIOS_INFO_STRUCT_SIZE]; +} BIOS_INFO; +#pragma pack () + +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { + { +BIOS_INFO_SIGNATURE, +BIOS_INFO_STRUCT_SIZE, +0, + }, + { +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT, + 0x0100, + FixedPcdGet32 (PcdFlashNvStorageVariableSize) + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize), + FixedPcdGet32 (PcdFlashNvStorageVariableBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvAdvancedSize), + FixedPcdGet32 (PcdFlashFvAdvancedBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvOptionalSize), + FixedPcdGet32 (PcdFlashFvOptionalBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvOsBootSize), + FixedPcdGet32 (PcdFlashFvOsBootBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvUefiBootSize), + FixedPcdGet32 (PcdFlashFvUefiBootBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvPostMemorySize), + FixedPcdGet32 (PcdFlashFvPostMemoryBase) +}, +{ + /* +Note : +Startup ACM is one of the binaries in FvFirmwareBinaries, +so put type 07 but not type 02. +FIT table will contain a type 02 entry with actual address +of ACM binary (it is passed as an input to FitGen tool). + */ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT, + 0x0100, + FixedPcdGet32 (PcdFlashFvFirmwareBinariesSize), + FixedPcdGet32 (PcdFlashFvFirmwareBinariesBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB, + 0x0100, + FixedPcdGet32 (PcdFlashFvFspSSize), + FixedPcdGet32 (PcdFlashFvFspSBase) +}, +{ + FIT_TYPE_07_BIOS_STARTUP_MODULE, + 0x00,// IBB FV + 0x0100, + FixedPcdGet32 (PcdFlashFvFspMSize), + FixedPcdGet32 (PcdFlashFvFspMBase) +}, +{ +