From patchwork Fri Jan 19 19:43:21 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: 125224 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp444886ljf; Fri, 19 Jan 2018 11:50:08 -0800 (PST) X-Google-Smtp-Source: AH8x227pqZMTPwAfxJlvkbl/KF1wi5E9Sa6glcB88HCNTj85ZsXUoK3NRw4h4DWsWVLXuFtDE54g X-Received: by 10.80.208.197 with SMTP id g5mr71532edf.216.1516391408658; Fri, 19 Jan 2018 11:50:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516391408; cv=none; d=google.com; s=arc-20160816; b=w7uWCZOxqG/LbDVRiY6/mbvV5MRMVyIUBJXdy4UnoD3fA3KGpur3dKDrn3fy7KVVuQ DvNFxFO1sw3HNWzb3SXGlfCjVX1ms+7E8X3OJx6tfStLBYAhIAj960pWlq1tASYz2C39 cFThEefMOOkAviLJlE/gNhmK++x171cGsOkjKUY8KknqDGTgGwEh1CG1VrLwN+3y3vD9 +QpujSs2YKnuCJ7SxRN0GsrAUT5nD6pBeCoylCiLtima8JusopSJylI3kMIul3nuz2C+ lFE8+dw0mbUia7Eby0I/5hIFJm7y+HFylFRQxEGhzVqb2k8d+i4EPC5ZXWgx6OF3hz7q qevQ== 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=JuHi5MLsDm87d+o87rc7EcLJGZLlu8KAtJk33PtCjARcKLnzG1TGtdAMxVDgixgef2 3N7Uo869wtKWMUOiLPzutWKjM+u8sngGSGKwWpZR4aAnBXE550eH9gv/lFIyPbfr8m0q g6+ErTIhYFrVdWeVmXigAdQe3F7x5ZVIsR/rFy92p1KYA5dP6IpwuVk66EwWDhh4tsNR 2W/wfXQxjQtb2Nm/NRjE8L6NO9w7eJ6GxFcz0fS7qxbm0JHaygE2M4pr+OS5lQDQ4ORw Jj8TTEWgX6IbQXpR/2DiUWmOMEuV2BDxP3wdCAM9psEDrwY0NPBMonoa6zhShOUNMFm6 IquA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EWW+6fdE; 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 d7si818369edl.453.2018.01.19.11.50.08; Fri, 19 Jan 2018 11:50:08 -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=EWW+6fdE; 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 3DD76C21F7F; Fri, 19 Jan 2018 19:46:16 +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 8297EC21F27; Fri, 19 Jan 2018 19:44:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AEB63C21F5F; Fri, 19 Jan 2018 19:43:39 +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 30114C21F53 for ; Fri, 19 Jan 2018 19:43:35 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id i186so5478982wmi.4 for ; Fri, 19 Jan 2018 11:43:35 -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=EWW+6fdECQxw9/fYOOJWnbDN1mb4mOyJ661BWvAq/ZGEgjPw6QMmSFZBjTsxmMSmr7 c+/X1122GDiY+TKrOiLhE1TFev6cbHLa+01IRnjSAfGyi4m5Zo+LCdPZ2q2mBT5K7MWb i9VH3ETqvfg+nNEob+fuYFvB47Dfk3OnzG7tc= 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=QmUAOapo6FrnNzyIQOB5RH/DCHY5fJZTfl8mMus4GsthA4Wmradq7E8pDnrZJbeQr5 PsCZCTHOBlbcOFlsQXlZQBp0LQo7gNUA9UheWKHgJQkdd6bNYd5H9br9gvkOtJKB4zpS O1MKpn4GQRotq9JkfYkrfgVj+YAEq7drWacHAjp4Hvt9isiitWFG4GMIyC/rXMJbc+pM QDF8SzdJVw7Vlp+MTpcPSWupntJTnCpa1PgCEOGe2zzPFTL8+aDvqwMi+b0M2unAaIdk cs+ohUng5fXLlsUTiv52aiUTK81FKTUEQPCjN99dXxz+CS5yIi1KVWCsjmIopg1WgnUJ augQ== X-Gm-Message-State: AKwxytfAfEvKmfBLyIT8MROMB/3k/4krAKXfYCHHtQWlVrkkTDcJyZN7 09YZimVz52HT2D88O0+gG665yUTfnVw= X-Received: by 10.80.142.15 with SMTP id 15mr26006edw.127.1516391014586; Fri, 19 Jan 2018 11:43:34 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id p6sm5936051edh.68.2018.01.19.11.43.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Jan 2018 11:43:34 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 19 Jan 2018 19:43:21 +0000 Message-Id: <1516391006-22483-5-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 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);