Home | History | Annotate | Download | only in bootstub
      1 /* bootparms.h base on Linux kernel include/asm-x86/bootparam.h */
      2 
      3 #include "types.h"
      4 
      5 #define EDD_MBR_SIG_MAX 16
      6 #define E820MAX 128
      7 #define EDDMAXNR 6
      8 
      9 /* extensible setup data list node */
     10 struct setup_data {
     11 	__u64 next;
     12 	__u32 type;
     13 	__u32 len;
     14 	__u8 data[0];
     15 };
     16 
     17 struct screen_info {
     18 	__u8  orig_x;	   /* 0x00 */
     19 	__u8  orig_y;	   /* 0x01 */
     20 	__u16 ext_mem_k;	/* 0x02 */
     21 	__u16 orig_video_page;  /* 0x04 */
     22 	__u8  orig_video_mode;  /* 0x06 */
     23 	__u8  orig_video_cols;  /* 0x07 */
     24 	__u16 unused2;	  /* 0x08 */
     25 	__u16 orig_video_ega_bx;/* 0x0a */
     26 	__u16 unused3;	  /* 0x0c */
     27 	__u8  orig_video_lines; /* 0x0e */
     28 	__u8  orig_video_isVGA; /* 0x0f */
     29 	__u16 orig_video_points;/* 0x10 */
     30 
     31 	/* VESA graphic mode -- linear frame buffer */
     32 	__u16 lfb_width;	/* 0x12 */
     33 	__u16 lfb_height;       /* 0x14 */
     34 	__u16 lfb_depth;	/* 0x16 */
     35 	__u32 lfb_base;	 /* 0x18 */
     36 	__u32 lfb_size;	 /* 0x1c */
     37 	__u16 cl_magic, cl_offset; /* 0x20 */
     38 	__u16 lfb_linelength;   /* 0x24 */
     39 	__u8  red_size;	 /* 0x26 */
     40 	__u8  red_pos;	  /* 0x27 */
     41 	__u8  green_size;       /* 0x28 */
     42 	__u8  green_pos;	/* 0x29 */
     43 	__u8  blue_size;	/* 0x2a */
     44 	__u8  blue_pos;	 /* 0x2b */
     45 	__u8  rsvd_size;	/* 0x2c */
     46 	__u8  rsvd_pos;	 /* 0x2d */
     47 	__u16 vesapm_seg;       /* 0x2e */
     48 	__u16 vesapm_off;       /* 0x30 */
     49 	__u16 pages;	    /* 0x32 */
     50 	__u16 vesa_attributes;  /* 0x34 */
     51 	__u32 capabilities;     /* 0x36 */
     52 	__u8  _reserved[6];     /* 0x3a */
     53 } __attribute__((packed));
     54 
     55 struct apm_bios_info {
     56 	__u16   version;
     57 	__u16   cseg;
     58 	__u32   offset;
     59 	__u16   cseg_16;
     60 	__u16   dseg;
     61 	__u16   flags;
     62 	__u16   cseg_len;
     63 	__u16   cseg_16_len;
     64 	__u16   dseg_len;
     65 };
     66 
     67 struct ist_info {
     68 	__u32 signature;
     69 	__u32 command;
     70 	__u32 event;
     71 	__u32 perf_level;
     72 };
     73 
     74 struct sys_desc_table {
     75 	__u16 length;
     76 	__u8  table[14];
     77 };
     78 
     79 struct efi_info {
     80 	__u32 efi_loader_signature;
     81 	__u32 efi_systab;
     82 	__u32 efi_memdesc_size;
     83 	__u32 efi_memdesc_version;
     84 	__u32 efi_memmap;
     85 	__u32 efi_memmap_size;
     86 	__u32 efi_systab_hi;
     87 	__u32 efi_memmap_hi;
     88 };
     89 
     90 struct setup_header {
     91 	__u8	setup_sects;
     92 	__u16	root_flags;
     93 	__u32	syssize;
     94 	__u16	ram_size;
     95 	__u16	vid_mode;
     96 	__u16	root_dev;
     97 	__u16	boot_flag;
     98 	__u16	jump;
     99 	__u32	header;
    100 	__u16	version;
    101 	__u32	realmode_swtch;
    102 	__u16	start_sys;
    103 	__u16	kernel_version;
    104 	__u8	type_of_loader;
    105 	__u8	loadflags;
    106 	__u16	setup_move_size;
    107 	__u32	code32_start;
    108 	__u32	ramdisk_image;
    109 	__u32	ramdisk_size;
    110 	__u32	bootsect_kludge;
    111 	__u16	heap_end_ptr;
    112 	__u16	_pad1;
    113 	__u32	cmd_line_ptr;
    114 	__u32	initrd_addr_max;
    115 	__u32	kernel_alignment;
    116 	__u8	relocatable_kernel;
    117 	__u8	_pad2[3];
    118 	__u32	cmdline_size;
    119 	__u32	hardware_subarch;
    120 	__u64	hardware_subarch_data;
    121 	__u32	payload_offset;
    122 	__u32	payload_length;
    123 	__u64	setup_data;
    124 } __attribute__((packed));
    125 
    126 struct edid_info {
    127 	unsigned char dummy[128];
    128 };
    129 
    130 struct e820entry {
    131 	__u64 addr;     /* start of memory segment */
    132 	__u64 size;     /* size of memory segment */
    133 	__u32 type;     /* type of memory segment */
    134 } __attribute__((packed));
    135 
    136 struct edd_device_params {
    137 	__u16 length;
    138 	__u16 info_flags;
    139 	__u32 num_default_cylinders;
    140 	__u32 num_default_heads;
    141 	__u32 sectors_per_track;
    142 	__u64 number_of_sectors;
    143 	__u16 bytes_per_sector;
    144 	__u32 dpte_ptr;	 /* 0xFFFFFFFF for our purposes */
    145 	__u16 key;	      /* = 0xBEDD */
    146 	__u8 device_path_info_length;   /* = 44 */
    147 	__u8 reserved2;
    148 	__u16 reserved3;
    149 	__u8 host_bus_type[4];
    150 	__u8 interface_type[8];
    151 	union {
    152 		struct {
    153 			__u16 base_address;
    154 			__u16 reserved1;
    155 			__u32 reserved2;
    156 		} __attribute__ ((packed)) isa;
    157 		struct {
    158 			__u8 bus;
    159 			__u8 slot;
    160 			__u8 function;
    161 			__u8 channel;
    162 			__u32 reserved;
    163 		} __attribute__ ((packed)) pci;
    164 		/* pcix is same as pci */
    165 		struct {
    166 			__u64 reserved;
    167 		} __attribute__ ((packed)) ibnd;
    168 		struct {
    169 			__u64 reserved;
    170 		} __attribute__ ((packed)) xprs;
    171 		struct {
    172 			__u64 reserved;
    173 		} __attribute__ ((packed)) htpt;
    174 		struct {
    175 			__u64 reserved;
    176 		} __attribute__ ((packed)) unknown;
    177 	} interface_path;
    178 	union {
    179 		struct {
    180 			__u8 device;
    181 			__u8 reserved1;
    182 			__u16 reserved2;
    183 			__u32 reserved3;
    184 			__u64 reserved4;
    185 		} __attribute__ ((packed)) ata;
    186 		struct {
    187 			__u8 device;
    188 			__u8 lun;
    189 			__u8 reserved1;
    190 			__u8 reserved2;
    191 			__u32 reserved3;
    192 			__u64 reserved4;
    193 		} __attribute__ ((packed)) atapi;
    194 		struct {
    195 			__u16 id;
    196 			__u64 lun;
    197 			__u16 reserved1;
    198 			__u32 reserved2;
    199 		} __attribute__ ((packed)) scsi;
    200 		struct {
    201 			__u64 serial_number;
    202 			__u64 reserved;
    203 		} __attribute__ ((packed)) usb;
    204 		struct {
    205 			__u64 eui;
    206 			__u64 reserved;
    207 		} __attribute__ ((packed)) i1394;
    208 		struct {
    209 			__u64 wwid;
    210 			__u64 lun;
    211 		} __attribute__ ((packed)) fibre;
    212 		struct {
    213 			__u64 identity_tag;
    214 			__u64 reserved;
    215 		} __attribute__ ((packed)) i2o;
    216 	       struct {
    217 			__u32 array_number;
    218 			__u32 reserved1;
    219 			__u64 reserved2;
    220 		} __attribute__ ((packed)) raid;
    221 		struct {
    222 			__u8 device;
    223 			__u8 reserved1;
    224 			__u16 reserved2;
    225 			__u32 reserved3;
    226 			__u64 reserved4;
    227 		} __attribute__ ((packed)) sata;
    228 		struct {
    229 			__u64 reserved1;
    230 			__u64 reserved2;
    231 		} __attribute__ ((packed)) unknown;
    232 	} device_path;
    233 	__u8 reserved4;
    234 	__u8 checksum;
    235 } __attribute__ ((packed));
    236 
    237 struct edd_info {
    238 	__u8 device;
    239 	__u8 version;
    240 	__u16 interface_support;
    241 	__u16 legacy_max_cylinder;
    242 	__u8 legacy_max_head;
    243 	__u8 legacy_sectors_per_track;
    244 	struct edd_device_params params;
    245 } __attribute__ ((packed));
    246 
    247 /* The so-called "zeropage" */
    248 struct boot_params {
    249 	struct screen_info screen_info;			/* 0x000 */
    250 	struct apm_bios_info apm_bios_info;		/* 0x040 */
    251 	__u8  _pad2[12];				/* 0x054 */
    252 	struct ist_info ist_info;			/* 0x060 */
    253 	__u8  _pad3[16];				/* 0x070 */
    254 	__u8  hd0_info[16];	/* obsolete! */		/* 0x080 */
    255 	__u8  hd1_info[16];	/* obsolete! */		/* 0x090 */
    256 	struct sys_desc_table sys_desc_table;		/* 0x0a0 */
    257 	__u8  _pad4[144];				/* 0x0b0 */
    258 	struct edid_info edid_info;			/* 0x140 */
    259 	struct efi_info efi_info;			/* 0x1c0 */
    260 	__u32 alt_mem_k;				/* 0x1e0 */
    261 	__u32 scratch;		/* Scratch field! */	/* 0x1e4 */
    262 	__u8  e820_entries;				/* 0x1e8 */
    263 	__u8  eddbuf_entries;				/* 0x1e9 */
    264 	__u8  edd_mbr_sig_buf_entries;			/* 0x1ea */
    265 	__u8  _pad6[6];					/* 0x1eb */
    266 	struct setup_header hdr;    /* setup header */	/* 0x1f1 */
    267 	__u8  _pad7[0x290-0x1f1-sizeof(struct setup_header)];
    268 	__u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX];	/* 0x290 */
    269 	struct e820entry e820_map[E820MAX];		/* 0x2d0 */
    270 	__u8  _pad8[48];				/* 0xcd0 */
    271 	struct edd_info eddbuf[EDDMAXNR];		/* 0xd00 */
    272 	__u8  _pad9[276];				/* 0xeec */
    273 } __attribute__((packed));
    274 #define X86_SUBARCH_PC			0
    275 #define X86_SUBARCH_LGUEST 		1
    276 #define X86_SUBARCH_XEN			2
    277 #define X86_SUBARCH_MRST		3
    278 
    279