This source file includes following definitions.
- MMU_init_hw
- mmu_mapin_ram
- setup_initial_memory_limit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #include <linux/signal.h>
19 #include <linux/sched.h>
20 #include <linux/kernel.h>
21 #include <linux/errno.h>
22 #include <linux/string.h>
23 #include <linux/types.h>
24 #include <linux/ptrace.h>
25 #include <linux/mman.h>
26 #include <linux/mm.h>
27 #include <linux/swap.h>
28 #include <linux/stddef.h>
29 #include <linux/vmalloc.h>
30 #include <linux/init.h>
31 #include <linux/delay.h>
32 #include <linux/highmem.h>
33 #include <linux/memblock.h>
34
35 #include <asm/pgalloc.h>
36 #include <asm/prom.h>
37 #include <asm/io.h>
38 #include <asm/mmu_context.h>
39 #include <asm/pgtable.h>
40 #include <asm/mmu.h>
41 #include <linux/uaccess.h>
42 #include <asm/smp.h>
43 #include <asm/bootx.h>
44 #include <asm/machdep.h>
45 #include <asm/setup.h>
46
47 #include <mm/mmu_decl.h>
48
49 extern int __map_without_ltlbs;
50
51
52
53 void __init MMU_init_hw(void)
54 {
55
56
57
58
59
60
61
62
63
64
65
66
67
68 mtspr(SPRN_ZPR, 0x10000000);
69
70 flush_instruction_cache();
71
72
73
74
75
76
77 mtspr(SPRN_DCWR, 0x00000000);
78
79
80
81
82
83
84 mtspr(SPRN_DCCR, 0xFFFF0000);
85 mtspr(SPRN_ICCR, 0xFFFF0000);
86 }
87
88 #define LARGE_PAGE_SIZE_16M (1<<24)
89 #define LARGE_PAGE_SIZE_4M (1<<22)
90
91 unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top)
92 {
93 unsigned long v, s, mapped;
94 phys_addr_t p;
95
96 v = KERNELBASE;
97 p = 0;
98 s = total_lowmem;
99
100 if (__map_without_ltlbs)
101 return 0;
102
103 while (s >= LARGE_PAGE_SIZE_16M) {
104 pmd_t *pmdp;
105 unsigned long val = p | _PMD_SIZE_16M | _PAGE_EXEC | _PAGE_HWWRITE;
106
107 pmdp = pmd_offset(pud_offset(pgd_offset_k(v), v), v);
108 *pmdp++ = __pmd(val);
109 *pmdp++ = __pmd(val);
110 *pmdp++ = __pmd(val);
111 *pmdp++ = __pmd(val);
112
113 v += LARGE_PAGE_SIZE_16M;
114 p += LARGE_PAGE_SIZE_16M;
115 s -= LARGE_PAGE_SIZE_16M;
116 }
117
118 while (s >= LARGE_PAGE_SIZE_4M) {
119 pmd_t *pmdp;
120 unsigned long val = p | _PMD_SIZE_4M | _PAGE_EXEC | _PAGE_HWWRITE;
121
122 pmdp = pmd_offset(pud_offset(pgd_offset_k(v), v), v);
123 *pmdp = __pmd(val);
124
125 v += LARGE_PAGE_SIZE_4M;
126 p += LARGE_PAGE_SIZE_4M;
127 s -= LARGE_PAGE_SIZE_4M;
128 }
129
130 mapped = total_lowmem - s;
131
132
133
134
135
136
137
138
139 memblock_set_current_limit(mapped);
140
141 return mapped;
142 }
143
144 void setup_initial_memory_limit(phys_addr_t first_memblock_base,
145 phys_addr_t first_memblock_size)
146 {
147
148
149
150 BUG_ON(first_memblock_base != 0);
151
152
153 memblock_set_current_limit(min_t(u64, first_memblock_size, 0x00800000));
154 }