1 #ifndef _ASM_X86_BOOTPARAM_H
2 #define _ASM_X86_BOOTPARAM_H
3 
4 #include <linux/types.h>
5 #include <linux/screen_info.h>
6 #include <linux/apm_bios.h>
7 #include <linux/edd.h>
8 #include <asm/e820.h>
9 #include <asm/ist.h>
10 #include <asm/video/edid.h>
11 
12 /* setup data types */
13 enum {
14 	SETUP_NONE = 0,
15 	SETUP_E820_EXT,
16 	SETUP_DTB,
17 };
18 
19 /* extensible setup data list node */
20 struct setup_data {
21 	__u64 next;
22 	__u32 type;
23 	__u32 len;
24 	__u8 data[0];
25 };
26 
27 /**
28  * struct setup_header - Information needed by Linux to boot
29  *
30  * See https://www.kernel.org/doc/html/latest/x86/boot.html
31  */
32 struct setup_header {
33 	__u8	setup_sects;
34 	__u16	root_flags;
35 	__u32	syssize;
36 	__u16	ram_size;
37 #define RAMDISK_IMAGE_START_MASK	0x07FF
38 #define RAMDISK_PROMPT_FLAG		0x8000
39 #define RAMDISK_LOAD_FLAG		0x4000
40 	__u16	vid_mode;
41 	__u16	root_dev;
42 	__u16	boot_flag;
43 	__u16	jump;
44 	__u32	header;
45 	__u16	version;
46 	__u32	realmode_swtch;
47 	__u16	start_sys;
48 	__u16	kernel_version;
49 	__u8	type_of_loader;
50 	__u8	loadflags;
51 #define LOADED_HIGH	BIT(0)
52 #define KASLR_FLAG	BIT(1)
53 #define QUIET_FLAG	BIT(5)
54 #define KEEP_SEGMENTS	BIT(6)		/* Obsolete */
55 #define CAN_USE_HEAP	BIT(7)
56 	__u16	setup_move_size;
57 	__u32	code32_start;
58 	__u32	ramdisk_image;
59 	__u32	ramdisk_size;
60 	__u32	bootsect_kludge;	/* Obsolete */
61 	__u16	heap_end_ptr;
62 	__u8	ext_loader_ver;
63 	__u8	ext_loader_type;
64 	__u32	cmd_line_ptr;
65 	__u32	initrd_addr_max;
66 	__u32	kernel_alignment;
67 	__u8	relocatable_kernel;
68 	u8	min_alignment;
69 #define XLF_KERNEL_64			BIT(0)
70 #define XLF_CAN_BE_LOADED_ABOVE_4G	BIT(1)
71 #define XLF_EFI_HANDOVER_32		BIT(2)
72 #define XLF_EFI_HANDOVER_64		BIT(3)
73 #define XLF_EFI_KEXEC			BIT(4)
74 	u16	xloadflags;
75 	__u32	cmdline_size;
76 	__u32	hardware_subarch;
77 	__u64	hardware_subarch_data;
78 	__u32	payload_offset;
79 	__u32	payload_length;
80 	__u64	setup_data;
81 	__u64	pref_address;
82 	__u32	init_size;
83 	__u32	handover_offset;
84 	u32	kernel_info_offset;
85 } __attribute__((packed));
86 
87 struct sys_desc_table {
88 	__u16 length;
89 	__u8  table[14];
90 };
91 
92 struct efi_info {
93 	__u32 efi_loader_signature;
94 	__u32 efi_systab;
95 	__u32 efi_memdesc_size;
96 	__u32 efi_memdesc_version;
97 	__u32 efi_memmap;
98 	__u32 efi_memmap_size;
99 	__u32 efi_systab_hi;
100 	__u32 efi_memmap_hi;
101 };
102 
103 /* The so-called "zeropage" */
104 struct boot_params {
105 	struct screen_info screen_info;			/* 0x000 */
106 	struct apm_bios_info apm_bios_info;		/* 0x040 */
107 	__u8  _pad2[4];					/* 0x054 */
108 	__u64  tboot_addr;				/* 0x058 */
109 	struct ist_info ist_info;			/* 0x060 */
110 	__u64 acpi_rsdp_addr;				/* 0x070 */
111 	__u8  _pad3[8];					/* 0x078 */
112 	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
113 	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
114 	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
115 	__u8  _pad4[144];				/* 0x0b0 */
116 	struct edid_info edid_info;			/* 0x140 */
117 	struct efi_info efi_info;			/* 0x1c0 */
118 	__u32 alt_mem_k;				/* 0x1e0 */
119 	__u32 scratch;		/* Scratch field! */	/* 0x1e4 */
120 	__u8  e820_entries;				/* 0x1e8 */
121 	__u8  eddbuf_entries;				/* 0x1e9 */
122 	__u8  edd_mbr_sig_buf_entries;			/* 0x1ea */
123 	__u8  _pad6[6];					/* 0x1eb */
124 	struct setup_header hdr;    /* setup header */	/* 0x1f1 */
125 	__u8  _pad7[0x290-0x1f1-sizeof(struct setup_header)];
126 	__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX];	/* 0x290 */
127 	struct e820_entry e820_map[E820MAX];		/* 0x2d0 */
128 	__u8  _pad8[48];				/* 0xcd0 */
129 	struct edd_info eddbuf[EDDMAXNR];		/* 0xd00 */
130 	__u8  _pad9[276];				/* 0xeec */
131 } __attribute__((packed));
132 
133 enum {
134 	X86_SUBARCH_PC = 0,
135 	X86_SUBARCH_LGUEST,
136 	X86_SUBARCH_XEN,
137 	X86_SUBARCH_INTEL_MID,
138 	X86_SUBARCH_CE4100,
139 	X86_NR_SUBARCHS,
140 };
141 #endif /* _ASM_X86_BOOTPARAM_H */
142