From nobody Mon Dec 23 14:59:09 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1518044320385838.4883499825249; Wed, 7 Feb 2018 14:58:40 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 850AA222DE141; Wed, 7 Feb 2018 14:52:47 -0800 (PST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 1EE75222DE137 for ; Wed, 7 Feb 2018 14:52:43 -0800 (PST) Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2018 14:58:28 -0800 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.55]) by fmsmga007.fm.intel.com with ESMTP; 07 Feb 2018 14:58:27 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,473,1511856000"; d="scan'208";a="16135176" From: "Kinney, Michael D" To: edk2-devel@lists.01.org Date: Wed, 7 Feb 2018 14:58:15 -0800 Message-Id: <20180207225822.28876-4-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180207225822.28876-1-michael.d.kinney@intel.com> References: <20180207225822.28876-1-michael.d.kinney@intel.com> Subject: [edk2] [Patch 03/10] MdeModulePkg/BootGraphicsResourceTableDxe: Use BmpSupportLib 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: , Cc: Ruiyu Ni , Eric Dong , Jiewen Yao , Michael D Kinney , Star Zeng MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Michael D Kinney https://bugzilla.tianocore.org/show_bug.cgi?id=3D800 Based on content from the following branch/commits: https://github.com/Microsoft/MS_UEFI/tree/share/MsCapsuleSupport https://github.com/Microsoft/MS_UEFI/commit/33bab4031a417d7d5a7d356c15a14c2= e60302b2d https://github.com/Microsoft/MS_UEFI/commit/ca516b1a61315c2d823f453e12d2135= 098f53d61 https://github.com/Microsoft/MS_UEFI/commit/2b9f111f2e74a4c2ef4c4e32379e111= f016dbd9b Use BmpSupportLib to convert a GOP BLT Buffer to the BMP graphics image that is published in an ACPI BGRT table. * Remove use of IndustryStandard/Bmp.h include file * Remove mBmpImageHeaderTemplate. This is handled by BmpSupportLib * Clean up code style with function prototypes at top and all module global variables together * Update SetBootLogo() to use SafeIntLib to check input parameters for overflows. * Remove internal function BgrtAcpiTableChecksum(). Use CalculateCheckSum8() directly from BgrtReadyToBootEventNotify() * Remove InstallBootGraphicsResourceTable(). Move all the code into BgrtReadyToBootEventNotify() that is signaled at ready to boot. * Remove all logic that converts a GOP BLT buffer to a BMP graphics image and use BmpSupportLib function TranslateGopBltToBmp() instead. * Use AllocatePool() instead of AllocatePages() to allocate copy of BMP image that is provided by BGRT. This is required to be compatible with BmpSupportLib function TranslateGopBltToBmp() that uses AllocatePool(). * Zero OemId in BGRT header before filling in value from PCD. * Get size of PcdAcpiDefaultOemId and only copy the the size of the PCD if it is smaller than the size of the OemId field in the BGRT header. * Use WriteUnaligned24() instead of CopyMem() for the OemTableId field of the BGRT header. Cc: Sean Brogan Cc: Jiewen Yao Cc: Star Zeng Cc: Eric Dong Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Michael D Kinney --- .../BootGraphicsResourceTableDxe.c | 425 ++++++++++-------= ---- .../BootGraphicsResourceTableDxe.inf | 4 +- 2 files changed, 197 insertions(+), 232 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootG= raphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourc= eTableDxe/BootGraphicsResourceTableDxe.c index 6a7165a954..118fb4a922 100644 --- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.c +++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.c @@ -1,7 +1,7 @@ /** @file This module install ACPI Boot Graphics Resource Table (BGRT). =20 - Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -14,7 +14,6 @@ #include =20 #include -#include =20 #include #include @@ -28,44 +27,65 @@ #include #include #include +#include +#include =20 +/** + 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 BltBu= ffer + 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 val= ue. + @retval EFI_OUT_OF_RESOURCES The logo information was not updated due= to + insufficient memory resources. + +**/ +EFI_STATUS +EFIAPI +SetBootLogo ( + IN EFI_BOOT_LOGO_PROTOCOL *This, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, + IN UINTN DestinationX, + IN UINTN DestinationY, + IN UINTN Width, + IN UINTN Height + ); + +// +// Boot Logo Protocol Handle // -// Module globals. +EFI_HANDLE mBootLogoHandle =3D NULL; + +// +// Boot Logo Protocol Instance // -EFI_EVENT mBootGraphicsReadyToBootEvent; -UINTN mBootGraphicsResourceTableKey =3D 0; +EFI_BOOT_LOGO_PROTOCOL mBootLogoProtocolTemplate =3D { + SetBootLogo +}; =20 -EFI_HANDLE mBootLogoHandle =3D NULL; +EFI_EVENT mBootGraphicsReadyToBootEvent; +UINTN mBootGraphicsResourceTableKey =3D 0; BOOLEAN mIsLogoValid =3D FALSE; EFI_GRAPHICS_OUTPUT_BLT_PIXEL *mLogoBltBuffer =3D NULL; -UINTN mLogoDestX =3D 0; -UINTN mLogoDestY =3D 0; -UINTN mLogoWidth =3D 0; +UINTN mLogoDestX =3D 0; +UINTN mLogoDestY =3D 0; +UINTN mLogoWidth =3D 0; UINTN mLogoHeight =3D 0; +BOOLEAN mAcpiBgrtInstalled =3D FALSE; +BOOLEAN mAcpiBgrtStatusChanged =3D FALSE; +BOOLEAN mAcpiBgrtBufferChanged =3D FALSE; =20 -BMP_IMAGE_HEADER mBmpImageHeaderTemplate =3D { - 'B', // CharB - 'M', // CharM - 0, // Size will be updated at runtime - {0, 0}, // Reserved - sizeof (BMP_IMAGE_HEADER), // ImageOffset - sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BMP_IMAGE_HEADER, HeaderSize), //= HeaderSize - 0, // PixelWidth will be updated at runtime - 0, // PixelHeight will be updated at runtime - 1, // Planes - 24, // BitPerPixel - 0, // CompressionType - 0, // ImageSize will be updated at runtime - 0, // XPixelsPerMeter - 0, // YPixelsPerMeter - 0, // NumberOfColors - 0 // ImportantColors -}; - -BOOLEAN mAcpiBgrtInstalled =3D FALSE; -BOOLEAN mAcpiBgrtStatusChanged =3D FALSE; -BOOLEAN mAcpiBgrtBufferChanged =3D FALSE; - +// +// ACPI Boot Graphics Resource Table template +// EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphicsResourceTableTempla= te =3D { { EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE, @@ -89,37 +109,6 @@ EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE mBootGraphics= ResourceTableTemplate =3D { 0 // Image Offset Y }; =20 -/** - 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 BltBu= ffer - 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 val= ue. - @retval EFI_OUT_OF_RESOURCES The logo information was not updated due= to - insufficient memory resources. - -**/ -EFI_STATUS -EFIAPI -SetBootLogo ( - IN EFI_BOOT_LOGO_PROTOCOL *This, - IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer OPTIONAL, - IN UINTN DestinationX, - IN UINTN DestinationY, - IN UINTN Width, - IN UINTN Height - ); - -EFI_BOOT_LOGO_PROTOCOL mBootLogoProtocolTemplate =3D { SetBootLogo }; - /** Update information of logo image drawn on screen. =20 @@ -149,7 +138,9 @@ SetBootLogo ( IN UINTN Height ) { - UINT64 BufferSize; + EFI_STATUS Status; + UINTN BufferSize; + UINT32 Result32; =20 if (BltBuffer =3D=3D NULL) { mIsLogoValid =3D FALSE; @@ -157,103 +148,115 @@ SetBootLogo ( return EFI_SUCCESS; } =20 + // + // Width and height are not allowed to be zero. + // if (Width =3D=3D 0 || Height =3D=3D 0) { return EFI_INVALID_PARAMETER; } - =20 - mAcpiBgrtBufferChanged =3D TRUE; - if (mLogoBltBuffer !=3D NULL) { - FreePool (mLogoBltBuffer); - mLogoBltBuffer =3D NULL; + + // + // Verify destination, width, and height do not overflow 32-bit values. + // The Boot Graphics Resource Table only has 32-bit fields for these val= ues. + // + Status =3D SafeUintnToUint32 (DestinationX, &Result32); + if (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; } - =20 + Status =3D SafeUintnToUint32 (DestinationY, &Result32); + if (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } + Status =3D SafeUintnToUint32 (Width, &Result32); + if (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } + Status =3D SafeUintnToUint32 (Height, &Result32); + if (EFI_ERROR (Status)) { + return EFI_INVALID_PARAMETER; + } + // - // Ensure the Height * Width doesn't overflow + // Ensure the Height * Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) do= es + // not overflow UINTN // - if (Height > DivU64x64Remainder ((UINTN) ~0, Width, NULL)) { + Status =3D SafeUintnMult ( + Width, + Height, + &BufferSize + ); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } + Status =3D SafeUintnMult ( + BufferSize, + sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), + &BufferSize + ); + if (EFI_ERROR (Status)) { return EFI_UNSUPPORTED; } - BufferSize =3D MultU64x64 (Width, Height); - =20 + // - // Ensure the BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) doesn'= t overflow + // Update state // - if (BufferSize > DivU64x32 ((UINTN) ~0, sizeof (EFI_GRAPHICS_OUTPUT_BLT_= PIXEL))) { - return EFI_UNSUPPORTED; + mAcpiBgrtBufferChanged =3D TRUE; + + // + // Free old logo buffer + // + if (mLogoBltBuffer !=3D NULL) { + FreePool (mLogoBltBuffer); + mLogoBltBuffer =3D NULL; } =20 - mLogoBltBuffer =3D AllocateCopyPool ( - (UINTN)BufferSize * sizeof (EFI_GRAPHICS_OUTPUT_BLT_P= IXEL), - BltBuffer - ); + // + // Allocate new logo buffer + // + mLogoBltBuffer =3D AllocateCopyPool (BufferSize, BltBuffer); if (mLogoBltBuffer =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } - mLogoDestX =3D DestinationX; - mLogoDestY =3D DestinationY; - mLogoWidth =3D Width; - mLogoHeight =3D Height; + + mLogoDestX =3D DestinationX; + mLogoDestY =3D DestinationY; + mLogoWidth =3D Width; + mLogoHeight =3D Height; mIsLogoValid =3D TRUE; =20 return EFI_SUCCESS; } =20 /** - This function calculates and updates an UINT8 checksum. + Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is u= sed to + install the Boot Graphics Resource Table. =20 - @param[in] Buffer Pointer to buffer to checksum. - @param[in] Size Number of bytes to checksum. + @param[in] Event The Event that is being processed. + @param[in] Context The Event Context. =20 **/ VOID -BgrtAcpiTableChecksum ( - IN UINT8 *Buffer, - IN UINTN Size - ) -{ - UINTN ChecksumOffset; - - ChecksumOffset =3D OFFSET_OF (EFI_ACPI_DESCRIPTION_HEADER, Checksum); - - // - // Set checksum to 0 first. - // - Buffer[ChecksumOffset] =3D 0; - - // - // Update checksum value. - // - Buffer[ChecksumOffset] =3D CalculateCheckSum8 (Buffer, Size); -} - -/** - Install Boot Graphics Resource Table to ACPI table. - - @return Status code. - -**/ -EFI_STATUS -InstallBootGraphicsResourceTable ( - VOID +EFIAPI +BgrtReadyToBootEventNotify ( + IN EFI_EVENT Event, + IN VOID *Context ) { - EFI_STATUS Status; - EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; - UINT8 *ImageBuffer; - UINTN PaddingSize; - UINTN BmpSize; - UINTN OrigBmpSize; - UINT8 *Image; - EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltPixel; - UINTN Col; - UINTN Row; + EFI_STATUS Status; + EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol; + VOID *ImageBuffer; + UINT32 BmpSize; =20 // // Get ACPI Table protocol. // - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **) &AcpiTableProtocol); + Status =3D gBS->LocateProtocol ( + &gEfiAcpiTableProtocolGuid, + NULL, + (VOID **) &AcpiTableProtocol + ); if (EFI_ERROR (Status)) { - return Status; + return; } =20 // @@ -264,109 +267,85 @@ InstallBootGraphicsResourceTable ( // // Nothing has changed // - return EFI_SUCCESS; + return; } else { // - // If BGRT data change happens. Uninstall Orignal AcpiTable first + // If BGRT data change happens, then uninstall orignal AcpiTable fir= st // Status =3D AcpiTableProtocol->UninstallAcpiTable ( AcpiTableProtocol, mBootGraphicsResourceTableKey ); if (EFI_ERROR (Status)) { - return Status; - }=20 + return; + } } } else { // - // Check whether Logo exist. + // Check whether Logo exists // - if ( mLogoBltBuffer =3D=3D NULL) { - return EFI_NOT_FOUND; + if (mLogoBltBuffer =3D=3D NULL) { + return; } } =20 if (mAcpiBgrtBufferChanged) { // - // reserve original BGRT buffer size + // Free the old BMP image buffer // - OrigBmpSize =3D mBmpImageHeaderTemplate.ImageSize + sizeof (BMP_IMAGE_= HEADER); - // - // Free orignal BMP memory=20 - //=20 - if (mBootGraphicsResourceTableTemplate.ImageAddress) { - gBS->FreePages(mBootGraphicsResourceTableTemplate.ImageAddress, EFI_= SIZE_TO_PAGES(OrigBmpSize)); + ImageBuffer =3D (UINT8 *)(UINTN)mBootGraphicsResourceTableTemplate.Ima= geAddress; + if (ImageBuffer !=3D NULL) { + FreePool (ImageBuffer); } =20 // - // Allocate memory for BMP file. + // Convert GOP Blt buffer to BMP image. Pass in ImageBuffer set to NU= LL + // so the BMP image is allocated by TranslateGopBltToBmp(). // - PaddingSize =3D mLogoWidth & 0x3; - - // - // First check mLogoWidth * 3 + PaddingSize doesn't overflow - // - if (mLogoWidth > (((UINT32) ~0) - PaddingSize) / 3 ) { - return EFI_UNSUPPORTED; - } - - // - // Second check (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof = (BMP_IMAGE_HEADER) doesn't overflow - // - if (mLogoHeight > (((UINT32) ~0) - sizeof (BMP_IMAGE_HEADER)) / (mLogo= Width * 3 + PaddingSize)) { - return EFI_UNSUPPORTED; + ImageBuffer =3D NULL; + Status =3D TranslateGopBltToBmp ( + mLogoBltBuffer, + (UINT32)mLogoHeight, + (UINT32)mLogoWidth, + &ImageBuffer, + &BmpSize + ); + if (EFI_ERROR (Status)) { + return; } =20 // - // The image should be stored in EfiBootServicesData, allowing the sys= tem to reclaim the memory - // - BmpSize =3D (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP= _IMAGE_HEADER); - ImageBuffer =3D AllocatePages (EFI_SIZE_TO_PAGES (BmpSize)); - if (ImageBuffer =3D=3D NULL) { - return EFI_OUT_OF_RESOURCES; - } - - ZeroMem (ImageBuffer, BmpSize); - - mBmpImageHeaderTemplate.Size =3D (UINT32) BmpSize; - mBmpImageHeaderTemplate.ImageSize =3D (UINT32) BmpSize - sizeof (BMP_I= MAGE_HEADER); - mBmpImageHeaderTemplate.PixelWidth =3D (UINT32) mLogoWidth; - mBmpImageHeaderTemplate.PixelHeight =3D (UINT32) mLogoHeight; - CopyMem (ImageBuffer, &mBmpImageHeaderTemplate, sizeof (BMP_IMAGE_HEAD= ER)); - =20 - // - // Convert BLT buffer to BMP file. + // Free the logo buffer // - Image =3D ImageBuffer + sizeof (BMP_IMAGE_HEADER); - for (Row =3D 0; Row < mLogoHeight; Row++) { - BltPixel =3D &mLogoBltBuffer[(mLogoHeight - Row - 1) * mLogoWidth]; - - for (Col =3D 0; Col < mLogoWidth; Col++) { - *Image++ =3D BltPixel->Blue; - *Image++ =3D BltPixel->Green; - *Image++ =3D BltPixel->Red; - BltPixel++; - } - - // - // Padding for 4 byte alignment. - // - Image +=3D PaddingSize; - } FreePool (mLogoBltBuffer); mLogoBltBuffer =3D NULL; =20 - mBootGraphicsResourceTableTemplate.ImageAddress =3D (UINT64) (UINTN) I= mageBuffer; - mBootGraphicsResourceTableTemplate.ImageOffsetX =3D (UINT32) mLogoDest= X; - mBootGraphicsResourceTableTemplate.ImageOffsetY =3D (UINT32) mLogoDest= Y; + // + // Update BMP image fields of the Boot Graphics Resource Table + // + mBootGraphicsResourceTableTemplate.ImageAddress =3D (UINT64)(UINTN)Ima= geBuffer; + mBootGraphicsResourceTableTemplate.ImageOffsetX =3D (UINT32)mLogoDestX; + mBootGraphicsResourceTableTemplate.ImageOffsetY =3D (UINT32)mLogoDestY; } =20 - mBootGraphicsResourceTableTemplate.Status =3D (UINT8) (mIsLogoValid ? EF= I_ACPI_5_0_BGRT_STATUS_VALID : EFI_ACPI_5_0_BGRT_STATUS_INVALID); + // + // Update Status field of Boot Graphics Resource Table + // + if (mIsLogoValid) { + mBootGraphicsResourceTableTemplate.Status =3D EFI_ACPI_5_0_BGRT_STATUS= _VALID; + } else { + mBootGraphicsResourceTableTemplate.Status =3D EFI_ACPI_5_0_BGRT_STATUS= _INVALID; + } =20 // - // Update Checksum. + // Update Checksum of Boot Graphics Resource Table // - BgrtAcpiTableChecksum ((UINT8 *) &mBootGraphicsResourceTableTemplate, si= zeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE)); + mBootGraphicsResourceTableTemplate.Header.Checksum =3D 0; + mBootGraphicsResourceTableTemplate.Header.Checksum =3D + CalculateCheckSum8 ( + (UINT8 *)&mBootGraphicsResourceTableTemplate, + sizeof (EFI_ACPI_5_0_BOOT_GRAPHICS_RESOURCE_TABLE) + ); =20 // // Publish Boot Graphics Resource Table. @@ -378,32 +357,12 @@ InstallBootGraphicsResourceTable ( &mBootGraphicsResourceTableKey ); if (EFI_ERROR (Status)) { - return Status; + return; } =20 - mAcpiBgrtInstalled =3D TRUE; + mAcpiBgrtInstalled =3D TRUE; mAcpiBgrtStatusChanged =3D FALSE; mAcpiBgrtBufferChanged =3D FALSE; - =20 - return Status; -} - -/** - Notify function for event group EFI_EVENT_GROUP_READY_TO_BOOT. This is u= sed to - install the Boot Graphics Resource Table. - - @param[in] Event The Event that is being processed. - @param[in] Context The Event Context. - -**/ -VOID -EFIAPI -BgrtReadyToBootEventNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - InstallBootGraphicsResourceTable (); } =20 /** @@ -419,23 +378,27 @@ BgrtReadyToBootEventNotify ( EFI_STATUS EFIAPI BootGraphicsDxeEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { - EFI_STATUS Status; - UINT64 OemTableId; + EFI_STATUS Status; + EFI_ACPI_DESCRIPTION_HEADER *Header; =20 + // + // Update Header fields of Boot Graphics Resource Table from PCDs + // + Header =3D &mBootGraphicsResourceTableTemplate.Header; + ZeroMem (Header->OemId, sizeof (Header->OemId)); CopyMem ( - mBootGraphicsResourceTableTemplate.Header.OemId, + Header->OemId, PcdGetPtr (PcdAcpiDefaultOemId), - sizeof (mBootGraphicsResourceTableTemplate.Header.OemId) + MIN (PcdGetSize (PcdAcpiDefaultOemId), sizeof (Header->OemId)) ); - OemTableId =3D PcdGet64 (PcdAcpiDefaultOemTableId); - CopyMem (&mBootGraphicsResourceTableTemplate.Header.OemTableId, &OemTabl= eId, sizeof (UINT64)); - mBootGraphicsResourceTableTemplate.Header.OemRevision =3D PcdGet32 = (PcdAcpiDefaultOemRevision); - mBootGraphicsResourceTableTemplate.Header.CreatorId =3D PcdGet32 = (PcdAcpiDefaultCreatorId); - mBootGraphicsResourceTableTemplate.Header.CreatorRevision =3D PcdGet32 = (PcdAcpiDefaultCreatorRevision); + WriteUnaligned64 (&Header->OemTableId, PcdGet64 (PcdAcpiDefaultOemTableI= d)); + Header->OemRevision =3D PcdGet32 (PcdAcpiDefaultOemRevision); + Header->CreatorId =3D PcdGet32 (PcdAcpiDefaultCreatorId); + Header->CreatorRevision =3D PcdGet32 (PcdAcpiDefaultCreatorRevision); =20 // // Install Boot Logo protocol. diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootG= raphicsResourceTableDxe.inf b/MdeModulePkg/Universal/Acpi/BootGraphicsResou= rceTableDxe/BootGraphicsResourceTableDxe.inf index 9fd1da448c..ff33405acd 100644 --- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf +++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.inf @@ -1,7 +1,7 @@ ## @file # This module install ACPI Boot Graphics Resource Table (BGRT). # -# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License # which accompanies this distribution. The full text of the license may = be found at @@ -43,6 +43,8 @@ UefiBootServicesTableLib DebugLib PcdLib + SafeIntLib + BmpSupportLib =20 [Protocols] gEfiAcpiTableProtocolGuid ## CONSUMES --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel