From patchwork Thu Aug 28 14:14:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36223 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CF903202DD for ; Thu, 28 Aug 2014 14:15:10 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lf10sf18868773pab.9 for ; Thu, 28 Aug 2014 07:15:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:reply-to:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=nLHPLUbSAUe/vUV5DJR3D9U620r99ONZCcxZhWZAsdA=; b=A66FYWTEuCnkUOcOHNZtpVzZhzkE4A/eT4flmkkaiglNdIN6dTidPruzCCN4A4NG9G J+zGDvPSsUYLXB0Nwa4Z4tWorVnlng/jBgfIABEN8Ja9JDuI/rIPq+ScqLXPI5+NTZRM ItoCgs6ny33VHmHveRIdPtY2o8GW+fArQRUHRI4tZOfKm4S8wq6g/pUrAVweezCkpIRn 2hpl2JTPSeHR6AD55QmUwgZVSRVMosIjEbVRHwo0J8QCjpSZNYXEj80FZ7isacm6ExWC fR3UFSRrPAMy8N5UjGrQl1um9Eu8ESC3uTTfF7WgnHaJ3q2PNzxYoQk/hZfyVa7bj4Si Tsig== X-Gm-Message-State: ALoCoQmMdCqpMZCs11YA9k2f+XjHfN+Ulyu9DCwLVFyvjUq7JmF8sbkoAjbBPFoVmlgvyee/zQBL X-Received: by 10.70.89.97 with SMTP id bn1mr2234085pdb.5.1409235306618; Thu, 28 Aug 2014 07:15:06 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.17.47 with SMTP id 44ls581627qgc.11.gmail; Thu, 28 Aug 2014 07:15:06 -0700 (PDT) X-Received: by 10.52.145.204 with SMTP id sw12mr783330vdb.79.1409235306474; Thu, 28 Aug 2014 07:15:06 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id rk7si3575703vcb.45.2014.08.28.07.15.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:15:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hy4so862243vcb.38 for ; Thu, 28 Aug 2014 07:15:06 -0700 (PDT) X-Received: by 10.52.129.165 with SMTP id nx5mr2788607vdb.25.1409235306394; Thu, 28 Aug 2014 07:15:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp243514vcb; Thu, 28 Aug 2014 07:15:05 -0700 (PDT) X-Received: by 10.50.176.202 with SMTP id ck10mr38574104igc.2.1409235305716; Thu, 28 Aug 2014 07:15:05 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id r4si4169261ici.105.2014.08.28.07.15.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:15:05 -0700 (PDT) Received-SPF: pass (google.com: domain of edk2-devel-bounces@lists.sourceforge.net designates 216.34.181.88 as permitted sender) client-ip=216.34.181.88; Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XN0TX-0004zK-6T; Thu, 28 Aug 2014 14:14:55 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XN0TV-0004z8-Jf for edk2-devel@lists.sourceforge.net; Thu, 28 Aug 2014 14:14:53 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.175 as permitted sender) client-ip=209.85.212.175; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f175.google.com; Received: from mail-wi0-f175.google.com ([209.85.212.175]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XN0TU-0002U8-Fj for edk2-devel@lists.sourceforge.net; Thu, 28 Aug 2014 14:14:53 +0000 Received: by mail-wi0-f175.google.com with SMTP id ho1so7555902wib.14 for ; Thu, 28 Aug 2014 07:14:44 -0700 (PDT) X-Received: by 10.194.78.4 with SMTP id x4mr5731056wjw.44.1409235284469; Thu, 28 Aug 2014 07:14:44 -0700 (PDT) Received: from ards-macbook-pro.local (BSN-61-108-214.dial-up.dsl.siol.net. [86.61.108.214]) by mx.google.com with ESMTPSA id bk6sm10278657wjb.26.2014.08.28.07.14.42 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 07:14:43 -0700 (PDT) From: Ard Biesheuvel To: lersek@redhat.com, olivier.martin@arm.com, edk2-devel@lists.sourceforge.net, peter.maydell@linaro.org, christoffer.dall@linaro.org, drjones@redhat.com, ilias.biris@linaro.org, leif.lindholm@linaro.org Date: Thu, 28 Aug 2014 16:14:01 +0200 Message-Id: <1409235244-25783-14-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409235244-25783-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409235244-25783-1-git-send-email-ard.biesheuvel@linaro.org> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1XN0TU-0002U8-Fj Subject: [edk2] [PATCH v4 13/16] ArmVirtualizationPkg: add PlatformPeiLib library X-BeenThere: edk2-devel@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list Reply-To: edk2-devel@lists.sourceforge.net List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.sourceforge.net X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ard.biesheuvel@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 This is a fork of the ARM PlatformPeiLib for virtual machines. The main purpose of having this specific implementation is that it allows us to preserve the device tree blob if it was passed to us in system DRAM. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- .../Library/PlatformPeiLib/PlatformPeiLib.c | 48 ++++++++++++++++++++++ .../Library/PlatformPeiLib/PlatformPeiLib.inf | 47 +++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c create mode 100644 ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c new file mode 100644 index 000000000000..d08eb0d0e45e --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -0,0 +1,48 @@ +/** @file +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* Copyright (c) 2014, Linaro 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 + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ) +{ + VOID *Base; + VOID *NewBase; + UINTN FdtSize; + + Base = (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeBaseAddress); + ASSERT (fdt_check_header (Base) == 0); + + FdtSize = fdt_totalsize (Base); + NewBase = AllocatePages (EFI_SIZE_TO_PAGES (FdtSize)); + ASSERT (NewBase != NULL); + + CopyMem (NewBase, Base, FdtSize); + PcdSet64 (PcdDeviceTreeBaseAddress, (UINT64)(UINTN)NewBase); + + BuildFvHob (PcdGet32(PcdFvBaseAddress), PcdGet32(PcdFvSize)); + + return EFI_SUCCESS; +} diff --git a/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf new file mode 100644 index 000000000000..f8a168ae6923 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf @@ -0,0 +1,47 @@ +#/** @file +# +# Copyright (c) 2011-2012, ARM Limited. All rights reserved. +# Copyright (c) 2014, Linaro 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. +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = PlatformPeiLib + FILE_GUID = 59C11815-F8DA-4F49-B4FB-EC1E41ED1F06 + MODULE_TYPE = SEC + VERSION_STRING = 1.0 + LIBRARY_CLASS = PlatformPeiLib + +[Sources] + PlatformPeiLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + DebugLib + HobLib + FdtLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + +[Pcd] + gArmTokenSpaceGuid.PcdDeviceTreeBaseAddress + +[Depex] + gEfiPeiMemoryDiscoveredPpiGuid