From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::230; helo=mail-wr0-x230.google.com; envelope-from=roman.bacik@broadcom.com; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x230.google.com (mail-wr0-x230.google.com [IPv6:2a00:1450:400c:c0c::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1ECCF2063E318 for ; Thu, 3 May 2018 07:46:56 -0700 (PDT) Received: by mail-wr0-x230.google.com with SMTP id q3-v6so17903842wrj.6 for ; Thu, 03 May 2018 07:46:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:references:in-reply-to:mime-version:thread-index:date :message-id:subject:to:cc; bh=ANu0SXjF0bl/S1flc1KTlPuIxtbPNJ++Ol7ur+94J/M=; b=cj2RFkDJi+3bJUkzrd5pZkDCFh/WWz46C0YNecowVhVkPE/xrXLnyLoglLP4E0m5Ed nqwbrUiQxsK6SZiZy39LEBmPWa8v3iOZ442Nv8x1gIKB/0v30004HPpnn4/nQ95CGKQm PF1cRhFlM3GuYNAUSGE8gEuLOANnU8CyxhEy8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:references:in-reply-to:mime-version :thread-index:date:message-id:subject:to:cc; bh=ANu0SXjF0bl/S1flc1KTlPuIxtbPNJ++Ol7ur+94J/M=; b=AXg8HHAF9tmziyyw3J1HoCHxhrniIEoyJ3ZyAYhD6+dluQLz7OXr2rgvykdvpktJnQ C0xNcHmQnNHw6z7yBmHYyKLNwbYvZi7bOlb3qbt1qUPKCH/aTXCJQGwb77uyGmfqA/CU kYG4Z5vp4ZQCMTCxmGEsFih/J+uYiGGjPrhn4U99K3V5HKqUj48jda22O48Ighe7BZwi WyNBcZRxL8gJRzbYqJZr4ncpio6xw0JGhvOMDVmUP3RkvWQN5QiyyOghvGSq0phPXgcF mlltNS8mrrNfZfM3ELR3Md4V7gHysVYAsAlgGLivOZsuWT4kcTOAt6fuZWNiRu53vbLY L7aw== X-Gm-Message-State: ALQs6tAJ2hqh9ane/32kLzOmU82TypI+eJV28cwMHHvdEpbXfqzqqQtE jhAu4fKRG00vOTSfn2qXqP0jfMnh3UYVOb63ihYTPQ== X-Google-Smtp-Source: AB8JxZrBLk+hVw2MLzsOiWBhw+DdsDErHq4BziuC6MvbC/mu0S72t8dG+7T76hBAH/3EFW+yCI7w6NcFhdpOfWZqktc= X-Received: by 2002:adf:c3cd:: with SMTP id d13-v6mr14298411wrg.282.1525358814966; Thu, 03 May 2018 07:46:54 -0700 (PDT) From: Roman Bacik References: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE6C0D@shsmsx102.ccr.corp.intel.com> In-Reply-To: <0C09AFA07DD0434D9E2A0C6AEB0483103BAE6C0D@shsmsx102.ccr.corp.intel.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQKPIRkpdqnJqvYSzTgbyFfqUpHmYAJFLPUzopVtaYA= Date: Thu, 3 May 2018 07:46:53 -0700 Message-ID: <902d4e396a11e3e72643e8a4ef64e5ac@mail.gmail.com> To: "Zeng, Star" , edk2-devel@lists.01.org Cc: "Ni, Ruiyu" , Vladimir Olovyannikov 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 14:46:57 -0000 Content-Type: text/plain; charset="UTF-8" Hi Star, Thank you very much for your reply. Since the BaseAddress is the lowest address in our case we thought this is a bug and the bottom up search starts at BaseAddress and ends at BaseAddress+length-1. What would be the best way to do a search starting from the BaseAddress as the lowest? Do we need to add another search type? Thanks, Roman -----Original Message----- From: Zeng, Star [mailto:star.zeng@intel.com] Sent: Wednesday, May 2, 2018 6:35 PM To: Roman Bacik; edk2-devel@lists.01.org Cc: Ni, Ruiyu; Vladimir Olovyannikov; Zeng, Star Subject: RE: [edk2] [PATCH v2] MdeModulePkg/Core: Fix MaxAddress in Gcd 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 ; 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/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