powerpc: Delete __cpuinit usage from all users
[linux/fpc-iii.git] / arch / mips / mm / pgtable-64.c
blobe8adc0069d66f17fcc6e27915fa1d5eb8e8258a6
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 1999, 2000 by Silicon Graphics
7 * Copyright (C) 2003 by Ralf Baechle
8 */
9 #include <linux/init.h>
10 #include <linux/mm.h>
11 #include <asm/fixmap.h>
12 #include <asm/pgtable.h>
13 #include <asm/pgalloc.h>
14 #include <asm/tlbflush.h>
16 void pgd_init(unsigned long page)
18 unsigned long *p, *end;
19 unsigned long entry;
21 #ifdef __PAGETABLE_PMD_FOLDED
22 entry = (unsigned long)invalid_pte_table;
23 #else
24 entry = (unsigned long)invalid_pmd_table;
25 #endif
27 p = (unsigned long *) page;
28 end = p + PTRS_PER_PGD;
30 do {
31 p[0] = entry;
32 p[1] = entry;
33 p[2] = entry;
34 p[3] = entry;
35 p[4] = entry;
36 p += 8;
37 p[-3] = entry;
38 p[-2] = entry;
39 p[-1] = entry;
40 } while (p != end);
43 #ifndef __PAGETABLE_PMD_FOLDED
44 void pmd_init(unsigned long addr, unsigned long pagetable)
46 unsigned long *p, *end;
48 p = (unsigned long *) addr;
49 end = p + PTRS_PER_PMD;
51 do {
52 p[0] = pagetable;
53 p[1] = pagetable;
54 p[2] = pagetable;
55 p[3] = pagetable;
56 p[4] = pagetable;
57 p += 8;
58 p[-3] = pagetable;
59 p[-2] = pagetable;
60 p[-1] = pagetable;
61 } while (p != end);
63 #endif
65 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
67 void pmdp_splitting_flush(struct vm_area_struct *vma,
68 unsigned long address,
69 pmd_t *pmdp)
71 if (!pmd_trans_splitting(*pmdp)) {
72 pmd_t pmd = pmd_mksplitting(*pmdp);
73 set_pmd_at(vma->vm_mm, address, pmdp, pmd);
77 #endif
79 pmd_t mk_pmd(struct page *page, pgprot_t prot)
81 pmd_t pmd;
83 pmd_val(pmd) = (page_to_pfn(page) << _PFN_SHIFT) | pgprot_val(prot);
85 return pmd;
88 void set_pmd_at(struct mm_struct *mm, unsigned long addr,
89 pmd_t *pmdp, pmd_t pmd)
91 *pmdp = pmd;
92 flush_tlb_all();
95 void __init pagetable_init(void)
97 unsigned long vaddr;
98 pgd_t *pgd_base;
100 /* Initialize the entire pgd. */
101 pgd_init((unsigned long)swapper_pg_dir);
102 #ifndef __PAGETABLE_PMD_FOLDED
103 pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table);
104 #endif
105 pgd_base = swapper_pg_dir;
107 * Fixed mappings:
109 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
110 fixrange_init(vaddr, vaddr + FIXADDR_SIZE, pgd_base);