2009-11-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
[grub2/jjazz.git] / include / grub / autoefi.h
blob4acd43965b46c1f6b36ded8775e9d61b218c5767
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2009 Free Software Foundation, Inc.
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.
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.
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/>.
18 /* This file provides some abstractions so that the same code compiles with
19 both efi and efiemu
21 #ifndef GRUB_AUTOEFI_HEADER
22 #define GRUB_AUTOEFI_HEADER 1
24 #include <grub/machine/machine.h>
26 #ifdef GRUB_MACHINE_EFI
27 # include <grub/efi/efi.h>
28 # define grub_autoefi_get_memory_map grub_efi_get_memory_map
29 # define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
30 # define grub_autoefi_system_table grub_efi_system_table
31 # define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
32 static inline grub_err_t grub_autoefi_prepare (void)
34 return GRUB_ERR_NONE;
36 # define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_MACHINE_MEMORY_AVAILABLE
37 # define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_MACHINE_MEMORY_RESERVED
38 # ifdef GRUB_MACHINE_MEMORY_ACPI
39 # define GRUB_AUTOEFI_MEMORY_ACPI GRUB_MACHINE_MEMORY_ACPI
40 # endif
41 # ifdef GRUB_MACHINE_MEMORY_NVS
42 # define GRUB_AUTOEFI_MEMORY_NVS GRUB_MACHINE_MEMORY_NVS
43 # endif
44 # ifdef GRUB_MACHINE_MEMORY_CODE
45 # define GRUB_AUTOEFI_MEMORY_CODE GRUB_MACHINE_MEMORY_CODE
46 # endif
47 # define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
48 # define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
49 # define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
50 # define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
51 # define SYSTEM_TABLE(x) (grub_efi_system_table->x)
52 # define EFI_PRESENT 1
53 #else
54 # include <grub/efiemu/efiemu.h>
55 # define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
56 # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
57 # define grub_autoefi_system_table grub_efiemu_system_table
58 # define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
59 # define grub_autoefi_prepare grub_efiemu_prepare
60 # define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
61 # define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
62 # define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
63 # define GRUB_AUTOEFI_MEMORY_NVS GRUB_EFIEMU_MEMORY_NVS
64 # define GRUB_AUTOEFI_MEMORY_CODE GRUB_EFIEMU_MEMORY_CODE
65 # define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
66 # define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
67 # define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR
68 # define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN
69 # define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
70 # define grub_efi_allocate_pages(x,y) (x)
71 # define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
72 # define EFI_PRESENT 1
73 #endif
75 #endif