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