]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1.retried graphics library class from MdePkg
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 24 Nov 2008 05:49:59 +0000 (05:49 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 24 Nov 2008 05:49:59 +0000 (05:49 +0000)
2.retried graphics library instance from MdeModulePkg
3.Move EnableQuietBoot(), DisableQuietBoot() and LockKeyboards() into GenericBdsLib

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6691 6f19259b-4bc3-4df7-8a09-765794883524

24 files changed:
DuetPkg/DuetPkg.dsc
DuetPkg/Library/DuetBdsLib/BdsPlatform.h
DuetPkg/Library/DuetBdsLib/PlatformBds.inf
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dsc
MdeModulePkg/Include/Library/GenericBdsLib.h
MdeModulePkg/Library/GenericBdsLib/BdsConsole.c
MdeModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
MdeModulePkg/Library/GenericBdsLib/InternalBdsLib.h
MdeModulePkg/Library/GraphicsLib/Graphics.c [deleted file]
MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf [deleted file]
MdeModulePkg/Library/PlatformBdsLibNull/BdsPlatform.h
MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf
MdeModulePkg/MdeModulePkg.dsc
MdeModulePkg/Universal/BdsDxe/Bds.h
MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
MdeModulePkg/Universal/DebugSupportDxe/Ipf/PlDebugSupport.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
MdeModulePkg/Universal/SetupBrowserDxe/Setup.h
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdePkg/Include/Library/GraphicsLib.h [deleted file]
Nt32Pkg/Library/Nt32BdsLib/BdsPlatform.c
Nt32Pkg/Library/Nt32BdsLib/BdsPlatform.h
Nt32Pkg/Library/Nt32BdsLib/Nt32BdsLib.inf
Nt32Pkg/Nt32Pkg.dsc

index 714cee2f57366ef6c6e547b6598ed0c0d806690a..ab95d883749b0b3ab77f72e69b967863a90888c9 100644 (file)
@@ -36,7 +36,6 @@
   ExtendedIfrSupportLib|MdeModulePkg/Library/ExtendedIfrSupportLib/ExtendedIfrSupportLib.inf\r
   GenericBdsLib|MdeModulePkg/Library/GenericBdsLib/GenericBdsLib.inf\r
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf\r
-  GraphicsLib|MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
   ExtendedHiiLib|MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf\r
index 1110529c9dcf10cc03d58e297f2bc70ddfe9a6ae..9419607410eb99d50cf210c8900c64ce14de645d 100644 (file)
@@ -38,7 +38,6 @@ Abstract:
 #include <Library/PcdLib.h>\r
 #include <Library/GenericBdsLib.h>\r
 #include <Library/PlatformBdsLib.h>\r
-#include <Library/GraphicsLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/DxeServicesTableLib.h>\r
index d92211797e19a01cad56a0e6fc39f2760d119ec4..ab0bd1c5fe7dd2b6b9a55ddff3433ac7943304b1 100644 (file)
@@ -47,7 +47,6 @@
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
-  GraphicsLib\r
   GenericBdsLib\r
   HobLib\r
   UefiLib\r
index 94d0937af904f7ae1b32d78a6edc79d63988826e..e18e6da19cd952a06fedccb7a7a286eb291862a3 100644 (file)
@@ -83,7 +83,6 @@
   FrameworkIfrSupportLib|IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf\r
   PciIncompatibleDeviceSupportLib|IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf\r
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
-  GraphicsLib|MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
   \r
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]\r
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf\r
   FrameworkIfrSupportLib|IntelFrameworkPkg/Library/FrameworkIfrSupportLib/IfrSupportLib.inf\r
   PciIncompatibleDeviceSupportLib|IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf\r
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
-  GraphicsLib|MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
 \r
 ################################################################################\r
 #\r
index fd46f8af74d386831493e0efd6a1bae1a88f73b9..0dc18df735f68335bb0723f35ceeab0d89f59e00 100644 (file)
@@ -1053,5 +1053,54 @@ CatPrint (
   IN CHAR16           *fmt,\r
   ...\r
   );\r
+\r
+/**\r
+  Use Console Control to turn off UGA based Simple Text Out consoles from going\r
+  to the UGA device. Put up LogoFile on every UGA 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
+EFIAPI\r
+EnableQuietBoot (\r
+  IN  EFI_GUID  *LogoFile\r
+  );\r
+\r
+\r
+/**\r
+  Use Console Control to turn on UGA based Simple Text Out consoles. The UGA \r
+  Simple Text Out screens will now be synced up with all non UGA output devices\r
+\r
+  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DisableQuietBoot (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Use Console Control Protocol to lock the Console In Spliter virtual handle. \r
+  This is the ConInHandle and ConIn handle in the EFI system table. All key\r
+  presses will be ignored until the Password is typed in. The only way to\r
+  disable the password is to type it in to a ConIn device.\r
+\r
+  @param  Password        Password used to lock ConIn device.\r
+\r
+  @retval EFI_SUCCESS     lock the Console In Spliter virtual handle successfully.\r
+  @retval EFI_UNSUPPORTED Password not found\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LockKeyboards (\r
+  IN  CHAR16    *Password\r
+  );\r
+\r
 #endif\r
 \r
index 376a3187be3f03dde6315b2ae1cd38f543f3618e..999de49ba3507bb5758df5eb93f7b71114945611 100644 (file)
@@ -405,3 +405,496 @@ BdsLibConnectAllDefaultConsoles (
   return EFI_SUCCESS;\r
 \r
 }\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
+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
+  UINTN                         BltBufferSize;\r
+  UINTN                         Index;\r
+  UINTN                         Height;\r
+  UINTN                         Width;\r
+  UINTN                         ImageIndex;\r
+  BOOLEAN                       IsAllocated;\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
+  // Calculate Color Map offset in the image.\r
+  //\r
+  Image       = BmpImage;\r
+  BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));\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 = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
+  IsAllocated   = FALSE;\r
+  if (*GopBlt == NULL) {\r
+    //\r
+    // GopBlt is not allocated by caller.\r
+    //\r
+    *GopBltSize = 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 < BltBufferSize) {\r
+      *GopBltSize = 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
+        break;\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
+/**\r
+  Use Console Control Protocol to lock the Console In Spliter virtual handle. \r
+  This is the ConInHandle and ConIn handle in the EFI system table. All key\r
+  presses will be ignored until the Password is typed in. The only way to\r
+  disable the password is to type it in to a ConIn device.\r
+\r
+  @param  Password        Password used to lock ConIn device.\r
+\r
+  @retval EFI_SUCCESS     lock the Console In Spliter virtual handle successfully.\r
+  @retval EFI_UNSUPPORTED Password not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+LockKeyboards (\r
+  IN  CHAR16    *Password\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  Status = ConsoleControl->LockStdIn (ConsoleControl, Password);\r
+  return Status;\r
+}\r
+\r
+\r
+/**\r
+  Use Console Control to turn off UGA based Simple Text Out consoles from going\r
+  to the UGA device. Put up LogoFile on every UGA device that is a console.\r
+\r
+  @param  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
+EFIAPI\r
+EnableQuietBoot (\r
+  IN  EFI_GUID  *LogoFile   OPTIONAL\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\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
+\r
+  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\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
+  Badging = NULL;\r
+  Status  = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);\r
+\r
+  //\r
+  // Set console control to graphics mode.\r
+  //\r
+  Status = ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  if (GraphicsOutput != NULL) {\r
+    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
+    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
+  } else if (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
+  Instance = 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
+        return Status;\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
+      Attribute   = EfiBadgingDisplayAttributeCenter;\r
+    }\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
+      if (ImageData != NULL) {\r
+        FreePool (ImageData);\r
+      }\r
+      if (Badging == NULL) {\r
+        return Status;\r
+      } else {\r
+        continue;\r
+      }\r
+    }\r
+\r
+    //\r
+    // Caculate 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
+    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 (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
+    if (ImageData != NULL) {\r
+      FreePool (ImageData);\r
+    }\r
+    if (Blt != NULL) {\r
+      FreePool (Blt);\r
+    }\r
+\r
+    if (Badging == NULL) {\r
+      break;\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Use Console Control to turn on UGA based Simple Text Out consoles. The UGA \r
+  Simple Text Out screens will now be synced up with all non UGA output devices\r
+\r
+  @retval EFI_SUCCESS          UGA devices are back in text mode and synced up.\r
+  @retval EFI_UNSUPPORTED      Logo not found\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DisableQuietBoot (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS                    Status;\r
+  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
+\r
+  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
+  //\r
+  // Set console control to text mode.\r
+  //\r
+  return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
+}\r
+\r
index ea59766e498cb1c8f28931b2d4e015e1468bb091..34100d2668513cdabaa975d650b87c076d77db32 100644 (file)
@@ -68,7 +68,8 @@
   PcdLib\r
   PerformanceLib\r
   TimerLib\r
-\r
+  PcdLib\r
+  DxeServicesLib\r
 \r
 [Guids]\r
   gEfiVT100PlusGuid                             # ALWAYS_CONSUMED\r
   gEfiDebugPortProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED\r
   gEfiSimpleTextInProtocolGuid                  # PROTOCOL ALWAYS_CONSUMED\r
   gEfiBlockIoProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiFirmwareVolume2ProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiFirmwareVolume2ProtocolGuid               # PROTOCOL ALWAYS_CONSUMED\r
   gEfiLegacyBiosProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiCpuArchProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
   gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
   gEfiFirmwareVolumeDispatchProtocolGuid        # PROTOCOL ALWAYS_CONSUMED\r
   gEfiAcpiS3SaveProtocolGuid\r
+  gEfiGraphicsOutputProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiUgaDrawProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiConsoleControlProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiOEMBadgingProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiHiiFontProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
+\r
+[FeaturePcd.common]\r
+  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
 \r
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPlatformBootTimeOutDefault\r
index a0defe6376ecfb33b7062cf3cb0b7127792a3ea0..b1bf7fcdda01a04adc98f079a4d730bf0f7ba8e9 100644 (file)
@@ -35,6 +35,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/AcpiS3Save.h>\r
 #include <Protocol/Performance.h>\r
 #include <Protocol/FirmwareVolumeDispatch.h>\r
+#include <Protocol/OEMBadging.h>\r
+#include <Protocol/ConsoleControl.h>\r
+#include <Protocol/GraphicsOutput.h>\r
+#include <Protocol/UgaDraw.h>\r
+#include <Protocol/HiiFont.h>\r
+#include <Protocol/HiiImage.h>\r
+\r
 \r
 #include <Guid/MemoryTypeInformation.h>\r
 #include <Guid/FileInfo.h>\r
@@ -42,6 +49,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/PcAnsi.h>\r
 #include <Guid/ShellFile.h>\r
 #include <Guid/GenericPlatformVariable.h>\r
+#include <Guid/Bmp.h>\r
 \r
 #include <Library/PrintLib.h>\r
 #include <Library/DebugLib.h>\r
@@ -60,6 +68,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PeCoffGetEntryPointLib.h>\r
 #include <Library/GenericBdsLib.h>\r
 #include <Library/TimerLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/DxeServicesLib.h>\r
 \r
 #define PERFORMANCE_SIGNATURE   EFI_SIGNATURE_32 ('P', 'e', 'r', 'f')\r
 #define PERF_TOKEN_SIZE         28\r
diff --git a/MdeModulePkg/Library/GraphicsLib/Graphics.c b/MdeModulePkg/Library/GraphicsLib/Graphics.c
deleted file mode 100644 (file)
index 9907a89..0000000
+++ /dev/null
@@ -1,556 +0,0 @@
-/** @file\r
-  Library supports diplaying graphical splash screen,\r
-  locking of keyboard input and printing character on\r
-  screen. These basic graphics operations are based on UEFI HII, \r
-  Graphics Output protocol or UGA Draw protocol.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation\r
-All rights reserved. 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
-\r
-#include <PiDxe.h>\r
-\r
-#include <Protocol/SimpleTextOut.h>\r
-#include <Protocol/OEMBadging.h>\r
-#include <Protocol/ConsoleControl.h>\r
-#include <Protocol/GraphicsOutput.h>\r
-#include <Protocol/UgaDraw.h>\r
-#include <Protocol/HiiFont.h>\r
-#include <Protocol/HiiImage.h>\r
-\r
-#include <Guid/Bmp.h>\r
-\r
-#include <Library/GraphicsLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/DxeServicesLib.h>\r
-#include <Library/PcdLib.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
-EFI_STATUS\r
-EFIAPI\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
-  UINTN                         BltBufferSize;\r
-  UINTN                         Index;\r
-  UINTN                         Height;\r
-  UINTN                         Width;\r
-  UINTN                         ImageIndex;\r
-  BOOLEAN                       IsAllocated;\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
-  // Calculate Color Map offset in the image.\r
-  //\r
-  Image       = BmpImage;\r
-  BmpColorMap = (BMP_COLOR_MAP *) (Image + sizeof (BMP_IMAGE_HEADER));\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 = BmpHeader->PixelWidth * BmpHeader->PixelHeight * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);\r
-  IsAllocated   = FALSE;\r
-  if (*GopBlt == NULL) {\r
-    //\r
-    // GopBlt is not allocated by caller.\r
-    //\r
-    *GopBltSize = 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 < BltBufferSize) {\r
-      *GopBltSize = 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
-        break;\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
-/**\r
-  Use Console Control Protocol to lock the Console In Spliter virtual handle. \r
-  This is the ConInHandle and ConIn handle in the EFI system table. All key\r
-  presses will be ignored until the Password is typed in. The only way to\r
-  disable the password is to type it in to a ConIn device.\r
-\r
-  @param  Password        Password used to lock ConIn device.\r
-\r
-  @retval EFI_SUCCESS     lock the Console In Spliter virtual handle successfully.\r
-  @retval EFI_UNSUPPORTED Password not found.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LockKeyboards (\r
-  IN  CHAR16    *Password\r
-  )\r
-{\r
-  EFI_STATUS                    Status;\r
-  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
-\r
-  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  Status = ConsoleControl->LockStdIn (ConsoleControl, Password);\r
-  return Status;\r
-}\r
-\r
-\r
-/**\r
-  Use Console Control to turn off UGA based Simple Text Out consoles from going\r
-  to the UGA device. Put up LogoFile on every UGA device that is a console.\r
-\r
-  @param  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
-EFIAPI\r
-EnableQuietBoot (\r
-  IN  EFI_GUID  *LogoFile\r
-  )\r
-{\r
-  return EnableQuietBootEx (LogoFile, NULL);\r
-}\r
-\r
-/**\r
-  Use Console Control to turn off UGA based Simple Text Out consoles from going\r
-  to the UGA device. Put up LogoFile on every UGA device that is a console\r
-\r
-  @param  LogoFile    File name of logo to display on the center of the screen.\r
-  @param  ImageHandle The driver image handle of the caller. The parameter is used to\r
-                      optimize the loading of the logo file so that the FV from which\r
-                      the driver image is loaded will be tried first.\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
-EFIAPI\r
-EnableQuietBootEx (\r
-  IN  EFI_GUID    *LogoFile,\r
-  IN  EFI_HANDLE  ImageHandle\r
-  )\r
-{\r
-  EFI_STATUS                    Status;\r
-  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\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
-\r
-  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\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
-  Badging = NULL;\r
-  Status  = gBS->LocateProtocol (&gEfiOEMBadgingProtocolGuid, NULL, (VOID **) &Badging);\r
-\r
-  //\r
-  // Set console control to graphics mode.\r
-  //\r
-  Status = ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenGraphics);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  if (GraphicsOutput != NULL) {\r
-    SizeOfX = GraphicsOutput->Mode->Info->HorizontalResolution;\r
-    SizeOfY = GraphicsOutput->Mode->Info->VerticalResolution;\r
-  } else if (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
-  Instance = 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
-        return Status;\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
-      Attribute   = EfiBadgingDisplayAttributeCenter;\r
-    }\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
-      if (ImageData != NULL) {\r
-        FreePool (ImageData);\r
-      }\r
-      if (Badging == NULL) {\r
-        return Status;\r
-      } else {\r
-        continue;\r
-      }\r
-    }\r
-\r
-    //\r
-    // Caculate 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
-    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 (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
-    if (ImageData != NULL) {\r
-      FreePool (ImageData);\r
-    }\r
-    if (Blt != NULL) {\r
-      FreePool (Blt);\r
-    }\r
-\r
-    if (Badging == NULL) {\r
-      break;\r
-    }\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
-/**\r
-  Use Console Control to turn on UGA based Simple Text Out consoles. The UGA \r
-  Simple Text Out screens will now be synced up with all non UGA output devices\r
-\r
-  @retval EFI_SUCCESS          UGA devices are back in text mode and synced up.\r
-  @retval EFI_UNSUPPORTED      Logo not found\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DisableQuietBoot (\r
-  VOID\r
-  )\r
-{\r
-  EFI_STATUS                    Status;\r
-  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
-\r
-  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
-  if (EFI_ERROR (Status)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-\r
-  //\r
-  // Set console control to text mode.\r
-  //\r
-  return ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
-}\r
-\r
diff --git a/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf b/MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf
deleted file mode 100644 (file)
index 7fb759a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#/** @file\r
-#   Library supports diplaying graphical splash screen,\r
-#   locking of keyboard input and printing character on\r
-#   screen.\r
-#\r
-# This library provides supports for basic graphic functions.\r
-# Copyright (c) 2006 - 2007, Intel Corporation.\r
-#\r
-#  All rights reserved. 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
-#  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
-\r
-[Defines]\r
-  INF_VERSION                    = 0x00010005\r
-  BASE_NAME                      = UefiGraphicsLib\r
-  FILE_GUID                      = 08c1a0e4-1208-47f8-a2c5-f42eabee653a\r
-  MODULE_TYPE                    = DXE_DRIVER\r
-  VERSION_STRING                 = 1.0\r
-  LIBRARY_CLASS                  = GraphicsLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER\r
-  EDK_RELEASE_VERSION            = 0x00020000\r
-  EFI_SPECIFICATION_VERSION      = 0x00020000\r
-\r
-\r
-#\r
-# The following information is for reference only and not required by the build tools.\r
-#\r
-#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
-#\r
-\r
-[Sources.common]\r
-  Graphics.c\r
-\r
-[Packages]\r
-  MdePkg/MdePkg.dec\r
-  MdeModulePkg/MdeModulePkg.dec\r
-\r
-[LibraryClasses]\r
-  UefiBootServicesTableLib\r
-  MemoryAllocationLib\r
-  BaseLib\r
-  PrintLib\r
-  DebugLib\r
-  DxeServicesLib\r
-  BaseMemoryLib\r
-  PcdLib\r
-\r
-[Protocols]\r
-  gEfiSimpleTextOutProtocolGuid                 # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiGraphicsOutputProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiUgaDrawProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiConsoleControlProtocolGuid                # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiOEMBadgingProtocolGuid                    # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiHiiFontProtocolGuid                       # PROTOCOL ALWAYS_CONSUMED\r
-\r
-[FeaturePcd.common]\r
-  gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport\r
index cc90974ee80475bd49ad70bf5dc1e3f8b854a78b..c25735117d66acb57504fa227200797270756fb5 100644 (file)
@@ -25,6 +25,5 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/PcdLib.h>\r
 #include <Library/GenericBdsLib.h>\r
 #include <Library/PlatformBdsLib.h>\r
-#include <Library/GraphicsLib.h>\r
 \r
 #endif // _BDS_PLATFORM_H\r
index 23498054107c0b9219469656ac7d029cd77872fa..630680e0aa12a92c69952f8bf877e1042342de25 100644 (file)
@@ -46,5 +46,4 @@
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
-  GraphicsLib\r
   GenericBdsLib\r
index 1676227dd7b0d6b767acbcd25a79d04c542f5854..d115aecda4ab0ea15f7fca6b18b356d0a7a432e2 100644 (file)
@@ -68,7 +68,6 @@
   UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf\r
   DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf\r
   PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
-  GraphicsLib|MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
   IfrSupportLib|MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrSupportLib.inf\r
   ExtendedIfrSupportLib|MdeModulePkg/Library/ExtendedIfrSupportLib/ExtendedIfrSupportLib.inf\r
   CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf\r
   MdeModulePkg/Library/PeiS3LibNull/PeiS3LibNull.inf\r
   MdeModulePkg/Library/PlatformBdsLibNull/PlatformBdsLibNull.inf\r
   MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
-  MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
   MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf\r
   MdeModulePkg/Library/UefiIfrSupportLib/UefiIfrSupportLib.inf\r
 \r
index aacffc461e5764a51a7e15d09e03735889066847..b02dfc0c8ec4c4f0db428c2dc25142c999313bd6 100644 (file)
@@ -54,7 +54,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/UefiLib.h>\r
-#include <Library/GraphicsLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PerformanceLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
index bc1311c2bec4c0282a082bfdf2295ba8d0678e62..ac6cee13d71efe0f1cab5eb8607abb96eefdac1f 100644 (file)
@@ -95,7 +95,6 @@
   ReportStatusCodeLib\r
   PerformanceLib\r
   MemoryAllocationLib\r
-  GraphicsLib\r
   UefiLib\r
   UefiBootServicesTableLib\r
   BaseMemoryLib\r
index 5402e04041ca873edb7f309992481ec7fba05d45..b4b078cb5787838f52ffb16693ef15669e9c1cdb 100644 (file)
@@ -145,7 +145,7 @@ PlInitializeDebugSupportDriver (
   VOID\r
   )\r
 {\r
-  SetMem (IvtEntryTable, sizeof (IvtEntryTable), 0);\r
+  ZeroMem (IvtEntryTable, sizeof (IvtEntryTable));\r
   ExternalInterruptCount = 0;\r
   return EFI_SUCCESS;\r
 }\r
@@ -307,7 +307,7 @@ ManageIvtEntryTable (
       //\r
       // re-init IvtEntryTable\r
       //\r
-      SetMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY), 0);\r
+      ZeroMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY));\r
     }\r
   } else {\r
     //\r
index ba391143e61c16e0c06546152c997b025837d84f..c1a79ab951b8d79563a6558cb7239e679b32ddbb 100644 (file)
@@ -217,10 +217,11 @@ SendForm (
   OUT EFI_BROWSER_ACTION_REQUEST       *ActionRequest  OPTIONAL\r
   )\r
 {\r
-  EFI_STATUS            Status;\r
-  UI_MENU_SELECTION     *Selection;\r
-  UINTN                 Index;\r
-  FORM_BROWSER_FORMSET  *FormSet;\r
+  EFI_STATUS                    Status;\r
+  UI_MENU_SELECTION             *Selection;\r
+  UINTN                         Index;\r
+  FORM_BROWSER_FORMSET          *FormSet;\r
+  EFI_CONSOLE_CONTROL_PROTOCOL  *ConsoleControl;\r
 \r
   Status = EFI_SUCCESS;\r
   ZeroMem (&gScreenDimensions, sizeof (EFI_SCREEN_DESCRIPTOR));\r
@@ -282,7 +283,15 @@ SendForm (
   // Ensure we are in Text mode\r
   //\r
   gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, EFI_BLACK));\r
-  DisableQuietBoot ();\r
+\r
+  Status = gBS->LocateProtocol (&gEfiConsoleControlProtocolGuid, NULL, (VOID **) &ConsoleControl);\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+  //\r
+  // Set console control to text mode.\r
+  //\r
+  ConsoleControl->SetMode (ConsoleControl, EfiConsoleControlScreenText);\r
 \r
   for (Index = 0; Index < HandleCount; Index++) {\r
     Selection = AllocateZeroPool (sizeof (UI_MENU_SELECTION));\r
index 73669735c0bb7fca77bbf97c12af3d86a001228f..ac419d1465e53a818fc910f63fb48666db6633a4 100644 (file)
@@ -30,10 +30,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/HiiConfigRouting.h>\r
 #include <Protocol/HiiDatabase.h>\r
 #include <Protocol/HiiString.h>\r
+#include <Protocol/ConsoleControl.h>\r
 \r
 #include <MdeModuleHii.h>\r
 \r
-#include <Library/GraphicsLib.h>\r
 #include <Library/PrintLib.h>\r
 #include <Library/DebugLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
index 190b80c1e91c951bb2e9111dcc7fd9d71f9d5a65..2b6f72aa4efe4fc213e4455ed40f3e3d7ee60886 100644 (file)
@@ -62,7 +62,6 @@
   BaseMemoryLib\r
   DebugLib\r
   PrintLib\r
-  GraphicsLib\r
   IfrSupportLib\r
   HiiLib\r
   ExtendedHiiLib\r
@@ -76,6 +75,7 @@
   gEfiHiiConfigRoutingProtocolGuid\r
   gEfiHiiDatabaseProtocolGuid\r
   gEfiUnicodeCollation2ProtocolGuid\r
+  gEfiConsoleControlProtocolGuid\r
 \r
 [FeaturePcd.common]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkHiiCompatibilitySupport\r
diff --git a/MdePkg/Include/Library/GraphicsLib.h b/MdePkg/Include/Library/GraphicsLib.h
deleted file mode 100644 (file)
index 3f31d88..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/** @file\r
-  Library supports displaying graphical splash screen,\r
-  locking of keyboard input and printing character on\r
-  screen.\r
-\r
-  Copyright (c) 2006 - 2008, Intel Corporation.<BR>\r
-  All rights reserved. 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
-#ifndef __EFI_GRAPHICS_LIB_H__\r
-#define __EFI_GRAPHICS_LIB_H__\r
-\r
-\r
-/**\r
-  Use Console Control to turn off UGA based Simple Text Out consoles from going\r
-  to the UGA device. Put up LogoFile on every UGA 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
-EFIAPI\r
-EnableQuietBoot (\r
-  IN  EFI_GUID  *LogoFile\r
-  );\r
-\r
-/**\r
-  Use Console Control to turn off GOP/UGA based Simple Text Out consoles from going\r
-  to the UGA device. Put up LogoFile on every UGA device that is a console\r
-\r
-  @param  LogoFile    File name of logo to display on the center of the screen.\r
-  @param  ImageHandle The driver image handle of the caller. The parameter is used to\r
-                      optimize the loading of the logo file so that the FV from which\r
-                      the driver image is loaded will be tried first.\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
-EFIAPI\r
-EnableQuietBootEx (\r
-  IN  EFI_GUID    *LogoFile,\r
-  IN  EFI_HANDLE  ImageHandle\r
-  );\r
-\r
-\r
-/**\r
-  Use Console Control to turn on UGA based Simple Text Out consoles. The UGA \r
-  Simple Text Out screens will now be synced up with all non UGA output devices\r
-\r
-  @retval EFI_SUCCESS     UGA devices are back in text mode and synced up.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-DisableQuietBoot (\r
-  VOID\r
-  );\r
-\r
-\r
-/**\r
-  Use Console Control Protocol to lock the Console In Spliter virtual handle. \r
-  This is the ConInHandle and ConIn handle in the EFI system table. All key\r
-  presses will be ignored until the Password is typed in. The only way to\r
-  disable the password is to type it in to a ConIn device.\r
-\r
-  @param[in]  Password   Password used to lock ConIn device.\r
-\r
-  @retval EFI_SUCCESS     lock the Console In Spliter virtual handle successfully.\r
-  @retval EFI_UNSUPPORTED Password not found\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-LockKeyboards (\r
-  IN  CHAR16    *Password\r
-  );\r
-\r
-#endif\r
index 814f71a41b864a2eb33847860cf75d2b21cc26d8..6970ceb0080f4ea8b37fcb6090a11471404c2066 100644 (file)
@@ -244,7 +244,7 @@ Returns:
   // from the graphic lib\r
   //\r
   if (QuietBoot) {\r
-    EnableQuietBootEx (&gEfiDefaultBmpLogoGuid, mBdsImageHandle);\r
+    EnableQuietBoot (&gEfiDefaultBmpLogoGuid);\r
     //\r
     // Perform system diagnostic\r
     //\r
index 7487cb883016e51f06a22450d5bbab8706b6cd71..5188ba51c9726dee9096262ad1fc2b458c71c56c 100644 (file)
@@ -32,7 +32,6 @@ Abstract:
 #include <Library/PcdLib.h>\r
 #include <Library/GenericBdsLib.h>\r
 #include <Library/PlatformBdsLib.h>\r
-#include <Library/GraphicsLib.h>\r
 #include <Library/DevicePathLib.h>\r
 \r
 #include <Protocol/WinNtThunk.h>\r
index f1fc9c89560d8a3135a75adcf1456a044bf237a2..53efebdeddb789506e8d6e04de19abfbfc02e1d6 100644 (file)
@@ -49,7 +49,6 @@
   BaseMemoryLib\r
   DebugLib\r
   PcdLib\r
-  GraphicsLib\r
   GenericBdsLib\r
 \r
 [Guids]\r
index f34553f8ee978f9d0489fb93b182d96234481b13..13b6f3106b87a01502db5df0040709b1fd67bf52 100644 (file)
@@ -60,7 +60,6 @@
   PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf\r
   PciIncompatibleDeviceSupportLib|IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf\r
   CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf\r
-  GraphicsLib|MdeModulePkg/Library/GraphicsLib/GraphicsLib.inf\r
   FvbServiceLib|MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
   IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf\r
   UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf\r