aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips')
-rw-r--r--include/asm-mips/addrspace.h1
-rw-r--r--include/asm-mips/delay.h22
-rw-r--r--include/asm-mips/page.h2
-rw-r--r--include/asm-mips/pgtable-32.h61
-rw-r--r--include/asm-mips/pgtable-64.h13
-rw-r--r--include/asm-mips/pgtable.h5
-rw-r--r--include/asm-mips/smp.h5
-rw-r--r--include/asm-mips/sparsemem.h14
8 files changed, 79 insertions, 44 deletions
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 42520cc84b0f..1386af1cb7d9 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -129,6 +129,7 @@
129#if defined (CONFIG_CPU_R4300) \ 129#if defined (CONFIG_CPU_R4300) \
130 || defined (CONFIG_CPU_R4X00) \ 130 || defined (CONFIG_CPU_R4X00) \
131 || defined (CONFIG_CPU_R5000) \ 131 || defined (CONFIG_CPU_R5000) \
132 || defined (CONFIG_CPU_RM7000) \
132 || defined (CONFIG_CPU_NEVADA) \ 133 || defined (CONFIG_CPU_NEVADA) \
133 || defined (CONFIG_CPU_TX49XX) \ 134 || defined (CONFIG_CPU_TX49XX) \
134 || defined (CONFIG_CPU_MIPS64) 135 || defined (CONFIG_CPU_MIPS64)
diff --git a/include/asm-mips/delay.h b/include/asm-mips/delay.h
index 64dd45150f64..928f30f8c45c 100644
--- a/include/asm-mips/delay.h
+++ b/include/asm-mips/delay.h
@@ -19,20 +19,22 @@ static inline void __delay(unsigned long loops)
19{ 19{
20 if (sizeof(long) == 4) 20 if (sizeof(long) == 4)
21 __asm__ __volatile__ ( 21 __asm__ __volatile__ (
22 ".set\tnoreorder\n" 22 " .set noreorder \n"
23 "1:\tbnez\t%0,1b\n\t" 23 " .align 3 \n"
24 "subu\t%0,1\n\t" 24 "1: bnez %0, 1b \n"
25 ".set\treorder" 25 " subu %0, 1 \n"
26 " .set reorder \n"
26 : "=r" (loops) 27 : "=r" (loops)
27 : "0" (loops)); 28 : "0" (loops));
28 else if (sizeof(long) == 8) 29 else if (sizeof(long) == 8)
29 __asm__ __volatile__ ( 30 __asm__ __volatile__ (
30 ".set\tnoreorder\n" 31 " .set noreorder \n"
31 "1:\tbnez\t%0,1b\n\t" 32 " .align 3 \n"
32 "dsubu\t%0,1\n\t" 33 "1: bnez %0, 1b \n"
33 ".set\treorder" 34 " dsubu %0, 1 \n"
34 :"=r" (loops) 35 " .set reorder \n"
35 :"0" (loops)); 36 : "=r" (loops)
37 : "0" (loops));
36} 38}
37 39
38 40
diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
index a1eab136ff6c..4035ec79ecd4 100644
--- a/include/asm-mips/page.h
+++ b/include/asm-mips/page.h
@@ -139,9 +139,11 @@ typedef struct { unsigned long pgprot; } pgprot_t;
139 139
140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 140#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
141 141
142#ifndef CONFIG_SPARSEMEM
142#ifndef CONFIG_NEED_MULTIPLE_NODES 143#ifndef CONFIG_NEED_MULTIPLE_NODES
143#define pfn_valid(pfn) ((pfn) < max_mapnr) 144#define pfn_valid(pfn) ((pfn) < max_mapnr)
144#endif 145#endif
146#endif
145 147
146#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 148#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
147#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 149#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
diff --git a/include/asm-mips/pgtable-32.h b/include/asm-mips/pgtable-32.h
index 4d6bc45df594..087c20769256 100644
--- a/include/asm-mips/pgtable-32.h
+++ b/include/asm-mips/pgtable-32.h
@@ -177,48 +177,67 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
177 ((swp_entry_t) { ((type) << 10) | ((offset) << 15) }) 177 ((swp_entry_t) { ((type) << 10) | ((offset) << 15) })
178 178
179/* 179/*
180 * Bits 0, 1, 2, 9 and 10 are taken, split up the 27 bits of offset 180 * Bits 0, 4, 8, and 9 are taken, split up 28 bits of offset into this range:
181 * into this range:
182 */ 181 */
183#define PTE_FILE_MAX_BITS 27 182#define PTE_FILE_MAX_BITS 28
184 183
185#define pte_to_pgoff(_pte) \ 184#define pte_to_pgoff(_pte) ((((_pte).pte >> 1 ) & 0x07) | \
186 ((((_pte).pte >> 3) & 0x3f ) + (((_pte).pte >> 11) << 8 )) 185 (((_pte).pte >> 2 ) & 0x38) | \
186 (((_pte).pte >> 10) << 6 ))
187 187
188#define pgoff_to_pte(off) \ 188#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x07) << 1 ) | \
189 ((pte_t) { (((off) & 0x3f) << 3) + (((off) >> 8) << 11) + _PAGE_FILE }) 189 (((off) & 0x38) << 2 ) | \
190 (((off) >> 6 ) << 10) | \
191 _PAGE_FILE })
190 192
191#else 193#else
192 194
193/* Swap entries must have VALID and GLOBAL bits cleared. */ 195/* Swap entries must have VALID and GLOBAL bits cleared. */
196#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
197#define __swp_type(x) (((x).val >> 2) & 0x1f)
198#define __swp_offset(x) ((x).val >> 7)
199#define __swp_entry(type,offset) \
200 ((swp_entry_t) { ((type) << 2) | ((offset) << 7) })
201#else
194#define __swp_type(x) (((x).val >> 8) & 0x1f) 202#define __swp_type(x) (((x).val >> 8) & 0x1f)
195#define __swp_offset(x) ((x).val >> 13) 203#define __swp_offset(x) ((x).val >> 13)
196#define __swp_entry(type,offset) \ 204#define __swp_entry(type,offset) \
197 ((swp_entry_t) { ((type) << 8) | ((offset) << 13) }) 205 ((swp_entry_t) { ((type) << 8) | ((offset) << 13) })
206#endif /* defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32) */
198 207
208#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
199/* 209/*
200 * Bits 0, 1, 2, 7 and 8 are taken, split up the 27 bits of offset 210 * Bits 0 and 1 of pte_high are taken, use the rest for the page offset...
201 * into this range:
202 */ 211 */
203#define PTE_FILE_MAX_BITS 27 212#define PTE_FILE_MAX_BITS 30
204 213
205#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 214#define pte_to_pgoff(_pte) ((_pte).pte_high >> 2)
206 /* fixme */ 215#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) << 2 })
207#define pte_to_pgoff(_pte) (((_pte).pte_high >> 6) + ((_pte).pte_high & 0x3f))
208#define pgoff_to_pte(off) \
209 ((pte_t){(((off) & 0x3f) + ((off) << 6) + _PAGE_FILE)})
210 216
211#else 217#else
212#define pte_to_pgoff(_pte) \ 218/*
213 ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) 219 * Bits 0, 4, 6, and 7 are taken, split up 28 bits of offset into this range:
220 */
221#define PTE_FILE_MAX_BITS 28
222
223#define pte_to_pgoff(_pte) ((((_pte).pte >> 1) & 0x7) | \
224 (((_pte).pte >> 2) & 0x8) | \
225 (((_pte).pte >> 8) << 4))
214 226
215#define pgoff_to_pte(off) \ 227#define pgoff_to_pte(off) ((pte_t) { (((off) & 0x7) << 1) | \
216 ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE }) 228 (((off) & 0x8) << 2) | \
229 (((off) >> 4) << 8) | \
230 _PAGE_FILE })
217#endif 231#endif
218 232
219#endif 233#endif
220 234
235#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
236#define __pte_to_swp_entry(pte) ((swp_entry_t) { (pte).pte_high })
237#define __swp_entry_to_pte(x) ((pte_t) { 0, (x).val })
238#else
221#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 239#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
222#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 240#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
241#endif
223 242
224#endif /* _ASM_PGTABLE_32_H */ 243#endif /* _ASM_PGTABLE_32_H */
diff --git a/include/asm-mips/pgtable-64.h b/include/asm-mips/pgtable-64.h
index 82166b254b27..2faf5c9ff127 100644
--- a/include/asm-mips/pgtable-64.h
+++ b/include/asm-mips/pgtable-64.h
@@ -224,15 +224,12 @@ static inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
224#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 224#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
225 225
226/* 226/*
227 * Bits 0, 1, 2, 7 and 8 are taken, split up the 32 bits of offset 227 * Bits 0, 4, 6, and 7 are taken. Let's leave bits 1, 2, 3, and 5 alone to
228 * into this range: 228 * make things easier, and only use the upper 56 bits for the page offset...
229 */ 229 */
230#define PTE_FILE_MAX_BITS 32 230#define PTE_FILE_MAX_BITS 56
231 231
232#define pte_to_pgoff(_pte) \ 232#define pte_to_pgoff(_pte) ((_pte).pte >> 8)
233 ((((_pte).pte >> 3) & 0x1f ) + (((_pte).pte >> 9) << 6 )) 233#define pgoff_to_pte(off) ((pte_t) { ((off) << 8) | _PAGE_FILE })
234
235#define pgoff_to_pte(off) \
236 ((pte_t) { (((off) & 0x1f) << 3) + (((off) >> 6) << 9) + _PAGE_FILE })
237 234
238#endif /* _ASM_PGTABLE_64_H */ 235#endif /* _ASM_PGTABLE_64_H */
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index f80fe75c7800..d0af2a3b0152 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -353,8 +353,9 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot)
353#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1) 353#if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32_R1)
354static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 354static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
355{ 355{
356 pte.pte_low &= _PAGE_CHG_MASK; 356 pte.pte_low &= _PAGE_CHG_MASK;
357 pte.pte_low |= pgprot_val(newprot); 357 pte.pte_high &= ~0x3f;
358 pte.pte_low |= pgprot_val(newprot);
358 pte.pte_high |= pgprot_val(newprot) & 0x3f; 359 pte.pte_high |= pgprot_val(newprot) & 0x3f;
359 return pte; 360 return pte;
360} 361}
diff --git a/include/asm-mips/smp.h b/include/asm-mips/smp.h
index 75c6fe7c2126..e14e4b69de21 100644
--- a/include/asm-mips/smp.h
+++ b/include/asm-mips/smp.h
@@ -48,7 +48,6 @@ extern struct call_data_struct *call_data;
48#define SMP_CALL_FUNCTION 0x2 48#define SMP_CALL_FUNCTION 0x2
49 49
50extern cpumask_t phys_cpu_present_map; 50extern cpumask_t phys_cpu_present_map;
51extern cpumask_t cpu_online_map;
52#define cpu_possible_map phys_cpu_present_map 51#define cpu_possible_map phys_cpu_present_map
53 52
54extern cpumask_t cpu_callout_map; 53extern cpumask_t cpu_callout_map;
@@ -86,9 +85,9 @@ extern void prom_init_secondary(void);
86extern void plat_smp_setup(void); 85extern void plat_smp_setup(void);
87 86
88/* 87/*
89 * Called after init_IRQ but before __cpu_up. 88 * Called in smp_prepare_cpus.
90 */ 89 */
91extern void prom_prepare_cpus(unsigned int max_cpus); 90extern void plat_prepare_cpus(unsigned int max_cpus);
92 91
93/* 92/*
94 * Last chance for the board code to finish SMP initialization before 93 * Last chance for the board code to finish SMP initialization before
diff --git a/include/asm-mips/sparsemem.h b/include/asm-mips/sparsemem.h
new file mode 100644
index 000000000000..795ac6c23203
--- /dev/null
+++ b/include/asm-mips/sparsemem.h
@@ -0,0 +1,14 @@
1#ifndef _MIPS_SPARSEMEM_H
2#define _MIPS_SPARSEMEM_H
3#ifdef CONFIG_SPARSEMEM
4
5/*
6 * SECTION_SIZE_BITS 2^N: how big each section will be
7 * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space
8 */
9#define SECTION_SIZE_BITS 28
10#define MAX_PHYSMEM_BITS 35
11
12#endif /* CONFIG_SPARSEMEM */
13#endif /* _MIPS_SPARSEMEM_H */
14