From patchwork Thu Nov 22 17:26:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151811 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1027346ljp; Thu, 22 Nov 2018 09:35:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/Up0jhKAQYdIxfyKYVjVewAYCNoLHdvOC5yUvziJ19UmpKJgvkpHHTWZjVfVu3OVftljrki X-Received: by 2002:a63:ce50:: with SMTP id r16mr10789955pgi.217.1542908107084; Thu, 22 Nov 2018 09:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542908107; cv=none; d=google.com; s=arc-20160816; b=YaEIfjUxbVWSwNtPz4rDHW2pl6OJOdhWk3wypSEN6sWsSTFiZDOU+Qs0coB/QQZftG JMx3Sy1R1sGYWSJJc/MCmbMX8nOhY1FALKkvs8fN54zdVd8ZkDEFyRVeLm6iTo0yZzn4 j08EKPncCbawXfLjBuUEnluW5WymBIfBQphwOr6/DHgvCkm0ZqVeL5ytq9x1dN9cNiX3 vACHeWy6CqU+lJ9gXmRU9HGK7rrLk1TEbzuzUlL1FoUqS7l6xfNzQTxvfRSD68mHxikl FfowYJ5L6Vkm3ho78+B+ZcnjGlOzvexZJkKpqWsgVuJD9YaLhZMFiXGIwWz0/YulKArD 7cWA== 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; bh=opyg0iYWKI3PLC9OUUxH770iQfK9+tU/bW7B8oaaI8k=; b=XY8W0P60+lbA3CGhHTRHO703S3xwa/WEdAayrSYnoy5cN9NVsIGtdF4nLzMkaL9iQU TOvXrd1J8J+k901IQ114LIzCydG5NfvBAq3w02YucaeSNnPlBLZsIq/GeZRQnSCMKKRJ uFTJ6mw266l72r33qTMWCz43jCp2RGQkJtQmBK9rxGGcvac1IsoyCb36Dbieb4CnCmt2 wYteaegcgUEezhOZVexVtqSZrWTO1MeUMyJDc8vpKi/y0DcugRiz3J8jI1XxGWYCOitB X2+9COad0HeV5XZMMyYvK78Op7pO4tZraxdCbJF8KUsdbEVKBlcuUjRe+BOOODo+ov6+ daUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=RfIS8Xpq; 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 o13-v6si45972830pgh.61.2018.11.22.09.35.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:35:07 -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=RfIS8Xpq; 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 6817E21194868; Thu, 22 Nov 2018 09:35:06 -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:4864:20::443; helo=mail-wr1-x443.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (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 7A68A2118FF2F for ; Thu, 22 Nov 2018 09:35:05 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id z5so5701483wrt.11 for ; Thu, 22 Nov 2018 09:35:05 -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=nw0JpCCGx9wAcKGlmydfV8b44dxDeVFGlcc2cVvUZo8=; b=RfIS8XpqTSyQ9UXSbsYZ9UUPSJhJyVD07SYuEl5aowUVMrsaWi3HHbyuzUDx6zsoV7 kO9LSZ2piqyRP/rbiw8UA7uL5EGgQslTtPyEMc1p1/AodUTU6KdTxlR35Rn1/sGfqmCQ 0iSXA2ISnMF5QgU7+2MVdwa9sUXqiV/SGJ/Qk= 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=nw0JpCCGx9wAcKGlmydfV8b44dxDeVFGlcc2cVvUZo8=; b=Iy4+H56L75KueDWDGkEnoRptPpxcczf5pPUUwdTqH07GpHA7GOBuwpANo+LGuhfXTF hPjK7WrwmQXYwt4QlQZ0h3AKU3/SO5RCV1ORbnKa1KNegcNUQVO+p8YslZZdicy9TMUs G912K6/B7KOkg2X0xHi5l2tSOzTdn7RntA7QXBVNwkSgbOGAlrn/pOJ+1GYilac1BVAo GcrZACOe6uG90SpMlfdiySF8tFDPQdtjfLrd30xFjWG08SgfT77xyWvBqw8BBYnR6F31 TKigwhZebKpAfuNpLHR34vR4KgGXo2MFH86ESOCYKYa1ce1LcaTwgCZFqAdT/FHzdLVh WNSA== X-Gm-Message-State: AA+aEWZ3jNaLUerRNNKzcI0FrCGHdESi3F9xV9kFTen7nQeFLw+pRxqS S+YmCw3V/ajmm2Bp0TaPQuqr8GNAO9mQJA== X-Received: by 2002:adf:eec9:: with SMTP id a9mr10261193wrp.242.1542907609863; Thu, 22 Nov 2018 09:26:49 -0800 (PST) Received: from mba13.wifi.ns.nl ([2a01:cb1d:112:6f00:6422:2edf:11bf:f2b]) by smtp.gmail.com with ESMTPSA id v1sm8874985wrw.90.2018.11.22.09.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:26:48 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 22 Nov 2018 18:26:42 +0100 Message-Id: <20181122172645.20819-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181122172645.20819-1-ard.biesheuvel@linaro.org> References: <20181122172645.20819-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 1/4] Platform/ARM: import ARM platform specific BdsLib header X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" The BdsLib library has been moved into Platform/ARM a while ago, but the BdsLib.h header was left behind, and so all users in Platform/ARM are still relying on it to be available in ArmPkg. So let's add a copy to Platform/ARM and wire it up, so we can drop it from ArmPkg going forward. Note that the BdsLib implementation included ArmLib.h from ArmPkg without using anything it provides, so drop that false dependency as well. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/ARM/ARM.dec | 3 + Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf | 2 +- Platform/ARM/Include/Library/BdsLib.h | 212 ++++++++++++++++++++ Platform/ARM/Library/BdsLib/BdsInternal.h | 1 - Platform/ARM/Library/BdsLib/BdsLib.inf | 2 +- 5 files changed, 217 insertions(+), 3 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Acked-by: Laszlo Ersek diff --git a/Platform/ARM/ARM.dec b/Platform/ARM/ARM.dec index f9bf3294a0ca..6a6eeb6559fd 100644 --- a/Platform/ARM/ARM.dec +++ b/Platform/ARM/ARM.dec @@ -21,5 +21,8 @@ [Includes] Include # Root include for the package +[LibraryClasses] + BdsLib|Include/Library/BdsLib.h + [Guids] gArmBootMonFsFileInfoGuid = { 0x41e26b9c, 0xada6, 0x45b3, { 0x80, 0x8e, 0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } } diff --git a/Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf b/Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf index f9a5aee3596e..d4aef4bfce92 100644 --- a/Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf +++ b/Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf @@ -28,10 +28,10 @@ ShellSetFdt.c [Packages] - ArmPkg/ArmPkg.dec EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + Platform/ARM/ARM.dec Platform/ARM/Drivers/FdtPlatformDxe/FdtPlatformDxe.dec ShellPkg/ShellPkg.dec diff --git a/Platform/ARM/Include/Library/BdsLib.h b/Platform/ARM/Include/Library/BdsLib.h new file mode 100644 index 000000000000..4528c2e8739b --- /dev/null +++ b/Platform/ARM/Include/Library/BdsLib.h @@ -0,0 +1,212 @@ +/** @file +* +* Copyright (c) 2013-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 __BDS_ENTRY_H__ +#define __BDS_ENTRY_H__ + +#define IS_DEVICE_PATH_NODE(node,type,subtype) \ + (((node)->Type == (type)) && ((node)->SubType == (subtype))) + +/** + This is defined by the UEFI specs, don't change it +**/ +typedef struct { + UINT16 LoadOptionIndex; + EFI_LOAD_OPTION *LoadOption; + UINTN LoadOptionSize; + + UINT32 Attributes; + UINT16 FilePathListLength; + CHAR16 *Description; + EFI_DEVICE_PATH_PROTOCOL *FilePathList; + + VOID* OptionalData; + UINTN OptionalDataSize; +} BDS_LOAD_OPTION; + +/** + Connect a Device Path and return the handle of the driver that support this DevicePath + + @param DevicePath Device Path of the File to connect + @param Handle Handle of the driver that support this DevicePath + @param RemainingDevicePath Remaining DevicePath nodes that do not match the driver DevicePath + + @retval EFI_SUCCESS A driver that matches the Device Path has been found + @retval EFI_NOT_FOUND No handles match the search. + @retval EFI_INVALID_PARAMETER DevicePath or Handle is NULL + +**/ +EFI_STATUS +BdsConnectDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL* DevicePath, + OUT EFI_HANDLE *Handle, + OUT EFI_DEVICE_PATH_PROTOCOL **RemainingDevicePath + ); + +/** + Connect all DXE drivers + + @retval EFI_SUCCESS All drivers have been connected + @retval EFI_NOT_FOUND No handles match the search. + @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results. + +**/ +EFI_STATUS +BdsConnectAllDrivers ( + VOID + ); + +/** + Return the value of a global variable defined by its VariableName. + The variable must be defined with the VendorGuid gEfiGlobalVariableGuid. + + @param VariableName A Null-terminated string that is the name of the vendor's + variable. + @param DefaultValue Value returned by the function if the variable does not exist + @param DataSize On input, the size in bytes of the return Data buffer. + On output the size of data returned in Data. + @param Value Value read from the UEFI Variable or copy of the default value + if the UEFI Variable does not exist + + @retval EFI_SUCCESS All drivers have been connected + @retval EFI_NOT_FOUND No handles match the search. + @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results. + +**/ +EFI_STATUS +GetGlobalEnvironmentVariable ( + IN CONST CHAR16* VariableName, + IN VOID* DefaultValue, + IN OUT UINTN* Size, + OUT VOID** Value + ); + +/** + Return the value of the variable defined by its VariableName and VendorGuid + + @param VariableName A Null-terminated string that is the name of the vendor's + variable. + @param VendorGuid A unique identifier for the vendor. + @param DefaultValue Value returned by the function if the variable does not exist + @param DataSize On input, the size in bytes of the return Data buffer. + On output the size of data returned in Data. + @param Value Value read from the UEFI Variable or copy of the default value + if the UEFI Variable does not exist + + @retval EFI_SUCCESS All drivers have been connected + @retval EFI_NOT_FOUND No handles match the search. + @retval EFI_OUT_OF_RESOURCES There is not resource pool memory to store the matching results. + +**/ +EFI_STATUS +GetEnvironmentVariable ( + IN CONST CHAR16* VariableName, + IN EFI_GUID* VendorGuid, + IN VOID* DefaultValue, + IN OUT UINTN* Size, + OUT VOID** Value + ); + +EFI_STATUS +BootOptionFromLoadOptionIndex ( + IN UINT16 LoadOptionIndex, + OUT BDS_LOAD_OPTION** BdsLoadOption + ); + +EFI_STATUS +BootOptionFromLoadOptionVariable ( + IN CHAR16* BootVariableName, + OUT BDS_LOAD_OPTION** BdsLoadOption + ); + +EFI_STATUS +BootOptionToLoadOptionVariable ( + IN BDS_LOAD_OPTION* BdsLoadOption + ); + +UINT16 +BootOptionAllocateBootIndex ( + VOID + ); + +/** + Start an EFI Application from a Device Path + + @param ParentImageHandle Handle of the calling image + @param DevicePath Location of the EFI Application + + @retval EFI_SUCCESS All drivers have been connected + @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found + @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results. + +**/ +EFI_STATUS +BdsStartEfiApplication ( + IN EFI_HANDLE ParentImageHandle, + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN UINTN LoadOptionsSize, + IN VOID* LoadOptions + ); + +EFI_STATUS +BdsLoadImage ( + IN EFI_DEVICE_PATH *DevicePath, + IN EFI_ALLOCATE_TYPE Type, + IN OUT EFI_PHYSICAL_ADDRESS* Image, + OUT UINTN *FileSize + ); + +/** + * Call BS.ExitBootServices with the appropriate Memory Map information + */ +EFI_STATUS +ShutdownUefiBootServices ( + VOID + ); + +/** + Locate an EFI application in a the Firmware Volumes by its name + + @param EfiAppGuid Guid of the EFI Application into the Firmware Volume + @param DevicePath EFI Device Path of the EFI application + + @return EFI_SUCCESS The function completed successfully. + @return EFI_NOT_FOUND The protocol could not be located. + @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol. + +**/ +EFI_STATUS +LocateEfiApplicationInFvByName ( + IN CONST CHAR16* EfiAppName, + OUT EFI_DEVICE_PATH **DevicePath + ); + +/** + Locate an EFI application in a the Firmware Volumes by its GUID + + @param EfiAppGuid Guid of the EFI Application into the Firmware Volume + @param DevicePath EFI Device Path of the EFI application + + @return EFI_SUCCESS The function completed successfully. + @return EFI_NOT_FOUND The protocol could not be located. + @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol. + +**/ +EFI_STATUS +LocateEfiApplicationInFvByGuid ( + IN CONST EFI_GUID *EfiAppGuid, + OUT EFI_DEVICE_PATH **DevicePath + ); + +#endif diff --git a/Platform/ARM/Library/BdsLib/BdsInternal.h b/Platform/ARM/Library/BdsLib/BdsInternal.h index f70aae603d69..bb4566e3a6c4 100644 --- a/Platform/ARM/Library/BdsLib/BdsInternal.h +++ b/Platform/ARM/Library/BdsLib/BdsInternal.h @@ -16,7 +16,6 @@ #define __BDS_INTERNAL_H__ #include -#include #include #include #include diff --git a/Platform/ARM/Library/BdsLib/BdsLib.inf b/Platform/ARM/Library/BdsLib/BdsLib.inf index 96c1d6e7e200..637ef5a08128 100644 --- a/Platform/ARM/Library/BdsLib/BdsLib.inf +++ b/Platform/ARM/Library/BdsLib/BdsLib.inf @@ -27,10 +27,10 @@ BdsLoadOption.c [Packages] - ArmPkg/ArmPkg.dec EmbeddedPkg/EmbeddedPkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + Platform/ARM/ARM.dec [LibraryClasses] ArmLib From patchwork Thu Nov 22 17:26:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151804 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1018599ljp; Thu, 22 Nov 2018 09:26:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/UtlVhr9OjzEKrLWPczt/AWAtIOSZYQBJDS28Jtvkbxk0iNL3sgnWSYCbrD+yfhr6zuCdRN X-Received: by 2002:a63:7c13:: with SMTP id x19mr10699277pgc.45.1542907615541; Thu, 22 Nov 2018 09:26:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542907615; cv=none; d=google.com; s=arc-20160816; b=HRL5NWMc0s08vEvtw4UoLSG4gVj4QBxhVwNSSvzumuK3ZeTh4B5NcoNGxikdnKYCdD k5PUauQFxd4lLPnLdfK8VIqVZDBCSkQI24NUD+LHQjcjGlRyxNkLvn0YmYmf4lI2PC0/ rRpVEMV9pbUr4Rch2PBEo5cno8D6sdk2igyR9oq000u63TBIejuONN971XC+1ICiUrIW G8SiQ/JHW0tn+r6Y5XHq046k0xddC5rnvUJuBg3ckud2zs3IMQOPZ7d6RnfT2U6dMYhJ 5nO7ghWw1saR73RfxJvcZ9uSjFpm7Dtzz7MtrOkQPmUoNSAmfQbTxx8IQZIAMCYi2yOU 9PYg== 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; bh=cvk0XXAHy2jfZBdSDPjoWwYlgCH0F4Sw3x735JFP0E8=; b=qbOoKUTW3pu+ofVJp+TXnketFjrxTVx//IyjF4/TLvBJlcpUl2n4Q0EBaXa4t+Cj6F OP/cfLRDcJnqFQnNyspE5a2ngAqRoD89Q1RCsNQcx1Z5dPwdIfxMxfgMFzBF8BMLzfCd lI4VoJwO3hxzFuWAYFLwFp4G0/8v4xlJVTL9HApFl7AW0lATtAIfpTSI4N/HyKb6XhHk +zm/s/B/GpddsnkMZ2myMQlinQsBGlM8/vLcsXf5Jix1Ns4zMh+zmjWvAOoWQT7Xozhs 2IXzDg20bKaR+lkuTDg31Ze6YiorAVLxjqI01MOQK7x8sQYfcssTQ5N4Jo+Aswl/eMRQ lhYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=S0s1htIG; 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 5-v6si53141734plt.408.2018.11.22.09.26.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:26:55 -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=S0s1htIG; 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 2A2142119486B; Thu, 22 Nov 2018 09:26:55 -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:4864:20::443; helo=mail-wr1-x443.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) (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 9671C2118FF2F for ; Thu, 22 Nov 2018 09:26:53 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id r10so9964694wrs.10 for ; Thu, 22 Nov 2018 09:26:53 -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=bs3vUL2s1hbVyXHURlM67Rz5kmloSZ5MLFegXx90uWg=; b=S0s1htIGyVi3rkX7aGFC7HlEVya1kEmH1lzff90oPtCQvm4hI/ySilHiG5m52xWVcB UYeNFokeeLI4eRZXkBM0ofAp5mGQQSJ7GWciFibDf94bDl/eThyBq4zbSBqr37NSeXJ8 1mwLwRymfTZ1Io55O6vaku9raacMjO4NGbiPU= 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=bs3vUL2s1hbVyXHURlM67Rz5kmloSZ5MLFegXx90uWg=; b=IK0SX6t63J/hnM/uXGg1Ot2JlG0EeeJtf9Z8wjQzNuBHKb7BXHnz6uBteMlkXL2ypy rC190Nz2rsnAY5C6pDmiKtVHm+wRo69lJ6yDEYMnLIAo9C6Lk5YWX7gRFqtba81DxqP7 eAX5qO06FFRhBr3SVMCbZi33EmBQ/68iB/W/L8vhcaMv10DV2rVMzbM0Q20qrFpj0GYi dF1mZxFz6dY9cyFvwP94UhMfcZZcMDDorB6ZS2RNxouHtmpo0PNjNDxbBhvv23D1JZ5D QnehChaEg4dBuo+sP1aOCp7LmzuEj1X2yQpYEcuwhH5nthPcrXsxOkqD+7hRH4YYaBOo O/pw== X-Gm-Message-State: AA+aEWZ6z6UZc5wUbdNFDF1aehaAXsCdT2glzBiDACEdfhYkN0IKxmhV YnZZzmnWR6dJmL6oZJXhxhyKBuViolv6Cw== X-Received: by 2002:adf:9123:: with SMTP id j32-v6mr10175269wrj.0.1542907611561; Thu, 22 Nov 2018 09:26:51 -0800 (PST) Received: from mba13.wifi.ns.nl ([2a01:cb1d:112:6f00:6422:2edf:11bf:f2b]) by smtp.gmail.com with ESMTPSA id v1sm8874985wrw.90.2018.11.22.09.26.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:26:50 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 22 Nov 2018 18:26:43 +0100 Message-Id: <20181122172645.20819-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181122172645.20819-1-ard.biesheuvel@linaro.org> References: <20181122172645.20819-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 2/4] Platform/ARM/BdsLid: drop unused BdsStartEfiApplication () X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" To prevent having to fix it, let's drop BdsStartEfiApplication entirely since it is never used. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/ARM/Include/Library/BdsLib.h | 19 ------- Platform/ARM/Library/BdsLib/BdsFilePath.c | 58 -------------------- 2 files changed, 77 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/Platform/ARM/Include/Library/BdsLib.h b/Platform/ARM/Include/Library/BdsLib.h index 4528c2e8739b..23f777d4097d 100644 --- a/Platform/ARM/Include/Library/BdsLib.h +++ b/Platform/ARM/Include/Library/BdsLib.h @@ -140,25 +140,6 @@ BootOptionAllocateBootIndex ( VOID ); -/** - Start an EFI Application from a Device Path - - @param ParentImageHandle Handle of the calling image - @param DevicePath Location of the EFI Application - - @retval EFI_SUCCESS All drivers have been connected - @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found - @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results. - -**/ -EFI_STATUS -BdsStartEfiApplication ( - IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN UINTN LoadOptionsSize, - IN VOID* LoadOptions - ); - EFI_STATUS BdsLoadImage ( IN EFI_DEVICE_PATH *DevicePath, diff --git a/Platform/ARM/Library/BdsLib/BdsFilePath.c b/Platform/ARM/Library/BdsLib/BdsFilePath.c index 7a4a5052a786..67dafa4f3651 100644 --- a/Platform/ARM/Library/BdsLib/BdsFilePath.c +++ b/Platform/ARM/Library/BdsLib/BdsFilePath.c @@ -1353,61 +1353,3 @@ BdsLoadImage ( { return BdsLoadImageAndUpdateDevicePath (&DevicePath, Type, Image, FileSize); } - -/** - Start an EFI Application from a Device Path - - @param ParentImageHandle Handle of the calling image - @param DevicePath Location of the EFI Application - - @retval EFI_SUCCESS All drivers have been connected - @retval EFI_NOT_FOUND The Linux kernel Device Path has not been found - @retval EFI_OUT_OF_RESOURCES There is not enough resource memory to store the matching results. - -**/ -EFI_STATUS -BdsStartEfiApplication ( - IN EFI_HANDLE ParentImageHandle, - IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, - IN UINTN LoadOptionsSize, - IN VOID* LoadOptions - ) -{ - EFI_STATUS Status; - EFI_HANDLE ImageHandle; - EFI_PHYSICAL_ADDRESS BinaryBuffer; - UINTN BinarySize; - EFI_LOADED_IMAGE_PROTOCOL* LoadedImage; - - // Find the nearest supported file loader - Status = BdsLoadImageAndUpdateDevicePath (&DevicePath, AllocateAnyPages, &BinaryBuffer, &BinarySize); - if (EFI_ERROR (Status)) { - return Status; - } - - // Load the image from the Buffer with Boot Services function - Status = gBS->LoadImage (TRUE, ParentImageHandle, DevicePath, (VOID*)(UINTN)BinaryBuffer, BinarySize, &ImageHandle); - if (EFI_ERROR (Status)) { - return Status; - } - - // Passed LoadOptions to the EFI Application - if (LoadOptionsSize != 0) { - Status = gBS->HandleProtocol (ImageHandle, &gEfiLoadedImageProtocolGuid, (VOID **) &LoadedImage); - if (EFI_ERROR (Status)) { - return Status; - } - - LoadedImage->LoadOptionsSize = LoadOptionsSize; - LoadedImage->LoadOptions = LoadOptions; - } - - // Before calling the image, enable the Watchdog Timer for the 5 Minute period - gBS->SetWatchdogTimer (5 * 60, 0x0000, 0x00, NULL); - // Start the image - Status = gBS->StartImage (ImageHandle, NULL, NULL); - // Clear the Watchdog Timer after the image returns - gBS->SetWatchdogTimer (0x0000, 0x0000, 0x0000, NULL); - - return Status; -} From patchwork Thu Nov 22 17:26:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151807 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1018643ljp; Thu, 22 Nov 2018 09:26:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/WaSqhtLD92DvT1P1DV06zyJ0+bcW0LfbbQn/Ji9uDXqg2OJFEaW2CL2z2TI+pDg0h1ulsL X-Received: by 2002:a17:902:6907:: with SMTP id j7mr11696684plk.221.1542907617836; Thu, 22 Nov 2018 09:26:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542907617; cv=none; d=google.com; s=arc-20160816; b=1GC9t8NDFma2X/jHVpJe2q6MqE5/JLZFw7Cre9ZwG8336gluMwhfxDHYwWaj23KuDb xzNinSpD/RVHzg7yS8PzuuMc0S8mMswy/wH4ZUYoh9KL02a22vt+VVMytZbXd5eNVNYD k4UW85hobj1X7TtGB1NGMzzT3G3wGpIC03SxnkKibvPqnQeY3n9aNrY4K7M2Nilshipx Gepr6nznoKpUenstkpZ0dMpAtBarUcjGLxN/oC5T2mSkNxf3A1PgGWtaC181TiWKzUoj XEhbk4AAGI9QB+PxLXkkJM/OObkVfGc6NzEI39vJ0CCECm035CRgPE2ja7+aUJOzmeZT 4XJg== 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; bh=BPdc6Zdle8Lbd1Cce2h7EaP+FS4AVmKgvYDvk7iwnt8=; b=yQyiuGaOC8kBNdCuYuiVaRPiXuA2619CmpeRrJrYNR9V2jwHg2hpTkDej5EXazmZpr tnwGN2QybGRzZ63gfPPuqecbVaz4734BhXMtD/uce9TkpIRKk68MollCH+0VvZO9wQ8Q f1tGEFRyl5fOQrRPvnVSndWfm00VvcehCFQ0mq3vKi3i4lOqSzpuMW+3mqcMU9UoDolP AUBLXvVjR77bawAIw5Tn9aYoIElCHa8eoMj8rh5BcxVp8x3CHBMy2+mwywFFgEIPqWAS RMilyabUfa2VA814X4aZP+ZmzuqaHfME+vN26E1kB8y12HaC2mP80C+pCqXBvVuBH6qR GRRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c0NBw9lx; 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 a3-v6si50629594plp.323.2018.11.22.09.26.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:26:57 -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=c0NBw9lx; 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 568BA2119486F; Thu, 22 Nov 2018 09:26: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:4864:20::442; helo=mail-wr1-x442.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) (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 A6DF12118FF2F for ; Thu, 22 Nov 2018 09:26:54 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id v13so6512178wrw.5 for ; Thu, 22 Nov 2018 09:26:54 -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=x/OeQm0qk5VJTtBuZHjMBRF5O0T49HOmBrvWMsS/reA=; b=c0NBw9lxBzeze0LtmBYZpLPfzEZQgOCrzJMyHiSazwl+L4ErWgLVOUxdBktag/wvgY Y7/mQwy6XFjHV9kNjiMdcK2nxHjPSWFeDUvkSm5KvqmaFgyAsu5y7i6j8YA8eFPGsTlM ePSo915y//nW+KWgRXEQ3TfPcjAsj4xiKHSoE= 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=x/OeQm0qk5VJTtBuZHjMBRF5O0T49HOmBrvWMsS/reA=; b=kjVkwxWE/97pKR3r5Qn/bfY5hVtVA5eE6xw0FDDwBFjg2db7ik5rFyn9bciTvLFu8i sWTQacyqHtrEXke1qSQiF9RPuPu/8pq5bLUWyOHoAGVYWvr4yB/cB91zkYVJR/h8DRe6 RVwmjyhUCex256bSuuq47TInXKRdPm3fXpwloNgp7uDR65Gf4ukafBMj/Sgup60ve2Kq eeR9ldrg6X+QFy5VugA/TINS9x0PqV8I4gio1PzLJzBFxwLd9l9kZxs/7Jc0GKLd8YeG YVYmqAMX5YF6j84X6ncJtb8KgwjJr5H9dj03ErioYbWY4yKEdk8LLqyQVhDz/Mgq5XOR drJQ== X-Gm-Message-State: AA+aEWaefvVTQy7CLpYMhofDYIqX3IFui/sKwNIfpcgB6XVMPBHDDTS9 BgBHnKqmNdok1tHQ56VL6jUa3dv0TVPmcA== X-Received: by 2002:adf:9f10:: with SMTP id l16mr10820258wrf.206.1542907612909; Thu, 22 Nov 2018 09:26:52 -0800 (PST) Received: from mba13.wifi.ns.nl ([2a01:cb1d:112:6f00:6422:2edf:11bf:f2b]) by smtp.gmail.com with ESMTPSA id v1sm8874985wrw.90.2018.11.22.09.26.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:26:52 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 22 Nov 2018 18:26:44 +0100 Message-Id: <20181122172645.20819-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181122172645.20819-1-ard.biesheuvel@linaro.org> References: <20181122172645.20819-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 3/4] Platform/ARM/BdsLib: don't clobber BdsLoadImage() DevicePath IN param X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" BdsLoadImage () is part of the BdsLib library API and is not documented as modifying its DevicePath argument, but does so nonetheless. So take a copy instead, and free it after use. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/ARM/Library/BdsLib/BdsFilePath.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/ARM/Library/BdsLib/BdsFilePath.c b/Platform/ARM/Library/BdsLib/BdsFilePath.c index 67dafa4f3651..74fdbbee773d 100644 --- a/Platform/ARM/Library/BdsLib/BdsFilePath.c +++ b/Platform/ARM/Library/BdsLib/BdsFilePath.c @@ -1351,5 +1351,16 @@ BdsLoadImage ( OUT UINTN *FileSize ) { - return BdsLoadImageAndUpdateDevicePath (&DevicePath, Type, Image, FileSize); + EFI_DEVICE_PATH *Path; + EFI_STATUS Status; + + Path = DuplicateDevicePath (DevicePath); + if (Path == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + Status = BdsLoadImageAndUpdateDevicePath (&Path, Type, Image, FileSize); + FreePool (Path); + + return Status; } From patchwork Thu Nov 22 17:26:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151810 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1018675ljp; Thu, 22 Nov 2018 09:27:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/XDT2y89lNBG+DaP5C8g8GRmMZ6OBDEwjlfHlE3zOrNopeXMDig9NRP2y74i6yusofAbdB/ X-Received: by 2002:a17:902:930b:: with SMTP id bc11mr12396409plb.17.1542907620332; Thu, 22 Nov 2018 09:27:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542907620; cv=none; d=google.com; s=arc-20160816; b=OF+62kqxnhTCoLmzGdiZ8EEH/DvBccNHsosI0T96hFKRTpoy4zxZw4iSoPHYKhLDki /jcLlTbUXPSXMJ/++VsLwMfarHWvRKr+t93Z9Cf36mveNM3rvGLdcDW93CPspdKaL1zw fcHs9CXflrj+lk3atKMk0Sy2K1/fTvxu1Z7owtJmU4gU651wTAV4qDV6PJQs+itT4bKZ e8Oo4dB1o61Yg6t4FyIakkXAT0wCbREorXXBrlQB9yusLemo/bhWRFROdUP710pkmolo RGlbE9OW1oaVyHq+M58Po3cKETiPKx1ODlwK/3mcCRcEodl/oAHF+KMGukluGWuhggnD qF4A== 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; bh=1Nm9NwxZZuPNE3Mok5VRuu15KNnfeQgtjosqQm5mPpY=; b=yc8tG0AVNtQNHghPR7fAPhFtvs1h6wgbw4GMPLPCLaNtbI4zrmTbzGuaf9uGIhbW/h UUc3ZOEgY5JJQontpdDORr3HVuwfUlbJOc/CStyhxREo3/1TsuHhSGgNCk8waXPCkQWw X6CdQlDWWj1ohu76ux6ebDNLWg7s/3rYOOUmDZTRzCS1CAeqK4xnRA/zJbjj/X1RTHzr hR8bHflt0V2TYNDMuAJtgXIMqceOi+MtoQ4hQ/0VaHJoV9M5pvF1Z/xMLurO0+8j1GCd AZfga+b88gRfpHyub2mT2BNBanfOtec++E+KNsxAuLyrwvYtRBrqxTRcekFC1VDcouNM gj6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fnO5Tl67; 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 2si50916130pgz.395.2018.11.22.09.27.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:27:00 -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=fnO5Tl67; 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 8A5F42194D3AE; Thu, 22 Nov 2018 09:26: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:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 E205221194866 for ; Thu, 22 Nov 2018 09:26:55 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id s11so9877146wmh.1 for ; Thu, 22 Nov 2018 09:26:55 -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=kkoOGjShLB/eVAtaF07dmtGTtZx7IE48RHEToeHH248=; b=fnO5Tl67PWmvBCOO6l59d9dKhthixoSBrqTcsmjyyttCo+Qyvik7B/WKMMLbSNLeAI IDELPVRlLlCbe2MdjJcz4NFc+hy/rhckUTS8dlaqoAsYaYJEwO9VGoaRWwYXPatSsPBu 3M+wOV5whZQYZJEVyDwwt3gpku+zekg97RS1Q= 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=kkoOGjShLB/eVAtaF07dmtGTtZx7IE48RHEToeHH248=; b=ff98a4D9i3dNJvktj3XrairIDfbK7LCL+9Xmi7Lav/hHj0tVelOPVjWHCOj3KIv2zD Pkk9zeT9Xn7lz2WLpeJCPLL5VVFmSMoyxvOwKBI+d4alVF8IxOXnvKhRy4D+Pvvf7THL R+X5fs3lRA3c6ig9EY87mwMSf+FikXG/pc+eYGfZ9O091/6asG1pHUgijovxB+jQTfr3 YVXwx65nU27rsHOnxV/RckLlwLGsZg5ttxusIJwM0L08v0Fvuk7G6bEUQ997/Ym+0Sws IS4X5p4r9dBKSg7XmiNdV0ZO8GBm3yhaLGzNESZgeBKSyyIOqtzk51ruQn5kmhAtMfDq MFww== X-Gm-Message-State: AGRZ1gI5qtsdOmRrGlEhZW8JJYHxELhXhvtbkSjPdOwgKlVyS6c12E2a lMmtIQJG2cznzx7DOAuQjmwKB1TV3zIi8g== X-Received: by 2002:a1c:248b:: with SMTP id k133-v6mr10157397wmk.148.1542907614110; Thu, 22 Nov 2018 09:26:54 -0800 (PST) Received: from mba13.wifi.ns.nl ([2a01:cb1d:112:6f00:6422:2edf:11bf:f2b]) by smtp.gmail.com with ESMTPSA id v1sm8874985wrw.90.2018.11.22.09.26.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Nov 2018 09:26:53 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 22 Nov 2018 18:26:45 +0100 Message-Id: <20181122172645.20819-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181122172645.20819-1-ard.biesheuvel@linaro.org> References: <20181122172645.20819-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms 4/4] Platform/ARM/BdsLib: maintain alignment for DevicePaths X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, nariman.poushin@linaro.org MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" DevicePath node types may have any size, and so it is up to the code that manipulates them to ensure that dereferencing them only occurs when the pointer is aligned explicitly. Since BdsConnectAndUpdateDevicePath() has only two callers, one of which itself, we can simply duplicate the device path (similar to how DxeCore's CoreConnectController () does it), and free the pool allocation again on the way out. (Note that the allocation only occurs when the non-recursive path is taken) Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Platform/ARM/Library/BdsLib/BdsFilePath.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/ARM/Library/BdsLib/BdsFilePath.c b/Platform/ARM/Library/BdsLib/BdsFilePath.c index 74fdbbee773d..543ac8f83086 100644 --- a/Platform/ARM/Library/BdsLib/BdsFilePath.c +++ b/Platform/ARM/Library/BdsLib/BdsFilePath.c @@ -421,7 +421,7 @@ BdsConnectAndUpdateDevicePath ( } if (RemainingDevicePath) { - *RemainingDevicePath = Remaining; + *RemainingDevicePath = DuplicateDevicePath (Remaining); } return Status; @@ -1333,14 +1333,18 @@ BdsLoadImageAndUpdateDevicePath ( } FileLoader = FileLoaders; + Status = EFI_UNSUPPORTED; while (FileLoader->Support != NULL) { if (FileLoader->Support (*DevicePath, Handle, RemainingDevicePath)) { - return FileLoader->LoadImage (DevicePath, Handle, RemainingDevicePath, Type, Image, FileSize); + Status = FileLoader->LoadImage (DevicePath, Handle, RemainingDevicePath, + Type, Image, FileSize); + break; } FileLoader++; } - return EFI_UNSUPPORTED; + FreePool (RemainingDevicePath); + return Status; } EFI_STATUS