]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/Library/DxeTcgPhysicalPresenceLib/DxeTcgPhysicalPresenceLib.c
SecurityPkg: Clean up source files
[mirror_edk2.git] / SecurityPkg / Library / DxeTcgPhysicalPresenceLib / DxeTcgPhysicalPresenceLib.c
index 4f35be80bb2d6589d84c9e018647c838848b3381..32e07000969349f518aed1516f8f63b351d87b1e 100644 (file)
@@ -8,13 +8,13 @@
 \r
   ExecutePendingTpmRequest() will receive untrusted input and do validation.\r
 \r
-Copyright (c) 2006 - 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
+Copyright (c) 2006 - 2018, 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
 http://opensource.org/licenses/bsd-license.php\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
@@ -60,10 +60,10 @@ PhysicalPresenceGetStringById (
 /**\r
   Get TPM physical presence permanent flags.\r
 \r
-  @param[in]  TcgProtocol   EFI TCG Protocol instance.  \r
-  @param[out] LifetimeLock  physicalPresenceLifetimeLock permanent flag.  \r
+  @param[in]  TcgProtocol   EFI TCG Protocol instance.\r
+  @param[out] LifetimeLock  physicalPresenceLifetimeLock permanent flag.\r
   @param[out] CmdEnable     physicalPresenceCMDEnable permanent flag.\r
-  \r
+\r
   @retval EFI_SUCCESS       Flags were returns successfully.\r
   @retval other             Failed to locate EFI TCG Protocol.\r
 \r
@@ -82,13 +82,13 @@ GetTpmCapability (
   UINT8                             SendBuffer[sizeof (*TpmRqu) + sizeof (UINT32) * 3];\r
   TPM_PERMANENT_FLAGS               *TpmPermanentFlags;\r
   UINT8                             RecvBuffer[40];\r
-  \r
+\r
   //\r
   // Fill request header\r
   //\r
   TpmRsp = (TPM_RSP_COMMAND_HDR*)RecvBuffer;\r
   TpmRqu = (TPM_RQU_COMMAND_HDR*)SendBuffer;\r
-  \r
+\r
   TpmRqu->tag       = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
   TpmRqu->paramSize = SwapBytes32 (sizeof (SendBuffer));\r
   TpmRqu->ordinal   = SwapBytes32 (TPM_ORD_GetCapability);\r
@@ -99,8 +99,8 @@ GetTpmCapability (
   SendBufPtr      = (UINT32*)(TpmRqu + 1);\r
   WriteUnaligned32 (SendBufPtr++, SwapBytes32 (TPM_CAP_FLAG));\r
   WriteUnaligned32 (SendBufPtr++, SwapBytes32 (sizeof (TPM_CAP_FLAG_PERMANENT)));\r
-  WriteUnaligned32 (SendBufPtr, SwapBytes32 (TPM_CAP_FLAG_PERMANENT));  \r
-  \r
+  WriteUnaligned32 (SendBufPtr, SwapBytes32 (TPM_CAP_FLAG_PERMANENT));\r
+\r
   Status = TcgProtocol->PassThroughToTpm (\r
                           TcgProtocol,\r
                           sizeof (SendBuffer),\r
@@ -111,9 +111,9 @@ GetTpmCapability (
   ASSERT_EFI_ERROR (Status);\r
   ASSERT (TpmRsp->tag == SwapBytes16 (TPM_TAG_RSP_COMMAND));\r
   ASSERT (TpmRsp->returnCode == 0);\r
-  \r
+\r
   TpmPermanentFlags = (TPM_PERMANENT_FLAGS *)&RecvBuffer[sizeof (TPM_RSP_COMMAND_HDR) + sizeof (UINT32)];\r
-  \r
+\r
   if (LifetimeLock != NULL) {\r
     *LifetimeLock = TpmPermanentFlags->physicalPresenceLifetimeLock;\r
   }\r
@@ -128,9 +128,9 @@ GetTpmCapability (
 /**\r
   Issue TSC_PhysicalPresence command to TPM.\r
 \r
-  @param[in] TcgProtocol          EFI TCG Protocol instance.  \r
-  @param[in] PhysicalPresence     The state to set the TPM's Physical Presence flags.  \r
-  \r
+  @param[in] TcgProtocol          EFI TCG Protocol instance.\r
+  @param[in] PhysicalPresence     The state to set the TPM's Physical Presence flags.\r
+\r
   @retval EFI_SUCCESS             TPM executed the command successfully.\r
   @retval EFI_SECURITY_VIOLATION  TPM returned error when executing the command.\r
   @retval other                   Failed to locate EFI TCG Protocol.\r
@@ -154,7 +154,7 @@ TpmPhysicalPresence (
   TpmRqu->tag       = SwapBytes16 (TPM_TAG_RQU_COMMAND);\r
   TpmRqu->paramSize = SwapBytes32 (sizeof (Buffer));\r
   TpmRqu->ordinal   = SwapBytes32 (TSC_ORD_PhysicalPresence);\r
-  WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence));  \r
+  WriteUnaligned16 (TpmPp, (TPM_PHYSICAL_PRESENCE) SwapBytes16 (PhysicalPresence));\r
 \r
   Status = TcgProtocol->PassThroughToTpm (\r
                           TcgProtocol,\r
@@ -171,19 +171,19 @@ TpmPhysicalPresence (
     //\r
     return EFI_SECURITY_VIOLATION;\r
   }\r
-  \r
+\r
   return Status;\r
 }\r
 \r
 /**\r
   Issue a TPM command for which no additional output data will be returned.\r
 \r
-  @param[in] TcgProtocol              EFI TCG Protocol instance.  \r
-  @param[in] Ordinal                  TPM command code.  \r
-  @param[in] AdditionalParameterSize  Additional parameter size.  \r
-  @param[in] AdditionalParameters     Pointer to the Additional paramaters.  \r
-  \r
-  @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE  Error occurred during sending command to TPM or \r
+  @param[in] TcgProtocol              EFI TCG Protocol instance.\r
+  @param[in] Ordinal                  TPM command code.\r
+  @param[in] AdditionalParameterSize  Additional parameter size.\r
+  @param[in] AdditionalParameters     Pointer to the Additional paramaters.\r
+\r
+  @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE  Error occurred during sending command to TPM or\r
                                                   receiving response from TPM.\r
   @retval Others                                  Return code from the TPM device after command execution.\r
 \r
@@ -232,9 +232,9 @@ TpmCommandNoReturnData (
   @param[in]      TcgProtocol         EFI TCG Protocol instance.\r
   @param[in]      CommandCode         Physical presence operation value.\r
   @param[in, out] PpiFlags            The physical presence interface flags.\r
-  \r
+\r
   @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE  Unknown physical presence operation.\r
-  @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE  Error occurred during sending command to TPM or \r
+  @retval TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE  Error occurred during sending command to TPM or\r
                                                   receiving response from TPM.\r
   @retval Others                                  Return code from the TPM device after command execution.\r
 \r
@@ -397,7 +397,7 @@ ExecutePhysicalPresence (
     case PHYSICAL_PRESENCE_SET_NO_PPI_MAINTENANCE_TRUE:\r
       PpiFlags->PPFlags |= TCG_BIOS_TPM_MANAGEMENT_FLAG_NO_PPI_MAINTENANCE;\r
       return 0;\r
-  \r
+\r
     case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR:\r
       //\r
       // PHYSICAL_PRESENCE_ENABLE_ACTIVATE + PHYSICAL_PRESENCE_CLEAR\r
@@ -423,7 +423,7 @@ ExecutePhysicalPresence (
       } else {\r
         TpmResponse = ExecutePhysicalPresence (TcgProtocol, PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE, PpiFlags);\r
         PpiFlags->PPFlags &= ~TCG_VENDOR_LIB_FLAG_RESET_TRACK;\r
-      } \r
+      }\r
       return TpmResponse;\r
 \r
     default:\r
@@ -453,7 +453,7 @@ ReadUserKey (
   UINT16                            InputKey;\r
   UINTN                             Index;\r
 \r
-  InputKey = 0; \r
+  InputKey = 0;\r
   do {\r
     Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
     if (Status == EFI_NOT_READY) {\r
@@ -479,18 +479,18 @@ ReadUserKey (
   if (InputKey != SCAN_ESC) {\r
     return TRUE;\r
   }\r
-  \r
+\r
   return FALSE;\r
 }\r
 \r
 /**\r
   The constructor function register UNI strings into imageHandle.\r
-  \r
-  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS. \r
+\r
+  It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.\r
 \r
   @param  ImageHandle   The firmware allocated handle for the EFI image.\r
   @param  SystemTable   A pointer to the EFI System Table.\r
-  \r
+\r
   @retval EFI_SUCCESS   The constructor successfully added string package.\r
   @retval Other value   The constructor can't add string package.\r
 \r
@@ -523,12 +523,12 @@ UserConfirm (
 {\r
   CHAR16                            *ConfirmText;\r
   CHAR16                            *TmpStr1;\r
-  CHAR16                            *TmpStr2; \r
+  CHAR16                            *TmpStr2;\r
   UINTN                             BufSize;\r
   BOOLEAN                           CautionKey;\r
   UINT16                            Index;\r
   CHAR16                            DstStr[81];\r
-    \r
+\r
   TmpStr2     = NULL;\r
   CautionKey  = FALSE;\r
   BufSize     = CONFIRM_BUFFER_SIZE;\r
@@ -538,7 +538,7 @@ UserConfirm (
   switch (TpmPpCommand) {\r
     case PHYSICAL_PRESENCE_ENABLE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ENABLE));\r
-      \r
+\r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
@@ -550,7 +550,7 @@ UserConfirm (
 \r
     case PHYSICAL_PRESENCE_DISABLE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISABLE));\r
-      \r
+\r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
@@ -563,10 +563,10 @@ UserConfirm (
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
       break;\r
-      \r
+\r
     case PHYSICAL_PRESENCE_ACTIVATE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACTIVATE));\r
-      \r
+\r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
@@ -589,7 +589,7 @@ UserConfirm (
 \r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ACCEPT_KEY));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
-      FreePool (TmpStr1); \r
+      FreePool (TmpStr1);\r
       break;\r
 \r
     case PHYSICAL_PRESENCE_CLEAR:\r
@@ -603,7 +603,7 @@ UserConfirm (
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CLEAR));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
-      FreePool (TmpStr1);      \r
+      FreePool (TmpStr1);\r
 \r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
@@ -628,15 +628,15 @@ UserConfirm (
 \r
     case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DEACTIVATE_DISABLE));\r
-      \r
-      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));      \r
+\r
+      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
 \r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_NOTE_OFF));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
-      \r
+\r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
@@ -648,8 +648,8 @@ UserConfirm (
 \r
     case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_TRUE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_ALLOW_TAKE_OWNERSHIP));\r
-      \r
-      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));      \r
+\r
+      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
 \r
@@ -660,8 +660,8 @@ UserConfirm (
 \r
     case PHYSICAL_PRESENCE_SET_OWNER_INSTALL_FALSE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_DISALLOW_TAKE_OWNERSHIP));\r
-      \r
-      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));      \r
+\r
+      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
 \r
@@ -688,15 +688,15 @@ UserConfirm (
 \r
     case PHYSICAL_PRESENCE_DEACTIVATE_DISABLE_OWNER_FALSE:\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_TURN_OFF));\r
-      \r
-      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));      \r
+\r
+      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
 \r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_NOTE_OFF));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
-      \r
+\r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
@@ -709,11 +709,11 @@ UserConfirm (
     case PHYSICAL_PRESENCE_DEFERRED_PP_UNOWNERED_FIELD_UPGRADE:\r
       CautionKey = TRUE;\r
       TmpStr2 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UNOWNED_FIELD_UPGRADE));\r
-      \r
-      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UPGRADE_HEAD_STR));      \r
+\r
+      TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_UPGRADE_HEAD_STR));\r
       UnicodeSPrint (ConfirmText, BufSize, TmpStr1, TmpStr2);\r
       FreePool (TmpStr1);\r
-      \r
+\r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_MAINTAIN));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       FreePool (TmpStr1);\r
@@ -787,7 +787,7 @@ UserConfirm (
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_WARNING_CLEAR));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), L" \n\n", (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
-      FreePool (TmpStr1); \r
+      FreePool (TmpStr1);\r
 \r
       TmpStr1 = PhysicalPresenceGetStringById (STRING_TOKEN (TPM_CAUTION_KEY));\r
       StrnCatS (ConfirmText, BufSize / sizeof (CHAR16), TmpStr1, (BufSize / sizeof (CHAR16)) - StrLen (ConfirmText) - 1);\r
@@ -877,10 +877,10 @@ UserConfirm (
 \r
   DstStr[80] = L'\0';\r
   for (Index = 0; Index < StrLen (ConfirmText); Index += 80) {\r
-    StrnCpyS(DstStr, sizeof (DstStr) / sizeof (CHAR16), ConfirmText + Index, sizeof (DstStr) / sizeof (CHAR16) - 1);    \r
-    Print (DstStr);    \r
+    StrnCpyS(DstStr, sizeof (DstStr) / sizeof (CHAR16), ConfirmText + Index, sizeof (DstStr) / sizeof (CHAR16) - 1);\r
+    Print (DstStr);\r
   }\r
-  \r
+\r
   FreePool (TmpStr1);\r
   FreePool (TmpStr2);\r
   FreePool (ConfirmText);\r
@@ -889,17 +889,17 @@ UserConfirm (
     return TRUE;\r
   }\r
 \r
-  return FALSE;  \r
+  return FALSE;\r
 }\r
 \r
 /**\r
-  Check if there is a valid physical presence command request. Also updates parameter value \r
+  Check if there is a valid physical presence command request. Also updates parameter value\r
   to whether the requested physical presence command already confirmed by user\r
\r
+\r
    @param[in]  TcgPpData           EFI TCG Physical Presence request data.\r
-   @param[in]  Flags               The physical presence interface flags. \r
+   @param[in]  Flags               The physical presence interface flags.\r
    @param[out] RequestConfirmed    If the physical presence operation command required user confirm from UI.\r
-                                   True, it indicates the command doesn't require user confirm, or already confirmed \r
+                                   True, it indicates the command doesn't require user confirm, or already confirmed\r
                                    in last boot cycle by user.\r
                                    False, it indicates the command need user confirm from UI.\r
 \r
@@ -1006,7 +1006,7 @@ HaveValidTpmRequest  (
   TcgPpData variable is external input, so this function will validate\r
   its data structure to be valid value.\r
 \r
-  @param[in] TcgProtocol          EFI TCG Protocol instance. \r
+  @param[in] TcgProtocol          EFI TCG Protocol instance.\r
   @param[in] TcgPpData            Point to the physical presence NV variable.\r
   @param[in] Flags                The physical presence interface flags.\r
 \r
@@ -1052,7 +1052,7 @@ ExecutePendingTpmRequest (
   } else {\r
     if (!RequestConfirmed) {\r
       //\r
-      // Print confirm text and wait for approval. \r
+      // Print confirm text and wait for approval.\r
       //\r
       RequestConfirmed = UserConfirm (TcgPpData->PPRequest);\r
     }\r
@@ -1077,18 +1077,18 @@ ExecutePendingTpmRequest (
                       EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
                       sizeof (EFI_PHYSICAL_PRESENCE_FLAGS),\r
                       &NewFlags\r
-                      ); \r
+                      );\r
     if (EFI_ERROR (Status)) {\r
       return;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Clear request\r
   //\r
   if ((NewFlags.PPFlags & TCG_VENDOR_LIB_FLAG_RESET_TRACK) == 0) {\r
     TcgPpData->LastPPRequest = TcgPpData->PPRequest;\r
-    TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION;    \r
+    TcgPpData->PPRequest = PHYSICAL_PRESENCE_NO_ACTION;\r
   }\r
 \r
   //\r
@@ -1124,7 +1124,7 @@ ExecutePendingTpmRequest (
     case PHYSICAL_PRESENCE_DEFERRED_PP_UNOWNERED_FIELD_UPGRADE:\r
     case PHYSICAL_PRESENCE_CLEAR_ENABLE_ACTIVATE:\r
     case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR:\r
-    case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE:      \r
+    case PHYSICAL_PRESENCE_ENABLE_ACTIVATE_CLEAR_ENABLE_ACTIVATE:\r
       break;\r
     default:\r
       if (TcgPpData->LastPPRequest >= TCG_PHYSICAL_PRESENCE_VENDOR_SPECIFIC_OPERATION) {\r
@@ -1142,21 +1142,21 @@ ExecutePendingTpmRequest (
 \r
   Print (L"Rebooting system to make TPM settings in effect\n");\r
   gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
-  ASSERT (FALSE);  \r
+  ASSERT (FALSE);\r
 }\r
 \r
 /**\r
   Check and execute the pending TPM request and Lock TPM.\r
 \r
-  The TPM request may come from OS or BIOS. This API will display request information and wait \r
+  The TPM request may come from OS or BIOS. This API will display request information and wait\r
   for user confirmation if TPM request exists. The TPM request will be sent to TPM device after\r
-  the TPM request is confirmed, and one or more reset may be required to make TPM request to \r
+  the TPM request is confirmed, and one or more reset may be required to make TPM request to\r
   take effect. At last, it will lock TPM to prevent TPM state change by malware.\r
-  \r
+\r
   This API should be invoked after console in and console out are all ready as they are required\r
-  to display request information and get user input to confirm the request. This API should also \r
+  to display request information and get user input to confirm the request. This API should also\r
   be invoked as early as possible as TPM is locked in this function.\r
-  \r
+\r
 **/\r
 VOID\r
 EFIAPI\r
@@ -1172,7 +1172,7 @@ TcgPhysicalPresenceLibProcessRequest (
   EFI_TCG_PROTOCOL                  *TcgProtocol;\r
   EDKII_VARIABLE_LOCK_PROTOCOL      *VariableLockProtocol;\r
   EFI_PHYSICAL_PRESENCE_FLAGS       PpiFlags;\r
-  \r
+\r
   Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol);\r
   if (EFI_ERROR (Status)) {\r
     return ;\r
@@ -1206,7 +1206,7 @@ TcgPhysicalPresenceLibProcessRequest (
   DEBUG ((EFI_D_INFO, "[TPM] PpiFlags = %x\n", PpiFlags.PPFlags));\r
 \r
   //\r
-  // This flags variable controls whether physical presence is required for TPM command. \r
+  // This flags variable controls whether physical presence is required for TPM command.\r
   // It should be protected from malicious software. We set it as read-only variable here.\r
   //\r
   Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLockProtocol);\r
@@ -1221,7 +1221,7 @@ TcgPhysicalPresenceLibProcessRequest (
       ASSERT_EFI_ERROR (Status);\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Initialize physical presence variable.\r
   //\r
@@ -1262,7 +1262,7 @@ TcgPhysicalPresenceLibProcessRequest (
   if (EFI_ERROR (Status)) {\r
     return ;\r
   }\r
-  \r
+\r
   if (!CmdEnable) {\r
     if (LifetimeLock) {\r
       //\r
@@ -1275,7 +1275,7 @@ TcgPhysicalPresenceLibProcessRequest (
       return ;\r
     }\r
   }\r
-  \r
+\r
   //\r
   // Set operator physical presence flags\r
   //\r
@@ -1283,7 +1283,7 @@ TcgPhysicalPresenceLibProcessRequest (
 \r
   //\r
   // Execute pending TPM request.\r
-  //  \r
+  //\r
   ExecutePendingTpmRequest (TcgProtocol, &TcgPpData, PpiFlags);\r
   DEBUG ((EFI_D_INFO, "[TPM] PPResponse = %x\n", TcgPpData.PPResponse));\r
 \r
@@ -1298,7 +1298,7 @@ TcgPhysicalPresenceLibProcessRequest (
 \r
   The TPM request may come from OS. This API will check if TPM request exists and need user\r
   input to confirmation.\r
-  \r
+\r
   @retval    TRUE        TPM needs input to confirm user physical presence.\r
   @retval    FALSE       TPM doesn't need input to confirm user physical presence.\r
 \r
@@ -1317,7 +1317,7 @@ TcgPhysicalPresenceLibNeedUserConfirm(
   BOOLEAN                      CmdEnable;\r
   EFI_TCG_PROTOCOL             *TcgProtocol;\r
   EFI_PHYSICAL_PRESENCE_FLAGS  PpiFlags;\r
-  \r
+\r
   Status = gBS->LocateProtocol (&gEfiTcgProtocolGuid, NULL, (VOID **)&TcgProtocol);\r
   if (EFI_ERROR (Status)) {\r
     return FALSE;\r
@@ -1349,7 +1349,7 @@ TcgPhysicalPresenceLibNeedUserConfirm(
   if (EFI_ERROR (Status)) {\r
     return FALSE;\r
   }\r
-  \r
+\r
   if (TcgPpData.PPRequest == PHYSICAL_PRESENCE_NO_ACTION) {\r
     //\r
     // No operation request\r