autoefi.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_MACHINE_MEMORY_AVAILABLE
  36. # define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_MACHINE_MEMORY_RESERVED
  37. # ifdef GRUB_MACHINE_MEMORY_ACPI
  38. # define GRUB_AUTOEFI_MEMORY_ACPI GRUB_MACHINE_MEMORY_ACPI
  39. # endif
  40. # ifdef GRUB_MACHINE_MEMORY_NVS
  41. # define GRUB_AUTOEFI_MEMORY_NVS GRUB_MACHINE_MEMORY_NVS
  42. # endif
  43. # ifdef GRUB_MACHINE_MEMORY_CODE
  44. # define GRUB_AUTOEFI_MEMORY_CODE GRUB_MACHINE_MEMORY_CODE
  45. # endif
  46. # define SYSTEM_TABLE_SIZEOF(x) (sizeof(grub_efi_system_table->x))
  47. # define SYSTEM_TABLE_VAR(x) ((void *)&(grub_efi_system_table->x))
  48. # define SYSTEM_TABLE_PTR(x) ((void *)(grub_efi_system_table->x))
  49. # define SIZEOF_OF_UINTN sizeof (grub_efi_uintn_t)
  50. # define SYSTEM_TABLE(x) (grub_efi_system_table->x)
  51. # define EFI_PRESENT 1
  52. #else
  53. # include <grub/efiemu/efiemu.h>
  54. # define grub_autoefi_get_memory_map grub_efiemu_get_memory_map
  55. # define grub_autoefi_finish_boot_services grub_efiemu_finish_boot_services
  56. # define grub_autoefi_exit_boot_services grub_efiemu_exit_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_set_virtual_address_map grub_efiemu_set_virtual_address_map
  61. # define GRUB_AUTOEFI_MEMORY_AVAILABLE GRUB_EFIEMU_MEMORY_AVAILABLE
  62. # define GRUB_AUTOEFI_MEMORY_RESERVED GRUB_EFIEMU_MEMORY_RESERVED
  63. # define GRUB_AUTOEFI_MEMORY_ACPI GRUB_EFIEMU_MEMORY_ACPI
  64. # define GRUB_AUTOEFI_MEMORY_NVS GRUB_EFIEMU_MEMORY_NVS
  65. # define GRUB_AUTOEFI_MEMORY_CODE GRUB_EFIEMU_MEMORY_CODE
  66. # define SYSTEM_TABLE_SIZEOF GRUB_EFIEMU_SYSTEM_TABLE_SIZEOF
  67. # define SYSTEM_TABLE_VAR GRUB_EFIEMU_SYSTEM_TABLE_VAR
  68. # define SYSTEM_TABLE_PTR GRUB_EFIEMU_SYSTEM_TABLE_PTR
  69. # define SIZEOF_OF_UINTN GRUB_EFIEMU_SIZEOF_OF_UINTN
  70. # define SYSTEM_TABLE GRUB_EFIEMU_SYSTEM_TABLE
  71. # define grub_efi_allocate_pages(x,y) (x)
  72. # define grub_efi_free_pages(x,y) GRUB_EFI_SUCCESS
  73. # define EFI_PRESENT 1
  74. #endif
  75. #endif