efi.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2015 Linaro Ltd <ard.biesheuvel@linaro.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __ASM_ARM_EFI_H
  9. #define __ASM_ARM_EFI_H
  10. #include <asm/cacheflush.h>
  11. #include <asm/cachetype.h>
  12. #include <asm/early_ioremap.h>
  13. #include <asm/fixmap.h>
  14. #include <asm/highmem.h>
  15. #include <asm/mach/map.h>
  16. #include <asm/mmu_context.h>
  17. #include <asm/pgtable.h>
  18. #include <asm/ptrace.h>
  19. #ifdef CONFIG_EFI
  20. void efi_init(void);
  21. int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
  22. int efi_set_mapping_permissions(struct mm_struct *mm, efi_memory_desc_t *md);
  23. #define arch_efi_call_virt_setup() efi_virtmap_load()
  24. #define arch_efi_call_virt_teardown() efi_virtmap_unload()
  25. #define arch_efi_call_virt(p, f, args...) \
  26. ({ \
  27. efi_##f##_t *__f; \
  28. __f = p->f; \
  29. __f(args); \
  30. })
  31. #define ARCH_EFI_IRQ_FLAGS_MASK \
  32. (PSR_J_BIT | PSR_E_BIT | PSR_A_BIT | PSR_I_BIT | PSR_F_BIT | \
  33. PSR_T_BIT | MODE_MASK)
  34. static inline void efi_set_pgd(struct mm_struct *mm)
  35. {
  36. check_and_switch_context(mm, NULL);
  37. }
  38. void efi_virtmap_load(void);
  39. void efi_virtmap_unload(void);
  40. #else
  41. #define efi_init()
  42. #endif /* CONFIG_EFI */
  43. /* arch specific definitions used by the stub code */
  44. #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
  45. #define __efi_call_early(f, ...) f(__VA_ARGS__)
  46. #define efi_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__)
  47. #define efi_is_64bit() (false)
  48. #define efi_table_attr(table, attr, instance) \
  49. ((table##_t *)instance)->attr
  50. #define efi_call_proto(protocol, f, instance, ...) \
  51. ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
  52. struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
  53. void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
  54. static inline void efifb_setup_from_dmi(struct screen_info *si, const char *opt)
  55. {
  56. }
  57. /*
  58. * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
  59. * so we will reserve that amount of memory. We have no easy way to tell what
  60. * the actuall size of code + data the uncompressed kernel will use.
  61. * If this is insufficient, the decompressor will relocate itself out of the
  62. * way before performing the decompression.
  63. */
  64. #define MAX_UNCOMP_KERNEL_SIZE SZ_32M
  65. /*
  66. * The kernel zImage should preferably be located between 32 MB and 128 MB
  67. * from the base of DRAM. The min address leaves space for a maximal size
  68. * uncompressed image, and the max address is due to how the zImage decompressor
  69. * picks a destination address.
  70. */
  71. #define ZIMAGE_OFFSET_LIMIT SZ_128M
  72. #define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
  73. /* on ARM, the FDT should be located in the first 128 MB of RAM */
  74. static inline unsigned long efi_get_max_fdt_addr(unsigned long dram_base)
  75. {
  76. return dram_base + ZIMAGE_OFFSET_LIMIT;
  77. }
  78. /* on ARM, the initrd should be loaded in a lowmem region */
  79. static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
  80. unsigned long image_addr)
  81. {
  82. return dram_base + SZ_512M;
  83. }
  84. #endif /* _ASM_ARM_EFI_H */