/** @file\r
Initialize TPM2 device and measure FVs before handing off control to DXE.\r
\r
-Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>\r
This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
#include <Protocol/TrEEProtocol.h>\r
#include <Library/PerformanceLib.h>\r
#include <Library/MemoryAllocationLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
\r
#define PERF_ID_TREE_PEI 0x3080\r
\r
typedef struct {\r
EFI_GUID *EventGuid;\r
TREE_EVENT_LOG_FORMAT LogFormat;\r
- UINT32 BootHashAlg;\r
- UINT16 DigestAlgID;\r
- TPMI_ALG_HASH TpmHashAlgo;\r
} TREE_EVENT_INFO_STRUCT;\r
\r
TREE_EVENT_INFO_STRUCT mTreeEventInfo[] = {\r
- {&gTcgEventEntryHobGuid, TREE_EVENT_LOG_FORMAT_TCG_1_2, TREE_BOOT_HASH_ALG_SHA1, 0, TPM_ALG_SHA1},\r
+ {&gTcgEventEntryHobGuid, TREE_EVENT_LOG_FORMAT_TCG_1_2},\r
};\r
\r
BOOLEAN mImageInMemory = FALSE;\r
\r
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *mMeasurementExcludedFvPpi;\r
\r
-/**\r
- This function return hash algorithm from event log format.\r
-\r
- @param[in] EventLogFormat Event log format.\r
-\r
- @return hash algorithm.\r
-**/\r
-TPMI_ALG_HASH\r
-TrEEGetHashAlgoFromLogFormat (\r
- IN TREE_EVENT_LOG_FORMAT EventLogFormat\r
- )\r
-{\r
- UINTN Index;\r
-\r
- for (Index = 0; Index < sizeof(mTreeEventInfo)/sizeof(mTreeEventInfo[0]); Index++) {\r
- if (mTreeEventInfo[Index].LogFormat == EventLogFormat) {\r
- return mTreeEventInfo[Index].TpmHashAlgo;\r
- }\r
- }\r
- return TPM_ALG_SHA1;\r
-}\r
-\r
/**\r
This function get digest from digest list.\r
\r
EFI_STATUS Status;\r
TPML_DIGEST_VALUES DigestList;\r
\r
+ if (GetFirstGuidHob (&gTpmErrorHobGuid) != NULL) {\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
Status = HashAndExtend (\r
NewEventHdr->PCRIndex,\r
HashData,\r
Status = LogHashEvent (&DigestList, NewEventHdr, NewEventData);\r
}\r
}\r
+ \r
+ if (Status == EFI_DEVICE_ERROR) {\r
+ DEBUG ((EFI_D_ERROR, "HashLogExtendEvent - %r. Disable TPM.\n", Status));\r
+ BuildGuidHob (&gTpmErrorHobGuid,0);\r
+ REPORT_STATUS_CODE (\r
+ EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+ (PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)\r
+ );\r
+ }\r
+\r
return Status;\r
}\r
\r
&TcgEventHdr,\r
(UINT8*) &FvBlob\r
);\r
- ASSERT_EFI_ERROR (Status);\r
\r
//\r
// Add new FV into the measured FV list.\r
\r
if (PcdGet8 (PcdTpm2ScrtmPolicy) == 1) {\r
Status = MeasureCRTMVersion ();\r
- ASSERT_EFI_ERROR (Status);\r
}\r
\r
Status = MeasureMainBios ();\r