]> git.proxmox.com Git - grub2.git/blame - include/grub/autoefi.h
EFI support
[grub2.git] / include / grub / autoefi.h
CommitLineData
5caf964d 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#include <grub/machine/machine.h>
25
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
12d6fc84 30# define grub_autoefi_exit_boot_services grub_efi_exit_boot_services
5caf964d 31# define grub_autoefi_system_table grub_efi_system_table
32# define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
8a10b2c6 33# define grub_autoefi_set_virtual_address_map grub_efi_set_virtual_address_map
5caf964d 34static inline grub_err_t grub_autoefi_prepare (void)
35{
36 return GRUB_ERR_NONE;
37};
38# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_MACHINE_MEMORY_AVAILABLE
39# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_MACHINE_MEMORY_RESERVED
40# ifdef GRUB_MACHINE_MEMORY_ACPI
41# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_MACHINE_MEMORY_ACPI
42# endif
43# ifdef GRUB_MACHINE_MEMORY_NVS
44# define GRUB_AUTOEFI_MEMORY_NVS GRUB_MACHINE_MEMORY_NVS
45# endif
46# ifdef GRUB_MACHINE_MEMORY_CODE
47# define GRUB_AUTOEFI_MEMORY_CODE GRUB_MACHINE_MEMORY_CODE
48# endif
49# define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
50# define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
51# define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
52# define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
53# define SYSTEM_TABLE(x) (grub_efi_system_table->x)
54# define EFI_PRESENT 1
55#else
56# include <grub/efiemu/efiemu.h>
57# define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
58# define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
12d6fc84 59# define grub_autoefi_exit_boot_services grub_efiemu_exit_boot_services
5caf964d 60# define grub_autoefi_system_table grub_efiemu_system_table
61# define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
62# define grub_autoefi_prepare grub_efiemu_prepare
8a10b2c6 63# define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
5caf964d 64# define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
65# define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
66# define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
67# define GRUB_AUTOEFI_MEMORY_NVS GRUB_EFIEMU_MEMORY_NVS
68# define GRUB_AUTOEFI_MEMORY_CODE GRUB_EFIEMU_MEMORY_CODE
69# define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
70# define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
71# define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR
b39f9d20 72# define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN
73# define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
5caf964d 74# define grub_efi_allocate_pages(x,y) (x)
75# define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
76# define EFI_PRESENT 1
77#endif
78
79#endif