efi.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. #ifdef CONFIG_EFI
  19. void efi_init(void);
  20. int efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md);
  21. #define efi_call_virt(f, ...) \
  22. ({ \
  23. efi_##f##_t *__f; \
  24. efi_status_t __s; \
  25. \
  26. efi_virtmap_load(); \
  27. __f = efi.systab->runtime->f; \
  28. __s = __f(__VA_ARGS__); \
  29. efi_virtmap_unload(); \
  30. __s; \
  31. })
  32. #define __efi_call_virt(f, ...) \
  33. ({ \
  34. efi_##f##_t *__f; \
  35. \
  36. efi_virtmap_load(); \
  37. __f = efi.systab->runtime->f; \
  38. __f(__VA_ARGS__); \
  39. efi_virtmap_unload(); \
  40. })
  41. static inline void efi_set_pgd(struct mm_struct *mm)
  42. {
  43. check_and_switch_context(mm, NULL);
  44. }
  45. void efi_virtmap_load(void);
  46. void efi_virtmap_unload(void);
  47. #else
  48. #define efi_init()
  49. #endif /* CONFIG_EFI */
  50. /* arch specific definitions used by the stub code */
  51. #define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
  52. /*
  53. * A reasonable upper bound for the uncompressed kernel size is 32 MBytes,
  54. * so we will reserve that amount of memory. We have no easy way to tell what
  55. * the actuall size of code + data the uncompressed kernel will use.
  56. * If this is insufficient, the decompressor will relocate itself out of the
  57. * way before performing the decompression.
  58. */
  59. #define MAX_UNCOMP_KERNEL_SIZE SZ_32M
  60. /*
  61. * The kernel zImage should preferably be located between 32 MB and 128 MB
  62. * from the base of DRAM. The min address leaves space for a maximal size
  63. * uncompressed image, and the max address is due to how the zImage decompressor
  64. * picks a destination address.
  65. */
  66. #define ZIMAGE_OFFSET_LIMIT SZ_128M
  67. #define MIN_ZIMAGE_OFFSET MAX_UNCOMP_KERNEL_SIZE
  68. #define MAX_FDT_OFFSET ZIMAGE_OFFSET_LIMIT
  69. #endif /* _ASM_ARM_EFI_H */