From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web12.2800.1571179870791713279 for ; Tue, 15 Oct 2019 15:51:11 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: prince.agyeman@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2019 15:51:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,301,1566889200"; d="scan'208";a="189501342" Received: from paagyema-desk2.amr.corp.intel.com ([10.24.15.58]) by orsmga008.jf.intel.com with ESMTP; 15 Oct 2019 15:51:09 -0700 From: "Agyeman, Prince" To: devel@edk2.groups.io Cc: Ankit Sinha , Nate DeSimone , Kubacki Michael A Subject: [edk2-platforms] [PATCH v2 2/4] KabylakeOpenBoardPkg: Add BIOS Info PEIM Date: Tue, 15 Oct 2019 15:51:07 -0700 Message-Id: <20191015225109.18992-3-prince.agyeman@intel.com> X-Mailer: git-send-email 2.19.1.windows.1 In-Reply-To: <20191015225109.18992-1-prince.agyeman@intel.com> References: <20191015225109.18992-1-prince.agyeman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Added BIOS Info PEIM to KabylakeRvp3 and GalagoPro3 to publish the BIOS info HOB. This PEIM currently publishes the board's microcode region information. Cc: Ankit Sinha Cc: Nate DeSimone Cc: Kubacki Michael A Signed-off-by: Prince Agyeman --- .../KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c | 93 +++++++++++++++++++ .../BiosInfo/BiosInfo.inf | 48 ++++++++++ .../GalagoPro3/OpenBoardPkg.dsc | 3 + .../GalagoPro3/OpenBoardPkg.fdf | 1 + .../KabylakeRvp3/OpenBoardPkg.dsc | 2 + .../KabylakeRvp3/OpenBoardPkg.fdf | 1 + 6 files changed, 148 insertions(+) create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c create mode 100644 Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c new file mode 100644 index 0000000000..578e66149e --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.c @@ -0,0 +1,93 @@ +/** @file + Driver for BIOS Info support. + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define INDEXPORT_TO_ADDRESS(x) (x) +#define DATAPORT_TO_ADDRESS(x) ((x) << 16) +#define PORTWIDTH_TO_ADDRESS(x) ((x) << 32) +#define PORTBITNUMBER_TO_ADDRESS(x) ((x) << 40) +#define PORTINDEXNUMBER_TO_ADDRESS(x) ((x) << 48) + +// +// Internal +// +#pragma pack (1) + +typedef struct { + BIOS_INFO_HEADER Header; + BIOS_INFO_STRUCT Entry[1]; +} BIOS_INFO; +#pragma pack () + +GLOBAL_REMOVE_IF_UNREFERENCED BIOS_INFO mBiosInfo = { + { + BIOS_INFO_SIGNATURE, + 1, + 0, + }, + { + { + FIT_TYPE_01_MICROCODE, + BIOS_INFO_STRUCT_ATTRIBUTE_MICROCODE_WHOLE_REGION, + 0x0100, + FixedPcdGet32 (PcdFlashMicrocodeFvSize), + FixedPcdGet32 (PcdFlashMicrocodeFvBase) + } + } +}; + +GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mBiosInfoPpiList = { + EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST, + &gBiosInfoGuid, + &mBiosInfo +}; + +/** + Installs BiosInfo Ppi and builds BiosInfo HOB . + + @param FileHandle Handle of the file being invoked. + @param PeiServices Describes the list of possible PEI Services. + + @retval EFI_SUCCESS Install the BiosInfo Ppi and HOB successfully. + +**/ +EFI_STATUS +EFIAPI +BiosInfoEntryPoint ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + VOID *HobData; + + // + // Install PPI, so that other PEI module can add dependency. + // + Status = PeiServicesInstallPpi (&mBiosInfoPpiList); + ASSERT_EFI_ERROR (Status); + + // + // Build hob, so that DXE module can also get the data. + // + HobData = BuildGuidHob (&gBiosInfoGuid, sizeof (mBiosInfo)); + ASSERT (HobData != NULL); + if (HobData == NULL) { + return EFI_OUT_OF_RESOURCES; + } + CopyMem (HobData, &mBiosInfo, sizeof (mBiosInfo)); + + return EFI_SUCCESS; +} diff --git a/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf new file mode 100644 index 0000000000..94543408b1 --- /dev/null +++ b/Platform/Intel/KabylakeOpenBoardPkg/BiosInfo/BiosInfo.inf @@ -0,0 +1,48 @@ +### @file +# Module Information description file for BIOS Info Driver +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +### + +[Defines] + INF_VERSION = 0x00010017 + BASE_NAME = BiosInfo + FILE_GUID = C83BCE0E-6F16-4D3C-8D9F-4D6F5A032929 + VERSION_STRING = 1.0 + MODULE_TYPE = PEIM + ENTRY_POINT = BiosInfoEntryPoint +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES IA32 X64 +# + +[LibraryClasses] + PeimEntryPoint + PeiServicesLib + HobLib + BaseMemoryLib + DebugLib + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + IntelSiliconPkg/IntelSiliconPkg.dec + KabylakeSiliconPkg/SiPkg.dec + KabylakeFspBinPkg/KabylakeFspBinPkg.dec + BoardModulePkg/BoardModulePkg.dec + MinPlatformPkg/MinPlatformPkg.dec + +[Pcd] + gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase ## CONSUMES + gSiPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize ## CONSUMES + +[Sources] + BiosInfo.c + +[Guids] + gBiosInfoGuid ## PRODUCES + +[Depex] + TRUE diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc index b6f9807e7e..665597f79e 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc @@ -287,6 +287,9 @@ } $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPostMem.inf + + $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf + !if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE $(PLATFORM_PACKAGE)/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf !endif diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf index c46f7a71e5..80efab1aad 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf @@ -240,6 +240,7 @@ INF $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf INF $(PROJECT)/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf +INF $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf [FV.FvPostMemoryUncompact] BlockSize = $(FLASH_BLOCK_SIZE) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc index b412dc9eec..5d4f5850f1 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc @@ -359,6 +359,8 @@ } !endif + $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf + !if gMinPlatformPkgTokenSpaceGuid.PcdTpm2Enable == TRUE $(PLATFORM_PACKAGE)/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf !endif diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf index c61b93db84..dbd6f2aa10 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.fdf @@ -242,6 +242,7 @@ INF $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf INF $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf INF IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf INF $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf +INF $(PLATFORM_BOARD_PACKAGE)/BiosInfo/BiosInfo.inf [FV.FvPostMemoryUncompact] BlockSize = $(FLASH_BLOCK_SIZE) -- 2.19.1.windows.1