From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 28954941E6F for ; Thu, 27 Jul 2023 23:58:04 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=mkoZjG4g6uakZL1tTKhRHp6hmFtzkRnaeDwFCsOfgOY=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1690502282; v=1; b=kEnnnLhWEhXJnQfVQDA/8aNnXiwE3hqW7vwqT2IhKDLIkcCjli+jPhmAQGgRU5fyOgJ2WlKU knA1t++4HeC3jwiVxu2ypkOTt2yO++WxQc/dOvgls+XVoQbkJ4zaDeGnE58B5X+J3/AEHShRUNt BuROSq0Pl3VdpfMtfLPAWjfo= X-Received: by 127.0.0.2 with SMTP id wiqFYY7687511xYCBgThTuKb; Thu, 27 Jul 2023 16:58:02 -0700 X-Received: from mail-ua1-f45.google.com (mail-ua1-f45.google.com [209.85.222.45]) by mx.groups.io with SMTP id smtpd.web10.22110.1690502282030282424 for ; Thu, 27 Jul 2023 16:58:02 -0700 X-Received: by mail-ua1-f45.google.com with SMTP id a1e0cc1a2514c-78f1210e27fso547062241.1 for ; Thu, 27 Jul 2023 16:58:01 -0700 (PDT) X-Gm-Message-State: ryJAJBxl1f8vul3EhUX8lz8ex7686176AA= X-Google-Smtp-Source: APBJJlFt4gPXea9a8DAwhUNKxi/kWN8CJT+ePcooheCyKVQNNACBvFBbiPbSOiQ6OfoPESI+VJRh7/Fe7vBWDLFyTIA= X-Received: by 2002:a67:f950:0:b0:43f:561c:2ea3 with SMTP id u16-20020a67f950000000b0043f561c2ea3mr792779vsq.21.1690502280836; Thu, 27 Jul 2023 16:58:00 -0700 (PDT) MIME-Version: 1.0 References: <98d6a4e6edccdd8ecc9f221c4248b96fe004f80a.1690447281.git.chitralekha.ck@intel.com> In-Reply-To: <98d6a4e6edccdd8ecc9f221c4248b96fe004f80a.1690447281.git.chitralekha.ck@intel.com> From: "Pedro Falcato" Date: Fri, 28 Jul 2023 00:57:49 +0100 Message-ID: Subject: Re: [edk2-devel] [PATCH v2] MdeModulePkg: AllocatePages for TranslateBmpToGopBlt To: devel@edk2.groups.io, chitralekha.ck@intel.com Cc: Ray Ni , Zhichao Gao , Ashraf Ali S , Chinni B Duggapu 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,pedro.falcato@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=kEnnnLhW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On Thu, Jul 27, 2023 at 4:40=E2=80=AFPM chitralekha ck wrote: > > 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__ If you really want to change this (why??), change this separately (as another commit/patch), like Ard told you before. This patch should only have AllocatePool -> AllocatePages changes. > > 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/Mde= ModulePkg/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 bu= ffer > 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 w= ill be > + EFI_BOOT_SERVICES.AllocatePages(). If a GopBlt buffer is passed in it = will be > used if it is big enough. > > @param[in] BmpImage Pointer to BMP file. > @@ -113,14 +113,14 @@ TranslateBmpToGopBlt ( > } > > 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; > } > > BmpHeader =3D (BMP_IMAGE_HEADER *)BmpImage; > > if ((BmpHeader->CharB !=3D 'B') || (BmpHeader->CharM !=3D 'M')) { > - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->Char fields i= ncorrect\n")); > + DEBUG ((DEBUG_ERROR, "%a: BmpHeader->Char fields incorrect\n", __fun= c__)); > return RETURN_UNSUPPORTED; > } > > @@ -128,12 +128,12 @@ TranslateBmpToGopBlt ( > // Doesn't support compress. > // > if (BmpHeader->CompressionType !=3D 0) { > - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: Compression Type unsuppo= rted.\n")); > + DEBUG ((DEBUG_ERROR, "%a: Compression Type unsupported\n", __func__)= ); > return RETURN_UNSUPPORTED; > } > > if ((BmpHeader->PixelHeight =3D=3D 0) || (BmpHeader->PixelWidth =3D=3D= 0)) { > - DEBUG ((DEBUG_ERROR, "TranslateBmpToGopBlt: BmpHeader->PixelHeight o= r BmpHeader->PixelWidth is 0.\n")); > + DEBUG ((DEBUG_ERROR, "%a: BmpHeader PixelHeight or PixelWidth is 0\n= ", __func__)); > return RETURN_UNSUPPORTED; > } > > @@ -144,7 +144,8 @@ TranslateBmpToGopBlt ( > if (BmpHeader->HeaderSize !=3D sizeof (BMP_IMAGE_HEADER) - OFFSET_OF (= BMP_IMAGE_HEADER, HeaderSize)) { > DEBUG (( > DEBUG_ERROR, > - "TranslateBmpToGopBlt: BmpHeader->Headership is not as expected. = Headersize 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 BitPerP= ixel: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 > )); > > @@ -189,7 +192,8 @@ TranslateBmpToGopBlt ( > if (EFI_ERROR (Status)) { > DEBUG (( > DEBUG_ERROR, > - "TranslateBmpToGopBlt: invalid BmpImage... DataSizePerLine:0x%x Pi= xelHeight: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 DataSi= zePerLine: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-= >ImageOffset)); > - 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)); I don't see why this is being changed either. > > return RETURN_UNSUPPORTED; > } > @@ -279,7 +284,8 @@ TranslateBmpToGopBlt ( > if (EFI_ERROR (Status)) { > DEBUG (( > DEBUG_ERROR, > - "TranslateBmpToGopBlt: invalid BltBuffer needed size... PixelWidth= :0x%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 = struct 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); This is wrong, AllocatePages takes pages, not bytes. > IsAllocated =3D TRUE; > if (*GopBlt =3D=3D NULL) { > return RETURN_OUT_OF_RESOURCES; > @@ -329,13 +336,14 @@ TranslateBmpToGopBlt ( > > *PixelWidth =3D BmpHeader->PixelWidth; > *PixelHeight =3D BmpHeader->PixelHeight; > - DEBUG ((DEBUG_INFO, "BmpHeader->ImageOffset 0x%X\n", BmpHeader->ImageO= ffset)); > - DEBUG ((DEBUG_INFO, "BmpHeader->PixelWidth 0x%X\n", BmpHeader->PixelWi= dth)); > - DEBUG ((DEBUG_INFO, "BmpHeader->PixelHeight 0x%X\n", BmpHeader->PixelH= eight)); > - DEBUG ((DEBUG_INFO, "BmpHeader->BitPerPixel 0x%X\n", BmpHeader->BitPer= Pixel)); > - DEBUG ((DEBUG_INFO, "BmpHeader->ImageSize 0x%X\n", BmpHeader->ImageSiz= e)); > - DEBUG ((DEBUG_INFO, "BmpHeader->HeaderSize 0x%X\n", BmpHeader->HeaderS= ize)); > - 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)); ditto. > > // > // Translate image from BMP to Blt buffer format > -- > 2.38.1.windows.1 > > > >=20 > > --=20 Pedro -=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 (#107305): https://edk2.groups.io/g/devel/message/107305 Mute This Topic: https://groups.io/mt/100392976/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-