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: 877830 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="KukQ4guJ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3zqhKV0Vfvz9s3L for ; Mon, 26 Feb 2018 23:41:49 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id A93FDC220FC; Mon, 26 Feb 2018 12:37:56 +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-Google-Smtp-Source: AH8x2240OIIo0xbVqfpbq0G5t678yB+mg78gcXbuX/JGfXQFHDmYSWEsrN3MOajYUoKj8ugYt7KiVw== 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);