From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 B5813207E36A7 for ; Mon, 28 May 2018 21:40:52 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 May 2018 21:40:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,455,1520924400"; d="scan'208";a="59901265" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga001.jf.intel.com with ESMTP; 28 May 2018 21:40:50 -0700 Received: from fmsmsx152.amr.corp.intel.com (10.18.125.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 28 May 2018 21:40:21 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX152.amr.corp.intel.com (10.18.125.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 28 May 2018 18:34:03 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.223]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.70]) with mapi id 14.03.0319.002; Tue, 29 May 2018 09:33:45 +0800 From: "Zeng, Star" To: Ard Biesheuvel , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [edk2] [PATCH v3 4/5] MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages Thread-Index: AQHT9pHifBwTBJIZD0edO7ZW6DNx4KRF7O/w Date: Tue, 29 May 2018 01:33:45 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BB47F22@shsmsx102.ccr.corp.intel.com> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> <20180528144024.10809-5-ard.biesheuvel@linaro.org> In-Reply-To: <20180528144024.10809-5-ard.biesheuvel@linaro.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 4/5] MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 May 2018 04:40:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Star Zeng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ard = Biesheuvel Sent: Monday, May 28, 2018 10:40 PM To: edk2-devel@lists.01.org Cc: Ard Biesheuvel Subject: [edk2] [PATCH v3 4/5] MdeModulePkg/DxeCorePerformanceLib: use Allo= catePeiAccessiblePages Replace the call to and implementation of the function FpdtAllocateReservedMemoryBelow4G() with a call to AllocatePeiAccessiblePag= es, which boils down to the same on X64, but does not crash non-X64 systems= that lack memory below 4 GB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 48 ++= +----------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 71d624fc9ce9..68b29ac5a9e2 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -165,46 +165,6 @@ IsKnownID ( } } =20 -/** - Allocate EfiReservedMemoryType below 4G memory address. - - This function allocates EfiReservedMemoryType below 4G memory address. - - @param[in] Size Size of memory to allocate. - - @return Allocated address for output. - -**/ -VOID * -FpdtAllocateReservedMemoryBelow4G ( - IN UINTN Size - ) -{ - UINTN Pages; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - VOID *Buffer; - - Buffer =3D NULL; - Pages =3D EFI_SIZE_TO_PAGES (Size); - Address =3D 0xffffffff; - - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiReservedMemoryType, - Pages, - &Address - ); - ASSERT_EFI_ERROR (Status); - - if (!EFI_ERROR (Status)) { - Buffer =3D (VOID *) (UINTN) Address; - ZeroMem (Buffer, Size); - } - - return Buffer; -} - /** Allocate buffer for Boot Performance table. =20 @@ -348,7 +308,13 @@ AllocateBootPerformanceTable ( // // Fail to allocate at specified address, continue to allocate at any = address. // - mAcpiBootPerformanceTable =3D (BOOT_PERFORMANCE_TABLE *) FpdtAllocateR= eservedMemoryBelow4G (BootPerformanceDataSize); + mAcpiBootPerformanceTable =3D (BOOT_PERFORMANCE_TABLE *) AllocatePeiAc= cessiblePages ( + EfiReservedMe= moryType, + EFI_SIZE_TO_P= AGES (BootPerformanceDataSize) + ); + if (mAcpiBootPerformanceTable !=3D NULL) { + ZeroMem (mAcpiBootPerformanceTable, BootPerformanceDataSize); + } } DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table = address =3D 0x%x\n", mAcpiBootPerformanceTable)); =20 -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel