fixmap.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * fixmap.h: compile-time virtual memory allocation
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file "COPYING" in the main directory of this archive
  6. * for more details.
  7. *
  8. * Copyright (C) 1998 Ingo Molnar
  9. * Copyright (C) 2013 Mark Salter <msalter@redhat.com>
  10. *
  11. * Adapted from arch/x86 version.
  12. *
  13. */
  14. #ifndef _ASM_ARM64_FIXMAP_H
  15. #define _ASM_ARM64_FIXMAP_H
  16. #ifndef __ASSEMBLY__
  17. #include <linux/kernel.h>
  18. #include <asm/boot.h>
  19. #include <asm/page.h>
  20. /*
  21. * Here we define all the compile-time 'special' virtual
  22. * addresses. The point is to have a constant address at
  23. * compile time, but to set the physical address only
  24. * in the boot process.
  25. *
  26. * These 'compile-time allocated' memory buffers are
  27. * page-sized. Use set_fixmap(idx,phys) to associate
  28. * physical memory with fixmap indices.
  29. *
  30. */
  31. enum fixed_addresses {
  32. FIX_HOLE,
  33. /*
  34. * Reserve a virtual window for the FDT that is 2 MB larger than the
  35. * maximum supported size, and put it at the top of the fixmap region.
  36. * The additional space ensures that any FDT that does not exceed
  37. * MAX_FDT_SIZE can be mapped regardless of whether it crosses any
  38. * 2 MB alignment boundaries.
  39. *
  40. * Keep this at the top so it remains 2 MB aligned.
  41. */
  42. #define FIX_FDT_SIZE (MAX_FDT_SIZE + SZ_2M)
  43. FIX_FDT_END,
  44. FIX_FDT = FIX_FDT_END + FIX_FDT_SIZE / PAGE_SIZE - 1,
  45. FIX_EARLYCON_MEM_BASE,
  46. FIX_TEXT_POKE0,
  47. __end_of_permanent_fixed_addresses,
  48. /*
  49. * Temporary boot-time mappings, used by early_ioremap(),
  50. * before ioremap() is functional.
  51. */
  52. #ifdef CONFIG_ARM64_64K_PAGES
  53. #define NR_FIX_BTMAPS 4
  54. #else
  55. #define NR_FIX_BTMAPS 64
  56. #endif
  57. #define FIX_BTMAPS_SLOTS 7
  58. #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
  59. FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
  60. FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
  61. __end_of_fixed_addresses
  62. };
  63. #define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT)
  64. #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
  65. #define FIXMAP_PAGE_IO __pgprot(PROT_DEVICE_nGnRE)
  66. void __init early_fixmap_init(void);
  67. #define __early_set_fixmap __set_fixmap
  68. #define __late_set_fixmap __set_fixmap
  69. #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
  70. extern void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
  71. #include <asm-generic/fixmap.h>
  72. #endif /* !__ASSEMBLY__ */
  73. #endif /* _ASM_ARM64_FIXMAP_H */