From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 DE1E18046B for ; Mon, 20 Mar 2017 19:37:24 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP; 20 Mar 2017 19:37:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,197,1486454400"; d="scan'208";a="238507386" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 20 Mar 2017 19:37:24 -0700 Received: from fmsmsx114.amr.corp.intel.com (10.18.116.8) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 20 Mar 2017 19:37:24 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX114.amr.corp.intel.com (10.18.116.8) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 20 Mar 2017 19:37:23 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX103.ccr.corp.intel.com ([10.239.4.69]) with mapi id 14.03.0248.002; Tue, 21 Mar 2017 10:37:22 +0800 From: "Gao, Liming" To: "Zeng, Star" , Ard Biesheuvel , "edk2-devel@lists.01.org" , "Tian, Feng" CC: "Yao, Jiewen" Thread-Topic: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't allocate below 4 GB Thread-Index: AQHSoRax5jDFGsozxUWj4JLnCNuwDaGelbEQ Date: Tue, 21 Mar 2017 02:37:21 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14D6F2F32@shsmsx102.ccr.corp.intel.com> References: <1489943988-15378-1-git-send-email-ard.biesheuvel@linaro.org> <0C09AFA07DD0434D9E2A0C6AEB0483103B835A6F@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103B835A6F@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't allocate below 4 GB X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Mar 2017 02:37:25 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. Spec has no such limitation. I agree this change.=20 Reviewed-by: Liming Gao Thanks Liming >-----Original Message----- >From: Zeng, Star >Sent: Monday, March 20, 2017 9:10 AM >To: Ard Biesheuvel ; edk2-devel@lists.01.org; >Tian, Feng >Cc: Yao, Jiewen ; Gao, Liming >; Zeng, Star >Subject: RE: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't >allocate below 4 GB > >I am ok with this patch. > >Jiewen and Liming, do you have any comments? > >Thanks, >Star >-----Original Message----- >From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org] >Sent: Monday, March 20, 2017 1:20 AM >To: edk2-devel@lists.01.org; Zeng, Star ; Tian, Feng > >Cc: Ard Biesheuvel >Subject: [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't >allocate below 4 GB > >The BGRT table has an 8 byte field for the memory address of the image dat= a, >and yet the driver explicitly allocates below 4 GB. This results in an ASS= ERT() >on systems that do not have any memory below 4 GB to begin with. > >Since neither the PI, the UEFI or the ACPI spec contain any mention of why >this data should reside below 4 GB, replace the allocation call with an or= dinary >AllocatePages() call. > >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Ard Biesheuvel >--- > >MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphi >csResourceTableDxe.c | 41 ++------------------ > 1 file changed, 3 insertions(+), 38 deletions(-) > >diff --git >a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >hicsResourceTableDxe.c >b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >hicsResourceTableDxe.c >index 804ffa5a6bb6..6a7165a95489 100644 >--- >a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >hicsResourceTableDxe.c >+++ >b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGrap >h >+++ icsResourceTableDxe.c >@@ -227,43 +227,6 @@ BgrtAcpiTableChecksum ( } > > /** >- Allocate EfiBootServicesData below 4G memory address. >- >- This function allocates EfiBootServicesData below 4G memory address. >- >- @param[in] Size Size of memory to allocate. >- >- @return Allocated address for output. >- >-**/ >-VOID * >-BgrtAllocateBsDataMemoryBelow4G ( >- IN UINTN Size >- ) >-{ >- UINTN Pages; >- EFI_PHYSICAL_ADDRESS Address; >- EFI_STATUS Status; >- VOID *Buffer; >- >- Pages =3D EFI_SIZE_TO_PAGES (Size); >- Address =3D 0xffffffff; >- >- Status =3D gBS->AllocatePages ( >- AllocateMaxAddress, >- EfiBootServicesData, >- Pages, >- &Address >- ); >- ASSERT_EFI_ERROR (Status); >- >- Buffer =3D (VOID *) (UINTN) Address; >- ZeroMem (Buffer, Size); >- >- return Buffer; >-} >- >-/** > Install Boot Graphics Resource Table to ACPI table. > > @return Status code. >@@ -358,11 +321,13 @@ InstallBootGraphicsResourceTable ( > // The image should be stored in EfiBootServicesData, allowing the sy= stem >to reclaim the memory > // > BmpSize =3D (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof >(BMP_IMAGE_HEADER); >- ImageBuffer =3D BgrtAllocateBsDataMemoryBelow4G (BmpSize); >+ 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_IMAGE_HEADER); > mBmpImageHeaderTemplate.PixelWidth =3D (UINT32) mLogoWidth; >-- >2.7.4