From patchwork Tue Jan 23 20:41:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 125592 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1995873ljf; Tue, 23 Jan 2018 12:48:17 -0800 (PST) X-Google-Smtp-Source: AH8x224Sc69/hSSc2Zehvt1xtiJ+rlhFl94FeOGGQwhE4duOgVRPDv7jkig9cuT+juOA/qn+vw7k X-Received: by 10.80.172.47 with SMTP id v44mr20324888edc.130.1516740497477; Tue, 23 Jan 2018 12:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516740497; cv=none; d=google.com; s=arc-20160816; b=U5BKs1wOYadw0tjDLsD2rbzuTBd75SOvS4AABNBSuzl7y8FbbX9+kxDrH9H5EQOq7O UHVEZOOX4T/Qp8i9E8RWJdNiCJKtJwaB77xCsvAybTLayAgoCOYMPf6YRJ1XkyUOmNRs QMmTb6HfJOPTENkwAQwmwyGsIJSVaLmCe4Do5nd4zZTrRo0xFDhpHorene/PoKL02i6c apez91EvKyEt/zpXc/CuolCIh9i9/h0yLFo96Qy61z1FUP7u1qqafL0NTWQ+nl8BeVAN zUYhVGGGANpEBe6U03d2kWHcQ3kmGK9XKnGAPUsuwfe53Kt6LMLSJ6lJCnuR42MfOsxS Lftg== 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 :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=QaYroxNd3askNKowPokMN25W/t4qBXmwlbEd13MrC2M=; b=CaPtjUmiXbiBu5Nq7yrS125vbfSU8Xx99MiLCmz3ushoPfEzW/GiAEyGcjnMGKkuOQ 2QfvOdJBEbUX9EuZzSTEdZmJrV9oG6RDR8S4ulYskweDDzYZL+0rF3WlaVPdrtVn7G36 iGUCFObOWtKwjD5wfOeah0Kw7lLG3CVRfR6AGN/MVm1bt2KTyY+osEF0sw16lGn3qI7V Ispjccpwg+8+5mnXJCT2kwI7WPnf+zAr2V4jG1mwXJOGidzEKcg4s+yinCS64rGXb3qo d/pXb66WGM+QgFZcSMqyLc5sS4qrRGv6xYV+26qYsvaA6iMqbaWuElCyqb4o5mZtHcCm NhDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eS61+qIH; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id b39si4111431edd.373.2018.01.23.12.48.17; Tue, 23 Jan 2018 12:48:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=eS61+qIH; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 04895C2214C; Tue, 23 Jan 2018 20:48:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 2F4F8C22174; Tue, 23 Jan 2018 20:42:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2B717C22174; Tue, 23 Jan 2018 20:42:11 +0000 (UTC) Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by lists.denx.de (Postfix) with ESMTPS id 079DCC21E8B for ; Tue, 23 Jan 2018 20:42:08 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id j21so15083615wmh.1 for ; Tue, 23 Jan 2018 12:42:08 -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=jd7TJ8ToMThI42VzCdFxxuucXAuvkiPJC/i5sG6S6nU=; b=eS61+qIHPhZBSVeolTgs6DJCE2CE323G9NaJXWzCJj2BklJ0jAjzryQ7iAHMLNJkif kildMst/uq6u6Q0UHpev63R55VTUgkCabcr5cGynP1HLFrTunrS/h6b2ZTo2HSTDTMuS I6p6QQ+NMxEFIbLzI+HQhIXTLKMzaNR0JiXcs= 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=jd7TJ8ToMThI42VzCdFxxuucXAuvkiPJC/i5sG6S6nU=; b=DZzFP3gPaqXyV51tuLXjtPS1gScEoBgz7+SZ/YILjCF7U0C3OnVJKt7raGh6/In6yL wUpVOv/xHpYTTo40c6YawSZf+aelfh+0hlxz2c3VxTx3SwanSL4oHFBEuWyog/oSoC9k Msi32vD21K6iRVeW7pZI/W/JPVC7owN2GdicPGjD1rVaX14urIwBqbxUh6/2KVi7Z8PX de7jsaOFSOhQCD+tSMOm4OpjUCqJOiY1CwtGMR1d/ecA+uD/LH33uiSk9NELS7O6XCxa Xh9RQFrxujdurd/qAdvZIL1OFtpnyObSnFhsTcvseAucmMH4dNDv5CXLbp1iEuvxcetg XePQ== X-Gm-Message-State: AKwxytem98LaVm3oCPaVzf0rpMQT25vPNAJehjfioIs1kQAWDDd2GSD4 yR2z3YLgTw+VU109tKvtgLBp7PBGNqc= X-Received: by 10.80.147.72 with SMTP id n8mr20968726eda.189.1516740127536; Tue, 23 Jan 2018 12:42:07 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id k12sm12400896edl.86.2018.01.23.12.42.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 12:42:06 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Tue, 23 Jan 2018 20:41:56 +0000 Message-Id: <1516740120-948-6-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516740120-948-1-git-send-email-bryan.odonoghue@linaro.org> References: <1516740120-948-1-git-send-email-bryan.odonoghue@linaro.org> Cc: harinarayan@ti.com Subject: [U-Boot] [PATCH v3 5/9] optee: Add optee_image_get_load_addr() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch adds optee_image_get_load_addr() a helper function used to calculate the load-address of an OPTEE image based on the lower entry-point address given in the OPTEE header. Signed-off-by: Bryan O'Donoghue Cc: Harinarayan Bhatta Cc: Andrew F. Davis Cc: Tom Rini Cc: Kever Yang Cc: Philipp Tomsich Cc: Peng Fan Tested-by: Peng Fan --- include/tee/optee.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/tee/optee.h b/include/tee/optee.h index eb328d3..e782cb0 100644 --- a/include/tee/optee.h +++ b/include/tee/optee.h @@ -36,6 +36,11 @@ static inline uint32_t optee_image_get_entry_point(const image_header_t *hdr) return optee_hdr->init_load_addr_lo; } +static inline uint32_t optee_image_get_load_addr(const image_header_t *hdr) +{ + return optee_image_get_entry_point(hdr) - sizeof(struct optee_header); +} + #if defined(CONFIG_OPTEE) int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start, unsigned long tzdram_len, unsigned long image_len);