summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Tcg/Tcg2Config
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:12 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commitc411b485b63a671a1e276700cff025c73997233c (patch)
treee7a57ca51b659161ab4bc9da95e988760ec57e7a /SecurityPkg/Tcg/Tcg2Config
parent39de741e2dcb8f11e9b4438e37224797643d8451 (diff)
downloadedk2-c411b485b63a671a1e276700cff025c73997233c.tar.gz
edk2-c411b485b63a671a1e276700cff025c73997233c.tar.bz2
edk2-c411b485b63a671a1e276700cff025c73997233c.zip
SecurityPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the SecurityPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Diffstat (limited to 'SecurityPkg/Tcg/Tcg2Config')
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c168
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c453
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h64
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h82
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c33
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2Internal.h8
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/TpmDetection.c23
7 files changed, 437 insertions, 394 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
index fca5ae2645..edf5f0fc77 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
@@ -20,38 +20,42 @@ extern TPM_INSTANCE_ID mTpmInstanceId[TPM_DEVICE_MAX + 1];
**/
VOID
UpdateDefaultPCRBanks (
- IN VOID *HiiPackage,
- IN UINTN HiiPackageSize,
- IN UINT32 PCRBanks
+ IN VOID *HiiPackage,
+ IN UINTN HiiPackageSize,
+ IN UINT32 PCRBanks
)
{
- EFI_HII_PACKAGE_HEADER *HiiPackageHeader;
- EFI_IFR_OP_HEADER *IfrOpCodeHeader;
- EFI_IFR_CHECKBOX *IfrCheckBox;
- EFI_IFR_DEFAULT *IfrDefault;
+ EFI_HII_PACKAGE_HEADER *HiiPackageHeader;
+ EFI_IFR_OP_HEADER *IfrOpCodeHeader;
+ EFI_IFR_CHECKBOX *IfrCheckBox;
+ EFI_IFR_DEFAULT *IfrDefault;
HiiPackageHeader = (EFI_HII_PACKAGE_HEADER *)HiiPackage;
switch (HiiPackageHeader->Type) {
- case EFI_HII_PACKAGE_FORMS:
- IfrOpCodeHeader = (EFI_IFR_OP_HEADER *)(HiiPackageHeader + 1);
- while ((UINTN)IfrOpCodeHeader < (UINTN)HiiPackageHeader + HiiPackageHeader->Length) {
- switch (IfrOpCodeHeader->OpCode) {
- case EFI_IFR_CHECKBOX_OP:
- IfrCheckBox = (EFI_IFR_CHECKBOX *)IfrOpCodeHeader;
- if ((IfrCheckBox->Question.QuestionId >= KEY_TPM2_PCR_BANKS_REQUEST_0) && (IfrCheckBox->Question.QuestionId <= KEY_TPM2_PCR_BANKS_REQUEST_4)) {
- IfrDefault = (EFI_IFR_DEFAULT *)(IfrCheckBox + 1);
- ASSERT (IfrDefault->Header.OpCode == EFI_IFR_DEFAULT_OP);
- ASSERT (IfrDefault->Type == EFI_IFR_TYPE_BOOLEAN);
- IfrDefault->Value.b = (BOOLEAN)((PCRBanks >> (IfrCheckBox->Question.QuestionId - KEY_TPM2_PCR_BANKS_REQUEST_0)) & 0x1);
+ case EFI_HII_PACKAGE_FORMS:
+ IfrOpCodeHeader = (EFI_IFR_OP_HEADER *)(HiiPackageHeader + 1);
+ while ((UINTN)IfrOpCodeHeader < (UINTN)HiiPackageHeader + HiiPackageHeader->Length) {
+ switch (IfrOpCodeHeader->OpCode) {
+ case EFI_IFR_CHECKBOX_OP:
+ IfrCheckBox = (EFI_IFR_CHECKBOX *)IfrOpCodeHeader;
+ if ((IfrCheckBox->Question.QuestionId >= KEY_TPM2_PCR_BANKS_REQUEST_0) && (IfrCheckBox->Question.QuestionId <= KEY_TPM2_PCR_BANKS_REQUEST_4)) {
+ IfrDefault = (EFI_IFR_DEFAULT *)(IfrCheckBox + 1);
+ ASSERT (IfrDefault->Header.OpCode == EFI_IFR_DEFAULT_OP);
+ ASSERT (IfrDefault->Type == EFI_IFR_TYPE_BOOLEAN);
+ IfrDefault->Value.b = (BOOLEAN)((PCRBanks >> (IfrCheckBox->Question.QuestionId - KEY_TPM2_PCR_BANKS_REQUEST_0)) & 0x1);
+ }
+
+ break;
}
- break;
+
+ IfrOpCodeHeader = (EFI_IFR_OP_HEADER *)((UINTN)IfrOpCodeHeader + IfrOpCodeHeader->Length);
}
- IfrOpCodeHeader = (EFI_IFR_OP_HEADER *)((UINTN)IfrOpCodeHeader + IfrOpCodeHeader->Length);
- }
- break;
+
+ break;
}
- return ;
+
+ return;
}
/**
@@ -67,16 +71,16 @@ UpdateDefaultPCRBanks (
**/
VOID
InitializeTcg2VersionInfo (
- IN TCG2_CONFIG_PRIVATE_DATA *PrivateData
+ IN TCG2_CONFIG_PRIVATE_DATA *PrivateData
)
{
- EFI_STATUS Status;
- EFI_STRING ConfigRequestHdr;
- BOOLEAN ActionFlag;
- TCG2_VERSION Tcg2Version;
- UINTN DataSize;
- UINT64 PcdTcg2PpiVersion;
- UINT8 PcdTpm2AcpiTableRev;
+ EFI_STATUS Status;
+ EFI_STRING ConfigRequestHdr;
+ BOOLEAN ActionFlag;
+ TCG2_VERSION Tcg2Version;
+ UINTN DataSize;
+ UINT64 PcdTcg2PpiVersion;
+ UINT8 PcdTpm2AcpiTableRev;
//
// Get the PCD value before initializing efi varstore configuration data.
@@ -85,7 +89,7 @@ InitializeTcg2VersionInfo (
CopyMem (
&PcdTcg2PpiVersion,
PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer),
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))
+ AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))
);
PcdTpm2AcpiTableRev = PcdGet8 (PcdTpm2AcpiTableRev);
@@ -101,13 +105,13 @@ InitializeTcg2VersionInfo (
);
ASSERT (ConfigRequestHdr != NULL);
DataSize = sizeof (Tcg2Version);
- Status = gRT->GetVariable (
- TCG2_VERSION_NAME,
- &gTcg2ConfigFormSetGuid,
- NULL,
- &DataSize,
- &Tcg2Version
- );
+ Status = gRT->GetVariable (
+ TCG2_VERSION_NAME,
+ &gTcg2ConfigFormSetGuid,
+ NULL,
+ &DataSize,
+ &Tcg2Version
+ );
if (!EFI_ERROR (Status)) {
//
// EFI variable does exist and validate current setting.
@@ -123,13 +127,13 @@ InitializeTcg2VersionInfo (
// Get the default values from variable.
//
DataSize = sizeof (Tcg2Version);
- Status = gRT->GetVariable (
- TCG2_VERSION_NAME,
- &gTcg2ConfigFormSetGuid,
- NULL,
- &DataSize,
- &Tcg2Version
- );
+ Status = gRT->GetVariable (
+ TCG2_VERSION_NAME,
+ &gTcg2ConfigFormSetGuid,
+ NULL,
+ &DataSize,
+ &Tcg2Version
+ );
ASSERT_EFI_ERROR (Status);
}
} else {
@@ -160,24 +164,26 @@ InitializeTcg2VersionInfo (
// Get the default values from variable.
//
DataSize = sizeof (Tcg2Version);
- Status = gRT->GetVariable (
- TCG2_VERSION_NAME,
- &gTcg2ConfigFormSetGuid,
- NULL,
- &DataSize,
- &Tcg2Version
- );
+ Status = gRT->GetVariable (
+ TCG2_VERSION_NAME,
+ &gTcg2ConfigFormSetGuid,
+ NULL,
+ &DataSize,
+ &Tcg2Version
+ );
ASSERT_EFI_ERROR (Status);
if (PcdTcg2PpiVersion != Tcg2Version.PpiVersion) {
DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer default value is not same with the default value in VFR\n"));
DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n"));
}
+
if (PcdTpm2AcpiTableRev != Tcg2Version.Tpm2AcpiTableRev) {
DEBUG ((DEBUG_WARN, "WARNING: PcdTpm2AcpiTableRev default value is not same with the default value in VFR\n"));
DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n"));
}
}
}
+
FreePool (ConfigRequestHdr);
//
@@ -189,7 +195,7 @@ InitializeTcg2VersionInfo (
CopyMem (
&PcdTcg2PpiVersion,
PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer),
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))
+ AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))
);
if (PcdTcg2PpiVersion != Tcg2Version.PpiVersion) {
DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and does not map to TCG2_VERSION.PpiVersion\n"));
@@ -247,8 +253,8 @@ InitializeTcg2VersionInfo (
EFI_STATUS
EFIAPI
Tcg2ConfigDriverEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -289,36 +295,36 @@ Tcg2ConfigDriverEntryPoint (
);
ASSERT_EFI_ERROR (Status);
- Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **) &PrivateData->Tcg2Protocol);
+ Status = gBS->LocateProtocol (&gEfiTcg2ProtocolGuid, NULL, (VOID **)&PrivateData->Tcg2Protocol);
ASSERT_EFI_ERROR (Status);
- PrivateData->ProtocolCapability.Size = sizeof(PrivateData->ProtocolCapability);
- Status = PrivateData->Tcg2Protocol->GetCapability (
- PrivateData->Tcg2Protocol,
- &PrivateData->ProtocolCapability
- );
+ PrivateData->ProtocolCapability.Size = sizeof (PrivateData->ProtocolCapability);
+ Status = PrivateData->Tcg2Protocol->GetCapability (
+ PrivateData->Tcg2Protocol,
+ &PrivateData->ProtocolCapability
+ );
ASSERT_EFI_ERROR (Status);
- DataSize = sizeof(Tcg2Configuration);
- Status = gRT->GetVariable (
- TCG2_STORAGE_NAME,
- &gTcg2ConfigFormSetGuid,
- NULL,
- &DataSize,
- &Tcg2Configuration
- );
+ DataSize = sizeof (Tcg2Configuration);
+ Status = gRT->GetVariable (
+ TCG2_STORAGE_NAME,
+ &gTcg2ConfigFormSetGuid,
+ NULL,
+ &DataSize,
+ &Tcg2Configuration
+ );
if (EFI_ERROR (Status)) {
//
// Variable not ready, set default value
//
- Tcg2Configuration.TpmDevice = TPM_DEVICE_DEFAULT;
+ Tcg2Configuration.TpmDevice = TPM_DEVICE_DEFAULT;
}
//
// Validation
//
if ((Tcg2Configuration.TpmDevice > TPM_DEVICE_MAX) || (Tcg2Configuration.TpmDevice < TPM_DEVICE_MIN)) {
- Tcg2Configuration.TpmDevice = TPM_DEVICE_DEFAULT;
+ Tcg2Configuration.TpmDevice = TPM_DEVICE_DEFAULT;
}
//
@@ -328,21 +334,21 @@ Tcg2ConfigDriverEntryPoint (
Status = PrivateData->Tcg2Protocol->GetActivePcrBanks (PrivateData->Tcg2Protocol, &CurrentActivePCRBanks);
ASSERT_EFI_ERROR (Status);
PrivateData->PCRBanksDesired = CurrentActivePCRBanks;
- UpdateDefaultPCRBanks (Tcg2ConfigBin + sizeof(UINT32), ReadUnaligned32((UINT32 *)Tcg2ConfigBin) - sizeof(UINT32), CurrentActivePCRBanks);
+ UpdateDefaultPCRBanks (Tcg2ConfigBin + sizeof (UINT32), ReadUnaligned32 ((UINT32 *)Tcg2ConfigBin) - sizeof (UINT32), CurrentActivePCRBanks);
//
// Sync data from PCD to variable, so that we do not need detect again in S3 phase.
//
Tcg2DeviceDetection.TpmDeviceDetected = TPM_DEVICE_NULL;
- for (Index = 0; Index < sizeof(mTpmInstanceId)/sizeof(mTpmInstanceId[0]); Index++) {
- if (CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &mTpmInstanceId[Index].TpmInstanceGuid)) {
+ for (Index = 0; Index < sizeof (mTpmInstanceId)/sizeof (mTpmInstanceId[0]); Index++) {
+ if (CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &mTpmInstanceId[Index].TpmInstanceGuid)) {
Tcg2DeviceDetection.TpmDeviceDetected = mTpmInstanceId[Index].TpmDevice;
break;
}
}
PrivateData->TpmDeviceDetected = Tcg2DeviceDetection.TpmDeviceDetected;
- Tcg2Configuration.TpmDevice = Tcg2DeviceDetection.TpmDeviceDetected;
+ Tcg2Configuration.TpmDevice = Tcg2DeviceDetection.TpmDeviceDetected;
//
// Save to variable so platform driver can get it.
@@ -351,7 +357,7 @@ Tcg2ConfigDriverEntryPoint (
TCG2_DEVICE_DETECTION_NAME,
&gTcg2ConfigFormSetGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof(Tcg2DeviceDetection),
+ sizeof (Tcg2DeviceDetection),
&Tcg2DeviceDetection
);
if (EFI_ERROR (Status)) {
@@ -373,7 +379,7 @@ Tcg2ConfigDriverEntryPoint (
TCG2_STORAGE_NAME,
&gTcg2ConfigFormSetGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof(Tcg2Configuration),
+ sizeof (Tcg2Configuration),
&Tcg2Configuration
);
if (EFI_ERROR (Status)) {
@@ -428,13 +434,13 @@ Tcg2ConfigDriverUnload (
IN EFI_HANDLE ImageHandle
)
{
- EFI_STATUS Status;
- TCG2_CONFIG_PRIVATE_DATA *PrivateData;
+ EFI_STATUS Status;
+ TCG2_CONFIG_PRIVATE_DATA *PrivateData;
Status = gBS->HandleProtocol (
ImageHandle,
&gEfiCallerIdGuid,
- (VOID **) &PrivateData
+ (VOID **)&PrivateData
);
if (EFI_ERROR (Status)) {
return Status;
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
index a7446ef2f6..6eb04c0144 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
@@ -18,12 +18,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <IndustryStandard/TpmPtp.h>
-#define EFI_TCG2_EVENT_LOG_FORMAT_ALL (EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 | EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
+#define EFI_TCG2_EVENT_LOG_FORMAT_ALL (EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 | EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
TPM_INSTANCE_ID mTpmInstanceId[TPM_DEVICE_MAX + 1] = TPM_INSTANCE_ID_LIST;
-TCG2_CONFIG_PRIVATE_DATA *mTcg2ConfigPrivateDate;
-TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate = {
+TCG2_CONFIG_PRIVATE_DATA *mTcg2ConfigPrivateDate;
+TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate = {
TCG2_CONFIG_PRIVATE_DATA_SIGNATURE,
{
Tcg2ExtractConfig,
@@ -32,14 +32,14 @@ TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate = {
}
};
-HII_VENDOR_DEVICE_PATH mTcg2HiiVendorDevicePath = {
+HII_VENDOR_DEVICE_PATH mTcg2HiiVendorDevicePath = {
{
{
HARDWARE_DEVICE_PATH,
HW_VENDOR_DP,
{
- (UINT8) (sizeof (VENDOR_DEVICE_PATH)),
- (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
}
},
TCG2_CONFIG_FORM_SET_GUID
@@ -48,8 +48,8 @@ HII_VENDOR_DEVICE_PATH mTcg2HiiVendorDevicePath = {
END_DEVICE_PATH_TYPE,
END_ENTIRE_DEVICE_PATH_SUBTYPE,
{
- (UINT8) (END_DEVICE_PATH_LENGTH),
- (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)
+ (UINT8)(END_DEVICE_PATH_LENGTH),
+ (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
}
}
};
@@ -66,7 +66,7 @@ UINT8 mCurrentPpRequest;
**/
BOOLEAN
IsPtpCrbSupported (
- IN VOID *Register
+ IN VOID *Register
)
{
PTP_CRB_INTERFACE_IDENTIFIER InterfaceId;
@@ -78,9 +78,11 @@ IsPtpCrbSupported (
if (((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB) ||
(InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO)) &&
- (InterfaceId.Bits.CapCRB != 0)) {
+ (InterfaceId.Bits.CapCRB != 0))
+ {
return TRUE;
}
+
return FALSE;
}
@@ -94,7 +96,7 @@ IsPtpCrbSupported (
**/
BOOLEAN
IsPtpFifoSupported (
- IN VOID *Register
+ IN VOID *Register
)
{
PTP_CRB_INTERFACE_IDENTIFIER InterfaceId;
@@ -106,9 +108,11 @@ IsPtpFifoSupported (
if (((InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_CRB) ||
(InterfaceId.Bits.InterfaceType == PTP_INTERFACE_IDENTIFIER_INTERFACE_TYPE_FIFO)) &&
- (InterfaceId.Bits.CapFIFO != 0)) {
+ (InterfaceId.Bits.CapFIFO != 0))
+ {
return TRUE;
}
+
return FALSE;
}
@@ -126,40 +130,44 @@ IsPtpFifoSupported (
**/
EFI_STATUS
SetPtpInterface (
- IN VOID *Register,
- IN UINT8 PtpInterface
+ IN VOID *Register,
+ IN UINT8 PtpInterface
)
{
TPM2_PTP_INTERFACE_TYPE PtpInterfaceCurrent;
PTP_CRB_INTERFACE_IDENTIFIER InterfaceId;
- PtpInterfaceCurrent = PcdGet8(PcdActiveTpmInterfaceType);
+ PtpInterfaceCurrent = PcdGet8 (PcdActiveTpmInterfaceType);
if ((PtpInterfaceCurrent != Tpm2PtpInterfaceFifo) &&
- (PtpInterfaceCurrent != Tpm2PtpInterfaceCrb)) {
+ (PtpInterfaceCurrent != Tpm2PtpInterfaceCrb))
+ {
return EFI_UNSUPPORTED;
}
+
InterfaceId.Uint32 = MmioRead32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId);
if (InterfaceId.Bits.IntfSelLock != 0) {
return EFI_WRITE_PROTECTED;
}
switch (PtpInterface) {
- case Tpm2PtpInterfaceFifo:
- if (InterfaceId.Bits.CapFIFO == 0) {
- return EFI_UNSUPPORTED;
- }
- InterfaceId.Bits.InterfaceSelector = PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_FIFO;
- MmioWrite32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId, InterfaceId.Uint32);
- return EFI_SUCCESS;
- case Tpm2PtpInterfaceCrb:
- if (InterfaceId.Bits.CapCRB == 0) {
- return EFI_UNSUPPORTED;
- }
- InterfaceId.Bits.InterfaceSelector = PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_CRB;
- MmioWrite32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId, InterfaceId.Uint32);
- return EFI_SUCCESS;
- default:
- return EFI_INVALID_PARAMETER;
+ case Tpm2PtpInterfaceFifo:
+ if (InterfaceId.Bits.CapFIFO == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ InterfaceId.Bits.InterfaceSelector = PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_FIFO;
+ MmioWrite32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId, InterfaceId.Uint32);
+ return EFI_SUCCESS;
+ case Tpm2PtpInterfaceCrb:
+ if (InterfaceId.Bits.CapCRB == 0) {
+ return EFI_UNSUPPORTED;
+ }
+
+ InterfaceId.Bits.InterfaceSelector = PTP_INTERFACE_IDENTIFIER_INTERFACE_SELECTOR_CRB;
+ MmioWrite32 ((UINTN)&((PTP_CRB_REGISTERS *)Register)->InterfaceId, InterfaceId.Uint32);
+ return EFI_SUCCESS;
+ default:
+ return EFI_INVALID_PARAMETER;
}
}
@@ -192,13 +200,13 @@ SetPtpInterface (
EFI_STATUS
EFIAPI
Tcg2ExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
+ 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) {
+ if ((Progress == NULL) || (Results == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -217,7 +225,7 @@ Tcg2ExtractConfig (
**/
EFI_STATUS
SaveTcg2PpRequest (
- IN UINT8 PpRequest
+ IN UINT8 PpRequest
)
{
UINT32 ReturnCode;
@@ -226,7 +234,7 @@ SaveTcg2PpRequest (
ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (PpRequest, 0);
if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {
mCurrentPpRequest = PpRequest;
- Status = EFI_SUCCESS;
+ Status = EFI_SUCCESS;
} else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE) {
Status = EFI_OUT_OF_RESOURCES;
} else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED) {
@@ -249,7 +257,7 @@ SaveTcg2PpRequest (
**/
EFI_STATUS
SaveTcg2PpRequestParameter (
- IN UINT32 PpRequestParameter
+ IN UINT32 PpRequestParameter
)
{
UINT32 ReturnCode;
@@ -281,8 +289,8 @@ SaveTcg2PpRequestParameter (
**/
EFI_STATUS
SaveTcg2PCRBanksRequest (
- IN UINTN PCRBankIndex,
- IN BOOLEAN Enable
+ IN UINTN PCRBankIndex,
+ IN BOOLEAN Enable
)
{
UINT32 ReturnCode;
@@ -329,12 +337,12 @@ SaveTcg2PCRBanksRequest (
EFI_STATUS
EFIAPI
Tcg2RouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
)
{
- if (Configuration == NULL || Progress == NULL) {
+ if ((Configuration == NULL) || (Progress == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -353,9 +361,9 @@ Tcg2RouteConfig (
**/
EFI_STATUS
-GetTpm2HID(
- CHAR8 *Hid,
- UINTN Size
+GetTpm2HID (
+ CHAR8 *Hid,
+ UINTN Size
)
{
EFI_STATUS Status;
@@ -366,54 +374,53 @@ GetTpm2HID(
PnpHID = TRUE;
- ZeroMem(Hid, Size);
+ ZeroMem (Hid, Size);
//
// Get Manufacturer ID
//
- Status = Tpm2GetCapabilityManufactureID(&ManufacturerID);
- if (!EFI_ERROR(Status)) {
- DEBUG((DEBUG_INFO, "TPM_PT_MANUFACTURER 0x%08x\n", ManufacturerID));
+ Status = Tpm2GetCapabilityManufactureID (&ManufacturerID);
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "TPM_PT_MANUFACTURER 0x%08x\n", ManufacturerID));
//
// ManufacturerID defined in TCG Vendor ID Registry
// may tailed with 0x00 or 0x20
//
- if ((ManufacturerID >> 24) == 0x00 || ((ManufacturerID >> 24) == 0x20)) {
+ if (((ManufacturerID >> 24) == 0x00) || ((ManufacturerID >> 24) == 0x20)) {
//
// HID containing PNP ID "NNN####"
// NNN is uppercase letter for Vendor ID specified by manufacturer
//
- CopyMem(Hid, &ManufacturerID, 3);
+ CopyMem (Hid, &ManufacturerID, 3);
} else {
//
// HID containing ACP ID "NNNN####"
// NNNN is uppercase letter for Vendor ID specified by manufacturer
//
- CopyMem(Hid, &ManufacturerID, 4);
+ CopyMem (Hid, &ManufacturerID, 4);
PnpHID = FALSE;
}
} else {
DEBUG ((DEBUG_ERROR, "Get TPM_PT_MANUFACTURER failed %x!\n", Status));
- ASSERT(FALSE);
+ ASSERT (FALSE);
return Status;
}
- Status = Tpm2GetCapabilityFirmwareVersion(&FirmwareVersion1, &FirmwareVersion2);
- if (!EFI_ERROR(Status)) {
- DEBUG((DEBUG_INFO, "TPM_PT_FIRMWARE_VERSION_1 0x%x\n", FirmwareVersion1));
- DEBUG((DEBUG_INFO, "TPM_PT_FIRMWARE_VERSION_2 0x%x\n", FirmwareVersion2));
+ Status = Tpm2GetCapabilityFirmwareVersion (&FirmwareVersion1, &FirmwareVersion2);
+ if (!EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "TPM_PT_FIRMWARE_VERSION_1 0x%x\n", FirmwareVersion1));
+ DEBUG ((DEBUG_INFO, "TPM_PT_FIRMWARE_VERSION_2 0x%x\n", FirmwareVersion2));
//
// #### is Firmware Version 1
//
if (PnpHID) {
- AsciiSPrint(Hid + 3, TPM_HID_PNP_SIZE - 3, "%02d%02d", ((FirmwareVersion1 & 0xFFFF0000) >> 16), (FirmwareVersion1 & 0x0000FFFF));
+ AsciiSPrint (Hid + 3, TPM_HID_PNP_SIZE - 3, "%02d%02d", ((FirmwareVersion1 & 0xFFFF0000) >> 16), (FirmwareVersion1 & 0x0000FFFF));
} else {
- AsciiSPrint(Hid + 4, TPM_HID_ACPI_SIZE - 4, "%02d%02d", ((FirmwareVersion1 & 0xFFFF0000) >> 16), (FirmwareVersion1 & 0x0000FFFF));
+ AsciiSPrint (Hid + 4, TPM_HID_ACPI_SIZE - 4, "%02d%02d", ((FirmwareVersion1 & 0xFFFF0000) >> 16), (FirmwareVersion1 & 0x0000FFFF));
}
-
} else {
DEBUG ((DEBUG_ERROR, "Get TPM_PT_FIRMWARE_VERSION_X failed %x!\n", Status));
- ASSERT(FALSE);
+ ASSERT (FALSE);
return Status;
}
@@ -438,15 +445,15 @@ GetTpm2HID(
**/
EFI_STATUS
Tcg2VersionInfoCallback (
- IN EFI_BROWSER_ACTION Action,
- IN EFI_QUESTION_ID QuestionId,
- IN UINT8 Type,
- IN EFI_IFR_TYPE_VALUE *Value
+ IN EFI_BROWSER_ACTION Action,
+ IN EFI_QUESTION_ID QuestionId,
+ IN UINT8 Type,
+ IN EFI_IFR_TYPE_VALUE *Value
)
{
- EFI_INPUT_KEY Key;
- UINT64 PcdTcg2PpiVersion;
- UINT8 PcdTpm2AcpiTableRev;
+ EFI_INPUT_KEY Key;
+ UINT64 PcdTcg2PpiVersion;
+ UINT8 PcdTpm2AcpiTableRev;
ASSERT (Action == EFI_BROWSER_ACTION_SUBMITTED);
@@ -461,7 +468,7 @@ Tcg2VersionInfoCallback (
CopyMem (
&PcdTcg2PpiVersion,
PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer),
- AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))
+ AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))
);
if (PcdTcg2PpiVersion != Value->u64) {
CreatePopUp (
@@ -472,7 +479,7 @@ Tcg2VersionInfoCallback (
NULL
);
}
- } else if (QuestionId == KEY_TPM2_ACPI_REVISION){
+ } else if (QuestionId == KEY_TPM2_ACPI_REVISION) {
//
// Get the PCD value after EFI_BROWSER_ACTION_SUBMITTED,
// the SetVariable to TCG2_VERSION_NAME should have been done.
@@ -520,19 +527,19 @@ Tcg2VersionInfoCallback (
EFI_STATUS
EFIAPI
Tcg2Callback (
- 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
+ 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
)
{
- EFI_STATUS Status;
- EFI_INPUT_KEY Key;
- CHAR8 HidStr[16];
- CHAR16 UnHidStr[16];
- TCG2_CONFIG_PRIVATE_DATA *Private;
+ EFI_STATUS Status;
+ EFI_INPUT_KEY Key;
+ CHAR8 HidStr[16];
+ CHAR16 UnHidStr[16];
+ TCG2_CONFIG_PRIVATE_DATA *Private;
if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {
return EFI_INVALID_PARAMETER;
@@ -545,24 +552,25 @@ Tcg2Callback (
// Update TPM2 HID info
//
if (QuestionId == KEY_TPM_DEVICE) {
- Status = GetTpm2HID(HidStr, 16);
+ Status = GetTpm2HID (HidStr, 16);
- if (EFI_ERROR(Status)) {
+ if (EFI_ERROR (Status)) {
//
// Fail to get TPM2 HID
//
HiiSetString (Private->HiiHandle, STRING_TOKEN (STR_TPM2_ACPI_HID_CONTENT), L"Unknown", NULL);
} else {
- AsciiStrToUnicodeStrS(HidStr, UnHidStr, 16);
+ AsciiStrToUnicodeStrS (HidStr, UnHidStr, 16);
HiiSetString (Private->HiiHandle, STRING_TOKEN (STR_TPM2_ACPI_HID_CONTENT), UnHidStr, NULL);
}
}
+
return EFI_SUCCESS;
}
if (Action == EFI_BROWSER_ACTION_CHANGING) {
if (QuestionId == KEY_TPM_DEVICE_INTERFACE) {
- Status = SetPtpInterface ((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress), Value->u8);
+ Status = SetPtpInterface ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress), Value->u8);
if (EFI_ERROR (Status)) {
CreatePopUp (
EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
@@ -579,19 +587,22 @@ Tcg2Callback (
if (QuestionId == KEY_TPM_DEVICE) {
return EFI_SUCCESS;
}
+
if (QuestionId == KEY_TPM2_OPERATION) {
return SaveTcg2PpRequest (Value->u8);
}
+
if (QuestionId == KEY_TPM2_OPERATION_PARAMETER) {
return SaveTcg2PpRequestParameter (Value->u32);
}
+
if ((QuestionId >= KEY_TPM2_PCR_BANKS_REQUEST_0) && (QuestionId <= KEY_TPM2_PCR_BANKS_REQUEST_4)) {
return SaveTcg2PCRBanksRequest (QuestionId - KEY_TPM2_PCR_BANKS_REQUEST_0, Value->b);
}
}
if (Action == EFI_BROWSER_ACTION_SUBMITTED) {
- if (QuestionId == KEY_TCG2_PPI_VERSION || QuestionId == KEY_TPM2_ACPI_REVISION) {
+ if ((QuestionId == KEY_TCG2_PPI_VERSION) || (QuestionId == KEY_TPM2_ACPI_REVISION)) {
return Tcg2VersionInfoCallback (Action, QuestionId, Type, Value);
}
}
@@ -615,36 +626,41 @@ AppendBufferWithTpmAlgHash (
)
{
switch (TpmAlgHash) {
- case TPM_ALG_SHA1:
- if (Buffer[0] != 0) {
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
- }
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA1");
- break;
- case TPM_ALG_SHA256:
- if (Buffer[0] != 0) {
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
- }
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA256");
- break;
- case TPM_ALG_SHA384:
- if (Buffer[0] != 0) {
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
- }
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA384");
- break;
- case TPM_ALG_SHA512:
- if (Buffer[0] != 0) {
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
- }
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA512");
- break;
- case TPM_ALG_SM3_256:
- if (Buffer[0] != 0) {
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
- }
- StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SM3_256");
- break;
+ case TPM_ALG_SHA1:
+ if (Buffer[0] != 0) {
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA1");
+ break;
+ case TPM_ALG_SHA256:
+ if (Buffer[0] != 0) {
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA256");
+ break;
+ case TPM_ALG_SHA384:
+ if (Buffer[0] != 0) {
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA384");
+ break;
+ case TPM_ALG_SHA512:
+ if (Buffer[0] != 0) {
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA512");
+ break;
+ case TPM_ALG_SM3_256:
+ if (Buffer[0] != 0) {
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SM3_256");
+ break;
}
}
@@ -668,30 +684,39 @@ FillBufferWithBootHashAlg (
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA1");
}
+
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA256) != 0) {
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA256");
}
+
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA384) != 0) {
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA384");
}
+
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SHA512) != 0) {
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SHA512");
}
+
if ((BootHashAlg & EFI_TCG2_BOOT_HASH_ALG_SM3_256) != 0) {
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"SM3_256");
}
}
@@ -705,26 +730,26 @@ FillBufferWithBootHashAlg (
**/
VOID
SetConfigInfo (
- IN OUT TCG2_CONFIGURATION_INFO *Tcg2ConfigInfo,
- IN UINT32 TpmAlgHash
+ IN OUT TCG2_CONFIGURATION_INFO *Tcg2ConfigInfo,
+ IN UINT32 TpmAlgHash
)
{
switch (TpmAlgHash) {
- case TPM_ALG_SHA1:
- Tcg2ConfigInfo->Sha1Supported = TRUE;
- break;
- case TPM_ALG_SHA256:
- Tcg2ConfigInfo->Sha256Supported = TRUE;
- break;
- case TPM_ALG_SHA384:
- Tcg2ConfigInfo->Sha384Supported = TRUE;
- break;
- case TPM_ALG_SHA512:
- Tcg2ConfigInfo->Sha512Supported = TRUE;
- break;
- case TPM_ALG_SM3_256:
- Tcg2ConfigInfo->Sm3Supported = TRUE;
- break;
+ case TPM_ALG_SHA1:
+ Tcg2ConfigInfo->Sha1Supported = TRUE;
+ break;
+ case TPM_ALG_SHA256:
+ Tcg2ConfigInfo->Sha256Supported = TRUE;
+ break;
+ case TPM_ALG_SHA384:
+ Tcg2ConfigInfo->Sha384Supported = TRUE;
+ break;
+ case TPM_ALG_SHA512:
+ Tcg2ConfigInfo->Sha512Supported = TRUE;
+ break;
+ case TPM_ALG_SM3_256:
+ Tcg2ConfigInfo->Sm3Supported = TRUE;
+ break;
}
}
@@ -748,18 +773,23 @@ FillBufferWithTCG2EventLogFormat (
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"TCG_1_2");
}
+
if ((TCG2EventLogFormat & EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) != 0) {
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"TCG_2");
}
+
if ((TCG2EventLogFormat & (~EFI_TCG2_EVENT_LOG_FORMAT_ALL)) != 0) {
if (Buffer[0] != 0) {
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L", ");
}
+
StrCatS (Buffer, BufferSize / sizeof (CHAR16), L"UNKNOWN");
}
}
@@ -792,14 +822,14 @@ InstallTcg2ConfigForm (
DriverHandle = NULL;
ConfigAccess = &PrivateData->ConfigAccess;
- Status = gBS->InstallMultipleProtocolInterfaces (
- &DriverHandle,
- &gEfiDevicePathProtocolGuid,
- &mTcg2HiiVendorDevicePath,
- &gEfiHiiConfigAccessProtocolGuid,
- ConfigAccess,
- NULL
- );
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &DriverHandle,
+ &gEfiDevicePathProtocolGuid,
+ &mTcg2HiiVendorDevicePath,
+ &gEfiHiiConfigAccessProtocolGuid,
+ ConfigAccess,
+ NULL
+ );
if (EFI_ERROR (Status)) {
return Status;
}
@@ -835,21 +865,21 @@ InstallTcg2ConfigForm (
// Update static data
//
switch (PrivateData->TpmDeviceDetected) {
- case TPM_DEVICE_NULL:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"Not Found", NULL);
- break;
- case TPM_DEVICE_1_2:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"TPM 1.2", NULL);
- break;
- case TPM_DEVICE_2_0_DTPM:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"TPM 2.0", NULL);
- break;
- default:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"Unknown", NULL);
- break;
- }
-
- ZeroMem (&Tcg2ConfigInfo, sizeof(Tcg2ConfigInfo));
+ case TPM_DEVICE_NULL:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"Not Found", NULL);
+ break;
+ case TPM_DEVICE_1_2:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"TPM 1.2", NULL);
+ break;
+ case TPM_DEVICE_2_0_DTPM:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"TPM 2.0", NULL);
+ break;
+ default:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_STATE_CONTENT), L"Unknown", NULL);
+ break;
+ }
+
+ ZeroMem (&Tcg2ConfigInfo, sizeof (Tcg2ConfigInfo));
Status = Tpm2GetCapabilityPcrs (&Pcrs);
if (EFI_ERROR (Status)) {
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_ACTIVE_HASH_ALGO_CONTENT), L"[Unknown]", NULL);
@@ -858,16 +888,18 @@ InstallTcg2ConfigForm (
TempBuffer[0] = 0;
for (Index = 0; Index < Pcrs.count; Index++) {
if (!IsZeroBuffer (Pcrs.pcrSelections[Index].pcrSelect, Pcrs.pcrSelections[Index].sizeofSelect)) {
- AppendBufferWithTpmAlgHash (TempBuffer, sizeof(TempBuffer), Pcrs.pcrSelections[Index].hash);
+ AppendBufferWithTpmAlgHash (TempBuffer, sizeof (TempBuffer), Pcrs.pcrSelections[Index].hash);
}
}
+
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_ACTIVE_HASH_ALGO_CONTENT), TempBuffer, NULL);
TempBuffer[0] = 0;
for (Index = 0; Index < Pcrs.count; Index++) {
- AppendBufferWithTpmAlgHash (TempBuffer, sizeof(TempBuffer), Pcrs.pcrSelections[Index].hash);
+ AppendBufferWithTpmAlgHash (TempBuffer, sizeof (TempBuffer), Pcrs.pcrSelections[Index].hash);
SetConfigInfo (&Tcg2ConfigInfo, Pcrs.pcrSelections[Index].hash);
}
+
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_SUPPORTED_HASH_ALGO_CONTENT), TempBuffer, NULL);
}
@@ -875,77 +907,82 @@ InstallTcg2ConfigForm (
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Tpm2GetCapabilityIsCmdImpl fails %r\n", Status));
}
+
Tcg2ConfigInfo.ChangeEPSSupported = IsCmdImp;
- FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PcdGet32 (PcdTcg2HashAlgorithmBitmap));
+ FillBufferWithBootHashAlg (TempBuffer, sizeof (TempBuffer), PcdGet32 (PcdTcg2HashAlgorithmBitmap));
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_BIOS_HASH_ALGO_CONTENT), TempBuffer, NULL);
//
// Tcg2 Capability
//
- FillBufferWithTCG2EventLogFormat (TempBuffer, sizeof(TempBuffer), PrivateData->ProtocolCapability.SupportedEventLogs);
+ FillBufferWithTCG2EventLogFormat (TempBuffer, sizeof (TempBuffer), PrivateData->ProtocolCapability.SupportedEventLogs);
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_SUPPORTED_EVENT_LOG_FORMAT_CONTENT), TempBuffer, NULL);
- FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PrivateData->ProtocolCapability.HashAlgorithmBitmap);
+ FillBufferWithBootHashAlg (TempBuffer, sizeof (TempBuffer), PrivateData->ProtocolCapability.HashAlgorithmBitmap);
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_HASH_ALGO_BITMAP_CONTENT), TempBuffer, NULL);
UnicodeSPrint (TempBuffer, sizeof (TempBuffer), L"%d", PrivateData->ProtocolCapability.NumberOfPCRBanks);
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_NUMBER_OF_PCR_BANKS_CONTENT), TempBuffer, NULL);
- FillBufferWithBootHashAlg (TempBuffer, sizeof(TempBuffer), PrivateData->ProtocolCapability.ActivePcrBanks);
+ FillBufferWithBootHashAlg (TempBuffer, sizeof (TempBuffer), PrivateData->ProtocolCapability.ActivePcrBanks);
HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_ACTIVE_PCR_BANKS_CONTENT), TempBuffer, NULL);
//
// Update TPM device interface type
//
if (PrivateData->TpmDeviceDetected == TPM_DEVICE_2_0_DTPM) {
- TpmDeviceInterfaceDetected = PcdGet8(PcdActiveTpmInterfaceType);
+ TpmDeviceInterfaceDetected = PcdGet8 (PcdActiveTpmInterfaceType);
switch (TpmDeviceInterfaceDetected) {
- case Tpm2PtpInterfaceTis:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"TIS", NULL);
- break;
- case Tpm2PtpInterfaceFifo:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"PTP FIFO", NULL);
- break;
- case Tpm2PtpInterfaceCrb:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"PTP CRB", NULL);
- break;
- default:
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"Unknown", NULL);
- break;
+ case Tpm2PtpInterfaceTis:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"TIS", NULL);
+ break;
+ case Tpm2PtpInterfaceFifo:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"PTP FIFO", NULL);
+ break;
+ case Tpm2PtpInterfaceCrb:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"PTP CRB", NULL);
+ break;
+ default:
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_STATE_CONTENT), L"Unknown", NULL);
+ break;
}
Tcg2ConfigInfo.TpmDeviceInterfaceAttempt = TpmDeviceInterfaceDetected;
switch (TpmDeviceInterfaceDetected) {
- case Tpm2PtpInterfaceTis:
- Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported = FALSE;
- Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported = FALSE;
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_CAPABILITY_CONTENT), L"TIS", NULL);
- break;
- case Tpm2PtpInterfaceFifo:
- case Tpm2PtpInterfaceCrb:
- Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported = IsPtpFifoSupported((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));
- Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported = IsPtpCrbSupported((VOID *) (UINTN) PcdGet64 (PcdTpmBaseAddress));
- TempBuffer[0] = 0;
- if (Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported) {
- if (TempBuffer[0] != 0) {
- StrCatS (TempBuffer, sizeof(TempBuffer) / sizeof (CHAR16), L", ");
+ case Tpm2PtpInterfaceTis:
+ Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported = FALSE;
+ Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported = FALSE;
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_CAPABILITY_CONTENT), L"TIS", NULL);
+ break;
+ case Tpm2PtpInterfaceFifo:
+ case Tpm2PtpInterfaceCrb:
+ Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported = IsPtpFifoSupported ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress));
+ Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported = IsPtpCrbSupported ((VOID *)(UINTN)PcdGet64 (PcdTpmBaseAddress));
+ TempBuffer[0] = 0;
+ if (Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported) {
+ if (TempBuffer[0] != 0) {
+ StrCatS (TempBuffer, sizeof (TempBuffer) / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (TempBuffer, sizeof (TempBuffer) / sizeof (CHAR16), L"PTP FIFO");
}
- StrCatS (TempBuffer, sizeof(TempBuffer) / sizeof (CHAR16), L"PTP FIFO");
- }
- if (Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported) {
- if (TempBuffer[0] != 0) {
- StrCatS (TempBuffer, sizeof(TempBuffer) / sizeof (CHAR16), L", ");
+
+ if (Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported) {
+ if (TempBuffer[0] != 0) {
+ StrCatS (TempBuffer, sizeof (TempBuffer) / sizeof (CHAR16), L", ");
+ }
+
+ StrCatS (TempBuffer, sizeof (TempBuffer) / sizeof (CHAR16), L"PTP CRB");
}
- StrCatS (TempBuffer, sizeof(TempBuffer) / sizeof (CHAR16), L"PTP CRB");
- }
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_CAPABILITY_CONTENT), TempBuffer, NULL);
- break;
- default:
- Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported = FALSE;
- Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported = FALSE;
- HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_CAPABILITY_CONTENT), L"Unknown", NULL);
- break;
+
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_CAPABILITY_CONTENT), TempBuffer, NULL);
+ break;
+ default:
+ Tcg2ConfigInfo.TpmDeviceInterfacePtpFifoSupported = FALSE;
+ Tcg2ConfigInfo.TpmDeviceInterfacePtpCrbSupported = FALSE;
+ HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_DEVICE_INTERFACE_CAPABILITY_CONTENT), L"Unknown", NULL);
+ break;
}
}
@@ -956,7 +993,7 @@ InstallTcg2ConfigForm (
TCG2_STORAGE_INFO_NAME,
&gTcg2ConfigFormSetGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS,
- sizeof(Tcg2ConfigInfo),
+ sizeof (Tcg2ConfigInfo),
&Tcg2ConfigInfo
);
if (EFI_ERROR (Status)) {
@@ -974,7 +1011,7 @@ InstallTcg2ConfigForm (
**/
VOID
UninstallTcg2ConfigForm (
- IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData
+ IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData
)
{
//
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h
index af542d52ef..3e0d5f31df 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.h
@@ -38,42 +38,42 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "Tcg2ConfigNvData.h"
#include "Tcg2Internal.h"
-#define TCG2_PROTOCOL_VERSION_DEFAULT 0x0001
+#define TCG2_PROTOCOL_VERSION_DEFAULT 0x0001
//
// Tool generated IFR binary data and String package data
//
-extern UINT8 Tcg2ConfigBin[];
-extern UINT8 Tcg2ConfigDxeStrings[];
+extern UINT8 Tcg2ConfigBin[];
+extern UINT8 Tcg2ConfigDxeStrings[];
///
/// HII specific Vendor Device Path definition.
///
typedef struct {
- VENDOR_DEVICE_PATH VendorDevicePath;
- EFI_DEVICE_PATH_PROTOCOL End;
+ VENDOR_DEVICE_PATH VendorDevicePath;
+ EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
typedef struct {
- UINTN Signature;
+ UINTN Signature;
- EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
- EFI_HII_HANDLE HiiHandle;
- EFI_HANDLE DriverHandle;
+ EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
+ EFI_HII_HANDLE HiiHandle;
+ EFI_HANDLE DriverHandle;
- UINT8 TpmDeviceDetected;
- EFI_TCG2_PROTOCOL *Tcg2Protocol;
- EFI_TCG2_BOOT_SERVICE_CAPABILITY ProtocolCapability;
- UINT32 PCRBanksDesired;
+ UINT8 TpmDeviceDetected;
+ EFI_TCG2_PROTOCOL *Tcg2Protocol;
+ EFI_TCG2_BOOT_SERVICE_CAPABILITY ProtocolCapability;
+ UINT32 PCRBanksDesired;
} TCG2_CONFIG_PRIVATE_DATA;
-extern TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate;
-extern TCG2_CONFIG_PRIVATE_DATA *mTcg2ConfigPrivateDate;
-#define TCG2_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'r', 'E', 'D')
+extern TCG2_CONFIG_PRIVATE_DATA mTcg2ConfigPrivateDateTemplate;
+extern TCG2_CONFIG_PRIVATE_DATA *mTcg2ConfigPrivateDate;
+#define TCG2_CONFIG_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('T', 'r', 'E', 'D')
#define TCG2_CONFIG_PRIVATE_DATA_FROM_THIS(a) CR (a, TCG2_CONFIG_PRIVATE_DATA, ConfigAccess, TCG2_CONFIG_PRIVATE_DATA_SIGNATURE)
-#define TPM_HID_PNP_SIZE 8
-#define TPM_HID_ACPI_SIZE 9
+#define TPM_HID_PNP_SIZE 8
+#define TPM_HID_ACPI_SIZE 9
/**
This function publish the TCG2 configuration Form for TPM device.
@@ -98,7 +98,7 @@ InstallTcg2ConfigForm (
**/
VOID
UninstallTcg2ConfigForm (
- IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData
+ IN OUT TCG2_CONFIG_PRIVATE_DATA *PrivateData
);
/**
@@ -130,10 +130,10 @@ UninstallTcg2ConfigForm (
EFI_STATUS
EFIAPI
Tcg2ExtractConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Request,
- OUT EFI_STRING *Progress,
- OUT EFI_STRING *Results
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Request,
+ OUT EFI_STRING *Progress,
+ OUT EFI_STRING *Results
);
/**
@@ -157,9 +157,9 @@ Tcg2ExtractConfig (
EFI_STATUS
EFIAPI
Tcg2RouteConfig (
- IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
- IN CONST EFI_STRING Configuration,
- OUT EFI_STRING *Progress
+ IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
+ IN CONST EFI_STRING Configuration,
+ OUT EFI_STRING *Progress
);
/**
@@ -187,12 +187,12 @@ Tcg2RouteConfig (
EFI_STATUS
EFIAPI
Tcg2Callback (
- 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
+ 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
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
index b84af40a04..69ef560047 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
@@ -13,32 +13,32 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Guid/Tcg2ConfigHii.h>
#include <IndustryStandard/TcgPhysicalPresence.h>
-#define TCG2_CONFIGURATION_VARSTORE_ID 0x0001
-#define TCG2_CONFIGURATION_INFO_VARSTORE_ID 0x0002
-#define TCG2_VERSION_VARSTORE_ID 0x0003
-#define TCG2_CONFIGURATION_FORM_ID 0x0001
-
-#define KEY_TPM_DEVICE 0x2000
-#define KEY_TPM2_OPERATION 0x2001
-#define KEY_TPM2_OPERATION_PARAMETER 0x2002
-#define KEY_TPM2_PCR_BANKS_REQUEST_0 0x2003
-#define KEY_TPM2_PCR_BANKS_REQUEST_1 0x2004
-#define KEY_TPM2_PCR_BANKS_REQUEST_2 0x2005
-#define KEY_TPM2_PCR_BANKS_REQUEST_3 0x2006
-#define KEY_TPM2_PCR_BANKS_REQUEST_4 0x2007
-#define KEY_TPM_DEVICE_INTERFACE 0x2008
-#define KEY_TCG2_PPI_VERSION 0x2009
-#define KEY_TPM2_ACPI_REVISION 0x200A
-
-#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
-
-#define TPM2_ACPI_REVISION_3 3
-#define TPM2_ACPI_REVISION_4 4
+#define TCG2_CONFIGURATION_VARSTORE_ID 0x0001
+#define TCG2_CONFIGURATION_INFO_VARSTORE_ID 0x0002
+#define TCG2_VERSION_VARSTORE_ID 0x0003
+#define TCG2_CONFIGURATION_FORM_ID 0x0001
+
+#define KEY_TPM_DEVICE 0x2000
+#define KEY_TPM2_OPERATION 0x2001
+#define KEY_TPM2_OPERATION_PARAMETER 0x2002
+#define KEY_TPM2_PCR_BANKS_REQUEST_0 0x2003
+#define KEY_TPM2_PCR_BANKS_REQUEST_1 0x2004
+#define KEY_TPM2_PCR_BANKS_REQUEST_2 0x2005
+#define KEY_TPM2_PCR_BANKS_REQUEST_3 0x2006
+#define KEY_TPM2_PCR_BANKS_REQUEST_4 0x2007
+#define KEY_TPM_DEVICE_INTERFACE 0x2008
+#define KEY_TCG2_PPI_VERSION 0x2009
+#define KEY_TPM2_ACPI_REVISION 0x200A
+
+#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
+
+#define TPM2_ACPI_REVISION_3 3
+#define TPM2_ACPI_REVISION_4 4
#define TPM_DEVICE_INTERFACE_TIS 0
#define TPM_DEVICE_INTERFACE_PTP_FIFO 1
@@ -46,31 +46,31 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#define TPM_DEVICE_INTERFACE_MAX TPM_DEVICE_INTERFACE_PTP_FIFO
#define TPM_DEVICE_INTERFACE_DEFAULT TPM_DEVICE_INTERFACE_PTP_CRB
-#define TCG2_PPI_VERSION_1_2 0x322E31 // "1.2"
-#define TCG2_PPI_VERSION_1_3 0x332E31 // "1.3"
+#define TCG2_PPI_VERSION_1_2 0x322E31 // "1.2"
+#define TCG2_PPI_VERSION_1_3 0x332E31 // "1.3"
//
// Nv Data structure referenced by IFR, TPM device user desired
//
typedef struct {
- UINT8 TpmDevice;
+ UINT8 TpmDevice;
} TCG2_CONFIGURATION;
typedef struct {
- UINT64 PpiVersion;
- UINT8 Tpm2AcpiTableRev;
+ UINT64 PpiVersion;
+ UINT8 Tpm2AcpiTableRev;
} TCG2_VERSION;
typedef struct {
- BOOLEAN Sha1Supported;
- BOOLEAN Sha256Supported;
- BOOLEAN Sha384Supported;
- BOOLEAN Sha512Supported;
- BOOLEAN Sm3Supported;
- UINT8 TpmDeviceInterfaceAttempt;
- BOOLEAN TpmDeviceInterfacePtpFifoSupported;
- BOOLEAN TpmDeviceInterfacePtpCrbSupported;
- BOOLEAN ChangeEPSSupported;
+ BOOLEAN Sha1Supported;
+ BOOLEAN Sha256Supported;
+ BOOLEAN Sha384Supported;
+ BOOLEAN Sha512Supported;
+ BOOLEAN Sm3Supported;
+ UINT8 TpmDeviceInterfaceAttempt;
+ BOOLEAN TpmDeviceInterfacePtpFifoSupported;
+ BOOLEAN TpmDeviceInterfacePtpCrbSupported;
+ BOOLEAN ChangeEPSSupported;
} TCG2_CONFIGURATION_INFO;
//
@@ -78,7 +78,7 @@ typedef struct {
// This variable is ReadOnly.
//
typedef struct {
- UINT8 TpmDeviceDetected;
+ UINT8 TpmDeviceDetected;
} TCG2_DEVICE_DETECTION;
#define TCG2_STORAGE_NAME L"TCG2_CONFIGURATION"
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c
index 8abc33efd4..21a01f07e1 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include <PiPei.h>
#include <Guid/TpmInstance.h>
@@ -27,7 +26,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
TPM_INSTANCE_ID mTpmInstanceId[] = TPM_INSTANCE_ID_LIST;
-CONST EFI_PEI_PPI_DESCRIPTOR gTpmSelectedPpi = {
+CONST EFI_PEI_PPI_DESCRIPTOR gTpmSelectedPpi = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiTpmDeviceSelectedGuid,
NULL
@@ -48,7 +47,7 @@ EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList = {
**/
UINT8
DetectTpmDevice (
- IN UINT8 SetupTpmDevice
+ IN UINT8 SetupTpmDevice
);
/**
@@ -67,18 +66,18 @@ Tcg2ConfigPeimEntryPoint (
IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- UINTN Size;
- EFI_STATUS Status;
- EFI_STATUS Status2;
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;
- TCG2_CONFIGURATION Tcg2Configuration;
- UINTN Index;
- UINT8 TpmDevice;
-
- Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);
+ UINTN Size;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
+ EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;
+ TCG2_CONFIGURATION Tcg2Configuration;
+ UINTN Index;
+ UINT8 TpmDevice;
+
+ Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **)&VariablePpi);
ASSERT_EFI_ERROR (Status);
- Size = sizeof(Tcg2Configuration);
+ Size = sizeof (Tcg2Configuration);
Status = VariablePpi->GetVariable (
VariablePpi,
TCG2_STORAGE_NAME,
@@ -91,7 +90,7 @@ Tcg2ConfigPeimEntryPoint (
//
// Variable not ready, set default value
//
- Tcg2Configuration.TpmDevice = TPM_DEVICE_DEFAULT;
+ Tcg2Configuration.TpmDevice = TPM_DEVICE_DEFAULT;
}
//
@@ -124,9 +123,9 @@ Tcg2ConfigPeimEntryPoint (
// NOTE: Tcg2Configuration 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++) {
+ for (Index = 0; Index < sizeof (mTpmInstanceId)/sizeof (mTpmInstanceId[0]); Index++) {
if (TpmDevice == mTpmInstanceId[Index].TpmDevice) {
- Size = sizeof(mTpmInstanceId[Index].TpmInstanceGuid);
+ Size = sizeof (mTpmInstanceId[Index].TpmInstanceGuid);
Status = PcdSetPtrS (PcdTpmInstanceGuid, &Size, &mTpmInstanceId[Index].TpmInstanceGuid);
ASSERT_EFI_ERROR (Status);
DEBUG ((DEBUG_INFO, "TpmDevice PCD: %g\n", &mTpmInstanceId[Index].TpmInstanceGuid));
@@ -145,7 +144,7 @@ Tcg2ConfigPeimEntryPoint (
// Because TcgPei or Tcg2Pei 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)) {
+ if (CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceNoneGuid)) {
Status2 = PeiServicesInstallPpi (&mTpmInitializationDonePpiList);
ASSERT_EFI_ERROR (Status2);
}
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2Internal.h b/SecurityPkg/Tcg/Tcg2Config/Tcg2Internal.h
index 6ed1015ef2..391010cbb4 100644
--- a/SecurityPkg/Tcg/Tcg2Config/Tcg2Internal.h
+++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2Internal.h
@@ -9,8 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#ifndef __TCG2_INTERNAL_H__
#define __TCG2_INTERNAL_H__
-#define EFI_TCG2_EVENT_LOG_FORMAT_DEFAULT EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2
-#define EFI_TCG2_EVENT_LOG_FORMAT_ALL (EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 | EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
+#define EFI_TCG2_EVENT_LOG_FORMAT_DEFAULT EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2
+#define EFI_TCG2_EVENT_LOG_FORMAT_ALL (EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 | EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)
#define TPM_INSTANCE_ID_LIST { \
{TPM_DEVICE_INTERFACE_NONE, TPM_DEVICE_NULL}, \
@@ -19,8 +19,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
}
typedef struct {
- GUID TpmInstanceGuid;
- UINT8 TpmDevice;
+ GUID TpmInstanceGuid;
+ UINT8 TpmDevice;
} TPM_INSTANCE_ID;
#endif
diff --git a/SecurityPkg/Tcg/Tcg2Config/TpmDetection.c b/SecurityPkg/Tcg/Tcg2Config/TpmDetection.c
index 57d3638f0c..64ec2ad699 100644
--- a/SecurityPkg/Tcg/Tcg2Config/TpmDetection.c
+++ b/SecurityPkg/Tcg/Tcg2Config/TpmDetection.c
@@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#include <PiPei.h>
#include <Ppi/ReadOnlyVariable2.h>
@@ -31,14 +30,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
UINT8
DetectTpmDevice (
- IN UINT8 SetupTpmDevice
+ IN UINT8 SetupTpmDevice
)
{
- EFI_STATUS Status;
- EFI_BOOT_MODE BootMode;
- TCG2_DEVICE_DETECTION Tcg2DeviceDetection;
- EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;
- UINTN Size;
+ EFI_STATUS Status;
+ EFI_BOOT_MODE BootMode;
+ TCG2_DEVICE_DETECTION Tcg2DeviceDetection;
+ EFI_PEI_READ_ONLY_VARIABLE2_PPI *VariablePpi;
+ UINTN Size;
Status = PeiServicesGetBootMode (&BootMode);
ASSERT_EFI_ERROR (Status);
@@ -49,11 +48,11 @@ DetectTpmDevice (
if (BootMode == BOOT_ON_S3_RESUME) {
DEBUG ((DEBUG_INFO, "DetectTpmDevice: S3 mode\n"));
- Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **) &VariablePpi);
+ Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **)&VariablePpi);
ASSERT_EFI_ERROR (Status);
- Size = sizeof(TCG2_DEVICE_DETECTION);
- ZeroMem (&Tcg2DeviceDetection, sizeof(Tcg2DeviceDetection));
+ Size = sizeof (TCG2_DEVICE_DETECTION);
+ ZeroMem (&Tcg2DeviceDetection, sizeof (Tcg2DeviceDetection));
Status = VariablePpi->GetVariable (
VariablePpi,
TCG2_DEVICE_DETECTION_NAME,
@@ -64,7 +63,8 @@ DetectTpmDevice (
);
if (!EFI_ERROR (Status) &&
(Tcg2DeviceDetection.TpmDeviceDetected >= TPM_DEVICE_MIN) &&
- (Tcg2DeviceDetection.TpmDeviceDetected <= TPM_DEVICE_MAX)) {
+ (Tcg2DeviceDetection.TpmDeviceDetected <= TPM_DEVICE_MAX))
+ {
DEBUG ((DEBUG_ERROR, "TpmDevice from DeviceDetection: %x\n", Tcg2DeviceDetection.TpmDeviceDetected));
return Tcg2DeviceDetection.TpmDeviceDetected;
}
@@ -89,6 +89,7 @@ DetectTpmDevice (
} else {
Status = Tpm12Startup (TPM_ST_CLEAR);
}
+
if (EFI_ERROR (Status)) {
return TPM_DEVICE_2_0_DTPM;
}