]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/PlatformBootManagerLib: rebase boot logo display to BootLogoLib
authorLaszlo Ersek <lersek@redhat.com>
Wed, 25 May 2016 11:08:15 +0000 (13:08 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Fri, 27 May 2016 09:28:01 +0000 (11:28 +0200)
In the course of porting OvmfPkg to the MdeModulePkg BDS, commit
817fb3ac2a78

  OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBoot

open-coded the EnableQuietBoot() function (and its dependencies / friends)
from IntelFrameworkModulePkg BDS.

This code duplication can be avoided; the functionality is available from
the following three libraries in MdeModulePkg:

- BootLogoLib: provides the BootLogoEnableLogo() function. It does not
  provide the internal ConvertBmpToGopBlt() function -- that one is
  delegated to ImageDecoderLib (function DecodeImage()).

- ImageDecoderLib: a general library that registers decoder plugins for
  specific image formats, and provides the generic DecodeImage() on top.

- BmpImageDecoderLib: one of said decoder plugins, for handling BMP images
  (which is the format of our logo).

In this patch, we revert 817fb3ac2a78, and atomically incorporate the
above libraries. This is inspired by Nt32Pkg commit 859e75c4fc42:

  Nt32Pkg: Use BootLogoLib for logo and progress bar drawing.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf
OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c [deleted file]
OvmfPkg/OvmfPkgIa32.dsc
OvmfPkg/OvmfPkgIa32X64.dsc
OvmfPkg/OvmfPkgX64.dsc

index da4cb728c6783bf7535f29ef12e3d16dc8ee7992..9eb9e390373d89ab51510755c02ea88f63de9f22 100644 (file)
@@ -1284,7 +1284,13 @@ Routine Description:
   //\r
   // Logo show\r
   //\r
   //\r
   // Logo show\r
   //\r
-  EnableQuietBoot (PcdGetPtr (PcdLogoFile));\r
+  BootLogoEnableLogo (\r
+    ImageFormatBmp,                          // ImageFormat\r
+    PcdGetPtr (PcdLogoFile),                 // Logo\r
+    EdkiiPlatformLogoDisplayAttributeCenter, // Attribute\r
+    0,                                       // OffsetX\r
+    0                                        // OffsetY\r
+    );\r
 \r
   //\r
   // Perform some platform specific connect sequence\r
 \r
   //\r
   // Perform some platform specific connect sequence\r
index 4c379b67e9bfe54f05f177cbf20c8835d029cfba..00a1d22eeaafcee1d296a41b3216a73a79f6b9f8 100644 (file)
@@ -26,7 +26,6 @@ Abstract:
 \r
 #include <PiDxe.h>\r
 \r
 \r
 #include <PiDxe.h>\r
 \r
-#include <IndustryStandard/Bmp.h>\r
 #include <IndustryStandard/Pci.h>\r
 #include <IndustryStandard/Acpi.h>\r
 #include <IndustryStandard/SmBios.h>\r
 #include <IndustryStandard/Pci.h>\r
 #include <IndustryStandard/Acpi.h>\r
 #include <IndustryStandard/SmBios.h>\r
@@ -41,6 +40,7 @@ Abstract:
 #include <Library/PcdLib.h>\r
 #include <Library/PciLib.h>\r
 #include <Library/UefiBootManagerLib.h>\r
 #include <Library/PcdLib.h>\r
 #include <Library/PciLib.h>\r
 #include <Library/UefiBootManagerLib.h>\r
+#include <Library/BootLogoLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
@@ -49,11 +49,7 @@ Abstract:
 #include <Library/NvVarsFileLib.h>\r
 #include <Library/QemuFwCfgLib.h>\r
 #include <Library/QemuBootOrderLib.h>\r
 #include <Library/NvVarsFileLib.h>\r
 #include <Library/QemuFwCfgLib.h>\r
 #include <Library/QemuBootOrderLib.h>\r
-#include <Library/DxeServicesLib.h>\r
 \r
 \r
-#include <Protocol/OEMBadging.h>\r
-#include <Protocol/UgaDraw.h>\r
-#include <Protocol/BootLogo.h>\r
 #include <Protocol/Decompress.h>\r
 #include <Protocol/PciIo.h>\r
 #include <Protocol/FirmwareVolume2.h>\r
 #include <Protocol/Decompress.h>\r
 #include <Protocol/PciIo.h>\r
 #include <Protocol/FirmwareVolume2.h>\r
@@ -184,31 +180,4 @@ TryRunningQemuKernel (
   VOID\r
   );\r
 \r
   VOID\r
   );\r
 \r
-/**\r
-  Use SystemTable Conout to stop video based Simple Text Out consoles from going\r
-  to the video device. Put up LogoFile on every video device that is a console.\r
-\r
-  @param[in]  LogoFile   File name of logo to display on the center of the screen.\r
-\r
-  @retval EFI_SUCCESS     ConsoleControl has been flipped to graphics and logo displayed.\r
-  @retval EFI_UNSUPPORTED Logo not found\r
-\r
-**/\r
-EFI_STATUS\r
-EnableQuietBoot (\r
-  IN  EFI_GUID  *LogoFile\r
-  );\r
-\r
-/**\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
-\r
-**/\r
-EFI_STATUS\r
-DisableQuietBoot (\r
-  VOID\r
-  );\r
-\r
 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_\r
 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_\r
index 34c43e29cb84757712e6b5f82efbfd37ad3411a2..5fcee3c55c03b4ab0d391bd99a80de27ba257070 100644 (file)
@@ -30,7 +30,6 @@
   BdsPlatform.c\r
   PlatformData.c\r
   QemuKernel.c\r
   BdsPlatform.c\r
   PlatformData.c\r
   QemuKernel.c\r
-  QuietBoot.c\r
   BdsPlatform.h\r
 \r
 [Packages]\r
   BdsPlatform.h\r
 \r
 [Packages]\r
@@ -47,6 +46,7 @@
   DebugLib\r
   PcdLib\r
   UefiBootManagerLib\r
   DebugLib\r
   PcdLib\r
   UefiBootManagerLib\r
+  BootLogoLib\r
   DevicePathLib\r
   PciLib\r
   NvVarsFileLib\r
   DevicePathLib\r
   PciLib\r
   NvVarsFileLib\r
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile\r
 \r
   gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile\r
 \r
-[FeaturePcd]\r
-  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport                   ## CONSUMES\r
-  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdBootlogoOnlyEnable ## CONSUMES\r
-\r
 [Pcd.IA32, Pcd.X64]\r
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock\r
 \r
 [Pcd.IA32, Pcd.X64]\r
   gEfiMdePkgTokenSpaceGuid.PcdFSBClock\r
 \r
@@ -75,7 +71,6 @@
   gEfiPciRootBridgeIoProtocolGuid\r
   gEfiS3SaveStateProtocolGuid                   # PROTOCOL SOMETIMES_CONSUMED\r
   gEfiDxeSmmReadyToLockProtocolGuid             # PROTOCOL SOMETIMES_PRODUCED\r
   gEfiPciRootBridgeIoProtocolGuid\r
   gEfiS3SaveStateProtocolGuid                   # PROTOCOL SOMETIMES_CONSUMED\r
   gEfiDxeSmmReadyToLockProtocolGuid             # PROTOCOL SOMETIMES_PRODUCED\r
