summaryrefslogtreecommitdiffstats
path: root/SecurityPkg/Tcg/TcgPei/TcgPei.c
diff options
context:
space:
mode:
Diffstat (limited to 'SecurityPkg/Tcg/TcgPei/TcgPei.c')
-rw-r--r--SecurityPkg/Tcg/TcgPei/TcgPei.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/SecurityPkg/Tcg/TcgPei/TcgPei.c b/SecurityPkg/Tcg/TcgPei/TcgPei.c
index 0c00e286ce..dcf4b0bbbd 100644
--- a/SecurityPkg/Tcg/TcgPei/TcgPei.c
+++ b/SecurityPkg/Tcg/TcgPei/TcgPei.c
@@ -1,7 +1,7 @@
/** @file
Initialize TPM device and measure FVs before handing off control to DXE.
-Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 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
@@ -38,6 +38,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/BaseLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/ReportStatusCodeLib.h>
#include "TpmComm.h"
@@ -221,6 +222,10 @@ HashLogExtendEvent (
{
EFI_STATUS Status;
VOID *HobData;
+
+ if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {
+ return EFI_DEVICE_ERROR;
+ }
HobData = NULL;
if (HashDataLen != 0) {
@@ -229,7 +234,9 @@ HashLogExtendEvent (
HashDataLen,
&NewEventHdr->Digest
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
}
Status = TpmCommExtend (
@@ -239,20 +246,34 @@ HashLogExtendEvent (
NewEventHdr->PCRIndex,
NULL
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status)) {
+ goto Done;
+ }
HobData = BuildGuidHob (
&gTcgEventEntryHobGuid,
sizeof (*NewEventHdr) + NewEventHdr->EventSize
);
if (HobData == NULL) {
- return EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
}
CopyMem (HobData, NewEventHdr, sizeof (*NewEventHdr));
HobData = (VOID *) ((UINT8*)HobData + sizeof (*NewEventHdr));
CopyMem (HobData, NewEventData, NewEventHdr->EventSize);
- return EFI_SUCCESS;
+
+Done:
+ if ((Status == EFI_DEVICE_ERROR) || (Status == EFI_TIMEOUT)) {
+ DEBUG ((EFI_D_ERROR, "HashLogExtendEvent - %r. Disable TPM.\n", Status));
+ 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;
}
/**
@@ -365,7 +386,6 @@ MeasureFvImage (
&TcgEventHdr,
(UINT8*) &FvBlob
);
- ASSERT_EFI_ERROR (Status);
//
// Add new FV into the measured FV list.
@@ -682,7 +702,6 @@ PeimEntryMP (
if (IsTpmUsable (PeiServices, TpmHandle)) {
if (PcdGet8 (PcdTpmScrtmPolicy) == 1) {
Status = MeasureCRTMVersion (PeiServices, TpmHandle);
- ASSERT_EFI_ERROR (Status);
}
Status = MeasureMainBios (PeiServices, TpmHandle);