From patchwork Tue Jan 23 20:41:55 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: 125593 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp1996191ljf; Tue, 23 Jan 2018 12:48:56 -0800 (PST) X-Google-Smtp-Source: AH8x227iem4UTSnnuXoVgrFL6A/ZRTXJYBAHndAi8soM48hpK5CZ0MsL34FfnsAOj2rcgYTn5wYi X-Received: by 10.80.138.130 with SMTP id j2mr21695314edj.36.1516740536370; Tue, 23 Jan 2018 12:48:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516740536; cv=none; d=google.com; s=arc-20160816; b=Ao7aFMh7zT3MvJZC7AysQOgtw8lUvpTz7g1YaWeQ4Orp21AKwdTG214Tx5V8BrzJL7 F8yb7YikToQHSQbOketNEBJP3HJDVyn2T7xSdZJW7VlkiKUynlD6nKbm6sAKdVYpxXPv mWkjfofxaC1mj2bHOv41JiFhzMS79pVuRuFCFb2c0Za4ybiUNyRcmV+E608aPCMla1TZ o+KZdBsWo0iQzNFPh0eqRqVWkHX3cy0fzvgkeLaxVGP4BX30a/GBgmb0CfFapGzyW4e5 wRz6n0XZYejPhEFIDVyv070jHzp6MTfObEzkTSeSnRJNrlV9XNlndViTeTRSB9wESk7S p4Xg== 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=Nlyd299iRRZuxbZEpXETXIfFadHeB/lPIWSShIvySO8YarNBf/DtFJ7ej6cPOpFCXN I8Kh2IUvUXy5t+Kb2sbvl43nTqyGSEj4T7vVcVDCD1asPKqayn5ivBA3iPNN1OHho6dP 3rOUgnsvG9tW9tFem/2thuKjRVoSr3XkilL7hs2Sp4UPPBVE0MunVl1taMw9wSl7RzMN XBnOZrBDSiYyKz9qMr2uPgBJf+APbbzfMwkBO3TIA6lTkGLZqruYRRTLqB1fQYMfvgWA jYnXJM75qpgt7KrjwAeNPzNYzQr1rNvA0p7cd/nmqMTddn5eTOg8yFnPWmlsGuerF8Pb xLvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UJoyebHN; 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 6si2260787edn.491.2018.01.23.12.48.56; Tue, 23 Jan 2018 12:48:56 -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=UJoyebHN; 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 E82ECC21F53; Tue, 23 Jan 2018 20:47:21 +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 72E78C2215A; Tue, 23 Jan 2018 20:42:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7DAB0C22153; Tue, 23 Jan 2018 20:42:10 +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 F2DC1C21EE3 for ; Tue, 23 Jan 2018 20:42:06 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id g1so4344172wmg.2 for ; Tue, 23 Jan 2018 12:42:06 -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=HehyfLwBiGL7w0M1GQgZW2L7CjFJl409qccQ+xCD/gQ=; b=UJoyebHNghzbybRljl+Cq7+f8/RMcc1Qdmbe/p8Zh3eQbk6neWHYSqmbEcLGQ0n3r1 YugAC9/9nIgrQxHkyGaZm5l5MtOc+ENhEkHqDoofrlFHZOqghJAAdVuzszb3Gxy8Pm4/ 5ihFbZVodCS1Zoidje0q7jJ5eZ6mSYDFwqm6E= 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=Q3E79fTOSgy5SBcW7ZEz2YpxQR7d/lCVoTAmUuaAf4PqroQcr6iDzI8tRsaeY5fA4U j1inhKGDnFHXt6dIqgA0CnExNN4QAyMLXl/QifiR1JsxyZC/qhM4o4+XWVEWJnBH6kjo zSlZMTr5lNO0Ly6DNt4wU84Gk/jPoUbz92Xj3GjPpzgPhOB+5K3L5rqRyJvzx/ZtOPvg kuWyzo47p/3/BvEEQsrwxBxkhNjc/6ioNQAz+bve59ktdxqKL0ZBIeOEB33tetIt9oCm zqcD7K8RdK9mnaWFXIpwmZ3K17JfzE5xi/5GMHc4NskqfHxCXKrc+bPV5IAexrMr+yrz AT/g== X-Gm-Message-State: AKwxytcmG/Ri4yYooPcXnLUa8SQkXxcanMc3G5GpeRsxp0tIx6vfnmat 9b12qDi+sFygYSIc33Gorzb+dpHr5l0= X-Received: by 10.80.182.203 with SMTP id f11mr20777521ede.157.1516740126486; Tue, 23 Jan 2018 12:42:06 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id k12sm12400896edl.86.2018.01.23.12.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Jan 2018 12:42:05 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Tue, 23 Jan 2018 20:41:55 +0000 Message-Id: <1516740120-948-5-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 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 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);