public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Zeng, Star" <star.zeng@intel.com>
To: Roman Bacik <roman.bacik@broadcom.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd
Date: Thu, 3 May 2018 01:34:49 +0000	[thread overview]
Message-ID: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE6C0D@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <CAGQAs7wbAemrcw-Kve4ugMDq2YOYxt9YA-ftasJ-z4nhKznuVg@mail.gmail.com>

The GcdAllocateType are EfiGcdAllocateMaxAddress*, the MaxAddress comes from 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 looking 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 looking 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 Roman Bacik
Sent: Thursday, May 3, 2018 2:01 AM
To: edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
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 <ruiyu.ni@intel.com>
Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Roman Bacik <roman.bacik@broadcom.com>
---
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/Gcd.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 == EfiGcdAllocateMaxAddressSearchBottomUp ||
- GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ) {
+ if (GcdAllocateType == EfiGcdAllocateMaxAddressSearchTopDown ||
+ GcdAllocateType == EfiGcdAllocateAnySearchTopDown ) {
MaxAddress = *BaseAddress;
} else {
MaxAddress = Entry->EndAddress;
-- 
1.9.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-05-03  1:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 18:01 [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd Roman Bacik
2018-05-03  1:34 ` Zeng, Star [this message]
2018-05-03 14:46   ` Roman Bacik
2018-05-03 16:11   ` Roman Bacik
2018-05-04  2:14     ` Zeng, Star

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0C09AFA07DD0434D9E2A0C6AEB0483103BAE6C0D@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox