b75591176eb9d785de3f2867e32edc1b9a626280
[grub.git] / include / grub / autoefi.h
1 /*
2  *  GRUB  --  GRand Unified Bootloader
3  *  Copyright (C) 2009  Free Software Foundation, Inc.
4  *
5  *  GRUB is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  GRUB is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 /* This file provides some abstractions so that the same code compiles with
19    both efi and efiemu
20  */
21 #ifndef GRUB_AUTOEFI_HEADER
22 #define GRUB_AUTOEFI_HEADER     1
23
24
25 #ifdef GRUB_MACHINE_EFI
26 # include <grub/efi/efi.h>
27 # define grub_autoefi_get_memory_map grub_efi_get_memory_map
28 # define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
29 # define grub_autoefi_exit_boot_services grub_efi_exit_boot_services
30 # define grub_autoefi_system_table grub_efi_system_table
31 # define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
32 # define grub_autoefi_set_virtual_address_map grub_efi_set_virtual_address_map
33 static inline grub_err_t grub_autoefi_prepare (void)
34 {
35   return GRUB_ERR_NONE;
36 };
37 # define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
38 # define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
39 # define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
40 # define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
41 # define SYSTEM_TABLE(x) (grub_efi_system_table->x)
42 # define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
43 # define EFI_PRESENT 1
44 #else
45 # include <grub/efiemu/efiemu.h>
46 # define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
47 # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
48 # define grub_autoefi_exit_boot_services grub_efiemu_exit_boot_services
49 # define grub_autoefi_system_table grub_efiemu_system_table
50 # define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
51 # define grub_autoefi_prepare grub_efiemu_prepare
52 # define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
53 # define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
54 # define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
55 # define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR
56 # define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN
57 # define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
58 # define grub_efi_allocate_pages(x,y) (x)
59 # define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
60 # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
61 # define EFI_PRESENT 1
62 #endif
63
64 #endif