multiboot: disentangle multiboot and multiboot2.
[grub.git] / include / grub / multiboot.h
1 /* multiboot.h - multiboot header file with grub definitions. */
2 /*
3  *  GRUB  --  GRand Unified Bootloader
4  *  Copyright (C) 2003,2007,2008,2010  Free Software Foundation, Inc.
5  *
6  *  GRUB 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 3 of the License, or
9  *  (at your option) any later version.
10  *
11  *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef GRUB_MULTIBOOT_HEADER
21 #define GRUB_MULTIBOOT_HEADER 1
22
23 #include <grub/file.h>
24
25 #include <multiboot.h>
26
27 #include <grub/types.h>
28 #include <grub/err.h>
29
30 typedef enum
31   {
32     GRUB_MULTIBOOT_QUIRKS_NONE = 0,
33     GRUB_MULTIBOOT_QUIRK_BAD_KLUDGE = 1,
34     GRUB_MULTIBOOT_QUIRK_MODULES_AFTER_KERNEL = 2
35   } grub_multiboot_quirks_t;
36 extern grub_multiboot_quirks_t grub_multiboot_quirks;
37
38 extern struct grub_relocator *grub_multiboot_relocator;
39
40 void grub_multiboot (int argc, char *argv[]);
41 void grub_module (int argc, char *argv[]);
42
43 void grub_multiboot_set_accepts_video (int val);
44 grub_err_t grub_multiboot_make_mbi (grub_uint32_t *target);
45 void grub_multiboot_free_mbi (void);
46 grub_err_t grub_multiboot_init_mbi (int argc, char *argv[]);
47 grub_err_t grub_multiboot_add_module (grub_addr_t start, grub_size_t size,
48                                       int argc, char *argv[]);
49 void grub_multiboot_set_bootdev (void);
50 void
51 grub_multiboot_add_elfsyms (grub_size_t num, grub_size_t entsize,
52                             unsigned shndx, void *data);
53
54 grub_uint32_t grub_multiboot_get_mmap_count (void);
55 grub_err_t grub_multiboot_set_video_mode (void);
56
57 /* FIXME: support coreboot as well.  */
58 #if defined (GRUB_MACHINE_PCBIOS)
59 #define GRUB_MACHINE_HAS_VBE 1
60 #else
61 #define GRUB_MACHINE_HAS_VBE 0
62 #endif
63
64 #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
65 #define GRUB_MACHINE_HAS_VGA_TEXT 1
66 #else
67 #define GRUB_MACHINE_HAS_VGA_TEXT 0
68 #endif
69
70 #if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
71 #define GRUB_MACHINE_HAS_ACPI 1
72 #else
73 #define GRUB_MACHINE_HAS_ACPI 0
74 #endif
75
76 #define GRUB_MULTIBOOT_CONSOLE_EGA_TEXT 1
77 #define GRUB_MULTIBOOT_CONSOLE_FRAMEBUFFER 2 
78
79 grub_err_t
80 grub_multiboot_set_console (int console_type, int accepted_consoles,
81                             int width, int height, int depth,
82                             int console_required);
83 grub_err_t
84 grub_multiboot_load (grub_file_t file, const char *filename);
85
86 struct mbi_load_data
87 {
88   grub_file_t file;
89   const char *filename;
90   void *buffer;
91   unsigned int mbi_ver;
92   int relocatable;
93   grub_uint32_t min_addr;
94   grub_uint32_t max_addr;
95   grub_size_t align;
96   grub_uint32_t preference;
97   grub_uint32_t link_base_addr;
98   grub_uint32_t load_base_addr;
99   int avoid_efi_boot_services;
100 };
101 typedef struct mbi_load_data mbi_load_data_t;
102
103 /* Load ELF32 or ELF64.  */
104 grub_err_t
105 grub_multiboot_load_elf (mbi_load_data_t *mld);
106
107 extern grub_size_t grub_multiboot_pure_size;
108 extern grub_size_t grub_multiboot_alloc_mbi;
109 extern grub_uint32_t grub_multiboot_payload_eip;
110
111
112 #endif /* ! GRUB_MULTIBOOT_HEADER */