]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/BootLogoLib/BootLogoLib.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Library / BootLogoLib / BootLogoLib.c
index 8bd9985cb27189b3742e9ee3f3dbd0f9419717df..3293e9e03c7ac68fe7870dd489b3d87f7a7fc8bd 100644 (file)
@@ -2,7 +2,8 @@
   This library is only intended to be used by PlatformBootManagerLib\r
   to show progress bar and LOGO.\r
 \r
-Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2018, 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
@@ -259,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
@@ -281,7 +292,7 @@ BootLogoEnableLogo (
     Status = EFI_SUCCESS;\r
   } else {\r
     //\r
-    // More than one Logo displayed, get merged BltBuffer using VideoToBuffer operation. \r
+    // More than one Logo displayed, get merged BltBuffer using VideoToBuffer operation.\r
     //\r
     if (Blt != NULL) {\r
       FreePool (Blt);\r
@@ -330,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
@@ -338,7 +366,7 @@ BootLogoEnableLogo (
 }\r
 \r
 /**\r
-  Use SystemTable Conout to turn on video based Simple Text Out consoles. The \r
+  Use SystemTable Conout to turn on video based Simple Text Out consoles. The\r
   Simple Text Out screens will now be synced up with all non video output devices\r
 \r
   @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.\r