fixmap.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2019 Western Digital Corporation or its affiliates.
  4. */
  5. #ifndef _ASM_RISCV_FIXMAP_H
  6. #define _ASM_RISCV_FIXMAP_H
  7. #include <linux/kernel.h>
  8. #include <linux/sizes.h>
  9. #include <linux/pgtable.h>
  10. #include <asm/page.h>
  11. #ifdef CONFIG_MMU
  12. /*
  13. * Here we define all the compile-time 'special' virtual addresses.
  14. * The point is to have a constant address at compile time, but to
  15. * set the physical address only in the boot process.
  16. *
  17. * These 'compile-time allocated' memory buffers are page-sized. Use
  18. * set_fixmap(idx,phys) to associate physical memory with fixmap indices.
  19. */
  20. enum fixed_addresses {
  21. FIX_HOLE,
  22. FIX_PTE,
  23. FIX_PMD,
  24. FIX_TEXT_POKE1,
  25. FIX_TEXT_POKE0,
  26. FIX_EARLYCON_MEM_BASE,
  27. __end_of_permanent_fixed_addresses,
  28. /*
  29. * Temporary boot-time mappings, used by early_ioremap(),
  30. * before ioremap() is functional.
  31. */
  32. #define NR_FIX_BTMAPS (SZ_256K / PAGE_SIZE)
  33. #define FIX_BTMAPS_SLOTS 7
  34. #define TOTAL_FIX_BTMAPS (NR_FIX_BTMAPS * FIX_BTMAPS_SLOTS)
  35. FIX_BTMAP_END = __end_of_permanent_fixed_addresses,
  36. FIX_BTMAP_BEGIN = FIX_BTMAP_END + TOTAL_FIX_BTMAPS - 1,
  37. __end_of_fixed_addresses
  38. };
  39. #define FIXMAP_PAGE_IO __pgprot(_PAGE_IOREMAP)
  40. #define __early_set_fixmap __set_fixmap
  41. #define __late_set_fixmap __set_fixmap
  42. #define __late_clear_fixmap(idx) __set_fixmap((idx), 0, FIXMAP_PAGE_CLEAR)
  43. extern void __set_fixmap(enum fixed_addresses idx,
  44. phys_addr_t phys, pgprot_t prot);
  45. #include <asm-generic/fixmap.h>
  46. #endif /* CONFIG_MMU */
  47. #endif /* _ASM_RISCV_FIXMAP_H */