From patchwork Mon Feb 26 12:35:58 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: 129634 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp155906lja; Mon, 26 Feb 2018 04:40:33 -0800 (PST) X-Google-Smtp-Source: AH8x227tIe9ajvUB6/U8vjai1Oo47WKnv/xiIY9C8qKPIaIf/M718Yq+74hA6yFbbs9ATWewp0Hi X-Received: by 10.80.214.158 with SMTP id r30mr14239846edi.288.1519648833336; Mon, 26 Feb 2018 04:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519648833; cv=none; d=google.com; s=arc-20160816; b=E289ULLTxAhJlJjGBbVsrpdzV3YhlwY3b6RlopxYdYAVWiXpKWH+sX1+LH2K5WxMVT +tAdBocC6X0Pt7Kjr5Bjhw9VbvzDjjrVgQRJIo/EQ5alxjKD5Pp2mUhsU4gmzyk1I9Ay wqUuI1zBiuG3ZcYgj048SG1qTnjsMMD+d5vJhbxj9mKReiYdXAOCERt9MXeenTry8BEC 5d4Xl80ZmdcN6NpCAl6Ta7xJZVt5P3WOA6F1LwP6mIx+m9ld0xgOiM3lHXyEL9UyAhQk W9+VnoJaeAJ6pY5rjJNxN84ArBo73kw4cZAaGZ9w/Xx0wY56tP1B2eyI8epMPgye79GC h94g== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:arc-authentication-results; bh=4CcwC7FBgW8X30HcQeHFFZHS6A58CAZ3P784+gQMGDU=; b=QYfVFFXoEbn0UzkEGZhxOeya9SyyNUXcYjX8HU+XgZ5e3A3Kn0+7nJ/V5IpR5ZLrS8 u64ZWzoGrDpIs8/3jcpWmFVWfDzNlqjsXjxSNA8NGn2pSzepNiEczh7puboJJy7/d5IT vHbsDKCxn7ahYR/dhqymNkjFZNWgW5i/evQtFe/8cjX+cZCJDwSSNlKx0M1i4Hk53pC8 E67oyqHZO3GhUwfe2hYGrKFZkmVvtzADZif1JHaJt7i7OpX5BGjz/olKwjQxCiQcWLzz 1V91D49BSzyp9Tz0gOATpDgCyBwPG1pCJKR7a65kW7pzG14hFmSGvLFITJZkvNDgcZPi wh5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KukQ4guJ; 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 h10si555548edh.7.2018.02.26.04.40.33; Mon, 26 Feb 2018 04:40: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=KukQ4guJ; 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 CF799C22100; Mon, 26 Feb 2018 12:37:55 +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 8C155C22102; Mon, 26 Feb 2018 12:36:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EC04CC21DED; Mon, 26 Feb 2018 12:36:18 +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 DA27DC220F0 for ; Mon, 26 Feb 2018 12:36:13 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id t6so8593494wmt.5 for ; Mon, 26 Feb 2018 04:36:13 -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=KukQ4guJccVM/Ob/cj+2A9ybZX/590G7H6l1gy1mIiPUoLHu9hfFTGtcEQMWGnFWVb DjmxOwzVLvXpJGhK55rYbuDfpT+phOWNyI2rmKt3YljyIENKFULPamelFXeFtu0TnxoG BWEbjfvCJAYooJMGXqXNFyiAM+KK8FFaXcwOM= 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=iNWDXwZANtw6E1+Mb39RyCs8RjACO+/GpUa45ioWypgirCjLMYwPQAgKroqfNNrn7C fM4qQYiYaAhrRQ9zWIhnNXd94Cy7y6rSzRvfygisIRVPCeDHfCHQsuV0fZE2QwSxdeK1 XFwMILqI7l/ixPDzbi+61zWhwGdhGgeBmyZX5KUCxvph6OLPhqThTMx0vzjDGHHaNU7j CoSiVAtQ/u5PJRxPsb6UT5MwPjoyJwpMMuVzLJ+qX0cQpmmsZnweD/wFFEyeldiZf7io kwrzWYTZsED4BhB2hGrfZX2dClQe4F81ECU7jVYN/VBf8b31HF88RjrNURYPzZ3VGY/3 1NJg== X-Gm-Message-State: APf1xPDb4vgpPaqZdyrx2j8WJ1ptBl3ge9PIrpX0XQi0XyYuDJiTT3SQ l+PNfO4txaTbRUgZX84apk9CPCkx4nA= X-Received: by 10.80.184.58 with SMTP id j55mr14517360ede.45.1519648573254; Mon, 26 Feb 2018 04:36:13 -0800 (PST) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id f6sm2493967edn.45.2018.02.26.04.36.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 04:36:12 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com, harinarayan@ti.com, afd@ti.com, kever.yang@rock-chips.com, philipp.tomsich@theobroma-systems.com, peng.fan@nxp.com Date: Mon, 26 Feb 2018 12:35:58 +0000 Message-Id: <1519648566-12061-5-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519648566-12061-1-git-send-email-bryan.odonoghue@linaro.org> References: <1519648566-12061-1-git-send-email-bryan.odonoghue@linaro.org> Subject: [U-Boot] [PATCH v4 04/12] 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);