From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B5BB422212C0B for ; Tue, 13 Feb 2018 18:01:36 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 18:07:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,510,1511856000"; d="scan'208";a="204007802" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.72]) by fmsmga006.fm.intel.com with ESMTP; 13 Feb 2018 18:07:26 -0800 From: "Kinney, Michael D" To: edk2-devel@lists.01.org Cc: Michael D Kinney , Sean Brogan , Bret Barkelew , Jiewen Yao , Star Zeng , Eric Dong Date: Tue, 13 Feb 2018 18:07:21 -0800 Message-Id: <20180214020722.5412-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180214020722.5412-1-michael.d.kinney@intel.com> References: <20180214020722.5412-1-michael.d.kinney@intel.com> Subject: [Patch 2/3] MdeModulePkg/BootGraphicsResourceDxe: Add Boot Logo 2 Protocol X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Feb 2018 02:01:37 -0000 From: Michael D Kinney 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 Cc: Bret Barkelew Cc: Jiewen Yao Cc: Star Zeng Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney --- .../BootGraphicsResourceTableDxe.c | 208 +++++++++++++++++++-- .../BootGraphicsResourceTableDxe.inf | 2 + 2 files changed, 196 insertions(+), 14 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c index 118fb4a922..85e79c6ce6 100644 --- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c +++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.c @@ -2,6 +2,7 @@ This module install ACPI Boot Graphics Resource Table (BGRT). Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2016, Microsoft Corporation
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -18,6 +19,7 @@ #include #include #include +#include #include @@ -33,20 +35,19 @@ /** Update information of logo image drawn on screen. - @param This The pointer to the Boot Logo protocol instance. - @param BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer - is set to NULL, it indicates that logo image is no - longer on the screen. - @param DestinationX X coordinate of destination for the BltBuffer. - @param DestinationY Y coordinate of destination for the BltBuffer. - @param Width Width of rectangle in BltBuffer in pixels. - @param Height Hight of rectangle in BltBuffer in pixels. - - @retval EFI_SUCCESS The boot logo information was updated. - @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. - @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to - insufficient memory resources. + @param[in] This The pointer to the Boot Logo protocol 2 instance. + @param[in] BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer + is set to NULL, it indicates that logo image is no + longer on the screen. + @param[in] DestinationX X coordinate of destination for the BltBuffer. + @param[in] DestinationY Y coordinate of destination for the BltBuffer. + @param[in] Width Width of rectangle in BltBuffer in pixels. + @param[in] Height Hight of rectangle in BltBuffer in pixels. + @retval EFI_SUCCESS The boot logo information was updated. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to + insufficient memory resources. **/ EFI_STATUS EFIAPI @@ -59,6 +60,69 @@ SetBootLogo ( IN UINTN Height ); +/** + Update information of logo image drawn on screen. + + @param[in] This The pointer to the Boot Logo protocol 2 instance. + @param[in] BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer + is set to NULL, it indicates that logo image is no + longer on the screen. + @param[in] DestinationX X coordinate of destination for the BltBuffer. + @param[in] DestinationY Y coordinate of destination for the BltBuffer. + @param[in] Width Width of rectangle in BltBuffer in pixels. + @param[in] Height Hight of rectangle in BltBuffer in pixels. + + @retval EFI_SUCCESS The boot logo information was updated. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to + insufficient memory resources. +**/ +EFI_STATUS +EFIAPI +SetBootLogo2 ( + IN EDKII_BOOT_LOGO2_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height + ); + +/** + Get the location of the boot logo on the screen. + + @param[in] This The pointer to the Boot Logo Protocol 2 instance + @param[out] BltBuffer Returns pointer to the GOP BLT buffer that was + previously registered with SetBootLogo2(). The + buffer returned must not be modified or freed. + @param[out] DestinationX Returns the X start position of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + @param[out] DestinationY Returns the Y start position of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + @param[out] Width Returns the width of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + @param[out] Height Returns the height of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + + @retval EFI_SUCCESS The location of the boot logo was returned. + @retval EFI_NOT_READY The boot logo has not been set. + @retval EFI_INVALID_PARAMETER BltBuffer is NULL. + @retval EFI_INVALID_PARAMETER DestinationX is NULL. + @retval EFI_INVALID_PARAMETER DestinationY is NULL. + @retval EFI_INVALID_PARAMETER Width is NULL. + @retval EFI_INVALID_PARAMETER Height is NULL. +**/ +EFI_STATUS +EFIAPI +GetBootLogo2 ( + IN EDKII_BOOT_LOGO2_PROTOCOL *This, + OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **BltBuffer, + OUT UINTN *DestinationX, + OUT UINTN *DestinationY, + OUT UINTN *Width, + OUT UINTN *Height + ); + // // Boot Logo Protocol Handle // @@ -71,6 +135,14 @@ EFI_BOOT_LOGO_PROTOCOL mBootLogoProtocolTemplate = { SetBootLogo }; +/// +/// Boot Logo 2 Protocol instance +/// +EDKII_BOOT_LOGO2_PROTOCOL mBootLogo2ProtocolTemplate = { + SetBootLogo2, + GetBootLogo2 +}; + EFI_EVENT mBootGraphicsReadyToBootEvent; UINTN mBootGraphicsResourceTableKey = 0; BOOLEAN mIsLogoValid = FALSE; @@ -137,6 +209,47 @@ SetBootLogo ( IN UINTN Width, IN UINTN Height ) +{ + // + // Call same service in Boot Logo 2 Protocol + // + return SetBootLogo2 ( + &mBootLogo2ProtocolTemplate, + BltBuffer, + DestinationX, + DestinationY, + Width, + Height + ); +} + +/** + Update information of logo image drawn on screen. + + @param[in] This The pointer to the Boot Logo protocol 2 instance. + @param[in] BltBuffer The BLT buffer for logo drawn on screen. If BltBuffer + is set to NULL, it indicates that logo image is no + longer on the screen. + @param[in] DestinationX X coordinate of destination for the BltBuffer. + @param[in] DestinationY Y coordinate of destination for the BltBuffer. + @param[in] Width Width of rectangle in BltBuffer in pixels. + @param[in] Height Hight of rectangle in BltBuffer in pixels. + + @retval EFI_SUCCESS The boot logo information was updated. + @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. + @retval EFI_OUT_OF_RESOURCES The logo information was not updated due to + insufficient memory resources. +**/ +EFI_STATUS +EFIAPI +SetBootLogo2 ( + IN EDKII_BOOT_LOGO2_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height + ) { EFI_STATUS Status; UINTN BufferSize; @@ -227,6 +340,71 @@ SetBootLogo ( return EFI_SUCCESS; } +/** + Get the location of the boot logo on the screen. + + @param[in] This The pointer to the Boot Logo Protocol 2 instance + @param[out] BltBuffer Returns pointer to the GOP BLT buffer that was + previously registered with SetBootLogo2(). The + buffer returned must not be modified or freed. + @param[out] DestinationX Returns the X start position of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + @param[out] DestinationY Returns the Y start position of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + @param[out] Width Returns the width of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + @param[out] Height Returns the height of the GOP BLT buffer + that was previously registers with SetBootLogo2(). + + @retval EFI_SUCCESS The location of the boot logo was returned. + @retval EFI_NOT_READY The boot logo has not been set. + @retval EFI_INVALID_PARAMETER BltBuffer is NULL. + @retval EFI_INVALID_PARAMETER DestinationX is NULL. + @retval EFI_INVALID_PARAMETER DestinationY is NULL. + @retval EFI_INVALID_PARAMETER Width is NULL. + @retval EFI_INVALID_PARAMETER Height is NULL. +**/ +EFI_STATUS +EFIAPI +GetBootLogo2 ( + IN EDKII_BOOT_LOGO2_PROTOCOL *This, + OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL **BltBuffer, + OUT UINTN *DestinationX, + OUT UINTN *DestinationY, + OUT UINTN *Width, + OUT UINTN *Height + ) +{ + // + // If the boot logo has not been set with SetBootLogo() or SetBootLogo() was + // called with a NULL BltBuffer then the boot logo is not valid and + // EFI_NOT_READY is returned. + // + if (mLogoBltBuffer == NULL) { + DEBUG ((DEBUG_ERROR, "Request to get boot logo location before boot logo has been set.\n")); + return EFI_NOT_READY; + } + + // + // Make sure none of the boot logo location parameters are NULL. + // + if (BltBuffer == NULL || DestinationX == NULL || DestinationY == NULL || + Width == NULL || Height == NULL) { + return EFI_INVALID_PARAMETER; + } + + // + // Boot logo is valid. Return values from module globals. + // + *BltBuffer = mLogoBltBuffer; + *DestinationX = mLogoDestX; + *DestinationY = mLogoDestY; + *Width = mLogoWidth; + *Height = mLogoHeight; + + return EFI_SUCCESS; +} + /** Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is used to install the Boot Graphics Resource Table. @@ -401,12 +579,14 @@ BootGraphicsDxeEntryPoint ( Header->CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision); // - // Install Boot Logo protocol. + // Install Boot Logo and Boot Logo 2 Protocols. // Status = gBS->InstallMultipleProtocolInterfaces ( &mBootLogoHandle, &gEfiBootLogoProtocolGuid, &mBootLogoProtocolTemplate, + &gEdkiiBootLogo2ProtocolGuid, + &mBootLogo2ProtocolTemplate, NULL ); ASSERT_EFI_ERROR (Status); diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf index ff33405acd..bc1c10e981 100644 --- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf +++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf @@ -2,6 +2,7 @@ # This module install ACPI Boot Graphics Resource Table (BGRT). # # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2016, Microsoft Corporation
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -49,6 +50,7 @@ [LibraryClasses] [Protocols] gEfiAcpiTableProtocolGuid ## CONSUMES gEfiBootLogoProtocolGuid ## PRODUCES + gEdkiiBootLogo2ProtocolGuid ## PRODUCES [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiDefaultOemId ## CONSUMES -- 2.14.2.windows.3