pgtable_mm.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef _M68K_PGTABLE_H
  2. #define _M68K_PGTABLE_H
  3. #include <asm-generic/4level-fixup.h>
  4. #include <asm/setup.h>
  5. #ifndef __ASSEMBLY__
  6. #include <asm/processor.h>
  7. #include <linux/sched.h>
  8. #include <linux/threads.h>
  9. /*
  10. * This file contains the functions and defines necessary to modify and use
  11. * the m68k page table tree.
  12. */
  13. #include <asm/virtconvert.h>
  14. /* Certain architectures need to do special things when pte's
  15. * within a page table are directly modified. Thus, the following
  16. * hook is made available.
  17. */
  18. #define set_pte(pteptr, pteval) \
  19. do{ \
  20. *(pteptr) = (pteval); \
  21. } while(0)
  22. #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
  23. /* PMD_SHIFT determines the size of the area a second-level page table can map */
  24. #ifdef CONFIG_SUN3
  25. #define PMD_SHIFT 17
  26. #else
  27. #define PMD_SHIFT 22
  28. #endif
  29. #define PMD_SIZE (1UL << PMD_SHIFT)
  30. #define PMD_MASK (~(PMD_SIZE-1))
  31. /* PGDIR_SHIFT determines what a third-level page table entry can map */
  32. #ifdef CONFIG_SUN3
  33. #define PGDIR_SHIFT 17
  34. #else
  35. #define PGDIR_SHIFT 25
  36. #endif
  37. #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
  38. #define PGDIR_MASK (~(PGDIR_SIZE-1))
  39. /*
  40. * entries per page directory level: the m68k is configured as three-level,
  41. * so we do have PMD level physically.
  42. */
  43. #ifdef CONFIG_SUN3
  44. #define PTRS_PER_PTE 16
  45. #define PTRS_PER_PMD 1
  46. #define PTRS_PER_PGD 2048
  47. #else
  48. #define PTRS_PER_PTE 1024
  49. #define PTRS_PER_PMD 8
  50. #define PTRS_PER_PGD 128
  51. #endif
  52. #define USER_PTRS_PER_PGD (TASK_SIZE/PGDIR_SIZE)
  53. #define FIRST_USER_ADDRESS 0
  54. /* Virtual address region for use by kernel_map() */
  55. #ifdef CONFIG_SUN3
  56. #define KMAP_START 0x0DC00000
  57. #define KMAP_END 0x0E000000
  58. #else
  59. #define KMAP_START 0xd0000000
  60. #define KMAP_END 0xf0000000
  61. #endif
  62. #ifndef CONFIG_SUN3
  63. /* Just any arbitrary offset to the start of the vmalloc VM area: the
  64. * current 8MB value just means that there will be a 8MB "hole" after the
  65. * physical memory until the kernel virtual memory starts. That means that
  66. * any out-of-bounds memory accesses will hopefully be caught.
  67. * The vmalloc() routines leaves a hole of 4kB between each vmalloced
  68. * area for the same reason. ;)
  69. */
  70. #define VMALLOC_OFFSET (8*1024*1024)
  71. #define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
  72. #define VMALLOC_END KMAP_START
  73. #else
  74. extern unsigned long vmalloc_end;
  75. #define VMALLOC_START 0x0f800000
  76. #define VMALLOC_END vmalloc_end
  77. #endif /* CONFIG_SUN3 */
  78. /* zero page used for uninitialized stuff */
  79. extern void *empty_zero_page;
  80. /*
  81. * ZERO_PAGE is a global shared page that is always zero: used
  82. * for zero-mapped memory areas etc..
  83. */
  84. #define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page))
  85. /* number of bits that fit into a memory pointer */
  86. #define BITS_PER_PTR (8*sizeof(unsigned long))
  87. /* to align the pointer to a pointer address */
  88. #define PTR_MASK (~(sizeof(void*)-1))
  89. /* sizeof(void*)==1<<SIZEOF_PTR_LOG2 */
  90. /* 64-bit machines, beware! SRB. */
  91. #define SIZEOF_PTR_LOG2 2
  92. extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
  93. /*
  94. * The m68k doesn't have any external MMU info: the kernel page
  95. * tables contain all the necessary information. The Sun3 does, but
  96. * they are updated on demand.
  97. */
  98. static inline void update_mmu_cache(struct vm_area_struct *vma,
  99. unsigned long address, pte_t pte)
  100. {
  101. }
  102. #endif /* !__ASSEMBLY__ */
  103. #define kern_addr_valid(addr) (1)
  104. #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \
  105. remap_pfn_range(vma, vaddr, pfn, size, prot)
  106. /* MMU-specific headers */
  107. #ifdef CONFIG_SUN3
  108. #include <asm/sun3_pgtable.h>
  109. #else
  110. #include <asm/motorola_pgtable.h>
  111. #endif
  112. #ifndef __ASSEMBLY__
  113. #include <asm-generic/pgtable.h>
  114. /*
  115. * Macro to mark a page protection value as "uncacheable".
  116. */
  117. #ifdef SUN3_PAGE_NOCACHE
  118. # define __SUN3_PAGE_NOCACHE SUN3_PAGE_NOCACHE
  119. #else
  120. # define __SUN3_PAGE_NOCACHE 0
  121. #endif
  122. #define pgprot_noncached(prot) \
  123. (MMU_IS_SUN3 \
  124. ? (__pgprot(pgprot_val(prot) | __SUN3_PAGE_NOCACHE)) \
  125. : ((MMU_IS_851 || MMU_IS_030) \
  126. ? (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE030)) \
  127. : (MMU_IS_040 || MMU_IS_060) \
  128. ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \
  129. : (prot)))
  130. #endif /* !__ASSEMBLY__ */
  131. /*
  132. * No page table caches to initialise
  133. */
  134. #define pgtable_cache_init() do { } while (0)
  135. #define check_pgt_cache() do { } while (0)
  136. #endif /* _M68K_PGTABLE_H */