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