Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / i386 / multiboot.h @ 13

History | View | Annotate | Download (8.22 KB)

1
#ifndef _MACHINE_MULTIBOOT_H /* LSC: FIXME: In MINIX this header is included everywhere... */
2
#define _MACHINE_MULTIBOOT_H 1
3

    
4
/*        $NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $        */
5

    
6
/*-
7
 * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
8
 * All rights reserved.
9
 *
10
 * This code is derived from software contributed to The NetBSD Foundation
11
 * by Julio M. Merino Vidal.
12
 *
13
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions
15
 * are met:
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.
21
 *
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.
33
 */
34

    
35
/* --------------------------------------------------------------------- */
36

    
37
/*
38
 * Multiboot header structure.
39
 */
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
45

    
46
#if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
47

    
48
#if !defined(_LOCORE)
49

    
50
#include <machine/types.h>
51

    
52
struct multiboot_header {
53
        uint32_t        mh_magic;
54
        uint32_t        mh_flags;
55
        uint32_t        mh_checksum;
56

    
57
        /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_ADDR. */
58
        paddr_t                mh_header_addr;
59
        paddr_t                mh_load_addr;
60
        paddr_t                mh_load_end_addr;
61
        paddr_t                mh_bss_end_addr;
62
        paddr_t                mh_entry_addr;
63

    
64
        /* Valid if mh_flags sets MULTIBOOT_HEADER_HAS_VBE. */
65
        uint32_t        mh_mode_type;
66
        uint32_t        mh_width;
67
        uint32_t        mh_height;
68
        uint32_t        mh_depth;
69
};
70
#endif /* !defined(_LOCORE) */
71

    
72
/*
73
 * Symbols defined in locore.S.
74
 */
75
#if !defined(_LOCORE) && defined(_KERNEL)
76
extern struct multiboot_header *Multiboot_Header;
77
#endif /* !defined(_LOCORE) && defined(_KERNEL) */
78

    
79
#endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
80

    
81
/* --------------------------------------------------------------------- */
82

    
83
/*
84
 * Multiboot information structure.
85
 */
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
99
#define MULTIBOOT_INFO_HAS_FRAMEBUFFER        0x00001000
100

    
101
#if defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))
102

    
103
#if !defined(_LOCORE)
104
struct multiboot_info {
105
        uint32_t        mi_flags;
106

    
107
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MEMORY. */
108
        uint32_t        mi_mem_lower;
109
        uint32_t        mi_mem_upper;
110

    
111
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_BOOT_DEVICE. */
112
        uint8_t                mi_boot_device_part3;
113
        uint8_t                mi_boot_device_part2;
114
        uint8_t                mi_boot_device_part1;
115
        uint8_t                mi_boot_device_drive;
116

    
117
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CMDLINE. */
118
        char *                mi_cmdline;
119

    
120
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MODS. */
121
        uint32_t        mi_mods_count;
122
        vaddr_t                mi_mods_addr;
123

    
124
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_{AOUT,ELF}_SYMS. */
125
        uint32_t        mi_elfshdr_num;
126
        uint32_t        mi_elfshdr_size;
127
        vaddr_t                mi_elfshdr_addr;
128
        uint32_t        mi_elfshdr_shndx;
129

    
130
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_MMAP. */
131
        uint32_t        mi_mmap_length;
132
        vaddr_t                mi_mmap_addr;
133

    
134
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_DRIVES. */
135
        uint32_t        mi_drives_length;
136
        vaddr_t                mi_drives_addr;
137

    
138
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_CONFIG_TABLE. */
139
        void *                unused_mi_config_table;
140

    
141
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_LOADER_NAME. */
142
        char *                mi_loader_name;
143

    
144
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_APM. */
145
        void *                unused_mi_apm_table;
146

    
147
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
148
        uint32_t vbe_control_info;
149
        uint32_t vbe_mode_info;
150
        uint16_t vbe_mode;
151
        uint16_t vbe_interface_seg;
152
        uint16_t vbe_interface_off;
153
        uint16_t vbe_interface_len;
154

    
155
        /* Valid if mi_flags sets MULTIBOOT_INFO_HAS_FRAMEBUFFER. */
156
        uint64_t framebuffer_addr;
157
        uint32_t framebuffer_pitch;
158
        uint32_t framebuffer_width;
159
        uint32_t framebuffer_height;
160
        uint8_t framebuffer_bpp;
161
#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
162
#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB     1
163
#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT        2
164
        uint8_t framebuffer_type;
165
        union
166
        {
167
                struct
168
                {
169
                        uint32_t framebuffer_palette_addr;
170
                        uint16_t framebuffer_palette_num_colors;
171
                };
172
                struct
173
                {
174
                        uint8_t framebuffer_red_field_position;
175
                        uint8_t framebuffer_red_mask_size;
176
                        uint8_t framebuffer_green_field_position;
177
                        uint8_t framebuffer_green_mask_size;
178
                        uint8_t framebuffer_blue_field_position;
179
                        uint8_t framebuffer_blue_mask_size;
180
            };
181
        };
182
};
183

    
184
/* --------------------------------------------------------------------- */
185

    
186
/*
187
 * Drive information.  This describes an entry in the drives table as
188
 * pointed to by mi_drives_addr.
189
 */
190
struct multiboot_drive {
191
        uint32_t        md_length;
192
        uint8_t                md_number;
193
        uint8_t                md_mode;
194
        uint16_t        md_cylinders;
195
        uint8_t                md_heads;
196
        uint8_t                md_sectors;
197

    
198
        /* The variable-sized 'ports' field comes here, so this structure
199
         * can be longer. */
200
};
201

    
202
/* --------------------------------------------------------------------- */
203

    
204
/*
205
 * Memory mapping.  This describes an entry in the memory mappings table
206
 * as pointed to by mi_mmap_addr.
207
 *
208
 * Be aware that mm_size specifies the size of all other fields *except*
209
 * for mm_size.  In order to jump between two different entries, you
210
 * have to count mm_size + 4 bytes.
211
 */
212
struct multiboot_mmap {
213
        uint32_t        mm_size;
214
        uint64_t        mm_base_addr;
215
        uint64_t        mm_length;
216
        uint32_t        mm_type;
217
};
218

    
219
/*
220
 * Modules. This describes an entry in the modules table as pointed
221
 * to by mi_mods_addr.
222
 */
223

    
224
struct multiboot_module {
225
        uint32_t        mmo_start;
226
        uint32_t        mmo_end;
227
        char *                mmo_string;
228
        uint32_t        mmo_reserved;
229
};
230

    
231
#endif /* !defined(_LOCORE) */
232

    
233
#endif /* defined(__minix) && !defined(__ASSEMBLY__) && (defined(_MINIX_SYSTEM) || defined(_STANDALONE))*/
234

    
235
#if defined(__minix)
236

    
237
#ifndef __ASSEMBLY__
238
typedef struct multiboot_info multiboot_info_t;
239
typedef struct multiboot_module multiboot_module_t;
240
typedef struct multiboot_mmap multiboot_memory_map_t;
241
#endif
242

    
243
#define MULTIBOOT_MEMORY_AVAILABLE              1
244
#define MULTIBOOT_MAX_MODS     20
245

    
246
#define mod_start mmo_start
247
#define mod_end mmo_end
248

    
249
#define mmap_addr mi_mmap_addr
250
#define mmap_length mi_mmap_length
251

    
252
#define MULTIBOOT_VIDEO_MODE 0x00000004
253
#define MULTIBOOT_VIDEO_MODE_EGA 1
254
#define MULTIBOOT_VIDEO_BUFFER 0xB8000
255

    
256
#define MULTIBOOT_CONSOLE_LINES 25
257
#define MULTIBOOT_CONSOLE_COLS 80
258

    
259
#define MULTIBOOT_PARAM_BUF_SIZE 1024
260
#endif /* defined(__minix) */
261

    
262
/* --------------------------------------------------------------------- */
263

    
264
/*
265
 * Prototypes for public functions defined in multiboot.c.
266
 */
267
#if !defined(_LOCORE) && defined(_KERNEL)
268
void                multiboot_pre_reloc(struct multiboot_info *);
269
void                multiboot_post_reloc(void);
270
void                multiboot_print_info(void);
271
bool                multiboot_ksyms_addsyms_elf(void);
272
#endif /* !defined(_LOCORE) */
273

    
274
/* --------------------------------------------------------------------- */
275

    
276
#endif /* _MACHINE_MULTIBOOT_H */