From patchwork Thu Nov 30 15:24:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120210 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809574qgn; Thu, 30 Nov 2017 07:25:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMZsFl0X9+mIR5gAKnaxLg9VVHtpVIva1Hp8QYrIwpar6aAB++5kPKaUm4yHE1zTQSzJKPG+ X-Received: by 10.98.19.202 with SMTP id 71mr6980370pft.181.1512055512864; Thu, 30 Nov 2017 07:25:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055512; cv=none; d=google.com; s=arc-20160816; b=A/g9MbEOeY86H1y51ooIeIuBp7lLKiiqBW/7rzTSlXF0TwontrHzrGYhp12TAK4JC2 fLTTdPllpVPMMB4xKKJFP9mfXgOZJvUS9iWf6L1gy+ADAU/3m2m/XAGaAqGeeu7iceis HDCDhkX9iEbAQMws2A7VromcNtN1nFfnemIQQgJnq7AMKyJG3Zq0JM7oix61cr4BQT1I yctqcK4eIoJpLzdgMtGAre7bcnv0NVggnMRHpFpXh5SaUPXf0l/+zEMCwvPZzkWe3xFE goYA3yQGQaA7RgqotQqhRR9HMkIxoT9Z9c2nuel9020nRZLpdygVjk2HfWNESrj3Up6h sOng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=OimvAcb40F5x7Ncm+qoP5VmS5Iu+C0ChV4FwA/VohNw=; b=DLr/3ZOADeP/lhp/rsAg5BeX953pCB8J77o17pe9bSFobmvRQ3XXVM8C6EeVCBCPFo 7ozIzhoiGJVTj/meOCODfRRREVswBvFaXp+x62wr/I5Iydj+XVjIwHLjXvNoWV9zOqoz 4VD/HGB6PxJA1oS+MYNIpvuOiW6mhXq7vzqkhx8I9t21VlZVnoCKkAnPE6pIj1Z5Yd31 /aRtbSQNleSG/UoEgdFL2CF4/JS/1cj3qrRq/OMhjuTqZPoRfGjhHfqPK3BwNzIT69PY bsWccX+f+9zWlQtl2kzxUa9PvzmOzTWxuvt8TLTYVCZyeg0QfwNKbcG14udpwlyku9+Y kDdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Wh617l6k; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id p11si3166627pgd.44.2017.11.30.07.25.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Wh617l6k; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EB42D220F3C57; Thu, 30 Nov 2017 07:20:46 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.162.152 with SMTP id s24mr2432082wra.151.1512055508333; Thu, 30 Nov 2017 07:25:08 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 => BeagleBoardPkg}/Library/DxeHobPeCoffLib/DxeHobPeCoff.c | 0 {EmbeddedPkg => BeagleBoardPkg}/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf | 0 {EmbeddedPkg => BeagleBoardPkg}/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c | 0 {EmbeddedPkg => BeagleBoardPkg}/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf | 0 EmbeddedPkg/EmbeddedPkg.dsc | 2 -- 6 files changed, 3 insertions(+), 5 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.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/BaseUefiDecompressLib.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 PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.inf @@ -203,7 +203,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER] ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/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 [LibraryClasses.ARM] @@ -386,7 +386,7 @@ [Components.common] PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf - NULL|EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf + NULL|BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf } ArmPkg/Drivers/CpuDxe/CpuDxe.inf diff --git a/EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoff.c b/BeagleBoardPkg/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/BeagleBoardPkg/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/LzmaHobCustomDecompressLib.c b/BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c similarity index 100% rename from EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c rename to BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.c diff --git a/EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf b/BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf similarity index 100% rename from EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.inf rename to BeagleBoardPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDecompressLib.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/LzmaHobCustomDecompressLib.inf EmbeddedPkg/Library/CoherentDmaLib/CoherentDmaLib.inf EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf EmbeddedPkg/Library/DxeDtPlatformDtbLoaderLibDefault/DxeDtPlatformDtbLoaderLibDefault.inf @@ -263,7 +262,6 @@ [Components.common] 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 From patchwork Thu Nov 30 15:24:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120211 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809615qgn; Thu, 30 Nov 2017 07:25:15 -0800 (PST) X-Google-Smtp-Source: AGs4zMaBag6oZUfqQOfCJWFjTtmiBbEY9mpphPbR4s+IdWvnq54MBkIAPlUvLjCFYd/ZZ7fflmfa X-Received: by 10.84.178.195 with SMTP id z61mr2871665plb.28.1512055515163; Thu, 30 Nov 2017 07:25:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055515; cv=none; d=google.com; s=arc-20160816; b=nxECDZpRlTJu6n+DXsH8C6155h88uip36GBKqIMZsGd1jmAbaXuEQ0GEtvFbouyBVn a60zNmFl00WbViBT60IL5F5p5ON1ayRzPG2BrohFCJ8+g1g32D7/tbA4NS88O9+BBODk z7/g3Nh5DmxuyaWEmlu52FUyEMSS1hj03vLT9GnaoD8UN6XJ5skPG3/tSZ0VfEOlSvCX XObhwZWf0AkrXzFYXUw5AMT0GohDujSnzxOzRBJF7ZxqcEPQoVYo0fyY4BxfCtFECXoD 2TRSmwnlNRXre6zUTlXumyTezukodf8hE6SbvoDIJFUDLLI/19SvqmvMzoqoUUf1NLkh 23nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=QxomiuSKSP8P0pHv8Z+eGy9DVWVLS1fxYAJQvoXA0K4=; b=kApPHTslRVtZMyQ/3pjXspIJ3BZmwBV+w+ohm6puiaJvP13ucGZKAwhEXZ6ibA5i8y mtQEx3M6rwIpwLzQtHZaoatkj7L/aknt/z8jINMOeq3V7Xd5foFzPVNNnl+B3emuBdUL CtyPuUrfUNxl9GVZkXlSctVfJQCuHev61Q8MLAkDxxDwKiPK2rUdDlJIsYFOeR3KYrJc Gm2MS73Fbp7cU+7WPer3xvc//WQyic21BmOJ8bNCtqM5DBJhssimosz0uN5vyhGD6Svq S13eq9wTZDCFARgKLXtVmg4Cqb4m4r/qJwWQ6dngDHznrAyvxBSfGwIIilPckh2ep/a1 cDvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZUKfozXo; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id c1si3143018pgp.582.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) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZUKfozXo; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3D60D220F3C4F; Thu, 30 Nov 2017 07:20:49 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.13.145 with SMTP id 139mr934893wmn.24.1512055511671; Thu, 30 Nov 2017 07:25:11 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.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/BaseUefiDecompressLib.inf ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf - LzmaDecompressLib|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf @@ -377,7 +376,10 @@ [Components.common] # # SEC # - ArmPlatformPkg/PrePi/PeiUniCore.inf + BeagleBoardPkg/PrePi/PeiUniCore.inf { + + NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf + } # # DXE diff --git a/BeagleBoardPkg/BeagleBoardPkg.fdf b/BeagleBoardPkg/BeagleBoardPkg.fdf index 71249c7eb3d7..83d85fce4070 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.fdf +++ b/BeagleBoardPkg/BeagleBoardPkg.fdf @@ -209,7 +209,7 @@ [FV.FVMAIN_COMPACT] READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE - INF ArmPlatformPkg/PrePi/PeiUniCore.inf + INF BeagleBoardPkg/PrePi/PeiUniCore.inf FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRED = TRUE { diff --git a/BeagleBoardPkg/PrePi/Arm/ArchPrePi.c b/BeagleBoardPkg/PrePi/Arm/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 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 IMPLIED. +* +**/ + +#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/PrePi/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 IMPLIED. +// +// + +#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 = SystemMemoryTop + + // Calculate Top of the Firmware Device + MOV32 (r2, FixedPcdGet32(PcdFdBaseAddress)) + MOV32 (r3, FixedPcdGet32(PcdFdSize) - 1) + add r3, r3, r2 // r3 = FdTop = 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 = SystemMemoryTop - FdTop + bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case 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 before), we need to increment + // one to the top of the stack. We check if incrementing one does not overflow (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 stack 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 = The top of the Mpcore Stacks + // Stack for the primary core = PrimaryCoreStack + MOV32 (r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize)) + sub r10, r1, r2 + + // Stack for the secondary core = Number of Cores - 1 + MOV32 (r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize)) + sub r10, r10, r1 + + // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) + mov r0, r10 + mov r1, r8 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) + 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 alias) + ldr r4, =ASM_PFX(CEntryPoint) + + // Jump to PrePiCore C code + // r0 = MpId + // r1 = UefiMemoryBase + // r2 = 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 IMPLIED. +// +// + +#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 = SystemMemoryTop + + // Calculate Top of the Firmware Device + mov32 r2, FixedPcdGet32(PcdFdBaseAddress) + mov32 r3, FixedPcdGet32(PcdFdSize) + sub r3, r3, #1 + add r3, r3, r2 // r3 = FdTop = 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 = SystemMemoryTop - FdTop + bmi _SetupStack // Jump if negative (FdTop > SystemMemoryTop). Case 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 before), we need to increment + // one to the top of the stack. We check if incrementing one does not overflow (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 stack 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 = The top of the Mpcore Stacks + // Stack for the primary core = PrimaryCoreStack + mov32 r2, FixedPcdGet32(PcdCPUCorePrimaryStackSize) + sub r10, r1, r2 + + // Stack for the secondary core = Number of Cores - 1 + mov32 r1, (FixedPcdGet32(PcdCoreCount) - 1) * FixedPcdGet32(PcdCPUCoreSecondaryStackSize) + sub r10, r10, r1 + + // r10 = The base of the MpCore Stacks (primary stack & secondary stacks) + mov r0, r10 + mov r1, r8 + //ArmPlatformStackSet(StackBase, MpId, PrimaryStackSize, SecondaryStackSize) + 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 alias) + ldr r4, StartupAddr + + // Jump to PrePiCore C code + // r0 = MpId + // r1 = UefiMemoryBase + // r2 = StacksBase + blx r4 + +_NeverReturn + b _NeverReturn + + END diff --git a/BeagleBoardPkg/PrePi/LzmaDecompress.h b/BeagleBoardPkg/PrePi/LzmaDecompress.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 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 IMPLIED. + +**/ + +#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 GUIDed section. + + Examines a GUIDed section specified by InputSection. + If GUID for InputSection does not match the GUID that this handler supports, + 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 supports, + then the size required to hold the decoded buffer is returned in OututBufferSize, + the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field + from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute. + + 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 formatted file. + @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required + if the buffer specified by InputSection were decoded. + @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space + if the buffer specified by InputSection were 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 was 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 output buffer. + + Decodes the GUIDed section specified by InputSection. + If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned. + If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned. + If the GUID of InputSection does match the GUID that this handler supports, then InputSection + is decoded into the buffer specified by OutputBuffer and the authentication status of this + decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the + data in InputSection, then OutputBuffer is set to point at the data in InputSection. 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 buffer, then ASSERT(). + If AuthenticationStatus is NULL, then ASSERT(). + + + @param[in] InputSection A pointer to a GUIDed section of an FFS formatted 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 operation. + @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_STATUS_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/MainUniCore.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 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 IMPLIED. +* +**/ + +#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/PeiUniCore.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 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 IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = BeagleBoardPrePiUniCore + FILE_GUID = 8a5dc3de-fe31-4ad9-9c93-dd73626932e7 + MODULE_TYPE = SEC + VERSION_STRING = 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 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 IMPLIED. +* +**/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "PrePi.h" +#include "LzmaDecompress.h" + +#define IS_XIP() (((UINT64)FixedPcdGet64 (PcdFdBaseAddress) > mSystemMemoryEnd) || \ + ((FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) + +UINT64 mSystemMemoryEnd = 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 = 0; + ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList); + PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR); + for (Index = 0; Index < PpiListCount; Index++, PpiList++) { + if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) { + *Ppi = 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 outside of the System Memory (XIP) + ASSERT (IS_XIP() || + ((FixedPcdGet64 (PcdFdBaseAddress) >= FixedPcdGet64 (PcdSystemMemoryBase)) && + ((UINT64)(FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) <= (UINT64)mSystemMemoryEnd))); + + // Initialize the architecture specific bits + ArchInitialize (); + + // Initialize the Serial Port + SerialPortInitialize (); + CharCount = AsciiSPrint (Buffer,sizeof (Buffer),"UEFI firmware (version %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 = HobConstructor ( + (VOID*)UefiMemoryBase, + FixedPcdGet32 (PcdSystemMemoryUefiRegionSize), + (VOID*)UefiMemoryBase, + (VOID*)StacksBase // The top of the UEFI Memory is reserved for the stacks + ); + PrePeiSetHobList (HobList); + + // Initialize MMU and Memory HOBs (Resource Descriptor HOBs) + Status = MemoryPeim (UefiMemoryBase, FixedPcdGet32 (PcdSystemMemoryUefiRegionSize)); + ASSERT_EFI_ERROR (Status); + + StacksSize = 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 = GetTimeInNanoSecond (StartTimeStamp); + + // Build SEC Performance Data Hob + BuildGuidDataHob (&gEfiFirmwarePerformanceGuid, &Performance, sizeof (Performance)); + + // Set the Boot Mode + SetBootMode (ArmPlatformGetBootMode ()); + + // Initialize Platform HOBs (CpuHob and FvHob) + Status = PlatformPeim (); + ASSERT_EFI_ERROR (Status); + + // Now, the HOB List has been initialized, we can register performance information + 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 compressed FV. + Status = DecompressFirstFv (); + ASSERT_EFI_ERROR (Status); + + // Load the DXE Core and transfer control to it + Status = 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 = GetPerformanceCounter (); + } else { + StartTimeStamp = 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 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 IMPLIED. +* +**/ + +#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_ */ From patchwork Thu Nov 30 15:24:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120212 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809705qgn; Thu, 30 Nov 2017 07:25:19 -0800 (PST) X-Google-Smtp-Source: AGs4zMbODatRdvJfWmZuno6lg4uitIAHe5IGrkh+yblQK93VHj35nB4BDw5kxEFARYX0b2fbB4ns X-Received: by 10.98.36.25 with SMTP id r25mr6969434pfj.72.1512055519430; Thu, 30 Nov 2017 07:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055519; cv=none; d=google.com; s=arc-20160816; b=ymZiw04LCrmOxVCY0xcPnRvGnrOhwcg3EavElJ1i+Xm2bV128THMAcciEjj5bDYgaW Cmq7k03EFTs+e0Las75CB2dNtLVAC9I9yoYWXS0ub+P4uPYhNNTWKfHPBR1nvZcYKYT/ xf2yjp2imU3yRG9xrtL834homcSnmvGRoK9KNRqq9CXdl2aWOoW6pL5eqbxa7yiftfFC jjoXDSDse6OLB0m7gNMALtlgsfS3mAG+bKSFLrDiOiCiZd/ONLASJp0etAhmpv2qg6mi mGE/nn1ZAvVyQfa5Ewu8qMPPTEXS6UMlkJT0pEMn5VRXNVAEbA45HyWf18J8zNbFb2/y 1yvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=+J/+dt7NEO9ewJO7+4KskB+/r2fzCQdWnCAfhqUlODA=; b=Rp2oy/2dPFQ9rqf8GxsBTpPzhQe1AMvVht8NQWsQo2RzpL03H1uQxhaex4dIOqKxKb GKLh3V/X97zt0IV9TM7t/g+zLd6hyAQ87d7yAjciuaxXO79SLVsQCjvgynvQtTl8BcJm JyiF3ox7CJRR1VVY5HABvhj3/q0qmyNjv2dEDqCeHUxdzgyK81qeEey8iAox4o75f5Rp YDVBRI0aRwnPcDMAfCD6boYVx+/7FyCz6ma3gD7CCTpHKru5QnbSWYquDqCOPpIpJo7X mu0a6wXhm/Jtbg2+sd3T26OlDr7hHLXuDF1ul5r4b+FQH4kyoDjujkizbUeYGNLyZcL1 fHyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fDTaeAnd; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id f10si3305730plo.659.2017.11.30.07.25.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:19 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fDTaeAnd; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7B6192211B41F; Thu, 30 Nov 2017 07:20:53 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.223.145.80 with SMTP id j74mr2449033wrj.250.1512055514231; Thu, 30 Nov 2017 07:25:14 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/BeagleBoardPkg/BeagleBoardPkg.dsc b/BeagleBoardPkg/BeagleBoardPkg.dsc index a1715593770a..5d87ee389124 100644 --- a/BeagleBoardPkg/BeagleBoardPkg.dsc +++ b/BeagleBoardPkg/BeagleBoardPkg.dsc @@ -150,7 +150,7 @@ [LibraryClasses.common.SEC] MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMemoryAllocationLib.inf PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf - MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf + MemoryInitPeiLib|BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.inf # 1/123 faster than Stm or Vstm version BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf diff --git a/BeagleBoardPkg/Library/MemoryInitPeiLib/MemoryInitPeiLib.c b/BeagleBoardPkg/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 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 IMPLIED. +* +**/ + +#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 InitMmu() the MMU Page Table resides in + // DRAM (even at the top of DRAM as it is the first permanent memory allocation) + Status = ArmConfigureMmu (MemoryTable, &TranslationTableBase, &TranslationTableSize); + 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) != 0); + + // + // Now, the permanent memory has been installed, we can call AllocatePages() + // + ResourceAttributes = ( + 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 = FALSE; + NextHob.Raw = GetHobList (); + while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) { + if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) && + (PcdGet64 (PcdSystemMemoryBase) >= NextHob.ResourceDescriptor->PhysicalStart) && + (NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength <= PcdGet64 (PcdSystemMemoryBase) + PcdGet64 (PcdSystemMemorySize))) + { + Found = TRUE; + break; + } + NextHob.Raw = 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 = (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); + + 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 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 IMPLIED. +# +#**/ + +[Defines] + INF_VERSION = 0x0001001A + BASE_NAME = BeagleBoardMemoryInitPeiLib + FILE_GUID = e489db0a-d847-4d67-910b-48a833f6fef5 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = 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 + From patchwork Thu Nov 30 15:24:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120213 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809795qgn; Thu, 30 Nov 2017 07:25:22 -0800 (PST) X-Google-Smtp-Source: AGs4zMYwHWzdJ57Q8K/acbCivyVp0/LyKe711ua0D3aEtDKSNC0GfTIcSam2dvkOL/7x+r0Nfsz+ X-Received: by 10.99.161.25 with SMTP id b25mr2701750pgf.283.1512055522678; Thu, 30 Nov 2017 07:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055522; cv=none; d=google.com; s=arc-20160816; b=gLMC8tFhqOZabEz+ooLrrZQKoOfTyQviRuM8ptvsecODoQ2aJ6zfWeAh7BzCxvwfuN VSgL2I5tryKjkEcQSIaK+DpnnpXgTcKGfunHHyoBjGPZdoIxlz9jr7z91HI4audZQ+V0 O85veLb4z+/dAcEasoBCLobHvV77uQODAYSIuPQwFfeW1hVzHIPyr9fpZFnlgNIVK2Ij yoaHvNAdrRYqWHUKTvfKhJNuz8ckOD3GmNvCP97+pqS7I0ndXBl+vj0/No++ujh13zf7 hG5RP33ONiXXQhFag4dMXC0qRty17Day/j2R6tRSmIlb0JRV3QClwJfXoK3Amo1+8GnY NqLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=NA+m6IT0QcKALytP8IRsa79Mzp9qsEKJEAkIWYTUxs0=; b=kVkCD7p4OpKk3aDjbC6pm1HIXtQUkSlf8RRLzHB2zl0CkhzLXVAFBJ37GvkSpnil2A dyzNjLT3LjbsuS69szzL/v0UKxc3qJjoDr9gI+3cw0xXjE6pLURJPwRU15lUYc0z32CQ qNDQMTbY4HuIBUH+CX4V2LZPSusviDR08rDF0p6te76vV1ot0lV2LVImwVsvWa+Gcxih 0rf9a51Bc9K5sCj7i30dUKTYuVNgU+xrF2tUZ+x9rv2l9EedBpQYfJc+6A0H/uCHzDT8 dazl+N4RJP2LqgRL4amaqzpddRzT+v7uqLImnApveuKLYQyhqKLMY27+I3r+1YVNtd4a QzqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=R8FHJVLT; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id l61si3265183plb.302.2017.11.30.07.25.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=R8FHJVLT; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BC1F02211B431; Thu, 30 Nov 2017 07:20:56 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::242; helo=mail-wm0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.61.87 with SMTP id k84mr2172602wma.48.1512055516690; Thu, 30 Nov 2017 07:25:16 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/PrePi/LzmaDecompress.h b/ArmPlatformPkg/PrePi/LzmaDecompress.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 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 IMPLIED. - -**/ - -#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 GUIDed section. - - Examines a GUIDed section specified by InputSection. - If GUID for InputSection does not match the GUID that this handler supports, - 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 supports, - then the size required to hold the decoded buffer is returned in OututBufferSize, - the size of an optional scratch buffer is returned in ScratchSize, and the Attributes field - from EFI_GUID_DEFINED_SECTION header of InputSection is returned in SectionAttribute. - - 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 formatted file. - @param[out] OutputBufferSize A pointer to the size, in bytes, of an output buffer required - if the buffer specified by InputSection were decoded. - @param[out] ScratchBufferSize A pointer to the size, in bytes, required as scratch space - if the buffer specified by InputSection were 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 was 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 output buffer. - - Decodes the GUIDed section specified by InputSection. - If GUID for InputSection does not match the GUID that this handler supports, then RETURN_UNSUPPORTED is returned. - If the data in InputSection can not be decoded, then RETURN_INVALID_PARAMETER is returned. - If the GUID of InputSection does match the GUID that this handler supports, then InputSection - is decoded into the buffer specified by OutputBuffer and the authentication status of this - decode operation is returned in AuthenticationStatus. If the decoded buffer is identical to the - data in InputSection, then OutputBuffer is set to point at the data in InputSection. 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 buffer, then ASSERT(). - If AuthenticationStatus is NULL, then ASSERT(). - - - @param[in] InputSection A pointer to a GUIDed section of an FFS formatted 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 operation. - @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_STATUS_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/PeiMPCore.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/PeiUniCore.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 #include "PrePi.h" -#include "LzmaDecompress.h" #define IS_XIP() (((UINT64)FixedPcdGet64 (PcdFdBaseAddress) > mSystemMemoryEnd) || \ ((FixedPcdGet64 (PcdFdBaseAddress) + FixedPcdGet32 (PcdFdSize)) < FixedPcdGet64 (PcdSystemMemoryBase))) @@ -168,14 +165,6 @@ PrePiMain ( 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 compressed FV. Status = DecompressFirstFv (); ASSERT_EFI_ERROR (Status); From patchwork Thu Nov 30 15:24:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120214 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809867qgn; Thu, 30 Nov 2017 07:25:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMapR89cVGK76mAXQxMO+DGhvyRACM1rUI1RXoTp2HPp2WS7ND6E/V4UYjHcTQAUTwF01yXU X-Received: by 10.159.231.15 with SMTP id w15mr3040937plq.410.1512055525982; Thu, 30 Nov 2017 07:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055525; cv=none; d=google.com; s=arc-20160816; b=EncTmQbl4EsW8y7J1tsn0RxqNXngDqf25DgXvi7jLPSVPwvupYdCusuGzgqT5IHSPQ 263Uhq+cGoD24ZgAXlO/7Zjl8RQF8UnLQXNxCdJ6D671fVwLa8FmwpR4fChqJBXY/yLx 3W112zlhgpZYi3pF8tm7/eTnBe84CzCZx68SEGili8OetSq7cGA+cmhu7Wxc2Ejrq6eo YPfwWngtfbGSVrWdinlCYYuUNDz4RYpJHPpnQCNlmPDpdE5pIR2FRL7GeWjyERmA34SJ ILd1xb8+HnQ6gLA6lwUTk2MRwygYDtjXUCephapkxRtNV/f+jjqPNpPeGDGl02i5TZE2 dxYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=6BXnNbW8x3Yp08M9qwve6bRS8xI4fUDFwkQll+tHBR8=; b=Khyb50tqYW0lV2kAvIAApm1WZ99EhB3AL/2GLppSTifL/UX330Ec9Q7qRh632HvkjZ KaS0JiKDvd2rDOMl56nrawbUJm3guta1pnmQFQ1BUGiqUDgdnAboil2ZKfgpvD59+8Ke MjgIVBnnLlC42LcQQVj0lqjdvlGOBsckVtQ+20lhY6pCH619iYq04wyTw3n2DHfm5g1C 1KCgDwkUu+Da+7VkjzrEJV1osm+bDVP+8TmENm/yA15nXqFi3asKQccceGuKeM75nIta fR2RVQzUjC6kJek8uTf1z2VoKi7JZatkl7qZD2W7Yxsi4p05xG6LrhgOIQvtW+l/bpGU jL5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OpBCdKl1; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id c10si3154711pgn.333.2017.11.30.07.25.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OpBCdKl1; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 014342211B438; Thu, 30 Nov 2017 07:20:57 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 677912211B42D for ; Thu, 30 Nov 2017 07:20:55 -0800 (PST) Received: by mail-wm0-x243.google.com with SMTP id 64so13059283wme.3 for ; Thu, 30 Nov 2017 07:25:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A5jmI5y9pF0gmRd5PKK/crUOIfWQw93y9kbUkqiD68A=; b=OpBCdKl1b86K2nSCZ65VkOBBoA6+T0F7L2STuufnes0bd1k2DD1qCQgz6mFbPeiEdM jqRTYCN6nJtYei4Ei0ZytCE6s85Dkt+M1l9v7VnY4NL+S+zyabT4OmYtYeAb+pl1vX81 Clb/IuNDmescHjocF1n1yLexYS71uLzgj/6Lc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A5jmI5y9pF0gmRd5PKK/crUOIfWQw93y9kbUkqiD68A=; b=LHMjZOUzbLseE8w+XW3I+Dy8s27cS6vQioGYeQIQytWoYpXa4IQblcvJwv6lzf6GKp tBKl/bZSnAa+n/oUg++dx06HqT6Ni6/0fXSMTTDRsWdg5gR3T1pTcM6x7MEXVYTi5bw0 7m/Cdtibm5eFtYoem6ZYh/YcfWMMB0HEuOpujNG2Uv3gor9k7HfYXozC0J28I/5kX7Pn HXXYdTvtR9nPOBzJ8crNCS0nS16jSb4uq08STGywNCpqy2cg62qxSR1wSjBikx4H5xgl jXAVIww6o12fweaokXKe+9e++Cspzid61/Zw2a+F8pMpSM3kr0dnQT8vaPwykjt8ROuK /Ong== X-Gm-Message-State: AJaThX7J62Vtgwuix15CW4vQrFDbn9SWsQDXi48I+itsHE5LadXBCuxJ +c/uC2wwJiIGGCWsPxTjLeeIgH+IfFI= X-Received: by 10.28.95.7 with SMTP id t7mr2336445wmb.86.1512055519203; Thu, 30 Nov 2017 07:25:19 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id 43sm2566328wru.81.2017.11.30.07.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:18 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 30 Nov 2017 15:24:51 +0000 Message-Id: <20171130152453.19205-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171130152453.19205-1-ard.biesheuvel@linaro.org> References: <20171130152453.19205-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 5/7] ArmPlatformPkg/MemoryInitPeiLib: don't reserve primary FV in memory X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Meenakshi Aggarwal Now that PrePi no longer exposes its internal code via special HOBs, we can remove the special handling of the primary FV, which needed to be reserved so that DXE core could call into the PE/COFF and LZMA libraries in the PrePi module. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Udit Kumar Signed-off-by: Meenakshi Aggarwal [ardb: updated commit log] Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c | 69 -------------------- 1 file changed, 69 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c index 2feb11f21d5d..d03214b5df66 100644 --- a/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c +++ b/ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.c @@ -70,11 +70,7 @@ MemoryPeim ( { ARM_MEMORY_REGION_DESCRIPTOR *MemoryTable; EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttributes; - UINT64 ResourceLength; EFI_PEI_HOB_POINTERS NextHob; - EFI_PHYSICAL_ADDRESS FdTop; - EFI_PHYSICAL_ADDRESS SystemMemoryTop; - EFI_PHYSICAL_ADDRESS ResourceTop; BOOLEAN Found; // Get Virtual Memory Map from the Platform Library @@ -121,71 +117,6 @@ MemoryPeim ( ); } - // - // Reserved the memory space occupied by the firmware volume - // - - SystemMemoryTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemoryBase) + (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdSystemMemorySize); - FdTop = (EFI_PHYSICAL_ADDRESS)PcdGet64 (PcdFdBaseAddress) + (EFI_PHYSICAL_ADDRESS)PcdGet32 (PcdFdSize); - - // EDK2 does not have the concept of boot firmware copied into DRAM. To avoid the DXE - // core to overwrite this area we must mark the region with the attribute non-present - if ((PcdGet64 (PcdFdBaseAddress) >= PcdGet64 (PcdSystemMemoryBase)) && (FdTop <= SystemMemoryTop)) { - Found = FALSE; - - // Search for System Memory Hob that contains the firmware - NextHob.Raw = GetHobList (); - while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) { - if ((NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) && - (PcdGet64 (PcdFdBaseAddress) >= NextHob.ResourceDescriptor->PhysicalStart) && - (FdTop <= NextHob.ResourceDescriptor->PhysicalStart + NextHob.ResourceDescriptor->ResourceLength)) - { - ResourceAttributes = NextHob.ResourceDescriptor->ResourceAttribute; - ResourceLength = NextHob.ResourceDescriptor->ResourceLength; - ResourceTop = NextHob.ResourceDescriptor->PhysicalStart + ResourceLength; - - if (PcdGet64 (PcdFdBaseAddress) == NextHob.ResourceDescriptor->PhysicalStart) { - if (SystemMemoryTop == FdTop) { - NextHob.ResourceDescriptor->ResourceAttribute = ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT; - } else { - // Create the System Memory HOB for the firmware with the non-present attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Top of the FD is system memory available for UEFI - NextHob.ResourceDescriptor->PhysicalStart += PcdGet32(PcdFdSize); - NextHob.ResourceDescriptor->ResourceLength -= PcdGet32(PcdFdSize); - } - } else { - // Create the System Memory HOB for the firmware with the non-present attribute - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes & ~EFI_RESOURCE_ATTRIBUTE_PRESENT, - PcdGet64 (PcdFdBaseAddress), - PcdGet32 (PcdFdSize)); - - // Update the HOB - NextHob.ResourceDescriptor->ResourceLength = PcdGet64 (PcdFdBaseAddress) - NextHob.ResourceDescriptor->PhysicalStart; - - // If there is some memory available on the top of the FD then create a HOB - if (FdTop < NextHob.ResourceDescriptor->PhysicalStart + ResourceLength) { - // Create the System Memory HOB for the remaining region (top of the FD) - BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, - ResourceAttributes, - FdTop, - ResourceTop - FdTop); - } - } - Found = TRUE; - break; - } - NextHob.Raw = GET_NEXT_HOB (NextHob); - } - - ASSERT(Found); - } - // Build Memory Allocation Hob InitMmu (MemoryTable); From patchwork Thu Nov 30 15:24:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120215 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp809975qgn; Thu, 30 Nov 2017 07:25:30 -0800 (PST) X-Google-Smtp-Source: AGs4zMYwBmSpAysV/1UH/j9qpObnEX1vOHDAiUgmR41URVMvwUhSouxErfiBpLSJcy6fUntLLnAR X-Received: by 10.84.245.142 with SMTP id j14mr3037922pll.328.1512055530062; Thu, 30 Nov 2017 07:25:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055530; cv=none; d=google.com; s=arc-20160816; b=P72FjuuF4y6m6aFQrLSGZuqbSFuXqwUK+Ne7Zh2ozfb3UZqM7/RspjRSqCaCFF4CBm S9qGNd8Fp/TTFHn8OgVaWk9deDolSXawlZcy90xnTWUCJLsWrUcJ2L7WDEqO1aDKDCq3 Q8eXZfyJJovKQB19yS47XQiAVIJHJe4LkBoQXXtodhlvFHwv0eyk9GofPi2y6/wYJLCK UODUjl3MHsYX8Fh3chvai2M7k/KmYvv6LCLI+LRt/0DwCur2sgt7I1AaUnzYDo4HgJr5 A1JdjqCncsmpv9ZdjWwIY/EzbhaiewC0C82omkrzUsndCqBW9ubb+eSCWyHuFensIvh+ Gfug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=XyveibH/F+qb04p+r2P/VSgEPU9kZQYRpZOIOCr8uDE=; b=NVZC50pMYs1CoUPzft7ifgIk5lCzDu3sH9OUKtltq8IEZdOSpTFPs+SJuNDPUeNkRn 6lLcx8eJKGl6nTmse9MTiN0higQbVqOrgpFaRK711oMblYrCR5htgYDXkjDLxZXdIin5 RkIcnJ+JvTItZq5Cy3TwSTnn6efUdwRKWKfflY1XZDkHKBBkSZMN2eUNVFOylxDM9Kfd HT9yF4TVzmyvU2TFSiL25g1VtPiCCbrAeNpWX+OLs5aq4F+QWbrkbCXTfrVZgvAmoOsQ k+3RyXotsNGO1tiAhcNRV0/ua2vysRML0afS30NXhNuxVa159GIWwakVKpNDGC95o611 r3MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GISzkc3J; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id f1si3170265pgq.100.2017.11.30.07.25.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GISzkc3J; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3877D2211B43D; Thu, 30 Nov 2017 07:21:01 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.127.22 with SMTP id a22mr897173wmd.12.1512055521182; Thu, 30 Nov 2017 07:25:21 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- ArmPlatformPkg/PrePi/PrePi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Leif Lindholm 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 = FixedPcdGet64(PcdSystemMemoryBase) + FixedPcdGet64(PcdSystemMemorySize) - 1; -EFI_STATUS -EFIAPI -ExtractGuidedSectionLibConstructor ( - VOID - ); - -EFI_STATUS +VOID EFIAPI -LzmaDecompressLibConstructor ( +ProcessLibraryConstructorList ( VOID ); @@ -162,8 +156,7 @@ PrePiMain ( PERF_START (NULL, "PEI", NULL, StartTimeStamp); // SEC phase needs to run library constructors by hand. - ExtractGuidedSectionLibConstructor (); - LzmaDecompressLibConstructor (); + ProcessLibraryConstructorList (); // Assume the FV that contains the SEC (our code) also contains a compressed FV. Status = DecompressFirstFv (); From patchwork Thu Nov 30 15:24:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 120216 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp810047qgn; Thu, 30 Nov 2017 07:25:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMb7t46+J7zLN1tLttCmy2FTgIgoIdD1wNThCsU1hc/Dy+H6+gQeDez1OweUMqD5rvKxf2T+ X-Received: by 10.99.132.72 with SMTP id k69mr2752654pgd.437.1512055533396; Thu, 30 Nov 2017 07:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512055533; cv=none; d=google.com; s=arc-20160816; b=015ByEaJO1E8dJ9fiFmGZNZKQ1PUXaJsyED3MxplJ5vhvUeer25kctXnjwiYGbsvau ocYzQF5lv9JWx4JDLbUYPez9AkFaY/N+tzuQ+XXFaLUvwIZrIS2Hz1frAth86oYZ4jxD DSF5olAz3vFPyU6lL1oirQZNxbilaBrYJLzoOk4Iat+Q9acGiB048Ar+7BCCyL+ZG6nx sjbdV5FZ2P3SrQ+tZ0HNaFkGmfik8O8LO2nMJI82lqunRB+S5u46DwrvcYSyMKC50Y8X RSdF98i3Qw6ok50Q0kyLChhlfc5bblj7B0o88qjc010CWakClJpNWJGXoe1+rVhN19rW 0g4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=0VWilixiz5v3dQgZL49U4NxSR3P1j0rNfmOvvhbZ/vo=; b=i0criCUYJNys+qm7s7vgjCvU3F6DWGVoB4p7njZGyY0OfwPcJ67LorwLRZEatH3LZI q9XJXewMBepS9jT4Nto/B9I9f0zfaP2E8W+sXDs5OCMnNAHUClg+XXk4hP6uhPUsTfh1 ReMl6Y38jHKbPb5J6HQ3g2Ql7XkC8IgK5GKrjqVL3NQVmmpwGaTdRBErgmx9mBACzSRw CQpXV1bS4ri/rVX4USMVkqayNBKWmO7S8e5960H3bJ4ktPBuEkzcsrkthQ0A1XDkMgzs cZoGLIMPZrKyXlKBdUBIFC5SZeF5eBY/HkXTJ1xYLqhJFTpMA8KQi4YysRAmm2NHIjBI xrvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AoEX2m/C; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id w24si3268136pll.230.2017.11.30.07.25.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Nov 2017 07:25:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AoEX2m/C; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 717642210FA00; Thu, 30 Nov 2017 07:21:01 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::241; helo=mail-wm0-x241.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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) 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-Received: by 10.28.167.22 with SMTP id q22mr2426627wme.52.1512055523704; Thu, 30 Nov 2017 07:25:23 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.11.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/PrePi/PeiMPCore.inf b/ArmPlatformPkg/PrePi/PeiMPCore.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 [LibraryClasses] BaseLib diff --git a/ArmPlatformPkg/PrePi/PeiUniCore.inf b/ArmPlatformPkg/PrePi/PeiUniCore.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 [LibraryClasses] BaseLib