TrEE is deprecated. We need use Tcg2.
Cc: Chao B Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao B Zhang <chao.b.zhang@intel.com>
+++ /dev/null
-/** @file\r
- TPM1.2/dTPM2.0 auto detection.\r
-\r
-Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-\r
-#include <PiPei.h>\r
-#include <Ppi/ReadOnlyVariable2.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/PeiServicesLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/Tpm12DeviceLib.h>\r
-#include <Library/Tpm12CommandLib.h>\r
-#include <IndustryStandard/Tpm12.h>\r
-\r
-#include "TrEEConfigNvData.h"\r
-\r
-/**\r
- This routine check both SetupVariable and real TPM device, and return final TpmDevice configuration.\r
-\r
- @param SetupTpmDevice TpmDevice configuration in setup driver\r
-\r
- @return TpmDevice configuration\r
-**/\r
-UINT8\r
-DetectTpmDevice (\r
- IN UINT8 SetupTpmDevice\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_BOOT_MODE BootMode;\r
- TREE_DEVICE_DETECTION TrEEDeviceDetection;\r
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;\r
- UINTN Size;\r
-\r
- Status = PeiServicesGetBootMode (&BootMode);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // In S3, we rely on normal boot Detection, because we save to ReadOnly Variable in normal boot.\r
- //\r
- if (BootMode == BOOT_ON_S3_RESUME) {\r
- DEBUG ((EFI_D_INFO, "DetectTpmDevice: S3 mode\n"));\r
-\r
- Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Size = sizeof(TREE_DEVICE_DETECTION);\r
- ZeroMem (&TrEEDeviceDetection, sizeof(TrEEDeviceDetection));\r
- Status = VariablePpi->GetVariable (\r
- VariablePpi,\r
- TREE_DEVICE_DETECTION_NAME,\r
- &gTrEEConfigFormSetGuid,\r
- NULL,\r
- &Size,\r
- &TrEEDeviceDetection\r
- );\r
- if (!EFI_ERROR (Status) &&\r
- (TrEEDeviceDetection.TpmDeviceDetected >= TPM_DEVICE_MIN) &&\r
- (TrEEDeviceDetection.TpmDeviceDetected <= TPM_DEVICE_MAX)) {\r
- DEBUG ((EFI_D_ERROR, "TpmDevice from DeviceDetection: %x\n", TrEEDeviceDetection.TpmDeviceDetected));\r
- return TrEEDeviceDetection.TpmDeviceDetected;\r
- }\r
- }\r
-\r
- DEBUG ((EFI_D_INFO, "DetectTpmDevice:\n"));\r
-\r
- // dTPM available and not disabled by setup\r
- // We need check if it is TPM1.2 or TPM2.0\r
- // So try TPM1.2 command at first\r
-\r
- Status = Tpm12RequestUseTpm ();\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // dTPM not available\r
- //\r
- return TPM_DEVICE_NULL;\r
- }\r
-\r
- if (BootMode == BOOT_ON_S3_RESUME) {\r
- Status = Tpm12Startup (TPM_ST_STATE);\r
- } else {\r
- Status = Tpm12Startup (TPM_ST_CLEAR);\r
- }\r
- if (EFI_ERROR (Status)) {\r
- return TPM_DEVICE_2_0_DTPM;\r
- }\r
-\r
- // NO initialization needed again.\r
- Status = PcdSet8S (PcdTpmInitializationPolicy, 0);\r
- ASSERT_EFI_ERROR (Status);\r
- return TPM_DEVICE_1_2;\r
-}\r
+++ /dev/null
-/** @file\r
- VFR file used by the TREE configuration component.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "TrEEConfigNvData.h"\r
-\r
-formset\r
- guid = TREE_CONFIG_FORM_SET_GUID,\r
- title = STRING_TOKEN(STR_TREE_TITLE),\r
- help = STRING_TOKEN(STR_TREE_HELP),\r
- classguid = EFI_HII_PLATFORM_SETUP_FORMSET_GUID,\r
-\r
- efivarstore TREE_CONFIGURATION,\r
- varid = TREE_CONFIGURATION_VARSTORE_ID,\r
- attribute = 0x03, // EFI variable attribures EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE\r
- name = TREE_CONFIGURATION,\r
- guid = TREE_CONFIG_FORM_SET_GUID;\r
-\r
- form formid = TREE_CONFIGURATION_FORM_ID,\r
- title = STRING_TOKEN(STR_TREE_TITLE);\r
-\r
- subtitle text = STRING_TOKEN(STR_NULL);\r
-\r
- text\r
- help = STRING_TOKEN(STR_TREE_DEVICE_STATE_HELP),\r
- text = STRING_TOKEN(STR_TREE_DEVICE_STATE_PROMPT),\r
- text = STRING_TOKEN(STR_TREE_DEVICE_STATE_CONTENT);\r
-\r
- oneof varid = TREE_CONFIGURATION.TpmDevice,\r
- questionid = KEY_TPM_DEVICE,\r
- prompt = STRING_TOKEN(STR_TREE_DEVICE_PROMPT),\r
- help = STRING_TOKEN(STR_TREE_DEVICE_HELP),\r
- flags = INTERACTIVE,\r
- option text = STRING_TOKEN(STR_TREE_TPM_1_2), value = TPM_DEVICE_1_2, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;\r
- option text = STRING_TOKEN(STR_TREE_TPM_2_0_DTPM), value = TPM_DEVICE_2_0_DTPM, flags = RESET_REQUIRED;\r
- endoneof;\r
-\r
- subtitle text = STRING_TOKEN(STR_NULL);\r
-\r
- suppressif ideqvallist TREE_CONFIGURATION.TpmDevice == TPM_DEVICE_NULL TPM_DEVICE_1_2;\r
-\r
- subtitle text = STRING_TOKEN(STR_NULL);\r
- subtitle text = STRING_TOKEN(STR_TREE_PP_OPERATION);\r
-\r
- oneof name = Tpm2Operation,\r
- questionid = KEY_TPM2_OPERATION,\r
- prompt = STRING_TOKEN(STR_TREE_OPERATION),\r
- help = STRING_TOKEN(STR_TREE_OPERATION_HELP),\r
- flags = INTERACTIVE | NUMERIC_SIZE_1,\r
- option text = STRING_TOKEN(STR_TREE_NO_ACTION), value = TREE_PHYSICAL_PRESENCE_NO_ACTION, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;\r
- option text = STRING_TOKEN(STR_TREE_CLEAR), value = TREE_PHYSICAL_PRESENCE_CLEAR_CONTROL_CLEAR, flags = RESET_REQUIRED;\r
- endoneof;\r
-\r
- endif;\r
-\r
- endform;\r
-\r
-endformset;\r
+++ /dev/null
-/** @file\r
- The module entry point for TrEE configuration module.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "TrEEConfigImpl.h"\r
-\r
-extern TPM_INSTANCE_ID mTpmInstanceId[TPM_DEVICE_MAX + 1];\r
-\r
-/**\r
- The entry point for TrEE configuration driver.\r
-\r
- @param[in] ImageHandle The image handle of the driver.\r
- @param[in] SystemTable The system table.\r
-\r
- @retval EFI_ALREADY_STARTED The driver already exists in system.\r
- @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack of resources.\r
- @retval EFI_SUCCES All the related protocols are installed on the driver.\r
- @retval Others Fail to install protocols as indicated.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEEConfigDriverEntryPoint (\r
- IN EFI_HANDLE ImageHandle,\r
- IN EFI_SYSTEM_TABLE *SystemTable\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TREE_CONFIG_PRIVATE_DATA *PrivateData;\r
- TREE_CONFIGURATION TrEEConfiguration;\r
- TREE_DEVICE_DETECTION TrEEDeviceDetection;\r
- UINTN Index;\r
- UINTN DataSize;\r
- EDKII_VARIABLE_LOCK_PROTOCOL *VariableLockProtocol;\r
-\r
- Status = gBS->OpenProtocol (\r
- ImageHandle,\r
- &gEfiCallerIdGuid,\r
- NULL,\r
- ImageHandle,\r
- ImageHandle,\r
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- return EFI_ALREADY_STARTED;\r
- }\r
- \r
- //\r
- // Create a private data structure.\r
- //\r
- PrivateData = AllocateCopyPool (sizeof (TREE_CONFIG_PRIVATE_DATA), &mTrEEConfigPrivateDateTemplate);\r
- ASSERT (PrivateData != NULL);\r
-\r
- //\r
- // Install private GUID.\r
- // \r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &ImageHandle,\r
- &gEfiCallerIdGuid,\r
- PrivateData,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- DataSize = sizeof(TrEEConfiguration);\r
- Status = gRT->GetVariable (\r
- TREE_STORAGE_NAME,\r
- &gTrEEConfigFormSetGuid,\r
- NULL,\r
- &DataSize,\r
- &TrEEConfiguration\r
- );\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // Variable not ready, set default value\r
- //\r
- TrEEConfiguration.TpmDevice = TPM_DEVICE_DEFAULT;\r
- }\r
-\r
- //\r
- // Validation\r
- //\r
- if ((TrEEConfiguration.TpmDevice > TPM_DEVICE_MAX) || (TrEEConfiguration.TpmDevice < TPM_DEVICE_MIN)) {\r
- TrEEConfiguration.TpmDevice = TPM_DEVICE_DEFAULT;\r
- }\r
-\r
- //\r
- // Save to variable so platform driver can get it.\r
- //\r
- Status = gRT->SetVariable (\r
- TREE_STORAGE_NAME,\r
- &gTrEEConfigFormSetGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
- sizeof(TrEEConfiguration),\r
- &TrEEConfiguration\r
- );\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "TrEEConfigDriver: Fail to set TREE_STORAGE_NAME\n"));\r
- }\r
-\r
- //\r
- // Sync data from PCD to variable, so that we do not need detect again in S3 phase.\r
- //\r
- TrEEDeviceDetection.TpmDeviceDetected = TPM_DEVICE_NULL;\r
- for (Index = 0; Index < sizeof(mTpmInstanceId)/sizeof(mTpmInstanceId[0]); Index++) {\r
- if (CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &mTpmInstanceId[Index].TpmInstanceGuid)) {\r
- TrEEDeviceDetection.TpmDeviceDetected = mTpmInstanceId[Index].TpmDevice;\r
- break;\r
- }\r
- }\r
-\r
- PrivateData->TpmDeviceDetected = TrEEDeviceDetection.TpmDeviceDetected;\r
-\r
- //\r
- // Save to variable so platform driver can get it.\r
- //\r
- Status = gRT->SetVariable (\r
- TREE_DEVICE_DETECTION_NAME,\r
- &gTrEEConfigFormSetGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
- sizeof(TrEEDeviceDetection),\r
- &TrEEDeviceDetection\r
- );\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((EFI_D_ERROR, "TrEEConfigDriver: Fail to set TREE_DEVICE_DETECTION_NAME\n"));\r
- Status = gRT->SetVariable (\r
- TREE_DEVICE_DETECTION_NAME,\r
- &gTrEEConfigFormSetGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
- 0,\r
- NULL\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
-\r
- //\r
- // We should lock TrEEDeviceDetection, because it contains information needed at S3.\r
- //\r
- Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLockProtocol);\r
- if (!EFI_ERROR (Status)) {\r
- Status = VariableLockProtocol->RequestToLock (\r
- VariableLockProtocol,\r
- TREE_DEVICE_DETECTION_NAME,\r
- &gTrEEConfigFormSetGuid\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- }\r
- \r
- //\r
- // Install TrEE configuration form\r
- //\r
- Status = InstallTrEEConfigForm (PrivateData);\r
- if (EFI_ERROR (Status)) {\r
- goto ErrorExit;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-\r
-ErrorExit:\r
- if (PrivateData != NULL) {\r
- UninstallTrEEConfigForm (PrivateData);\r
- } \r
- \r
- return Status;\r
-}\r
-\r
-/**\r
- Unload the TrEE configuration form.\r
-\r
- @param[in] ImageHandle The driver's image handle.\r
-\r
- @retval EFI_SUCCESS The TrEE configuration form is unloaded.\r
- @retval Others Failed to unload the form.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEEConfigDriverUnload (\r
- IN EFI_HANDLE ImageHandle\r
- )\r
-{\r
- EFI_STATUS Status;\r
- TREE_CONFIG_PRIVATE_DATA *PrivateData;\r
-\r
- Status = gBS->HandleProtocol (\r
- ImageHandle,\r
- &gEfiCallerIdGuid,\r
- (VOID **) &PrivateData\r
- ); \r
- if (EFI_ERROR (Status)) {\r
- return Status; \r
- }\r
- \r
- ASSERT (PrivateData->Signature == TREE_CONFIG_PRIVATE_DATA_SIGNATURE);\r
-\r
- gBS->UninstallMultipleProtocolInterfaces (\r
- &ImageHandle,\r
- &gEfiCallerIdGuid,\r
- PrivateData,\r
- NULL\r
- );\r
- \r
- UninstallTrEEConfigForm (PrivateData);\r
-\r
- return EFI_SUCCESS;\r
-}\r
+++ /dev/null
-## @file\r
-# TPM device configuration for TPM 2.0\r
-# \r
-# By this module, user may select TPM device, clear TPM state, etc.\r
-# NOTE: This module is only for reference only, each platform should have its own setup page.\r
-#\r
-# Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = TrEEConfigDxe\r
- MODULE_UNI_FILE = TrEEConfigDxe.uni\r
- FILE_GUID = 3141FD4D-EA02-4a70-9BCE-97EE837319AC\r
- MODULE_TYPE = DXE_DRIVER\r
- VERSION_STRING = 1.0\r
- ENTRY_POINT = TrEEConfigDriverEntryPoint\r
- UNLOAD_IMAGE = TrEEConfigDriverUnload\r
-\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources]\r
- TrEEConfigDriver.c\r
- TrEEConfigImpl.c\r
- TrEEConfigImpl.h\r
- TrEEConfig.vfr\r
- TrEEConfigStrings.uni\r
- TrEEConfigNvData.h\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- SecurityPkg/SecurityPkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- BaseMemoryLib\r
- MemoryAllocationLib\r
- UefiLib\r
- UefiBootServicesTableLib\r
- UefiRuntimeServicesTableLib\r
- UefiDriverEntryPoint\r
- UefiHiiServicesLib\r
- DebugLib\r
- HiiLib\r
- PcdLib\r
- PrintLib\r
- Tpm2DeviceLib\r
- Tpm2CommandLib\r
-\r
-[Guids]\r
- ## SOMETIMES_PRODUCES ## Variable:L"TrEEPhysicalPresence"\r
- ## SOMETIMES_CONSUMES ## Variable:L"TrEEPhysicalPresence"\r
- gEfiTrEEPhysicalPresenceGuid\r
- \r
- ## PRODUCES ## HII\r
- ## SOMETIMES_PRODUCES ## Variable:L"TREE_CONFIGURATION"\r
- ## SOMETIMES_CONSUMES ## Variable:L"TREE_CONFIGURATION"\r
- ## PRODUCES ## Variable:L"TREE_DEVICE_DETECTION"\r
- ## SOMETIMES_CONSUMES ## Variable:L"TREE_DEVICE_DETECTION"\r
- gTrEEConfigFormSetGuid\r
-\r
-[Protocols]\r
- gEfiHiiConfigAccessProtocolGuid ## PRODUCES\r
- gEfiDevicePathProtocolGuid ## PRODUCES\r
- gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES\r
-\r
-[Pcd]\r
- gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES\r
-\r
-[Depex]\r
- gEfiTrEEProtocolGuid AND\r
- gEfiHiiConfigRoutingProtocolGuid AND\r
- gEfiHiiDatabaseProtocolGuid AND\r
- gEfiVariableArchProtocolGuid AND\r
- gEfiVariableWriteArchProtocolGuid\r
- \r
-[UserExtensions.TianoCore."ExtraFiles"]\r
- TrEEConfigDxeExtra.uni
\ No newline at end of file
+++ /dev/null
-// /** @file\r
-// TPM device configuration for TPM 2.0\r
-//\r
-// By this module, user may select TPM device, clear TPM state, etc.\r
-// NOTE: This module is only for reference only, each platform should have its own setup page.\r
-//\r
-// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-// **/\r
-\r
-\r
-#string STR_MODULE_ABSTRACT #language en-US "TPM device configuration for TPM 2.0"\r
-\r
-#string STR_MODULE_DESCRIPTION #language en-US "By this module, user may select TPM device, clear TPM state, etc. NOTE: This module is only for reference only, each platform should have its own setup page."\r
-\r
+++ /dev/null
-// /** @file\r
-// TrEEConfigDxe Localized Strings and Content\r
-//\r
-// Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-// **/\r
-\r
-#string STR_PROPERTIES_MODULE_NAME \r
-#language en-US \r
-"TrEE (Trusted Execution Environment) Configuration DXE"\r
-\r
-\r
+++ /dev/null
-/** @file\r
- HII Config Access protocol implementation of TREE configuration module.\r
- NOTE: This module is only for reference only, each platform should have its own setup page.\r
-\r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "TrEEConfigImpl.h"\r
-#include <Library/PcdLib.h>\r
-#include <Library/Tpm2CommandLib.h>\r
-#include <Guid/TpmInstance.h>\r
-\r
-TPM_INSTANCE_ID mTpmInstanceId[TPM_DEVICE_MAX + 1] = TPM_INSTANCE_ID_LIST;\r
-\r
-TREE_CONFIG_PRIVATE_DATA mTrEEConfigPrivateDateTemplate = {\r
- TREE_CONFIG_PRIVATE_DATA_SIGNATURE,\r
- {\r
- TrEEExtractConfig,\r
- TrEERouteConfig,\r
- TrEECallback\r
- }\r
-};\r
-\r
-HII_VENDOR_DEVICE_PATH mTrEEHiiVendorDevicePath = {\r
- {\r
- {\r
- HARDWARE_DEVICE_PATH,\r
- HW_VENDOR_DP,\r
- {\r
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
- }\r
- },\r
- TREE_CONFIG_FORM_SET_GUID\r
- },\r
- {\r
- END_DEVICE_PATH_TYPE,\r
- END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
- { \r
- (UINT8) (END_DEVICE_PATH_LENGTH),\r
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
- }\r
- }\r
-};\r
-\r
-/**\r
- This function allows a caller to extract the current configuration for one\r
- or more named elements from the target driver.\r
-\r
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param[in] Request A null-terminated Unicode string in\r
- <ConfigRequest> format.\r
- @param[out] Progress On return, points to a character in the Request\r
- string. Points to the string's null terminator if\r
- request was successful. Points to the most recent\r
- '&' before the first failing name/value pair (or\r
- the beginning of the string if the failure is in\r
- the first name/value pair) if the request was not\r
- successful.\r
- @param[out] Results A null-terminated Unicode string in\r
- <ConfigAltResp> format which has all values filled\r
- in for the names in the Request string. String to\r
- be allocated by the called function.\r
-\r
- @retval EFI_SUCCESS The Results is filled with the requested values.\r
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
- driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEEExtractConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Request,\r
- OUT EFI_STRING *Progress,\r
- OUT EFI_STRING *Results\r
- )\r
-{\r
- if (Progress == NULL || Results == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- *Progress = Request;\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- Save TPM request to variable space.\r
-\r
- @param[in] PpRequest Physical Presence request command.\r
-\r
- @retval EFI_SUCCESS The operation is finished successfully.\r
- @retval Others Other errors as indicated.\r
-\r
-**/\r
-EFI_STATUS\r
-SaveTrEEPpRequest (\r
- IN UINT8 PpRequest\r
- )\r
-{\r
- EFI_STATUS Status;\r
- UINTN DataSize;\r
- EFI_TREE_PHYSICAL_PRESENCE PpData;\r
-\r
- //\r
- // Save TPM command to variable.\r
- //\r
- DataSize = sizeof (EFI_TREE_PHYSICAL_PRESENCE);\r
- Status = gRT->GetVariable (\r
- TREE_PHYSICAL_PRESENCE_VARIABLE,\r
- &gEfiTrEEPhysicalPresenceGuid,\r
- NULL,\r
- &DataSize,\r
- &PpData\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- } \r
- \r
- PpData.PPRequest = PpRequest;\r
- Status = gRT->SetVariable (\r
- TREE_PHYSICAL_PRESENCE_VARIABLE,\r
- &gEfiTrEEPhysicalPresenceGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
- DataSize,\r
- &PpData\r
- );\r
- if (EFI_ERROR(Status)) {\r
- return Status;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
- This function processes the results of changes in configuration.\r
-\r
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r
- format.\r
- @param[out] Progress A pointer to a string filled in with the offset of\r
- the most recent '&' before the first failing\r
- name/value pair (or the beginning of the string if\r
- the failure is in the first name/value pair) or\r
- the terminating NULL if all was successful.\r
-\r
- @retval EFI_SUCCESS The Results is processed successfully.\r
- @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
- driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEERouteConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Configuration,\r
- OUT EFI_STRING *Progress\r
- )\r
-{\r
- if (Configuration == NULL || Progress == NULL) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return EFI_NOT_FOUND;\r
-}\r
-\r
-/**\r
- This function processes the results of changes in configuration.\r
-\r
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param[in] Action Specifies the type of action taken by the browser.\r
- @param[in] QuestionId A unique value which is sent to the original\r
- exporting driver so that it can identify the type\r
- of data to expect.\r
- @param[in] Type The type of value for the question.\r
- @param[in] Value A pointer to the data being sent to the original\r
- exporting driver.\r
- @param[out] ActionRequest On return, points to the action requested by the\r
- callback function.\r
-\r
- @retval EFI_SUCCESS The callback successfully handled the action.\r
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
- variable and its data.\r
- @retval EFI_DEVICE_ERROR The variable could not be saved.\r
- @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
- callback.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEECallback (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN EFI_BROWSER_ACTION Action,\r
- IN EFI_QUESTION_ID QuestionId,\r
- IN UINT8 Type,\r
- IN EFI_IFR_TYPE_VALUE *Value,\r
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
- )\r
-{\r
- if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- \r
- if (Action == EFI_BROWSER_ACTION_CHANGED) {\r
- if (QuestionId == KEY_TPM_DEVICE) {\r
- return EFI_SUCCESS;\r
- }\r
- if (QuestionId == KEY_TPM2_OPERATION) {\r
- return SaveTrEEPpRequest (Value->u8);\r
- }\r
- }\r
-\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
- This function publish the TREE configuration Form for TPM device.\r
-\r
- @param[in, out] PrivateData Points to TREE configuration private data.\r
-\r
- @retval EFI_SUCCESS HII Form is installed for this network device.\r
- @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r
- @retval Others Other errors as indicated.\r
-\r
-**/\r
-EFI_STATUS\r
-InstallTrEEConfigForm (\r
- IN OUT TREE_CONFIG_PRIVATE_DATA *PrivateData\r
- )\r
-{\r
- EFI_STATUS Status;\r
- EFI_HII_HANDLE HiiHandle;\r
- EFI_HANDLE DriverHandle;\r
- EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;\r
-\r
- DriverHandle = NULL;\r
- ConfigAccess = &PrivateData->ConfigAccess;\r
- Status = gBS->InstallMultipleProtocolInterfaces (\r
- &DriverHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- &mTrEEHiiVendorDevicePath,\r
- &gEfiHiiConfigAccessProtocolGuid,\r
- ConfigAccess,\r
- NULL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return Status;\r
- }\r
-\r
- PrivateData->DriverHandle = DriverHandle;\r
-\r
- //\r
- // Publish the HII package list\r
- //\r
- HiiHandle = HiiAddPackages (\r
- &gTrEEConfigFormSetGuid,\r
- DriverHandle,\r
- TrEEConfigDxeStrings,\r
- TrEEConfigBin,\r
- NULL\r
- );\r
- if (HiiHandle == NULL) {\r
- gBS->UninstallMultipleProtocolInterfaces (\r
- DriverHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- &mTrEEHiiVendorDevicePath,\r
- &gEfiHiiConfigAccessProtocolGuid,\r
- ConfigAccess,\r
- NULL\r
- ); \r
-\r
- return EFI_OUT_OF_RESOURCES;\r
- }\r
- \r
- PrivateData->HiiHandle = HiiHandle;\r
-\r
- //\r
- // Update static data\r
- //\r
- switch (PrivateData->TpmDeviceDetected) {\r
- case TPM_DEVICE_NULL:\r
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TREE_DEVICE_STATE_CONTENT), L"Not Found", NULL);\r
- break;\r
- case TPM_DEVICE_1_2:\r
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TREE_DEVICE_STATE_CONTENT), L"TPM 1.2", NULL);\r
- break;\r
- case TPM_DEVICE_2_0_DTPM:\r
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TREE_DEVICE_STATE_CONTENT), L"TPM 2.0 (DTPM)", NULL);\r
- break;\r
- default:\r
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TREE_DEVICE_STATE_CONTENT), L"Unknown", NULL);\r
- break;\r
- }\r
-\r
- return EFI_SUCCESS; \r
-}\r
-\r
-/**\r
- This function removes TREE configuration Form.\r
-\r
- @param[in, out] PrivateData Points to TREE configuration private data.\r
-\r
-**/\r
-VOID\r
-UninstallTrEEConfigForm (\r
- IN OUT TREE_CONFIG_PRIVATE_DATA *PrivateData\r
- )\r
-{\r
- //\r
- // Uninstall HII package list\r
- //\r
- if (PrivateData->HiiHandle != NULL) {\r
- HiiRemovePackages (PrivateData->HiiHandle);\r
- PrivateData->HiiHandle = NULL;\r
- }\r
-\r
- //\r
- // Uninstall HII Config Access Protocol\r
- //\r
- if (PrivateData->DriverHandle != NULL) {\r
- gBS->UninstallMultipleProtocolInterfaces (\r
- PrivateData->DriverHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- &mTrEEHiiVendorDevicePath,\r
- &gEfiHiiConfigAccessProtocolGuid,\r
- &PrivateData->ConfigAccess,\r
- NULL\r
- );\r
- PrivateData->DriverHandle = NULL;\r
- }\r
- \r
- FreePool (PrivateData);\r
-}\r
+++ /dev/null
-/** @file\r
- The header file of HII Config Access protocol implementation of TREE\r
- configuration module.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __TREE_CONFIG_IMPL_H__\r
-#define __TREE_CONFIG_IMPL_H__\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Protocol/HiiConfigAccess.h>\r
-#include <Protocol/HiiConfigRouting.h>\r
-#include <Protocol/TrEEProtocol.h>\r
-#include <Protocol/VariableLock.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/UefiRuntimeServicesTableLib.h>\r
-#include <Library/UefiHiiServicesLib.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/HiiLib.h>\r
-#include <Library/DevicePathLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/PrintLib.h>\r
-\r
-#include <Guid/MdeModuleHii.h>\r
-\r
-#include "TrEEConfigNvData.h"\r
-\r
-//\r
-// Tool generated IFR binary data and String package data\r
-//\r
-extern UINT8 TrEEConfigBin[];\r
-extern UINT8 TrEEConfigDxeStrings[];\r
-\r
-///\r
-/// HII specific Vendor Device Path definition.\r
-///\r
-typedef struct {\r
- VENDOR_DEVICE_PATH VendorDevicePath;\r
- EFI_DEVICE_PATH_PROTOCOL End;\r
-} HII_VENDOR_DEVICE_PATH;\r
-\r
-typedef struct {\r
- UINTN Signature;\r
-\r
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;\r
- EFI_HII_HANDLE HiiHandle;\r
- EFI_HANDLE DriverHandle; \r
-\r
- UINT8 TpmDeviceDetected;\r
-} TREE_CONFIG_PRIVATE_DATA;\r
-\r
-extern TREE_CONFIG_PRIVATE_DATA mTrEEConfigPrivateDateTemplate;\r
-\r
-#define TREE_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'r', 'E', 'D')\r
-#define TREE_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, TREE_CONFIG_PRIVATE_DATA, ConfigAccess, TREE_CONFIG_PRIVATE_DATA_SIGNATURE)\r
-\r
-\r
-/**\r
- This function publish the TREE configuration Form for TPM device.\r
-\r
- @param[in, out] PrivateData Points to TREE configuration private data.\r
-\r
- @retval EFI_SUCCESS HII Form is installed for this network device.\r
- @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.\r
- @retval Others Other errors as indicated.\r
-\r
-**/\r
-EFI_STATUS\r
-InstallTrEEConfigForm (\r
- IN OUT TREE_CONFIG_PRIVATE_DATA *PrivateData\r
- );\r
-\r
-/**\r
- This function removes TREE configuration Form.\r
-\r
- @param[in, out] PrivateData Points to TREE configuration private data.\r
-\r
-**/\r
-VOID\r
-UninstallTrEEConfigForm (\r
- IN OUT TREE_CONFIG_PRIVATE_DATA *PrivateData\r
- );\r
-\r
-/**\r
- This function allows a caller to extract the current configuration for one\r
- or more named elements from the target driver.\r
-\r
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param[in] Request A null-terminated Unicode string in\r
- <ConfigRequest> format.\r
- @param[out] Progress On return, points to a character in the Request\r
- string. Points to the string's null terminator if\r
- request was successful. Points to the most recent\r
- '&' before the first failing name/value pair (or\r
- the beginning of the string if the failure is in\r
- the first name/value pair) if the request was not\r
- successful.\r
- @param[out] Results A null-terminated Unicode string in\r
- <ConfigAltResp> format which has all values filled\r
- in for the names in the Request string. String to\r
- be allocated by the called function.\r
-\r
- @retval EFI_SUCCESS The Results is filled with the requested values.\r
- @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.\r
- @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
- driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEEExtractConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Request,\r
- OUT EFI_STRING *Progress,\r
- OUT EFI_STRING *Results\r
- );\r
-\r
-/**\r
- This function processes the results of changes in configuration.\r
-\r
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param[in] Configuration A null-terminated Unicode string in <ConfigResp>\r
- format.\r
- @param[out] Progress A pointer to a string filled in with the offset of\r
- the most recent '&' before the first failing\r
- name/value pair (or the beginning of the string if\r
- the failure is in the first name/value pair) or\r
- the terminating NULL if all was successful.\r
-\r
- @retval EFI_SUCCESS The Results is processed successfully.\r
- @retval EFI_INVALID_PARAMETER Configuration is NULL.\r
- @retval EFI_NOT_FOUND Routing data doesn't match any storage in this\r
- driver.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEERouteConfig (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN CONST EFI_STRING Configuration,\r
- OUT EFI_STRING *Progress\r
- );\r
-\r
-/**\r
- This function processes the results of changes in configuration.\r
-\r
- @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
- @param[in] Action Specifies the type of action taken by the browser.\r
- @param[in] QuestionId A unique value which is sent to the original\r
- exporting driver so that it can identify the type\r
- of data to expect.\r
- @param[in] Type The type of value for the question.\r
- @param[in] Value A pointer to the data being sent to the original\r
- exporting driver.\r
- @param[out] ActionRequest On return, points to the action requested by the\r
- callback function.\r
-\r
- @retval EFI_SUCCESS The callback successfully handled the action.\r
- @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the\r
- variable and its data.\r
- @retval EFI_DEVICE_ERROR The variable could not be saved.\r
- @retval EFI_UNSUPPORTED The specified Action is not supported by the\r
- callback.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEECallback (\r
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,\r
- IN EFI_BROWSER_ACTION Action,\r
- IN EFI_QUESTION_ID QuestionId,\r
- IN UINT8 Type,\r
- IN EFI_IFR_TYPE_VALUE *Value,\r
- OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest\r
- );\r
-\r
-#endif\r
+++ /dev/null
-/** @file\r
- Header file for NV data structure definition.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __TREE_CONFIG_NV_DATA_H__\r
-#define __TREE_CONFIG_NV_DATA_H__\r
-\r
-#include <Guid/HiiPlatformSetupFormset.h>\r
-#include <Guid/TrEEPhysicalPresenceData.h>\r
-#include <Guid/TrEEConfigHii.h>\r
-\r
-#define TREE_CONFIGURATION_VARSTORE_ID 0x0001\r
-#define TREE_CONFIGURATION_FORM_ID 0x0001\r
-\r
-#define KEY_TPM_DEVICE 0x2000\r
-#define KEY_TPM2_OPERATION 0x2001\r
-\r
-#define TPM_DEVICE_NULL 0\r
-#define TPM_DEVICE_1_2 1\r
-#define TPM_DEVICE_2_0_DTPM 2\r
-#define TPM_DEVICE_MIN TPM_DEVICE_1_2\r
-#define TPM_DEVICE_MAX TPM_DEVICE_2_0_DTPM\r
-#define TPM_DEVICE_DEFAULT TPM_DEVICE_1_2\r
-\r
-//\r
-// Nv Data structure referenced by IFR, TPM device user desired\r
-//\r
-typedef struct {\r
- UINT8 TpmDevice;\r
-} TREE_CONFIGURATION;\r
-\r
-//\r
-// Variable saved for S3, TPM detected, only valid in S3 path.\r
-// This variable is ReadOnly.\r
-//\r
-typedef struct {\r
- UINT8 TpmDeviceDetected;\r
-} TREE_DEVICE_DETECTION;\r
-\r
-#define TREE_STORAGE_NAME L"TREE_CONFIGURATION"\r
-#define TREE_DEVICE_DETECTION_NAME L"TREE_DEVICE_DETECTION"\r
-\r
-#define TPM_INSTANCE_ID_LIST { \\r
- {TPM_DEVICE_INTERFACE_NONE, TPM_DEVICE_NULL}, \\r
- {TPM_DEVICE_INTERFACE_TPM12, TPM_DEVICE_1_2}, \\r
- {TPM_DEVICE_INTERFACE_TPM20_DTPM, TPM_DEVICE_2_0_DTPM}, \\r
-}\r
-\r
-//\r
-// BUGBUG: In order to pass VfrCompiler, we have to redefine GUID here.\r
-//\r
-#ifndef __BASE_H__\r
-typedef struct {\r
- UINT32 Data1;\r
- UINT16 Data2;\r
- UINT16 Data3;\r
- UINT8 Data4[8];\r
-} GUID;\r
-#endif\r
-\r
-typedef struct {\r
- GUID TpmInstanceGuid;\r
- UINT8 TpmDevice;\r
-} TPM_INSTANCE_ID;\r
-\r
-#endif\r
+++ /dev/null
-## @file\r
-# Set TPM device type\r
-#\r
-# This module initializes TPM device type based on variable and detection.\r
-# NOTE: This module is only for reference only, each platform should have its own setup page.\r
-#\r
-# Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>\r
-# This program and the accompanying materials\r
-# are licensed and made available under the terms and conditions of the BSD License\r
-# which accompanies this distribution. The full text of the license may be found at\r
-# http://opensource.org/licenses/bsd-license.php\r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-#\r
-##\r
-\r
-[Defines]\r
- INF_VERSION = 0x00010005\r
- BASE_NAME = TrEEConfigPei\r
- MODULE_UNI_FILE = TrEEConfigPei.uni\r
- FILE_GUID = A5C1EF72-9379-4370-B4C7-0F5126CAC38E\r
- MODULE_TYPE = PEIM\r
- VERSION_STRING = 1.0\r
- ENTRY_POINT = TrEEConfigPeimEntryPoint\r
-\r
-#\r
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
-#\r
-# [BootMode]\r
-# S3_RESUME ## SOMETIMES_CONSUMES\r
-#\r
-\r
-[Sources]\r
- TrEEConfigPeim.c\r
- TrEEConfigNvData.h\r
- TpmDetection.c\r
-\r
-[Packages]\r
- MdePkg/MdePkg.dec\r
- MdeModulePkg/MdeModulePkg.dec\r
- SecurityPkg/SecurityPkg.dec\r
-\r
-[LibraryClasses]\r
- BaseLib\r
- BaseMemoryLib\r
- MemoryAllocationLib\r
- PeiServicesLib\r
- PeimEntryPoint\r
- DebugLib\r
- PcdLib\r
- TimerLib\r
- Tpm12CommandLib\r
- Tpm12DeviceLib\r
-\r
-[Guids]\r
- ## SOMETIMES_CONSUMES ## Variable:L"TREE_CONFIGURATION"\r
- ## SOMETIMES_CONSUMES ## Variable:L"TREE_DEVICE_DETECTION"\r
- gTrEEConfigFormSetGuid\r
- gEfiTpmDeviceSelectedGuid ## PRODUCES ## GUID # Used as a PPI GUID\r
- gEfiTpmDeviceInstanceNoneGuid ## SOMETIMES_CONSUMES ## GUID # TPM device identifier\r
-\r
-[Ppis]\r
- gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES\r
- gPeiTpmInitializationDonePpiGuid ## SOMETIMES_PRODUCES\r
-\r
-[Pcd]\r
- gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## PRODUCES\r
- gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy ## PRODUCES\r
- gEfiSecurityPkgTokenSpaceGuid.PcdTpmAutoDetection ## CONSUMES \r
- gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress ## SOMETIMES_CONSUMES\r
-\r
-[Depex]\r
- gEfiPeiMasterBootModePpiGuid AND\r
- gEfiPeiReadOnlyVariable2PpiGuid\r
- \r
-[UserExtensions.TianoCore."ExtraFiles"]\r
- TrEEConfigPeiExtra.uni
\ No newline at end of file
+++ /dev/null
-// /** @file\r
-// Set TPM device type\r
-//\r
-// This module initializes TPM device type based on variable and detection.\r
-// NOTE: This module is only for reference only, each platform should have its own setup page.\r
-//\r
-// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-// **/\r
-\r
-\r
-#string STR_MODULE_ABSTRACT #language en-US "Set TPM device type"\r
-\r
-#string STR_MODULE_DESCRIPTION #language en-US "This module initializes TPM device type based on variable and detection.\n"\r
- "NOTE: This module is only for reference only, each platform should have its own setup page."\r
-\r
+++ /dev/null
-// /** @file\r
-// TrEEConfigDxe Localized Strings and Content\r
-//\r
-// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
-//\r
-// This program and the accompanying materials\r
-// are licensed and made available under the terms and conditions of the BSD License\r
-// which accompanies this distribution. The full text of the license may be found at\r
-// http://opensource.org/licenses/bsd-license.php\r
-// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-//\r
-// **/\r
-\r
-#string STR_PROPERTIES_MODULE_NAME \r
-#language en-US \r
-"TrEE (Trusted Execution Environment) Configuration DXE"\r
-\r
-\r
+++ /dev/null
-/** @file\r
- The module entry point for TrEE configuration module.\r
-\r
-Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-\r
-#include <PiPei.h>\r
-\r
-#include <Guid/TpmInstance.h>\r
-\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/PeiServicesLib.h>\r
-#include <Library/PcdLib.h>\r
-\r
-#include <Ppi/ReadOnlyVariable2.h>\r
-#include <Ppi/TpmInitialized.h>\r
-#include <Protocol/TrEEProtocol.h>\r
-\r
-#include "TrEEConfigNvData.h"\r
-\r
-TPM_INSTANCE_ID mTpmInstanceId[] = TPM_INSTANCE_ID_LIST;\r
-\r
-CONST EFI_PEI_PPI_DESCRIPTOR gTpmSelectedPpi = {\r
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
- &gEfiTpmDeviceSelectedGuid,\r
- NULL\r
-};\r
-\r
-EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList = {\r
- EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
- &gPeiTpmInitializationDonePpiGuid,\r
- NULL\r
-};\r
-\r
-/**\r
- This routine check both SetupVariable and real TPM device, and return final TpmDevice configuration.\r
-\r
- @param SetupTpmDevice TpmDevice configuration in setup driver\r
-\r
- @return TpmDevice configuration\r
-**/\r
-UINT8\r
-DetectTpmDevice (\r
- IN UINT8 SetupTpmDevice\r
- );\r
-\r
-/**\r
- The entry point for TrEE configuration driver.\r
-\r
- @param FileHandle Handle of the file being invoked.\r
- @param PeiServices Describes the list of possible PEI Services.\r
-\r
- @retval EFI_SUCCES Convert variable to PCD successfully.\r
- @retval Others Fail to convert variable to PCD.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-TrEEConfigPeimEntryPoint (\r
- IN EFI_PEI_FILE_HANDLE FileHandle,\r
- IN CONST EFI_PEI_SERVICES **PeiServices\r
- )\r
-{\r
- UINTN Size;\r
- EFI_STATUS Status;\r
- EFI_STATUS Status2;\r
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;\r
- TREE_CONFIGURATION TrEEConfiguration;\r
- UINTN Index;\r
- UINT8 TpmDevice;\r
-\r
- Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- Size = sizeof(TrEEConfiguration);\r
- Status = VariablePpi->GetVariable (\r
- VariablePpi,\r
- TREE_STORAGE_NAME,\r
- &gTrEEConfigFormSetGuid,\r
- NULL,\r
- &Size,\r
- &TrEEConfiguration\r
- );\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // Variable not ready, set default value\r
- //\r
- TrEEConfiguration.TpmDevice = TPM_DEVICE_DEFAULT;\r
- }\r
-\r
- //\r
- // Validation\r
- //\r
- if ((TrEEConfiguration.TpmDevice > TPM_DEVICE_MAX) || (TrEEConfiguration.TpmDevice < TPM_DEVICE_MIN)) {\r
- TrEEConfiguration.TpmDevice = TPM_DEVICE_DEFAULT;\r
- }\r
-\r
- //\r
- // Although we have SetupVariable info, we still need detect TPM device manually.\r
- //\r
- DEBUG ((EFI_D_INFO, "TrEEConfiguration.TpmDevice from Setup: %x\n", TrEEConfiguration.TpmDevice));\r
-\r
- if (PcdGetBool (PcdTpmAutoDetection)) {\r
- TpmDevice = DetectTpmDevice (TrEEConfiguration.TpmDevice);\r
- DEBUG ((EFI_D_INFO, "TpmDevice final: %x\n", TpmDevice));\r
- if (TpmDevice != TPM_DEVICE_NULL) {\r
- TrEEConfiguration.TpmDevice = TpmDevice;\r
- }\r
- } else {\r
- TpmDevice = TrEEConfiguration.TpmDevice;\r
- }\r
-\r
- //\r
- // Convert variable to PCD.\r
- // This is work-around because there is no gurantee DynamicHiiPcd can return correct value in DXE phase.\r
- // Using DynamicPcd instead.\r
- //\r
- // NOTE: TrEEConfiguration variable contains the desired TpmDevice type,\r
- // while PcdTpmInstanceGuid PCD contains the real detected TpmDevice type\r
- //\r
- for (Index = 0; Index < sizeof(mTpmInstanceId)/sizeof(mTpmInstanceId[0]); Index++) {\r
- if (TpmDevice == mTpmInstanceId[Index].TpmDevice) {\r
- Size = sizeof(mTpmInstanceId[Index].TpmInstanceGuid);\r
- Status = PcdSetPtrS (PcdTpmInstanceGuid, &Size, &mTpmInstanceId[Index].TpmInstanceGuid);\r
- ASSERT_EFI_ERROR (Status);\r
- DEBUG ((EFI_D_INFO, "TpmDevice PCD: %g\n", &mTpmInstanceId[Index].TpmInstanceGuid));\r
- break;\r
- }\r
- }\r
-\r
- //\r
- // Selection done\r
- //\r
- Status = PeiServicesInstallPpi (&gTpmSelectedPpi);\r
- ASSERT_EFI_ERROR (Status);\r
-\r
- //\r
- // Even if no TPM is selected or detected, we still need intall TpmInitializationDonePpi.\r
- // Because TcgPei or TrEEPei will not run, but we still need a way to notify other driver.\r
- // Other driver can know TPM initialization state by TpmInitializedPpi.\r
- //\r
- if (CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceNoneGuid)) {\r
- Status2 = PeiServicesInstallPpi (&mTpmInitializationDonePpiList);\r
- ASSERT_EFI_ERROR (Status2);\r
- }\r
-\r
- return Status;\r
-}\r
+++ /dev/null
-/** @file\r
- String definitions for TCG configuration form.\r
-\r
-Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#langdef en-US "English"\r
-\r
-#string STR_TREE_TITLE #language en-US "TrEE Configuration"\r
-#string STR_TREE_HELP #language en-US "Press <Enter> to select TrEE Setup options."\r
-\r
-#string STR_TREE_DEVICE_STATE_PROMPT #language en-US "Current TPM Device"\r
-#string STR_TREE_DEVICE_STATE_HELP #language en-US "Current TPM Device: Disable, TPM1.2, or TPM2.0"\r
-#string STR_TREE_DEVICE_STATE_CONTENT #language en-US ""\r
-\r
-#string STR_TREE_DEVICE_PROMPT #language en-US "Attempt TPM Device"\r
-#string STR_TREE_DEVICE_HELP #language en-US "Attempt TPM Device: Disable, TPM1.2, or TPM2.0"\r
-#string STR_TREE_DEVICE_CONTENT #language en-US ""\r
-\r
-#string STR_TREE_PP_OPERATION #language en-US "TPM2 Physical Presence Operation"\r
-\r
-#string STR_TREE_OPERATION #language en-US "TPM2 Operation"\r
-#string STR_TREE_OPERATION_HELP #language en-US "Select one of the supported operation to change TPM2 state."\r
-\r
-#string STR_TREE_NO_ACTION #language en-US "No Action"\r
-#string STR_TREE_CLEAR #language en-US "TPM2 ClearControl(NO) + Clear"\r
-\r
-#string STR_TREE_TPM_DISABLE #language en-US "Disable"\r
-#string STR_TREE_TPM_1_2 #language en-US "TPM 1.2"\r
-#string STR_TREE_TPM_2_0_DTPM #language en-US "TPM 2.0 (DTPM)"\r
-\r
-#string STR_NULL #language en-US ""\r