efi.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _ASM_EFI_H
  2. #define _ASM_EFI_H
  3. #include <asm/io.h>
  4. #include <asm/neon.h>
  5. #ifdef CONFIG_EFI
  6. extern void efi_init(void);
  7. #else
  8. #define efi_init()
  9. #endif
  10. #define efi_call_virt(f, ...) \
  11. ({ \
  12. efi_##f##_t *__f; \
  13. efi_status_t __s; \
  14. \
  15. kernel_neon_begin(); \
  16. efi_virtmap_load(); \
  17. __f = efi.systab->runtime->f; \
  18. __s = __f(__VA_ARGS__); \
  19. efi_virtmap_unload(); \
  20. kernel_neon_end(); \
  21. __s; \
  22. })
  23. #define __efi_call_virt(f, ...) \
  24. ({ \
  25. efi_##f##_t *__f; \
  26. \
  27. kernel_neon_begin(); \
  28. efi_virtmap_load(); \
  29. __f = efi.systab->runtime->f; \
  30. __f(__VA_ARGS__); \
  31. efi_virtmap_unload(); \
  32. kernel_neon_end(); \
  33. })
  34. /* arch specific definitions used by the stub code */
  35. /*
  36. * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from
  37. * start of kernel and may not cross a 2MiB boundary. We set alignment to
  38. * 2MiB so we know it won't cross a 2MiB boundary.
  39. */
  40. #define EFI_FDT_ALIGN SZ_2M /* used by allocate_new_fdt_and_exit_boot() */
  41. #define MAX_FDT_OFFSET SZ_512M
  42. #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
  43. #define EFI_ALLOC_ALIGN SZ_64K
  44. /*
  45. * On ARM systems, virtually remapped UEFI runtime services are set up in two
  46. * distinct stages:
  47. * - The stub retrieves the final version of the memory map from UEFI, populates
  48. * the virt_addr fields and calls the SetVirtualAddressMap() [SVAM] runtime
  49. * service to communicate the new mapping to the firmware (Note that the new
  50. * mapping is not live at this time)
  51. * - During an early initcall(), the EFI system table is permanently remapped
  52. * and the virtual remapping of the UEFI Runtime Services regions is loaded
  53. * into a private set of page tables. If this all succeeds, the Runtime
  54. * Services are enabled and the EFI_RUNTIME_SERVICES bit set.
  55. */
  56. void efi_virtmap_load(void);
  57. void efi_virtmap_unload(void);
  58. #endif /* _ASM_EFI_H */