Add missing Copyright line, sorry.
[coreboot.git] / src / include / cpu / x86 / multiboot.h
1 /* multiboot.h - multiboot header file. */
2 /*
3  *  Copyright (C) 2003  Free Software Foundation, Inc.
4  *  Copyright (C) 2008  Robert Millan
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2 of the License, or
9  *  (at your option) any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef MULTIBOOT_H
21 #define MULTIBOOT_H
22
23 #include <stdint.h>
24
25 /* How many bytes from the start of the file we search for the header.  */
26 #define MB_SEARCH                 8192
27
28 /* The magic field should contain this.  */
29 #define MB_MAGIC                  0x1BADB002
30
31 /* This should be in %eax.  */
32 #define MB_MAGIC2                 0x2BADB002
33
34 /* The bits in the required part of flags field we don't support.  */
35 #define MB_UNSUPPORTED            0x0000fffc
36
37 /* Alignment of multiboot modules.  */
38 #define MB_MOD_ALIGN              0x00001000
39
40 /*
41  * Flags set in the 'flags' member of the multiboot header.
42  */
43
44 /* Align all boot modules on i386 page (4KB) boundaries.  */
45 #define MB_PAGE_ALIGN           0x00000001
46
47 /* Must pass memory information to OS.  */
48 #define MB_MEMORY_INFO          0x00000002
49
50 /* Must pass video information to OS.  */
51 #define MB_VIDEO_MODE           0x00000004
52
53 /* This flag indicates the use of the address fields in the header.  */
54 #define MB_AOUT_KLUDGE          0x00010000
55
56 /*
57  *  Flags to be set in the 'flags' member of the multiboot info structure.
58  */
59
60 /* is there basic lower/upper memory information? */
61 #define MB_INFO_MEMORY          0x00000001
62 /* is there a boot device set? */
63 #define MB_INFO_BOOTDEV         0x00000002
64 /* is the command-line defined? */
65 #define MB_INFO_CMDLINE         0x00000004
66 /* are there modules to do something with? */
67 #define MB_INFO_MODS            0x00000008
68
69 /* These next two are mutually exclusive */
70
71 /* is there a symbol table loaded? */
72 #define MB_INFO_AOUT_SYMS               0x00000010
73 /* is there an ELF section header table? */
74 #define MB_INFO_ELF_SHDR                0x00000020
75
76 /* is there a full memory map? */
77 #define MB_INFO_MEM_MAP         0x00000040
78
79 /* Is there drive info?  */
80 #define MB_INFO_DRIVE_INFO              0x00000080
81
82 /* Is there a config table?  */
83 #define MB_INFO_CONFIG_TABLE    0x00000100
84
85 /* Is there a boot loader name?  */
86 #define MB_INFO_BOOT_LOADER_NAME        0x00000200
87
88 /* Is there a APM table?  */
89 #define MB_INFO_APM_TABLE               0x00000400
90
91 /* Is there video information?  */
92 #define MB_INFO_VIDEO_INFO              0x00000800
93
94 struct multiboot_header {
95         /* Must be MB_MAGIC - see above.  */
96         uint32_t magic;
97
98         /* Feature flags.  */
99         uint32_t flags;
100
101         /* The above fields plus this one must equal 0 mod 2^32. */
102         uint32_t checksum;
103
104         /* These are only valid if MB_AOUT_KLUDGE is set.  */
105         uint32_t header_addr;
106         uint32_t load_addr;
107         uint32_t load_end_addr;
108         uint32_t bss_end_addr;
109         uint32_t entry_addr;
110
111         /* These are only valid if MB_VIDEO_MODE is set.  */
112         uint32_t mode_type;
113         uint32_t width;
114         uint32_t height;
115         uint32_t depth;
116 };
117
118 struct multiboot_info {
119         /* Multiboot info version number */
120         uint32_t flags;
121
122         /* Available memory from BIOS */
123         uint32_t mem_lower;
124         uint32_t mem_upper;
125
126         /* "root" partition */
127         uint32_t boot_device;
128
129         /* Kernel command line */
130         uint32_t cmdline;
131
132         /* Boot-Module list */
133         uint32_t mods_count;
134         uint32_t mods_addr;
135
136         uint32_t syms[4];
137
138         /* Memory Mapping buffer */
139         uint32_t mmap_length;
140         uint32_t mmap_addr;
141
142         /* Drive Info buffer */
143         uint32_t drives_length;
144         uint32_t drives_addr;
145
146         /* ROM configuration table */
147         uint32_t config_table;
148
149         /* Boot Loader Name */
150         uint32_t boot_loader_name;
151
152         /* APM table */
153         uint32_t apm_table;
154
155         /* Video */
156         uint32_t vbe_control_info;
157         uint32_t vbe_mode_info;
158         uint16_t vbe_mode;
159         uint16_t vbe_interface_seg;
160         uint16_t vbe_interface_off;
161         uint16_t vbe_interface_len;
162 };
163
164 struct multiboot_mmap_entry {
165         uint32_t size;
166         uint64_t addr;
167         uint64_t len;
168         uint32_t type;
169 } __attribute__ ((packed));
170
171 extern struct multiboot_info *mbi;
172
173 unsigned long  write_multiboot_info(unsigned long, unsigned long, unsigned long, unsigned long);
174
175 #endif