aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-m68k')
-rw-r--r--include/asm-m68k/mmzone.h9
-rw-r--r--include/asm-m68k/module.h1
-rw-r--r--include/asm-m68k/motorola_pgtable.h10
-rw-r--r--include/asm-m68k/page.h52
-rw-r--r--include/asm-m68k/pgalloc.h3
-rw-r--r--include/asm-m68k/pgtable.h17
-rw-r--r--include/asm-m68k/sun3_pgtable.h4
-rw-r--r--include/asm-m68k/virtconvert.h49
8 files changed, 75 insertions, 70 deletions
diff --git a/include/asm-m68k/mmzone.h b/include/asm-m68k/mmzone.h
new file mode 100644
index 000000000000..e1f1ec7b7006
--- /dev/null
+++ b/include/asm-m68k/mmzone.h
@@ -0,0 +1,9 @@
1#ifndef _ASM_M68K_MMZONE_H_
2#define _ASM_M68K_MMZONE_H_
3
4extern pg_data_t pg_data_map[];
5
6#define NODE_DATA(nid) (&pg_data_map[nid])
7#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
8
9#endif /* _ASM_M68K_MMZONE_H_ */
diff --git a/include/asm-m68k/module.h b/include/asm-m68k/module.h
index 71a1f76ac891..382d20a6fc18 100644
--- a/include/asm-m68k/module.h
+++ b/include/asm-m68k/module.h
@@ -17,6 +17,7 @@ struct mod_arch_specific {
17 17
18enum m68k_fixup_type { 18enum m68k_fixup_type {
19 m68k_fixup_memoffset, 19 m68k_fixup_memoffset,
20 m68k_fixup_vnode_shift,
20}; 21};
21 22
22struct m68k_fixup_info { 23struct m68k_fixup_info {
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
index 61e4406ed96a..b5b78c01eb6c 100644
--- a/include/asm-m68k/motorola_pgtable.h
+++ b/include/asm-m68k/motorola_pgtable.h
@@ -130,7 +130,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
130#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE)) 130#define pte_present(pte) (pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE))
131#define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; }) 131#define pte_clear(mm,addr,ptep) ({ pte_val(*(ptep)) = 0; })
132 132
133#define pte_page(pte) (mem_map + ((unsigned long)(__va(pte_val(pte)) - PAGE_OFFSET) >> PAGE_SHIFT)) 133#define pte_page(pte) virt_to_page(__va(pte_val(pte)))
134#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 134#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT)
135#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 135#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
136 136
@@ -143,7 +143,7 @@ static inline void pgd_set(pgd_t *pgdp, pmd_t *pmdp)
143 while (--__i >= 0) \ 143 while (--__i >= 0) \
144 *__ptr++ = 0; \ 144 *__ptr++ = 0; \
145}) 145})
146#define pmd_page(pmd) (mem_map + ((unsigned long)(__va(pmd_val(pmd)) - PAGE_OFFSET) >> PAGE_SHIFT)) 146#define pmd_page(pmd) virt_to_page(__va(pmd_val(pmd)))
147 147
148 148
149#define pgd_none(pgd) (!pgd_val(pgd)) 149#define pgd_none(pgd) (!pgd_val(pgd))
@@ -223,10 +223,10 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address)
223 return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)); 223 return (pte_t *)__pmd_page(*pmdp) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1));
224} 224}
225 225
226#define pte_offset_map(pmdp,address) ((pte_t *)kmap(pmd_page(*pmdp)) + ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 226#define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
227#define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address) 227#define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address)
228#define pte_unmap(pte) kunmap(pte) 228#define pte_unmap(pte) ((void)0)
229#define pte_unmap_nested(pte) kunmap(pte) 229#define pte_unmap_nested(pte) ((void)0)
230 230
231/* 231/*
232 * Allocate and free page tables. The xxx_kernel() versions are 232 * Allocate and free page tables. The xxx_kernel() versions are
diff --git a/include/asm-m68k/page.h b/include/asm-m68k/page.h
index 7650b99dcae6..9e6d0d6debdb 100644
--- a/include/asm-m68k/page.h
+++ b/include/asm-m68k/page.h
@@ -121,7 +121,6 @@ extern unsigned long m68k_memoffset;
121#ifndef CONFIG_SUN3 121#ifndef CONFIG_SUN3
122 122
123#define WANT_PAGE_VIRTUAL 123#define WANT_PAGE_VIRTUAL
124#ifdef CONFIG_SINGLE_MEMORY_CHUNK
125 124
126static inline unsigned long ___pa(void *vaddr) 125static inline unsigned long ___pa(void *vaddr)
127{ 126{
@@ -133,7 +132,7 @@ static inline unsigned long ___pa(void *vaddr)
133 : "0" (vaddr), "i" (m68k_fixup_memoffset)); 132 : "0" (vaddr), "i" (m68k_fixup_memoffset));
134 return paddr; 133 return paddr;
135} 134}
136#define __pa(vaddr) ___pa((void *)(vaddr)) 135#define __pa(vaddr) ___pa((void *)(vaddr))
137static inline void *__va(unsigned long paddr) 136static inline void *__va(unsigned long paddr)
138{ 137{
139 void *vaddr; 138 void *vaddr;
@@ -145,11 +144,6 @@ static inline void *__va(unsigned long paddr)
145 return vaddr; 144 return vaddr;
146} 145}
147 146
148#else
149#define __pa(vaddr) virt_to_phys((void *)(vaddr))
150#define __va(paddr) phys_to_virt((unsigned long)(paddr))
151#endif
152
153#else /* !CONFIG_SUN3 */ 147#else /* !CONFIG_SUN3 */
154/* This #define is a horrible hack to suppress lots of warnings. --m */ 148/* This #define is a horrible hack to suppress lots of warnings. --m */
155#define __pa(x) ___pa((unsigned long)(x)) 149#define __pa(x) ___pa((unsigned long)(x))
@@ -184,11 +178,47 @@ static inline void *__va(unsigned long x)
184#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT) 178#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
185#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT) 179#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
186 180
187#define virt_to_page(kaddr) (mem_map + (((unsigned long)(kaddr)-PAGE_OFFSET) >> PAGE_SHIFT)) 181extern int m68k_virt_to_node_shift;
188#define page_to_virt(page) ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) 182
183#ifdef CONFIG_SINGLE_MEMORY_CHUNK
184#define __virt_to_node(addr) (&pg_data_map[0])
185#else
186extern struct pglist_data *pg_data_table[];
187
188static inline __attribute_const__ int __virt_to_node_shift(void)
189{
190 int shift;
191
192 asm (
193 "1: moveq #0,%0\n"
194 m68k_fixup(%c1, 1b)
195 : "=d" (shift)
196 : "i" (m68k_fixup_vnode_shift));
197 return shift;
198}
199
200#define __virt_to_node(addr) (pg_data_table[(unsigned long)(addr) >> __virt_to_node_shift()])
201#endif
189 202
190#define pfn_to_page(pfn) virt_to_page(pfn_to_virt(pfn)) 203#define virt_to_page(addr) ({ \
191#define page_to_pfn(page) virt_to_pfn(page_to_virt(page)) 204 pfn_to_page(virt_to_pfn(addr)); \
205})
206#define page_to_virt(page) ({ \
207 pfn_to_virt(page_to_pfn(page)); \
208})
209
210#define pfn_to_page(pfn) ({ \
211 unsigned long __pfn = (pfn); \
212 struct pglist_data *pgdat; \
213 pgdat = __virt_to_node((unsigned long)pfn_to_virt(__pfn)); \
214 pgdat->node_mem_map + (__pfn - pgdat->node_start_pfn); \
215})
216#define page_to_pfn(_page) ({ \
217 struct page *__p = (_page); \
218 struct pglist_data *pgdat; \
219 pgdat = &pg_data_map[page_to_nid(__p)]; \
220 ((__p) - pgdat->node_mem_map) + pgdat->node_start_pfn; \
221})
192 222
193#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory) 223#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET && (void *)(kaddr) < high_memory)
194#define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn)) 224#define pfn_valid(pfn) virt_addr_valid(pfn_to_virt(pfn))
diff --git a/include/asm-m68k/pgalloc.h b/include/asm-m68k/pgalloc.h
index a9cfb4b99d88..4cb1a57ab763 100644
--- a/include/asm-m68k/pgalloc.h
+++ b/include/asm-m68k/pgalloc.h
@@ -8,11 +8,12 @@
8#include <asm/virtconvert.h> 8#include <asm/virtconvert.h>
9 9
10 10
11
12#ifdef CONFIG_SUN3 11#ifdef CONFIG_SUN3
13#include <asm/sun3_pgalloc.h> 12#include <asm/sun3_pgalloc.h>
14#else 13#else
15#include <asm/motorola_pgalloc.h> 14#include <asm/motorola_pgalloc.h>
16#endif 15#endif
17 16
17extern void m68k_setup_node(int node);
18
18#endif /* M68K_PGALLOC_H */ 19#endif /* M68K_PGALLOC_H */
diff --git a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h
index 555b87a1f7e3..778a4c538eb2 100644
--- a/include/asm-m68k/pgtable.h
+++ b/include/asm-m68k/pgtable.h
@@ -107,22 +107,7 @@ extern void *empty_zero_page;
107/* 64-bit machines, beware! SRB. */ 107/* 64-bit machines, beware! SRB. */
108#define SIZEOF_PTR_LOG2 2 108#define SIZEOF_PTR_LOG2 2
109 109
110/* 110#define mm_end_of_chunk(addr, len) 0
111 * Check if the addr/len goes up to the end of a physical
112 * memory chunk. Used for DMA functions.
113 */
114#ifdef CONFIG_SINGLE_MEMORY_CHUNK
115/*
116 * It makes no sense to consider whether we cross a memory boundary if
117 * we support just one physical chunk of memory.
118 */
119static inline int mm_end_of_chunk(unsigned long addr, int len)
120{
121 return 0;
122}
123#else
124int mm_end_of_chunk (unsigned long addr, int len);
125#endif
126 111
127extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode); 112extern void kernel_set_cachemode(void *addr, unsigned long size, int cmode);
128 113
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h
index 5156a28a18d8..b9e62c1e7ae3 100644
--- a/include/asm-m68k/sun3_pgtable.h
+++ b/include/asm-m68k/sun3_pgtable.h
@@ -132,8 +132,8 @@ static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *p
132#define pfn_pte(pfn, pgprot) \ 132#define pfn_pte(pfn, pgprot) \
133({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; }) 133({ pte_t __pte; pte_val(__pte) = pfn | pgprot_val(pgprot); __pte; })
134 134
135#define pte_page(pte) (mem_map+((__pte_page(pte) - PAGE_OFFSET) >> PAGE_SHIFT)) 135#define pte_page(pte) virt_to_page(__pte_page(pte))
136#define pmd_page(pmd) (mem_map+((__pmd_page(pmd) - PAGE_OFFSET) >> PAGE_SHIFT)) 136#define pmd_page(pmd) virt_to_page(__pmd_page(pmd))
137 137
138 138
139static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); } 139static inline int pmd_none2 (pmd_t *pmd) { return !pmd_val (*pmd); }
diff --git a/include/asm-m68k/virtconvert.h b/include/asm-m68k/virtconvert.h
index 83a87c9b1a16..dea32fbc7e51 100644
--- a/include/asm-m68k/virtconvert.h
+++ b/include/asm-m68k/virtconvert.h
@@ -8,56 +8,35 @@
8#ifdef __KERNEL__ 8#ifdef __KERNEL__
9 9
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/mmzone.h>
11#include <asm/setup.h> 12#include <asm/setup.h>
12#include <asm/page.h> 13#include <asm/page.h>
13 14
14#ifdef CONFIG_AMIGA
15#include <asm/amigahw.h>
16#endif
17
18/* 15/*
19 * Change virtual addresses to physical addresses and vv. 16 * Change virtual addresses to physical addresses and vv.
20 */ 17 */
21#ifndef CONFIG_SUN3
22extern unsigned long mm_vtop(unsigned long addr) __attribute_const__;
23extern unsigned long mm_ptov(unsigned long addr) __attribute_const__;
24#else
25static inline unsigned long mm_vtop(unsigned long vaddr)
26{
27 return __pa(vaddr);
28}
29
30static inline unsigned long mm_ptov(unsigned long paddr)
31{
32 return (unsigned long)__va(paddr);
33}
34#endif
35
36#ifdef CONFIG_SINGLE_MEMORY_CHUNK
37static inline unsigned long virt_to_phys(void *vaddr)
38{
39 return (unsigned long)vaddr - PAGE_OFFSET + m68k_memory[0].addr;
40}
41
42static inline void * phys_to_virt(unsigned long paddr)
43{
44 return (void *)(paddr - m68k_memory[0].addr + PAGE_OFFSET);
45}
46#else
47static inline unsigned long virt_to_phys(void *address) 18static inline unsigned long virt_to_phys(void *address)
48{ 19{
49 return mm_vtop((unsigned long)address); 20 return __pa(address);
50} 21}
51 22
52static inline void *phys_to_virt(unsigned long address) 23static inline void *phys_to_virt(unsigned long address)
53{ 24{
54 return (void *) mm_ptov(address); 25 return __va(address);
55} 26}
56#endif
57 27
58/* Permanent address of a page. */ 28/* Permanent address of a page. */
59#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) 29#ifdef CONFIG_SINGLE_MEMORY_CHUNK
60#define page_to_phys(page) virt_to_phys((void *)__page_address(page)) 30#define page_to_phys(page) \
31 __pa(PAGE_OFFSET + (((page) - pg_data_map[0].node_mem_map) << PAGE_SHIFT))
32#else
33#define page_to_phys(_page) ({ \
34 struct page *__page = _page; \
35 struct pglist_data *pgdat; \
36 pgdat = pg_data_table[page_to_nid(__page)]; \
37 page_to_pfn(__page) << PAGE_SHIFT; \
38})
39#endif
61 40
62/* 41/*
63 * IO bus memory addresses are 1:1 with the physical address, 42 * IO bus memory addresses are 1:1 with the physical address,