Blame view

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