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: 883789 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gap7KTKO"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zyYVT3cjVz9s9h for ; Sat, 10 Mar 2018 03:58:25 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 00D9EC21C6A; Fri, 9 Mar 2018 16:57:03 +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-Google-Smtp-Source: AG47ELvptDGasdnP03DZbt7JF4L2kpOewS09P7s+rTj3g28YDP/zZ4J4yGlAgBe1rUeqvTIdrh+7zg== 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);