[v6,05/10] optee: Add optee_image_get_entry_point()

Message ID 1520959836-16105-6-git-send-email-bryan.odonoghue@linaro.org
State Accepted
Commit f79443684b60beb7cb281fc0becb6b69aa0a1a4a
Headers show
Series
  • Add new OPTEE bootm support to u-boot
Related show

Commit Message

Bryan O'Donoghue March 13, 2018, 4:50 p.m.
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 <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 | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

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

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

Patch

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