From patchwork Wed Sep 3 11:18:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36585 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C1CDE202E4 for ; Wed, 3 Sep 2014 11:19:18 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id ft15sf5278885pdb.2 for ; Wed, 03 Sep 2014 04:19:17 -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:cc: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=HuCg5VzROkgVJcAfZzN3wvZeUE5AVbPT1/0/Zzstc/0=; b=R0rG7ENN5df0Mngs/3fONA7HiO1Cda265CxNuQwg8tD73bszcanLH+TQf19Hn5ehm9 ntpdGQWfxE7XQKy+BBIpb8ZZEfnXx1/zn6uYYKbQlcOuuByJz8wOYYjN0hyhF3S2PWj2 ZmlYtEHCPirf929hayDqipvnFxfQd00FdZ47phq0w533ACZ++g+d1cNmtAqm4/KI8AWZ 7m+0J8OmmwdqlJ1rWYjSJww+VmfaaBuCMxjEljKCMPIqbDLFjMqVgyEhXsIr0DgGhW7l Mbc5GA9HvXFLGWSF7yd5J8GxmSMcRjtAR4oth+xXCiCYnGWUjiUMRjSnYaS8xLSRQkZ4 5mMw== X-Gm-Message-State: ALoCoQl0UWU8NUw4XiY7KFgw0Je/KdqBMykYkAaaLcMGYM4mAcCbpYTAQwbSVtVsiCrc4RwACMOP X-Received: by 10.70.89.97 with SMTP id bn1mr22591666pdb.5.1409743157367; Wed, 03 Sep 2014 04:19:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.230 with SMTP id j93ls2895045qgf.31.gmail; Wed, 03 Sep 2014 04:19:17 -0700 (PDT) X-Received: by 10.52.129.200 with SMTP id ny8mr29131294vdb.27.1409743157257; Wed, 03 Sep 2014 04:19:17 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id 9si3442750vcq.96.2014.09.03.04.19.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so8536689vcb.2 for ; Wed, 03 Sep 2014 04:19:17 -0700 (PDT) X-Received: by 10.220.169.72 with SMTP id x8mr77884vcy.45.1409743157096; Wed, 03 Sep 2014 04:19:17 -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 uj3csp664004vcb; Wed, 3 Sep 2014 04:19:16 -0700 (PDT) X-Received: by 10.50.61.138 with SMTP id p10mr36049869igr.20.1409743156467; Wed, 03 Sep 2014 04:19:16 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id rs7si1695684igb.13.2014.09.03.04.19.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:16 -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 1XP8ai-0008Gn-Rj; Wed, 03 Sep 2014 11:19:08 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8ah-0008GK-LL for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:19:07 +0000 Received-SPF: pass (sog-mx-3.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.178 as permitted sender) client-ip=209.85.212.178; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f178.google.com; Received: from mail-wi0-f178.google.com ([209.85.212.178]) by sog-mx-3.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XP8ag-0001U2-HL for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:19:07 +0000 Received: by mail-wi0-f178.google.com with SMTP id r20so9598651wiv.5 for ; Wed, 03 Sep 2014 04:19:00 -0700 (PDT) X-Received: by 10.180.207.6 with SMTP id ls6mr24622056wic.48.1409743140284; Wed, 03 Sep 2014 04:19:00 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id p1sm15258661wjy.22.2014.09.03.04.18.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:59 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Wed, 3 Sep 2014 13:18:14 +0200 Message-Id: <1409743096-14919-22-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409743096-14919-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409743096-14919-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: 1XP8ag-0001U2-HL Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v6 21/23] 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.171 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 --- Removed the 'Reviewed-by: Laszlo Ersek ' as this module was changed to load the device tree from PcdDeviceTreeInitialBaseAddress, but store the new offset in PcdDeviceTreeBaseAddress (as before). .../Library/PlatformPeiLib/PlatformPeiLib.c | 47 +++++++++++++++++++++ .../Library/PlatformPeiLib/PlatformPeiLib.inf | 48 ++++++++++++++++++++++ 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..41d506cf717f --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.c @@ -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. +* +**/ + +#include + +#include +#include +#include +#include +#include + +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ) +{ + VOID *Base; + VOID *NewBase; + UINTN FdtSize; + + Base = (VOID*)(UINTN)FixedPcdGet64 (PcdDeviceTreeInitialBaseAddress); + 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..e544b528d261 --- /dev/null +++ b/ArmPlatformPkg/ArmVirtualizationPkg/Library/PlatformPeiLib/PlatformPeiLib.inf @@ -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. +# +#**/ + +[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/ArmVirtualizationPkg/ArmVirtualizationPkg.dec + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + DebugLib + HobLib + FdtLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmTokenSpaceGuid.PcdFvSize + gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress + +[Pcd] + gArmVirtualizationTokenSpaceGuid.PcdDeviceTreeBaseAddress + +[Depex] + gEfiPeiMemoryDiscoveredPpiGuid