From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=david.wei@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C960621160A22 for ; Sat, 29 Sep 2018 22:59:27 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Sep 2018 22:59:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,322,1534834800"; d="scan'208";a="74982379" Received: from zwei4-mobl1.ccr.corp.intel.com ([10.239.192.128]) by fmsmga008.fm.intel.com with ESMTP; 29 Sep 2018 22:57:54 -0700 From: zwei4 To: edk2-devel@lists.01.org Cc: David Wei , Mike Wu , Mang Guo , Steele Kelly Date: Sun, 30 Sep 2018 13:57:51 +0800 Message-Id: <20180930055751.4500-1-david.wei@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] Setup Cleanup X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Sep 2018 05:59:28 -0000 Remove TPM setup option. Add fixed PCD gPlatformModuleTokenSpaceGuid.PcdTpmControl to enable/disable TPM at build-time. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: David Wei CC: Mike Wu CC: Mang Guo CC: Steele Kelly --- .../Common/Include/Guid/SetupVariable.h | 2 +- .../PeiPlatformConfigUpdateLib.c | 36 +----------- .../PlatformPostMemPei/PlatformInit.c | 15 +++-- .../PlatformPostMemPei/PlatformPostMemPei.inf | 3 +- .../PlatformSetupDxe/PlatformSetupDxe.c | 7 +-- .../PlatformSettings/PlatformSetupDxe/Security.vfi | 25 +++------ .../PlatformSetupDxe/SetupInfoRecords.c | 64 +--------------------- Platform/BroxtonPlatformPkg/PlatformPkg.dec | 4 ++ 8 files changed, 26 insertions(+), 130 deletions(-) diff --git a/Platform/BroxtonPlatformPkg/Common/Include/Guid/SetupVariable.h b/Platform/BroxtonPlatformPkg/Common/Include/Guid/SetupVariable.h index 19b948c0ea..2d81068778 100644 --- a/Platform/BroxtonPlatformPkg/Common/Include/Guid/SetupVariable.h +++ b/Platform/BroxtonPlatformPkg/Common/Include/Guid/SetupVariable.h @@ -480,7 +480,7 @@ typedef struct { UINT8 PanelScaling; UINT8 IgdLcdIGmchBlc; UINT8 SecEnable; - UINT8 TPM; + UINT8 TPMReserved; UINT8 TPMSupportedBanks; UINT8 TpmDetection; UINT8 PttSuppressCommandSend; // For PTT Debug diff --git a/Platform/BroxtonPlatformPkg/Common/Library/PeiPlatformConfigUpdateLib/PeiPlatformConfigUpdateLib.c b/Platform/BroxtonPlatformPkg/Common/Library/PeiPlatformConfigUpdateLib/PeiPlatformConfigUpdateLib.c index a003b278b4..b62db3ae8d 100644 --- a/Platform/BroxtonPlatformPkg/Common/Library/PeiPlatformConfigUpdateLib/PeiPlatformConfigUpdateLib.c +++ b/Platform/BroxtonPlatformPkg/Common/Library/PeiPlatformConfigUpdateLib/PeiPlatformConfigUpdateLib.c @@ -2,7 +2,7 @@ Platform Configuration Update library implementation file. This library updates the setup data with platform overrides. - Copyright (c) 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -30,37 +30,6 @@ #define SETUP_NFC_IPT 1 #define SETUP_NFC 2 -EFI_STATUS -TpmSetupPolicyInit ( - IN SYSTEM_CONFIGURATION *SystemConfiguration - ) -{ -#if FTPM_SUPPORT - EFI_STATUS Status; - BOOLEAN PttEnabledState = FALSE; - EFI_HOB_GUID_TYPE *FdoEnabledGuidHob = NULL; - - FdoEnabledGuidHob = GetFirstGuidHob (&gFdoModeEnabledHobGuid); - - if (SystemConfiguration->TpmDetection == 0) { - Status = PttHeciGetState (&PttEnabledState); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Get PTT enabled state failed.\n")); - } - - if (PttEnabledState && (FdoEnabledGuidHob == NULL)) { - SystemConfiguration->TPM = TPM_PTT; - } else { - DEBUG ((EFI_D_INFO, "TpmPolicyInit-TPM and TpmDetection is disabled because of FDO \n\r")); - SystemConfiguration->TPM = TPM_DISABLE; - } - SystemConfiguration->TpmDetection = 1; - } - -#endif - return EFI_SUCCESS; -} - EFI_STATUS GetSecureNfcInfo ( @@ -189,9 +158,6 @@ UpdateSetupDataValues ( Status = GetSecureNfcInfo (PreDefaultSetupData); ASSERT_EFI_ERROR (Status); - Status = TpmSetupPolicyInit (PreDefaultSetupData); - ASSERT_EFI_ERROR (Status); - return Status; } diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c index acaaebbfbb..412304b158 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformInit.c @@ -76,19 +76,22 @@ TpmPolicyInit ( EFI_STATUS Status; UINTN Size; BOOLEAN IsPttEnabled = TRUE; - MBP_ME_FW_CAPS Mbp_Me_Fw_Caps = { 0 }; + MBP_ME_FW_CAPS MbpMeFwCaps = { 0 }; + UINT8 TpmControl; DEBUG ((EFI_D_ERROR, "TpmPolicyInit entry.\n")); + TpmControl = PcdGet8(PcdTpmControl); + // // Get ME FW Capability from MBP table to determine PTT State // - Status = HeciGetMeFwCapability (&Mbp_Me_Fw_Caps); + Status = HeciGetMeFwCapability (&MbpMeFwCaps); if (!EFI_ERROR (Status)) { - IsPttEnabled = (BOOLEAN) Mbp_Me_Fw_Caps.CurrentFeatures.Fields.PTT; + IsPttEnabled = (BOOLEAN) MbpMeFwCaps.CurrentFeatures.Fields.PTT; } - if ((IsPttEnabled) && (SystemConfiguration->TPM == TPM_PTT)) { + if ((IsPttEnabled) && (TpmControl == TPM_PTT)) { if (SystemConfiguration->PttSuppressCommandSend == 1) { Size = sizeof (gEfiTpmDeviceInstanceNoneGuid); PcdSetPtrS (PcdTpmInstanceGuid, &Size, &gEfiTpmDeviceInstanceNoneGuid); @@ -101,14 +104,14 @@ TpmPolicyInit ( PcdSetPtrS (PcdTpmInstanceGuid, &Size, &gTpmDeviceInstanceTpm20PttPtpGuid); DEBUG ((DEBUG_INFO, "Set PcdTpmInstanceGuid to PTT.\n")); } - } else if (SystemConfiguration->TPM == TPM_DTPM_1_2) { + } else if (TpmControl == TPM_DTPM_1_2) { // // Set PcdTpmInstanceGuid to dTPM 1.2 // Size = sizeof (gEfiTpmDeviceInstanceTpm12Guid); PcdSetPtrS (PcdTpmInstanceGuid, &Size, &gEfiTpmDeviceInstanceTpm12Guid); DEBUG ((DEBUG_INFO, "Set PcdTpmInstanceGuid to dTPM 1.2.\n")); - } else if (SystemConfiguration->TPM == TPM_DTPM_2_0) { + } else if (TpmControl == TPM_DTPM_2_0) { // // Set PcdTpmInstanceGuid to dTPM 2.0 // diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf index c7c0f4dfe3..717bb55ba0 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformPostMemPei/PlatformPostMemPei.inf @@ -1,7 +1,7 @@ ## @file # Component description file for PlatformInit module. # -# Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -123,6 +123,7 @@ gPlatformModuleTokenSpaceGuid.PcdBoardPostMemInitFunc gPlatformModuleTokenSpaceGuid.PcdBoardVbtFileGuid gPlatformModuleTokenSpaceGuid.PcdOemLogoFileGuid + gPlatformModuleTokenSpaceGuid.PcdTpmControl [Depex] gDramPolicyPpiGuid diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/PlatformSetupDxe.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/PlatformSetupDxe.c index 15d3a91fc0..c13981a028 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/PlatformSetupDxe.c +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/PlatformSetupDxe.c @@ -13,7 +13,7 @@ 4. It save all the mapping info in NV variables which will be consumed by platform override protocol driver to publish the platform override protocol. - Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -117,11 +117,6 @@ LoadOsDefaultValues ( Private->FakeNvData.I2s34C1 = TRUE; Private->FakeNvData.UserCameraSel = TRUE; Private->FakeNvData.WorldCameraSel = 2; -#if X64_BUILD_ENABLE - Private->FakeNvData.TPM = 1; -#else - Private->FakeNvData.TPM = 0; -#endif Private->FakeNvData.I2C0Speed = 1; Private->FakeNvData.I2C1Speed = 1; Private->FakeNvData.I2C2Speed = 1; diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/Security.vfi b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/Security.vfi index 6f2361318d..1b65ae15d4 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/Security.vfi +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/Security.vfi @@ -112,25 +112,14 @@ form formid = SECURITY_CONFIGURATION_FORM_ID, // subtitle text = STRING_TOKEN(STR_TPM_CONFIGURATION_PROMPT); - grayoutif TRUE; - oneof varid = Setup.TPM, - prompt = STRING_TOKEN(STR_TPM_PROMPT), - help = STRING_TOKEN(STR_TPM_HELP), - option text = STRING_TOKEN(STR_DISABLE), value = 0x00, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED; - option text = STRING_TOKEN(STR_TPM_PTT), value = 0x01, flags = RESET_REQUIRED; + oneof varid = Setup.TPMSupportedBanks, + prompt = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_PROMPT), + help = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_HELP), + option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_NULL), value = TPM2_SUPPORTED_BANK_NULL, flags = RESET_REQUIRED; + option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_SHA1), value = TPM2_SUPPORTED_BANK_SHA1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED; + option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_SHA2), value = TPM2_SUPPORTED_BANK_SHA2, flags = RESET_REQUIRED; + option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_BOTH), value = TPM2_SUPPORTED_BANK_BOTH, flags = RESET_REQUIRED; endoneof; - endif; - - suppressif NOT ideqval Setup.TPM == 1; - oneof varid = Setup.TPMSupportedBanks, - prompt = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_PROMPT), - help = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_HELP), - option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_NULL), value = TPM2_SUPPORTED_BANK_NULL, flags = RESET_REQUIRED; - option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_SHA1), value = TPM2_SUPPORTED_BANK_SHA1, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED; - option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_SHA2), value = TPM2_SUPPORTED_BANK_SHA2, flags = RESET_REQUIRED; - option text = STRING_TOKEN(STR_TPM2_PCR_ALLOCATE_BOTH), value = TPM2_SUPPORTED_BANK_BOTH, flags = RESET_REQUIRED; - endoneof; - endif; endform; diff --git a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SetupInfoRecords.c b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SetupInfoRecords.c index 4e921c2eaa..6de245fa51 100644 --- a/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SetupInfoRecords.c +++ b/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/SetupInfoRecords.c @@ -1603,65 +1603,6 @@ UpdatePLInformation ( HiiSetString (mHiiHandle, STRING_TOKEN (STR_SHORT_DUR_PWR_LIMIT_VALUE), Buffer, NULL); } - -EFI_STATUS -SaveTpmDeviceSelection ( - SYSTEM_CONFIGURATION *SystemConfigPtr - ) -{ - EFI_STATUS Status; - BOOLEAN PttEnabledState; - BOOLEAN ResetRequired; - EFI_INPUT_KEY Key; - CHAR16 *StringBuffer1 = L"Perform TPM Device Selection is Changed."; - CHAR16 *StringBuffer2 = L"System will Restart!"; - CHAR16 *StringBuffer3 = L"Press Enter Key To Continue"; - - ResetRequired = FALSE; - // - // TPM Device Selector Override - // - Status = PttHeciGetState (&PttEnabledState); - if (EFI_ERROR (Status)) { - return Status; - } - - if (SystemConfigPtr->TPM == TPM_PTT) { - DEBUG ((EFI_D_INFO, "TPM Device Selection is PTT.\n")); - if (!PttEnabledState) { - ResetRequired = TRUE; - PttHeciSetState (TRUE); - } - } else if ((SystemConfigPtr->TPM == TPM_DTPM_1_2) || (SystemConfigPtr->TPM == TPM_DTPM_2_0)) { - DEBUG ((EFI_D_INFO, "TPM Device Selection is dTPM.\n")); - if (PttEnabledState) { - ResetRequired = TRUE; - PttHeciSetState (FALSE); - } - } else if (SystemConfigPtr->TPM == TPM_DISABLE) { - DEBUG ((EFI_D_INFO, "TPM Device Selection is Disable.\n")); - if (PttEnabledState) { - ResetRequired = TRUE; - PttHeciSetState (FALSE); - } - } - - if (ResetRequired) { - DEBUG ((EFI_D_INFO, "Trigger cold reset to take effect.\n")); - // - // Popup a menu to notice user - // - do { - CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, StringBuffer3, NULL); - } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN); - - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); - } - - return EFI_SUCCESS; -} - - VOID EFIAPI SetupInfo ( @@ -1809,9 +1750,6 @@ CheckSystemConfigSave ( CheckTPMActivePcrBanks (SystemConfigPtr->TPMSupportedBanks); - // - // Save TPM device selection and trigger a cold reset to take effect. - // - SaveTpmDeviceSelection (SystemConfigPtr); + } diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.dec b/Platform/BroxtonPlatformPkg/PlatformPkg.dec index c27ac042ab..f72b1222d5 100644 --- a/Platform/BroxtonPlatformPkg/PlatformPkg.dec +++ b/Platform/BroxtonPlatformPkg/PlatformPkg.dec @@ -397,3 +397,7 @@ gPlatformModuleTokenSpaceGuid.PcdSecCoreMaxPpiSupported|0x6|UINT32|0x10001010 ## SerialIo Uart Configuration gPlatformModuleTokenSpaceGuid.PcdSerialIoUartNumber|2|UINT8|0x10001011 + + ## TPM Configuration + ## 0 - Disable TPM; 1 - Enable PTT (fTPM); 2 - Enable Discrete TPM 1.2; 3 - Enable Discrete TPM 2.0 + gPlatformModuleTokenSpaceGuid.PcdTpmControl|1|UINT8|0x10001012 -- 2.14.1.windows.1