From patchwork Mon Feb 26 12:35:59 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: 129641 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp158950lja; Mon, 26 Feb 2018 04:44:16 -0800 (PST) X-Google-Smtp-Source: AH8x225h5HBX2rAB9DSb0sOuPVMCazISBvElj9hMpL/35bTomSGrpn9TgetD8pbBAM87iczIzZk+ X-Received: by 10.80.189.131 with SMTP id y3mr14568604edh.122.1519649056182; Mon, 26 Feb 2018 04:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519649056; cv=none; d=google.com; s=arc-20160816; b=0HMWXT5tqsO7qs8WmIOUlajxubamGKm2nzoz9/1pSQr9lU3yor5lMIt5OqoOxAOG9B 7KUOT4BahnNWclfzzeTc6lEggk5INVzEzkLEjFtU1wtBxZwQfnAwaGdDSGRePZUVDr2H oWuy0TfyV7ZzCD+LGSJappoOGZ0fGyPjlJeCHGGhcZQ/bdIqp1T1E7Hg2fX38bs0gFWO 9wy9iA7fTVkJeWEXQL2Vc6hECDi7L5k9Rn0hQ2HmgsoJ+P0XurHvgBfqt0xF9PiQDreK H0p3TUchoy8r4XC9CILa9Asl4gVggTYY24nzYZxAeEZ+Glp353k1FEKRNs6/bCUWbTjF dRBA== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:arc-authentication-results; bh=QaYroxNd3askNKowPokMN25W/t4qBXmwlbEd13MrC2M=; b=tXPJgw9Ghs6TrImS2stUPn4Mwe1mLUiWZwziAO8kToW7ZMyPOnsrkVwkez4QyT6oRE PvNM48xPi4Tw1GXgu2QNyZq1fBqKd9iDdkgW19apTPnbTuh9Y3M3lfzy/DlRDnaTp8aK Acra2WwlFd6dCoifW740vZkuO/zhfCqwU9r6zr4MVUAk/5A8JO08G3vfmgzKfXalDvqg P2siEjka4yEN4Kfa7CFLBOzvi3SGoiokzHmbAiDUUdKpGbDm+UKpRggwuWxg8H8FuGqU pSknQf8ErnpLki9OxvzTXm2FL2u9ippUdRe2iovT1qhiZ35k705FLji3Intpiy8Cwn5W ScEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=G/nKu8yi; 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 59si177722edy.483.2018.02.26.04.44.15; Mon, 26 Feb 2018 04:44:16 -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=G/nKu8yi; 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 A85AFC2211B; Mon, 26 Feb 2018 12:38:56 +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 DE27EC220EB; Mon, 26 Feb 2018 12:36:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 78A8DC220CA; Mon, 26 Feb 2018 12:36:19 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id C8B5EC220D9 for ; Mon, 26 Feb 2018 12:36:14 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id q83so17192154wme.5 for ; Mon, 26 Feb 2018 04:36:14 -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=G/nKu8yi1sQoGT1oSx7EzwjpW++O0Zeh5Q1l60QBceIQ/R5RXv63ZQFgr5VBAFtyf0 Tnea1yNMislIbNbcSm9XyJqRvD1/Jla9w/Alba8FBoUGCV30orPc58MzcCRazbJexPno IYve0Pf8c1vbq5cHJrpcSq/asWoDhaUVfcF6A= 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=T/pmSj0JJaxBsp0p8obSRuWJ+4Zmf6TiO7v0stPlDMb6J4teuRM+rO+aP3g3r3a6eh pL+lkZA6ELqp8QO8+rnSfRpb+qU4z9x+Hn5ziGH/hR1OkEjBvS5ylJ0pQ5LoBuC6UyFP OlbOKEIwBftLCnJbkdJNtljYzDBSWO5MXWEeII9Duc6FSRP4Vjh2cnUwBofr/NQDn0CJ m5SpS+JsQA9RxMAtJQQp4X4GQfOPhj+1sam+uwtc0w40qASbkuqWF6zn5oNahNu1Z3wu bqKxOIEv9p0xHBMJY1bIfQajmeZVXOHP2RZ/w2VMdztU8eiJr9nJZ6Ee2x+sfYDMuke9 /d+A== X-Gm-Message-State: APf1xPBw6a0VfS9AV5uPfRVjYnsCzwPXp5mSNHRgsUziV3rmqbjGqRVS HXWV1ckMRVbvJOeWkU1NnawwaNAjyTY= X-Received: by 10.80.195.137 with SMTP id h9mr6150444edf.232.1519648574256; Mon, 26 Feb 2018 04:36:14 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f6sm2493967edn.45.2018.02.26.04.36.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 04:36:13 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com, harinarayan@ti.com, afd@ti.com, kever.yang@rock-chips.com, philipp.tomsich@theobroma-systems.com, peng.fan@nxp.com Date: Mon, 26 Feb 2018 12:35:59 +0000 Message-Id: <1519648566-12061-6-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519648566-12061-1-git-send-email-bryan.odonoghue@linaro.org> References: <1519648566-12061-1-git-send-email-bryan.odonoghue@linaro.org> Subject: [U-Boot] [PATCH v4 05/12] 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);