]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
BaseTools: use predefined constants instead of local strings
[mirror_edk2.git] / MdeModulePkg / Library / BootLogoLib / BootLogoLib.c
index 2c1e8ea5b4f2a83bb7f16acfe3c4cacb503ef334..e14c097510436f4ce1ff3e963eaa14f8b4931976 100644 (file)
@@ -3,6 +3,7 @@
   to show progress bar and LOGO.\r
 \r
 Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2016, Microsoft Corporation<BR>\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
 The full text of the license may be found at\r
@@ -19,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/PlatformLogo.h>\r
 #include <Protocol/UgaDraw.h>\r
 #include <Protocol/BootLogo.h>\r
+#include <Protocol/BootLogo2.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
@@ -56,6 +58,7 @@ BootLogoEnableLogo (
   UINT32                                RefreshRate;\r
   EFI_GRAPHICS_OUTPUT_PROTOCOL          *GraphicsOutput;\r
   EFI_BOOT_LOGO_PROTOCOL                *BootLogo;\r
+  EDKII_BOOT_LOGO2_PROTOCOL             *BootLogo2;\r
   UINTN                                 NumberOfLogos;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL         *LogoBlt;\r
   UINTN                                 LogoDestX;\r
@@ -98,6 +101,14 @@ BootLogoEnableLogo (
     BootLogo = NULL;\r
   }\r
 \r
+  //\r
+  // Try to open Boot Logo 2 Protocol.\r
+  //\r
+  Status = gBS->LocateProtocol (&gEdkiiBootLogo2ProtocolGuid, NULL, (VOID **) &BootLogo2);\r
+  if (EFI_ERROR (Status)) {\r
+    BootLogo2 = NULL;\r
+  }\r
+\r
   //\r
   // Erase Cursor from screen\r
   //\r
@@ -142,10 +153,6 @@ BootLogoEnableLogo (
       break;\r
     }\r
 \r
-    if (EFI_ERROR (Status)) {\r
-      continue;\r
-    }\r
-\r
     if (Blt != NULL) {\r
       FreePool (Blt);\r
     }\r
@@ -263,7 +270,7 @@ BootLogoEnableLogo (
     }\r
   }\r
 \r
-  if (BootLogo == NULL || NumberOfLogos == 0) {\r
+  if ((BootLogo == NULL && BootLogo2 == NULL) || NumberOfLogos == 0) {\r
     //\r
     // No logo displayed.\r
     //\r
@@ -334,7 +341,24 @@ BootLogoEnableLogo (
   }\r
 \r
   if (!EFI_ERROR (Status)) {\r
-    BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);\r
+    //\r
+    // Attempt to register logo with Boot Logo 2 Protocol first\r
+    //\r
+    if (BootLogo2 != NULL) {\r
+      Status = BootLogo2->SetBootLogo (BootLogo2, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);\r
+    }\r
+    //\r
+    // If Boot Logo 2 Protocol is not available or registration with Boot Logo 2\r
+    // Protocol failed, then attempt to register logo with Boot Logo Protocol\r
+    //\r
+    if (EFI_ERROR (Status) && BootLogo != NULL) {\r
+      Status = BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);\r
+    }\r
+    //\r
+    // Status of this function is EFI_SUCCESS even if registration with Boot\r
+    // Logo 2 Protocol or Boot Logo Protocol fails.\r
+    //\r
+    Status = EFI_SUCCESS;\r
   }\r
   FreePool (LogoBlt);\r
 \r