From patchwork Wed Sep 3 11:18:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36578 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f200.google.com (mail-pd0-f200.google.com [209.85.192.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5E67E202E4 for ; Wed, 3 Sep 2014 11:19:11 +0000 (UTC) Received: by mail-pd0-f200.google.com with SMTP id w10sf49516727pde.7 for ; Wed, 03 Sep 2014 04:19: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: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=EXoORPcMxPr81iK6nP+03dg+Y1GcpF7G49D7mgCr0ls=; b=hArbgzuX5rg5tTS1mRy+neTuJ0Y3wZDqtfWGHTiE3JJIOdEqbHhxCFlcm3Fua1R42M 4uOkdyB0RbvcDveYDNpQ6r9KeGF9GEf5N+aiYOhkfeiODGfC8FoxaqHyRXIDxBA+tqwI CNvAcEVJBOgbiP28mXuSIbgmL6Ea+lDb0PyEu1MnivllrXNTVgr6SCH/Lbm2m3F+n/do XVEFUnb1ZYbot9HTcvIzW+UiaKjKWMvrTd8oifs3s5ZBYGz5WIChCYmbL6znkj80HGkL xOOVdbcd6yMeH+NV9HVlcOy2BmFGumOrAUxF14z6188cjDCLQnwr6cpj0JBGKQ/5Yy6q C7yw== X-Gm-Message-State: ALoCoQnCJybWVguF/25w+m1xD2n45qtLiF50KobV6AYRbXcePedfRJde7aNNt+UJlcli8HgSq740 X-Received: by 10.66.66.46 with SMTP id c14mr22871489pat.21.1409743144593; Wed, 03 Sep 2014 04:19:04 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.18.193 with SMTP id 59ls2851988qgf.7.gmail; Wed, 03 Sep 2014 04:19:04 -0700 (PDT) X-Received: by 10.52.120.51 with SMTP id kz19mr16585vdb.95.1409743143072; Wed, 03 Sep 2014 04:19:03 -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 zs4si704981vdb.65.2014.09.03.04.19.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:03 -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 hy4so8671599vcb.10 for ; Wed, 03 Sep 2014 04:19:03 -0700 (PDT) X-Received: by 10.52.73.202 with SMTP id n10mr18893vdv.86.1409743142956; Wed, 03 Sep 2014 04:19:02 -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 uj3csp663972vcb; Wed, 3 Sep 2014 04:19:02 -0700 (PDT) X-Received: by 10.50.12.4 with SMTP id u4mr36368139igb.22.1409743142357; Wed, 03 Sep 2014 04:19:02 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id fv4si1690153igb.20.2014.09.03.04.19.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:19:02 -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-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aT-0004GG-Fp; Wed, 03 Sep 2014 11:18:53 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1XP8aQ-0004Fz-Ni for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:50 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 74.125.82.181 as permitted sender) client-ip=74.125.82.181; envelope-from=ard.biesheuvel@linaro.org; helo=mail-we0-f181.google.com; Received: from mail-we0-f181.google.com ([74.125.82.181]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XP8aP-0005F5-EV for edk2-devel@lists.sourceforge.net; Wed, 03 Sep 2014 11:18:50 +0000 Received: by mail-we0-f181.google.com with SMTP id x48so8423946wes.40 for ; Wed, 03 Sep 2014 04:18:43 -0700 (PDT) X-Received: by 10.180.99.34 with SMTP id en2mr35294507wib.34.1409743123065; Wed, 03 Sep 2014 04:18:43 -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.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Sep 2014 04:18:42 -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:06 +0200 Message-Id: <1409743096-14919-14-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: 1XP8aP-0005F5-EV Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v6 13/23] EmbeddedPkg: split off FDT loading functionality from FdtLib 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 Split off the recently added functionality to load device tree images and install them as configuration tables, as it introduces a dependency on UefiBootServicesTableLib, preventing FdtLib from being used during SEC and PEI phases. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- EmbeddedPkg/Include/FdtLoadLib.h | 51 ++++++++++++++++++++++ EmbeddedPkg/Include/libfdt_env.h | 31 ------------- EmbeddedPkg/Library/FdtLib/FdtLib.inf | 13 ------ .../{FdtLib => FdtLoadLib}/FdtConfigurationTable.c | 2 +- EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf | 44 +++++++++++++++++++ 5 files changed, 96 insertions(+), 45 deletions(-) create mode 100644 EmbeddedPkg/Include/FdtLoadLib.h rename EmbeddedPkg/Library/{FdtLib => FdtLoadLib}/FdtConfigurationTable.c (96%) create mode 100644 EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf diff --git a/EmbeddedPkg/Include/FdtLoadLib.h b/EmbeddedPkg/Include/FdtLoadLib.h new file mode 100644 index 000000000000..b5f6dfc8fbc6 --- /dev/null +++ b/EmbeddedPkg/Include/FdtLoadLib.h @@ -0,0 +1,51 @@ +/** @file +* +* Copyright (c) 2011-2014, 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 _FDTLOADLIB_ENV_H +#define _FDTLOADLIB_ENV_H + +#include +#include + +/** + Load and Install FDT from Semihosting + + @param Filename Name of the file to load from semihosting + + @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table + from semihosting + @return EFI_NOT_FOUND Fail to locate the file in semihosting + @return EFI_OUT_OF_RESOURCES Fail to allocate memory to contain the blob +**/ +EFI_STATUS +InstallFdtFromSemihosting ( + IN CONST CHAR16* FileName + ); + +/** + Load and Install FDT from Firmware Volume + + @param Filename Guid of the FDT blob to load from firmware volume + + @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table + from firmware volume + @return EFI_NOT_FOUND Failed to locate the file in firmware volume + @return EFI_OUT_OF_RESOURCES Failed to allocate memory to contain the blob +**/ +EFI_STATUS +InstallFdtFromFv ( + IN CONST EFI_GUID *FileName + ); + +#endif diff --git a/EmbeddedPkg/Include/libfdt_env.h b/EmbeddedPkg/Include/libfdt_env.h index c4dc83c02494..3e24db94098c 100644 --- a/EmbeddedPkg/Include/libfdt_env.h +++ b/EmbeddedPkg/Include/libfdt_env.h @@ -15,7 +15,6 @@ #ifndef _LIBFDT_ENV_H #define _LIBFDT_ENV_H -#include #include #include @@ -79,34 +78,4 @@ static inline char *strchr(const char *s, int c) { return AsciiStrStr (s, pattern); } -/** - Load and Install FDT from Semihosting - - @param Filename Name of the file to load from semihosting - - @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table - from semihosting - @return EFI_NOT_FOUND Fail to locate the file in semihosting - @return EFI_OUT_OF_RESOURCES Fail to allocate memory to contain the blob -**/ -EFI_STATUS -InstallFdtFromSemihosting ( - IN CONST CHAR16* FileName - ); - -/** - Load and Install FDT from Firmware Volume - - @param Filename Guid of the FDT blob to load from firmware volume - - @return EFI_SUCCESS Fdt Blob was successfully installed into the configuration table - from firmware volume - @return EFI_NOT_FOUND Failed to locate the file in firmware volume - @return EFI_OUT_OF_RESOURCES Failed to allocate memory to contain the blob -**/ -EFI_STATUS -InstallFdtFromFv ( - IN CONST EFI_GUID *FileName - ); - #endif /* _LIBFDT_ENV_H */ diff --git a/EmbeddedPkg/Library/FdtLib/FdtLib.inf b/EmbeddedPkg/Library/FdtLib/FdtLib.inf index d18caa67ea3f..f3da231143a0 100644 --- a/EmbeddedPkg/Library/FdtLib/FdtLib.inf +++ b/EmbeddedPkg/Library/FdtLib/FdtLib.inf @@ -26,7 +26,6 @@ # [Sources] - FdtConfigurationTable.c fdt_ro.c fdt_rw.c fdt_strerror.c @@ -37,15 +36,3 @@ [Packages] MdePkg/MdePkg.dec EmbeddedPkg/EmbeddedPkg.dec - -[LibraryClasses] - UefiBootServicesTableLib - -[Protocols] - gEfiDevicePathProtocolGuid - gEfiSimpleFileSystemProtocolGuid - gEfiFirmwareVolume2ProtocolGuid - -[Guids] - gEfiFileInfoGuid - gFdtTableGuid diff --git a/EmbeddedPkg/Library/FdtLib/FdtConfigurationTable.c b/EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c similarity index 96% rename from EmbeddedPkg/Library/FdtLib/FdtConfigurationTable.c rename to EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c index aece1df1cc79..fd15a0b0ceb9 100644 --- a/EmbeddedPkg/Library/FdtLib/FdtConfigurationTable.c +++ b/EmbeddedPkg/Library/FdtLoadLib/FdtConfigurationTable.c @@ -24,7 +24,7 @@ #include #include -#include +#include // // Device path for SemiHosting diff --git a/EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf b/EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf new file mode 100644 index 000000000000..4d870fa6939e --- /dev/null +++ b/EmbeddedPkg/Library/FdtLoadLib/FdtLoadLib.inf @@ -0,0 +1,44 @@ +#/* @file +# 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 = FdtLoadLib + FILE_GUID = F00298C1-BBC3-445F-8906-AAEAFE7729A4 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = FdtLoadLib + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = ARM AARCH64 +# + +[Sources] + FdtConfigurationTable.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + +[LibraryClasses] + FdtLib + +[Protocols] + gEfiDevicePathProtocolGuid + gEfiSimpleFileSystemProtocolGuid + gEfiFirmwareVolume2ProtocolGuid + +[Guids] + gEfiFileInfoGuid + gFdtTableGuid