blob: 5412bc7386ec90f20f1b5dab1bb621673a5fa524 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* OP-TEE related definitions
*
* (C) Copyright 2016 Linaro Limited
* Andrew F. Davis <andrew.davis@linaro.org>
*/
#ifndef _OPTEE_H
#define _OPTEE_H
#include <linux/errno.h>
#include <image.h>
#define OPTEE_MAGIC 0x4554504f
#define OPTEE_VERSION 1
#define OPTEE_ARCH_ARM32 0
#define OPTEE_ARCH_ARM64 1
struct optee_header {
uint32_t magic;
uint8_t version;
uint8_t arch;
uint16_t flags;
uint32_t init_size;
uint32_t init_load_addr_hi;
uint32_t init_load_addr_lo;
uint32_t init_mem_usage;
uint32_t paged_size;
};
static inline uint32_t
optee_image_get_entry_point(const struct image_header *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 struct image_header *hdr)
{
return optee_image_get_entry_point(hdr) - sizeof(struct optee_header);
}
#if defined(CONFIG_OPTEE_IMAGE)
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
#if defined(CONFIG_OPTEE_LIB) && defined(CONFIG_OF_LIBFDT)
int optee_copy_fdt_nodes(void *new_blob);
#else
static inline int optee_copy_fdt_nodes(void *new_blob)
{
return 0;
}
#endif
#endif /* _OPTEE_H */
|