efi.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _ASM_EFI_H
  2. #define _ASM_EFI_H
  3. #include <asm/io.h>
  4. #include <asm/mmu_context.h>
  5. #include <asm/neon.h>
  6. #include <asm/ptrace.h>
  7. #include <asm/tlbflush.h>
  8. #ifdef CONFIG_EFI
  9. extern void efi_init(void);
  10. #else
  11. #define efi_init()
  12. #endif
  13. int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
  14. int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
  15. #define arch_efi_call_virt_setup() \
  16. ({ \
  17. kernel_neon_begin(); \
  18. efi_virtmap_load(); \
  19. })
  20. #define arch_efi_call_virt(p, f, args...) \
  21. ({ \
  22. efi_##f##_t *__f; \
  23. __f = p->f; \
  24. __f(args); \
  25. })
  26. #define arch_efi_call_virt_teardown() \
  27. ({ \
  28. efi_virtmap_unload(); \
  29. kernel_neon_end(); \
  30. })
  31. #define ARCH_EFI_IRQ_FLAGS_MASK (PSR_D_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT)
  32. /* arch specific definitions used by the stub code */
  33. /*
  34. * AArch64 requires the DTB to be 8-byte aligned in the first 512MiB from
  35. * start of kernel and may not cross a 2MiB boundary. We set alignment to
  36. * 2MiB so we know it won't cross a 2MiB boundary.
  37. */
  38. #define EFI_FDT_ALIGN SZ_2M /* used by allocate_new_fdt_and_exit_boot() */
  39. #define MAX_FDT_OFFSET SZ_512M
  40. #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
  41. #define __efi_call_early(f, ...) f(__VA_ARGS__)
  42. #define efi_is_64bit() (true)
  43. #define alloc_screen_info(x...) &screen_info
  44. #define free_screen_info(x...)
  45. static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
  46. {
  47. }
  48. #define EFI_ALLOC_ALIGN SZ_64K
  49. /*
  50. * On ARM systems, virtually remapped UEFI runtime services are set up in two
  51. * distinct stages:
  52. * - The stub retrieves the final version of the memory map from UEFI, populates
  53. * the virt_addr fields and calls the SetVirtualAddressMap() [SVAM] runtime
  54. * service to communicate the new mapping to the firmware (Note that the new
  55. * mapping is not live at this time)
  56. * - During an early initcall(), the EFI system table is permanently remapped
  57. * and the virtual remapping of the UEFI Runtime Services regions is loaded
  58. * into a private set of page tables. If this all succeeds, the Runtime
  59. * Services are enabled and the EFI_RUNTIME_SERVICES bit set.
  60. */
  61. static inline void efi_set_pgd(struct mm_struct *mm)
  62. {
  63. switch_mm(NULL, mm, NULL);
  64. }
  65. void efi_virtmap_load(void);
  66. void efi_virtmap_unload(void);
  67. #endif /* _ASM_EFI_H */