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