49#define PERF_ID_TCG2_DXE 0x3120
56#define TCG2_DEFAULT_MAX_COMMAND_SIZE 0x1000
57#define TCG2_DEFAULT_MAX_RESPONSE_SIZE 0x1000
61 EFI_TCG2_EVENT_LOG_FORMAT LogFormat;
65 { &gTcgEventEntryHobGuid, EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 },
66 { &gTcgEvent2EntryHobGuid, EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 },
69#define TCG_EVENT_LOG_AREA_COUNT_MAX 2
72 EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat;
77 BOOLEAN EventLogStarted;
78 BOOLEAN EventLogTruncated;
79 UINTN Next800155EventOffset;
85 BOOLEAN GetEventLogCalled[TCG_EVENT_LOG_AREA_COUNT_MAX];
95 EFI_TCG2_BOOT_HASH_ALG_SHA1,
96 EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2,
98 TCG2_DEFAULT_MAX_COMMAND_SIZE,
99 TCG2_DEFAULT_MAX_RESPONSE_SIZE,
106UINTN mBootAttempts = 0;
107CHAR16 mBootVarName[] = L
"BootOrder";
162 for (Index = 0; Index < Size; Index++) {
163 DEBUG ((DEBUG_INFO,
"%02x", (
UINTN)Data[Index]));
182 UINT32 DigestListCount;
183 TPMI_ALG_HASH HashAlgId;
186 DigestBuffer = (UINT8 *)NoActionEvent->Digests.digests;
189 NoActionEvent->PCRIndex = 0;
190 NoActionEvent->EventType = EV_NO_ACTION;
195 ZeroMem (&NoActionEvent->Digests, sizeof (NoActionEvent->Digests));
197 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA1) != 0) {
198 HashAlgId = TPM_ALG_SHA1;
199 CopyMem (DigestBuffer, &HashAlgId,
sizeof (TPMI_ALG_HASH));
204 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA256) != 0) {
205 HashAlgId = TPM_ALG_SHA256;
206 CopyMem (DigestBuffer, &HashAlgId,
sizeof (TPMI_ALG_HASH));
211 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA384) != 0) {
212 HashAlgId = TPM_ALG_SHA384;
213 CopyMem (DigestBuffer, &HashAlgId,
sizeof (TPMI_ALG_HASH));
218 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA512) != 0) {
219 HashAlgId = TPM_ALG_SHA512;
220 CopyMem (DigestBuffer, &HashAlgId,
sizeof (TPMI_ALG_HASH));
225 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SM3_256) != 0) {
226 HashAlgId = TPM_ALG_SM3_256;
227 CopyMem (DigestBuffer, &HashAlgId,
sizeof (TPMI_ALG_HASH));
235 WriteUnaligned32 ((UINT32 *)&NoActionEvent->Digests.count, DigestListCount);
261 #define COLUME_SIZE (16 * 2)
263 Count = Size / COLUME_SIZE;
264 Left = Size % COLUME_SIZE;
265 for (Index = 0; Index < Count; Index++) {
266 DEBUG ((DEBUG_INFO,
"%04x: ", Index * COLUME_SIZE));
268 DEBUG ((DEBUG_INFO,
"\n"));
272 DEBUG ((DEBUG_INFO,
"%04x: ", Index * COLUME_SIZE));
274 DEBUG ((DEBUG_INFO,
"\n"));
298 UINTN EnabledProcessorNum;
303 Status =
gBS->LocateProtocol (&gEfiMpServiceProtocolGuid,
NULL, (VOID **)&MpProtocol);
304 if (EFI_ERROR (Status)) {
308 return EFI_UNSUPPORTED;
311 Status = MpProtocol->GetNumberOfProcessors (
316 if (EFI_ERROR (Status)) {
320 Status =
gBS->AllocatePool (
323 (VOID **)&ProcessorLocBuf
325 if (EFI_ERROR (Status)) {
332 for (Index = 0; Index < ProcessorNum; Index++) {
333 Status = MpProtocol->GetProcessorInfo (
338 if (EFI_ERROR (Status)) {
347 &ProcessorLocBuf[Index],
353 *LocationBuf = ProcessorLocBuf;
385 DEBUG ((DEBUG_VERBOSE,
"Tcg2GetCapability ...\n"));
387 if ((This ==
NULL) || (ProtocolCapability ==
NULL)) {
388 return EFI_INVALID_PARAMETER;
391 DEBUG ((DEBUG_VERBOSE,
"Size - 0x%x\n", ProtocolCapability->Size));
394 if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
398 if ((mTcgDxeData.BsCap.ProtocolVersion.Major > 0x01) ||
399 ((mTcgDxeData.BsCap.ProtocolVersion.Major == 0x01) && ((mTcgDxeData.BsCap.ProtocolVersion.Minor > 0x00))))
404 ProtocolCapability->StructureVersion.Major = 1;
405 ProtocolCapability->StructureVersion.Minor = 0;
406 ProtocolCapability->ProtocolVersion.Major = 1;
407 ProtocolCapability->ProtocolVersion.Minor = 0;
408 DEBUG ((DEBUG_ERROR,
"TreeGetCapability (Compatible) - %r\n",
EFI_SUCCESS));
413 ProtocolCapability->Size = mTcgDxeData.BsCap.Size;
414 return EFI_BUFFER_TOO_SMALL;
417 CopyMem (ProtocolCapability, &mTcgDxeData.BsCap, mTcgDxeData.BsCap.Size);
434 DEBUG ((DEBUG_INFO,
" Event:\n"));
435 DEBUG ((DEBUG_INFO,
" PCRIndex - %d\n", EventHdr->PCRIndex));
436 DEBUG ((DEBUG_INFO,
" EventType - 0x%08x\n", EventHdr->EventType));
437 DEBUG ((DEBUG_INFO,
" Digest - "));
438 for (Index = 0; Index <
sizeof (
TCG_DIGEST); Index++) {
439 DEBUG ((DEBUG_INFO,
"%02x ", EventHdr->Digest.digest[Index]));
442 DEBUG ((DEBUG_INFO,
"\n"));
443 DEBUG ((DEBUG_INFO,
" EventSize - 0x%08x\n", EventHdr->EventSize));
459 UINT8 *VendorInfoSize;
461 UINT32 NumberOfAlgorithms;
463 DEBUG ((DEBUG_INFO,
" TCG_EfiSpecIDEventStruct:\n"));
464 DEBUG ((DEBUG_INFO,
" signature - '"));
465 for (Index = 0; Index <
sizeof (TcgEfiSpecIdEventStruct->signature); Index++) {
466 DEBUG ((DEBUG_INFO,
"%c", TcgEfiSpecIdEventStruct->signature[Index]));
469 DEBUG ((DEBUG_INFO,
"'\n"));
470 DEBUG ((DEBUG_INFO,
" platformClass - 0x%08x\n", TcgEfiSpecIdEventStruct->platformClass));
471 DEBUG ((DEBUG_INFO,
" specVersion - %d.%d%d\n", TcgEfiSpecIdEventStruct->specVersionMajor, TcgEfiSpecIdEventStruct->specVersionMinor, TcgEfiSpecIdEventStruct->specErrata));
472 DEBUG ((DEBUG_INFO,
" uintnSize - 0x%02x\n", TcgEfiSpecIdEventStruct->uintnSize));
474 CopyMem (&NumberOfAlgorithms, TcgEfiSpecIdEventStruct + 1,
sizeof (NumberOfAlgorithms));
475 DEBUG ((DEBUG_INFO,
" NumberOfAlgorithms - 0x%08x\n", NumberOfAlgorithms));
478 for (Index = 0; Index < NumberOfAlgorithms; Index++) {
479 DEBUG ((DEBUG_INFO,
" digest(%d)\n", Index));
480 DEBUG ((DEBUG_INFO,
" algorithmId - 0x%04x\n", DigestSize[Index].algorithmId));
481 DEBUG ((DEBUG_INFO,
" digestSize - 0x%04x\n", DigestSize[Index].digestSize));
484 VendorInfoSize = (UINT8 *)&DigestSize[NumberOfAlgorithms];
485 DEBUG ((DEBUG_INFO,
" VendorInfoSize - 0x%02x\n", *VendorInfoSize));
486 VendorInfo = VendorInfoSize + 1;
487 DEBUG ((DEBUG_INFO,
" VendorInfo - "));
488 for (Index = 0; Index < *VendorInfoSize; Index++) {
489 DEBUG ((DEBUG_INFO,
"%02x ", VendorInfo[Index]));
492 DEBUG ((DEBUG_INFO,
"\n"));
506 UINT8 *VendorInfoSize;
507 UINT32 NumberOfAlgorithms;
509 CopyMem (&NumberOfAlgorithms, TcgEfiSpecIdEventStruct + 1,
sizeof (NumberOfAlgorithms));
512 VendorInfoSize = (UINT8 *)&DigestSize[NumberOfAlgorithms];
529 TPMI_ALG_HASH HashAlgo;
535 DEBUG ((DEBUG_INFO,
" Event:\n"));
536 DEBUG ((DEBUG_INFO,
" PCRIndex - %d\n", TcgPcrEvent2->PCRIndex));
537 DEBUG ((DEBUG_INFO,
" EventType - 0x%08x\n", TcgPcrEvent2->EventType));
539 DEBUG ((DEBUG_INFO,
" DigestCount: 0x%08x\n", TcgPcrEvent2->Digest.count));
541 DigestCount = TcgPcrEvent2->Digest.count;
542 HashAlgo = TcgPcrEvent2->Digest.digests[0].hashAlg;
543 DigestBuffer = (UINT8 *)&TcgPcrEvent2->Digest.digests[0].digest;
544 for (DigestIndex = 0; DigestIndex < DigestCount; DigestIndex++) {
545 DEBUG ((DEBUG_INFO,
" HashAlgo : 0x%04x\n", HashAlgo));
546 DEBUG ((DEBUG_INFO,
" Digest(%d): ", DigestIndex));
548 for (Index = 0; Index < DigestSize; Index++) {
549 DEBUG ((DEBUG_INFO,
"%02x ", DigestBuffer[Index]));
552 DEBUG ((DEBUG_INFO,
"\n"));
556 CopyMem (&HashAlgo, DigestBuffer + DigestSize,
sizeof (TPMI_ALG_HASH));
557 DigestBuffer = DigestBuffer + DigestSize +
sizeof (TPMI_ALG_HASH);
560 DEBUG ((DEBUG_INFO,
"\n"));
561 DigestBuffer = DigestBuffer -
sizeof (TPMI_ALG_HASH);
563 CopyMem (&EventSize, DigestBuffer,
sizeof (TcgPcrEvent2->EventSize));
564 DEBUG ((DEBUG_INFO,
" EventSize - 0x%08x\n", EventSize));
565 EventBuffer = DigestBuffer +
sizeof (TcgPcrEvent2->EventSize);
583 TPMI_ALG_HASH HashAlgo;
589 DigestCount = TcgPcrEvent2->Digest.count;
590 HashAlgo = TcgPcrEvent2->Digest.digests[0].hashAlg;
591 DigestBuffer = (UINT8 *)&TcgPcrEvent2->Digest.digests[0].digest;
592 for (DigestIndex = 0; DigestIndex < DigestCount; DigestIndex++) {
597 CopyMem (&HashAlgo, DigestBuffer + DigestSize,
sizeof (TPMI_ALG_HASH));
598 DigestBuffer = DigestBuffer + DigestSize +
sizeof (TPMI_ALG_HASH);
601 DigestBuffer = DigestBuffer -
sizeof (TPMI_ALG_HASH);
603 CopyMem (&EventSize, DigestBuffer,
sizeof (TcgPcrEvent2->EventSize));
604 EventBuffer = DigestBuffer +
sizeof (TcgPcrEvent2->EventSize);
606 return (
UINTN)EventBuffer + EventSize - (
UINTN)TcgPcrEvent2;
620 IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
629 UINTN NumberOfEvents;
631 DEBUG ((DEBUG_INFO,
"EventLogFormat: (0x%x)\n", EventLogFormat));
633 switch (EventLogFormat) {
634 case EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2:
636 while ((
UINTN)EventHdr <= EventLogLastEntry) {
641 if (FinalEventsTable ==
NULL) {
642 DEBUG ((DEBUG_INFO,
"FinalEventsTable: NOT FOUND\n"));
644 DEBUG ((DEBUG_INFO,
"FinalEventsTable: (0x%x)\n", FinalEventsTable));
645 DEBUG ((DEBUG_INFO,
" Version: (0x%x)\n", FinalEventsTable->Version));
646 DEBUG ((DEBUG_INFO,
" NumberOfEvents: (0x%x)\n", FinalEventsTable->NumberOfEvents));
649 for (NumberOfEvents = 0; NumberOfEvents < FinalEventsTable->NumberOfEvents; NumberOfEvents++) {
656 case EFI_TCG2_EVENT_LOG_FORMAT_TCG_2:
667 while ((
UINTN)TcgPcrEvent2 <= EventLogLastEntry) {
672 if (FinalEventsTable ==
NULL) {
673 DEBUG ((DEBUG_INFO,
"FinalEventsTable: NOT FOUND\n"));
675 DEBUG ((DEBUG_INFO,
"FinalEventsTable: (0x%x)\n", FinalEventsTable));
676 DEBUG ((DEBUG_INFO,
" Version: (0x%x)\n", FinalEventsTable->Version));
677 DEBUG ((DEBUG_INFO,
" NumberOfEvents: (0x%x)\n", FinalEventsTable->NumberOfEvents));
680 for (NumberOfEvents = 0; NumberOfEvents < FinalEventsTable->NumberOfEvents; NumberOfEvents++) {
713 IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
716 OUT BOOLEAN *EventLogTruncated
721 DEBUG ((DEBUG_INFO,
"Tcg2GetEventLog ... (0x%x)\n", EventLogFormat));
724 return EFI_INVALID_PARAMETER;
727 for (Index = 0; Index <
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]); Index++) {
728 if (EventLogFormat == mTcg2EventInfo[Index].LogFormat) {
733 if (Index ==
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0])) {
734 return EFI_INVALID_PARAMETER;
737 if ((mTcg2EventInfo[Index].LogFormat & mTcgDxeData.BsCap.SupportedEventLogs) == 0) {
738 return EFI_INVALID_PARAMETER;
741 if (!mTcgDxeData.BsCap.TPMPresentFlag) {
742 if (EventLogLocation !=
NULL) {
743 *EventLogLocation = 0;
746 if (EventLogLastEntry !=
NULL) {
747 *EventLogLastEntry = 0;
750 if (EventLogTruncated !=
NULL) {
751 *EventLogTruncated =
FALSE;
757 if (EventLogLocation !=
NULL) {
758 *EventLogLocation = mTcgDxeData.EventLogAreaStruct[Index].Lasa;
759 DEBUG ((DEBUG_INFO,
"Tcg2GetEventLog (EventLogLocation - %x)\n", *EventLogLocation));
762 if (EventLogLastEntry !=
NULL) {
763 if (!mTcgDxeData.EventLogAreaStruct[Index].EventLogStarted) {
769 DEBUG ((DEBUG_INFO,
"Tcg2GetEventLog (EventLogLastEntry - %x)\n", *EventLogLastEntry));
772 if (EventLogTruncated !=
NULL) {
773 *EventLogTruncated = mTcgDxeData.EventLogAreaStruct[Index].EventLogTruncated;
774 DEBUG ((DEBUG_INFO,
"Tcg2GetEventLog (EventLogTruncated - %x)\n", *EventLogTruncated));
780 if ((EventLogLocation !=
NULL) && (EventLogLastEntry !=
NULL)) {
781 DumpEventLog (EventLogFormat, *EventLogLocation, *EventLogLastEntry, mTcgDxeData.FinalEventsTable[Index]);
788 mTcgDxeData.GetEventLogCalled[Index] =
TRUE;
807 IN VOID *NewEventHdr,
808 IN UINT32 NewEventHdrSize,
809 IN UINT8 *NewEventData,
810 IN UINT32 NewEventSize
817 TCG_Sp800_155_PlatformId_Event2_SIGNATURE,
818 sizeof (TCG_Sp800_155_PlatformId_Event2_SIGNATURE) - 1
822 TCG_Sp800_155_PlatformId_Event3_SIGNATURE,
823 sizeof (TCG_Sp800_155_PlatformId_Event3_SIGNATURE) - 1
848 IN VOID *NewEventHdr,
849 IN UINT32 NewEventHdrSize,
850 IN UINT8 *NewEventData,
851 IN UINT32 NewEventSize
855 BOOLEAN Record800155Event;
857 if (NewEventSize >
MAX_ADDRESS - NewEventHdrSize) {
858 return EFI_OUT_OF_RESOURCES;
861 NewLogSize = NewEventHdrSize + NewEventSize;
863 if (NewLogSize >
MAX_ADDRESS - EventLogAreaStruct->EventLogSize) {
864 return EFI_OUT_OF_RESOURCES;
867 if (NewLogSize + EventLogAreaStruct->EventLogSize > EventLogAreaStruct->Laml) {
868 DEBUG ((DEBUG_INFO,
" Laml - 0x%x\n", EventLogAreaStruct->Laml));
869 DEBUG ((DEBUG_INFO,
" NewLogSize - 0x%x\n", NewLogSize));
870 DEBUG ((DEBUG_INFO,
" LogSize - 0x%x\n", EventLogAreaStruct->EventLogSize));
871 DEBUG ((DEBUG_INFO,
"TcgCommLogEvent - %r\n", EFI_OUT_OF_RESOURCES));
872 return EFI_OUT_OF_RESOURCES;
880 Record800155Event =
Is800155Event (NewEventHdr, NewEventHdrSize, NewEventData, NewEventSize);
881 if (Record800155Event) {
882 if (EventLogAreaStruct->Next800155EventOffset != 0) {
884 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset + NewLogSize,
885 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset,
886 EventLogAreaStruct->EventLogSize - EventLogAreaStruct->Next800155EventOffset
890 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset,
895 (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->Next800155EventOffset + NewEventHdrSize,
900 EventLogAreaStruct->Next800155EventOffset += NewLogSize;
901 EventLogAreaStruct->LastEvent += NewLogSize;
902 EventLogAreaStruct->EventLogSize += NewLogSize;
908 EventLogAreaStruct->LastEvent = (UINT8 *)(
UINTN)EventLogAreaStruct->Lasa + EventLogAreaStruct->EventLogSize;
909 EventLogAreaStruct->EventLogSize += NewLogSize;
910 CopyMem (EventLogAreaStruct->LastEvent, NewEventHdr, NewEventHdrSize);
912 EventLogAreaStruct->LastEvent + NewEventHdrSize,
934 IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat,
935 IN VOID *NewEventHdr,
936 IN UINT32 NewEventHdrSize,
937 IN UINT8 *NewEventData,
938 IN UINT32 NewEventSize
945 for (Index = 0; Index <
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]); Index++) {
946 if (EventLogFormat == mTcg2EventInfo[Index].LogFormat) {
951 if (Index ==
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0])) {
952 return EFI_INVALID_PARAMETER;
958 EventLogAreaStruct = &mTcgDxeData.EventLogAreaStruct[Index];
960 if (EventLogAreaStruct->EventLogTruncated) {
961 return EFI_VOLUME_FULL;
972 if (Status == EFI_OUT_OF_RESOURCES) {
973 EventLogAreaStruct->EventLogTruncated =
TRUE;
974 return EFI_VOLUME_FULL;
976 EventLogAreaStruct->EventLogStarted =
TRUE;
982 if (mTcgDxeData.GetEventLogCalled[Index]) {
983 if (mTcgDxeData.FinalEventsTable[Index] ==
NULL) {
990 EventLogAreaStruct = &mTcgDxeData.FinalEventLogAreaStruct[Index];
992 if (EventLogAreaStruct->EventLogTruncated) {
993 return EFI_VOLUME_FULL;
1003 if (Status == EFI_OUT_OF_RESOURCES) {
1004 EventLogAreaStruct->EventLogTruncated =
TRUE;
1005 return EFI_VOLUME_FULL;
1007 EventLogAreaStruct->EventLogStarted =
TRUE;
1011 (mTcgDxeData.FinalEventsTable[Index])->NumberOfEvents++;
1012 DEBUG ((DEBUG_INFO,
"FinalEventsTable->NumberOfEvents - 0x%x\n", (mTcgDxeData.FinalEventsTable[Index])->NumberOfEvents));
1013 DEBUG ((DEBUG_INFO,
" Size - 0x%x\n", (
UINTN)EventLogAreaStruct->EventLogSize));
1029 IN VOID *DigestListBin
1036 TPMI_ALG_HASH HashAlg;
1039 TotalSize =
sizeof (Count);
1040 DigestListBin = (UINT8 *)DigestListBin +
sizeof (Count);
1041 for (Index = 0; Index < Count; Index++) {
1043 TotalSize +=
sizeof (HashAlg);
1044 DigestListBin = (UINT8 *)DigestListBin +
sizeof (HashAlg);
1047 TotalSize += DigestSize;
1048 DigestListBin = (UINT8 *)DigestListBin + DigestSize;
1066 IN OUT VOID *Buffer,
1067 IN VOID *DigestListBin,
1068 IN UINT32 HashAlgorithmMask,
1069 OUT UINT32 *HashAlgorithmMaskCopied
1075 TPMI_ALG_HASH HashAlg;
1076 UINT32 DigestListCount;
1077 UINT32 *DigestListCountPtr;
1079 DigestListCountPtr = (UINT32 *)Buffer;
1080 DigestListCount = 0;
1081 (*HashAlgorithmMaskCopied) = 0;
1084 Buffer = (UINT8 *)Buffer +
sizeof (Count);
1085 DigestListBin = (UINT8 *)DigestListBin +
sizeof (Count);
1086 for (Index = 0; Index < Count; Index++) {
1088 DigestListBin = (UINT8 *)DigestListBin +
sizeof (HashAlg);
1092 CopyMem (Buffer, &HashAlg,
sizeof (HashAlg));
1093 Buffer = (UINT8 *)Buffer +
sizeof (HashAlg);
1094 CopyMem (Buffer, DigestListBin, DigestSize);
1095 Buffer = (UINT8 *)Buffer + DigestSize;
1099 DEBUG ((DEBUG_ERROR,
"WARNING: CopyDigestListBinToBuffer Event log has HashAlg unsupported by PCR bank (0x%x)\n", HashAlg));
1102 DigestListBin = (UINT8 *)DigestListBin + DigestSize;
1124 IN UINT8 *NewEventData
1132 UINT8 *DigestBuffer;
1133 UINT32 *EventSizePtr;
1135 DEBUG ((DEBUG_INFO,
"SupportedEventLogs - 0x%08x\n", mTcgDxeData.BsCap.SupportedEventLogs));
1138 for (Index = 0; Index <
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]); Index++) {
1139 if ((mTcgDxeData.BsCap.SupportedEventLogs & mTcg2EventInfo[Index].LogFormat) != 0) {
1140 DEBUG ((DEBUG_INFO,
" LogFormat - 0x%08x\n", mTcg2EventInfo[Index].LogFormat));
1141 switch (mTcg2EventInfo[Index].LogFormat) {
1142 case EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2:
1144 if (!EFI_ERROR (Status)) {
1148 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
1150 mTcg2EventInfo[Index].LogFormat,
1154 NewEventHdr->EventSize
1160 gBS->RestoreTPL (OldTpl);
1167 case EFI_TCG2_EVENT_LOG_FORMAT_TCG_2:
1168 ZeroMem (&TcgPcrEvent2,
sizeof (TcgPcrEvent2));
1169 TcgPcrEvent2.PCRIndex = NewEventHdr->PCRIndex;
1170 TcgPcrEvent2.EventType = NewEventHdr->EventType;
1171 DigestBuffer = (UINT8 *)&TcgPcrEvent2.Digest;
1173 CopyMem (EventSizePtr, &NewEventHdr->EventSize, sizeof (NewEventHdr->EventSize));
1178 OldTpl =
gBS->RaiseTPL (TPL_HIGH_LEVEL);
1180 mTcg2EventInfo[Index].LogFormat,
1182 sizeof (TcgPcrEvent2.PCRIndex) + sizeof (TcgPcrEvent2.EventType) +
GetDigestListBinSize (DigestBuffer) +
sizeof (TcgPcrEvent2.EventSize),
1184 NewEventHdr->EventSize
1190 gBS->RestoreTPL (OldTpl);
1222 IN UINT64 HashDataLen,
1224 IN UINT8 *NewEventData
1231 if (!mTcgDxeData.BsCap.TPMPresentFlag) {
1232 return EFI_DEVICE_ERROR;
1235 if (NewEventHdr->EventType == EV_NO_ACTION) {
1239 if (NewEventHdr->PCRIndex <= MAX_PCR_INDEX) {
1242 if ((Flags & EFI_TCG2_EXTEND_ONLY) == 0) {
1250 NewEventHdr->PCRIndex,
1255 if (!EFI_ERROR (Status)) {
1264 NewEventHdr->PCRIndex,
1269 if (!EFI_ERROR (Status)) {
1270 if ((Flags & EFI_TCG2_EXTEND_ONLY) == 0) {
1275 if (Status == EFI_DEVICE_ERROR) {
1276 DEBUG ((DEBUG_ERROR,
"TcgDxeHashLogExtendEvent - %r. Disable TPM.\n", Status));
1277 mTcgDxeData.BsCap.TPMPresentFlag =
FALSE;
1280 (
PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
1312 IN UINT64 DataToHashLen,
1320 DEBUG ((DEBUG_VERBOSE,
"Tcg2HashLogExtendEvent ...\n"));
1322 if ((This ==
NULL) || (Event ==
NULL)) {
1323 return EFI_INVALID_PARAMETER;
1329 if ((Event->Header.EventType != EV_NO_ACTION) && (DataToHash == 0)) {
1330 return EFI_INVALID_PARAMETER;
1333 if (!mTcgDxeData.BsCap.TPMPresentFlag) {
1334 return EFI_DEVICE_ERROR;
1337 if (Event->Size < Event->Header.HeaderSize + sizeof (UINT32)) {
1338 return EFI_INVALID_PARAMETER;
1341 if ((Event->Header.EventType != EV_NO_ACTION) && (Event->Header.PCRIndex > MAX_PCR_INDEX)) {
1342 return EFI_INVALID_PARAMETER;
1345 NewEventHdr.PCRIndex = Event->Header.PCRIndex;
1346 NewEventHdr.EventType = Event->Header.EventType;
1347 NewEventHdr.EventSize = Event->Size -
sizeof (UINT32) - Event->Header.HeaderSize;
1348 if ((Flags & PE_COFF_IMAGE) != 0) {
1350 NewEventHdr.PCRIndex,
1352 (
UINTN)DataToHashLen,
1355 if (!EFI_ERROR (Status)) {
1356 if ((Flags & EFI_TCG2_EXTEND_ONLY) == 0) {
1361 if (Status == EFI_DEVICE_ERROR) {
1362 DEBUG ((DEBUG_ERROR,
"MeasurePeImageAndExtend - %r. Disable TPM.\n", Status));
1363 mTcgDxeData.BsCap.TPMPresentFlag =
FALSE;
1366 (
PcdGet32 (PcdStatusCodeSubClassTpmDevice) | EFI_P_EC_INTERFACE_ERROR)
1372 (UINT8 *)(
UINTN)DataToHash,
1379 DEBUG ((DEBUG_VERBOSE,
"Tcg2HashLogExtendEvent - %r\n", Status));
1401 IN UINT32 InputParameterBlockSize,
1402 IN UINT8 *InputParameterBlock,
1403 IN UINT32 OutputParameterBlockSize,
1404 IN UINT8 *OutputParameterBlock
1409 DEBUG ((DEBUG_INFO,
"Tcg2SubmitCommand ...\n"));
1411 if ((This ==
NULL) ||
1412 (InputParameterBlockSize == 0) || (InputParameterBlock ==
NULL) ||
1413 (OutputParameterBlockSize == 0) || (OutputParameterBlock ==
NULL))
1415 return EFI_INVALID_PARAMETER;
1418 if (!mTcgDxeData.BsCap.TPMPresentFlag) {
1419 return EFI_DEVICE_ERROR;
1422 if (InputParameterBlockSize > mTcgDxeData.BsCap.MaxCommandSize) {
1423 return EFI_INVALID_PARAMETER;
1426 if (OutputParameterBlockSize > mTcgDxeData.BsCap.MaxResponseSize) {
1427 return EFI_INVALID_PARAMETER;
1431 InputParameterBlockSize,
1432 InputParameterBlock,
1433 &OutputParameterBlockSize,
1434 OutputParameterBlock
1436 DEBUG ((DEBUG_INFO,
"Tcg2SubmitCommand - %r\n", Status));
1453 OUT UINT32 *ActivePcrBanks
1456 if (ActivePcrBanks ==
NULL) {
1457 return EFI_INVALID_PARAMETER;
1460 *ActivePcrBanks = mTcgDxeData.BsCap.ActivePcrBanks;
1477 IN UINT32 ActivePcrBanks
1483 DEBUG ((DEBUG_INFO,
"Tcg2SetActivePCRBanks ... (0x%x)\n", ActivePcrBanks));
1485 if (ActivePcrBanks == 0) {
1486 return EFI_INVALID_PARAMETER;
1489 if ((ActivePcrBanks & (~mTcgDxeData.BsCap.HashAlgorithmBitmap)) != 0) {
1490 return EFI_INVALID_PARAMETER;
1493 if (ActivePcrBanks == mTcgDxeData.BsCap.ActivePcrBanks) {
1502 if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {
1504 }
else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE) {
1505 Status = EFI_OUT_OF_RESOURCES;
1506 }
else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED) {
1507 Status = EFI_UNSUPPORTED;
1509 Status = EFI_DEVICE_ERROR;
1512 DEBUG ((DEBUG_INFO,
"Tcg2SetActivePCRBanks - %r\n", Status));
1531 OUT UINT32 *OperationPresent,
1532 OUT UINT32 *Response
1537 if ((OperationPresent ==
NULL) || (Response ==
NULL)) {
1538 return EFI_INVALID_PARAMETER;
1542 if (ReturnCode == TCG_PP_RETURN_TPM_OPERATION_RESPONSE_SUCCESS) {
1545 return EFI_UNSUPPORTED;
1576 VOID *DigestListBin;
1578 UINT32 DigestListBinSize;
1581 UINT32 *EventSizePtr;
1582 UINT32 HashAlgorithmMaskCopied;
1589 UINT8 *VendorInfoSize;
1590 UINT32 NumberOfAlgorithms;
1593 DEBUG ((DEBUG_INFO,
"SetupEventLog\n"));
1598 for (Index = 0; Index <
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]); Index++) {
1599 if ((mTcgDxeData.BsCap.SupportedEventLogs & mTcg2EventInfo[Index].LogFormat) != 0) {
1600 mTcgDxeData.EventLogAreaStruct[Index].EventLogFormat = mTcg2EventInfo[Index].LogFormat;
1601 if (
PcdGet8 (PcdTpm2AcpiTableRev) >= 4) {
1602 Status =
gBS->AllocatePages (
1609 Status =
gBS->AllocatePages (
1617 if (EFI_ERROR (Status)) {
1621 mTcgDxeData.EventLogAreaStruct[Index].Lasa = Lasa;
1622 mTcgDxeData.EventLogAreaStruct[Index].Laml =
PcdGet32 (PcdTcgLogAreaMinLen);
1623 mTcgDxeData.EventLogAreaStruct[Index].Next800155EventOffset = 0;
1625 if ((
PcdGet8 (PcdTpm2AcpiTableRev) >= 4) ||
1626 (mTcg2EventInfo[Index].LogFormat == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2))
1632 PcdSet32S (PcdTpm2AcpiTableLaml, (UINT32)mTcgDxeData.EventLogAreaStruct[Index].Laml);
1633 PcdSet64S (PcdTpm2AcpiTableLasa, mTcgDxeData.EventLogAreaStruct[Index].Lasa);
1644 if (mTcg2EventInfo[Index].LogFormat != EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2) {
1649 CopyMem (TcgEfiSpecIdEventStruct->signature, TCG_EfiSpecIDEventStruct_SIGNATURE_03, sizeof (TcgEfiSpecIdEventStruct->signature));
1650 TcgEfiSpecIdEventStruct->platformClass =
PcdGet8 (PcdTpmPlatformClass);
1651 TcgEfiSpecIdEventStruct->specVersionMajor = TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2;
1652 TcgEfiSpecIdEventStruct->specVersionMinor = TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2;
1653 TcgEfiSpecIdEventStruct->specErrata = (UINT8)
PcdGet32 (PcdTcgPfpMeasurementRevision);
1654 TcgEfiSpecIdEventStruct->uintnSize =
sizeof (
UINTN)/
sizeof (UINT32);
1655 NumberOfAlgorithms = 0;
1657 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA1) != 0) {
1658 TempDigestSize = DigestSize;
1659 TempDigestSize += NumberOfAlgorithms;
1660 TempDigestSize->algorithmId = TPM_ALG_SHA1;
1662 NumberOfAlgorithms++;
1665 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA256) != 0) {
1666 TempDigestSize = DigestSize;
1667 TempDigestSize += NumberOfAlgorithms;
1668 TempDigestSize->algorithmId = TPM_ALG_SHA256;
1670 NumberOfAlgorithms++;
1673 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA384) != 0) {
1674 TempDigestSize = DigestSize;
1675 TempDigestSize += NumberOfAlgorithms;
1676 TempDigestSize->algorithmId = TPM_ALG_SHA384;
1678 NumberOfAlgorithms++;
1681 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA512) != 0) {
1682 TempDigestSize = DigestSize;
1683 TempDigestSize += NumberOfAlgorithms;
1684 TempDigestSize->algorithmId = TPM_ALG_SHA512;
1686 NumberOfAlgorithms++;
1689 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SM3_256) != 0) {
1690 TempDigestSize = DigestSize;
1691 TempDigestSize += NumberOfAlgorithms;
1692 TempDigestSize->algorithmId = TPM_ALG_SM3_256;
1694 NumberOfAlgorithms++;
1697 CopyMem (TcgEfiSpecIdEventStruct + 1, &NumberOfAlgorithms,
sizeof (NumberOfAlgorithms));
1698 TempDigestSize = DigestSize;
1699 TempDigestSize += NumberOfAlgorithms;
1700 VendorInfoSize = (UINT8 *)TempDigestSize;
1701 *VendorInfoSize = 0;
1703 SpecIdEvent.PCRIndex = 0;
1704 SpecIdEvent.EventType = EV_NO_ACTION;
1705 ZeroMem (&SpecIdEvent.Digest, sizeof (SpecIdEvent.Digest));
1714 mTcg2EventInfo[Index].LogFormat,
1716 sizeof (SpecIdEvent),
1717 (UINT8 *)TcgEfiSpecIdEventStruct,
1718 SpecIdEvent.EventSize
1724 mTcgDxeData.EventLogAreaStruct[Index].Next800155EventOffset = \
1725 mTcgDxeData.EventLogAreaStruct[Index].EventLogSize;
1731 while (GuidHob.Guid !=
NULL) {
1735 mTcg2EventInfo[Index].LogFormat,
1737 sizeof (NoActionEvent.PCRIndex) + sizeof (NoActionEvent.EventType) +
GetDigestListBinSize (&NoActionEvent.Digests) + sizeof (NoActionEvent.EventSize),
1738 GET_GUID_HOB_DATA (GuidHob.Guid),
1739 GET_GUID_HOB_DATA_SIZE (GuidHob.Guid)
1742 GuidHob.Guid = GET_NEXT_HOB (GuidHob);
1743 GuidHob.Guid =
GetNextGuidHob (&gTcg800155PlatformIdEventHobGuid, GuidHob.Guid);
1750 if (GuidHob.Guid !=
NULL) {
1754 StartupLocalityEvent.StartupLocality = *(UINT8 *)(GET_GUID_HOB_DATA (GuidHob.Guid));
1755 CopyMem (StartupLocalityEvent.Signature, TCG_EfiStartupLocalityEvent_SIGNATURE, sizeof (StartupLocalityEvent.Signature));
1756 DEBUG ((DEBUG_INFO,
"SetupEventLog: Set Locality from HOB into StartupLocalityEvent 0x%02x\n", StartupLocalityEvent.StartupLocality));
1768 mTcg2EventInfo[Index].LogFormat,
1770 sizeof (NoActionEvent.PCRIndex) + sizeof (NoActionEvent.EventType) +
GetDigestListBinSize (&NoActionEvent.Digests) + sizeof (NoActionEvent.EventSize),
1771 (UINT8 *)&StartupLocalityEvent,
1772 sizeof (StartupLocalityEvent)
1782 for (Index = 0; Index <
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]); Index++) {
1783 if ((mTcgDxeData.BsCap.SupportedEventLogs & mTcg2EventInfo[Index].LogFormat) != 0) {
1784 if (mTcg2EventInfo[Index].LogFormat == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2) {
1785 Status =
gBS->AllocatePages (
1791 if (EFI_ERROR (Status)) {
1800 mTcgDxeData.FinalEventsTable[Index] = (VOID *)(
UINTN)Lasa;
1801 (mTcgDxeData.FinalEventsTable[Index])->Version = EFI_TCG2_FINAL_EVENTS_TABLE_VERSION;
1802 (mTcgDxeData.FinalEventsTable[Index])->NumberOfEvents = 0;
1804 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogFormat = mTcg2EventInfo[Index].LogFormat;
1807 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogSize = 0;
1808 mTcgDxeData.FinalEventLogAreaStruct[Index].LastEvent = (VOID *)(
UINTN)mTcgDxeData.FinalEventLogAreaStruct[Index].Lasa;
1809 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogStarted =
FALSE;
1810 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogTruncated =
FALSE;
1811 mTcgDxeData.FinalEventLogAreaStruct[Index].Next800155EventOffset = 0;
1816 Status =
gBS->InstallConfigurationTable (&gEfiTcg2FinalEventsTableGuid, (VOID *)mTcgDxeData.FinalEventsTable[Index]);
1817 if (EFI_ERROR (Status)) {
1824 mTcgDxeData.FinalEventsTable[Index] =
NULL;
1825 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogFormat = mTcg2EventInfo[Index].LogFormat;
1826 mTcgDxeData.FinalEventLogAreaStruct[Index].Lasa = 0;
1827 mTcgDxeData.FinalEventLogAreaStruct[Index].Laml = 0;
1828 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogSize = 0;
1829 mTcgDxeData.FinalEventLogAreaStruct[Index].LastEvent = 0;
1830 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogStarted =
FALSE;
1831 mTcgDxeData.FinalEventLogAreaStruct[Index].EventLogTruncated =
FALSE;
1832 mTcgDxeData.FinalEventLogAreaStruct[Index].Next800155EventOffset = 0;
1841 for (Index = 0; Index <
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]); Index++) {
1842 if ((mTcgDxeData.BsCap.SupportedEventLogs & mTcg2EventInfo[Index].LogFormat) != 0) {
1845 while (!EFI_ERROR (Status) &&
1846 (GuidHob.Raw =
GetNextGuidHob (mTcg2EventInfo[Index].EventGuid, GuidHob.Raw)) !=
NULL)
1848 TcgEvent =
AllocateCopyPool (GET_GUID_HOB_DATA_SIZE (GuidHob.Guid), GET_GUID_HOB_DATA (GuidHob.Guid));
1849 ASSERT (TcgEvent !=
NULL);
1850 GuidHob.Raw = GET_NEXT_HOB (GuidHob);
1851 switch (mTcg2EventInfo[Index].LogFormat) {
1852 case EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2:
1854 mTcg2EventInfo[Index].LogFormat,
1861 case EFI_TCG2_EVENT_LOG_FORMAT_TCG_2:
1862 DigestListBin = (UINT8 *)TcgEvent +
sizeof (TCG_PCRINDEX) +
sizeof (TCG_EVENTTYPE);
1867 CopyMem (&EventSize, (UINT8 *)DigestListBin + DigestListBinSize,
sizeof (UINT32));
1868 Event = (UINT8 *)DigestListBin + DigestListBinSize +
sizeof (UINT32);
1876 mTcgDxeData.BsCap.ActivePcrBanks,
1877 &HashAlgorithmMaskCopied
1879 if (HashAlgorithmMaskCopied != mTcgDxeData.BsCap.ActivePcrBanks) {
1882 "ERROR: The event2 log includes digest hash mask 0x%x, but required digest hash mask is 0x%x\n",
1883 HashAlgorithmMaskCopied,
1884 mTcgDxeData.BsCap.ActivePcrBanks
1891 CopyMem (EventSizePtr, &EventSize,
sizeof (UINT32));
1895 mTcg2EventInfo[Index].LogFormat,
1897 sizeof (TCG_PCRINDEX) +
sizeof (TCG_EVENTTYPE) + DigestListBinSize +
sizeof (UINT32),
1930 TcgEvent.PCRIndex = PCRIndex;
1931 TcgEvent.EventType = EV_EFI_ACTION;
1932 TcgEvent.EventSize = (UINT32)
AsciiStrLen (String);
1960 ProcessorLocBuf =
NULL;
1963 if (
PcdGet8 (PcdTpmPlatformClass) == TCG_PLATFORM_TYPE_SERVER) {
1970 if (!EFI_ERROR (Status)) {
1971 TcgEvent.PCRIndex = 1;
1972 TcgEvent.EventType = EV_TABLE_OF_DEVICES;
1973 TcgEvent.EventSize =
sizeof (HandoffTables);
1975 HandoffTables.NumberOfTables = 1;
1976 HandoffTables.TableEntry[0].
VendorGuid = gEfiMpServiceProtocolGuid;
1977 HandoffTables.TableEntry[0].
VendorTable = ProcessorLocBuf;
1981 (UINT8 *)(
UINTN)ProcessorLocBuf,
1984 (UINT8 *)&HandoffTables
2011 DEBUG ((DEBUG_INFO,
"MeasureSeparatorEvent Pcr - %x\n", PCRIndex));
2014 TcgEvent.PCRIndex = PCRIndex;
2015 TcgEvent.EventType = EV_SEPARATOR;
2016 TcgEvent.EventSize = (UINT32)
sizeof (EventData);
2019 (UINT8 *)&EventData,
2044 IN TCG_EVENTTYPE EventType,
2053 UINTN VarNameLength;
2056 DEBUG ((DEBUG_INFO,
"Tcg2Dxe: MeasureVariable (Pcr - %x, EventType - %x, ", (
UINTN)PCRIndex, (
UINTN)EventType));
2057 DEBUG ((DEBUG_INFO,
"VariableName - %s, VendorGuid - %g)\n", VarName, VendorGuid));
2059 VarNameLength =
StrLen (VarName);
2060 TcgEvent.PCRIndex = PCRIndex;
2061 TcgEvent.EventType = EventType;
2063 TcgEvent.EventSize = (UINT32)(
sizeof (*VarLog) + VarNameLength *
sizeof (*VarName) + VarSize
2064 -
sizeof (VarLog->UnicodeName) -
sizeof (VarLog->
VariableData));
2067 if (VarLog ==
NULL) {
2068 return EFI_OUT_OF_RESOURCES;
2071 VarLog->VariableName = *VendorGuid;
2072 VarLog->UnicodeNameLength = VarNameLength;
2073 VarLog->VariableDataLength = VarSize;
2075 VarLog->UnicodeName,
2077 VarNameLength * sizeof (*VarName)
2079 if ((VarSize != 0) && (VarData !=
NULL)) {
2081 (CHAR16 *)VarLog->UnicodeName + VarNameLength,
2087 if ((EventType == EV_EFI_VARIABLE_DRIVER_CONFIG) || (EventType == EV_EFI_SPDM_DEVICE_POLICY)) {
2099 ASSERT (VarData !=
NULL);
2131 IN TCG_EVENTTYPE EventType,
2140 Status =
GetVariable2 (VarName, VendorGuid, VarData, VarSize);
2141 if (EventType == EV_EFI_VARIABLE_DRIVER_CONFIG) {
2142 if (EFI_ERROR (Status)) {
2153 if (EFI_ERROR (Status)) {
2154 return EFI_NOT_FOUND;
2193 EV_EFI_VARIABLE_BOOT,
2224 EV_EFI_VARIABLE_DRIVER_CONFIG,
2256 &gEfiGlobalVariableGuid,
2260 if ((Status == EFI_NOT_FOUND) || (BootOrder ==
NULL)) {
2264 if (EFI_ERROR (Status)) {
2272 BootCount /=
sizeof (*BootOrder);
2273 for (Index = 0; Index < BootCount; Index++) {
2274 UnicodeSPrint (mBootVarName,
sizeof (mBootVarName), L
"Boot%04x", BootOrder[Index]);
2277 &gEfiGlobalVariableGuid,
2281 if (!EFI_ERROR (Status)) {
2310 Status = EFI_NOT_FOUND;
2311 for (Index = 0; Index <
sizeof (mVariableType)/
sizeof (mVariableType[0]); Index++) {
2313 mVariableType[Index].VariableName,
2314 mVariableType[Index].VendorGuid,
2318 if (!EFI_ERROR (Status)) {
2329 if (!EFI_ERROR (Status)) {
2332 EV_EFI_VARIABLE_DRIVER_CONFIG,
2334 &gEfiImageSecurityDatabaseGuid,
2346 if ((
PcdGet32 (PcdTcgPfpMeasurementRevision) >= TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_106) &&
2347 (
PcdGet8 (PcdEnableSpdmDeviceAuthentication) != 0))
2349 Status =
GetVariable2 (EFI_DEVICE_SECURITY_DATABASE, &gEfiDeviceSignatureDatabaseGuid, &Data, &DataSize);
2352 PCR_INDEX_FOR_SIGNATURE_DB,
2353 EV_EFI_SPDM_DEVICE_POLICY,
2354 EFI_DEVICE_SECURITY_DATABASE,
2355 &gEfiDeviceSignatureDatabaseGuid,
2360 }
else if (Status == EFI_NOT_FOUND) {
2364 PCR_INDEX_FOR_SIGNATURE_DB,
2365 EV_EFI_SPDM_DEVICE_POLICY,
2366 EFI_DEVICE_SECURITY_DATABASE,
2367 &gEfiDeviceSignatureDatabaseGuid,
2392 TcgEvent.PCRIndex = 7;
2393 TcgEvent.EventType = EV_EFI_ACTION;
2394 TcgEvent.EventSize =
sizeof (FIRMWARE_DEBUGGER_EVENT_STRING) - 1;
2397 (UINT8 *)FIRMWARE_DEBUGGER_EVENT_STRING,
2398 sizeof (FIRMWARE_DEBUGGER_EVENT_STRING) - 1,
2400 (UINT8 *)FIRMWARE_DEBUGGER_EVENT_STRING
2432 Status =
gBS->LocateProtocol (&gEfiVariableWriteArchProtocolGuid,
NULL, (VOID **)&Protocol);
2433 if (EFI_ERROR (Status)) {
2437 if (
PcdGetBool (PcdFirmwareDebuggerInitialized)) {
2439 DEBUG ((DEBUG_INFO,
"MeasureLaunchOfFirmwareDebugger - %r\n", Status));
2443 DEBUG ((DEBUG_INFO,
"MeasureAllSecureVariables - %r\n", Status));
2452 DEBUG ((DEBUG_INFO,
"MeasureSeparatorEvent - %r\n", Status));
2475 PERF_START_EX (mImageHandle,
"EventRec",
"Tcg2Dxe", 0, PERF_ID_TCG2_DXE);
2476 if (mBootAttempts == 0) {
2481 if (EFI_ERROR (Status)) {
2482 DEBUG ((DEBUG_ERROR,
"HOBs not Measured. Error!\n"));
2489 if (EFI_ERROR (Status)) {
2490 DEBUG ((DEBUG_ERROR,
"Boot Variables not Measured. Error!\n"));
2498 EFI_CALLING_EFI_APPLICATION
2500 if (EFI_ERROR (Status)) {
2501 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_CALLING_EFI_APPLICATION));
2508 for (PcrIndex = 0; PcrIndex < 7; PcrIndex++) {
2510 if (EFI_ERROR (Status)) {
2511 DEBUG ((DEBUG_ERROR,
"Separator Event not Measured. Error!\n"));
2532 EFI_RETURNING_FROM_EFI_APPLICATION
2534 if (EFI_ERROR (Status)) {
2535 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_RETURNING_FROM_EFI_APPLICATION));
2544 EFI_CALLING_EFI_APPLICATION
2546 if (EFI_ERROR (Status)) {
2547 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_CALLING_EFI_APPLICATION));
2551 DEBUG ((DEBUG_INFO,
"TPM2 Tcg2Dxe Measure Data when ReadyToBoot\n"));
2556 PERF_END_EX (mImageHandle,
"EventRec",
"Tcg2Dxe", 0, PERF_ID_TCG2_DXE + 1);
2582 EFI_EXIT_BOOT_SERVICES_INVOCATION
2584 if (EFI_ERROR (Status)) {
2585 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_INVOCATION));
2593 EFI_EXIT_BOOT_SERVICES_SUCCEEDED
2595 if (EFI_ERROR (Status)) {
2596 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_SUCCEEDED));
2623 EFI_EXIT_BOOT_SERVICES_INVOCATION
2625 if (EFI_ERROR (Status)) {
2626 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_INVOCATION));
2634 EFI_EXIT_BOOT_SERVICES_FAILED
2636 if (EFI_ERROR (Status)) {
2637 DEBUG ((DEBUG_ERROR,
"%a not Measured. Error!\n", EFI_EXIT_BOOT_SERVICES_FAILED));
2664 IN VOID *ResetData OPTIONAL
2670 DEBUG ((DEBUG_VERBOSE,
"Tpm2Shutdown (SU_CLEAR) - %r\n", Status));
2691 Status =
gBS->LocateProtocol (&gEfiResetNotificationProtocolGuid,
NULL, (VOID **)&ResetNotify);
2692 if (!EFI_ERROR (Status)) {
2695 DEBUG ((DEBUG_VERBOSE,
"TCG2: Hook system reset to properly shutdown TPM.\n"));
2697 gBS->CloseEvent (Event);
2716 Status =
gBS->InstallMultipleProtocolInterfaces (
2718 &gEfiTcg2ProtocolGuid,
2744 UINT32 MaxCommandSize;
2745 UINT32 MaxResponseSize;
2747 EFI_TCG2_EVENT_ALGORITHM_BITMAP TpmHashAlgorithmBitmap;
2748 UINT32 ActivePCRBanks;
2749 UINT32 NumberOfPCRBanks;
2751 mImageHandle = ImageHandle;
2756 DEBUG ((DEBUG_INFO,
"No TPM2 instance required!\n"));
2757 return EFI_UNSUPPORTED;
2761 DEBUG ((DEBUG_ERROR,
"TPM2 error!\n"));
2762 return EFI_DEVICE_ERROR;
2766 if (EFI_ERROR (Status)) {
2767 DEBUG ((DEBUG_ERROR,
"TPM2 not detected!\n"));
2774 ASSERT (TCG_EVENT_LOG_AREA_COUNT_MAX ==
sizeof (mTcg2EventInfo)/
sizeof (mTcg2EventInfo[0]));
2777 mTcgDxeData.BsCap.ProtocolVersion.Major = 1;
2778 mTcgDxeData.BsCap.ProtocolVersion.Minor = 1;
2779 mTcgDxeData.BsCap.StructureVersion.Major = 1;
2780 mTcgDxeData.BsCap.StructureVersion.Minor = 1;
2782 DEBUG ((DEBUG_INFO,
"Tcg2.ProtocolVersion - %02x.%02x\n", mTcgDxeData.BsCap.ProtocolVersion.Major, mTcgDxeData.BsCap.ProtocolVersion.Minor));
2783 DEBUG ((DEBUG_INFO,
"Tcg2.StructureVersion - %02x.%02x\n", mTcgDxeData.BsCap.StructureVersion.Major, mTcgDxeData.BsCap.StructureVersion.Minor));
2786 if (EFI_ERROR (Status)) {
2787 DEBUG ((DEBUG_ERROR,
"Tpm2GetCapabilityManufactureID fail!\n"));
2789 DEBUG ((DEBUG_INFO,
"Tpm2GetCapabilityManufactureID - %08x\n", mTcgDxeData.BsCap.ManufacturerID));
2793 UINT32 FirmwareVersion1;
2794 UINT32 FirmwareVersion2;
2797 if (EFI_ERROR (Status)) {
2798 DEBUG ((DEBUG_ERROR,
"Tpm2GetCapabilityFirmwareVersion fail!\n"));
2800 DEBUG ((DEBUG_INFO,
"Tpm2GetCapabilityFirmwareVersion - %08x %08x\n", FirmwareVersion1, FirmwareVersion2));
2806 if (EFI_ERROR (Status)) {
2807 DEBUG ((DEBUG_ERROR,
"Tpm2GetCapabilityMaxCommandResponseSize fail!\n"));
2809 mTcgDxeData.BsCap.MaxCommandSize = (UINT16)MaxCommandSize;
2810 mTcgDxeData.BsCap.MaxResponseSize = (UINT16)MaxResponseSize;
2811 DEBUG ((DEBUG_INFO,
"Tpm2GetCapabilityMaxCommandResponseSize - %08x, %08x\n", MaxCommandSize, MaxResponseSize));
2820 mTcgDxeData.BsCap.HashAlgorithmBitmap = TpmHashAlgorithmBitmap &
PcdGet32 (PcdTcg2HashAlgorithmBitmap);
2821 mTcgDxeData.BsCap.ActivePcrBanks = ActivePCRBanks &
PcdGet32 (PcdTcg2HashAlgorithmBitmap);
2826 NumberOfPCRBanks = 0;
2827 for (Index = 0; Index < 32; Index++) {
2828 if ((mTcgDxeData.BsCap.HashAlgorithmBitmap & (1u << Index)) != 0) {
2833 if (
PcdGet32 (PcdTcg2NumberOfPCRBanks) == 0) {
2834 mTcgDxeData.BsCap.NumberOfPCRBanks = NumberOfPCRBanks;
2836 mTcgDxeData.BsCap.NumberOfPCRBanks =
PcdGet32 (PcdTcg2NumberOfPCRBanks);
2837 if (
PcdGet32 (PcdTcg2NumberOfPCRBanks) > NumberOfPCRBanks) {
2838 DEBUG ((DEBUG_ERROR,
"ERROR: PcdTcg2NumberOfPCRBanks(0x%x) > NumberOfPCRBanks(0x%x)\n",
PcdGet32 (PcdTcg2NumberOfPCRBanks), NumberOfPCRBanks));
2839 mTcgDxeData.BsCap.NumberOfPCRBanks = NumberOfPCRBanks;
2843 mTcgDxeData.BsCap.SupportedEventLogs = EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2 | EFI_TCG2_EVENT_LOG_FORMAT_TCG_2;
2844 if ((mTcgDxeData.BsCap.ActivePcrBanks & EFI_TCG2_BOOT_HASH_ALG_SHA1) == 0) {
2848 mTcgDxeData.BsCap.SupportedEventLogs &= ~EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2;
2851 DEBUG ((DEBUG_INFO,
"Tcg2.SupportedEventLogs - 0x%08x\n", mTcgDxeData.BsCap.SupportedEventLogs));
2852 DEBUG ((DEBUG_INFO,
"Tcg2.HashAlgorithmBitmap - 0x%08x\n", mTcgDxeData.BsCap.HashAlgorithmBitmap));
2853 DEBUG ((DEBUG_INFO,
"Tcg2.NumberOfPCRBanks - 0x%08x\n", mTcgDxeData.BsCap.NumberOfPCRBanks));
2854 DEBUG ((DEBUG_INFO,
"Tcg2.ActivePcrBanks - 0x%08x\n", mTcgDxeData.BsCap.ActivePcrBanks));
2856 if (mTcgDxeData.BsCap.TPMPresentFlag) {
2873 Status =
gBS->CreateEventEx (
2878 &gEfiEventExitBootServicesGuid,
2885 Status =
gBS->CreateEventEx (
2890 &gEventExitBootServicesFailedGuid,
2911 DEBUG ((DEBUG_INFO,
"InstallTcg2 - %r\n", Status));
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
VOID *EFIAPI GetNextGuidHob(IN CONST EFI_GUID *Guid, IN CONST VOID *HobStart)
VOID *EFIAPI GetHobList(VOID)
#define SM3_256_DIGEST_SIZE
#define SHA512_DIGEST_SIZE
#define SHA256_DIGEST_SIZE
#define SHA384_DIGEST_SIZE
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
UINT16 EFIAPI ReadUnaligned16(IN CONST UINT16 *Buffer)
UINT32 EFIAPI WriteUnaligned32(OUT UINT32 *Buffer, IN UINT32 Value)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
UINT32 EFIAPI ReadUnaligned32(IN CONST UINT32 *Buffer)
INTN EFIAPI CompareMem(IN CONST VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define EFI_KEY_EXCHANGE_KEY_NAME
#define EFI_PLATFORM_KEY_NAME
#define EFI_SECURE_BOOT_MODE_NAME
EFI_STATUS EFIAPI HashAndExtend(IN TPMI_DH_PCR PcrIndex, IN VOID *DataToHash, IN UINTN DataToHashLen, OUT TPML_DIGEST_VALUES *DigestList)
#define EFI_IMAGE_SECURITY_DATABASE2
#define EFI_IMAGE_SECURITY_DATABASE1
#define EFI_IMAGE_SECURITY_DATABASE
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG_CODE_BEGIN()
#define DEBUG(Expression)
#define REPORT_STATUS_CODE(Type, Value)
UINT32 EFIAPI Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction(IN UINT32 OperationRequest, IN UINT32 RequestParameter)
UINT32 EFIAPI Tcg2PhysicalPresenceLibReturnOperationResponseToOsFunction(OUT UINT32 *MostRecentRequest, OUT UINT32 *Response)
#define PcdGet8(TokenName)
#define PcdGet32(TokenName)
#define PcdGetBool(TokenName)
#define PcdSet64S(TokenName, Value)
#define PcdSet32S(TokenName, Value)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS TcgMeasureAction(IN TPM_PCRINDEX PCRIndex, IN CHAR8 *String)
VOID EFIAPI OnExitBootServicesFailed(IN EFI_EVENT Event, IN VOID *Context)
VOID InternalDumpData(IN UINT8 *Data, IN UINTN Size)
UINTN GetTcgEfiSpecIdEventStructSize(IN TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct)
VOID * CopyDigestListBinToBuffer(IN OUT VOID *Buffer, IN VOID *DigestListBin, IN UINT32 HashAlgorithmMask, OUT UINT32 *HashAlgorithmMaskCopied)
EFI_STATUS EFIAPI Tcg2SetActivePCRBanks(IN EFI_TCG2_PROTOCOL *This, IN UINT32 ActivePcrBanks)
EFI_STATUS MeasureLaunchOfFirmwareDebugger(VOID)
EFI_STATUS SetupEventLog(VOID)
EFI_STATUS EFIAPI Tcg2HashLogExtendEvent(IN EFI_TCG2_PROTOCOL *This, IN UINT64 Flags, IN EFI_PHYSICAL_ADDRESS DataToHash, IN UINT64 DataToHashLen, IN EFI_TCG2_EVENT *Event)
UINTN GetPcrEvent2Size(IN TCG_PCR_EVENT2 *TcgPcrEvent2)
EFI_STATUS MeasureAllSecureVariables(VOID)
VOID InternalDumpHex(IN UINT8 *Data, IN UINTN Size)
EFI_STATUS EFIAPI Tcg2GetActivePCRBanks(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *ActivePcrBanks)
EFI_STATUS ReadAndMeasureVariable(IN TPM_PCRINDEX PCRIndex, IN TCG_EVENTTYPE EventType, IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
VOID DumpTcgEfiSpecIdEventStruct(IN TCG_EfiSpecIDEventStruct *TcgEfiSpecIdEventStruct)
BOOLEAN Is800155Event(IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize)
VOID EFIAPI ShutdownTpmOnReset(IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL)
EFI_STATUS GetProcessorsCpuLocation(OUT EFI_CPU_PHYSICAL_LOCATION **LocationBuf, OUT UINTN *Num)
EFI_STATUS TcgDxeHashLogExtendEvent(IN UINT64 Flags, IN UINT8 *HashData, IN UINT64 HashDataLen, IN OUT TCG_PCR_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
EFI_STATUS MeasurePeImageAndExtend(IN UINT32 PCRIndex, IN EFI_PHYSICAL_ADDRESS ImageAddress, IN UINTN ImageSize, OUT TPML_DIGEST_VALUES *DigestList)
VOID EFIAPI MeasureSecureBootPolicy(IN EFI_EVENT Event, IN VOID *Context)
UINT32 GetDigestListBinSize(IN VOID *DigestListBin)
EFI_STATUS MeasureVariable(IN TPM_PCRINDEX PCRIndex, IN TCG_EVENTTYPE EventType, IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, IN VOID *VarData, IN UINTN VarSize)
VOID EFIAPI OnReadyToBoot(IN EFI_EVENT Event, IN VOID *Context)
VOID InitNoActionEvent(IN OUT TCG_PCR_EVENT2_HDR *NoActionEvent, IN UINT32 EventSize)
EFI_STATUS EFIAPI Tcg2GetCapability(IN EFI_TCG2_PROTOCOL *This, IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability)
EFI_STATUS EFIAPI Tcg2SubmitCommand(IN EFI_TCG2_PROTOCOL *This, IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN UINT32 OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
VOID DumpEventLog(IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat, IN EFI_PHYSICAL_ADDRESS EventLogLocation, IN EFI_PHYSICAL_ADDRESS EventLogLastEntry, IN EFI_TCG2_FINAL_EVENTS_TABLE *FinalEventsTable)
EFI_STATUS TcgCommLogEvent(IN OUT TCG_EVENT_LOG_AREA_STRUCT *EventLogAreaStruct, IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize)
EFI_STATUS MeasureSeparatorEvent(IN TPM_PCRINDEX PCRIndex)
VOID EFIAPI OnExitBootServices(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI Tcg2GetEventLog(IN EFI_TCG2_PROTOCOL *This, IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat, OUT EFI_PHYSICAL_ADDRESS *EventLogLocation, OUT EFI_PHYSICAL_ADDRESS *EventLogLastEntry, OUT BOOLEAN *EventLogTruncated)
EFI_STATUS EFIAPI Tcg2GetResultOfSetActivePcrBanks(IN EFI_TCG2_PROTOCOL *This, OUT UINT32 *OperationPresent, OUT UINT32 *Response)
VOID DumpEvent2(IN TCG_PCR_EVENT2 *TcgPcrEvent2)
VOID DumpEvent(IN TCG_PCR_EVENT_HDR *EventHdr)
EFI_STATUS ReadAndMeasureBootVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
VOID EFIAPI OnResetNotificationInstall(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS TcgDxeLogEvent(IN EFI_TCG2_EVENT_LOG_FORMAT EventLogFormat, IN VOID *NewEventHdr, IN UINT32 NewEventHdrSize, IN UINT8 *NewEventData, IN UINT32 NewEventSize)
EFI_STATUS MeasureHandoffTables(VOID)
EFI_STATUS ReadAndMeasureSecureVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
EFI_STATUS TcgDxeLogHashEvent(IN TPML_DIGEST_VALUES *DigestList, IN OUT TCG_PCR_EVENT_HDR *NewEventHdr, IN UINT8 *NewEventData)
EFI_STATUS MeasureAllBootVariables(VOID)
EFI_STATUS EFIAPI DriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS InstallTcg2(VOID)
UINT32 GetHashMaskFromAlgo(IN TPMI_ALG_HASH HashAlgo)
VOID * CopyDigestListToBuffer(IN OUT VOID *Buffer, IN TPML_DIGEST_VALUES *DigestList, IN UINT32 HashAlgorithmMask)
UINT16 GetHashSizeFromAlgo(IN TPMI_ALG_HASH HashAlgo)
BOOLEAN EFIAPI IsHashAlgSupportedInHashAlgorithmMask(IN TPMI_ALG_HASH HashAlg, IN UINT32 HashAlgorithmMask)
EFI_STATUS EFIAPI Tpm2GetCapabilitySupportedAndActivePcrs(OUT UINT32 *TpmHashAlgorithmBitmap, OUT UINT32 *ActivePcrBanks)
EFI_STATUS EFIAPI Tpm2GetCapabilityFirmwareVersion(OUT UINT32 *FirmwareVersion1, OUT UINT32 *FirmwareVersion2)
EFI_STATUS EFIAPI Tpm2GetCapabilityMaxCommandResponseSize(OUT UINT32 *MaxCommandSize, OUT UINT32 *MaxResponseSize)
EFI_STATUS EFIAPI Tpm2GetCapabilityManufactureID(OUT UINT32 *ManufactureId)
EFI_STATUS EFIAPI Tpm2Shutdown(IN TPM_SU ShutdownType)
EFI_STATUS EFIAPI GetDigestFromDigestList(IN TPMI_ALG_HASH HashAlg, IN TPML_DIGEST_VALUES *DigestList, OUT VOID *Digest)
EFI_STATUS EFIAPI Tpm2SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock)
EFI_STATUS EFIAPI Tpm2RequestUseTpm(VOID)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
EFI_STATUS EFIAPI GetVariable2(IN CONST CHAR16 *Name, IN CONST EFI_GUID *Guid, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
EFI_STATUS EFIAPI EfiCreateEventReadyToBootEx(IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *ReadyToBootEvent)
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
EFI_CPU_PHYSICAL_LOCATION Location
INT8 VariableData[1]
Driver or platform-specific data.