18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci#ifndef __ASM_IMAGE_H
48c2ecf20Sopenharmony_ci#define __ASM_IMAGE_H
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#define ARM64_IMAGE_MAGIC	"ARM\x64"
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_BE_SHIFT		0
98c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT	(ARM64_IMAGE_FLAG_BE_SHIFT + 1)
108c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT \
118c2ecf20Sopenharmony_ci					(ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT + 2)
128c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_BE_MASK		0x1
138c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PAGE_SIZE_MASK		0x3
148c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PHYS_BASE_MASK		0x1
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_LE			0
178c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_BE			1
188c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PAGE_SIZE_4K		1
198c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PAGE_SIZE_16K		2
208c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PAGE_SIZE_64K		3
218c2ecf20Sopenharmony_ci#define ARM64_IMAGE_FLAG_PHYS_BASE		1
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define arm64_image_flag_field(flags, field) \
268c2ecf20Sopenharmony_ci				(((flags) >> field##_SHIFT) & field##_MASK)
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/*
298c2ecf20Sopenharmony_ci * struct arm64_image_header - arm64 kernel image header
308c2ecf20Sopenharmony_ci * See Documentation/arm64/booting.rst for details
318c2ecf20Sopenharmony_ci *
328c2ecf20Sopenharmony_ci * @code0:		Executable code, or
338c2ecf20Sopenharmony_ci *   @mz_header		  alternatively used for part of MZ header
348c2ecf20Sopenharmony_ci * @code1:		Executable code
358c2ecf20Sopenharmony_ci * @text_offset:	Image load offset
368c2ecf20Sopenharmony_ci * @image_size:		Effective Image size
378c2ecf20Sopenharmony_ci * @flags:		kernel flags
388c2ecf20Sopenharmony_ci * @reserved:		reserved
398c2ecf20Sopenharmony_ci * @magic:		Magic number
408c2ecf20Sopenharmony_ci * @reserved5:		reserved, or
418c2ecf20Sopenharmony_ci *   @pe_header:	  alternatively used for PE COFF offset
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct arm64_image_header {
458c2ecf20Sopenharmony_ci	__le32 code0;
468c2ecf20Sopenharmony_ci	__le32 code1;
478c2ecf20Sopenharmony_ci	__le64 text_offset;
488c2ecf20Sopenharmony_ci	__le64 image_size;
498c2ecf20Sopenharmony_ci	__le64 flags;
508c2ecf20Sopenharmony_ci	__le64 res2;
518c2ecf20Sopenharmony_ci	__le64 res3;
528c2ecf20Sopenharmony_ci	__le64 res4;
538c2ecf20Sopenharmony_ci	__le32 magic;
548c2ecf20Sopenharmony_ci	__le32 res5;
558c2ecf20Sopenharmony_ci};
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#endif /* __ASM_IMAGE_H */
60