locale.library: fix preferred2ondisk conversion to iterate over the whole array
[AROS.git] / compiler / include / aros / multiboot.h
blob0395457ee23b0b02d301e4bac184e0662bdb2a72
1 /*
2 Copyright © 2002-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Multiboot information structures
6 Lang: english
7 */
9 #ifndef _MB_H
10 #define _MB_H
12 #include <aros/cpu.h> /* For __WORDSIZE */
13 #include <hardware/vbe.h>
15 #if (__WORDSIZE == 64)
16 #ifndef MULTIBOOT_64BIT
19 * Define this in your code if you want to build 32-bit code using full 64-bit pointers.
20 * Useful for building pc-x86_64 bootstrap which runs in 32 bit mode.
22 #define MULTIBOOT_64BIT
24 #endif
25 #endif
27 struct multiboot_header
29 unsigned int magic; /* MB_MAGIC */
30 unsigned int flags; /* See below */
31 unsigned int chksum;
33 unsigned int header_addr;
34 unsigned int load_addr;
35 unsigned int load_end_addr;
36 unsigned int bss_end_addr;
37 unsigned int entry_addr;
39 /* Preferred video mode */
40 unsigned int mode_type;
41 unsigned int width;
42 unsigned int height;
43 unsigned int depth;
46 #define MB_MAGIC 0x1BADB002
48 /* Header flags */
49 #define MB_PAGE_ALIGN 0x00000001 /* Align modules to page boundary */
50 #define MB_MEMORY_INFO 0x00000002 /* We request memory information */
51 #define MB_VIDEO_MODE 0x00000004 /* We specify preferred video mode information */
52 #define MB_AOUT_KLUDGE 0x00010000
54 /* This is passed in by the bootloader */
55 #define MB_STARTUP_MAGIC 0x2BADB002
57 /* Structure passed from bootloader */
58 struct multiboot
60 unsigned int flags; /* See below */
61 unsigned int mem_lower; /* Low memory size */
62 unsigned int mem_upper; /* Upper memory size */
63 unsigned int bootdev; /* Boot device, int13h encoding */
64 unsigned int cmdline; /* 32-bit pointer to a command line string */
65 unsigned int mods_count; /* Number of modules */
66 unsigned int mods_addr; /* 32-bit pointer to module descriptors table */
67 unsigned int elf_num; /* Copy of ELF section header */
68 unsigned int elf_size;
69 unsigned int elf_addr;
70 unsigned int elf_shndx;
71 unsigned int mmap_length; /* Length of memory map in bytes */
72 unsigned int mmap_addr; /* 32-bit pointer to memory map */
73 unsigned int drives_length; /* Size of drives table in bytes */
74 unsigned int drives_addr; /* 32-bit pointer to drives table */
75 unsigned int config_table; /* 32-bit pointer to ROM configuration table */
76 unsigned int loader_name; /* 32-bit pointer to bootloader name string */
77 unsigned int apm_table; /* 32-bit pointer to APM data table */
78 unsigned int vbe_control_info; /* 32-bit pointer to VESA controller descriptor */
79 unsigned int vbe_mode_info; /* 32-bit pointer to VESA mode descriptor */
80 unsigned short vbe_mode; /* Current VESA video mode */
81 unsigned short vbe_if_seg; /* VBE protected mode interface */
82 unsigned short vbe_if_off;
83 unsigned short vbe_if_len;
84 #ifdef MULTIBOOT_64BIT
85 unsigned long long framebuffer_addr; /* Framebuffer address, 64-bit pointer */
86 #else
87 unsigned int framebuffer_addr;
88 unsigned int framebuffer_addr_high;
89 #endif
90 unsigned int framebuffer_pitch;
91 unsigned int framebuffer_width;
92 unsigned int framebuffer_height;
93 unsigned char framebuffer_bpp;
94 unsigned char framebuffer_type;
95 union
97 struct
99 unsigned int framebuffer_palette_addr;
100 unsigned short framebuffer_palette_num_colors;
102 struct
104 unsigned char framebuffer_red_field_position;
105 unsigned char framebuffer_red_mask_size;
106 unsigned char framebuffer_green_field_position;
107 unsigned char framebuffer_green_mask_size;
108 unsigned char framebuffer_blue_field_position;
109 unsigned char framebuffer_blue_mask_size;
114 /* flags */
115 #define MB_FLAGS_MEM 1
116 #define MB_FLAGS_BOOTDEV 2
117 #define MB_FLAGS_CMDLINE 4
118 #define MB_FLAGS_MODS 8
119 #define MB_FLAGS_AOUT 16
120 #define MB_FLAGS_ELF 32
121 #define MB_FLAGS_MMAP 64
122 #define MB_FLAGS_DRIVES 128
123 #define MB_FLAGS_CFGTBL 256
124 #define MB_FLAGS_LDRNAME 512
125 #define MB_FLAGS_APMTBL 1024
126 #define MB_FLAGS_GFX 2048
127 #define MB_FLAGS_FB 4096
129 /* framebuffer_type */
130 #define MB_FRAMEBUFFER_LUT 0
131 #define MB_FRAMEBUFFER_RGB 1
132 #define MB_FRAMEBUFFER_TEXT 2
134 struct mb_mmap
136 unsigned int size; /* Entry size (not including this field) */
137 #ifdef MULTIBOOT_64BIT
138 unsigned long long addr; /* Full 64-bit address and length */
139 unsigned long long len;
140 #else
141 unsigned int addr;
142 unsigned int addr_high;
143 unsigned int len;
144 unsigned int len_high;
145 #endif
146 unsigned int type; /* Entry type, see below */
147 } __attribute((packed));
149 /* Memory map entry types */
150 #define MMAP_TYPE_RAM 1 /* General purpose RAM */
151 #define MMAP_TYPE_RESERVED 2
152 #define MMAP_TYPE_ACPIDATA 3
153 #define MMAP_TYPE_ACPINVS 4
155 /* Disk drive information from PC BIOS */
156 struct mb_drive
158 unsigned int size;
159 unsigned char number;
160 unsigned char mode;
161 unsigned short cyls;
162 unsigned char heads;
163 unsigned char secs;
164 unsigned short ports[10]; /* Ugly, needs to be fixed */
167 /* Drive mode */
168 #define MB_MODE_CHS 0
169 #define MB_MODE_LBA 1
171 /* Modules list */
172 struct mb_module
174 unsigned int mod_start; /* from bytes */
175 unsigned int mod_end; /* to 'mod_end-1' inclusive */
176 unsigned int cmdline; /* Module command line */
177 unsigned int pad; /* padding to take it to 16 bytes (must be zero) */
180 #endif /* _MB_H */