From patchwork Thu Nov 30 15:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120214 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809867qgn; Thu, 30 Nov 2017 07:25:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMapR89cVGK76mAXQxMO+DGhvyRACM1rUI1RXoTp2HPp2WS7ND6E/V4UYjHcTQAUTwF01yXU X-Received: by 10.159.231.15 with SMTP id w15mr3040937plq.410.1512055525982; Thu, 30 Nov 2017 07:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055525; cv=none; d=google.com; s=arc-20160816; b=EncTmQbl4EsW8y7J1tsn0RxqNXngDqf25DgXvi7jLPSVPwvupYdCusuGzgqT5IHSPQ 263Uhq+cGoD24ZgAXlO/7Zjl8RQF8UnLQXNxCdJ6D671fVwLa8FmwpR4fChqJBXY/yLx 3W112zlhgpZYi3pF8tm7/eTnBe84CzCZx68SEGili8OetSq7cGA+cmhu7Wxc2Ejrq6eo YPfwWngtfbGSVrWdinlCYYuUNDz4RYpJHPpnQCNlmPDpdE5pIR2FRL7GeWjyERmA34SJ ILd1xb8+HnQ6gLA6lwUTk2MRwygYDtjXUCephapkxRtNV/f+jjqPNpPeGDGl02i5TZE2 dxYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=6BXnNbW8x3Yp08M9qwve6bRS8xI4fUDFwkQll+tHBR8=; b=Khyb50tqYW0lV2kAvIAApm1WZ99EhB3AL/2GLppSTifL/UX330Ec9Q7qRh632HvkjZ KaS0JiKDvd2rDOMl56nrawbUJm3guta1pnmQFQ1BUGiqUDgdnAboil2ZKfgpvD59+8Ke MjgIVBnnLlC42LcQQVj0lqjdvlGOBsckVtQ+20lhY6pCH619iYq04wyTw3n2DHfm5g1C 1KCgDwkUu+Da+7VkjzrEJV1osm+bDVP+8TmENm/yA15nXqFi3asKQccceGuKeM75nIta fR2RVQzUjC6kJek8uTf1z2VoKi7JZatkl7qZD2W7Yxsi4p05xG6LrhgOIQvtW+l/bpGU jL5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OpBCdKl1; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id c10si3154711pgn.333.2017.11.30.07.25.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OpBCdKl1; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 014342211B438; Thu, 30 Nov 2017 07:20:57 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (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 677912211B42D for ; Thu, 30 Nov 2017 07:20:55 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id 64so13059283wme.3 for ; Thu, 30 Nov 2017 07:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A5jmI5y9pF0gmRd5PKK/crUOIfWQw93y9kbUkqiD68A=; b=OpBCdKl1b86K2nSCZ65VkOBBoA6+T0F7L2STuufnes0bd1k2DD1qCQgz6mFbPeiEdM jqRTYCN6nJtYei4Ei0ZytCE6s85Dkt+M1l9v7VnY4NL+S+zyabT4OmYtYeAb+pl1vX81 Clb/IuNDmescHjocF1n1yLexYS71uLzgj/6Lc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A5jmI5y9pF0gmRd5PKK/crUOIfWQw93y9kbUkqiD68A=; b=LHMjZOUzbLseE8w+XW3I+Dy8s27cS6vQioGYeQIQytWoYpXa4IQblcvJwv6lzf6GKp tBKl/bZSnAa+n/oUg++dx06HqT6Ni6/0fXSMTTDRsWdg5gR3T1pTcM6x7MEXVYTi5bw0 7m/Cdtibm5eFtYoem6ZYh/YcfWMMB0HEuOpujNG2Uv3gor9k7HfYXozC0J28I/5kX7Pn HXXYdTvtR9nPOBzJ8crNCS0nS16jSb4uq08STGywNCpqy2cg62qxSR1wSjBikx4H5xgl jXAVIww6o12fweaokXKe+9e++Cspzid61/Zw2a+F8pMpSM3kr0dnQT8vaPwykjt8ROuK /Ong== X-Gm-Message-State: AJaThX7J62Vtgwuix15CW4vQrFDbn9SWsQDXi48I+itsHE5LadXBCuxJ +c/uC2wwJiIGGCWsPxTjLeeIgH+IfFI= X-Received: by 10.28.95.7 with SMTP id t7mr2336445wmb.86.1512055519203; Thu, 30 Nov 2017 07:25:19 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:18 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:51 +0000 Message-Id: <20171130152453.19205-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171130152453.19205-1-ard.biesheuvel@linaro.org> References: <20171130152453.19205-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 5/7] ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory 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: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Meenakshi Aggarwal Now that PrePi no longer exposes its internal code via special HOBs, we can remove the special handling of the primary FV, which needed to be reserved so that DXE core could call into the PE/COFF and LZMA libraries in the PrePi module. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar Signed-off-by: Meenakshi Aggarwal [ardb: updated commit log] Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c | 69 -------------------- 1 file changed, 69 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c index 2feb11f21d5d..d03214b5df66 100644 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c @@ -70,11 +70,7 @@ MemoryPeim ( { ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; - UINT64 ResourceLength; EFI_PEI_HOB_POINTERS NextHob; - EFI_PHYSICAL_ADDRESS FdTop; - EFI_PHYSICAL_ADDRESS SystemMemoryTop; - EFI_PHYSICAL_ADDRESS ResourceTop; BOOLEAN Found; // Get Virtual Memory Map from the Platform Library @@ -121,71 +117,6 @@ MemoryPeim ( ); } - // - // Reserved the memory space occupied by the firmware volume - // - - SystemMemoryTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase) + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize); - FdTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFdSize); - - // EDK2 does not have the concept of boot firmware copied into DRAM. To avoid the DXE - // core to overwrite this area we must mark the region with the attribute non-present - if ((PcdGet64 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) { - Found = FALSE; - - // Search for System Memory Hob that contains the firmware - NextHob.Raw = GetHobList (); - while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) { - if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) && - (PcdGet64 (PcdFdBaseAddress) >= NextHob.ResourceDescriptor->PhysicalStart) && - (FdTop <= NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength)) - { - ResourceAttributes = NextHob.ResourceDescriptor->ResourceAttribute; - ResourceLength = NextHob.ResourceDescriptor->ResourceLength; - ResourceTop = NextHob.ResourceDescriptor->PhysicalStart + ResourceLength; - - if (PcdGet64 (PcdFdBaseAddress) == NextHob.ResourceDescriptor->PhysicalStart) { - if (SystemMemoryTop == FdTop) { - NextHob.ResourceDescriptor->ResourceAttribute = ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT; - } else { - // Create the System Memory HOB for the firmware with the non-present attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Top of the FD is system memory available for UEFI - NextHob.ResourceDescriptor->PhysicalStart += PcdGet32(PcdFdSize); - NextHob.ResourceDescriptor->ResourceLength -= PcdGet32(PcdFdSize); - } - } else { - // Create the System Memory HOB for the firmware with the non-present attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Update the HOB - NextHob.ResourceDescriptor->ResourceLength = PcdGet64 (PcdFdBaseAddress) - NextHob.ResourceDescriptor->PhysicalStart; - - // If there is some memory available on the top of the FD then create a HOB - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + ResourceLength) { - // Create the System Memory HOB for the remaining region (top of the FD) - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes, - FdTop, - ResourceTop - FdTop); - } - } - Found = TRUE; - break; - } - NextHob.Raw = GET_NEXT_HOB (NextHob); - } - - ASSERT(Found); - } - // Build Memory Allocation Hob InitMmu (MemoryTable);