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: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-Google-Smtp-Source: AGs4zMZ1qThTk2WvM7VRocKveTaBJY3WaI6vscU5lMYfdfeEIixEoGOM7oUvoj9lWbpLn6vjcudT7w== 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 Cc: leif.lindholm@linaro.org, Ard Biesheuvel , Udit Kumar , Meenakshi Aggarwal , Sakar Arora 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: [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: , X-List-Received-Date: Thu, 30 Nov 2017 15:20:55 -0000 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(-) 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); -- 2.11.0