diff mbox series

[v6,06/10] optee: Add optee_image_get_load_addr()

Message ID 1520959836-16105-7-git-send-email-bryan.odonoghue@linaro.org
State Accepted
Commit dd5a12e28799366d3c64434f6b347550a4600231
Headers show
Series Add new OPTEE bootm support to u-boot | expand

Commit Message

Bryan O'Donoghue March 13, 2018, 4:50 p.m. UTC
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 <bryan.odonoghue@linaro.org>
Cc: Harinarayan Bhatta <harinarayan@ti.com>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Peng Fan <peng.fan@nxp.com>
Tested-by: Peng Fan <peng.fan@nxp.com>
---
 include/tee/optee.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Tom Rini March 19, 2018, 10:37 p.m. UTC | #1
On Tue, Mar 13, 2018 at 04:50:32PM +0000, Bryan O'Donoghue wrote:

> 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 <bryan.odonoghue@linaro.org>

> Cc: Harinarayan Bhatta <harinarayan@ti.com>

> Cc: Andrew F. Davis <afd@ti.com>

> Cc: Tom Rini <trini@konsulko.com>

> Cc: Kever Yang <kever.yang@rock-chips.com>

> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

> Cc: Peng Fan <peng.fan@nxp.com>

> Tested-by: Peng Fan <peng.fan@nxp.com>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

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);