From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=star.zeng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (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 00B142063E2E6 for ; Wed, 2 May 2018 18:34:52 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 May 2018 18:34:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,356,1520924400"; d="scan'208";a="46348896" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 02 May 2018 18:34:52 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 2 May 2018 18:34:52 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.79]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.6]) with mapi id 14.03.0319.002; Thu, 3 May 2018 09:34:50 +0800 From: "Zeng, Star" To: Roman Bacik , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" , Vladimir Olovyannikov , "Zeng, Star" Thread-Topic: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd Thread-Index: AQHT4j/FjBKf0RHhSkS5+A2ptnAYvaQdOLqA Date: Thu, 3 May 2018 01:34:49 +0000 Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE6C0D@shsmsx102.ccr.corp.intel.com> References: In-Reply-To: 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 v2] MdeModulePkg/Core: Fix MaxAddress in Gcd 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: Thu, 03 May 2018 01:34:53 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress comes fro= m input BaseAddress parameter. The original code logic is correct according to PI spec. PI Spec: If GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp, then the GCD memory space map is searched from the lowest address up to BaseAddress look= ing for unallocated memory ranges of Length bytes beginning on a boundary specified= by Alignment that matches GcdMemoryType. If GcdAllocateType is EfiGcdAllocateMaxAddressSearchTopDown, then the GCD memory space map is searched from BaseAddress down to the lowest address lo= oking for unallocated memory ranges of Length bytes beginning on a boundary specified= by Alignment that matches GcdMemoryType. Thanks, Star -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Roma= n Bacik Sent: Thursday, May 3, 2018 2:01 AM To: edk2-devel@lists.01.org Cc: Ni, Ruiyu ; Vladimir Olovyannikov Subject: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd When BottomUp search is used the MaxAddress is incorrectly chosen to be the BaseAddress instead of the EndAddress. Cc: Ruiyu Ni Cc: Vladimir Olovyannikov Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Roman Bacik --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gc= d.c index e17e98230b79..9eeb2bd74599 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -1170,8 +1170,8 @@ CoreAllocateSpace ( // // Compute the maximum address to use in the search algorithm // - if (GcdAllocateType =3D=3D EfiGcdAllocateMaxAddressSearchBottomUp || - GcdAllocateType =3D=3D EfiGcdAllocateMaxAddressSearchTopDown ) { + if (GcdAllocateType =3D=3D EfiGcdAllocateMaxAddressSearchTopDown || + GcdAllocateType =3D=3D EfiGcdAllocateAnySearchTopDown ) { MaxAddress =3D *BaseAddress; } else { MaxAddress =3D Entry->EndAddress; --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel