]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
Vlv2TbltDevicePkg: Display logo on BOOT_ON_FLASH_UPDATE
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / PlatformBdsLib / BdsPlatform.c
index 7dd289ece8dceaad13cbbfa6fccf93710a052fec..c25e1d301a342704660bf58abff04e2afe8f56ad 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2004  - 2016, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2004  - 2018, Intel Corporation. All rights reserved.<BR>\r
                                                                                    \r
   This program and the accompanying materials are licensed and made available under\r
   the terms and conditions of the BSD License that accompanies this distribution.  \r
@@ -27,7 +27,7 @@ Abstract:
 #include "SetupMode.h"\r
 #include <Guid/SetupVariable.h>\r
 #include <Library/TcgPhysicalPresenceLib.h>\r
-#include <Library/TrEEPhysicalPresenceLib.h>\r
+#include <Library/Tcg2PhysicalPresenceLib.h>\r
 #include <Protocol/I2cMasterMcg.h>\r
 #include <TianoApi.h>\r
 #include <PlatformBaseAddresses.h>\r
@@ -1795,7 +1795,7 @@ PlatformBdsPolicyBehavior (
     TcgPhysicalPresenceLibProcessRequest();\r
     #endif\r
     #ifdef FTPM_ENABLE\r
-    TrEEPhysicalPresenceLibProcessRequest(NULL);\r
+    Tcg2PhysicalPresenceLibProcessRequest(NULL);\r
     #endif\r
 \r
     if (EsrtManagement != NULL) {\r
@@ -1871,10 +1871,11 @@ PlatformBdsPolicyBehavior (
     //\r
     PlatformBdsConnectConsole (gPlatformConsole);\r
     PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);\r
+    EnableQuietBoot (PcdGetPtr(PcdLogoFile));\r
 \r
-    DEBUG((EFI_D_INFO, "ProcessCapsules Before EndOfDxe......\n"));\r
+    DEBUG((DEBUG_INFO, "ProcessCapsules Before EndOfDxe......\n"));\r
     ProcessCapsules ();\r
-    DEBUG((EFI_D_INFO, "ProcessCapsules Done\n"));\r
+    DEBUG((DEBUG_INFO, "ProcessCapsules Done\n"));\r
 \r
     //\r
     // Close boot script and install ready to lock\r
@@ -1901,9 +1902,9 @@ PlatformBdsPolicyBehavior (
       EsrtManagement->SyncEsrtFmp();\r
     }\r
 \r
-    DEBUG((EFI_D_INFO, "ProcessCapsules After ConnectAll......\n"));\r
+    DEBUG((DEBUG_INFO, "ProcessCapsules After ConnectAll......\n"));\r
     ProcessCapsules();\r
-    DEBUG((EFI_D_INFO, "ProcessCapsules Done\n"));\r
+    DEBUG((DEBUG_INFO, "ProcessCapsules Done\n"));\r
     break;\r
 \r
   case BOOT_IN_RECOVERY_MODE:\r
@@ -2005,7 +2006,7 @@ FULL_CONFIGURATION:
    TcgPhysicalPresenceLibProcessRequest();\r
    #endif\r
    #ifdef FTPM_ENABLE\r
-   TrEEPhysicalPresenceLibProcessRequest(NULL);\r
+   Tcg2PhysicalPresenceLibProcessRequest(NULL);\r
    #endif\r
 \r
     if (EsrtManagement != NULL) {\r
@@ -2411,6 +2412,12 @@ ShowProgressHotKey (
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;\r
   UINT32                        GpioValue;\r
+  CHAR16                        *TmpStr1;\r
+  CHAR16                        *TmpStr2;\r
+  CHAR16                        *TmpStr3;\r
+  UINTN                         TmpStrSize;\r
+  VOID                          *Buffer;\r
+  UINTN                         Size;\r
 \r
   if (TimeoutDefault == 0) {\r
     return EFI_TIMEOUT;\r
@@ -2434,10 +2441,76 @@ ShowProgressHotKey (
   SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);\r
   SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
 \r
+  TmpStr2 = NULL;\r
+  TmpStr3 = NULL;\r
+\r
+  //\r
+  // Check if the platform is using test key.\r
+  //\r
+  Status = GetSectionFromAnyFv(\r
+             PcdGetPtr(PcdEdkiiRsa2048Sha256TestPublicKeyFileGuid),\r
+             EFI_SECTION_RAW,\r
+             0,\r
+             &Buffer,\r
+             &Size\r
+             );\r
+  if (!EFI_ERROR(Status)) {\r
+    if ((Size == PcdGetSize(PcdRsa2048Sha256PublicKeyBuffer)) &&\r
+        (CompareMem(Buffer, PcdGetPtr(PcdRsa2048Sha256PublicKeyBuffer), Size) == 0)) {\r
+      TmpStr2 = L"WARNING: Recovery Test Key is used.\r\n";\r
+      if (DebugAssertEnabled()) {\r
+        DEBUG ((DEBUG_INFO, "\n\nWARNING: Recovery Test Key is used.\n"));\r
+      } else {\r
+        SerialPortWrite((UINT8 *)"\n\nWARNING: Recovery Test Key is used.", sizeof("\n\nWARNING: Recovery Test Key is used."));\r
+      }\r
+      PcdSetBoolS(PcdTestKeyUsed, TRUE);\r
+    }\r
+    FreePool(Buffer);\r
+  }\r
+  Status = GetSectionFromAnyFv(\r
+             PcdGetPtr(PcdEdkiiPkcs7TestPublicKeyFileGuid),\r
+             EFI_SECTION_RAW,\r
+             0,\r
+             &Buffer,\r
+             &Size\r
+             );\r
+  if (!EFI_ERROR(Status)) {\r
+    if ((Size == PcdGetSize(PcdPkcs7CertBuffer)) &&\r
+        (CompareMem(Buffer, PcdGetPtr(PcdPkcs7CertBuffer), Size) == 0)) {\r
+      TmpStr3 = L"WARNING: Capsule Test Key is used.\r\n";\r
+      if (DebugAssertEnabled()) {\r
+        DEBUG ((DEBUG_INFO, "\n\nWARNING: Capsule Test Key is used.\r\n"));\r
+      } else {\r
+        SerialPortWrite((UINT8 *)"\n\nWARNING: Capsule Test Key is used.", sizeof("\n\nWARNING: Capsule Test Key is used."));\r
+      }\r
+      PcdSetBoolS(PcdTestKeyUsed, TRUE);\r
+    }\r
+    FreePool(Buffer);\r
+  }\r
+\r
   //\r
   // Clear the progress status bar first\r
   //\r
-  TmpStr = L"Start boot option, Press <F2> or <DEL> to enter setup page.";\r
+  TmpStr1 = L"Start boot option, Press <F2> or <DEL> to enter setup page.\r\n";\r
+  TmpStrSize = StrSize(TmpStr1);\r
+  if (TmpStr2 != NULL) {\r
+    TmpStrSize += StrSize(TmpStr2);\r
+  }\r
+  if (TmpStr3 != NULL) {\r
+    TmpStrSize += StrSize(TmpStr3);\r
+  }\r
+  TmpStr = AllocatePool (TmpStrSize);\r
+  if (TmpStr == NULL) {\r
+    TmpStr = TmpStr1;\r
+  } else {\r
+    StrCpyS(TmpStr, TmpStrSize/sizeof(CHAR16), TmpStr1);\r
+    if (TmpStr2 != NULL) {\r
+      StrCatS(TmpStr, TmpStrSize/sizeof(CHAR16), TmpStr2);\r
+    }\r
+    if (TmpStr3 != NULL) {\r
+      StrCatS(TmpStr, TmpStrSize/sizeof(CHAR16), TmpStr3);\r
+    }\r
+  }\r
   PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);\r
 \r
   TimeoutRemain = TimeoutDefault;\r
@@ -2570,6 +2643,8 @@ PlatformBdsEnterFrontPageWithHotKey (
 {\r
   EFI_STATUS                    Status;\r
 \r
+  EFI_STATUS                         LogoStatus;\r
+  EFI_BOOT_LOGO_PROTOCOL             *BootLogo;\r
   EFI_GRAPHICS_OUTPUT_PROTOCOL       *GraphicsOutput;\r
   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL    *SimpleTextOut;\r
   UINTN                              BootTextColumn;\r
@@ -2649,6 +2724,14 @@ PlatformBdsEnterFrontPageWithHotKey (
     gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
     gST->ConOut->ClearScreen (gST->ConOut);\r
 \r
+    //\r
+    // Boot Logo is corrupted, report it using Boot Logo protocol.\r
+    //\r
+    LogoStatus = gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);\r
+    if (!EFI_ERROR (LogoStatus) && (BootLogo != NULL)) {\r
+      BootLogo->SetBootLogo (BootLogo, NULL, 0, 0, 0, 0);\r
+    }\r
+\r
     if (EFI_ERROR (Status)) {\r
       //\r
       // Timeout or user press enter to continue\r
@@ -2656,6 +2739,7 @@ PlatformBdsEnterFrontPageWithHotKey (
       goto Exit;\r
     }\r
   }\r
+\r
   //\r
   // Install BM HiiPackages. \r
   // Keep BootMaint HiiPackage, so that it can be covered by global setting. \r