fixmap.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_FIXMAP_H
  3. #define _ASM_FIXMAP_H
  4. #define FIXADDR_START 0xffc80000UL
  5. #define FIXADDR_END 0xfff00000UL
  6. #define FIXADDR_TOP (FIXADDR_END - PAGE_SIZE)
  7. #include <linux/pgtable.h>
  8. #include <asm/kmap_size.h>
  9. enum fixed_addresses {
  10. FIX_EARLYCON_MEM_BASE,
  11. __end_of_permanent_fixed_addresses,
  12. FIX_KMAP_BEGIN = __end_of_permanent_fixed_addresses,
  13. FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_MAX_IDX * NR_CPUS) - 1,
  14. /* Support writing RO kernel text via kprobes, jump labels, etc. */
  15. FIX_TEXT_POKE0,
  16. FIX_TEXT_POKE1,
  17. __end_of_fixmap_region,
  18. /*
  19. * Share the kmap() region with early_ioremap(): this is guaranteed
  20. * not to clash since early_ioremap() is only available before
  21. * paging_init(), and kmap() only after.
  22. */
  23. #define NR_FIX_BTMAPS 32
  24. #define FIX_BTMAPS_SLOTS 7
  25. #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
  26. FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
  27. FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
  28. __end_of_early_ioremap_region
  29. };
  30. static const enum fixed_addresses __end_of_fixed_addresses =
  31. __end_of_fixmap_region > __end_of_early_ioremap_region ?
  32. __end_of_fixmap_region : __end_of_early_ioremap_region;
  33. #define FIXMAP_PAGE_COMMON (L_PTE_YOUNG | L_PTE_PRESENT | L_PTE_XN | L_PTE_DIRTY)
  34. #define FIXMAP_PAGE_NORMAL (pgprot_kernel | L_PTE_XN)
  35. #define FIXMAP_PAGE_RO (FIXMAP_PAGE_NORMAL | L_PTE_RDONLY)
  36. /* Used by set_fixmap_(io|nocache), both meant for mapping a device */
  37. #define FIXMAP_PAGE_IO (FIXMAP_PAGE_COMMON | L_PTE_MT_DEV_SHARED | L_PTE_SHARED)
  38. #define FIXMAP_PAGE_NOCACHE FIXMAP_PAGE_IO
  39. #define __early_set_fixmap __set_fixmap
  40. #ifdef CONFIG_MMU
  41. void __set_fixmap(enum fixed_addresses idx, phys_addr_t phys, pgprot_t prot);
  42. void __init early_fixmap_init(void);
  43. #include <asm-generic/fixmap.h>
  44. #else
  45. static inline void early_fixmap_init(void) { }
  46. #endif
  47. #endif