From patchwork Fri Mar 9 16:55:26 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: 131167 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1214632lja; Fri, 9 Mar 2018 08:58:34 -0800 (PST) X-Google-Smtp-Source: AG47ELvUTeEXS2ReL+Mn1tw2wB8/rLbM8pGaMGCpZmTr/LZ5aIqGXrtRaf6gn8ollk7JjxVF9R83 X-Received: by 10.80.159.1 with SMTP id b1mr37249452edf.132.1520614713961; Fri, 09 Mar 2018 08:58:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520614713; cv=none; d=google.com; s=arc-20160816; b=ZmFZSON3hQzAOSqzbP1xwXELehUM0sAeP+V1MwACNKCNT0jwT6etEu3guARhZEHVOV kaS7GjwsvvPOVOLUpJF31zVC4h2EOtZgPVhf+BvNN2pkXXriqIbU/Hc1EW0cnSujWlko 3JrnOxb7M473QbX9q9O0F2yBH6TqpsJFy/13SW+v0G7NjuoKjkFKLtYlypJTpSgN5V4g ++/s+DbgqYvCXvJZ/E6fmosYMrCDiCvantGUIk8zjVgv2JNBHHBiY2/JBTX04G3E/oNo WcOxtshAMcyizyCFxgVPzPwu9Bg/q/bQxDP2X92MK6lBBsIEHuFGe0XPwcuYipOabSLd PoWQ== 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=m9PcAb7uMADwrUbagxv+leoYeQ99MXQz0igKTEroUL4kQyW5hiDSchek+D1bWjew8b D/Oamy/KzpQlCWaXn+jGUYYqX32yEJ2sJb1jpYTV4sMbgkKo1CXVO02IGyReIOKwVSZl pemoOg4ljzFK9lkWPqLXjQyboZDnizhgD2O6Oskj9oEOJSYVXPgXTRk+3obnm1qYK6wu kuBVsYjZ6WDAfagADTy97dQf6Gj9TZb+laAULCAl+kv+R//77nJ98qyWJLMVJAnsPk40 93ehVPVw3zLQPHpEvUoUYLroL+AaB5tqqbqJiA7edcji9HC2Lqdq+q+SZ2VMfvIorHe/ OWNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=gap7KTKO; 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 w3si1488937edj.433.2018.03.09.08.58.33; Fri, 09 Mar 2018 08:58:33 -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=gap7KTKO; 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 94272C21C6A; Fri, 9 Mar 2018 16:57:02 +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_BLOCKED, 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 1BCF8C21DFB; Fri, 9 Mar 2018 16:55:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A973FC21C27; Fri, 9 Mar 2018 16:55:44 +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 E2E25C21E0B for ; Fri, 9 Mar 2018 16:55:39 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id h21so5094599wmd.1 for ; Fri, 09 Mar 2018 08:55:39 -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=gap7KTKOPiuAWnEkGOH3j12Dyiggc6z3lYoUPQkiKZ04F+LXpgJb239eQ1UT/ve56U sZcITiRPB+2ojdSoFNPOXBsxaRj0WKfSwmvr+DKZrbfXZX2rYSxU0D/OFTx9tmrXc4S0 QTmBhAyvthJqBRWdNLdlOV5ObebL9EfmKgjyY= 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=p9KQCggochAVygDUK8Hfke8XIM+PRZrg3XRMJ4PfC/2lUAbyfPqg2hjdCOC3C2zTVT 4aRC5B8FHWtyLcAg0yYvbpxp6WtfW/FzmnlZuHPN6s4JKEQMgdEYbhZtIW1RKTBn02jF YD3K13BvYcsKNoCJfVDc2svy4Bgyg1TiO8bMk6jDBuugjJmbgQ318V4XtwDJ8FbrahKu We0qgkflXDfSXVOr0PIshBKrRLcSQuIwdl9Fu/zHvgYBgH8ExilFYw+V7BT8LOiLXRZ0 XAmbKHudL5GPSecuGrV/lYpi0KTZFnbUYRMC2aHF/g8Q3iTlOCx2setCM8thbCiAUFzB 2Ygw== X-Gm-Message-State: APf1xPDlhpdIVGlJSIVZ45BBpXEPB6WdwoeNkqcVjT/evSFV6ONjnki7 DaVyuUy+L9tl4M6yTSZPPUl9GrjANu0= X-Received: by 10.80.170.222 with SMTP id r30mr37940726edc.309.1520614539413; Fri, 09 Mar 2018 08:55:39 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id e40sm960335ede.15.2018.03.09.08.55.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 08:55:38 -0800 (PST) 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: Fri, 9 Mar 2018 16:55:26 +0000 Message-Id: <1520614531-2164-6-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520614531-2164-1-git-send-email-bryan.odonoghue@linaro.org> References: <1520614531-2164-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Harinarayan Bhatta Subject: [U-Boot] [PATCH v5 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);