From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512055513321128.69268109276697; Thu, 30 Nov 2017 07:25:13 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EB42D220F3C57; Thu, 30 Nov 2017 07:20:46 -0800 (PST) Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 8BC4C220C1C3A for ; Thu, 30 Nov 2017 07:20:44 -0800 (PST) Received: by mail-wr0-x242.google.com with SMTP id z18so6995699wrb.8 for ; Thu, 30 Nov 2017 07:25:09 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:07 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=2nAHojVZq8zkPAaar3KqDfrRhqtVEJxSroGuGu9Am+o=; b=Wh617l6krpUdR8kn05uXnNkREcm5BPcWbI7tDd+hHBAHyiMaANlSE/2zBPuqNEqZIp OMxZ/f2P7CQSgQd2Jau5h7Xh23HFt4rpHI+Rp/sIe3QIxLCbiE1550B6jIDP1x4YOsPz y8XFmsHlKzZ/X2G4doNLvZZrlvuKbrV0dIEfk= 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=2nAHojVZq8zkPAaar3KqDfrRhqtVEJxSroGuGu9Am+o=; b=UlyTh8EnHX1TFKv4qL6vvVjjTgNKBzCR5tBqgVaIxvrPVABJZTojxUa6tAR7NOvq/o vmhRwewwvluICHAO85FnGra3CSkr0Mfv/FI3Qwg0OWjsyPhYmPfQKDaYY/L/aZ9dtxWA lEUjvXUinCodYTL92svyGucStd/8IfAUH3SpzBTEQZLh0o/lUaS6ptCIFl/Z+Y2Eujbz TxaIREH41A87QK/UhbHqPHUIc7xaFh4b+hk/OLQREqN7JjHFroe23KURxpIJ5lFG/DfP qwcNS69YSnkZgP7IYKQkn/Jv6j1+hAiPEPMCl9EGLD3MlDWtNuGlKQ+ihms8PXb63sJ7 Z4JA== X-Gm-Message-State: AJaThX5bBXLUdOsXPlbyTHUsh9WVuiIW13nhSDsDv05M2y3a5vUO0U6m KxbY9uaokCGzZSvEWTZy6nLiO4Jo0pA= X-Google-Smtp-Source: AGs4zMa8doSiEQwkDLjOTe7oIKm7VhDX17k61dEqjON3PGT4ZOdUeeIR/eFBhef+LtIxOp6yAV12nQ== X-Received: by 10.223.162.152 with SMTP id s24mr2432082wra.151.1512055508333; Thu, 30 Nov 2017 07:25:08 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:47 +0000 Message-Id: <20171130152453.19205-2-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 1/7] EmbeddedPkg BeagleBoardPkg: move special HOB reuse libraries into platform 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The BeagleBoard platform uses PeCoffLib and CustomDecompressLib implementations that invoke the library code that resides in the PrePi module via pointers exposed via special GUIDed HOBs. This is a nice hack, but not necessarily something we want to carry in reference code. So as a first step, move the libraries that expose this reused code into BeagleBoardPkg, and remove it from EmbeddedPkg. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BeagleBoardPkg/BeagleBoardPkg.dsc = | 6 +++--- {EmbeddedPkg =3D> BeagleBoardPkg}/Library/DxeHobPeCoffLib/DxeHobPeCoff.c = | 0 {EmbeddedPkg =3D> BeagleBoardPkg}/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.= inf | 0 {EmbeddedPkg =3D> BeagleBoardPkg}/Library/LzmaHobCustomDecompressLib/LzmaH= obCustomDecompressLib.c | 0 {EmbeddedPkg =3D> BeagleBoardPkg}/Library/LzmaHobCustomDecompressLib/LzmaH= obCustomDecompressLib.inf | 0 EmbeddedPkg/EmbeddedPkg.dsc = | 2 -- 6 files changed, 3 insertions(+), 5 deletions(-) diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoard= Pkg.dsc index 2837ef3c0639..f74e58399989 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc @@ -172,7 +172,7 @@ [LibraryClasses.common.DXE_CORE] UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf # PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf + PeCoffLib|BeagleBoardPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf =20 PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform= anceLib.inf =20 @@ -203,7 +203,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeL= ibFramework/DxeReportStatusCodeLib.inf CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf # PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf - PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf + PeCoffLib|BeagleBoardPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf =20 =20 [LibraryClasses.ARM] @@ -386,7 +386,7 @@ [Components.common] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf - NULL|EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDec= ompressLib.inf + NULL|BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustom= DecompressLib.inf } =20 ArmPkg/Drivers/CpuDxe/CpuDxe.inf diff --git a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c b/BeagleBoa= rdPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c similarity index 100% rename from EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c rename to BeagleBoardPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c diff --git a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf b/Beag= leBoardPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf similarity index 100% rename from EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf rename to BeagleBoardPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf diff --git a/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDe= compressLib.c b/BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCu= stomDecompressLib.c similarity index 100% rename from EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDec= ompressLib.c rename to BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDe= compressLib.c diff --git a/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDe= compressLib.inf b/BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHob= CustomDecompressLib.inf similarity index 100% rename from EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDec= ompressLib.inf rename to BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDe= compressLib.inf diff --git a/EmbeddedPkg/EmbeddedPkg.dsc b/EmbeddedPkg/EmbeddedPkg.dsc index 073a1568844c..af965c2036cb 100644 --- a/EmbeddedPkg/EmbeddedPkg.dsc +++ b/EmbeddedPkg/EmbeddedPkg.dsc @@ -241,7 +241,6 @@ [Components.common] EmbeddedPkg/Library/PrePiLib/PrePiLib.inf EmbeddedPkg/Library/TemplateResetSystemLib/TemplateResetSystemLib.inf EmbeddedPkg/Library/TemplateRealTimeClockLib/TemplateRealTimeClockLib.inf - EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLi= b.inf EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoa= derLibDefault.inf @@ -263,7 +262,6 @@ [Components.common] =20 EmbeddedPkg/Library/AcpiLib/AcpiLib.inf EmbeddedPkg/Library/DebugAgentTimerLibNull/DebugAgentTimerLibNull.inf - EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf EmbeddedPkg/Library/FdtLib/FdtLib.inf EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512055515608292.01927446996547; Thu, 30 Nov 2017 07:25:15 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3D60D220F3C4F; Thu, 30 Nov 2017 07:20:49 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 7CCD5220C1C3A for ; Thu, 30 Nov 2017 07:20:48 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id g130so2006914wme.0 for ; Thu, 30 Nov 2017 07:25:13 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:10 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=EGHr74H67msWGutMevrhEqY+IL8yU12IXeNHGzrptv4=; b=ZUKfozXoAXu2zyWJ1IYhHsEDxeZ5XE/16f2GT3R9R/OGQQo4ZJUBnCRQIfXED7Mxqn lEFyvv/KFM7JzGczlav9C9MiOQKWkBQXkczTI0wYp0K8dCVsFNBtl8BLGYVgnVQEXf6n Nb9ynqmrRxXpkDeUOjMOyPUbxKOYMdkpp01xw= 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=EGHr74H67msWGutMevrhEqY+IL8yU12IXeNHGzrptv4=; b=rro4Pe8RNB9W0WFJQcRI+Pz++xPf1uv6mlHb4jPElfw5i1vtJcCLrltMXFc7Kg59ot SGI2OHyryvRNDW4/VpX38f9YBWXjLfyHZAZ2bViLOV75enG2G6fXd+H+k7BbCTYYTCC/ nvp9ggP3880hRmPBbvpX4BmsZ5MyIbRG1ty459QpRumth7A/KQ+GRScY8/xw/KxFwEc/ wqGdvvEMdzzYsWWrD30KtWoHsraD9B5gzZsN/2PdHPP6SOxHt3FN4vtmCqz4p85PoUNW H9O/gI2WUb8OfeX+9LQjTf3csyptjULgpK2MVFkCutMjlnCUpFWI7Loy3VXypZA9sqe1 oIjw== X-Gm-Message-State: AJaThX68zQz2O8jI5C9+Gky0dhtKH3j9CP7E+qxNY871iziEuJ3xROAk pYcXBsULOJVnLUQlP1wtuDmXCSweaog= X-Google-Smtp-Source: AGs4zMYG1JGvcU7cvQn6sBJYNkRoc1KuHXdjMpWdE04CH8vkhgvaLt0gZKZZmFEINz6qb41MIxb8HQ== X-Received: by 10.28.13.145 with SMTP id 139mr934893wmn.24.1512055511671; Thu, 30 Nov 2017 07:25:11 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:48 +0000 Message-Id: <20171130152453.19205-3-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 2/7] BeagleBoardPkg: create private PrePi implementation 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Clone the PrePi implementation for BeagleBoardPkg, so we can start removing some of the awkward optimizations that we'd rather not keep in reference code. Note that we only clone the unicore ARM flavor, which is all we need for BeagleBoard. In the case of PrePi, it involves libraries included by the SEC startup code that are exposed to DXE core via HOBs containing function pointers, which forces us to keep the primary FV reserved in memory. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BeagleBoardPkg/BeagleBoardPkg.dsc | 6 +- BeagleBoardPkg/BeagleBoardPkg.fdf | 2 +- BeagleBoardPkg/PrePi/Arm/ArchPrePi.c | 29 +++ BeagleBoardPkg/PrePi/Arm/ModuleEntryPoint.S | 130 +++++++++++++ BeagleBoardPkg/PrePi/Arm/ModuleEntryPoint.asm | 148 +++++++++++++++ BeagleBoardPkg/PrePi/LzmaDecompress.h | 103 ++++++++++ BeagleBoardPkg/PrePi/MainUniCore.c | 39 ++++ BeagleBoardPkg/PrePi/PeiUniCore.inf | 104 ++++++++++ BeagleBoardPkg/PrePi/PrePi.c | 198 ++++++++++++++++++++ BeagleBoardPkg/PrePi/PrePi.h | 90 +++++++++ 10 files changed, 846 insertions(+), 3 deletions(-) diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoard= Pkg.dsc index f74e58399989..a1715593770a 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc @@ -142,7 +142,6 @@ [LibraryClasses.common.SEC] ReportStatusCodeLib|MdeModulePkg/Library/PeiDxeDebugLibReportStatusCode/= PeiDxeDebugLibReportStatusCode.inf UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib= /PrePiExtractGuidedSectionLib.inf - LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCusto= mDecompressLib.inf =20 PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf =20 @@ -377,7 +376,10 @@ [Components.common] # # SEC # - ArmPlatformPkg/PrePi/PeiUniCore.inf + BeagleBoardPkg/PrePi/PeiUniCore.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompre= ssLib.inf + } =20 # # DXE diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf b/BeagleBoardPkg/BeagleBoard= Pkg.fdf index 71249c7eb3d7..83d85fce4070 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.fdf +++ b/BeagleBoardPkg/BeagleBoardPkg.fdf @@ -209,7 +209,7 @@ [FV.FVMAIN_COMPACT] READ_LOCK_CAP =3D TRUE READ_LOCK_STATUS =3D TRUE =20 - INF ArmPlatformPkg/PrePi/PeiUniCore.inf + INF BeagleBoardPkg/PrePi/PeiUniCore.inf =20 FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE { diff --git a/BeagleBoardPkg/PrePi/Arm/ArchPrePi.c b/BeagleBoardPkg/PrePi/Ar= m/ArchPrePi.c new file mode 100644 index 000000000000..075eb89e1b03 --- /dev/null +++ b/BeagleBoardPkg/PrePi/Arm/ArchPrePi.c @@ -0,0 +1,29 @@ +/** @file +* +* Copyright (c) 2011 - 2013, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD License +* which accompanies this distribution. The full text of the license may = be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +* +**/ + +#include "PrePi.h" + +VOID +ArchInitialize ( + VOID + ) +{ + // Enable program flow prediction, if supported. + ArmEnableBranchPrediction (); + + if (FixedPcdGet32 (PcdVFPEnabled)) { + ArmEnableVFP (); + } +} + diff --git a/BeagleBoardPkg/PrePi/Arm/ModuleEntryPoint.S b/BeagleBoardPkg/P= rePi/Arm/ModuleEntryPoint.S new file mode 100644 index 000000000000..212cab62d44b --- /dev/null +++ b/BeagleBoardPkg/PrePi/Arm/ModuleEntryPoint.S @@ -0,0 +1,130 @@ +// +// Copyright (c) 2011-2015, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the = BSD License +// which accompanies this distribution. The full text of the license may= be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. +// +// + +#include + +#include + +ASM_FUNC(_ModuleEntryPoint) + // Do early platform specific actions + bl ASM_PFX(ArmPlatformPeiBootAction) + + // Get ID of this CPU in Multicore system + bl ASM_PFX(ArmReadMpidr) + // Keep a copy of the MpId register value + mov r8, r0 + +_SetSVCMode: + // Enter SVC mode, Disable FIQ and IRQ + mov r1, #(CPSR_MODE_SVC | CPSR_IRQ | CPSR_FIQ) + msr CPSR_c, r1 + +// Check if we can install the stack at the top of the System Memory or if= we need +// to install the stacks at the bottom of the Firmware Device (case the FD= is located +// at the top of the DRAM) +_SystemMemoryEndInit: + ADRL (r1, mSystemMemoryEnd) + ldrd r2, r3, [r1] + teq r3, #0 + moveq r1, r2 + mvnne r1, #0 + +_SetupStackPosition: + // r1 =3D SystemMemoryTop + + // Calculate Top of the Firmware Device + MOV32 (r2, FixedPcdGet32(PcdFdBaseAddress)) + MOV32 (r3, FixedPcdGet32(PcdFdSize) - 1) + add r3, r3, r2 // r3 =3D FdTop =3D PcdFdBaseAddress + PcdFdSize + + // UEFI Memory Size (stacks are allocated in this region) + MOV32 (r4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize)) + + // + // Reserve the memory for the UEFI region (contain stacks on its top) + // + + // Calculate how much space there is between the top of the Firmware and= the Top of the System Memory + subs r0, r1, r3 // r0 =3D SystemMemoryTop - FdTop + bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Cas= e when the PrePi is in XIP memory outside of the DRAM + cmp r0, r4 + bge _SetupStack + + // Case the top of stacks is the FdBaseAddress + mov r1, r2 + +_SetupStack: + // r1 contains the top of the stack (and the UEFI Memory) + + // Because the 'push' instruction is equivalent to 'stmdb' (decrement be= fore), we need to increment + // one to the top of the stack. We check if incrementing one does not ov= erflow (case of DRAM at the + // top of the memory space) + adds r9, r1, #1 + bcs _SetupOverflowStack + +_SetupAlignedStack: + mov r1, r9 + b _GetBaseUefiMemory + +_SetupOverflowStack: + // Case memory at the top of the address space. Ensure the top of the st= ack is EFI_PAGE_SIZE + // aligned (4KB) + MOV32 (r9, ~EFI_PAGE_MASK & 0xFFFFFFFF) + and r1, r1, r9 + +_GetBaseUefiMemory: + // Calculate the Base of the UEFI Memory + sub r9, r1, r4 + +_GetStackBase: + // r1 =3D The top of the Mpcore Stacks + // Stack for the primary core =3D PrimaryCoreStack + MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) + sub r10, r1, r2 + + // Stack for the secondary core =3D Number of Cores - 1 + MOV32 (r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreS= econdaryStackSize)) + sub r10, r10, r1 + + // r10 =3D The base of the MpCore Stacks (primary stack & secondary stac= ks) + mov r0, r10 + mov r1, r8 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackS= ize) + MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) + MOV32 (r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) + bl ASM_PFX(ArmPlatformStackSet) + + // Is it the Primary Core ? + mov r0, r8 + bl ASM_PFX(ArmPlatformIsPrimaryCore) + cmp r0, #1 + bne _PrepareArguments + +_PrepareArguments: + mov r0, r8 + mov r1, r9 + mov r2, r10 + mov r3, sp + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped ali= as) + ldr r4, =3DASM_PFX(CEntryPoint) + + // Jump to PrePiCore C code + // r0 =3D MpId + // r1 =3D UefiMemoryBase + // r2 =3D StacksBase + blx r4 + +_NeverReturn: + b _NeverReturn diff --git a/BeagleBoardPkg/PrePi/Arm/ModuleEntryPoint.asm b/BeagleBoardPkg= /PrePi/Arm/ModuleEntryPoint.asm new file mode 100644 index 000000000000..80c2877cbdbf --- /dev/null +++ b/BeagleBoardPkg/PrePi/Arm/ModuleEntryPoint.asm @@ -0,0 +1,148 @@ +// +// Copyright (c) 2011-2015, ARM Limited. All rights reserved. +// +// This program and the accompanying materials +// are licensed and made available under the terms and conditions of the = BSD License +// which accompanies this distribution. The full text of the license may= be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. +// +// + +#include +#include + + INCLUDE AsmMacroIoLib.inc + + IMPORT CEntryPoint + IMPORT ArmPlatformIsPrimaryCore + IMPORT ArmReadMpidr + IMPORT ArmPlatformPeiBootAction + IMPORT ArmPlatformStackSet + IMPORT mSystemMemoryEnd + + EXPORT _ModuleEntryPoint + + PRESERVE8 + AREA PrePiCoreEntryPoint, CODE, READONLY + +StartupAddr DCD CEntryPoint + +_ModuleEntryPoint + // Do early platform specific actions + bl ArmPlatformPeiBootAction + + // Get ID of this CPU in Multicore system + bl ArmReadMpidr + // Keep a copy of the MpId register value + mov r8, r0 + +_SetSVCMode + // Enter SVC mode, Disable FIQ and IRQ + mov r1, #(CPSR_MODE_SVC :OR: CPSR_IRQ :OR: CPSR_FIQ) + msr CPSR_c, r1 + +// Check if we can install the stack at the top of the System Memory or if= we need +// to install the stacks at the bottom of the Firmware Device (case the FD= is located +// at the top of the DRAM) +_SystemMemoryEndInit + adrll r1, mSystemMemoryEnd + ldrd r2, r3, [r1] + teq r3, #0 + moveq r1, r2 + mvnne r1, #0 + +_SetupStackPosition + // r1 =3D SystemMemoryTop + + // Calculate Top of the Firmware Device + mov32 r2, FixedPcdGet32(PcdFdBaseAddress) + mov32 r3, FixedPcdGet32(PcdFdSize) + sub r3, r3, #1 + add r3, r3, r2 // r3 =3D FdTop =3D PcdFdBaseAddress + PcdFdSize + + // UEFI Memory Size (stacks are allocated in this region) + mov32 r4, FixedPcdGet32(PcdSystemMemoryUefiRegionSize) + + // + // Reserve the memory for the UEFI region (contain stacks on its top) + // + + // Calculate how much space there is between the top of the Firmware and= the Top of the System Memory + subs r0, r1, r3 // r0 =3D SystemMemoryTop - FdTop + bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Cas= e when the PrePi is in XIP memory outside of the DRAM + cmp r0, r4 + bge _SetupStack + + // Case the top of stacks is the FdBaseAddress + mov r1, r2 + +_SetupStack + // r1 contains the top of the stack (and the UEFI Memory) + + // Because the 'push' instruction is equivalent to 'stmdb' (decrement be= fore), we need to increment + // one to the top of the stack. We check if incrementing one does not ov= erflow (case of DRAM at the + // top of the memory space) + adds r9, r1, #1 + bcs _SetupOverflowStack + +_SetupAlignedStack + mov r1, r9 + b _GetBaseUefiMemory + +_SetupOverflowStack + // Case memory at the top of the address space. Ensure the top of the st= ack is EFI_PAGE_SIZE + // aligned (4KB) + mov32 r9, EFI_PAGE_MASK + and r9, r9, r1 + sub r1, r1, r9 + +_GetBaseUefiMemory + // Calculate the Base of the UEFI Memory + sub r9, r1, r4 + +_GetStackBase + // r1 =3D The top of the Mpcore Stacks + // Stack for the primary core =3D PrimaryCoreStack + mov32 r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize) + sub r10, r1, r2 + + // Stack for the secondary core =3D Number of Cores - 1 + mov32 r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSe= condaryStackSize) + sub r10, r10, r1 + + // r10 =3D The base of the MpCore Stacks (primary stack & secondary stac= ks) + mov r0, r10 + mov r1, r8 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackS= ize) + mov32 r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize) + mov32 r3, FixedPcdGet32(PcdCPUCoreSecondaryStackSize) + bl ArmPlatformStackSet + + // Is it the Primary Core ? + mov r0, r8 + bl ArmPlatformIsPrimaryCore + cmp r0, #1 + bne _PrepareArguments + +_PrepareArguments + mov r0, r8 + mov r1, r9 + mov r2, r10 + + // Move sec startup address into a data register + // Ensure we're jumping to FV version of the code (not boot remapped ali= as) + ldr r4, StartupAddr + + // Jump to PrePiCore C code + // r0 =3D MpId + // r1 =3D UefiMemoryBase + // r2 =3D StacksBase + blx r4 + +_NeverReturn + b _NeverReturn + + END diff --git a/BeagleBoardPkg/PrePi/LzmaDecompress.h b/BeagleBoardPkg/PrePi/L= zmaDecompress.h new file mode 100644 index 000000000000..a79ff343d231 --- /dev/null +++ b/BeagleBoardPkg/PrePi/LzmaDecompress.h @@ -0,0 +1,103 @@ +/** @file + LZMA Decompress Library header file + + Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. + +**/ + +#ifndef __LZMA_DECOMPRESS_H___ +#define __LZMA_DECOMPRESS_H___ + +/** + Examines a GUIDed section and returns the size of the decoded buffer and= the + size of an scratch buffer required to actually decode the data in a GUID= ed section. + + Examines a GUIDed section specified by InputSection. + If GUID for InputSection does not match the GUID that this handler suppo= rts, + then RETURN_UNSUPPORTED is returned. + If the required information can not be retrieved from InputSection, + then RETURN_INVALID_PARAMETER is returned. + If the GUID of InputSection does match the GUID that this handler suppor= ts, + then the size required to hold the decoded buffer is returned in OututBu= fferSize, + the size of an optional scratch buffer is returned in ScratchSize, and t= he Attributes field + from EFI_GUID_DEFINED_SECTION header of InputSection is returned in Sect= ionAttribute. + + If InputSection is NULL, then ASSERT(). + If OutputBufferSize is NULL, then ASSERT(). + If ScratchBufferSize is NULL, then ASSERT(). + If SectionAttribute is NULL, then ASSERT(). + + + @param[in] InputSection A pointer to a GUIDed section of an FFS f= ormatted file. + @param[out] OutputBufferSize A pointer to the size, in bytes, of an ou= tput buffer required + if the buffer specified by InputSection w= ere decoded. + @param[out] ScratchBufferSize A pointer to the size, in bytes, required= as scratch space + if the buffer specified by InputSection w= ere decoded. + @param[out] SectionAttribute A pointer to the attributes of the GUIDed= section. See the Attributes + field of EFI_GUID_DEFINED_SECTION in the = PI Specification. + + @retval RETURN_SUCCESS The information about InputSection wa= s returned. + @retval RETURN_UNSUPPORTED The section specified by InputSection= does not match the GUID this handler supports. + @retval RETURN_INVALID_PARAMETER The information can not be retrieved = from the section specified by InputSection. + +**/ +RETURN_STATUS +EFIAPI +LzmaGuidedSectionGetInfo ( + IN CONST VOID *InputSection, + OUT UINT32 *OutputBufferSize, + OUT UINT32 *ScratchBufferSize, + OUT UINT16 *SectionAttribute + ); + +/** + Decompress a LZAM compressed GUIDed section into a caller allocated outp= ut buffer. + + Decodes the GUIDed section specified by InputSection. + If GUID for InputSection does not match the GUID that this handler suppo= rts, then RETURN_UNSUPPORTED is returned. + If the data in InputSection can not be decoded, then RETURN_INVALID_PARA= METER is returned. + If the GUID of InputSection does match the GUID that this handler suppor= ts, then InputSection + is decoded into the buffer specified by OutputBuffer and the authenticat= ion status of this + decode operation is returned in AuthenticationStatus. If the decoded bu= ffer is identical to the + data in InputSection, then OutputBuffer is set to point at the data in I= nputSection. Otherwise, + the decoded data will be placed in caller allocated buffer specified by = OutputBuffer. + + If InputSection is NULL, then ASSERT(). + If OutputBuffer is NULL, then ASSERT(). + If ScratchBuffer is NULL and this decode operation requires a scratch bu= ffer, then ASSERT(). + If AuthenticationStatus is NULL, then ASSERT(). + + + @param[in] InputSection A pointer to a GUIDed section of an FFS format= ted file. + @param[out] OutputBuffer A pointer to a buffer that contains the result= of a decode operation. + @param[out] ScratchBuffer A caller allocated buffer that may be required= by this function + as a scratch buffer to perform the decode oper= ation. + @param[out] AuthenticationStatus + A pointer to the authentication status of the = decoded output buffer. + See the definition of authentication status in= the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI + section of the PI Specification. EFI_AUTH_STAT= US_PLATFORM_OVERRIDE must + never be set by this handler. + + @retval RETURN_SUCCESS The buffer specified by InputSection = was decoded. + @retval RETURN_UNSUPPORTED The section specified by InputSection= does not match the GUID this handler supports. + @retval RETURN_INVALID_PARAMETER The section specified by InputSection= can not be decoded. + +**/ +RETURN_STATUS +EFIAPI +LzmaGuidedSectionExtraction ( + IN CONST VOID *InputSection, + OUT VOID **OutputBuffer, + OUT VOID *ScratchBuffer, OPTIONAL + OUT UINT32 *AuthenticationStatus + ); + +#endif // __LZMADECOMPRESS_H__ + diff --git a/BeagleBoardPkg/PrePi/MainUniCore.c b/BeagleBoardPkg/PrePi/Main= UniCore.c new file mode 100644 index 000000000000..56707362dcd1 --- /dev/null +++ b/BeagleBoardPkg/PrePi/MainUniCore.c @@ -0,0 +1,39 @@ +/** @file +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2017, Linaro, Ltd. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD License +* which accompanies this distribution. The full text of the license may = be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +* +**/ + +#include "PrePi.h" + +VOID +PrimaryMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINT64 StartTimeStamp + ) +{ + PrePiMain (UefiMemoryBase, StacksBase, StartTimeStamp); + + // We must never return + ASSERT(FALSE); +} + +VOID +SecondaryMain ( + IN UINTN MpId + ) +{ + // We must never get into this function on UniCore system + ASSERT(FALSE); +} + diff --git a/BeagleBoardPkg/PrePi/PeiUniCore.inf b/BeagleBoardPkg/PrePi/Pei= UniCore.inf new file mode 100644 index 000000000000..3d72bc5b46e1 --- /dev/null +++ b/BeagleBoardPkg/PrePi/PeiUniCore.inf @@ -0,0 +1,104 @@ +#/** @file +# +# (C) Copyright 2015 Hewlett-Packard Development Company, L.P.
+# Copyright (c) 2011-2017, ARM Ltd. All rights reserved.
+# Copyright (c) 2017, Linaro, Ltd. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +#**/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D BeagleBoardPrePiUniCore + FILE_GUID =3D 8a5dc3de-fe31-4ad9-9c93-dd73626932e7 + MODULE_TYPE =3D SEC + VERSION_STRING =3D 1.0 + +[Sources] + PrePi.c + MainUniCore.c + +[Sources.ARM] + Arm/ArchPrePi.c + Arm/ModuleEntryPoint.S | GCC + Arm/ModuleEntryPoint.asm | RVCT + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + ArmPlatformLib + ArmPlatformStackLib + BaseLib + DebugLib + DebugAgentLib + ExtractGuidedSectionLib + HobLib + IoLib + MemoryAllocationLib + MemoryInitPeiLib + PeCoffGetEntryPointLib + PlatformPeiLib + PrePiHobListPointerLib + PrePiLib + SerialPortLib + TimerLib + +[Ppis] + gArmMpCoreInfoPpiGuid + +[Guids] + gArmMpCoreInfoGuid + gEfiFirmwarePerformanceGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + gArmPlatformTokenSpaceGuid.PcdSendSgiToBringUpSecondaryCores + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + +[FixedPcd] + gArmTokenSpaceGuid.PcdVFPEnabled + + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize + gArmPlatformTokenSpaceGuid.PcdCPUCoreSecondaryStackSize + + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gArmPlatformTokenSpaceGuid.PcdCoreCount + + gEmbeddedTokenSpaceGuid.PcdPrePiCpuMemorySize + gEmbeddedTokenSpaceGuid.PcdPrePiCpuIoSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize diff --git a/BeagleBoardPkg/PrePi/PrePi.c b/BeagleBoardPkg/PrePi/PrePi.c new file mode 100644 index 000000000000..6c4f34692dfb --- /dev/null +++ b/BeagleBoardPkg/PrePi/PrePi.c @@ -0,0 +1,198 @@ +/** @file +* +* Copyright (c) 2011-2017, ARM Limited. All rights reserved. +* Copyright (c) 2017, Linaro, Ltd. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD License +* which accompanies this distribution. The full text of the license may = be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "PrePi.h" +#include "LzmaDecompress.h" + +#define IS_XIP() (((UINT64)FixedPcdGet64 (PcdFdBaseAddress) > mSystemMemor= yEnd) || \ + ((FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdF= dSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) + +UINT64 mSystemMemoryEnd =3D FixedPcdGet64(PcdSystemMemoryBase) + + FixedPcdGet64(PcdSystemMemorySize) - 1; + +EFI_STATUS +EFIAPI +ExtractGuidedSectionLibConstructor ( + VOID + ); + +EFI_STATUS +EFIAPI +LzmaDecompressLibConstructor ( + VOID + ); + +EFI_STATUS +GetPlatformPpi ( + IN EFI_GUID *PpiGuid, + OUT VOID **Ppi + ) +{ + UINTN PpiListSize; + UINTN PpiListCount; + EFI_PEI_PPI_DESCRIPTOR *PpiList; + UINTN Index; + + PpiListSize =3D 0; + ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); + PpiListCount =3D PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); + for (Index =3D 0; Index < PpiListCount; Index++, PpiList++) { + if (CompareGuid (PpiList->Guid, PpiGuid) =3D=3D TRUE) { + *Ppi =3D PpiList->Ppi; + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + +VOID +PrePiMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINT64 StartTimeStamp + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE* HobList; + EFI_STATUS Status; + CHAR8 Buffer[100]; + UINTN CharCount; + UINTN StacksSize; + FIRMWARE_SEC_PERFORMANCE Performance; + + // If ensure the FD is either part of the System Memory or totally outsi= de of the System Memory (XIP) + ASSERT (IS_XIP() || + ((FixedPcdGet64 (PcdFdBaseAddress) >=3D FixedPcdGet64 (PcdSystem= MemoryBase)) && + ((UINT64)(FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (Pcd= FdSize)) <=3D (UINT64)mSystemMemoryEnd))); + + // Initialize the architecture specific bits + ArchInitialize (); + + // Initialize the Serial Port + SerialPortInitialize (); + CharCount =3D AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (versio= n %s built at %a on %a)\n\r", + (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + // Initialize the Debug Agent for Source Level Debugging + InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL); + SaveAndSetDebugTimerInterrupt (TRUE); + + // Declare the PI/UEFI memory region + HobList =3D HobConstructor ( + (VOID*)UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize), + (VOID*)UefiMemoryBase, + (VOID*)StacksBase // The top of the UEFI Memory is reserved for the s= tacks + ); + PrePeiSetHobList (HobList); + + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + Status =3D MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUef= iRegionSize)); + ASSERT_EFI_ERROR (Status); + + StacksSize =3D PcdGet32 (PcdCPUCorePrimaryStackSize); + BuildStackHob (StacksBase, StacksSize); + + //TODO: Call CpuPei as a library + BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize= )); + + // Store timer value logged at the beginning of firmware image execution + Performance.ResetEnd =3D GetTimeInNanoSecond (StartTimeStamp); + + // Build SEC Performance Data Hob + BuildGuidDataHob (&gEfiFirmwarePerformanceGuid, &Performance, sizeof (Pe= rformance)); + + // Set the Boot Mode + SetBootMode (ArmPlatformGetBootMode ()); + + // Initialize Platform HOBs (CpuHob and FvHob) + Status =3D PlatformPeim (); + ASSERT_EFI_ERROR (Status); + + // Now, the HOB List has been initialized, we can register performance i= nformation + PERF_START (NULL, "PEI", NULL, StartTimeStamp); + + // SEC phase needs to run library constructors by hand. + ExtractGuidedSectionLibConstructor (); + LzmaDecompressLibConstructor (); + + // Build HOBs to pass up our version of stuff the DXE Core needs to save= space + BuildPeCoffLoaderHob (); + BuildExtractSectionHob ( + &gLzmaCustomDecompressGuid, + LzmaGuidedSectionGetInfo, + LzmaGuidedSectionExtraction + ); + + // Assume the FV that contains the SEC (our code) also contains a compre= ssed FV. + Status =3D DecompressFirstFv (); + ASSERT_EFI_ERROR (Status); + + // Load the DXE Core and transfer control to it + Status =3D LoadDxeCoreFromFv (NULL, 0); + ASSERT_EFI_ERROR (Status); +} + +VOID +CEntryPoint ( + IN UINTN MpId, + IN UINTN UefiMemoryBase, + IN UINTN StacksBase + ) +{ + UINT64 StartTimeStamp; + + // Initialize the platform specific controllers + ArmPlatformInitialize (MpId); + + if (PerformanceMeasurementEnabled ()) { + // Initialize the Timer Library to setup the Timer HW controller + TimerConstructor (); + // We cannot call yet the PerformanceLib because the HOB List has not = been initialized + StartTimeStamp =3D GetPerformanceCounter (); + } else { + StartTimeStamp =3D 0; + } + + // Data Cache enabled on Primary core when MMU is enabled. + ArmDisableDataCache (); + // Invalidate Data cache + ArmInvalidateDataCache (); + // Invalidate instruction cache + ArmInvalidateInstructionCache (); + // Enable Instruction Caches on all cores. + ArmEnableInstructionCache (); + + PrimaryMain (UefiMemoryBase, StacksBase, StartTimeStamp); + + // DXE Core should always load and never return + ASSERT (FALSE); +} diff --git a/BeagleBoardPkg/PrePi/PrePi.h b/BeagleBoardPkg/PrePi/PrePi.h new file mode 100644 index 000000000000..e7f58e59240c --- /dev/null +++ b/BeagleBoardPkg/PrePi/PrePi.h @@ -0,0 +1,90 @@ +/** @file +* +* Copyright (c) 2011-2015, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD License +* which accompanies this distribution. The full text of the license may = be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +* +**/ + +#ifndef _PREPI_H_ +#define _PREPI_H_ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SerialPrint(txt) SerialPortWrite (txt, AsciiStrLen(txt)+1); + +extern UINT64 mSystemMemoryEnd; + +RETURN_STATUS +EFIAPI +TimerConstructor ( + VOID + ); + +VOID +PrePiMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINT64 StartTimeStamp + ); + +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ); + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ); + +VOID +PrimaryMain ( + IN UINTN UefiMemoryBase, + IN UINTN StacksBase, + IN UINT64 StartTimeStamp + ); + +VOID +SecondaryMain ( + IN UINTN MpId + ); + +// Either implemented by PrePiLib or by MemoryInitPei +VOID +BuildMemoryTypeInformationHob ( + VOID + ); + +EFI_STATUS +GetPlatformPpi ( + IN EFI_GUID *PpiGuid, + OUT VOID **Ppi + ); + +// Initialize the Architecture specific controllers +VOID +ArchInitialize ( + VOID + ); + +#endif /* _PREPI_H_ */ --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512055519830440.0123000268276; Thu, 30 Nov 2017 07:25:19 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7B6192211B41F; Thu, 30 Nov 2017 07:20:53 -0800 (PST) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::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 926BA220C1C3A for ; Thu, 30 Nov 2017 07:20:50 -0800 (PST) Received: by mail-wr0-x243.google.com with SMTP id y21so6967160wrc.1 for ; Thu, 30 Nov 2017 07:25:15 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:13 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=kFOUtYeoeRFMsZnu2qUmI3Cn3JwGzrpAlQwFBEZ/+WQ=; b=fDTaeAndRYCKOBabxw3DFquktNwyPX0M8NFuoZ39eFZSPbC8HsSs7Kz/0YHkLjbayF qvXAMBShrusE5jBKW/HZ8lpSIXnq3IBwpWG0SuG0a0uIhOTqisEYBwi20uwnDVYXpApW pbQUg+qBfdssSi3Ea7ygATMwzgXMRv8bO4ozA= 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=kFOUtYeoeRFMsZnu2qUmI3Cn3JwGzrpAlQwFBEZ/+WQ=; b=eHYWioZlnd1iQG7vhfyCUpsLjOiPyCRH/8GBwggnGMr62uBRKdwuxLRp/HwOrpSHcz IZEnnl7VgjJIwkhLYFdCByQJ0Xbs57DeZ3n2wMCUN+G3pvAIfGL9x/nBvqP0e1Fc/3kd q6v9DQIYGmGvT1fqW23g3ywHfwI1jXazCEwglFjIfcuVH5xkXEmSLXnipU/Xx05coT8H hpp5a7N31Xbl/eSx9iTYa4tlbsokXSed75S9prL/dH80IOrwf0NqGyr/Byly9/AWlafr Gl+QTZ0M19PamaCONKWI06CHU6K4gXyR/X+oP6sdwzwdWRYPNyj918iTgVeeu05ry/Ao 9eXg== X-Gm-Message-State: AJaThX7ocR12IlRCSP3fkIIiRcql3IbO1qjQslpEcUL+gGd+MaD/Hj6m WlJ2OVNlX0X6V6Lcplz6UwgLurTGLto= X-Google-Smtp-Source: AGs4zMZDbN3jyQ8rV8POf7xQi1c/EDb+uDGD7+V6gqOlkGI9b05lsit2sbAHE8TV6h4FbjI+NMmKpg== X-Received: by 10.223.145.80 with SMTP id j74mr2449033wrj.250.1512055514231; Thu, 30 Nov 2017 07:25:14 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:49 +0000 Message-Id: <20171130152453.19205-4-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 3/7] BeagleBoardPkg: clone MemoryInitPeiLib 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The common MemoryInitPeiLib implementation preserves the primary FV holding the PrePi module and the compressed secondary FV, and removes the memory it occupies from the memory map, hiding it from the OS. The only platform that actual requires this is BeagleBoardPkg, since it exposes the PeCoff and LZMA libraries in PrePi to DXE core via special HOBs. So let's give BeagleBoard its own MemoryInitPeiLib, so that we can clean up the generic version. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BeagleBoardPkg/BeagleBoardPkg.dsc | 2 +- BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c | 198 +++++++= +++++++++++++ BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf | 64 +++++++ 3 files changed, 263 insertions(+), 1 deletion(-) diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoard= Pkg.dsc index a1715593770a..5d87ee389124 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc @@ -150,7 +150,7 @@ [LibraryClasses.common.SEC] MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe= moryAllocationLib.inf PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf - MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf + MemoryInitPeiLib|BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLi= b.inf =20 # 1/123 faster than Stm or Vstm version BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf diff --git a/BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/B= eagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c new file mode 100644 index 000000000000..2feb11f21d5d --- /dev/null +++ b/BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c @@ -0,0 +1,198 @@ +/** @file +* +* Copyright (c) 2011-2015, ARM Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD License +* which accompanies this distribution. The full text of the license may = be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include + +VOID +BuildMemoryTypeInformationHob ( + VOID + ); + +STATIC +VOID +InitMmu ( + IN ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable + ) +{ + + VOID *TranslationTableBase; + UINTN TranslationTableSize; + RETURN_STATUS Status; + + //Note: Because we called PeiServicesInstallPeiMemory() before to call I= nitMmu() the MMU Page Table resides in + // DRAM (even at the top of DRAM as it is the first permanent memor= y allocation) + Status =3D ArmConfigureMmu (MemoryTable, &TranslationTableBase, &Transla= tionTableSize); + if (EFI_ERROR (Status)) { + DEBUG ((EFI_D_ERROR, "Error: Failed to enable MMU\n")); + } +} + +/*++ + +Routine Description: + + + +Arguments: + + FileHandle - Handle of the file being invoked. + PeiServices - Describes the list of possible PEI Services. + +Returns: + + Status - EFI_SUCCESS if the boot mode could be set + +--*/ +EFI_STATUS +EFIAPI +MemoryPeim ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ) +{ + 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 + ArmPlatformGetVirtualMemoryMap (&MemoryTable); + + // Ensure PcdSystemMemorySize has been set + ASSERT (PcdGet64 (PcdSystemMemorySize) !=3D 0); + + // + // Now, the permanent memory has been installed, we can call AllocatePag= es() + // + ResourceAttributes =3D ( + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_TESTED + ); + + // + // Check if the resource for the main system memory has been declared + // + Found =3D FALSE; + NextHob.Raw =3D GetHobList (); + while ((NextHob.Raw =3D GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Ne= xtHob.Raw)) !=3D NULL) { + if ((NextHob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_SYST= EM_MEMORY) && + (PcdGet64 (PcdSystemMemoryBase) >=3D NextHob.ResourceDescriptor->P= hysicalStart) && + (NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescr= iptor->ResourceLength <=3D PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSy= stemMemorySize))) + { + Found =3D TRUE; + break; + } + NextHob.Raw =3D GET_NEXT_HOB (NextHob); + } + + if (!Found) { + // Reserved the memory space occupied by the firmware volume + BuildResourceDescriptorHob ( + EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes, + PcdGet64 (PcdSystemMemoryBase), + PcdGet64 (PcdSystemMemorySize) + ); + } + + // + // Reserved the memory space occupied by the firmware volume + // + + SystemMemoryTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase)= + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize); + FdTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSI= CAL_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 attribut= e non-present + if ((PcdGet64 (PcdFdBaseAddress) >=3D PcdGet64 (PcdSystemMemoryBase)) &&= (FdTop <=3D SystemMemoryTop)) { + Found =3D FALSE; + + // Search for System Memory Hob that contains the firmware + NextHob.Raw =3D GetHobList (); + while ((NextHob.Raw =3D GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, = NextHob.Raw)) !=3D NULL) { + if ((NextHob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_SY= STEM_MEMORY) && + (PcdGet64 (PcdFdBaseAddress) >=3D NextHob.ResourceDescriptor->Ph= ysicalStart) && + (FdTop <=3D NextHob.ResourceDescriptor->PhysicalStart + NextHob.= ResourceDescriptor->ResourceLength)) + { + ResourceAttributes =3D NextHob.ResourceDescriptor->ResourceAttribu= te; + ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; + ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + Resour= ceLength; + + if (PcdGet64 (PcdFdBaseAddress) =3D=3D NextHob.ResourceDescriptor-= >PhysicalStart) { + if (SystemMemoryTop =3D=3D FdTop) { + NextHob.ResourceDescriptor->ResourceAttribute =3D ResourceAttr= ibutes & ~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 +=3D PcdGet32(PcdFdS= ize); + NextHob.ResourceDescriptor->ResourceLength -=3D PcdGet32(PcdFd= Size); + } + } else { + // Create the System Memory HOB for the firmware with the non-pr= esent attribute + BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes & ~EFI_RESOURCE_A= TTRIBUTE_PRESENT, + PcdGet64 (PcdFdBaseAddress), + PcdGet32 (PcdFdSize)); + + // Update the HOB + NextHob.ResourceDescriptor->ResourceLength =3D PcdGet64 (PcdFdBa= seAddress) - NextHob.ResourceDescriptor->PhysicalStart; + + // If there is some memory available on the top of the FD then c= reate a HOB + if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + Resource= Length) { + // Create the System Memory HOB for the remaining region (top = of the FD) + BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, + ResourceAttributes, + FdTop, + ResourceTop - FdTop); + } + } + Found =3D TRUE; + break; + } + NextHob.Raw =3D GET_NEXT_HOB (NextHob); + } + + ASSERT(Found); + } + + // Build Memory Allocation Hob + InitMmu (MemoryTable); + + if (FeaturePcdGet (PcdPrePiProduceMemoryTypeInformationHob)) { + // Optional feature that helps prevent EFI memory map fragmentation. + BuildMemoryTypeInformationHob (); + } + + return EFI_SUCCESS; +} diff --git a/BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf b= /BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf new file mode 100644 index 000000000000..0e8c42f6c6bd --- /dev/null +++ b/BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf @@ -0,0 +1,64 @@ +#/** @file +# +# Copyright (c) 2011-2014, ARM Ltd. All rights reserved.
+# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may = be found at +# http://opensource.org/licenses/bsd-license.php +# +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IM= PLIED. +# +#**/ + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D BeagleBoardMemoryInitPeiLib + FILE_GUID =3D e489db0a-d847-4d67-910b-48a833f6fef5 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D MemoryInitPeiLib|SEC PEIM + +[Sources] + MemoryInitPeiLib.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + +[LibraryClasses] + DebugLib + HobLib + ArmMmuLib + ArmPlatformLib + +[Guids] + gEfiMemoryTypeInformationGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob + +[FixedPcd] + gArmTokenSpaceGuid.PcdFdBaseAddress + gArmTokenSpaceGuid.PcdFdSize + + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData + +[Pcd] + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize + --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512055523094305.88525294846886; Thu, 30 Nov 2017 07:25:23 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BC1F02211B431; Thu, 30 Nov 2017 07:20:56 -0800 (PST) Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) (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 0EC44220F3C23 for ; Thu, 30 Nov 2017 07:20:52 -0800 (PST) Received: by mail-wm0-x242.google.com with SMTP id t8so13709304wmc.3 for ; Thu, 30 Nov 2017 07:25:18 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:15 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=2L0AAaNuria7J8atI9J1Qnt+Bp9RnA/nXnnQ6aH1DPk=; b=R8FHJVLTTeHjE6ZTK4fR1lbnpk+jFD3wijN9YY6zTt7IRpw0ZAM+LixJdzBqTtPwe7 V4WYGzdLyzNAPyd0G4hCNomB3304Ih9u7LQbiNC/zDhR0d255T3wNkGp0UBq74iCgLiT kS9SgzxwW43AKkJGV8ATuNblfNAp7AS4bQ7MY= 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=2L0AAaNuria7J8atI9J1Qnt+Bp9RnA/nXnnQ6aH1DPk=; b=sZP9prSuQwCfWraYG9uc+78Qm5IrhX9aQgYF/H5+HXIs+9OL/VhQQHhdOZcm8DWAI2 wGmox9QOrcqFRB08JcEaCoPyjp4afNdfENNJLF2PJxcpBwG7OlEs6mcGnHmD41N3CTPo 8jjKFEu6AXhKKChJL7m7wnDDImo8WhZ6ypprT0hRbHTaTRbW9fVPo90f3iUo9Vh86wnj 0qooKKZn7gRQpBf80/SZLYzBbwHaOVpdnEH8WnMAzsM4eT3iS++xM8yp0j3BVsBi8Nl0 6Kab24CAEP9fKDSu9osjhRtscnSDqZcbX14LoKVaDCJ4OBUW0/DSD3msbnGEuItkED9A ujhw== X-Gm-Message-State: AJaThX6c1NEr66AP/7KLAgPJbpqotTHCUQlu0E3FziKNe3EQiSJ19XKl V1pAwJyZNvAG/tnOhRyYn4Gxsrnz9Ok= X-Google-Smtp-Source: AGs4zMYr8qe0iE34SOg/DkO5p0zIaS7Hq7jyUtgNdTfJYN/LGNWMHV+9yAv+Le8CTyfJN+erEDEslg== X-Received: by 10.28.61.87 with SMTP id k84mr2172602wma.48.1512055516690; Thu, 30 Nov 2017 07:25:16 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:50 +0000 Message-Id: <20171130152453.19205-5-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 4/7] ArmPlatformPkg/PrePi: don't expose PE/COFF and LZMA libraries via HOBs 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Avoid the need to preserve all memory exposed by PrePi indefinitely by removing the 'feature' that exposes the PE/COFF and LZMA libraries via special HOBs to other modules that may want to reuse the code. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/PrePi/LzmaDecompress.h | 103 -------------------- ArmPlatformPkg/PrePi/PeiMPCore.inf | 1 - ArmPlatformPkg/PrePi/PeiUniCore.inf | 1 - ArmPlatformPkg/PrePi/PrePi.c | 11 --- 4 files changed, 116 deletions(-) diff --git a/ArmPlatformPkg/PrePi/LzmaDecompress.h b/ArmPlatformPkg/PrePi/L= zmaDecompress.h deleted file mode 100644 index a79ff343d231..000000000000 --- a/ArmPlatformPkg/PrePi/LzmaDecompress.h +++ /dev/null @@ -1,103 +0,0 @@ -/** @file - LZMA Decompress Library header file - - Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
- This program and the accompanying materials - are licensed and made available under the terms and conditions of the BS= D License - which accompanies this distribution. The full text of the license may b= e found at - http://opensource.org/licenses/bsd-license.php - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. - -**/ - -#ifndef __LZMA_DECOMPRESS_H___ -#define __LZMA_DECOMPRESS_H___ - -/** - Examines a GUIDed section and returns the size of the decoded buffer and= the - size of an scratch buffer required to actually decode the data in a GUID= ed section. - - Examines a GUIDed section specified by InputSection. - If GUID for InputSection does not match the GUID that this handler suppo= rts, - then RETURN_UNSUPPORTED is returned. - If the required information can not be retrieved from InputSection, - then RETURN_INVALID_PARAMETER is returned. - If the GUID of InputSection does match the GUID that this handler suppor= ts, - then the size required to hold the decoded buffer is returned in OututBu= fferSize, - the size of an optional scratch buffer is returned in ScratchSize, and t= he Attributes field - from EFI_GUID_DEFINED_SECTION header of InputSection is returned in Sect= ionAttribute. - - If InputSection is NULL, then ASSERT(). - If OutputBufferSize is NULL, then ASSERT(). - If ScratchBufferSize is NULL, then ASSERT(). - If SectionAttribute is NULL, then ASSERT(). - - - @param[in] InputSection A pointer to a GUIDed section of an FFS f= ormatted file. - @param[out] OutputBufferSize A pointer to the size, in bytes, of an ou= tput buffer required - if the buffer specified by InputSection w= ere decoded. - @param[out] ScratchBufferSize A pointer to the size, in bytes, required= as scratch space - if the buffer specified by InputSection w= ere decoded. - @param[out] SectionAttribute A pointer to the attributes of the GUIDed= section. See the Attributes - field of EFI_GUID_DEFINED_SECTION in the = PI Specification. - - @retval RETURN_SUCCESS The information about InputSection wa= s returned. - @retval RETURN_UNSUPPORTED The section specified by InputSection= does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The information can not be retrieved = from the section specified by InputSection. - -**/ -RETURN_STATUS -EFIAPI -LzmaGuidedSectionGetInfo ( - IN CONST VOID *InputSection, - OUT UINT32 *OutputBufferSize, - OUT UINT32 *ScratchBufferSize, - OUT UINT16 *SectionAttribute - ); - -/** - Decompress a LZAM compressed GUIDed section into a caller allocated outp= ut buffer. - - Decodes the GUIDed section specified by InputSection. - If GUID for InputSection does not match the GUID that this handler suppo= rts, then RETURN_UNSUPPORTED is returned. - If the data in InputSection can not be decoded, then RETURN_INVALID_PARA= METER is returned. - If the GUID of InputSection does match the GUID that this handler suppor= ts, then InputSection - is decoded into the buffer specified by OutputBuffer and the authenticat= ion status of this - decode operation is returned in AuthenticationStatus. If the decoded bu= ffer is identical to the - data in InputSection, then OutputBuffer is set to point at the data in I= nputSection. Otherwise, - the decoded data will be placed in caller allocated buffer specified by = OutputBuffer. - - If InputSection is NULL, then ASSERT(). - If OutputBuffer is NULL, then ASSERT(). - If ScratchBuffer is NULL and this decode operation requires a scratch bu= ffer, then ASSERT(). - If AuthenticationStatus is NULL, then ASSERT(). - - - @param[in] InputSection A pointer to a GUIDed section of an FFS format= ted file. - @param[out] OutputBuffer A pointer to a buffer that contains the result= of a decode operation. - @param[out] ScratchBuffer A caller allocated buffer that may be required= by this function - as a scratch buffer to perform the decode oper= ation. - @param[out] AuthenticationStatus - A pointer to the authentication status of the = decoded output buffer. - See the definition of authentication status in= the EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI - section of the PI Specification. EFI_AUTH_STAT= US_PLATFORM_OVERRIDE must - never be set by this handler. - - @retval RETURN_SUCCESS The buffer specified by InputSection = was decoded. - @retval RETURN_UNSUPPORTED The section specified by InputSection= does not match the GUID this handler supports. - @retval RETURN_INVALID_PARAMETER The section specified by InputSection= can not be decoded. - -**/ -RETURN_STATUS -EFIAPI -LzmaGuidedSectionExtraction ( - IN CONST VOID *InputSection, - OUT VOID **OutputBuffer, - OUT VOID *ScratchBuffer, OPTIONAL - OUT UINT32 *AuthenticationStatus - ); - -#endif // __LZMADECOMPRESS_H__ - diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiM= PCore.inf index 636049d4f44d..ccb5388e5516 100644 --- a/ArmPlatformPkg/PrePi/PeiMPCore.inf +++ b/ArmPlatformPkg/PrePi/PeiMPCore.inf @@ -52,7 +52,6 @@ [LibraryClasses] SerialPortLib ExtractGuidedSectionLib LzmaDecompressLib - PeCoffGetEntryPointLib DebugAgentLib PrePiLib ArmPlatformLib diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/Pei= UniCore.inf index f37ddec9d13d..2d376c30d400 100644 --- a/ArmPlatformPkg/PrePi/PeiUniCore.inf +++ b/ArmPlatformPkg/PrePi/PeiUniCore.inf @@ -51,7 +51,6 @@ [LibraryClasses] SerialPortLib ExtractGuidedSectionLib LzmaDecompressLib - PeCoffGetEntryPointLib DebugAgentLib PrePiLib ArmPlatformLib diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index e5016ea45359..a60cafdce45e 100644 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -25,10 +24,8 @@ #include #include #include -#include =20 #include "PrePi.h" -#include "LzmaDecompress.h" =20 #define IS_XIP() (((UINT64)FixedPcdGet64 (PcdFdBaseAddress) > mSystemMemor= yEnd) || \ ((FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdF= dSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) @@ -168,14 +165,6 @@ PrePiMain ( ExtractGuidedSectionLibConstructor (); LzmaDecompressLibConstructor (); =20 - // Build HOBs to pass up our version of stuff the DXE Core needs to save= space - BuildPeCoffLoaderHob (); - BuildExtractSectionHob ( - &gLzmaCustomDecompressGuid, - LzmaGuidedSectionGetInfo, - LzmaGuidedSectionExtraction - ); - // Assume the FV that contains the SEC (our code) also contains a compre= ssed FV. Status =3D DecompressFirstFv (); ASSERT_EFI_ERROR (Status); --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512055526733617.4122991791186; Thu, 30 Nov 2017 07:25:26 -0800 (PST) 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) 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) 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) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.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 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) 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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/ArmPlatformP= kg/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; =20 // Get Virtual Memory Map from the Platform Library @@ -121,71 +117,6 @@ MemoryPeim ( ); } =20 - // - // Reserved the memory space occupied by the firmware volume - // - - SystemMemoryTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase)= + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize); - FdTop =3D (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSI= CAL_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 attribut= e non-present - if ((PcdGet64 (PcdFdBaseAddress) >=3D PcdGet64 (PcdSystemMemoryBase)) &&= (FdTop <=3D SystemMemoryTop)) { - Found =3D FALSE; - - // Search for System Memory Hob that contains the firmware - NextHob.Raw =3D GetHobList (); - while ((NextHob.Raw =3D GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, = NextHob.Raw)) !=3D NULL) { - if ((NextHob.ResourceDescriptor->ResourceType =3D=3D EFI_RESOURCE_SY= STEM_MEMORY) && - (PcdGet64 (PcdFdBaseAddress) >=3D NextHob.ResourceDescriptor->Ph= ysicalStart) && - (FdTop <=3D NextHob.ResourceDescriptor->PhysicalStart + NextHob.= ResourceDescriptor->ResourceLength)) - { - ResourceAttributes =3D NextHob.ResourceDescriptor->ResourceAttribu= te; - ResourceLength =3D NextHob.ResourceDescriptor->ResourceLength; - ResourceTop =3D NextHob.ResourceDescriptor->PhysicalStart + Resour= ceLength; - - if (PcdGet64 (PcdFdBaseAddress) =3D=3D NextHob.ResourceDescriptor-= >PhysicalStart) { - if (SystemMemoryTop =3D=3D FdTop) { - NextHob.ResourceDescriptor->ResourceAttribute =3D ResourceAttr= ibutes & ~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 +=3D PcdGet32(PcdFdS= ize); - NextHob.ResourceDescriptor->ResourceLength -=3D PcdGet32(PcdFd= Size); - } - } else { - // Create the System Memory HOB for the firmware with the non-pr= esent attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE_A= TTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Update the HOB - NextHob.ResourceDescriptor->ResourceLength =3D PcdGet64 (PcdFdBa= seAddress) - NextHob.ResourceDescriptor->PhysicalStart; - - // If there is some memory available on the top of the FD then c= reate a HOB - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + Resource= Length) { - // Create the System Memory HOB for the remaining region (top = of the FD) - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes, - FdTop, - ResourceTop - FdTop); - } - } - Found =3D TRUE; - break; - } - NextHob.Raw =3D GET_NEXT_HOB (NextHob); - } - - ASSERT(Found); - } - // Build Memory Allocation Hob InitMmu (MemoryTable); =20 --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1512055530475485.72903096355117; Thu, 30 Nov 2017 07:25:30 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3877D2211B43D; Thu, 30 Nov 2017 07:21:01 -0800 (PST) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 61C4A220F3C5D for ; Thu, 30 Nov 2017 07:20:57 -0800 (PST) Received: by mail-wm0-x244.google.com with SMTP id b76so13172867wmg.1 for ; Thu, 30 Nov 2017 07:25:22 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:20 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=T2BuGhW/lWViu4xhEVNFRIsoZsOdo+1PD49O2nCJiUk=; b=GISzkc3JyvG8zM2uHZzsppRK8Q3nN4LL1KcrmWFSQT5oOh9bBfE0E/GyLZpQUvcZfq +fUBMOaqzpnxJj4QDAwzLHqmfwNcUucCAiBOrwZGdxCv2cvE9Yor1axonNAk1Q9GXuUl IJTJU3JQlgL3Xp7kAINB3i1hf9CV3iYqkaye8= 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=T2BuGhW/lWViu4xhEVNFRIsoZsOdo+1PD49O2nCJiUk=; b=B+/feS6Lab5k81Mdk7lk4bLFdlALP2Y6VBGUsU/8ggjVJtbk8qOnufCvAQqF0TEXcU csI+W3wcKer7LD1sIYE7DU6X9ui58H8oEa7mvTLoR0281tOjb1Q8rnal/OgbC0yF8wc1 EL2kJfWYhMpkYAiznsKfFOV9qnrcZ7+E6ahuGqY4T5gkn+jXqj47Rcl4pRdX6vF4qfNl TKRw15eYfO0sSTzlXiaVniTCih5/jI5WNL7P9jbkDSU170S4YUn8StwgybFxUWVCibmH M7U80fNj92PqY4EiSl0TkP8cB5o3nlnvB44TRnotV/7mN7zvKiee+D+iER6sLiDCzXNj 5Wdw== X-Gm-Message-State: AJaThX68oZ04jalHRlV2pBAzbNCWHB0eB0sTUoVi8Fw6fpbAYkQdGSyy 9rHk85DCvNS9EO4/AhKxMjq7gJ3W0Vg= X-Google-Smtp-Source: AGs4zMY8/YUey/lOzK81XvZIyNtuI+MqmBk83a/lFbBbBw9GhemtYW3beqKzBpT5p6SS4b452iSOEA== X-Received: by 10.28.127.22 with SMTP id a22mr897173wmd.12.1512055521182; Thu, 30 Nov 2017 07:25:21 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:52 +0000 Message-Id: <20171130152453.19205-7-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 6/7] ArmPlatformPkg/PrePi; call all constructors by hand 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Call ProcessLibraryConstructorList () to invoke all library constructors by hand rather than calling only some of them explicitly. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- ArmPlatformPkg/PrePi/PrePi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c index a60cafdce45e..76a53bc871d2 100644 --- a/ArmPlatformPkg/PrePi/PrePi.c +++ b/ArmPlatformPkg/PrePi/PrePi.c @@ -33,15 +33,9 @@ UINT64 mSystemMemoryEnd =3D FixedPcdGet64(PcdSystemMemoryBase) + FixedPcdGet64(PcdSystemMemorySize) - 1; =20 -EFI_STATUS -EFIAPI -ExtractGuidedSectionLibConstructor ( - VOID - ); - -EFI_STATUS +VOID EFIAPI -LzmaDecompressLibConstructor ( +ProcessLibraryConstructorList ( VOID ); =20 @@ -162,8 +156,7 @@ PrePiMain ( PERF_START (NULL, "PEI", NULL, StartTimeStamp); =20 // SEC phase needs to run library constructors by hand. - ExtractGuidedSectionLibConstructor (); - LzmaDecompressLibConstructor (); + ProcessLibraryConstructorList (); =20 // Assume the FV that contains the SEC (our code) also contains a compre= ssed FV. Status =3D DecompressFirstFv (); --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 00:42:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 151205553400837.33940910539525; Thu, 30 Nov 2017 07:25:34 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 717642210FA00; Thu, 30 Nov 2017 07:21:01 -0800 (PST) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (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 DBE7E220C1C3A for ; Thu, 30 Nov 2017 07:20:59 -0800 (PST) Received: by mail-wm0-x241.google.com with SMTP id y82so1995589wmg.1 for ; Thu, 30 Nov 2017 07:25:25 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:22 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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=oWxACuAGiF8X+/el3VK2JtAdWah5+apwzdCjCPyVhWE=; b=AoEX2m/Cqh4gqxGRoguTPk4aY8RtJggcMQsgYw719cEGGMb0zpxu7mV7VV44URQqNR gDl/jUOur6cYPM7zdnnBOlvFYA1VmWspm365EhJF2cuRSeV0phap4JBUbCViE8eStGgj jHk7rP+0nwwbUj3K7SvlFLpKPhfHyTwe7YetA= 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=oWxACuAGiF8X+/el3VK2JtAdWah5+apwzdCjCPyVhWE=; b=JbZdyHAfuL+qh3PyjMpEUxI8O0lcsqtgGMoF6qVHHnw3Fu6uUKumnvD8SVoas0UxWK Fde5IpJa2rEJqrca6bSEUb4nqzoOTBPx/MV8rxdW/nY4S7OUi0UU5XSRbdT2URbJvn2E iWuQ7lc7FFQnO2SKvI1N3IVl2NefYyrBC+yzKOE37Q19W4OpMhCSZV7ACVGnA/5J2htY jlOxjeb6HvBJLflwrehmX+kx9VJBb9JY4AGsVf9gyKVMftovl6upT+9F7FSN/SAxNiYx eZYIXQmm5axPl8Ceyie+92bw/ysSCRA1K8UiMZsSGVzArqQbXApaGtbO9W+JJKX3J+s2 MkeA== X-Gm-Message-State: AJaThX7vRvrFHythlivv16XfVPbXBJCT/c6zkIUnfIKjyHPSouUyokmq ACLfXolZKyNd9myCxU0pZ1yKlhOQ66c= X-Google-Smtp-Source: AGs4zMZq7mK1+Mfnjlv+dpYWogkBF0a5odNu/p8sLpHELrXOQp1GKbMrnnCeimCLkmHKusLIYZb2og== X-Received: by 10.28.167.22 with SMTP id q22mr2426627wme.52.1512055523704; Thu, 30 Nov 2017 07:25:23 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:53 +0000 Message-Id: <20171130152453.19205-8-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 7/7] ArmPlatformPkg/PrePi: remove bogus IntelFrameworkModulePkg reference 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 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" PrePi does not use anything from IntelFrameworkModulePkg so remove the reference from its [Packages] sections. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/PrePi/PeiMPCore.inf | 1 - ArmPlatformPkg/PrePi/PeiUniCore.inf | 1 - 2 files changed, 2 deletions(-) diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiM= PCore.inf index ccb5388e5516..242b03175536 100644 --- a/ArmPlatformPkg/PrePi/PeiMPCore.inf +++ b/ArmPlatformPkg/PrePi/PeiMPCore.inf @@ -39,7 +39,6 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec - IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec =20 [LibraryClasses] BaseLib diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/Pei= UniCore.inf index 2d376c30d400..a45cdef4ed91 100644 --- a/ArmPlatformPkg/PrePi/PeiUniCore.inf +++ b/ArmPlatformPkg/PrePi/PeiUniCore.inf @@ -39,7 +39,6 @@ [Packages] EmbeddedPkg/EmbeddedPkg.dec ArmPkg/ArmPkg.dec ArmPlatformPkg/ArmPlatformPkg.dec - IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec =20 [LibraryClasses] BaseLib --=20 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel