pgtable.h 4.8 KB

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