Add a file missing in multiboot2 commit.
[grub.git] / include / grub / multiboot2.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_MULTIBOOT2_HEADER
21 #define GRUB_MULTIBOOT2_HEADER 1
22
23 #include <grub/file.h>
24
25 #include <multiboot2.h>
26
27 #include <grub/types.h>
28 #include <grub/err.h>
29
30 extern struct grub_relocator *grub_multiboot2_relocator;
31
32 void grub_multiboot2 (int argc, char *argv[]);
33 void grub_module2 (int argc, char *argv[]);
34
35 void grub_multiboot2_set_accepts_video (int val);
36 grub_err_t grub_multiboot2_make_mbi (grub_uint32_t *target);
37 void grub_multiboot2_free_mbi (void);
38 grub_err_t grub_multiboot2_init_mbi (int argc, char *argv[]);
39 grub_err_t grub_multiboot2_add_module (grub_addr_t start, grub_size_t size,
40                                       int argc, char *argv[]);
41 void grub_multiboot2_set_bootdev (void);
42 void
43 grub_multiboot2_add_elfsyms (grub_size_t num, grub_size_t entsize,
44                             unsigned shndx, void *data);
45
46 grub_uint32_t grub_multiboot2_get_mmap_count (void);
47 grub_err_t grub_multiboot2_set_video_mode (void);
48
49 /* FIXME: support coreboot as well.  */
50 #if defined (GRUB_MACHINE_PCBIOS)
51 #define GRUB_MACHINE_HAS_VBE 1
52 #else
53 #define GRUB_MACHINE_HAS_VBE 0
54 #endif
55
56 #if defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT) || defined (GRUB_MACHINE_QEMU)
57 #define GRUB_MACHINE_HAS_VGA_TEXT 1
58 #else
59 #define GRUB_MACHINE_HAS_VGA_TEXT 0
60 #endif
61
62 #if defined (GRUB_MACHINE_EFI) || defined (GRUB_MACHINE_PCBIOS) || defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_MULTIBOOT)
63 #define GRUB_MACHINE_HAS_ACPI 1
64 #else
65 #define GRUB_MACHINE_HAS_ACPI 0
66 #endif
67
68 #define GRUB_MULTIBOOT2_CONSOLE_EGA_TEXT 1
69 #define GRUB_MULTIBOOT2_CONSOLE_FRAMEBUFFER 2 
70
71 grub_err_t
72 grub_multiboot2_set_console (int console_type, int accepted_consoles,
73                             int width, int height, int depth,
74                             int console_required);
75 grub_err_t
76 grub_multiboot2_load (grub_file_t file, const char *filename);
77
78 struct mbi_load_data
79 {
80   grub_file_t file;
81   const char *filename;
82   void *buffer;
83   unsigned int mbi_ver;
84   int relocatable;
85   grub_uint32_t min_addr;
86   grub_uint32_t max_addr;
87   grub_size_t align;
88   grub_uint32_t preference;
89   grub_uint32_t link_base_addr;
90   grub_uint32_t load_base_addr;
91   int avoid_efi_boot_services;
92 };
93 typedef struct mbi_load_data mbi_load_data_t;
94
95 /* Load ELF32 or ELF64.  */
96 grub_err_t
97 grub_multiboot2_load_elf (mbi_load_data_t *mld);
98
99 extern grub_size_t grub_multiboot2_pure_size;
100 extern grub_size_t grub_multiboot2_alloc_mbi;
101 extern grub_uint32_t grub_multiboot2_payload_eip;
102
103
104 #endif /* ! GRUB_MULTIBOOT_HEADER */