From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com []) by mx.groups.io with SMTP id smtpd.web09.1151.1612929638872804363 for ; Tue, 09 Feb 2021 20:00:39 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: heng.luo@intel.com) IronPort-SDR: tB2otifhD47C/8OQSMANAUmVEND1bfXQklvRBuG/dNxkcNEHRhkpACBdxzC0iLxh6I+YbjVJ9B qAH24kCSagOQ== X-IronPort-AV: E=McAfee;i="6000,8403,9890"; a="181233769" X-IronPort-AV: E=Sophos;i="5.81,167,1610438400"; d="scan'208";a="181233769" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2021 20:00:28 -0800 IronPort-SDR: C/A+a6Bghs4qPNYwdEFIsDSYkgmxKLNoi+xCTi821ZH6TEFCjZ3nIWux7VmT1AZVaHWr7eyEbT rV/yOH4ybWUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,167,1610438400"; d="scan'208";a="396530758" Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.154]) by orsmga008.jf.intel.com with ESMTP; 09 Feb 2021 20:00:27 -0800 From: "Heng Luo" To: devel@edk2.groups.io Cc: Sai Chaganty , Nate DeSimone Subject: [Patch V3 5/8] TigerlakeOpenBoardPkg: Add modules Date: Wed, 10 Feb 2021 12:00:09 +0800 Message-Id: <20210210040012.4564-5-heng.luo@intel.com> X-Mailer: git-send-email 2.24.0.windows.2 In-Reply-To: <20210210040012.4564-1-heng.luo@intel.com> References: <20210210040012.4564-1-heng.luo@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3175 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/Pla= tform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c new file mode 100644 index 0000000000..46c3d439c2 --- /dev/null +++ b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.c @@ -0,0 +1,200 @@ +/** @file=0D + Driver for BIOS Info support.=0D +=0D + Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +**/=0D +=0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +#include =0D +=0D +#define BASE_FV_SIZE 10=0D +=0D +#define FSP_WRAPPER_FV_SIZE 3=0D +=0D +#define TSN_MAC_ADDRESS_FV_SIZE 0=0D +=0D +#define BIOS_INFO_STRUCT_SIZE (BASE_FV_SIZE + FSP_WRAPPER_FV_SIZE + TSN_MA= C_ADDRESS_FV_SIZE)=0D +=0D +=0D +/*=0D + BIOS_INFO structure is the base of the firmware volume layout for Intel = platform BIOS implementation=0D + so security checker module can run based on the structure and throw warn= ings, error or deadloop=0D + when any unexpected firmware volumes are detected.=0D +=0D + BIOS_INFO is recommended to support full entries of firmware volumes pre= sent in a flash=0D + with right type, attribute, version, flash map base address and size,=0D + all associated information which is defined by BIOS_INFO_STRUCT structur= e.=0D + - IBB firmware volumes, which are expected to be measured or/and verifie= d=0D + by hardware base security solution to meet SecureBoot chain of trust=0D + (Intel BootGuard for example), have attribute 0x0.=0D + - Post IBB firmware volumes, which are expected to be measured or/and ve= rified=0D + by BIOS (TCG code for measurement, RSA2048SHA256Sign algorithm for ver= ification for example),=0D + have attribute BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB.=0D + - Else, follows Firmware Interface Table specification.=0D +*/=0D +#pragma pack (1)=0D +typedef struct {=0D + BIOS_INFO_HEADER Header;=0D + BIOS_INFO_STRUCT Entry[BIOS_INFO_STRUCT_SIZE];=0D +} BIOS_INFO;=0D +#pragma pack ()=0D +=0D +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo =3D {=0D + {=0D + BIOS_INFO_SIGNATURE,=0D + BIOS_INFO_STRUCT_SIZE,=0D + 0,=0D + },=0D + {=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashNvStorageVariableSize) + FixedPcdGet32 (PcdFl= ashNvStorageFtwWorkingSize) + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)= ,=0D + FixedPcdGet32 (PcdFlashNvStorageVariableBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvAdvancedSize),=0D + FixedPcdGet32 (PcdFlashFvAdvancedBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvOptionalSize),=0D + FixedPcdGet32 (PcdFlashFvOptionalBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvOsBootSize),=0D + FixedPcdGet32 (PcdFlashFvOsBootBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvUefiBootSize),=0D + FixedPcdGet32 (PcdFlashFvUefiBootBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvPostMemorySize),=0D + FixedPcdGet32 (PcdFlashFvPostMemoryBase)=0D + },=0D + {=0D + /*=0D + Note :=0D + Startup ACM is one of the binaries in FvFirmwareBinaries,=0D + so put type 07 but not type 02.=0D + FIT table will contain a type 02 entry with actual address=0D + of ACM binary (it is passed as an input to FitGen tool).=0D + */=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_GENERAL_EXCLUDE_FROM_FIT,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvFirmwareBinariesSize),=0D + FixedPcdGet32 (PcdFlashFvFirmwareBinariesBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvFspSSize),=0D + FixedPcdGet32 (PcdFlashFvFspSBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + 0x00, // IBB FV=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvFspMSize),=0D + FixedPcdGet32 (PcdFlashFvFspMBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + 0x00, // IBB FV=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvFspTSize),=0D + FixedPcdGet32 (PcdFlashFvFspTBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + 0x00, // IBB FV=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvSecuritySize),=0D + FixedPcdGet32 (PcdFlashFvSecurityBase)=0D + },=0D + {=0D + FIT_TYPE_07_BIOS_STARTUP_MODULE,=0D + 0x00, // IBB FV=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashFvPreMemorySize),=0D + FixedPcdGet32 (PcdFlashFvPreMemoryBase)=0D + },=0D + {=0D + FIT_TYPE_01_MICROCODE,=0D + BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION,=0D + 0x0100,=0D + FixedPcdGet32 (PcdFlashMicrocodeFvSize),=0D + FixedPcdGet32 (PcdFlashMicrocodeFvBase)=0D + },=0D + }=0D +};=0D +=0D +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mBiosInfoPpiList =3D= {=0D + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,=0D + &gBiosInfoGuid,=0D + &mBiosInfo=0D +};=0D +=0D +/**=0D + Installs BiosInfo Ppi.=0D +=0D + @param FileHandle Handle of the file being invoked.=0D + @param PeiServices Describes the list of possible PEI Services.=0D +=0D + @retval EFI_SUCCESS Install the BiosInfo Ppi successfully.=0D +=0D +**/=0D +EFI_STATUS=0D +EFIAPI=0D +BiosInfoEntryPoint (=0D + IN EFI_PEI_FILE_HANDLE FileHandle,=0D + IN CONST EFI_PEI_SERVICES **PeiServices=0D + )=0D +{=0D + EFI_STATUS Status;=0D + VOID *HobData;=0D +=0D + //=0D + // Install PPI, so that other PEI module can add dependency.=0D + //=0D + Status =3D PeiServicesInstallPpi (&mBiosInfoPpiList);=0D + ASSERT_EFI_ERROR (Status);=0D +=0D + //=0D + // Build hob, so that DXE module can also get the data.=0D + //=0D + HobData =3D BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo));=0D + ASSERT (HobData !=3D NULL);=0D + if (HobData =3D=3D NULL) {=0D + return EFI_OUT_OF_RESOURCES;=0D + }=0D + CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo));=0D + return EFI_SUCCESS;=0D +}=0D diff --git a/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf b/P= latform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf new file mode 100644 index 0000000000..66c8814c97 --- /dev/null +++ b/Platform/Intel/TigerlakeOpenBoardPkg/BiosInfo/BiosInfo.inf @@ -0,0 +1,83 @@ +## @file=0D +# Module Information description file for BIOS Info Driver=0D +#=0D +# Copyright (c) 2021, Intel Corporation. All rights reserved.
=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x00010017=0D + BASE_NAME =3D BiosInfo=0D + FILE_GUID =3D 4A4CA1C6-871C-45BB-8801-6910A7AA5807= =0D + VERSION_STRING =3D 1.0=0D + MODULE_TYPE =3D PEIM=0D + ENTRY_POINT =3D BiosInfoEntryPoint=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES IA32 X64=0D +#=0D +=0D +[LibraryClasses]=0D + PeimEntryPoint=0D + PeiServicesLib=0D + PeiServicesTablePointerLib=0D + HobLib=0D + BaseMemoryLib=0D + MemoryAllocationLib=0D + DebugLib=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + TigerlakeSiliconPkg/SiPkg.dec=0D + IntelSiliconPkg/IntelSiliconPkg.dec=0D + MinPlatformPkg/MinPlatformPkg.dec=0D + TigerlakeOpenBoardPkg/OpenBoardPkg.dec=0D + SecurityPkg/SecurityPkg.dec=0D + BoardModulePkg/BoardModulePkg.dec=0D +=0D +[Pcd]=0D + gSiPkgTokenSpaceGuid.PcdBiosAreaBaseAddress ## CONSU= MES=0D + gSiPkgTokenSpaceGuid.PcdBiosSize ## CONSU= MES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase ## CONSU= MES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize ## CONSU= MES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase ## CONSU= MES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize ## CONSU= MES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase ## CONSU= MES=0D + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize ## CONSU= MES=0D + gBoardModuleTokenSpaceGuid.PcdFlashFvFirmwareBinariesBase ## CONSU= MES=0D + gBoardModuleTokenSpaceGuid.PcdFlashFvFirmwareBinariesSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvAdvancedSize ## CONSU= MES=0D + gBoardModuleTokenSpaceGuid.PcdFlashFvOptionalBase ## CONSU= MES=0D + gBoardModuleTokenSpaceGuid.PcdFlashFvOptionalSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecurityBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvSecuritySize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvOsBootSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvUefiBootSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemoryBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPostMemorySize ## CONSU= MES=0D + gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase ## CONSU= MES=0D + gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspSSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspMSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvFspTSize ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemoryBase ## CONSU= MES=0D + gMinPlatformPkgTokenSpaceGuid.PcdFlashFvPreMemorySize ## CONSU= MES=0D +=0D +=0D +[Sources]=0D + BiosInfo.c=0D +=0D +[Guids]=0D + gBiosInfoGuid ## PRODUCES=0D +=0D +[Depex]=0D + gEfiPeiMasterBootModePpiGuid=0D --=20 2.24.0.windows.2