From patchwork Fri Jan 12 14:52:19 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: 124358 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2158233qgn; Fri, 12 Jan 2018 07:00:42 -0800 (PST) X-Google-Smtp-Source: ACJfBou172xWSTtUQE7imHH6h/waDefs+JYwenaZVsea4eLTwC0Liv7YmEWDC1Cg4x9fbTgwQFG3 X-Received: by 10.80.181.15 with SMTP id y15mr12162271edd.29.1515769242670; Fri, 12 Jan 2018 07:00:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515769242; cv=none; d=google.com; s=arc-20160816; b=LE8Jjs/rhbX/LFZiVAicTf8seLIr76HUyoTHLZqpbA06hwyVuKpcNUw4t2O871OZ2f wn2Gk0DPubDit3XOGjmrX+xWuQP2xmQACgfGO08iQ2JE1s6pMn/osvAIEoCKcFdCHRZU 1YNbyDxsQvcWyhrP2JJvuoxWz+LwGhtR4pgSD7rOvPE7EZFmjUopVNrXbOID5GNKzcnh 0oN8qFJxYRkJYvHD/XXeKQKFDQq+mxCjEMTdlI1Elhz/Wpiswwv1S+Mw2DBNw1h09EDa a+rD8QQpO1remf53ZxZRxkDeHQcYfX8yDY0mSk+NlTSvf+xnnxEx5OxkKunPYSy/pXh6 4vXg== 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=hmZDMrGkDZCMuzIDfZU0K5xGfdIVakAKtsbe2o5PFXU=; b=wFPNKWyM7PHqn7ZwLy6rvcFLS+7PYXiqcp0p+f2P4EBg8GoDNgyNaQLm37qajA15bG xfdeEw6GQWlriw+D3bvpsD/EqfwVyFSaxiKRwBbDfUw0Fuw69pQUFRWpSmtIhIefaUfc WuO6rH6A8hADF3mgwBnN2GU4BY+Q0eRe6nMY0oCoBR7cPoA8l6a6PZAfJBm7DQG5mTdI lA/QOZzttSsR9YCQYuKaeMQHhCwW77U0qOMWQl4czO1bgG3hI//7Od6/kJ5ko4NtzMVX 3D3XMcN4WILpVyppnZN+O4VJw1RCMcZdhHolvHX7y/roGjY0+Rwc3J/J0ino1e01t6ZK Zd1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ir4N0lD+; 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 q38si1463742eda.93.2018.01.12.07.00.42; Fri, 12 Jan 2018 07:00:42 -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=Ir4N0lD+; 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 48114C22252; Fri, 12 Jan 2018 14:59:30 +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_DNSWL_NONE, 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 8F794C2228D; Fri, 12 Jan 2018 14:52:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4AA5BC22261; Fri, 12 Jan 2018 14:52:34 +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 D4292C22254 for ; Fri, 12 Jan 2018 14:52:30 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id i11so12291632wmf.4 for ; Fri, 12 Jan 2018 06:52:30 -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=4CR7G1kWHXAAr9VrTmFzsY6BTwMtYOZ2oY13f23vvlM=; b=Ir4N0lD+W8f6Xdl5gO7gj7AZNRiVfkMaZK2r9rJvRpYeOo4MoZqEIkId/MHmP7wVkt gj5UnzfTO8LJ6rachRcA12D7i8XSDApD8FHXfb613iYlMeo7r4Om+phDo3LX2eWiBXLf g16V6wP83SCpGhLurY3rDPUH7ph7qd9E7V7eA= 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=4CR7G1kWHXAAr9VrTmFzsY6BTwMtYOZ2oY13f23vvlM=; b=CMjBfxzhAK+KxwzRAPR9/IA7ZulLwJ6b0q+bscPSqe4h1VpvcEN1xYSBCwGrAKKjq6 ivtjT2dhBR7NkCKL79GUeBhNYcQfcAMYHltSnwu6M3z7vs4Vvy8TboMN7ERJ62sx2BV0 JbzZ1Rhxh+1ylxWDxLOG6iEtD9MEMw8B5cPhjCF9CWlCNmj8FGjEzQWufamSArHsguet PP/ncwaCY34exJkj4Mn8OkHtQoc6YbuE6HAbSZC1RVJnmh8SiTydWAGc7y9Cw8zH5VYr YMgz2Iqsaf1PUZDorxYxDpbEaUe1QzbyeZgVyx9JG/enaE1XdW16CBKJSuT0kjpCpXwl mWvQ== X-Gm-Message-State: AKwxytcvCGIC5xdBx6dcg93e+GF2UZ+NIsFZbOCnEzdCZbWoWp5SrFmf gyxM6ltyVTn6l/LJ3h8tJAQjQRyoCbg= X-Received: by 10.80.152.68 with SMTP id h4mr2452525edb.23.1515768750338; Fri, 12 Jan 2018 06:52:30 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id d20sm1318629ede.16.2018.01.12.06.52.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 06:52:29 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Fri, 12 Jan 2018 14:52:19 +0000 Message-Id: <1515768744-25246-5-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515768744-25246-1-git-send-email-bryan.odonoghue@linaro.org> References: <1515768744-25246-1-git-send-email-bryan.odonoghue@linaro.org> Cc: trini@konsulko.com, harinarayan@ti.com Subject: [U-Boot] [PATCH 4/9] optee: Add optee_image_get_entry_point() 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" Add a helper function for extracting the least significant 32 bits from the OPTEE entry point address, which will be good enough to load OPTEE binaries up to (2^32)-1 bytes. We may need to extend this out later on but for now (2^32)-1 should be fine. 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 --- include/tee/optee.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/tee/optee.h b/include/tee/optee.h index 8943afb..eb328d3 100644 --- a/include/tee/optee.h +++ b/include/tee/optee.h @@ -29,6 +29,13 @@ struct optee_header { uint32_t paged_size; }; +static inline uint32_t optee_image_get_entry_point(const image_header_t *hdr) +{ + struct optee_header *optee_hdr = (struct optee_header *)(hdr + 1); + + return optee_hdr->init_load_addr_lo; +} + #if defined(CONFIG_OPTEE) int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start, unsigned long tzdram_len, unsigned long image_len);