public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: devel@edk2.groups.io
Cc: Jian J Wang <jian.j.wang@intel.com>,
	Hao A Wu <hao.a.wu@intel.com>, Dandan Bi <dandan.bi@intel.com>,
	Star Zeng <star.zeng@intel.com>
Subject: [PATCH 5/6] MdeModulePkg/Smbios: Add TCG PFP rev 105 support.
Date: Tue, 31 Dec 2019 14:44:11 +0800	[thread overview]
Message-ID: <20191231064412.22988-6-jiewen.yao@intel.com> (raw)
In-Reply-To: <20191231064412.22988-1-jiewen.yao@intel.com>

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2439

Report EV_EFI_HANDOFF_TABLES2 if the platform chooses PFP >= 105.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 .../SmbiosMeasurementDxe.c                    | 35 +++++++++++++++++--
 .../SmbiosMeasurementDxe.inf                  |  3 ++
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c
index 5ec2aca095..a5839c09f1 100644
--- a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c
+++ b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.c
@@ -108,6 +108,18 @@ SMBIOS_FILTER_STRUCT  mSmbiosFilterStandardTableBlackList[] = {
 EFI_SMBIOS_PROTOCOL *mSmbios;
 UINTN               mMaxLen;
 
+#pragma pack (1)
+
+#define SMBIOS_HANDOFF_TABLE_DESC  "SmbiosTable"
+typedef struct {
+  UINT8                             TableDescriptionSize;
+  UINT8                             TableDescription[sizeof(SMBIOS_HANDOFF_TABLE_DESC)];
+  UINT64                            NumberOfTables;
+  EFI_CONFIGURATION_TABLE           TableEntry[1];
+} SMBIOS_HANDOFF_TABLE_POINTERS2;
+
+#pragma pack ()
+
 /**
 
   This function dump raw data.
@@ -460,6 +472,10 @@ MeasureSmbiosTable (
 {
   EFI_STATUS                        Status;
   EFI_HANDOFF_TABLE_POINTERS        HandoffTables;
+  SMBIOS_HANDOFF_TABLE_POINTERS2    SmbiosHandoffTables2;
+  UINT32                            EventType;
+  VOID                              *EventLog;
+  UINT32                            EventLogSize;
   SMBIOS_TABLE_ENTRY_POINT          *SmbiosTable;
   SMBIOS_TABLE_3_0_ENTRY_POINT      *Smbios3Table;
   VOID                              *SmbiosTableAddress;
@@ -569,11 +585,24 @@ MeasureSmbiosTable (
       CopyGuid (&(HandoffTables.TableEntry[0].VendorGuid), &gEfiSmbiosTableGuid);
       HandoffTables.TableEntry[0].VendorTable = SmbiosTable;
     }
+    EventType = EV_EFI_HANDOFF_TABLES;
+    EventLog = &HandoffTables;
+    EventLogSize = sizeof (HandoffTables);
+
+    if (PcdGet32(PcdTcgPfpMeasurementRevision) >= TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_105) {
+      SmbiosHandoffTables2.TableDescriptionSize = sizeof(SmbiosHandoffTables2.TableDescription);
+      CopyMem (SmbiosHandoffTables2.TableDescription, SMBIOS_HANDOFF_TABLE_DESC, sizeof(SmbiosHandoffTables2.TableDescription));
+      SmbiosHandoffTables2.NumberOfTables = HandoffTables.NumberOfTables;
+      CopyMem (&(SmbiosHandoffTables2.TableEntry[0]), &(HandoffTables.TableEntry[0]), sizeof(SmbiosHandoffTables2.TableEntry[0]));
+      EventType = EV_EFI_HANDOFF_TABLES2;
+      EventLog = &SmbiosHandoffTables2;
+      EventLogSize = sizeof (SmbiosHandoffTables2);
+    }
     Status = TpmMeasureAndLogData (
                1,                       // PCRIndex
-               EV_EFI_HANDOFF_TABLES,   // EventType
-               &HandoffTables,          // EventLog
-               sizeof (HandoffTables),  // LogLen
+               EventType,               // EventType
+               EventLog,                // EventLog
+               EventLogSize,            // LogLen
                TableAddress,            // HashData
                TableLength              // HashDataLen
                );
diff --git a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf
index a074044c84..81d3655dc7 100644
--- a/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf
+++ b/MdeModulePkg/Universal/SmbiosMeasurementDxe/SmbiosMeasurementDxe.inf
@@ -57,6 +57,9 @@
   gEfiSmbiosTableGuid                               ## SOMETIMES_CONSUMES ## SystemTable
   gEfiSmbios3TableGuid                              ## SOMETIMES_CONSUMES ## SystemTable
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdTcgPfpMeasurementRevision            ## CONSUMES
+
 [Depex]
   gEfiSmbiosProtocolGuid
 
-- 
2.19.2.windows.1


  parent reply	other threads:[~2019-12-31  6:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-31  6:44 [PATCH 0/6] TCG: Add TCG PFP rev 105 and 800-155 event support Yao, Jiewen
2019-12-31  6:44 ` [PATCH 1/6] SecurityPkg/Guid: Add TCG 800-155 event GUID definition Yao, Jiewen
2020-01-06  3:22   ` Wang, Jian J
2019-12-31  6:44 ` [PATCH 2/6] SecurityPkg/Tcg2Dxe: Add Tcg2Dxe to support 800-155 event Yao, Jiewen
2020-01-06  5:59   ` [edk2-devel] " Wang, Jian J
2019-12-31  6:44 ` [PATCH 3/6] MdeModulePkg/Smbios: Done measure Smbios multiple times Yao, Jiewen
2020-01-02 11:01   ` Zeng, Star
2019-12-31  6:44 ` [PATCH 4/6] MdeModulePkg/dec: add PcdTcgPfpMeasurementRevision PCD Yao, Jiewen
2020-01-06  3:13   ` Wang, Jian J
2019-12-31  6:44 ` Yao, Jiewen [this message]
2020-01-02 11:09   ` [PATCH 5/6] MdeModulePkg/Smbios: Add TCG PFP rev 105 support Zeng, Star
2020-01-02 14:16     ` Yao, Jiewen
2020-01-03  0:54       ` Zeng, Star
2019-12-31  6:44 ` [PATCH 6/6] SecurityPkg/Tcg2Pei: Add TCG PFP " Yao, Jiewen
2020-01-06  5:33   ` Wang, Jian J
2020-01-06  5:53     ` Yao, Jiewen
2020-01-06  5:57       ` Wang, Jian J
2020-01-06  6:00         ` Yao, Jiewen
2020-01-02  0:11 ` [edk2-devel] [PATCH 0/6] TCG: Add TCG PFP rev 105 and 800-155 event support Liming Gao
2020-01-02  0:39   ` Yao, Jiewen
2020-01-06  6:11 ` Wang, Jian J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191231064412.22988-6-jiewen.yao@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox