From patchwork Fri Jan 19 19:43:22 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: 125218 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp443451ljf; Fri, 19 Jan 2018 11:45:44 -0800 (PST) X-Google-Smtp-Source: AH8x224DRh4kq6/aiIA43I8GJ1hr7Cl6zY2QZ+mjLVbLt+0hYcj5MHHZp/Ba1VvKxuUsASuwZFH2 X-Received: by 10.80.155.90 with SMTP id a26mr50338edj.290.1516391144148; Fri, 19 Jan 2018 11:45:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516391144; cv=none; d=google.com; s=arc-20160816; b=ccc/4DubKAX9It+DADr525rzE7bTo3NiYn1bplDiZclZKYEf9XBpD/k8NN2snWc1Sc h4F2c8Ccdqu78FtcJ9wJF66qxP4hoNAze6DQ0d4I19i2mql4JewmiOCY/BLsu2D3W+YM PYTFSAxlBXLLmByOsfsmCKvIAeffDhQx4TBWWG5E1xE41uM8is27f608zQWgFM7nfc6b 6p0bFFZcZ8vRW4vLzZR96Nc8b7WQVZfCwT43xwS3Xyx/7GrTS5MUUENjgTJsFLlxamLg YBuGjBVTMbjlEmgBxsdsEIlcLa017jszKq7l+cJDLG23v25EwxBEZh9SDj1nwnMgKYPF Hy+w== 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=s5oEqaJSeqIp5+tReydEj8zJwd0fv2if+8R0dtN16VULJdNtPJGmFzZGwPx9QM4sJQ F0hZQDcwzWu++Vz22u5SN2rh5EcOIQPMcD/5JqKy6IgjLoXvI4eS3tCH8Sxe9i8DJoZn hGD3BkFnfsUmha/yTmzXLnlHdM8eK/wFxfjY+WziIOscXttH2FThNgZtyze9sRMR/8xm GbF8iA8LIknS17BmLKav5T+z7cMR3SaL+rfY5+/+Nu7u4GNT9PW+Qc8oq76dySfIEHJk 62VgCoeatjyhRA7SWA6gg9Nq76kEkzrhgERwC/Ez7itGzPVQB06xJlAkmA0r1QI2610D yEbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=CNx0qurg; 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 p90si1520501edp.421.2018.01.19.11.45.43; Fri, 19 Jan 2018 11:45:44 -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=CNx0qurg; 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 A4822C21F5F; Fri, 19 Jan 2018 19:44:37 +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 15F31C21F3D; Fri, 19 Jan 2018 19:43:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BEE06C21F7E; Fri, 19 Jan 2018 19:43:40 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 74757C21F59 for ; Fri, 19 Jan 2018 19:43:36 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id r78so5727595wme.0 for ; Fri, 19 Jan 2018 11:43:36 -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=CNx0qurgz7+ex5FrqQtDA/JU6lmkwE8ldKox5xSCeK5NcG48/q5UoVPi7t3hHdUgu9 htDpmjm5TMaLh/kKjNJ/8ADDZsGUBSjddL4v6Se5Np1wwNeSAaqrw3+Pvlt69gDeFOIw FiEgaie7w9yktXUlinazN7Zrxrg/cjDCu4kgs= 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=id5tYfc0FE8yOJXcDhqeQLzkrmzKNToweCkeiH5GXChEQMRJQLcmSy3VfmjfrEF5DA 5gWzWLBfmCpkt3lcCqSf6ugC8uKvn+XP/2uFVPkXxC7khvVxdy3TmjITfD+KbB+ABHbZ nXQOCcQZKbkf4bNYrJnSMtDhD2Wc1DG3FqL6qPLdnHmxaBtxWbEqeTTLz6nl+0dQeliv QwHK2HBJdn+kLVhgiHBg38cXyfHgY+UMW5Japn+bKb6ev0VQUhTW5xwsNm9gymdm8Mp6 hpDSZWsNjHe9/cspDrcPJR7Aw33SCHZF/AG0p7WRERo6EavLNVuA64KVAXT8g79QCn0W Ajdg== X-Gm-Message-State: AKwxytfM4DakTixqTUjKcLQ3oYQmJZSegipYQu8pxQcrALon3RSHViMy ibiRxbrP9k59HYmlw5ynbZFTzvRId6o= X-Received: by 10.80.230.142 with SMTP id z14mr57854edm.174.1516391015779; Fri, 19 Jan 2018 11:43:35 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id p6sm5936051edh.68.2018.01.19.11.43.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Jan 2018 11:43:35 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 19 Jan 2018 19:43:22 +0000 Message-Id: <1516391006-22483-6-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516391006-22483-1-git-send-email-bryan.odonoghue@linaro.org> References: <1516391006-22483-1-git-send-email-bryan.odonoghue@linaro.org> Cc: harinarayan@ti.com Subject: [U-Boot] [PATCH v2 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);