-  gEfiOEMBadgingProtocolGuid                    # PROTOCOL SOMETIMES_PRODUCED\r
   gEfiLoadedImageProtocolGuid                   # PROTOCOL SOMETIMES_PRODUCED\r
 \r
 [Guids]\r
   gEfiLoadedImageProtocolGuid                   # PROTOCOL SOMETIMES_PRODUCED\r
 \r
 [Guids]\r
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c b/OvmfPkg/Library/PlatformBootManagerLib/QuietBoot.c
deleted file mode 100644 (file)
index 972050f..0000000
+++ /dev/null
@@ -1,673 +0,0 @@
-/** @file\r
-  Platform BDS function for quiet boot support.\r
-\r
-Copyright (c) 2004 - 2016, 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
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#include "BdsPlatform.h"\r
-\r
-/**\r
-  Convert a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buffer\r
-  is passed in a GopBlt buffer will be allocated by this routine. If a GopBlt\r
-  buffer is passed in it will be used if it is big enough.\r
-\r
-  @param  BmpImage      Pointer to BMP file\r
-  @param  BmpImageSize  Number of bytes in BmpImage\r
-  @param  GopBlt        Buffer containing GOP version of BmpImage.\r
-  @param  GopBltSize    Size of GopBlt in bytes.\r
-  @param  PixelHeight   Height of GopBlt/BmpImage in pixels\r
-  @param  PixelWidth    Width of GopBlt/BmpImage in pixels\r
-\r
-  @retval EFI_SUCCESS           GopBlt and GopBltSize are returned.\r
-  @retval EFI_UNSUPPORTED       BmpImage is not a valid *.BMP image\r
-  @retval EFI_BUFFER_TOO_SMALL  The passed in GopBlt buffer is not big enough.\r
-                                GopBltSize will contain the required size.\r
-  @retval EFI_OUT_OF_RESOURCES  No enough buffer to allocate.\r
-\r
-**/\r
-STATIC\r
-EFI_STATUS\r
-ConvertBmpToGopBlt (\r
-  IN     VOID      *BmpImage,\r
-  IN     UINTN     BmpImageSize,\r
-  IN OUT VOID      **GopBlt,\r
-  IN OUT UINTN     *GopBltSize,\r
-     OUT UINTN     *PixelHeight,\r
-     OUT UINTN     *PixelWidth\r
-  )\r
-{\r
-  UINT8                         *Image;\r
-  UINT8                         *ImageHeader;\r
-  BMP_IMAGE_HEADER              *BmpHeader;\r
-  BMP_COLOR_MAP                 *BmpColorMap;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;\r
-  UINT64                        BltBufferSize;\r
-  UINTN                         Index;\r
-  UINTN                         Height;\r
-  UINTN                         Width;\r
-  UINTN                         ImageIndex;\r
-  UINT32                        DataSizePerLine;\r
-  BOOLEAN                       IsAllocated;\r
-  UINT32                        ColorMapNum;\r
-\r
-  if (sizeof (BMP_IMAGE_HEADER) > BmpImageSize) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  BmpHeader = (BMP_IMAGE_HEADER *) BmpImage;\r
-\r
-  if (BmpHeader->CharB != 'B' || BmpHeader->CharM != 'M') {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // Doesn't support compress.\r
-  //\r
-  if (BmpHeader->CompressionType != 0) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // Only support BITMAPINFOHEADER format.\r
-  // BITMAPFILEHEADER + BITMAPINFOHEADER = BMP_IMAGE_HEADER\r
-  //\r
-  if (BmpHeader->HeaderSize != sizeof (BMP_IMAGE_HEADER) - OFFSET_OF(BMP_IMAGE_HEADER, HeaderSize)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // The data size in each line must be 4 byte alignment.\r
-  //\r
-  DataSizePerLine = ((BmpHeader->PixelWidth * BmpHeader->BitPerPixel + 31) >> 3) & (~0x3);\r
-  BltBufferSize = MultU64x32 (DataSizePerLine, BmpHeader->PixelHeight);\r
-  if (BltBufferSize > (UINT32) ~0) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if ((BmpHeader->Size != BmpImageSize) ||\r
-      (BmpHeader->Size < BmpHeader->ImageOffset) ||\r
-      (BmpHeader->Size - BmpHeader->ImageOffset !=  BmpHeader->PixelHeight * DataSizePerLine)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  //\r
-  // Calculate Color Map offset in the image.\r
-  //\r
-  Image       = BmpImage;\r
-  BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));\r
-  if (BmpHeader->ImageOffset < sizeof (BMP_IMAGE_HEADER)) {\r
-    return EFI_INVALID_PARAMETER;\r
-  }\r
-\r
-  if (BmpHeader->ImageOffset > sizeof (BMP_IMAGE_HEADER)) {\r
-    switch (BmpHeader->BitPerPixel) {\r
-      case 1:\r
-        ColorMapNum = 2;\r
-        break;\r
-      case 4:\r
-        ColorMapNum = 16;\r
-        break;\r
-      case 8:\r
-        ColorMapNum = 256;\r
-        break;\r
-      default:\r
-        ColorMapNum = 0;\r
-        break;\r
-      }\r
-    //\r
-    // BMP file may has padding data between the bmp header section and the bmp data section.\r
-    //\r
-    if (BmpHeader->ImageOffset - sizeof (BMP_IMAGE_HEADER) < sizeof (BMP_COLOR_MAP) * ColorMapNum) {\r
-      return EFI_INVALID_PARAMETER;\r
-    }\r
-  }\r
-\r
-  //\r
-  // Calculate graphics image data address in the image\r
-  //\r
-  Image         = ((UINT8 *) BmpImage) + BmpHeader->ImageOffset;\r
-  ImageHeader   = Image;\r
-\r
-  //\r
-  // Calculate the BltBuffer needed size.\r
-  //\r
-  BltBufferSize = MultU64x32 ((UINT64) BmpHeader->PixelWidth, BmpHeader->PixelHeight);\r
-  //\r
-  // Ensure the BltBufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow\r
-  //\r
-  if (BltBufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-  BltBufferSize = MultU64x32 (BltBufferSize, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
-\r
-  IsAllocated   = FALSE;\r
-  if (*GopBlt == NULL) {\r
-    //\r
-    // GopBlt is not allocated by caller.\r
-    //\r
-    *GopBltSize = (UINTN) BltBufferSize;\r
-    *GopBlt     = AllocatePool (*GopBltSize);\r
-    IsAllocated = TRUE;\r
-    if (*GopBlt == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-  } else {\r
-    //\r
-    // GopBlt has been allocated by caller.\r
-    //\r
-    if (*GopBltSize < (UINTN) BltBufferSize) {\r
-      *GopBltSize = (UINTN) BltBufferSize;\r
-      return EFI_BUFFER_TOO_SMALL;\r
-    }\r
-  }\r
-\r
-  *PixelWidth   = BmpHeader->PixelWidth;\r
-  *PixelHeight  = BmpHeader->PixelHeight;\r
-\r
-  //\r
-  // Convert image from BMP to Blt buffer format\r
-  //\r
-  BltBuffer = *GopBlt;\r
-  for (Height = 0; Height < BmpHeader->PixelHeight; Height++) {\r
-    Blt = &BltBuffer[(BmpHeader->PixelHeight - Height - 1) * BmpHeader->PixelWidth];\r
-    for (Width = 0; Width < BmpHeader->PixelWidth; Width++, Image++, Blt++) {\r
-      switch (BmpHeader->BitPerPixel) {\r
-      case 1:\r
-        //\r
-        // Convert 1-bit (2 colors) BMP to 24-bit color\r
-        //\r
-        for (Index = 0; Index < 8 && Width < BmpHeader->PixelWidth; Index++) {\r
-          Blt->Red    = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Red;\r
-          Blt->Green  = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Green;\r
-          Blt->Blue   = BmpColorMap[((*Image) >> (7 - Index)) & 0x1].Blue;\r
-          Blt++;\r
-          Width++;\r
-        }\r
-\r
-        Blt--;\r
-        Width--;\r
-        break;\r
-\r
-      case 4:\r
-        //\r
-        // Convert 4-bit (16 colors) BMP Palette to 24-bit color\r
-        //\r
-        Index       = (*Image) >> 4;\r
-        Blt->Red    = BmpColorMap[Index].Red;\r
-        Blt->Green  = BmpColorMap[Index].Green;\r
-        Blt->Blue   = BmpColorMap[Index].Blue;\r
-        if (Width < (BmpHeader->PixelWidth - 1)) {\r
-          Blt++;\r
-          Width++;\r
-          Index       = (*Image) & 0x0f;\r
-          Blt->Red    = BmpColorMap[Index].Red;\r
-          Blt->Green  = BmpColorMap[Index].Green;\r
-          Blt->Blue   = BmpColorMap[Index].Blue;\r
-        }\r
-        break;\r
-\r
-      case 8:\r
-        //\r
-        // Convert 8-bit (256 colors) BMP Palette to 24-bit color\r
-        //\r
-        Blt->Red    = BmpColorMap[*Image].Red;\r
-        Blt->Green  = BmpColorMap[*Image].Green;\r
-        Blt->Blue   = BmpColorMap[*Image].Blue;\r
-        break;\r
-\r
-      case 24:\r
-        //\r
-        // It is 24-bit BMP.\r
-        //\r
-        Blt->Blue   = *Image++;\r
-        Blt->Green  = *Image++;\r
-        Blt->Red    = *Image;\r
-        break;\r
-\r
-      default:\r
-        //\r
-        // Other bit format BMP is not supported.\r
-        //\r
-        if (IsAllocated) {\r
-          FreePool (*GopBlt);\r
-          *GopBlt = NULL;\r
-        }\r
-        return EFI_UNSUPPORTED;\r
-      };\r
-\r
-    }\r
-\r
-    ImageIndex = (UINTN) (Image - ImageHeader);\r
-    if ((ImageIndex % 4) != 0) {\r
-      //\r
-      // Bmp Image starts each row on a 32-bit boundary!\r
-      //\r
-      Image = Image + (4 - (ImageIndex % 4));\r
-    }\r
-  }\r
-\r
-  return EFI_SUCCESS;\r
-}\r
-\r
-/**\r
-  Use SystemTable Conout to stop video based Simple Text Out consoles from going\r
-  to the video device. Put up LogoFile on every video device that is a console.\r
-\r
-  @param[in]  LogoFile   File name of logo to display on the center of the screen.\r
-\r
-  @retval EFI_SUCCESS     ConsoleControl has been flipped to graphics and logo displayed.\r
-  @retval EFI_UNSUPPORTED Logo not found\r
-\r
-**/\r
-EFI_STATUS\r
-EnableQuietBoot (\r
-  IN  EFI_GUID  *LogoFile\r
-  )\r
-{\r
-  EFI_STATUS                    Status;\r
-  EFI_OEM_BADGING_PROTOCOL      *Badging;\r
-  UINT32                        SizeOfX;\r
-  UINT32                        SizeOfY;\r
-  INTN                          DestX;\r
-  INTN                          DestY;\r
-  UINT8                         *ImageData;\r
-  UINTN                         ImageSize;\r
-  UINTN                         BltSize;\r
-  UINT32                        Instance;\r
-  EFI_BADGING_FORMAT            Format;\r
-  EFI_BADGING_DISPLAY_ATTRIBUTE Attribute;\r
-  UINTN                         CoordinateX;\r
-  UINTN                         CoordinateY;\r
-  UINTN                         Height;\r
-  UINTN                         Width;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;\r
-  EFI_UGA_DRAW_PROTOCOL         *UgaDraw;\r
-  UINT32                        ColorDepth;\r
-  UINT32                        RefreshRate;\r
-  EFI_GRAPHICS_OUTPUT_PROTOCOL  *GraphicsOutput;\r
-  EFI_BOOT_LOGO_PROTOCOL        *BootLogo;\r
-  UINTN                         NumberOfLogos;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LogoBlt;\r
-  UINTN                         LogoDestX;\r
-  UINTN                         LogoDestY;\r
-  UINTN                         LogoHeight;\r
-  UINTN                         LogoWidth;\r
-  UINTN                         NewDestX;\r
-  UINTN                         NewDestY;\r
-  UINTN                         NewHeight;\r
-  UINTN                         NewWidth;\r
-  UINT64                        BufferSize;\r
-\r
-  UgaDraw = NULL;\r
-  //\r
-  // Try to open GOP first\r
-  //\r
-  Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiGraphicsOutputProtocolGuid, (VOID **) &GraphicsOutput);\r
-  if (EFI_ERROR (Status) && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-    GraphicsOutput = NULL;\r
-    //\r
-    // Open GOP failed, try to open UGA\r
-    //\r
-    Status = gBS->HandleProtocol (gST->ConsoleOutHandle, &gEfiUgaDrawProtocolGuid, (VOID **) &UgaDraw);\r
-  }\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // Try to open Boot Logo Protocol.\r
-  //\r
-  BootLogo = NULL;\r
-  gBS->LocateProtocol (&gEfiBootLogoProtocolGuid, NULL, (VOID **) &BootLogo);\r
-\r
-  //\r
-  // Erase Cursor from screen\r
-  //\r
-  gST->ConOut->EnableCursor (gST->ConOut, FALSE);\r
-\r
-  Badging = NULL;\r
-  Status  = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);\r
-\r
-  if (GraphicsOutput != NULL) {\r
-    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
-    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
-\r
-  } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-    Status = UgaDraw->GetMode (UgaDraw, &SizeOfX, &SizeOfY, &ColorDepth, &RefreshRate);\r
-    if (EFI_ERROR (Status)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-  } else {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  Blt = NULL;\r
-  NumberOfLogos = 0;\r
-  LogoDestX = 0;\r
-  LogoDestY = 0;\r
-  LogoHeight = 0;\r
-  LogoWidth = 0;\r
-  NewDestX = 0;\r
-  NewDestY = 0;\r
-  NewHeight = 0;\r
-  NewWidth = 0;\r
-  Instance = 0;\r
-  Height = 0;\r
-  Width = 0;\r
-  while (1) {\r
-    ImageData = NULL;\r
-    ImageSize = 0;\r
-\r
-    if (Badging != NULL) {\r
-      //\r
-      // Get image from OEMBadging protocol.\r
-      //\r
-      Status = Badging->GetImage (\r
-                          Badging,\r
-                          &Instance,\r
-                          &Format,\r
-                          &ImageData,\r
-                          &ImageSize,\r
-                          &Attribute,\r
-                          &CoordinateX,\r
-                          &CoordinateY\r
-                          );\r
-      if (EFI_ERROR (Status)) {\r
-        goto Done;\r
-      }\r
-\r
-      //\r
-      // Currently only support BMP format.\r
-      //\r
-      if (Format != EfiBadgingFormatBMP) {\r
-        if (ImageData != NULL) {\r
-          FreePool (ImageData);\r
-        }\r
-        continue;\r
-      }\r
-    } else {\r
-      //\r
-      // Get the specified image from FV.\r
-      //\r
-      Status = GetSectionFromAnyFv (LogoFile, EFI_SECTION_RAW, 0, (VOID **) &ImageData, &ImageSize);\r
-      if (EFI_ERROR (Status)) {\r
-        return EFI_UNSUPPORTED;\r
-      }\r
-\r
-      CoordinateX = 0;\r
-      CoordinateY = 0;\r
-      if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
-        Attribute   = EfiBadgingDisplayAttributeCenter;\r
-      } else {\r
-        Attribute   = EfiBadgingDisplayAttributeCustomized;\r
-      }\r
-    }\r
-\r
-    if (Blt != NULL) {\r
-      FreePool (Blt);\r
-    }\r
-    Blt = NULL;\r
-    Status = ConvertBmpToGopBlt (\r
-              ImageData,\r
-              ImageSize,\r
-              (VOID **) &Blt,\r
-              &BltSize,\r
-              &Height,\r
-              &Width\r
-              );\r
-    if (EFI_ERROR (Status)) {\r
-      FreePool (ImageData);\r
-\r
-      if (Badging == NULL) {\r
-        return Status;\r
-      } else {\r
-        continue;\r
-      }\r
-    }\r
-\r
-    //\r
-    // Calculate the display position according to Attribute.\r
-    //\r
-    switch (Attribute) {\r
-    case EfiBadgingDisplayAttributeLeftTop:\r
-      DestX = CoordinateX;\r
-      DestY = CoordinateY;\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeCenterTop:\r
-      DestX = (SizeOfX - Width) / 2;\r
-      DestY = CoordinateY;\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeRightTop:\r
-      DestX = (SizeOfX - Width - CoordinateX);\r
-      DestY = CoordinateY;;\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeCenterRight:\r
-      DestX = (SizeOfX - Width - CoordinateX);\r
-      DestY = (SizeOfY - Height) / 2;\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeRightBottom:\r
-      DestX = (SizeOfX - Width - CoordinateX);\r
-      DestY = (SizeOfY - Height - CoordinateY);\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeCenterBottom:\r
-      DestX = (SizeOfX - Width) / 2;\r
-      DestY = (SizeOfY - Height - CoordinateY);\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeLeftBottom:\r
-      DestX = CoordinateX;\r
-      DestY = (SizeOfY - Height - CoordinateY);\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeCenterLeft:\r
-      DestX = CoordinateX;\r
-      DestY = (SizeOfY - Height) / 2;\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeCenter:\r
-      DestX = (SizeOfX - Width) / 2;\r
-      DestY = (SizeOfY - Height) / 2;\r
-      break;\r
-\r
-    case EfiBadgingDisplayAttributeCustomized:\r
-      DestX = (SizeOfX - Width) / 2;\r
-      DestY = ((SizeOfY * 382) / 1000) - Height / 2;\r
-      break;\r
-\r
-    default:\r
-      DestX = CoordinateX;\r
-      DestY = CoordinateY;\r
-      break;\r
-    }\r
-\r
-    if ((DestX >= 0) && (DestY >= 0)) {\r
-      if (GraphicsOutput != NULL) {\r
-        Status = GraphicsOutput->Blt (\r
-                            GraphicsOutput,\r
-                            Blt,\r
-                            EfiBltBufferToVideo,\r
-                            0,\r
-                            0,\r
-                            (UINTN) DestX,\r
-                            (UINTN) DestY,\r
-                            Width,\r
-                            Height,\r
-                            Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
-                            );\r
-      } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-        Status = UgaDraw->Blt (\r
-                            UgaDraw,\r
-                            (EFI_UGA_PIXEL *) Blt,\r
-                            EfiUgaBltBufferToVideo,\r
-                            0,\r
-                            0,\r
-                            (UINTN) DestX,\r
-                            (UINTN) DestY,\r
-                            Width,\r
-                            Height,\r
-                            Width * sizeof (EFI_UGA_PIXEL)\r
-                            );\r
-      } else {\r
-        Status = EFI_UNSUPPORTED;\r
-      }\r
-\r
-      //\r
-      // Report displayed Logo information.\r
-      //\r
-      if (!EFI_ERROR (Status)) {\r
-        NumberOfLogos++;\r
-\r
-        if (LogoWidth == 0) {\r
-          //\r
-          // The first Logo.\r
-          //\r
-          LogoDestX = (UINTN) DestX;\r
-          LogoDestY = (UINTN) DestY;\r
-          LogoWidth = Width;\r
-          LogoHeight = Height;\r
-        } else {\r
-          //\r
-          // Merge new logo with old one.\r
-          //\r
-          NewDestX = MIN ((UINTN) DestX, LogoDestX);\r
-          NewDestY = MIN ((UINTN) DestY, LogoDestY);\r
-          NewWidth = MAX ((UINTN) DestX + Width, LogoDestX + LogoWidth) - NewDestX;\r
-          NewHeight = MAX ((UINTN) DestY + Height, LogoDestY + LogoHeight) - NewDestY;\r
-\r
-          LogoDestX = NewDestX;\r
-          LogoDestY = NewDestY;\r
-          LogoWidth = NewWidth;\r
-          LogoHeight = NewHeight;\r
-        }\r
-      }\r
-    }\r
-\r
-    FreePool (ImageData);\r
-\r
-    if (Badging == NULL) {\r
-      break;\r
-    }\r
-  }\r
-\r
-Done:\r
-  if (BootLogo == NULL || NumberOfLogos == 0) {\r
-    //\r
-    // No logo displayed.\r
-    //\r
-    if (Blt != NULL) {\r
-      FreePool (Blt);\r
-    }\r
-\r
-    return Status;\r
-  }\r
-\r
-  //\r
-  // Advertise displayed Logo information.\r
-  //\r
-  if (NumberOfLogos == 1) {\r
-    //\r
-    // Only one logo displayed, use its Blt buffer directly for BootLogo protocol.\r
-    //\r
-    LogoBlt = Blt;\r
-    Status = EFI_SUCCESS;\r
-  } else {\r
-    //\r
-    // More than one Logo displayed, get merged BltBuffer using VideoToBuffer operation.\r
-    //\r
-    if (Blt != NULL) {\r
-      FreePool (Blt);\r
-    }\r
-\r
-    //\r
-    // Ensure the LogoHeight * LogoWidth doesn't overflow\r
-    //\r
-    if (LogoHeight > DivU64x64Remainder ((UINTN) ~0, LogoWidth, NULL)) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-    BufferSize = MultU64x64 (LogoWidth, LogoHeight);\r
-\r
-    //\r
-    // Ensure the BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn't overflow\r
-    //\r
-    if (BufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL))) {\r
-      return EFI_UNSUPPORTED;\r
-    }\r
-\r
-    LogoBlt = AllocateZeroPool ((UINTN)BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));\r
-    if (LogoBlt == NULL) {\r
-      return EFI_OUT_OF_RESOURCES;\r
-    }\r
-\r
-    if (GraphicsOutput != NULL) {\r
-      Status = GraphicsOutput->Blt (\r
-                          GraphicsOutput,\r
-                          LogoBlt,\r
-                          EfiBltVideoToBltBuffer,\r
-                          LogoDestX,\r
-                          LogoDestY,\r
-                          0,\r
-                          0,\r
-                          LogoWidth,\r
-                          LogoHeight,\r
-                          LogoWidth * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)\r
-                          );\r
-    } else if (UgaDraw != NULL && FeaturePcdGet (PcdUgaConsumeSupport)) {\r
-      Status = UgaDraw->Blt (\r
-                          UgaDraw,\r
-                          (EFI_UGA_PIXEL *) LogoBlt,\r
-                          EfiUgaVideoToBltBuffer,\r
-                          LogoDestX,\r
-                          LogoDestY,\r
-                          0,\r
-                          0,\r
-                          LogoWidth,\r
-                          LogoHeight,\r
-                          LogoWidth * sizeof (EFI_UGA_PIXEL)\r
-                          );\r
-    } else {\r
-      Status = EFI_UNSUPPORTED;\r
-    }\r
-  }\r
-\r
-  if (!EFI_ERROR (Status)) {\r
-    BootLogo->SetBootLogo (BootLogo, LogoBlt, LogoDestX, LogoDestY, LogoWidth, LogoHeight);\r
-  }\r
-  FreePool (LogoBlt);\r
-\r
-  return Status;\r
-}\r
-\r
-/**\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
-\r
-**/\r
-EFI_STATUS\r
-DisableQuietBoot (\r
-  VOID\r
-  )\r
-{\r
-\r
-  //\r
-  // Enable Cursor on Screen\r
-  //\r
-  gST->ConOut->EnableCursor (gST->ConOut, TRUE);\r
-  return EFI_SUCCESS;\r
-}\r
-\r
index 1eb5d0bc9bcba2d06b44ca3ac69ed72971b5f445..338c9ba4f8e50fab154b3b4fcf6e60d3ed8aafe3 100644 (file)
@@ -77,6 +77,8 @@
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf\r
+  ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf\r
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {\r
     <LibraryClasses>\r
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {\r
     <LibraryClasses>\r
+      NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf\r
 !ifdef $(CSM_ENABLE)\r
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf\r
       NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf\r
 !ifdef $(CSM_ENABLE)\r
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf\r
       NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf\r
index ea381a023f7e181766b7459560135bc7745690c6..8475280b2cda4f94cfd0b76b5d5c6289a7261bb8 100644 (file)
@@ -82,6 +82,8 @@
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf\r
+  ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf\r
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {\r
     <LibraryClasses>\r
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {\r
     <LibraryClasses>\r
+      NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf\r
 !ifdef $(CSM_ENABLE)\r
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf\r
       NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf\r
 !ifdef $(CSM_ENABLE)\r
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf\r
       NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf\r
index d37a206d52636f98085ec8b8caa70c3e01265623..200c06baaa16fa0cbcb53c9fc873620312f1e466 100644 (file)
@@ -82,6 +82,8 @@
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
   HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf\r
   UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf\r
+  BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf\r
+  ImageDecoderLib|MdeModulePkg/Library/ImageDecoderLib/ImageDecoderLib.inf\r
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {\r
     <LibraryClasses>\r
   PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcatRealTimeClockRuntimeDxe.inf\r
   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf {\r
     <LibraryClasses>\r
+      NULL|MdeModulePkg/Library/BmpImageDecoderLib/BmpImageDecoderLib.inf\r
 !ifdef $(CSM_ENABLE)\r
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf\r
       NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf\r
 !ifdef $(CSM_ENABLE)\r
       NULL|OvmfPkg/Csm/CsmSupportLib/CsmSupportLib.inf\r
       NULL|IntelFrameworkModulePkg/Library/LegacyBootManagerLib/LegacyBootManagerLib.inf\r