]> git.sur5r.net Git - u-boot/blobdiff - include/tee/optee.h
efi_loader: new functions to print loaded image information
[u-boot] / include / tee / optee.h
index 9ab0d08634f2b9b9cc6c30953aa5f2217be10c35..4b9e94c1754430a412d7ca0aeb8140256c85f79c 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef        _OPTEE_H
 #define _OPTEE_H
 
+#include <linux/errno.h>
+
 #define OPTEE_MAGIC             0x4554504f
 #define OPTEE_VERSION           1
 #define OPTEE_ARCH_ARM32        0
@@ -27,4 +29,43 @@ 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;
+}
+
+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);
+#else
+static inline int optee_verify_image(struct optee_header *hdr,
+                                    unsigned long tzdram_start,
+                                    unsigned long tzdram_len,
+                                    unsigned long image_len)
+{
+       return -EPERM;
+}
+
+#endif
+
+#if defined(CONFIG_OPTEE)
+int optee_verify_bootm_image(unsigned long image_addr,
+                            unsigned long image_load_addr,
+                            unsigned long image_len);
+#else
+static inline int optee_verify_bootm_image(unsigned long image_addr,
+                                          unsigned long image_load_addr,
+                                          unsigned long image_len)
+{
+       return -EPERM;
+}
+#endif
+
 #endif /* _OPTEE_H */