1 #ifndef _MACHINE_MULTIBOOT_H /* LSC: FIXME: In MINIX this header is included everywhere... */
2 #define _MACHINE_MULTIBOOT_H 1
4 /* $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $ */
7 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
10 * This code is derived from software contributed to The NetBSD Foundation
11 * by Julio M. Merino Vidal.
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
35 /* --------------------------------------------------------------------- */
38 * Multiboot header structure.
40 #define MULTIBOOT_HEADER_MAGIC 0x1BADB002
41 #define MULTIBOOT_HEADER_MODS_ALIGNED 0x00000001
42 #define MULTIBOOT_HEADER_WANT_MEMORY 0x00000002
43 #define MULTIBOOT_HEADER_HAS_VBE 0x00000004
44 #define MULTIBOOT_HEADER_HAS_ADDR 0x00010000
46 #if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
50 #include <machine/types.h>
52 struct multiboot_header
{
57 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
58 paddr_t mh_header_addr
;
60 paddr_t mh_load_end_addr
;
61 paddr_t mh_bss_end_addr
;
62 paddr_t mh_entry_addr
;
64 /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
65 uint32_t mh_mode_type
;
70 #endif /* !defined(_LOCORE) */
73 * Symbols defined in locore.S.
75 #if !defined(_LOCORE) && defined(_KERNEL)
76 extern struct multiboot_header
*Multiboot_Header
;
77 #endif /* !defined(_LOCORE) && defined(_KERNEL) */
79 #endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
81 /* --------------------------------------------------------------------- */
84 * Multiboot information structure.
86 #define MULTIBOOT_INFO_MAGIC 0x2BADB002
87 #define MULTIBOOT_INFO_HAS_MEMORY 0x00000001
88 #define MULTIBOOT_INFO_HAS_BOOT_DEVICE 0x00000002
89 #define MULTIBOOT_INFO_HAS_CMDLINE 0x00000004
90 #define MULTIBOOT_INFO_HAS_MODS 0x00000008
91 #define MULTIBOOT_INFO_HAS_AOUT_SYMS 0x00000010
92 #define MULTIBOOT_INFO_HAS_ELF_SYMS 0x00000020
93 #define MULTIBOOT_INFO_HAS_MMAP 0x00000040
94 #define MULTIBOOT_INFO_HAS_DRIVES 0x00000080
95 #define MULTIBOOT_INFO_HAS_CONFIG_TABLE 0x00000100
96 #define MULTIBOOT_INFO_HAS_LOADER_NAME 0x00000200
97 #define MULTIBOOT_INFO_HAS_APM_TABLE 0x00000400
98 #define MULTIBOOT_INFO_HAS_VBE 0x00000800
100 #if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
102 #if !defined(_LOCORE)
103 struct multiboot_info
{
106 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
107 uint32_t mi_mem_lower
;
108 uint32_t mi_mem_upper
;
110 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
111 uint8_t mi_boot_device_part3
;
112 uint8_t mi_boot_device_part2
;
113 uint8_t mi_boot_device_part1
;
114 uint8_t mi_boot_device_drive
;
116 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
119 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
120 uint32_t mi_mods_count
;
121 vaddr_t mi_mods_addr
;
123 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
124 uint32_t mi_elfshdr_num
;
125 uint32_t mi_elfshdr_size
;
126 vaddr_t mi_elfshdr_addr
;
127 uint32_t mi_elfshdr_shndx
;
129 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
130 uint32_t mi_mmap_length
;
131 vaddr_t mi_mmap_addr
;
133 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
134 uint32_t mi_drives_length
;
135 vaddr_t mi_drives_addr
;
137 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
138 void * unused_mi_config_table
;
140 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
141 char * mi_loader_name
;
143 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
144 void * unused_mi_apm_table
;
146 /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
147 void * unused_mi_vbe_control_info
;
148 void * unused_mi_vbe_mode_info
;
149 paddr_t unused_mi_vbe_interface_seg
;
150 paddr_t unused_mi_vbe_interface_off
;
151 uint32_t unused_mi_vbe_interface_len
;
154 /* --------------------------------------------------------------------- */
157 * Drive information. This describes an entry in the drives table as
158 * pointed to by mi_drives_addr.
160 struct multiboot_drive
{
164 uint16_t md_cylinders
;
168 /* The variable-sized 'ports' field comes here, so this structure
172 /* --------------------------------------------------------------------- */
175 * Memory mapping. This describes an entry in the memory mappings table
176 * as pointed to by mi_mmap_addr.
178 * Be aware that mm_size specifies the size of all other fields *except*
179 * for mm_size. In order to jump between two different entries, you
180 * have to count mm_size + 4 bytes.
182 struct multiboot_mmap
{
184 uint64_t mm_base_addr
;
190 * Modules. This describes an entry in the modules table as pointed
191 * to by mi_mods_addr.
194 struct multiboot_module
{
198 uint32_t mmo_reserved
;
201 #endif /* !defined(_LOCORE) */
203 #endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
208 typedef struct multiboot_info multiboot_info_t
;
209 typedef struct multiboot_module multiboot_module_t
;
210 typedef struct multiboot_mmap multiboot_memory_map_t
;
213 #define MULTIBOOT_MEMORY_AVAILABLE 1
214 #define MULTIBOOT_MAX_MODS 20
216 #define mod_start mmo_start
217 #define mod_end mmo_end
219 #define mmap_addr mi_mmap_addr
220 #define mmap_length mi_mmap_length
222 #define MULTIBOOT_VIDEO_MODE 0x00000004
223 #define MULTIBOOT_VIDEO_MODE_EGA 1
224 #define MULTIBOOT_VIDEO_BUFFER 0xB8000
226 #define MULTIBOOT_CONSOLE_LINES 25
227 #define MULTIBOOT_CONSOLE_COLS 80
229 #define MULTIBOOT_PARAM_BUF_SIZE 1024
230 #endif /* defined(__minix) */
232 /* --------------------------------------------------------------------- */
235 * Prototypes for public functions defined in multiboot.c.
237 #if !defined(_LOCORE) && defined(_KERNEL)
238 void multiboot_pre_reloc(struct multiboot_info
*);
239 void multiboot_post_reloc(void);
240 void multiboot_print_info(void);
241 bool multiboot_ksyms_addsyms_elf(void);
242 #endif /* !defined(_LOCORE) */
244 /* --------------------------------------------------------------------- */
246 #endif /* _MACHINE_MULTIBOOT_H */