Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 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 | |
Simon Glass | 90f2b5a | 2023-03-20 08:30:06 +1300 | [diff] [blame] | 12 | /* setup_data/setup_indirect types */ |
| 13 | #define SETUP_NONE 0 |
| 14 | #define SETUP_E820_EXT 1 |
| 15 | #define SETUP_DTB 2 |
| 16 | #define SETUP_PCI 3 |
| 17 | #define SETUP_EFI 4 |
| 18 | #define SETUP_APPLE_PROPERTIES 5 |
| 19 | #define SETUP_JAILHOUSE 6 |
| 20 | #define SETUP_CC_BLOB 7 |
| 21 | #define SETUP_IMA 8 |
| 22 | #define SETUP_RNG_SEED 9 |
| 23 | #define SETUP_ENUM_MAX SETUP_RNG_SEED |
| 24 | |
| 25 | #define SETUP_INDIRECT BIT(31) |
| 26 | #define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT) |
| 27 | |
| 28 | /* ram_size flags */ |
| 29 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
| 30 | #define RAMDISK_PROMPT_FLAG 0x8000 |
| 31 | #define RAMDISK_LOAD_FLAG 0x4000 |
| 32 | |
| 33 | /* loadflags */ |
| 34 | #define LOADED_HIGH BIT(0) |
| 35 | #define KASLR_FLAG BIT(1) |
| 36 | #define QUIET_FLAG BIT(5) |
| 37 | #define KEEP_SEGMENTS BIT(6) |
| 38 | #define CAN_USE_HEAP BIT(7) |
| 39 | |
| 40 | #define XLF_KERNEL_64 BIT(0) |
| 41 | #define XLF_CAN_BE_LOADED_ABOVE_4G BIT(1) |
| 42 | #define XLF_EFI_HANDOVER_32 BIT(2) |
| 43 | #define XLF_EFI_HANDOVER_64 BIT(3) |
| 44 | #define XLF_EFI_KEXEC BIT(4) |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 45 | |
| 46 | /* extensible setup data list node */ |
| 47 | struct setup_data { |
| 48 | __u64 next; |
| 49 | __u32 type; |
| 50 | __u32 len; |
Simon Glass | 90f2b5a | 2023-03-20 08:30:06 +1300 | [diff] [blame] | 51 | __u8 data[]; |
| 52 | }; |
| 53 | |
| 54 | /* extensible setup indirect data node */ |
| 55 | struct setup_indirect { |
| 56 | __u32 type; |
| 57 | __u32 reserved; /* Reserved, must be set to zero. */ |
| 58 | __u64 len; |
| 59 | __u64 addr; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 60 | }; |
| 61 | |
Simon Glass | 6e04cb7 | 2020-09-05 14:50:37 -0600 | [diff] [blame] | 62 | /** |
| 63 | * struct setup_header - Information needed by Linux to boot |
| 64 | * |
Paul Barker | 0ef6343 | 2023-07-07 07:51:42 +0100 | [diff] [blame] | 65 | * See https://www.kernel.org/doc/html/latest/arch/x86/boot.html |
Simon Glass | 6e04cb7 | 2020-09-05 14:50:37 -0600 | [diff] [blame] | 66 | */ |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 67 | struct setup_header { |
| 68 | __u8 setup_sects; |
| 69 | __u16 root_flags; |
| 70 | __u32 syssize; |
| 71 | __u16 ram_size; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 72 | __u16 vid_mode; |
| 73 | __u16 root_dev; |
| 74 | __u16 boot_flag; |
| 75 | __u16 jump; |
| 76 | __u32 header; |
| 77 | __u16 version; |
| 78 | __u32 realmode_swtch; |
Simon Glass | 90f2b5a | 2023-03-20 08:30:06 +1300 | [diff] [blame] | 79 | __u16 start_sys_seg; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 80 | __u16 kernel_version; |
| 81 | __u8 type_of_loader; |
| 82 | __u8 loadflags; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 83 | __u16 setup_move_size; |
| 84 | __u32 code32_start; |
| 85 | __u32 ramdisk_image; |
| 86 | __u32 ramdisk_size; |
Simon Glass | 6e04cb7 | 2020-09-05 14:50:37 -0600 | [diff] [blame] | 87 | __u32 bootsect_kludge; /* Obsolete */ |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 88 | __u16 heap_end_ptr; |
| 89 | __u8 ext_loader_ver; |
| 90 | __u8 ext_loader_type; |
| 91 | __u32 cmd_line_ptr; |
| 92 | __u32 initrd_addr_max; |
| 93 | __u32 kernel_alignment; |
| 94 | __u8 relocatable_kernel; |
Simon Glass | 90f2b5a | 2023-03-20 08:30:06 +1300 | [diff] [blame] | 95 | __u8 min_alignment; |
| 96 | __u16 xloadflags; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 97 | __u32 cmdline_size; |
| 98 | __u32 hardware_subarch; |
| 99 | __u64 hardware_subarch_data; |
| 100 | __u32 payload_offset; |
| 101 | __u32 payload_length; |
| 102 | __u64 setup_data; |
Stefan Roese | 88d915b | 2016-09-30 09:15:59 +0200 | [diff] [blame] | 103 | __u64 pref_address; |
| 104 | __u32 init_size; |
| 105 | __u32 handover_offset; |
Simon Glass | 90f2b5a | 2023-03-20 08:30:06 +1300 | [diff] [blame] | 106 | __u32 kernel_info_offset; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 107 | } __attribute__((packed)); |
| 108 | |
| 109 | struct sys_desc_table { |
| 110 | __u16 length; |
| 111 | __u8 table[14]; |
| 112 | }; |
| 113 | |
| 114 | struct efi_info { |
| 115 | __u32 efi_loader_signature; |
| 116 | __u32 efi_systab; |
| 117 | __u32 efi_memdesc_size; |
| 118 | __u32 efi_memdesc_version; |
| 119 | __u32 efi_memmap; |
| 120 | __u32 efi_memmap_size; |
| 121 | __u32 efi_systab_hi; |
| 122 | __u32 efi_memmap_hi; |
| 123 | }; |
| 124 | |
| 125 | /* The so-called "zeropage" */ |
| 126 | struct boot_params { |
| 127 | struct screen_info screen_info; /* 0x000 */ |
| 128 | struct apm_bios_info apm_bios_info; /* 0x040 */ |
| 129 | __u8 _pad2[4]; /* 0x054 */ |
| 130 | __u64 tboot_addr; /* 0x058 */ |
| 131 | struct ist_info ist_info; /* 0x060 */ |
Andy Shevchenko | d905aa8 | 2019-09-13 18:42:00 +0300 | [diff] [blame] | 132 | __u64 acpi_rsdp_addr; /* 0x070 */ |
| 133 | __u8 _pad3[8]; /* 0x078 */ |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 134 | __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ |
| 135 | __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ |
| 136 | struct sys_desc_table sys_desc_table; /* 0x0a0 */ |
| 137 | __u8 _pad4[144]; /* 0x0b0 */ |
| 138 | struct edid_info edid_info; /* 0x140 */ |
| 139 | struct efi_info efi_info; /* 0x1c0 */ |
| 140 | __u32 alt_mem_k; /* 0x1e0 */ |
| 141 | __u32 scratch; /* Scratch field! */ /* 0x1e4 */ |
| 142 | __u8 e820_entries; /* 0x1e8 */ |
| 143 | __u8 eddbuf_entries; /* 0x1e9 */ |
| 144 | __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ |
| 145 | __u8 _pad6[6]; /* 0x1eb */ |
| 146 | struct setup_header hdr; /* setup header */ /* 0x1f1 */ |
| 147 | __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; |
| 148 | __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ |
Bin Meng | 4551992 | 2018-04-11 22:02:11 -0700 | [diff] [blame] | 149 | struct e820_entry e820_map[E820MAX]; /* 0x2d0 */ |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 150 | __u8 _pad8[48]; /* 0xcd0 */ |
| 151 | struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ |
| 152 | __u8 _pad9[276]; /* 0xeec */ |
| 153 | } __attribute__((packed)); |
| 154 | |
| 155 | enum { |
| 156 | X86_SUBARCH_PC = 0, |
| 157 | X86_SUBARCH_LGUEST, |
| 158 | X86_SUBARCH_XEN, |
Andy Shevchenko | 7cbaddd | 2017-01-08 23:51:04 +0300 | [diff] [blame] | 159 | X86_SUBARCH_INTEL_MID, |
| 160 | X86_SUBARCH_CE4100, |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 161 | X86_NR_SUBARCHS, |
| 162 | }; |
Graeme Russ | 95ffaba | 2010-04-24 00:05:49 +1000 | [diff] [blame] | 163 | #endif /* _ASM_X86_BOOTPARAM_H */ |