From: Bryan O'Donoghue Date: Tue, 13 Mar 2018 16:50:32 +0000 (+0000) Subject: optee: Add optee_image_get_load_addr() X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=dd5a12e28799366d3c64434f6b347550a4600231;p=u-boot.git optee: Add optee_image_get_load_addr() 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 --- diff --git a/include/tee/optee.h b/include/tee/optee.h index eb328d3cc6..e782cb0e0e 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);