1 /* SPDX-License-Identifier: BSD-2-Clause */
3 * OP-TEE related definitions
5 * (C) Copyright 2016 Linaro Limited
6 * Andrew F. Davis <andrew.davis@linaro.org>
12 #include <linux/errno.h>
15 #define OPTEE_MAGIC 0x4554504f
16 #define OPTEE_VERSION 1
17 #define OPTEE_ARCH_ARM32 0
18 #define OPTEE_ARCH_ARM64 1
26 uint32_t init_load_addr_hi;
27 uint32_t init_load_addr_lo;
28 uint32_t init_mem_usage;
32 static inline uint32_t
33 optee_image_get_entry_point(const struct image_header *hdr)
35 struct optee_header *optee_hdr = (struct optee_header *)(hdr + 1);
37 return optee_hdr->init_load_addr_lo;
40 static inline uint32_t
41 optee_image_get_load_addr(const struct image_header *hdr)
43 return optee_image_get_entry_point(hdr) - sizeof(struct optee_header);
46 #if defined(CONFIG_OPTEE)
47 int optee_verify_image(struct optee_header *hdr, unsigned long tzdram_start,
48 unsigned long tzdram_len, unsigned long image_len);
50 static inline int optee_verify_image(struct optee_header *hdr,
51 unsigned long tzdram_start,
52 unsigned long tzdram_len,
53 unsigned long image_len)
60 #if defined(CONFIG_OPTEE)
61 int optee_verify_bootm_image(unsigned long image_addr,
62 unsigned long image_load_addr,
63 unsigned long image_len);
65 static inline int optee_verify_bootm_image(unsigned long image_addr,
66 unsigned long image_load_addr,
67 unsigned long image_len)
73 #if defined(CONFIG_OPTEE) && defined(CONFIG_OF_LIBFDT)
74 int optee_copy_fdt_nodes(const void *old_blob, void *new_blob);
76 static inline int optee_copy_fdt_nodes(const void *old_blob, void *new_blob)