autoefi.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #ifdef GRUB_MACHINE_EFI
  24. # include <grub/efi/efi.h>
  25. # define grub_autoefi_get_memory_map grub_efi_get_memory_map
  26. # define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
  27. # define grub_autoefi_exit_boot_services grub_efi_exit_boot_services
  28. # define grub_autoefi_system_table grub_efi_system_table
  29. # define grub_autoefi_mmap_iterate grub_machine_mmap_iterate
  30. # define grub_autoefi_set_virtual_address_map grub_efi_set_virtual_address_map
  31. static inline grub_err_t grub_autoefi_prepare (void)
  32. {
  33. return GRUB_ERR_NONE;
  34. };
  35. # define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
  36. # define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
  37. # define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
  38. # define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
  39. # define SYSTEM_TABLE(x) (grub_efi_system_table->x)
  40. # define grub_autoefi_finish_boot_services grub_efi_finish_boot_services
  41. # define EFI_PRESENT 1
  42. #else
  43. # include <grub/efiemu/efiemu.h>
  44. # define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
  45. # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
  46. # define grub_autoefi_exit_boot_services grub_efiemu_exit_boot_services
  47. # define grub_autoefi_system_table grub_efiemu_system_table
  48. # define grub_autoefi_mmap_iterate grub_efiemu_mmap_iterate
  49. # define grub_autoefi_prepare grub_efiemu_prepare
  50. # define grub_autoefi_set_virtual_address_map grub_efiemu_set_virtual_address_map
  51. # define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
  52. # define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
  53. # define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR
  54. # define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN
  55. # define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
  56. # define grub_efi_allocate_fixed(x,y) (x)
  57. # define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
  58. # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
  59. # define EFI_PRESENT 1
  60. #endif
  61. #endif