xref: /openbmc/linux/arch/arm64/include/asm/image.h (revision 3cf3cdea)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 
3 #ifndef __ASM_IMAGE_H
4 #define __ASM_IMAGE_H
5 
6 #define ARM64_IMAGE_MAGIC	"ARM\x64"
7 
8 #define ARM64_IMAGE_FLAG_BE_SHIFT		0
9 #define ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT	(ARM64_IMAGE_FLAG_BE_SHIFT + 1)
10 #define ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT \
11 					(ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT + 2)
12 #define ARM64_IMAGE_FLAG_BE_MASK		0x1
13 #define ARM64_IMAGE_FLAG_PAGE_SIZE_MASK		0x3
14 #define ARM64_IMAGE_FLAG_PHYS_BASE_MASK		0x1
15 
16 #define ARM64_IMAGE_FLAG_LE			0
17 #define ARM64_IMAGE_FLAG_BE			1
18 #define ARM64_IMAGE_FLAG_PAGE_SIZE_4K		1
19 #define ARM64_IMAGE_FLAG_PAGE_SIZE_16K		2
20 #define ARM64_IMAGE_FLAG_PAGE_SIZE_64K		3
21 #define ARM64_IMAGE_FLAG_PHYS_BASE		1
22 
23 #ifndef __ASSEMBLY__
24 
25 #define arm64_image_flag_field(flags, field) \
26 				(((flags) >> field##_SHIFT) & field##_MASK)
27 
28 /*
29  * struct arm64_image_header - arm64 kernel image header
30  * See Documentation/arm64/booting.rst for details
31  *
32  * @code0:		Executable code, or
33  *   @mz_header		  alternatively used for part of MZ header
34  * @code1:		Executable code
35  * @text_offset:	Image load offset
36  * @image_size:		Effective Image size
37  * @flags:		kernel flags
38  * @reserved:		reserved
39  * @magic:		Magic number
40  * @reserved5:		reserved, or
41  *   @pe_header:	  alternatively used for PE COFF offset
42  */
43 
44 struct arm64_image_header {
45 	__le32 code0;
46 	__le32 code1;
47 	__le64 text_offset;
48 	__le64 image_size;
49 	__le64 flags;
50 	__le64 res2;
51 	__le64 res3;
52 	__le64 res4;
53 	__le32 magic;
54 	__le32 res5;
55 };
56 
57 #endif /* __ASSEMBLY__ */
58 
59 #endif /* __ASM_IMAGE_H */
60