fixmap.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. *
  10. * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  11. */
  12. #ifndef _ASM_FIXMAP_H
  13. #define _ASM_FIXMAP_H
  14. #include <asm/pgtable.h>
  15. #ifdef CONFIG_HIGHMEM
  16. #include <linux/threads.h>
  17. #include <asm/kmap_types.h>
  18. #endif
  19. /*
  20. * Here we define all the compile-time 'special' virtual
  21. * addresses. The point is to have a constant address at
  22. * compile time, but to set the physical address only
  23. * in the boot process. We allocate these special addresses
  24. * from the end of the consistent memory region backwards.
  25. * Also this lets us do fail-safe vmalloc(), we
  26. * can guarantee that these special addresses and
  27. * vmalloc()-ed addresses never overlap.
  28. *
  29. * these 'compile-time allocated' memory buffers are
  30. * fixed-size 4k pages. (or larger if used with an increment
  31. * higher than 1) use fixmap_set(idx,phys) to associate
  32. * physical memory with fixmap indices.
  33. */
  34. enum fixed_addresses {
  35. #ifdef CONFIG_HIGHMEM
  36. /* reserved pte's for temporary kernel mappings */
  37. FIX_KMAP_BEGIN,
  38. FIX_KMAP_END = FIX_KMAP_BEGIN + (KM_TYPE_NR * NR_CPUS) - 1,
  39. #endif
  40. __end_of_fixed_addresses
  41. };
  42. #define FIXADDR_TOP (VMALLOC_START - PAGE_SIZE)
  43. #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
  44. #define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK)
  45. #include <asm-generic/fixmap.h>
  46. #define kmap_get_fixmap_pte(vaddr) \
  47. pte_offset_kernel( \
  48. pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), \
  49. (vaddr) \
  50. )
  51. #endif