From nobody Sun May 5 22:39:00 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 1521666813663546.6349775929117; Wed, 21 Mar 2018 14:13:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C5F70225E9648; Wed, 21 Mar 2018 14:06:59 -0700 (PDT) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 D7BF9223DB11E for ; Wed, 21 Mar 2018 14:06:57 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 14:13:28 -0700 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.49]) by fmsmga006.fm.intel.com with ESMTP; 21 Mar 2018 14:13:28 -0700 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=134.134.136.24; helo=mga09.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.48,341,1517904000"; d="scan'208";a="213473651" From: Michael D Kinney To: edk2-devel@lists.01.org Date: Wed, 21 Mar 2018 14:13:24 -0700 Message-Id: <20180321211325.16388-2-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180321211325.16388-1-michael.d.kinney@intel.com> References: <20180321211325.16388-1-michael.d.kinney@intel.com> Subject: [edk2] [Patch 1/2] MdeModulePkg/CapsuleApp: Fix logic bug in CleanGatherList() 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: Jiewen Yao , Eric Dong , 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" https://bugzilla.tianocore.org/show_bug.cgi?id=3D905 Fix pointer math when more than one capsule is passed to the CapsuleApp. Use the ContinuationPointer from the last array entry instead of the first array entry. Cc: Jiewen Yao Cc: Star Zeng Cc: Eric Dong Signed-off-by: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: jiewen.yao@intel.com --- MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePk= g/Application/CapsuleApp/CapsuleApp.c index 393cfe5060..b9ff812179 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c @@ -1,7 +1,7 @@ /** @file A shell application that triggers capsule update process. =20 - Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2016 - 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 @@ -653,7 +653,7 @@ CleanGatherList ( break; } =20 - TempBlockPtr2 =3D (VOID *) ((UINTN) TempBlockPtr->Union.Continuation= Pointer); + TempBlockPtr2 =3D (VOID *) ((UINTN) TempBlockPtr[Index].Union.Contin= uationPointer); FreePool(TempBlockPtr1); TempBlockPtr1 =3D TempBlockPtr2; } --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sun May 5 22:39:00 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 1521666816517968.0192003592249; Wed, 21 Mar 2018 14:13:36 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2F002225E964F; Wed, 21 Mar 2018 14:07:00 -0700 (PDT) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 79E2D21E49029 for ; Wed, 21 Mar 2018 14:06:58 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2018 14:13:29 -0700 Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.49]) by fmsmga006.fm.intel.com with ESMTP; 21 Mar 2018 14:13:28 -0700 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=134.134.136.24; helo=mga09.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.48,341,1517904000"; d="scan'208";a="213473656" From: Michael D Kinney To: edk2-devel@lists.01.org Date: Wed, 21 Mar 2018 14:13:25 -0700 Message-Id: <20180321211325.16388-3-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.14.2.windows.3 In-Reply-To: <20180321211325.16388-1-michael.d.kinney@intel.com> References: <20180321211325.16388-1-michael.d.kinney@intel.com> Subject: [edk2] [Patch 2/2] MdeModulePkg/CapsuleApp: Center bitmap at bottom of screen 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: Jiewen Yao , Eric Dong , 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" https://bugzilla.tianocore.org/show_bug.cgi?id=3D907 When -G option is used to convert a BMP file to a UX capsule, the bitmap is centered horizontally and placed in the lower half of the screen below the boot logo. This matches examples shown in the following pages: https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/user-expe= rience-for-uefi-firmware-updates https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/boot-scre= en-components Checks are also made to make sure the bitmap provided fits in the current GOP mode. Cc: Jiewen Yao Cc: Star Zeng Cc: Eric Dong Signed-off-by: Michael D Kinney Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Jiewen.yao@intel.com --- MdeModulePkg/Application/CapsuleApp/CapsuleApp.c | 63 ++++++++++++++++++= ++-- MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf | 3 +- 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c b/MdeModulePk= g/Application/CapsuleApp/CapsuleApp.c index b9ff812179..e1e48befc2 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -173,15 +174,21 @@ CreateBmpFmp ( EFI_DISPLAY_CAPSULE *DisplayCapsule; EFI_STATUS Status; EFI_GRAPHICS_OUTPUT_PROTOCOL *Gop; + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info; + EFI_GRAPHICS_OUTPUT_BLT_PIXEL *GopBlt; + UINTN GopBltSize; + UINTN Height; + UINTN Width; =20 Status =3D gBS->LocateProtocol(&gEfiGraphicsOutputProtocolGuid, NULL, (V= OID **)&Gop); if (EFI_ERROR(Status)) { Print(L"CapsuleApp: NO GOP is found.\n"); return EFI_UNSUPPORTED; } + Info =3D Gop->Mode->Info; Print(L"Current GOP: Mode - %d, ", Gop->Mode->Mode); - Print(L"HorizontalResolution - %d, ", Gop->Mode->Info->HorizontalResolut= ion); - Print(L"VerticalResolution - %d\n", Gop->Mode->Info->VerticalResolution); + Print(L"HorizontalResolution - %d, ", Info->HorizontalResolution); + Print(L"VerticalResolution - %d\n", Info->VerticalResolution); // HorizontalResolution >=3D BMP_IMAGE_HEADER.PixelWidth // VerticalResolution >=3D BMP_IMAGE_HEADER.PixelHeight =20 @@ -207,6 +214,35 @@ CreateBmpFmp ( goto Done; } =20 + GopBlt =3D NULL; + Status =3D TranslateBmpToGopBlt ( + BmpBuffer, + FileSize, + &GopBlt, + &GopBltSize, + &Height, + &Width + ); + if (EFI_ERROR(Status)) { + Print(L"CapsuleApp: BMP image (%s) is not valid.\n", BmpName); + goto Done; + } + if (GopBlt !=3D NULL) { + FreePool (GopBlt); + } + Print(L"BMP image (%s), Width - %d, Height - %d\n", BmpName, Width, Heig= ht); + + if (Height > Info->VerticalResolution) { + Status =3D EFI_INVALID_PARAMETER; + Print(L"CapsuleApp: BMP image (%s) height is larger than current resol= ution.\n", BmpName); + goto Done; + } + if (Width > Info->HorizontalResolution) { + Status =3D EFI_INVALID_PARAMETER; + Print(L"CapsuleApp: BMP image (%s) width is larger than current resolu= tion.\n", BmpName); + goto Done; + } + FullCapsuleBufferSize =3D sizeof(EFI_DISPLAY_CAPSULE) + FileSize; FullCapsuleBuffer =3D AllocatePool(FullCapsuleBufferSize); if (FullCapsuleBuffer =3D=3D NULL) { @@ -226,8 +262,27 @@ CreateBmpFmp ( DisplayCapsule->ImagePayload.ImageType =3D 0; // BMP DisplayCapsule->ImagePayload.Reserved =3D 0; DisplayCapsule->ImagePayload.Mode =3D Gop->Mode->Mode; - DisplayCapsule->ImagePayload.OffsetX =3D 0; - DisplayCapsule->ImagePayload.OffsetY =3D 0; + + // + // Center the bitmap horizontally + // + DisplayCapsule->ImagePayload.OffsetX =3D (UINT32)((Info->HorizontalResol= ution - Width) / 2); + + // + // Put bitmap 3/4 down the display. If bitmap is too tall, then align b= ottom + // of bitmap at bottom of display. + // + DisplayCapsule->ImagePayload.OffsetY =3D + MIN ( + (UINT32)(Info->VerticalResolution - Height), + (UINT32)(((3 * Info->VerticalResolution) - (2 * Height)) / 4) + ); + + Print(L"BMP image (%s), OffsetX - %d, OffsetY - %d\n", + BmpName, + DisplayCapsule->ImagePayload.OffsetX, + DisplayCapsule->ImagePayload.OffsetY + ); =20 CopyMem((DisplayCapsule + 1), BmpBuffer, FileSize); =20 diff --git a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf b/MdeModule= Pkg/Application/CapsuleApp/CapsuleApp.inf index b06c4ea1bc..3a67c6b909 100644 --- a/MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf +++ b/MdeModulePkg/Application/CapsuleApp/CapsuleApp.inf @@ -4,7 +4,7 @@ # This application can trigger capsule update process. It can also # generate capsule image, or dump capsule variable information. # -# Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.
+# Copyright (c) 2016 - 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 @@ -63,6 +63,7 @@ [LibraryClasses] UefiRuntimeServicesTableLib UefiLib PrintLib + BmpSupportLib =20 [UserExtensions.TianoCore."ExtraFiles"] CapsuleAppExtra.uni --=20 2.14.2.windows.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel