From nobody Sun Feb 8 20:28:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+107513+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107513+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1691038850; cv=none; d=zohomail.com; s=zohoarc; b=IEYNajjPH078WE3+1OCEIeFb1mF6WDkpwCMBTyXbUOAPleoJFTJNOD1Bvh3XQoSieWjeCv/7E+zfnOHN+6T/ICUvqUemoke+LjZfViRgsvBDikAi0tVYyjSroZUCJxWtmfUmKoknwScToFHDXz/9nfpq+POGlIg+lwGgnapWcjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1691038850; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=BVhINucpdq42LgdAG6ZCvlNySOzczjfoHUGN7QGo9wA=; b=enQ17nQPuUg5xiRfTogLnGRaY1C9Tx1Jfr/lrtVre7pjOMhgn7dYYotfYmZFNKCJsiRoui+zl2RT0pfvFekaznW+dYu04VBh5ZlQ5cDrA9i7XkPD4IIwy6gLUXWOD3BgubuoONUIQcruQ+unoOaR718eZJ6WLA2Eakv3q84IRbY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+107513+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1691038850602231.73042158876797; Wed, 2 Aug 2023 22:00:50 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=hTWrvW9p/lh2KrGQ0sxvD49C0KDlxTzdTcxF9ZufzXQ=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1691038850; v=1; b=EFgx/EVsqZNAglLjuciY5yQ1/B1BFT6kaRfDDX3J14vPFCY2N1kOHz0OChafjrLpUl2dV2mr rphm4AzGhiGCHqGuWwvEoGqqxyMoZba9H6YL+zD8UFw6OssLbKFTBvuoJqfdtCrgsgOWpTxWHvq cjFyLsmjCZfEFsBuMYnCPdUc= X-Received: by 127.0.0.2 with SMTP id 71wLYY1788612xU5K1Bzvbfu; Wed, 02 Aug 2023 22:00:50 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.7714.1691038820986078498 for ; Wed, 02 Aug 2023 22:00:21 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="349366599" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="349366599" X-Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 22:00:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="1060098455" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="1060098455" X-Received: from basfe006.gar.corp.intel.com ([10.66.244.178]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 22:00:18 -0700 From: chitralekha ck To: devel@edk2.groups.io Cc: chitralekha ck , Ray Ni , Zhichao Gao , Ashraf Ali S , Chinni B Duggapu Subject: [edk2-devel] [PATCH v2] MdeModulePkg: AllocatePages for TranslateBmpToGopBlt Date: Thu, 3 Aug 2023 10:30:09 +0530 Message-Id: <98d6a4e6edccdd8ecc9f221c4248b96fe004f80a.1691038792.git.chitralekha.ck@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chitralekha.ck@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: YM6DKtiK4MkHvvD8MSpZj26Xx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1691038853048100002 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D4507 AllocatePool limits to allocate memory of 64 KB at most in PEI Phase. AllocatePool() is being avoided due to its 64k allocation size limit when the library is incorporated into a PEI component. change the function debug string to __func__ Cc: Ray Ni Cc: Zhichao Gao Cc: Ashraf Ali S Cc: Chinni B Duggapu Signed-off-by: chitralekha ck --- .../Library/BaseBmpSupportLib/BmpSupportLib.c | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c b/MdeMo= dulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c index c5e885d7a6..d0833a721f 100644 --- a/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c +++ b/MdeModulePkg/Library/BaseBmpSupportLib/BmpSupportLib.c @@ -52,7 +52,7 @@ const BMP_IMAGE_HEADER mBmpImageHeaderTemplate =3D { /** Translate a *.BMP graphics image to a GOP blt buffer. If a NULL Blt buff= er is passed in a GopBlt buffer will be allocated by this routine using - EFI_BOOT_SERVICES.AllocatePool(). If a GopBlt buffer is passed in it wil= l be + EFI_BOOT_SERVICES.AllocatePages(). If a GopBlt buffer is passed in it wi= ll be used if it is big enough. =20 @param[in] BmpImage Pointer to BMP file. @@ -113,14 +113,14 @@ TranslateBmpToGopBlt ( } =20 if (BmpImageSize < sizeof (BMP_IMAGE_HEADER)) { - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpImageSize too small\n")= ); + DEBUG ((DEBUG_ERROR, "%a: BmpImageSize too small\n", __func__)); return RETURN_UNSUPPORTED; } =20 BmpHeader =3D (BMP_IMAGE_HEADER *)BmpImage; =20 if ((BmpHeader->CharB !=3D 'B') || (BmpHeader->CharM !=3D 'M')) { - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->Char fields inc= orrect\n")); + DEBUG ((DEBUG_ERROR, "%a: BmpHeader->Char fields incorrect\n", __func_= _)); return RETURN_UNSUPPORTED; } =20 @@ -128,12 +128,12 @@ TranslateBmpToGopBlt ( // Doesn't support compress. // if (BmpHeader->CompressionType !=3D 0) { - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: Compression Type unsupport= ed.\n")); + DEBUG ((DEBUG_ERROR, "%a: Compression Type unsupported\n", __func__)); return RETURN_UNSUPPORTED; } =20 if ((BmpHeader->PixelHeight =3D=3D 0) || (BmpHeader->PixelWidth =3D=3D 0= )) { - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight or = BmpHeader->PixelWidth is 0.\n")); + DEBUG ((DEBUG_ERROR, "%a: BmpHeader PixelHeight or PixelWidth is 0\n",= __func__)); return RETURN_UNSUPPORTED; } =20 @@ -144,7 +144,8 @@ TranslateBmpToGopBlt ( if (BmpHeader->HeaderSize !=3D sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (BM= P_IMAGE_HEADER, HeaderSize)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: BmpHeader->Headership is not as expected. He= adersize is 0x%x\n", + "%a: BmpHeader->Headership is not as expected. Headersize is 0x%x\n", + __func__, BmpHeader->HeaderSize )); return RETURN_UNSUPPORTED; @@ -161,7 +162,8 @@ TranslateBmpToGopBlt ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: invalid BmpImage... PixelWidth:0x%x BitPerPix= el:0x%x\n", + "%a: invalid BmpImage. PixelWidth:0x%x BitPerPixel:0x%x\n", + __func__, BmpHeader->PixelWidth, BmpHeader->BitPerPixel )); @@ -172,7 +174,8 @@ TranslateBmpToGopBlt ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x\n", + "%a: invalid BmpImage. DataSizePerLine:0x%x\n", + __func__, DataSizePerLine )); =20 @@ -189,7 +192,8 @@ TranslateBmpToGopBlt ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x Pixe= lHeight:0x%x\n", + "%a: invalid BmpImage. DataSizePerLine:0x%x PixelHeight:0x%x\n", + __func__, DataSizePerLine, BmpHeader->PixelHeight )); @@ -206,7 +210,8 @@ TranslateBmpToGopBlt ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: invalid BmpImage... PixelHeight:0x%x DataSize= PerLine:0x%x\n", + "%a: invalid BmpImage. PixelHeight:0x%x DataSizePerLine:0x%x\n", + __func__, BmpHeader->PixelHeight, DataSizePerLine )); @@ -218,11 +223,11 @@ TranslateBmpToGopBlt ( (BmpHeader->Size < BmpHeader->ImageOffset) || (BmpHeader->Size - BmpHeader->ImageOffset !=3D DataSize)) { - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: invalid BmpImage... \n")); - DEBUG ((DEBUG_ERROR, " BmpHeader->Size: 0x%x\n", BmpHeader->Size)); - DEBUG ((DEBUG_ERROR, " BmpHeader->ImageOffset: 0x%x\n", BmpHeader->I= mageOffset)); - DEBUG ((DEBUG_ERROR, " BmpImageSize: 0x%lx\n", (UINTN)BmpImageSize)); - DEBUG ((DEBUG_ERROR, " DataSize: 0x%lx\n", (UINTN)DataSize)); + DEBUG ((DEBUG_ERROR, "%a: invalid BmpImage... \n", __func__)); + DEBUG ((DEBUG_ERROR, " Size: 0x%x\n", BmpHeader->Size)); + DEBUG ((DEBUG_ERROR, " ImageOffset: 0x%x\n", BmpHeader->ImageOffset)); + DEBUG ((DEBUG_ERROR, " BmpImageSize: 0x%lx\n", (UINTN)BmpImageSize)); + DEBUG ((DEBUG_ERROR, " DataSize: 0x%lx\n", (UINTN)DataSize)); =20 return RETURN_UNSUPPORTED; } @@ -279,7 +284,8 @@ TranslateBmpToGopBlt ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: invalid BltBuffer needed size... PixelWidth:0= x%x PixelHeight:0x%x\n", + "%a: invalid BltBuffer needed size. PixelWidth:0x%x PixelHeight:0x%x= \n", + __func__, BmpHeader->PixelWidth, BmpHeader->PixelHeight )); @@ -297,7 +303,8 @@ TranslateBmpToGopBlt ( if (EFI_ERROR (Status)) { DEBUG (( DEBUG_ERROR, - "TranslateBmpToGopBlt: invalid BltBuffer needed size... PixelWidth x= PixelHeight:0x%x struct size:0x%x\n", + "%a: invalid BltBuffer needed size. PixelWidth x PixelHeight:0x%x st= ruct size:0x%x\n", + __func__, Temp, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) )); @@ -312,7 +319,7 @@ TranslateBmpToGopBlt ( // DEBUG ((DEBUG_INFO, "Bmp Support: Allocating 0x%X bytes of memory\n", = BltBufferSize)); *GopBltSize =3D (UINTN)BltBufferSize; - *GopBlt =3D AllocatePool (*GopBltSize); + *GopBlt =3D AllocatePages (*GopBltSize); IsAllocated =3D TRUE; if (*GopBlt =3D=3D NULL) { return RETURN_OUT_OF_RESOURCES; @@ -329,13 +336,14 @@ TranslateBmpToGopBlt ( =20 *PixelWidth =3D BmpHeader->PixelWidth; *PixelHeight =3D BmpHeader->PixelHeight; - DEBUG ((DEBUG_INFO, "BmpHeader->ImageOffset 0x%X\n", BmpHeader->ImageOff= set)); - DEBUG ((DEBUG_INFO, "BmpHeader->PixelWidth 0x%X\n", BmpHeader->PixelWidt= h)); - DEBUG ((DEBUG_INFO, "BmpHeader->PixelHeight 0x%X\n", BmpHeader->PixelHei= ght)); - DEBUG ((DEBUG_INFO, "BmpHeader->BitPerPixel 0x%X\n", BmpHeader->BitPerPi= xel)); - DEBUG ((DEBUG_INFO, "BmpHeader->ImageSize 0x%X\n", BmpHeader->ImageSize)= ); - DEBUG ((DEBUG_INFO, "BmpHeader->HeaderSize 0x%X\n", BmpHeader->HeaderSiz= e)); - DEBUG ((DEBUG_INFO, "BmpHeader->Size 0x%X\n", BmpHeader->Size)); + DEBUG ((DEBUG_INFO, "BmpHeader :\n")); + DEBUG ((DEBUG_INFO, " ImageOffset 0x%X\n", BmpHeader->ImageOffset)); + DEBUG ((DEBUG_INFO, " PixelWidth 0x%X\n", BmpHeader->PixelWidth)); + DEBUG ((DEBUG_INFO, " PixelHeight 0x%X\n", BmpHeader->PixelHeight)); + DEBUG ((DEBUG_INFO, " BitPerPixel 0x%X\n", BmpHeader->BitPerPixel)); + DEBUG ((DEBUG_INFO, " ImageSize 0x%X\n", BmpHeader->ImageSize)); + DEBUG ((DEBUG_INFO, " HeaderSize 0x%X\n", BmpHeader->HeaderSize)); + DEBUG ((DEBUG_INFO, " Size 0x%X\n", BmpHeader->Size)); =20 // // Translate image from BMP to Blt buffer format --=20 2.38.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107513): https://edk2.groups.io/g/devel/message/107513 Mute This Topic: https://groups.io/mt/100520797/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-