]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/BootGraphicsResourceDxe: Add Boot Logo 2 Protocol
authorMichael D Kinney <michael.d.kinney@intel.com>
Tue, 2 Jan 2018 16:46:58 +0000 (08:46 -0800)
committerMichael D Kinney <michael.d.kinney@intel.com>
Wed, 28 Feb 2018 19:58:27 +0000 (11:58 -0800)
https://bugzilla.tianocore.org/show_bug.cgi?id=799

Based on content from the following branch/commit:
https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport
https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2e60302b2d

Update BootGraphicsResourceDxe to produce both the Boot Logo
Protocol and the Boot Logo 2 Protocol.

The Boot Logo 2 Protocol service GetBootLogo() is amended
to return the pointer to the GOP BLT buffer previously
registered with the SetBootLogo() service.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c
MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf

index 118fb4a922d73e1fe65113bb0ac38007dbd2dc0c..cfd4be0ebfa25e5e2acf647b302fab06e8fad9ff 100644 (file)
@@ -2,6 +2,7 @@
   This module install ACPI Boot Graphics Resource Table (BGRT).\r
 \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\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
@@ -18,6 +19,7 @@
 #include <Protocol/AcpiTable.h>\r
 #include <Protocol/GraphicsOutput.h>\r
 #include <Protocol/BootLogo.h>\r
+#include <Protocol/BootLogo2.h>\r
 \r
 #include <Guid/EventGroup.h>\r
 \r
 /**\r
   Update information of logo image drawn on screen.\r
 \r
-  @param  This           The pointer to the Boot Logo protocol instance.\r
-  @param  BltBuffer      The BLT buffer for logo drawn on screen. If BltBuffer\r
-                         is set to NULL, it indicates that logo image is no\r
-                         longer on the screen.\r
-  @param  DestinationX   X coordinate of destination for the BltBuffer.\r
-  @param  DestinationY   Y coordinate of destination for the BltBuffer.\r
-  @param  Width          Width of rectangle in BltBuffer in pixels.\r
-  @param  Height         Hight of rectangle in BltBuffer in pixels.\r
-\r
-  @retval EFI_SUCCESS             The boot logo information was updated.\r
-  @retval EFI_INVALID_PARAMETER   One of the parameters has an invalid value.\r
-  @retval EFI_OUT_OF_RESOURCES    The logo information was not updated due to\r
-                                  insufficient memory resources.\r
-\r
+  @param[in] This          The pointer to the Boot Logo protocol 2 instance.\r
+  @param[in] BltBuffer     The BLT buffer for logo drawn on screen. If BltBuffer\r
+                           is set to NULL, it indicates that logo image is no\r
+                           longer on the screen.\r
+  @param[in] DestinationX  X coordinate of destination for the BltBuffer.\r
+  @param[in] DestinationY  Y coordinate of destination for the BltBuffer.\r
+  @param[in] Width         Width of rectangle in BltBuffer in pixels.\r
+  @param[in] Height        Hight of rectangle in BltBuffer in pixels.\r
+\r
+  @retval EFI_SUCCESS            The boot logo information was updated.\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value.\r
+  @retval EFI_OUT_OF_RESOURCES   The logo information was not updated due to\r
+                                 insufficient memory resources.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -59,6 +60,69 @@ SetBootLogo (
   IN UINTN                          Height\r
   );\r
 \r
+/**\r
+  Update information of logo image drawn on screen.\r
+\r
+  @param[in] This          The pointer to the Boot Logo protocol 2 instance.\r
+  @param[in] BltBuffer     The BLT buffer for logo drawn on screen. If BltBuffer\r
+                           is set to NULL, it indicates that logo image is no\r
+                           longer on the screen.\r
+  @param[in] DestinationX  X coordinate of destination for the BltBuffer.\r
+  @param[in] DestinationY  Y coordinate of destination for the BltBuffer.\r
+  @param[in] Width         Width of rectangle in BltBuffer in pixels.\r
+  @param[in] Height        Hight of rectangle in BltBuffer in pixels.\r
+\r
+  @retval EFI_SUCCESS            The boot logo information was updated.\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value.\r
+  @retval EFI_OUT_OF_RESOURCES   The logo information was not updated due to\r
+                                 insufficient memory resources.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SetBootLogo2 (\r
+  IN EDKII_BOOT_LOGO2_PROTOCOL      *This,\r
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltBuffer       OPTIONAL,\r
+  IN UINTN                          DestinationX,\r
+  IN UINTN                          DestinationY,\r
+  IN UINTN                          Width,\r
+  IN UINTN                          Height\r
+  );\r
+\r
+/**\r
+  Get the location of the boot logo on the screen.\r
+\r
+  @param[in]  This          The pointer to the Boot Logo Protocol 2 instance\r
+  @param[out] BltBuffer     Returns pointer to the GOP BLT buffer that was\r
+                            previously registered with SetBootLogo2(). The\r
+                            buffer returned must not be modified or freed.\r
+  @param[out] DestinationX  Returns the X start position of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+  @param[out] DestinationY  Returns the Y start position of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+  @param[out] Width         Returns the width of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+  @param[out] Height        Returns the height of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+\r
+  @retval EFI_SUCCESS            The location of the boot logo was returned.\r
+  @retval EFI_NOT_READY          The boot logo has not been set.\r
+  @retval EFI_INVALID_PARAMETER  BltBuffer is NULL.\r
+  @retval EFI_INVALID_PARAMETER  DestinationX is NULL.\r
+  @retval EFI_INVALID_PARAMETER  DestinationY is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Width is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Height is NULL.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetBootLogo2 (\r
+  IN  EDKII_BOOT_LOGO2_PROTOCOL      *This,\r
+  OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  **BltBuffer,\r
+  OUT UINTN                          *DestinationX,\r
+  OUT UINTN                          *DestinationY,\r
+  OUT UINTN                          *Width,\r
+  OUT UINTN                          *Height\r
+  );\r
+\r
 //\r
 // Boot Logo Protocol Handle\r
 //\r
@@ -71,6 +135,14 @@ EFI_BOOT_LOGO_PROTOCOL  mBootLogoProtocolTemplate = {
   SetBootLogo\r
 };\r
 \r
+///\r
+/// Boot Logo 2 Protocol instance\r
+///\r
+EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = {\r
+  SetBootLogo2,\r
+  GetBootLogo2\r
+};\r
+\r
 EFI_EVENT                      mBootGraphicsReadyToBootEvent;\r
 UINTN                          mBootGraphicsResourceTableKey = 0;\r
 BOOLEAN                        mIsLogoValid = FALSE;\r
@@ -137,6 +209,47 @@ SetBootLogo (
   IN UINTN                             Width,\r
   IN UINTN                             Height\r
   )\r
+{\r
+  //\r
+  // Call same service in Boot Logo 2 Protocol\r
+  //\r
+  return SetBootLogo2 (\r
+           &mBootLogo2ProtocolTemplate,\r
+           BltBuffer,\r
+           DestinationX,\r
+           DestinationY,\r
+           Width,\r
+           Height\r
+           );\r
+}\r
+\r
+/**\r
+  Update information of logo image drawn on screen.\r
+\r
+  @param[in] This          The pointer to the Boot Logo protocol 2 instance.\r
+  @param[in] BltBuffer     The BLT buffer for logo drawn on screen. If BltBuffer\r
+                           is set to NULL, it indicates that logo image is no\r
+                           longer on the screen.\r
+  @param[in] DestinationX  X coordinate of destination for the BltBuffer.\r
+  @param[in] DestinationY  Y coordinate of destination for the BltBuffer.\r
+  @param[in] Width         Width of rectangle in BltBuffer in pixels.\r
+  @param[in] Height        Hight of rectangle in BltBuffer in pixels.\r
+\r
+  @retval EFI_SUCCESS            The boot logo information was updated.\r
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value.\r
+  @retval EFI_OUT_OF_RESOURCES   The logo information was not updated due to\r
+                                 insufficient memory resources.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SetBootLogo2 (\r
+  IN EDKII_BOOT_LOGO2_PROTOCOL      *This,\r
+  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL  *BltBuffer       OPTIONAL,\r
+  IN UINTN                          DestinationX,\r
+  IN UINTN                          DestinationY,\r
+  IN UINTN                          Width,\r
+  IN UINTN                          Height\r
+  )\r
 {\r
   EFI_STATUS  Status;\r
   UINTN       BufferSize;\r
@@ -227,6 +340,71 @@ SetBootLogo (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Get the location of the boot logo on the screen.\r
+\r
+  @param[in]  This          The pointer to the Boot Logo Protocol 2 instance\r
+  @param[out] BltBuffer     Returns pointer to the GOP BLT buffer that was\r
+                            previously registered with SetBootLogo2(). The\r
+                            buffer returned must not be modified or freed.\r
+  @param[out] DestinationX  Returns the X start position of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+  @param[out] DestinationY  Returns the Y start position of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+  @param[out] Width         Returns the width of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+  @param[out] Height        Returns the height of the GOP BLT buffer\r
+                            that was previously registered with SetBootLogo2().\r
+\r
+  @retval EFI_SUCCESS            The location of the boot logo was returned.\r
+  @retval EFI_NOT_READY          The boot logo has not been set.\r
+  @retval EFI_INVALID_PARAMETER  BltBuffer is NULL.\r
+  @retval EFI_INVALID_PARAMETER  DestinationX is NULL.\r
+  @retval EFI_INVALID_PARAMETER  DestinationY is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Width is NULL.\r
+  @retval EFI_INVALID_PARAMETER  Height is NULL.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetBootLogo2 (\r
+  IN  EDKII_BOOT_LOGO2_PROTOCOL      *This,\r
+  OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL  **BltBuffer,\r
+  OUT UINTN                          *DestinationX,\r
+  OUT UINTN                          *DestinationY,\r
+  OUT UINTN                          *Width,\r
+  OUT UINTN                          *Height\r
+  )\r
+{\r
+  //\r
+  // If the boot logo has not been set with SetBootLogo() or SetBootLogo() was\r
+  // called with a NULL BltBuffer then the boot logo is not valid and\r
+  // EFI_NOT_READY is returned.\r
+  //\r
+  if (mLogoBltBuffer == NULL) {\r
+    DEBUG ((DEBUG_ERROR, "Request to get boot logo location before boot logo has been set.\n"));\r
+    return EFI_NOT_READY;\r
+  }\r
+\r
+  //\r
+  // Make sure none of the boot logo location parameters are NULL.\r
+  //\r
+  if (BltBuffer == NULL || DestinationX == NULL || DestinationY == NULL ||\r
+      Width == NULL || Height == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Boot logo is valid.  Return values from module globals.\r
+  //\r
+  *BltBuffer    = mLogoBltBuffer;\r
+  *DestinationX = mLogoDestX;\r
+  *DestinationY = mLogoDestY;\r
+  *Width        = mLogoWidth;\r
+  *Height       = mLogoHeight;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
 /**\r
   Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to\r
   install the Boot Graphics Resource Table.\r
@@ -401,12 +579,14 @@ BootGraphicsDxeEntryPoint (
   Header->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);\r
 \r
   //\r
-  // Install Boot Logo protocol.\r
+  // Install Boot Logo and Boot Logo 2 Protocols.\r
   //\r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &mBootLogoHandle,\r
                   &gEfiBootLogoProtocolGuid,\r
                   &mBootLogoProtocolTemplate,\r
+                  &gEdkiiBootLogo2ProtocolGuid,\r
+                  &mBootLogo2ProtocolTemplate,\r
                   NULL\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
index ff33405acddc41ef8a9d7cce72b0ebb16a6633b5..bc1c10e981628004ba22c1ab5b5ee5a9801ad1dc 100644 (file)
@@ -2,6 +2,7 @@
 #  This module install ACPI Boot Graphics Resource Table (BGRT).\r
 #\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\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
@@ -49,6 +50,7 @@
 [Protocols]\r
   gEfiAcpiTableProtocolGuid                     ## CONSUMES\r
   gEfiBootLogoProtocolGuid                      ## PRODUCES\r
+  gEdkiiBootLogo2ProtocolGuid                   ## PRODUCES\r
 \r
 [Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId            ## CONSUMES\r