1
2
3 #ifndef __ASM_IMAGE_H
4 #define __ASM_IMAGE_H
5
6 #define RISCV_IMAGE_MAGIC "RISCV\0\0\0"
7 #define RISCV_IMAGE_MAGIC2 "RSC\x05"
8
9 #define RISCV_IMAGE_FLAG_BE_SHIFT 0
10 #define RISCV_IMAGE_FLAG_BE_MASK 0x1
11
12 #define RISCV_IMAGE_FLAG_LE 0
13 #define RISCV_IMAGE_FLAG_BE 1
14
15 #ifdef CONFIG_CPU_BIG_ENDIAN
16 #error conversion of header fields to LE not yet implemented
17 #else
18 #define __HEAD_FLAG_BE RISCV_IMAGE_FLAG_LE
19 #endif
20
21 #define __HEAD_FLAG(field) (__HEAD_FLAG_##field << \
22 RISCV_IMAGE_FLAG_##field##_SHIFT)
23
24 #define __HEAD_FLAGS (__HEAD_FLAG(BE))
25
26 #define RISCV_HEADER_VERSION_MAJOR 0
27 #define RISCV_HEADER_VERSION_MINOR 2
28
29 #define RISCV_HEADER_VERSION (RISCV_HEADER_VERSION_MAJOR << 16 | \
30 RISCV_HEADER_VERSION_MINOR)
31
32 #ifndef __ASSEMBLY__
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 struct riscv_image_header {
52 u32 code0;
53 u32 code1;
54 u64 text_offset;
55 u64 image_size;
56 u64 flags;
57 u32 version;
58 u32 res1;
59 u64 res2;
60 u64 magic;
61 u32 magic2;
62 u32 res4;
63 };
64 #endif
65 #endif