From patchwork Tue Mar 13 16:50:32 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: 131515 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp972211ljb; Tue, 13 Mar 2018 09:54:39 -0700 (PDT) X-Google-Smtp-Source: AG47ELuW3HXxmoWfBIxoLkW7cK8erENgjwFdFNZuiGe+K1PNQKB7BiLNYGGyRMtr4dKXdP4Hfnfc X-Received: by 10.80.194.201 with SMTP id u9mr1561196edf.179.1520960079720; Tue, 13 Mar 2018 09:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960079; cv=none; d=google.com; s=arc-20160816; b=YNAqnCdhgQneLISvrXw9FjY3oc0Pdby4Vfc6pSoR9lD7fC5JAe8hhl8Y5Zl3UeI7X5 mwJIV5cbI9wvrtSkUH3BLqVk1XRJZU6r7anTGdVGg2RiaqxjjyKDjsaxQG7zFv2NsUVG E+h+9RcvzXWPNh22ZVwAcEdDgktq+UZFTt0rh8lK25uMhuMxipxVrIkGkLiUiRG4noJm ZDom2uhsnLw92/LwLbAKPXkx/QlsjRUsU37guvnhNFW33iSKF7gKn1vX1b8AsTbnyllW jVn1FSHEfFnPl+FmVPgCIZAdJ2azfWXWJc5gmBX14pAlDYnZmc4aVfHjYX/TmLLrXy6G 5Gdw== 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=QaYroxNd3askNKowPokMN25W/t4qBXmwlbEd13MrC2M=; b=KRK2pBgxKImUrkDqyWUImtGcQlvdEDx4ubSSuKls3V2bB5mCARp6AmOpAIvMqm5Iuh W2iFsl+DMUfr0kPoJaQi9UQDiqotF1MfXUqtkefqEf2JA69sN4x8fg/YNqoVZbbmrB2Q p3vQUt3wg7lCM77RQT6eNqj8O+epj8vJ56GkZ6eWo/RBQ6m94LMTBEXA/Kj3sCQg1Ahg IDvsL9czFhgqMjUNg+N1PVORyvwOuKJEoBPhN0dpnjVE7XdpuhUPOocnRZZnZj5Zu+PZ 5qHDihhpSCrDYbMIzHi+28XG85c4dbwyQvySeON2h9BDX05wx01jreP3/aXVEmhGpfKq wi/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=HTWtLs1n; 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 a58si387654edd.351.2018.03.13.09.54.39; Tue, 13 Mar 2018 09:54:39 -0700 (PDT) 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=HTWtLs1n; 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 55DFBC21E1D; Tue, 13 Mar 2018 16:53:04 +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_H2, 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 51125C21DFF; Tue, 13 Mar 2018 16:51:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C1E0DC21DFF; Tue, 13 Mar 2018 16:50:54 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by lists.denx.de (Postfix) with ESMTPS id 701D3C21DB6 for ; Tue, 13 Mar 2018 16:50:50 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id v65so733533wrc.11 for ; Tue, 13 Mar 2018 09:50:50 -0700 (PDT) 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=jd7TJ8ToMThI42VzCdFxxuucXAuvkiPJC/i5sG6S6nU=; b=HTWtLs1n6iwMLzulW+KiKUk3KLpdkPy3dVs3fT13dDmogORClbCJatO5KmY85b7WyX qC1JAxCWtj8584LcMqkb6QDKVL0nuzaAhfqS5fKOXzKH3BAtuncObqaGIrx9tzghjVTu sx+ZIR16FICizmQvX/5pGO8MEIDDuVTs3jodg= 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=jd7TJ8ToMThI42VzCdFxxuucXAuvkiPJC/i5sG6S6nU=; b=RWO4Zi6mpd+Act4Om9bEvZvXgB4zvsV5CQ9q7Cil/olQPA3uK7YI9m0XuscRjdSK79 jkD7Bw3IJlAqpwp/TIf5CtozNQXheZMTQP0GKpjSG/uW3ukSqWjQZuiRtEgpCviyqHu3 oFIS2vZM1CcwMS0O872QCDdNHhKVHRYEasnS3kS6/a0dOT1u5qT7fhsvUEc6xOIrjx3C WxjCiX38U4M9BwZNDmEN6n2KJwbxY7C9njM3g3cDhHRPter9HI1MEghoTSRLF6dSdqTX Noon3CuN/IZX5Rn2ghnmyij29Csum2UsWqHY38X3CjJVqvSSDDD+BV9vMN9v9ZvtaN+d HGWQ== X-Gm-Message-State: AElRT7GNvTTV5RFbUPVhxdpD9V2ntKUxqovo/QjjrcJ9jn4sBMncYBZs wKzfEhyXLw/R39VgxKlC56vc4eHONjU= X-Received: by 10.80.247.195 with SMTP id i3mr1589886edn.121.1520959849996; Tue, 13 Mar 2018 09:50:49 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id 33sm476671edz.37.2018.03.13.09.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Mar 2018 09:50:49 -0700 (PDT) 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: Tue, 13 Mar 2018 16:50:32 +0000 Message-Id: <1520959836-16105-7-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520959836-16105-1-git-send-email-bryan.odonoghue@linaro.org> References: <1520959836-16105-1-git-send-email-bryan.odonoghue@linaro.org> Cc: Harinarayan Bhatta Subject: [U-Boot] [PATCH v6 06/10] optee: Add optee_image_get_load_addr() 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" This patch adds optee_image_get_load_addr() a helper function used to calculate the load-address of an OPTEE image based on the lower entry-point address given in the OPTEE header. 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 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/tee/optee.h b/include/tee/optee.h index eb328d3..e782cb0 100644 --- a/include/tee/optee.h +++ b/include/tee/optee.h @@ -36,6 +36,11 @@ static inline uint32_t optee_image_get_entry_point(const image_header_t *hdr) return optee_hdr->init_load_addr_lo; } +static inline uint32_t optee_image_get_load_addr(const image_header_t *hdr) +{ + return optee_image_get_entry_point(hdr) - sizeof(struct optee_header); +} + #if defined(CONFIG_OPTEE) int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start, unsigned long tzdram_len, unsigned long image_len);