diff options
Diffstat (limited to 'SecurityPkg/Tcg/TcgPei')
-rw-r--r-- | SecurityPkg/Tcg/TcgPei/TcgPei.c | 252 |
1 files changed, 129 insertions, 123 deletions
diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c b/SecurityPkg/Tcg/TcgPei/TcgPei.c index 536bd5a408..5aa80511aa 100644 --- a/SecurityPkg/Tcg/TcgPei/TcgPei.c +++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c @@ -39,7 +39,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include <Library/BaseCryptLib.h>
#include <Library/PerformanceLib.h>
-BOOLEAN mImageInMemory = FALSE;
+BOOLEAN mImageInMemory = FALSE;
EFI_PEI_PPI_DESCRIPTOR mTpmInitializedPpiList = {
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
@@ -74,15 +74,15 @@ EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList = { EFI_STATUS
EFIAPI
HashLogExtendEvent (
- IN EDKII_TCG_PPI *This,
- IN UINT64 Flags,
- IN UINT8 *HashData,
- IN UINTN HashDataLen,
- IN TCG_PCR_EVENT_HDR *NewEventHdr,
- IN UINT8 *NewEventData
+ IN EDKII_TCG_PPI *This,
+ IN UINT64 Flags,
+ IN UINT8 *HashData,
+ IN UINTN HashDataLen,
+ IN TCG_PCR_EVENT_HDR *NewEventHdr,
+ IN UINT8 *NewEventData
);
-EDKII_TCG_PPI mEdkiiTcgPpi = {
+EDKII_TCG_PPI mEdkiiTcgPpi = {
HashLogExtendEvent
};
@@ -95,17 +95,17 @@ EFI_PEI_PPI_DESCRIPTOR mTcgPpiList = { //
// Number of firmware blobs to grow by each time we run out of room
//
-#define FIRMWARE_BLOB_GROWTH_STEP 4
+#define FIRMWARE_BLOB_GROWTH_STEP 4
-EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredBaseFvInfo;
-UINT32 mMeasuredMaxBaseFvIndex = 0;
-UINT32 mMeasuredBaseFvIndex = 0;
+EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredBaseFvInfo;
+UINT32 mMeasuredMaxBaseFvIndex = 0;
+UINT32 mMeasuredBaseFvIndex = 0;
-EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredChildFvInfo;
-UINT32 mMeasuredMaxChildFvIndex = 0;
-UINT32 mMeasuredChildFvIndex = 0;
+EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredChildFvInfo;
+UINT32 mMeasuredMaxChildFvIndex = 0;
+UINT32 mMeasuredChildFvIndex = 0;
-EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *mMeasurementExcludedFvPpi;
+EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *mMeasurementExcludedFvPpi;
/**
Lock physical presence if needed.
@@ -120,9 +120,9 @@ EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *mMeasurementExcludedFvPpi EFI_STATUS
EFIAPI
PhysicalPresencePpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
);
/**
@@ -139,9 +139,9 @@ PhysicalPresencePpiNotifyCallback ( EFI_STATUS
EFIAPI
FirmwareVolumeInfoPpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
);
/**
@@ -158,12 +158,12 @@ FirmwareVolumeInfoPpiNotifyCallback ( EFI_STATUS
EFIAPI
EndofPeiSignalNotifyCallBack (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
);
-EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList[] = {
+EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList[] = {
{
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
&gPeiLockPhysicalPresencePpiGuid,
@@ -204,12 +204,12 @@ EFI_PEI_NOTIFY_DESCRIPTOR mNotifyList[] = { EFI_STATUS
EFIAPI
EndofPeiSignalNotifyCallBack (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
)
{
- MEASURED_HOB_DATA *MeasuredHobData;
+ MEASURED_HOB_DATA *MeasuredHobData;
MeasuredHobData = NULL;
@@ -218,12 +218,12 @@ EndofPeiSignalNotifyCallBack ( //
// Create a Guid hob to save all measured Fv
//
- MeasuredHobData = BuildGuidHob(
+ MeasuredHobData = BuildGuidHob (
&gMeasuredFvHobGuid,
- sizeof(UINTN) + sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex + mMeasuredChildFvIndex)
+ sizeof (UINTN) + sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex + mMeasuredChildFvIndex)
);
- if (MeasuredHobData != NULL){
+ if (MeasuredHobData != NULL) {
//
// Save measured FV info enty number
//
@@ -232,12 +232,12 @@ EndofPeiSignalNotifyCallBack ( //
// Save measured base Fv info
//
- CopyMem (MeasuredHobData->MeasuredFvBuf, mMeasuredBaseFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex));
+ CopyMem (MeasuredHobData->MeasuredFvBuf, mMeasuredBaseFvInfo, sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredBaseFvIndex));
//
// Save measured child Fv info
//
- CopyMem (&MeasuredHobData->MeasuredFvBuf[mMeasuredBaseFvIndex] , mMeasuredChildFvInfo, sizeof(EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex));
+ CopyMem (&MeasuredHobData->MeasuredFvBuf[mMeasuredBaseFvIndex], mMeasuredChildFvInfo, sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredChildFvIndex));
}
PERF_CALLBACK_END (&gEfiEndOfPeiSignalPpiGuid);
@@ -300,16 +300,16 @@ TpmCommHashAll ( EFI_STATUS
EFIAPI
HashLogExtendEvent (
- IN EDKII_TCG_PPI *This,
- IN UINT64 Flags,
- IN UINT8 *HashData,
- IN UINTN HashDataLen,
- IN TCG_PCR_EVENT_HDR *NewEventHdr,
- IN UINT8 *NewEventData
+ IN EDKII_TCG_PPI *This,
+ IN UINT64 Flags,
+ IN UINT8 *HashData,
+ IN UINTN HashDataLen,
+ IN TCG_PCR_EVENT_HDR *NewEventHdr,
+ IN UINT8 *NewEventData
)
{
- EFI_STATUS Status;
- VOID *HobData;
+ EFI_STATUS Status;
+ VOID *HobData;
if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
return EFI_DEVICE_ERROR;
@@ -337,28 +337,29 @@ HashLogExtendEvent ( }
HobData = BuildGuidHob (
- &gTcgEventEntryHobGuid,
- sizeof (*NewEventHdr) + NewEventHdr->EventSize
- );
+ &gTcgEventEntryHobGuid,
+ sizeof (*NewEventHdr) + NewEventHdr->EventSize
+ );
if (HobData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
CopyMem (HobData, NewEventHdr, sizeof (*NewEventHdr));
- HobData = (VOID *) ((UINT8*)HobData + sizeof (*NewEventHdr));
+ HobData = (VOID *)((UINT8 *)HobData + sizeof (*NewEventHdr));
CopyMem (HobData, NewEventData, NewEventHdr->EventSize);
Done:
if ((Status == EFI_DEVICE_ERROR) || (Status == EFI_TIMEOUT)) {
DEBUG ((DEBUG_ERROR, "HashLogExtendEvent - %r. Disable TPM.\n", Status));
- BuildGuidHob (&gTpmErrorHobGuid,0);
+ BuildGuidHob (&gTpmErrorHobGuid, 0);
REPORT_STATUS_CODE (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
(PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
);
Status = EFI_DEVICE_ERROR;
}
+
return Status;
}
@@ -375,10 +376,10 @@ Done: EFI_STATUS
EFIAPI
MeasureCRTMVersion (
- IN EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_SERVICES **PeiServices
)
{
- TCG_PCR_EVENT_HDR TcgEventHdr;
+ TCG_PCR_EVENT_HDR TcgEventHdr;
//
// Use FirmwareVersion string to represent CRTM version.
@@ -387,15 +388,15 @@ MeasureCRTMVersion ( TcgEventHdr.PCRIndex = 0;
TcgEventHdr.EventType = EV_S_CRTM_VERSION;
- TcgEventHdr.EventSize = (UINT32) StrSize((CHAR16*)PcdGetPtr (PcdFirmwareVersionString));
+ TcgEventHdr.EventSize = (UINT32)StrSize ((CHAR16 *)PcdGetPtr (PcdFirmwareVersionString));
return HashLogExtendEvent (
&mEdkiiTcgPpi,
0,
- (UINT8*)PcdGetPtr (PcdFirmwareVersionString),
+ (UINT8 *)PcdGetPtr (PcdFirmwareVersionString),
TcgEventHdr.EventSize,
&TcgEventHdr,
- (UINT8*)PcdGetPtr (PcdFirmwareVersionString)
+ (UINT8 *)PcdGetPtr (PcdFirmwareVersionString)
);
}
@@ -415,24 +416,24 @@ MeasureCRTMVersion ( EFI_STATUS
EFIAPI
MeasureFvImage (
- IN EFI_PHYSICAL_ADDRESS FvBase,
- IN UINT64 FvLength
+ IN EFI_PHYSICAL_ADDRESS FvBase,
+ IN UINT64 FvLength
)
{
- UINT32 Index;
- EFI_STATUS Status;
- EFI_PLATFORM_FIRMWARE_BLOB FvBlob;
- TCG_PCR_EVENT_HDR TcgEventHdr;
- EFI_PHYSICAL_ADDRESS FvOrgBase;
- EFI_PHYSICAL_ADDRESS FvDataBase;
- EFI_PEI_HOB_POINTERS Hob;
- EDKII_MIGRATED_FV_INFO *MigratedFvInfo;
+ UINT32 Index;
+ EFI_STATUS Status;
+ EFI_PLATFORM_FIRMWARE_BLOB FvBlob;
+ TCG_PCR_EVENT_HDR TcgEventHdr;
+ EFI_PHYSICAL_ADDRESS FvOrgBase;
+ EFI_PHYSICAL_ADDRESS FvDataBase;
+ EFI_PEI_HOB_POINTERS Hob;
+ EDKII_MIGRATED_FV_INFO *MigratedFvInfo;
//
// Check if it is in Excluded FV list
//
if (mMeasurementExcludedFvPpi != NULL) {
- for (Index = 0; Index < mMeasurementExcludedFvPpi->Count; Index ++) {
+ for (Index = 0; Index < mMeasurementExcludedFvPpi->Count; Index++) {
if (mMeasurementExcludedFvPpi->Fv[Index].FvBase == FvBase) {
DEBUG ((DEBUG_INFO, "The FV which is excluded by TcgPei starts at: 0x%x\n", FvBase));
DEBUG ((DEBUG_INFO, "The FV which is excluded by TcgPei has the size: 0x%x\n", FvLength));
@@ -444,7 +445,7 @@ MeasureFvImage ( //
// Check whether FV is in the measured FV list.
//
- for (Index = 0; Index < mMeasuredBaseFvIndex; Index ++) {
+ for (Index = 0; Index < mMeasuredBaseFvIndex; Index++) {
if (mMeasuredBaseFvInfo[Index].BlobBase == FvBase) {
return EFI_SUCCESS;
}
@@ -455,17 +456,18 @@ MeasureFvImage ( //
FvOrgBase = FvBase;
FvDataBase = FvBase;
- Hob.Raw = GetFirstGuidHob (&gEdkiiMigratedFvInfoGuid);
+ Hob.Raw = GetFirstGuidHob (&gEdkiiMigratedFvInfoGuid);
while (Hob.Raw != NULL) {
MigratedFvInfo = GET_GUID_HOB_DATA (Hob);
- if ((MigratedFvInfo->FvNewBase == (UINT32) FvBase) && (MigratedFvInfo->FvLength == (UINT32) FvLength)) {
+ if ((MigratedFvInfo->FvNewBase == (UINT32)FvBase) && (MigratedFvInfo->FvLength == (UINT32)FvLength)) {
//
// Found the migrated FV info
//
- FvOrgBase = (EFI_PHYSICAL_ADDRESS) (UINTN) MigratedFvInfo->FvOrgBase;
- FvDataBase = (EFI_PHYSICAL_ADDRESS) (UINTN) MigratedFvInfo->FvDataBase;
+ FvOrgBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvOrgBase;
+ FvDataBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MigratedFvInfo->FvDataBase;
break;
}
+
Hob.Raw = GET_NEXT_HOB (Hob);
Hob.Raw = GetNextGuidHob (&gEdkiiMigratedFvInfoGuid, Hob.Raw);
}
@@ -479,17 +481,17 @@ MeasureFvImage ( DEBUG ((DEBUG_INFO, "The FV which is measured by TcgPei starts at: 0x%x\n", FvBlob.BlobBase));
DEBUG ((DEBUG_INFO, "The FV which is measured by TcgPei has the size: 0x%x\n", FvBlob.BlobLength));
- TcgEventHdr.PCRIndex = 0;
+ TcgEventHdr.PCRIndex = 0;
TcgEventHdr.EventType = EV_EFI_PLATFORM_FIRMWARE_BLOB;
TcgEventHdr.EventSize = sizeof (FvBlob);
Status = HashLogExtendEvent (
&mEdkiiTcgPpi,
0,
- (UINT8*) (UINTN) FvDataBase,
- (UINTN) FvBlob.BlobLength,
+ (UINT8 *)(UINTN)FvDataBase,
+ (UINTN)FvBlob.BlobLength,
&TcgEventHdr,
- (UINT8*) &FvBlob
+ (UINT8 *)&FvBlob
);
//
@@ -525,16 +527,16 @@ MeasureFvImage ( EFI_STATUS
EFIAPI
MeasureMainBios (
- IN EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
- UINT32 FvInstances;
- EFI_PEI_FV_HANDLE VolumeHandle;
- EFI_FV_INFO VolumeInfo;
- EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
+ EFI_STATUS Status;
+ UINT32 FvInstances;
+ EFI_PEI_FV_HANDLE VolumeHandle;
+ EFI_FV_INFO VolumeInfo;
+ EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
- FvInstances = 0;
+ FvInstances = 0;
while (TRUE) {
//
// Traverse all firmware volume instances of Static Core Root of Trust for Measurement
@@ -558,10 +560,10 @@ MeasureMainBios ( &VolumeInfo.FvFormat,
0,
NULL,
- (VOID**)&FvPpi
+ (VOID **)&FvPpi
);
if (!EFI_ERROR (Status)) {
- MeasureFvImage ((EFI_PHYSICAL_ADDRESS) (UINTN) VolumeInfo.FvStart, VolumeInfo.FvSize);
+ MeasureFvImage ((EFI_PHYSICAL_ADDRESS)(UINTN)VolumeInfo.FvStart, VolumeInfo.FvSize);
}
FvInstances++;
@@ -584,9 +586,9 @@ MeasureMainBios ( EFI_STATUS
EFIAPI
FirmwareVolumeInfoPpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
)
{
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *Fv;
@@ -594,7 +596,7 @@ FirmwareVolumeInfoPpiNotifyCallback ( EFI_PEI_FIRMWARE_VOLUME_PPI *FvPpi;
UINTN Index;
- Fv = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *) Ppi;
+ Fv = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *)Ppi;
//
// The PEI Core can not dispatch or load files from memory mapped FVs that do not support FvPpi.
@@ -603,7 +605,7 @@ FirmwareVolumeInfoPpiNotifyCallback ( &Fv->FvFormat,
0,
NULL,
- (VOID**)&FvPpi
+ (VOID **)&FvPpi
);
if (EFI_ERROR (Status)) {
return EFI_SUCCESS;
@@ -613,8 +615,7 @@ FirmwareVolumeInfoPpiNotifyCallback ( // This is an FV from an FFS file, and the parent FV must have already been measured,
// No need to measure twice, so just record the FV and return
//
- if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
-
+ if ((Fv->ParentFvName != NULL) || (Fv->ParentFileName != NULL)) {
if (mMeasuredChildFvIndex >= mMeasuredMaxChildFvIndex) {
mMeasuredChildFvInfo = ReallocatePool (
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * mMeasuredMaxChildFvIndex,
@@ -624,21 +625,23 @@ FirmwareVolumeInfoPpiNotifyCallback ( ASSERT (mMeasuredChildFvInfo != NULL);
mMeasuredMaxChildFvIndex = mMeasuredMaxChildFvIndex + FIRMWARE_BLOB_GROWTH_STEP;
}
+
//
// Check whether FV is in the measured child FV list.
//
for (Index = 0; Index < mMeasuredChildFvIndex; Index++) {
- if (mMeasuredChildFvInfo[Index].BlobBase == (EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo) {
+ if (mMeasuredChildFvInfo[Index].BlobBase == (EFI_PHYSICAL_ADDRESS)(UINTN)Fv->FvInfo) {
return EFI_SUCCESS;
}
}
- mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase = (EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo;
+
+ mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase = (EFI_PHYSICAL_ADDRESS)(UINTN)Fv->FvInfo;
mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobLength = Fv->FvInfoSize;
mMeasuredChildFvIndex++;
return EFI_SUCCESS;
}
- return MeasureFvImage ((EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo, Fv->FvInfoSize);
+ return MeasureFvImage ((EFI_PHYSICAL_ADDRESS)(UINTN)Fv->FvInfo, Fv->FvInfoSize);
}
/**
@@ -657,15 +660,15 @@ FirmwareVolumeInfoPpiNotifyCallback ( EFI_STATUS
EFIAPI
PhysicalPresencePpiNotifyCallback (
- IN EFI_PEI_SERVICES **PeiServices,
- IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
- IN VOID *Ppi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
+ IN VOID *Ppi
)
{
- EFI_STATUS Status;
- TPM_PERMANENT_FLAGS TpmPermanentFlags;
- PEI_LOCK_PHYSICAL_PRESENCE_PPI *LockPhysicalPresencePpi;
- TPM_PHYSICAL_PRESENCE PhysicalPresenceValue;
+ EFI_STATUS Status;
+ TPM_PERMANENT_FLAGS TpmPermanentFlags;
+ PEI_LOCK_PHYSICAL_PRESENCE_PPI *LockPhysicalPresencePpi;
+ TPM_PHYSICAL_PRESENCE PhysicalPresenceValue;
Status = Tpm12GetCapabilityFlagPermanent (&TpmPermanentFlags);
if (EFI_ERROR (Status)) {
@@ -679,14 +682,14 @@ PhysicalPresencePpiNotifyCallback ( //
// Lock TPM LifetimeLock is required, and LifetimeLock is not locked yet.
//
- PhysicalPresenceValue = TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK;
+ PhysicalPresenceValue = TPM_PHYSICAL_PRESENCE_LIFETIME_LOCK;
TpmPermanentFlags.physicalPresenceLifetimeLock = TRUE;
if (PcdGetBool (PcdPhysicalPresenceCmdEnable)) {
- PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_ENABLE;
+ PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_ENABLE;
TpmPermanentFlags.physicalPresenceCMDEnable = TRUE;
} else {
- PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_DISABLE;
+ PhysicalPresenceValue |= TPM_PHYSICAL_PRESENCE_CMD_DISABLE;
TpmPermanentFlags.physicalPresenceCMDEnable = FALSE;
}
@@ -707,8 +710,8 @@ PhysicalPresencePpiNotifyCallback ( //
// 2. Lock physical presence if it is required.
//
- LockPhysicalPresencePpi = (PEI_LOCK_PHYSICAL_PRESENCE_PPI *) Ppi;
- if (!LockPhysicalPresencePpi->LockPhysicalPresence ((CONST EFI_PEI_SERVICES**) PeiServices)) {
+ LockPhysicalPresencePpi = (PEI_LOCK_PHYSICAL_PRESENCE_PPI *)Ppi;
+ if (!LockPhysicalPresencePpi->LockPhysicalPresence ((CONST EFI_PEI_SERVICES **)PeiServices)) {
return EFI_SUCCESS;
}
@@ -736,8 +739,8 @@ PhysicalPresencePpiNotifyCallback ( // Lock physical presence
//
Status = Tpm12PhysicalPresence (
- TPM_PHYSICAL_PRESENCE_LOCK
- );
+ TPM_PHYSICAL_PRESENCE_LOCK
+ );
return Status;
}
@@ -762,6 +765,7 @@ IsTpmUsable ( if (EFI_ERROR (Status)) {
return FALSE;
}
+
return (BOOLEAN)(!TpmPermanentFlags.deactivated);
}
@@ -778,17 +782,17 @@ IsTpmUsable ( EFI_STATUS
EFIAPI
PeimEntryMP (
- IN EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
Status = PeiServicesLocatePpi (
- &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid,
- 0,
- NULL,
- (VOID**)&mMeasurementExcludedFvPpi
- );
+ &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&mMeasurementExcludedFvPpi
+ );
// Do not check status, because it is optional
Status = Tpm12RequestUseTpm ();
@@ -835,15 +839,15 @@ PeimEntryMP ( EFI_STATUS
EFIAPI
PeimEntryMA (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
- EFI_STATUS Status2;
- EFI_BOOT_MODE BootMode;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
+ EFI_BOOT_MODE BootMode;
- if (!CompareGuid (PcdGetPtr(PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)){
+ if (!CompareGuid (PcdGetPtr (PcdTpmInstanceGuid), &gEfiTpmDeviceInstanceTpm12Guid)) {
DEBUG ((DEBUG_ERROR, "No TPM12 instance required!\n"));
return EFI_UNSUPPORTED;
}
@@ -863,7 +867,7 @@ PeimEntryMA ( // In S3 path, skip shadow logic. no measurement is required
//
if (BootMode != BOOT_ON_S3_RESUME) {
- Status = (**PeiServices).RegisterForShadow(FileHandle);
+ Status = (**PeiServices).RegisterForShadow (FileHandle);
if (Status == EFI_ALREADY_STARTED) {
mImageInMemory = TRUE;
} else if (Status == EFI_NOT_FOUND) {
@@ -884,7 +888,8 @@ PeimEntryMA ( } else {
Status = Tpm12Startup (TPM_ST_CLEAR);
}
- if (EFI_ERROR (Status) ) {
+
+ if (EFI_ERROR (Status)) {
goto Done;
}
}
@@ -907,19 +912,20 @@ PeimEntryMA ( }
if (mImageInMemory) {
- Status = PeimEntryMP ((EFI_PEI_SERVICES**)PeiServices);
+ Status = PeimEntryMP ((EFI_PEI_SERVICES **)PeiServices);
return Status;
}
Done:
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "TPM error! Build Hob\n"));
- BuildGuidHob (&gTpmErrorHobGuid,0);
+ BuildGuidHob (&gTpmErrorHobGuid, 0);
REPORT_STATUS_CODE (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
(PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
);
}
+
//
// Always install TpmInitializationDonePpi no matter success or fail.
// Other driver can know TPM initialization state by TpmInitializedPpi.
|