From patchwork Tue Mar 13 16:50:31 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: 131516 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp972219ljb; Tue, 13 Mar 2018 09:54:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELsNNHM9bKhnqAeS7zmEYHm4Dsl/BIvqxVr+7ieXfvX+1GMMqkmC8cipD0hqNAdffn+aXPne X-Received: by 10.80.211.19 with SMTP id g19mr1568767edh.15.1520960080120; Tue, 13 Mar 2018 09:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960080; cv=none; d=google.com; s=arc-20160816; b=ebFKypVJyPmn5EzY2BoRLSXu+kUQTEkyM7S0Kz0bYytMILuMSh1iFTMxIFPSk4bw6F dR0nYL9BnjdjipVWjVMRzblUuHisD2ZVe65A+LVBEeVGPrl9aZyMkgngi/BnZHZJsl8i 2qxUNUkGR2rzE00KjEW+TSceVvnru8CWgQ6WfC1erAsqTG08+my/cuGvAMbxz8AXGbJu 4KqevCW1WLzALQruStL9qJUOOl1HDR3Y6OK8iQigrsNXwsVPqB1E4Te5Twu+IjgGTy6/ sZJ9WZ2uRcO4CpY9RB1Cmgn5V+ExRVo2UKoCfBfzIHBaZHGoJV00k1FpjB7MDFaUmLT2 qUvQ== 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=4CcwC7FBgW8X30HcQeHFFZHS6A58CAZ3P784+gQMGDU=; b=ha3t2bTveKZMALRIYcw2EP3AmXHIPqFIUIxDyDIArw7k6gyd8ZqzAQukuBt4HbvX2a VeJnF1rSnkZO8ktoT7JSIXcVzbO/ZH/d/MLtWmMcTeBENUp7by52Hubr00GKGcYqTR43 Rn/N/lfEI/a6kG762ah4WlgsVvIEF096RtZR479FN4hvw9qBSQc8oTNPgq7kX6CzBmQr gQiNplvzTixcngCjIn2ETJwPAiRrXvon7KdQIZ/hfh1B2vzGYVzBi37J2rB3MT+4w+HM 5NN8r2jr6iMPXynSn8dpGtwdjd5OxCRoljh9i66LWRRWw/dHX7lK6rz73BJa2lYnb9Hq hTQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=JGKZt0my; 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 7si353736edj.485.2018.03.13.09.54.39; Tue, 13 Mar 2018 09:54:40 -0700 (PDT) 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=JGKZt0my; 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 A8338C21E15; Tue, 13 Mar 2018 16:52:46 +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_H2, 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 EEC04C21DD3; Tue, 13 Mar 2018 16:51:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6A6FEC21D72; Tue, 13 Mar 2018 16:50:54 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by lists.denx.de (Postfix) with ESMTPS id 1BA1EC21C8B for ; Tue, 13 Mar 2018 16:50:49 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id d10so808251wrf.3 for ; Tue, 13 Mar 2018 09:50:49 -0700 (PDT) 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=HehyfLwBiGL7w0M1GQgZW2L7CjFJl409qccQ+xCD/gQ=; b=JGKZt0myK1JWf9Nrv6qUxZjmgM0U5FmG/pzcFRSghIhlGt4NJCohP9R3ppo2lMR49N NH4nHHzzlF9zVZtNwcIg4PeNUp9Win8pALG9rcSTTkly0oKdt28EXmIenCze49PNpSjj l/CENyQi4EoOrUckg4W4+VrYYyakthXeVyPkc= 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=HehyfLwBiGL7w0M1GQgZW2L7CjFJl409qccQ+xCD/gQ=; b=FXAkDR1dv5SHSLq0OXCb8Daib6WGPVw+v8ofqWd2465jIYxv8jZxL2CuZVskEAqoRU AZ+Z2wGT7TJiZw8Ipyh3rU06QnJI1F8dQJoV4JTG3Ovzw/oSkEPImH9lto03hTaHrcM6 mYU3cAjsqEJor6jBFHjSY4hcRRh2nzq7RPKIiJiBSHBJBnWkVOqqWdwRDf57zSeldJMT 49SAf8Iju7fExCcPhUIKAWSoQNJy4NkpRgTZvhW/3PXB6pweADAoZlQPCp2nt5ToNjZh pK8mZZ7o8b4X6nzWMPkI7LeDiT/oTUStVSgdhCmWPREl9nY5DdMI87pnC/DVKatHf17j y98A== X-Gm-Message-State: AElRT7HfaqS2DQ1PZQGRo4sSIbCly4dKIPZX4I/XHCF05kKFpg9+d4aT MmZXPe2PpKwr3kR1ydee+F9+Ymj9AV0= X-Received: by 10.80.213.150 with SMTP id v22mr1622777edi.58.1520959848606; Tue, 13 Mar 2018 09:50:48 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id 33sm476671edz.37.2018.03.13.09.50.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Mar 2018 09:50:48 -0700 (PDT) From: Bryan O'Donoghue To: U-Boot@lists.denx.de, trini@konsulko.com, afd@ti.com, kever.yang@rock-chips.com, philipp.tomsich@theobroma-systems.com, peng.fan@nxp.com Date: Tue, 13 Mar 2018 16:50:31 +0000 Message-Id: <1520959836-16105-6-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520959836-16105-1-git-send-email-bryan.odonoghue@linaro.org> References: <1520959836-16105-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Harinarayan Bhatta Subject: [U-Boot] [PATCH v6 05/10] 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 Tested-by: 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);