]> git.proxmox.com Git - mirror_edk2.git/commitdiff
SecurityPkg Tcg2ConfigDxe: Add setup option to configure PPI version
authorStar Zeng <star.zeng@intel.com>
Fri, 9 Dec 2016 07:53:22 +0000 (15:53 +0800)
committerStar Zeng <star.zeng@intel.com>
Fri, 6 Jan 2017 10:06:37 +0000 (18:06 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=288

gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer was
introduced to configure physical presence interface version. but test
or user needs to build different images to support different versions
separately as the PCD does not support Dynamic types.

This patch is to extend the PCD to support Dynamic types and add a
setup option in Tcg2ConfigDxe driver to configure the physical
presence interface version, the PCD needs to be DynamicHii type and
maps to the setup option.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
SecurityPkg/SecurityPkg.dec
SecurityPkg/SecurityPkg.dsc
SecurityPkg/SecurityPkg.uni
SecurityPkg/Tcg/Tcg2Config/Tcg2Config.vfr
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDxe.inf
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigImpl.c
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigNvData.h
SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigStrings.uni
SecurityPkg/Tcg/Tcg2Smm/Tcg2Smm.c

index cabb956f1e26db4c6494186c003e59466959e4dc..feeaf60c43f49c644361dd4b620d115544d9384d 100644 (file)
@@ -5,7 +5,7 @@
 #  It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and library classes)\r
 #  and libraries instances, which are used for those features.\r
 #\r
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2015 Hewlett Packard Enterprise Development LP <BR>\r
 # This program and the accompanying materials are licensed and made available under\r
 # the terms and conditions of the BSD License which accompanies this distribution.\r
   # @ValidList  0x80000003 | 0x010D0000\r
   gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice|0x010D0000|UINT32|0x00000007\r
 \r
-  ## Null-terminated string of the Version of Physical Presence interface supported by platform.\r
-  # @Prompt Version of Physical Presence interface supported by platform.\r
-  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|"1.3"|VOID*|0x00000008\r
-\r
 [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]\r
   ## Indicates the presence or absence of the platform operator during firmware booting.\r
   #  If platform operator is not physical presence during boot. TPM will be locked and the TPM commands \r
   # @Prompt Length(in bytes) of the TCG2 Final event log area.\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2FinalLogAreaLen|0x8000|UINT32|0x00010018\r
 \r
+  ## Null-terminated string of the Version of Physical Presence interface supported by platform.<BR><BR>\r
+  # To support configuring from setup page, this PCD can be DynamicHii type and map to a setup option.<BR>\r
+  # For example, map to TCG2_VERSION.PpiVersion to be configured by Tcg2ConfigDxe driver.<BR>\r
+  # gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS<BR>\r
+  # @Prompt Version of Physical Presence interface supported by platform.\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|"1.3"|VOID*|0x00000008\r
+\r
   ## Indicate whether a physical presence user exist.\r
   # When it is configured to Dynamic or DynamicEx, it can be set through detection using \r
   # a platform-specific method (e.g. Button pressed) in a actual platform in early boot phase.<BR><BR>\r
index e5cce218f35c71e63669d0b0dda29ff6495f4834..0d397416620c14a7570a1e295e526bb51d96ec7f 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 #  Security Module Package for All Architectures.\r
 #\r
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>\r
 # (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTpm2HashMask|3\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2HashAlgorithmBitmap|3\r
 \r
+[PcdsDynamicHii.common.DEFAULT]\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L"TCG2_VERSION"|gTcg2ConfigFormSetGuid|0x0|"1.3"|NV,BS\r
+\r
 [Components]\r
   SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.inf\r
   #SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.inf\r
index 9e08e3125e118675d7e189975d0e7c6ab05e08e6..815bf0bac553dbc23385800d2a944061c9fd372d 100644 (file)
 \r
 #string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcgPhysicalPresenceInterfaceVer_PROMPT  #language en-US "Version of Physical Presence interface supported by platform."\r
 \r
-#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcgPhysicalPresenceInterfaceVer_HELP  #language en-US "Null-terminated string of the Version of Physical Presence interface supported by platform."\r
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdTcgPhysicalPresenceInterfaceVer_HELP  #language en-US "Null-terminated string of the Version of Physical Presence interface supported by platform.<BR><BR>\n"\r
+                                                                                                   "To support configuring from setup page, this PCD can be DynamicHii type and map to a setup option.<BR>\n"\r
+                                                                                                   "For example, map to TCG2_VERSION.PpiVersion to be configured by Tcg2ConfigDxe driver.<BR>\n"\r
+                                                                                                   "gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer|L\"TCG2_VERSION\"|gTcg2ConfigFormSetGuid|0x0|\"1.3\"|NV,BS<BR>"\r
 \r
 #string STR_gEfiSecurityPkgTokenSpaceGuid_PcdUserPhysicalPresence_PROMPT\r
 #language en-US\r
index f56d0f32857d6452203ee59857e4b18e7959140a..a1167137f2cc861e36b344267cf42103a2c98cfb 100644 (file)
@@ -32,6 +32,12 @@ formset
     name  = TCG2_CONFIGURATION,\r
     guid  = TCG2_CONFIG_FORM_SET_GUID;\r
 \r
+  efivarstore TCG2_VERSION,\r
+    varid = TCG2_VERSION_VARSTORE_ID,\r
+    attribute = 0x03,  // EFI variable attribures  EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE\r
+    name  = TCG2_VERSION,\r
+    guid  = TCG2_CONFIG_FORM_SET_GUID;\r
+\r
   form formid = TCG2_CONFIGURATION_FORM_ID,\r
     title = STRING_TOKEN(STR_TCG2_TITLE);\r
 \r
@@ -104,6 +110,20 @@ formset
     subtitle text = STRING_TOKEN(STR_NULL);\r
     subtitle text = STRING_TOKEN(STR_TCG2_PP_OPERATION);\r
 \r
+    text\r
+      help   = STRING_TOKEN(STR_TCG2_PPI_VERSION_STATE_HELP),\r
+      text   = STRING_TOKEN(STR_TCG2_PPI_VERSION_STATE_PROMPT),\r
+        text   = STRING_TOKEN(STR_TCG2_PPI_VERSION_STATE_CONTENT);\r
+\r
+    oneof varid  = TCG2_VERSION.PpiVersion,\r
+          questionid = KEY_TCG2_PPI_VERSION,\r
+          prompt = STRING_TOKEN(STR_TCG2_PPI_VERSION_PROMPT),\r
+          help   = STRING_TOKEN(STR_TCG2_PPI_VERSION_HELP),\r
+          flags  = INTERACTIVE,\r
+            option text = STRING_TOKEN(STR_TCG2_PPI_VERSION_1_2), value = TCG2_PPI_VERSION_1_2, flags = RESET_REQUIRED;\r
+            option text = STRING_TOKEN(STR_TCG2_PPI_VERSION_1_3), value = TCG2_PPI_VERSION_1_3, flags = DEFAULT | MANUFACTURING | RESET_REQUIRED;\r
+    endoneof;\r
+\r
     oneof name = Tpm2Operation,\r
           questionid = KEY_TPM2_OPERATION,\r
           prompt = STRING_TOKEN(STR_TCG2_OPERATION),\r
index 968670f04d5122d4412348bf5ce6dfc5c8bdcc78..ad7cd54e6cb0c7c49c740e5319065bf92aec5d35 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The module entry point for Tcg2 configuration module.\r
 \r
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, 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
@@ -60,6 +60,154 @@ UpdateDefaultPCRBanks (
   return ;\r
 }\r
 \r
+/**\r
+  Initialize TCG2 version information.\r
+\r
+  This function will initialize efi varstore configuration data for\r
+  TCG2_VERSION_NAME variable, check the value of related PCD with\r
+  the variable value and set string for the version state content\r
+  according to the PCD value.\r
+\r
+  @param[in] PrivateData    Points to TCG2 configuration private data.\r
+\r
+**/\r
+VOID\r
+InitializeTcg2VersionInfo (\r
+  IN TCG2_CONFIG_PRIVATE_DATA   *PrivateData\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_STRING                    ConfigRequestHdr;\r
+  BOOLEAN                       ActionFlag;\r
+  TCG2_VERSION                  Tcg2Version;\r
+  UINTN                         DataSize;\r
+  UINT64                        PcdTcg2PpiVersion;\r
+\r
+  //\r
+  // Get the PCD value before initializing efi varstore configuration data.\r
+  //\r
+  PcdTcg2PpiVersion = 0;\r
+  CopyMem (\r
+    &PcdTcg2PpiVersion,\r
+    PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer),\r
+    AsciiStrSize (PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))\r
+    );\r
+\r
+  //\r
+  // Initialize efi varstore configuration data.\r
+  //\r
+  ZeroMem (&Tcg2Version, sizeof (Tcg2Version));\r
+  ConfigRequestHdr = HiiConstructConfigHdr (\r
+                       &gTcg2ConfigFormSetGuid,\r
+                       TCG2_VERSION_NAME,\r
+                       PrivateData->DriverHandle\r
+                       );\r
+  ASSERT (ConfigRequestHdr != NULL);\r
+  DataSize = sizeof (Tcg2Version);\r
+  Status = gRT->GetVariable (\r
+                  TCG2_VERSION_NAME,\r
+                  &gTcg2ConfigFormSetGuid,\r
+                  NULL,\r
+                  &DataSize,\r
+                  &Tcg2Version\r
+                  );\r
+  if (!EFI_ERROR (Status)) {\r
+    //\r
+    // EFI variable does exist and validate current setting.\r
+    //\r
+    ActionFlag = HiiValidateSettings (ConfigRequestHdr);\r
+    if (!ActionFlag) {\r
+      //\r
+      // Current configuration is invalid, reset to defaults.\r
+      //\r
+      ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);\r
+      ASSERT (ActionFlag);\r
+      //\r
+      // Get the default values from variable.\r
+      //\r
+      DataSize = sizeof (Tcg2Version);\r
+      Status = gRT->GetVariable (\r
+                      TCG2_VERSION_NAME,\r
+                      &gTcg2ConfigFormSetGuid,\r
+                      NULL,\r
+                      &DataSize,\r
+                      &Tcg2Version\r
+                      );\r
+      ASSERT_EFI_ERROR (Status);\r
+    }\r
+  } else {\r
+    //\r
+    // EFI variable doesn't exist.\r
+    //\r
+\r
+    //\r
+    // Store zero data Buffer Storage to EFI variable.\r
+    //\r
+    Status = gRT->SetVariable (\r
+                    TCG2_VERSION_NAME,\r
+                    &gTcg2ConfigFormSetGuid,\r
+                    EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+                    sizeof (Tcg2Version),\r
+                    &Tcg2Version\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((DEBUG_ERROR, "Tcg2ConfigDriver: Fail to set TCG2_VERSION_NAME\n"));\r
+      return;\r
+    } else {\r
+      //\r
+      // Build this variable based on default values stored in IFR.\r
+      //\r
+      ActionFlag = HiiSetToDefaults (ConfigRequestHdr, EFI_HII_DEFAULT_CLASS_STANDARD);\r
+      ASSERT (ActionFlag);\r
+      //\r
+      // Get the default values from variable.\r
+      //\r
+      DataSize = sizeof (Tcg2Version);\r
+      Status = gRT->GetVariable (\r
+                      TCG2_VERSION_NAME,\r
+                      &gTcg2ConfigFormSetGuid,\r
+                      NULL,\r
+                      &DataSize,\r
+                      &Tcg2Version\r
+                      );\r
+      ASSERT_EFI_ERROR (Status);\r
+      if (PcdTcg2PpiVersion != Tcg2Version.PpiVersion) {\r
+        DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer default value is not same with the default value in VFR\n"));\r
+        DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n"));\r
+      }\r
+    }\r
+  }\r
+  FreePool (ConfigRequestHdr);\r
+\r
+  //\r
+  // Get the PCD value again.\r
+  // If the PCD value is not equal to the value in variable,\r
+  // the PCD is not DynamicHii type and maps to the setup option.\r
+  //\r
+  PcdTcg2PpiVersion = 0;\r
+  CopyMem (\r
+    &PcdTcg2PpiVersion,\r
+    PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer),\r
+    AsciiStrSize (PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))\r
+    );\r
+  if (PcdTcg2PpiVersion != Tcg2Version.PpiVersion) {\r
+    DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and maps to TCG2_VERSION.PpiVersion\n"));\r
+    DEBUG ((DEBUG_WARN, "WARNING: The TCG2 PPI version configuring from setup page will not work\n"));\r
+  }\r
+\r
+  switch (PcdTcg2PpiVersion) {\r
+    case TCG2_PPI_VERSION_1_2:\r
+      HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_PPI_VERSION_STATE_CONTENT), L"1.2", NULL);\r
+      break;\r
+    case TCG2_PPI_VERSION_1_3:\r
+      HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TCG2_PPI_VERSION_STATE_CONTENT), L"1.3", NULL);\r
+      break;\r
+    default:\r
+      ASSERT (FALSE);\r
+      break;\r
+  }\r
+}\r
+\r
 /**\r
   The entry point for Tcg2 configuration driver.\r
 \r
@@ -229,6 +377,8 @@ Tcg2ConfigDriverEntryPoint (
     goto ErrorExit;\r
   }\r
 \r
+  InitializeTcg2VersionInfo (PrivateData);\r
+\r
   return EFI_SUCCESS;\r
 \r
 ErrorExit:\r
index d9340d6f53a5a300ca7f219240e486f033720e1f..9f21aabf44606d89e93350a6d24ff8721678e905 100644 (file)
@@ -4,7 +4,7 @@
 #  By this module, user may select TPM device, clear TPM state, etc.\r
 #  NOTE: This module is only for reference only, each platform should have its own setup page.\r
 #\r
-# Copyright (c) 2015 - 2106, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2017, 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
@@ -77,6 +77,7 @@
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid            ## CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTcg2HashAlgorithmBitmap    ## CONSUMES\r
   gEfiSecurityPkgTokenSpaceGuid.PcdTpmBaseAddress             ## CONSUMES\r
+  gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer  ## CONSUMES\r
 \r
 [Depex]\r
   gEfiTcg2ProtocolGuid              AND\r
index a45f5cb740e47acbc709b7bbe929039202cdaffa..ecd7ab981a3d126f465de3c3dcef3ff12b80fee9 100644 (file)
@@ -455,6 +455,62 @@ GetTpm2HID(
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  This function processes the results of changes in configuration\r
+  for TCG2 version information.\r
+\r
+  @param[in] Action             Specifies the type of action taken by the browser.\r
+                                ASSERT if the Action is not EFI_BROWSER_ACTION_SUBMITTED.\r
+  @param[in] QuestionId         A unique value which is sent to the original\r
+                                exporting driver so that it can identify the type\r
+                                of data to expect.\r
+  @param[in] Type               The type of value for the question.\r
+  @param[in] Value              A pointer to the data being sent to the original\r
+                                exporting driver.\r
+\r
+  @retval EFI_SUCCESS           The callback successfully handled the action.\r
+\r
+**/\r
+EFI_STATUS\r
+Tcg2VersionInfoCallback (\r
+  IN EFI_BROWSER_ACTION         Action,\r
+  IN EFI_QUESTION_ID            QuestionId,\r
+  IN UINT8                      Type,\r
+  IN EFI_IFR_TYPE_VALUE         *Value\r
+  )\r
+{\r
+  EFI_INPUT_KEY                 Key;\r
+  UINT64                        PcdTcg2PpiVersion;\r
+\r
+  ASSERT (Action == EFI_BROWSER_ACTION_SUBMITTED);\r
+\r
+  if (QuestionId == KEY_TCG2_PPI_VERSION) {\r
+    //\r
+    // Get the PCD value after EFI_BROWSER_ACTION_SUBMITTED,\r
+    // the SetVariable to TCG2_VERSION_NAME should have been done.\r
+    // If the PCD value is not equal to the value set to variable,\r
+    // the PCD is not DynamicHii type and maps to the setup option.\r
+    //\r
+    PcdTcg2PpiVersion = 0;\r
+    CopyMem (\r
+      &PcdTcg2PpiVersion,\r
+      PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer),\r
+      AsciiStrSize (PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer))\r
+      );\r
+    if (PcdTcg2PpiVersion != Value->u64) {\r
+      CreatePopUp (\r
+        EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,\r
+        &Key,\r
+        L"WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and maps to this option!",\r
+        L"The version configuring by this setup option will not work!",\r
+        NULL\r
+        );\r
+    }\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
 /**\r
   This function processes the results of changes in configuration.\r
 \r
@@ -546,7 +602,13 @@ Tcg2Callback (
       return SaveTcg2PpRequestParameter (Value->u32);\r
     }\r
     if ((QuestionId >= KEY_TPM2_PCR_BANKS_REQUEST_0) && (QuestionId <= KEY_TPM2_PCR_BANKS_REQUEST_4)) {\r
-      SaveTcg2PCRBanksRequest (QuestionId - KEY_TPM2_PCR_BANKS_REQUEST_0, Value->b);\r
+      return SaveTcg2PCRBanksRequest (QuestionId - KEY_TPM2_PCR_BANKS_REQUEST_0, Value->b);\r
+    }\r
+  }\r
+\r
+  if (Action == EFI_BROWSER_ACTION_SUBMITTED) {\r
+    if (QuestionId == KEY_TCG2_PPI_VERSION) {\r
+      return Tcg2VersionInfoCallback (Action, QuestionId, Type, Value);\r
     }\r
   }\r
 \r
index 20eaa508fad238c19c35bffff63539a053174892..7868c212d57016defd961d30a2c87ccd8b2f865b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for NV data structure definition.\r
 \r
-Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2015 - 2017, 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
@@ -30,6 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #define TCG2_CONFIGURATION_VARSTORE_ID  0x0001\r
 #define TCG2_CONFIGURATION_INFO_VARSTORE_ID  0x0002\r
+#define TCG2_VERSION_VARSTORE_ID        0x0003\r
 #define TCG2_CONFIGURATION_FORM_ID      0x0001\r
 \r
 #define KEY_TPM_DEVICE                                 0x2000\r
@@ -41,6 +42,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define KEY_TPM2_PCR_BANKS_REQUEST_3            0x2006\r
 #define KEY_TPM2_PCR_BANKS_REQUEST_4            0x2007\r
 #define KEY_TPM_DEVICE_INTERFACE                       0x2008\r
+#define KEY_TCG2_PPI_VERSION                    0x2009\r
 \r
 #define TPM_DEVICE_NULL           0\r
 #define TPM_DEVICE_1_2            1\r
@@ -58,6 +60,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define TCG2_PROTOCOL_VERSION_DEFAULT        0x0001\r
 #define EFI_TCG2_EVENT_LOG_FORMAT_DEFAULT    EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2\r
 \r
+#define TCG2_PPI_VERSION_1_2                    0x322E31  // "1.2"\r
+#define TCG2_PPI_VERSION_1_3                    0x332E31  // "1.3" \r
+\r
 //\r
 // Nv Data structure referenced by IFR, TPM device user desired\r
 //\r
@@ -65,6 +70,10 @@ typedef struct {
   UINT8   TpmDevice;\r
 } TCG2_CONFIGURATION;\r
 \r
+typedef struct {\r
+  UINT64  PpiVersion;\r
+} TCG2_VERSION;\r
+\r
 typedef struct {\r
   BOOLEAN  Sha1Supported;\r
   BOOLEAN  Sha256Supported;\r
@@ -87,6 +96,7 @@ typedef struct {
 #define TCG2_STORAGE_NAME           L"TCG2_CONFIGURATION"\r
 #define TCG2_STORAGE_INFO_NAME      L"TCG2_CONFIGURATION_INFO"\r
 #define TCG2_DEVICE_DETECTION_NAME  L"TCG2_DEVICE_DETECTION"\r
+#define TCG2_VERSION_NAME           L"TCG2_VERSION"\r
 \r
 #define TPM_INSTANCE_ID_LIST  { \\r
   {TPM_DEVICE_INTERFACE_NONE,           TPM_DEVICE_NULL},      \\r
index 3a0a14224df06f769cc9f888a6cf1a97faaa542a..414dcec5c20347c61fb132a472dbb81b8f81bd2b 100644 (file)
@@ -25,6 +25,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #string STR_TCG2_DEVICE_HELP                #language en-US "Attempt TPM Device: TPM1.2, or TPM2.0"\r
 #string STR_TCG2_DEVICE_CONTENT             #language en-US ""\r
 \r
+#string STR_TCG2_PPI_VERSION_STATE_PROMPT   #language en-US "Current PPI Version"\r
+#string STR_TCG2_PPI_VERSION_STATE_HELP     #language en-US "Current PPI Version: 1.2 or 1.3"\r
+#string STR_TCG2_PPI_VERSION_STATE_CONTENT  #language en-US ""\r
+\r
+#string STR_TCG2_PPI_VERSION_PROMPT         #language en-US "Attempt PPI Version"\r
+#string STR_TCG2_PPI_VERSION_HELP           #language en-US "Attempt PPI Version: 1.2 or 1.3\n"\r
+                                                            "PcdTcgPhysicalPresenceInterfaceVer needs to be DynamicHii type and map to this option\n"\r
+                                                            "Otherwise the version configuring by this setup option will not work"\r
+\r
 #string STR_TPM2_ACPI_HID_PROMPT                  #language en-US "HID from TPM2 ACPI Table"\r
 #string STR_TPM2_ACPI_HID_HELP                    #language en-US "HID from TPM2 ACPI Table: ManufacturerID + FirmwareVersion_1"\r
 #string STR_TPM2_ACPI_HID_CONTENT                 #language en-US ""\r
@@ -65,6 +74,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #string STR_TCG2_TPM_1_2                   #language en-US "TPM 1.2"\r
 #string STR_TCG2_TPM_2_0_DTPM              #language en-US "TPM 2.0"\r
 \r
+#string STR_TCG2_PPI_VERSION_1_2           #language en-US "1.2"\r
+#string STR_TCG2_PPI_VERSION_1_3           #language en-US "1.3"\r
+\r
 #string STR_TPM2_ACTIVE_HASH_ALGO                 #language en-US "TPM2 Active PCR Hash Algorithm"\r
 #string STR_TPM2_ACTIVE_HASH_ALGO_HELP            #language en-US "TPM2 Active PCR Hash Algorithm: SHA1, SHA256, SHA384, SHA512, SM3_256"\r
 #string STR_TPM2_ACTIVE_HASH_ALGO_CONTENT         #language en-US ""\r
index 3ca6958a6eb313dc9616600c1dc3a2b6f79bf248..7557e29852c5287333ee3603963954f4b6a6887f 100644 (file)
@@ -439,6 +439,12 @@ PublishAcpiTable (
   Status = UpdatePPVersion(Table, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer));\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  DEBUG ((\r
+    DEBUG_INFO,\r
+    "Current physical presence interface version - %a\n",\r
+    (CHAR8 *) PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer)\r
+    ));\r
+\r
   //\r
   // Update TPM2 HID before measuring it to PCR\r
   //\r