From patchwork Fri Sep 5 11:56:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36832 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 765EC202E4 for ; Fri, 5 Sep 2014 11:57:46 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf67989938pdj.0 for ; Fri, 05 Sep 2014 04:57:40 -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=hYd9M1UZk+dP065+PHIIBiwLEykRJ/5c6ggLDhZ4QMv0AEhzMEtm5fYaONTGSia6ip 8+ZwmO36gICf19F/3xQa1BKLP+aIGLotQc6V8yUlwMJ6Ak5YR9qEay2VQaB+blf2Uol+ EUhDp35DWL6pYySJnB5Lps7yiqEAGQbKaV9qgn7BZZYH4YnfIKrESdK/F5Zij+XJnRmu U9pjl4aGBvP/nH9MJAN8zRAU/mapx43MxksLrPyzSqnEeipwiStEG0Qivxk3VdyHzcmu QTj4ARLLhHDTxsPZtDwVJ3ftxnXeUgSt3LiBiMduVMc4HvQWh1DOurcRAz2YEv8wEVJC VxZg== X-Gm-Message-State: ALoCoQn6MGBk98JaCw3THR4mWXILgy9L12VLOhhpA8sLkBvAJf3FBQ7cmEWll8bEl5nvytwGbgdo X-Received: by 10.70.96.197 with SMTP id du5mr6549981pdb.3.1409918259585; Fri, 05 Sep 2014 04:57:39 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.92.228 with SMTP id b91ls673047qge.88.gmail; Fri, 05 Sep 2014 04:57:39 -0700 (PDT) X-Received: by 10.220.113.148 with SMTP id a20mr1023038vcq.30.1409918259487; Fri, 05 Sep 2014 04:57:39 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id pu11si955389vdb.55.2014.09.05.04.57.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id im17so12306644vcb.13 for ; Fri, 05 Sep 2014 04:57:39 -0700 (PDT) X-Received: by 10.220.44.80 with SMTP id z16mr9764104vce.7.1409918259398; Fri, 05 Sep 2014 04:57:39 -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 uj3csp71076vcb; Fri, 5 Sep 2014 04:57:38 -0700 (PDT) X-Received: by 10.43.127.136 with SMTP id ha8mr2629500icc.78.1409918258733; Fri, 05 Sep 2014 04:57:38 -0700 (PDT) Received: from lists.sourceforge.net (lists.sourceforge.net. [216.34.181.88]) by mx.google.com with ESMTPS id xc18si2772542icb.78.2014.09.05.04.57.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:38 -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 1XPs8w-0001Wg-52; Fri, 05 Sep 2014 11:57:30 +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 1XPs8t-0001WH-UH for edk2-devel@lists.sourceforge.net; Fri, 05 Sep 2014 11:57:27 +0000 Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of linaro.org designates 209.85.212.179 as permitted sender) client-ip=209.85.212.179; envelope-from=ard.biesheuvel@linaro.org; helo=mail-wi0-f179.google.com; Received: from mail-wi0-f179.google.com ([209.85.212.179]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1XPs8s-0000Qx-Ki for edk2-devel@lists.sourceforge.net; Fri, 05 Sep 2014 11:57:27 +0000 Received: by mail-wi0-f179.google.com with SMTP id q5so2834562wiv.0 for ; Fri, 05 Sep 2014 04:57:17 -0700 (PDT) X-Received: by 10.194.63.241 with SMTP id j17mr14136926wjs.115.1409918236888; Fri, 05 Sep 2014 04:57:16 -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 dc9sm1758798wib.5.2014.09.05.04.57.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 04:57:16 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.sourceforge.net, lersek@redhat.com, olivier.martin@arm.com Date: Fri, 5 Sep 2014 13:56:43 +0200 Message-Id: <1409918214-29584-14-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409918214-29584-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409918214-29584-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: 1XPs8s-0000Qx-Ki Cc: peter.maydell@linaro.org, ilias.biris@linaro.org, christoffer.dall@linaro.org Subject: [edk2] [PATCH v7 13/24] 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.182 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 Reviewed-by: Laszlo Ersek --- 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