]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
SecurityPkg/Tcg2: Add Support Laml, Lasa for TPM2 ACPI.
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Dxe / Tcg2Dxe.c
index a2729457b72c0f68c2f6a468f3df7b3ecabb6476..85f2e0ae3809efd6ba412061b18db619aca7f997 100644 (file)
@@ -1467,17 +1467,37 @@ SetupEventLog (
   for (Index = 0; Index < sizeof(mTcg2EventInfo)/sizeof(mTcg2EventInfo[0]); Index++) {\r
     if ((mTcgDxeData.BsCap.SupportedEventLogs & mTcg2EventInfo[Index].LogFormat) != 0) {\r
       mTcgDxeData.EventLogAreaStruct[Index].EventLogFormat = mTcg2EventInfo[Index].LogFormat;\r
-      Status = gBS->AllocatePages (\r
-                      AllocateAnyPages,\r
-                      EfiBootServicesData,\r
-                      EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
-                      &Lasa\r
-                      );\r
+      if (PcdGet8(PcdTpm2AcpiTableRev) >= 4) {\r
+        Status = gBS->AllocatePages (\r
+                        AllocateAnyPages,\r
+                        EfiACPIMemoryNVS,\r
+                        EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
+                        &Lasa\r
+                        );\r
+      } else {\r
+        Status = gBS->AllocatePages (\r
+                        AllocateAnyPages,\r
+                        EfiBootServicesData,\r
+                        EFI_SIZE_TO_PAGES (PcdGet32 (PcdTcgLogAreaMinLen)),\r
+                        &Lasa\r
+                        );\r
+      }\r
       if (EFI_ERROR (Status)) {\r
         return Status;\r
       }\r
       mTcgDxeData.EventLogAreaStruct[Index].Lasa = Lasa;\r
       mTcgDxeData.EventLogAreaStruct[Index].Laml = PcdGet32 (PcdTcgLogAreaMinLen);\r
+\r
+      if ((PcdGet8(PcdTpm2AcpiTableRev) >= 4) ||\r
+          (mTcg2EventInfo[Index].LogFormat == EFI_TCG2_EVENT_LOG_FORMAT_TCG_2)) {\r
+        //\r
+        // Report TCG2 event log address and length, so that they can be reported in TPM2 ACPI table.\r
+        // Ignore the return status, because those fields are optional.\r
+        //\r
+        PcdSet32S(PcdTpm2AcpiTableLaml, (UINT32)mTcgDxeData.EventLogAreaStruct[Index].Laml);\r
+        PcdSet64S(PcdTpm2AcpiTableLasa, mTcgDxeData.EventLogAreaStruct[Index].Lasa);\r
+      }\r
+\r
       //\r
       // To initialize them as 0xFF is recommended\r
       // because the OS can know the last entry for that.\r