From f4e7aa05a3fe348dda4c1f491a48789ef5b7e4d1 Mon Sep 17 00:00:00 2001 From: Tim He Date: Fri, 8 May 2015 03:13:37 +0000 Subject: Sync the branch changes to trunk. Support fTPM feature, and update the BiosID to 0.80. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tim He git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17362 6f19259b-4bc3-4df7-8a09-765794883524 --- Vlv2TbltDevicePkg/PlatformPei/Platform.c | 70 ++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'Vlv2TbltDevicePkg/PlatformPei/Platform.c') diff --git a/Vlv2TbltDevicePkg/PlatformPei/Platform.c b/Vlv2TbltDevicePkg/PlatformPei/Platform.c index 1dab9ca851..899b4a9791 100644 --- a/Vlv2TbltDevicePkg/PlatformPei/Platform.c +++ b/Vlv2TbltDevicePkg/PlatformPei/Platform.c @@ -28,6 +28,7 @@ Module Name: #include #include #include +#include // // Start::Alpine Valley platform @@ -190,6 +191,67 @@ PeiSmbusExec ( UINT8 *Buffer ); + +EFI_STATUS +FtpmPolicyInit ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN SYSTEM_CONFIGURATION *pSystemConfiguration + ) +{ + EFI_STATUS Status; + EFI_PEI_PPI_DESCRIPTOR *mFtpmPolicyPpiDesc; + SEC_FTPM_POLICY_PPI *mFtpmPolicyPpi; + + + DEBUG((EFI_D_INFO, "FtpmPolicyInit Entry \n")); + + if (NULL == PeiServices || NULL == pSystemConfiguration) { + DEBUG((EFI_D_ERROR, "Input error. \n")); + return EFI_INVALID_PARAMETER; + } + + Status = (*PeiServices)->AllocatePool( + PeiServices, + sizeof (EFI_PEI_PPI_DESCRIPTOR), + (void **)&mFtpmPolicyPpiDesc + ); + ASSERT_EFI_ERROR (Status); + + Status = (*PeiServices)->AllocatePool( + PeiServices, + sizeof (SEC_FTPM_POLICY_PPI), + (void **)&mFtpmPolicyPpi + ); + ASSERT_EFI_ERROR (Status); + + // + // Initialize PPI + // + (*PeiServices)->SetMem ((VOID *)mFtpmPolicyPpi, sizeof (SEC_FTPM_POLICY_PPI), 0); + mFtpmPolicyPpiDesc->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST; + mFtpmPolicyPpiDesc->Guid = &gSeCfTPMPolicyPpiGuid; + mFtpmPolicyPpiDesc->Ppi = mFtpmPolicyPpi; + + + DEBUG((EFI_D_INFO, "pSystemConfiguration->fTPM = 0x%x \n", pSystemConfiguration->fTPM)); + if(pSystemConfiguration->fTPM == 1) { + mFtpmPolicyPpi->fTPMEnable = TRUE; + } else { + mFtpmPolicyPpi->fTPMEnable = FALSE; + } + + Status = (*PeiServices)->InstallPpi( + PeiServices, + mFtpmPolicyPpiDesc + ); + ASSERT_EFI_ERROR (Status); + + DEBUG((EFI_D_INFO, "FtpmPolicyInit done \n")); + + return EFI_SUCCESS; +} + + /** This routine attempts to acquire the SMBus @@ -697,6 +759,14 @@ PeiInitPlatform ( ); +#ifdef FTPM_ENABLE + Status = FtpmPolicyInit(PeiServices, &SystemConfiguration); + if (EFI_ERROR (Status)) { + DEBUG((EFI_D_ERROR, "fTPM init failed.\n")); + } +#endif + + // // Set the new boot mode for MRC // -- cgit v1.2.3