diff options
Diffstat (limited to 'arch/microblaze/mm/pgtable.c')
-rw-r--r-- | arch/microblaze/mm/pgtable.c | 66 |
1 files changed, 18 insertions, 48 deletions
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c index 46c4ca5d15c5..59bf2335a4ce 100644 --- a/arch/microblaze/mm/pgtable.c +++ b/arch/microblaze/mm/pgtable.c | |||
@@ -42,6 +42,7 @@ | |||
42 | 42 | ||
43 | unsigned long ioremap_base; | 43 | unsigned long ioremap_base; |
44 | unsigned long ioremap_bot; | 44 | unsigned long ioremap_bot; |
45 | EXPORT_SYMBOL(ioremap_bot); | ||
45 | 46 | ||
46 | /* The maximum lowmem defaults to 768Mb, but this can be configured to | 47 | /* The maximum lowmem defaults to 768Mb, but this can be configured to |
47 | * another value. | 48 | * another value. |
@@ -103,7 +104,7 @@ static void __iomem *__ioremap(phys_addr_t addr, unsigned long size, | |||
103 | area = get_vm_area(size, VM_IOREMAP); | 104 | area = get_vm_area(size, VM_IOREMAP); |
104 | if (area == NULL) | 105 | if (area == NULL) |
105 | return NULL; | 106 | return NULL; |
106 | v = VMALLOC_VMADDR(area->addr); | 107 | v = (unsigned long) area->addr; |
107 | } else { | 108 | } else { |
108 | v = (ioremap_bot -= size); | 109 | v = (ioremap_bot -= size); |
109 | } | 110 | } |
@@ -144,7 +145,6 @@ int map_page(unsigned long va, phys_addr_t pa, int flags) | |||
144 | pmd_t *pd; | 145 | pmd_t *pd; |
145 | pte_t *pg; | 146 | pte_t *pg; |
146 | int err = -ENOMEM; | 147 | int err = -ENOMEM; |
147 | /* spin_lock(&init_mm.page_table_lock); */ | ||
148 | /* Use upper 10 bits of VA to index the first level map */ | 148 | /* Use upper 10 bits of VA to index the first level map */ |
149 | pd = pmd_offset(pgd_offset_k(va), va); | 149 | pd = pmd_offset(pgd_offset_k(va), va); |
150 | /* Use middle 10 bits of VA to index the second-level map */ | 150 | /* Use middle 10 bits of VA to index the second-level map */ |
@@ -155,39 +155,13 @@ int map_page(unsigned long va, phys_addr_t pa, int flags) | |||
155 | err = 0; | 155 | err = 0; |
156 | set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, | 156 | set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, |
157 | __pgprot(flags))); | 157 | __pgprot(flags))); |
158 | if (mem_init_done) | 158 | if (unlikely(mem_init_done)) |
159 | flush_HPTE(0, va, pmd_val(*pd)); | 159 | flush_HPTE(0, va, pmd_val(*pd)); |
160 | /* flush_HPTE(0, va, pg); */ | 160 | /* flush_HPTE(0, va, pg); */ |
161 | |||
162 | } | 161 | } |
163 | /* spin_unlock(&init_mm.page_table_lock); */ | ||
164 | return err; | 162 | return err; |
165 | } | 163 | } |
166 | 164 | ||
167 | void __init adjust_total_lowmem(void) | ||
168 | { | ||
169 | /* TBD */ | ||
170 | #if 0 | ||
171 | unsigned long max_low_mem = MAX_LOW_MEM; | ||
172 | |||
173 | if (total_lowmem > max_low_mem) { | ||
174 | total_lowmem = max_low_mem; | ||
175 | #ifndef CONFIG_HIGHMEM | ||
176 | printk(KERN_INFO "Warning, memory limited to %ld Mb, use " | ||
177 | "CONFIG_HIGHMEM to reach %ld Mb\n", | ||
178 | max_low_mem >> 20, total_memory >> 20); | ||
179 | total_memory = total_lowmem; | ||
180 | #endif /* CONFIG_HIGHMEM */ | ||
181 | } | ||
182 | #endif | ||
183 | } | ||
184 | |||
185 | static void show_tmem(unsigned long tmem) | ||
186 | { | ||
187 | volatile unsigned long a; | ||
188 | a = a + tmem; | ||
189 | } | ||
190 | |||
191 | /* | 165 | /* |
192 | * Map in all of physical memory starting at CONFIG_KERNEL_START. | 166 | * Map in all of physical memory starting at CONFIG_KERNEL_START. |
193 | */ | 167 | */ |
@@ -197,7 +171,6 @@ void __init mapin_ram(void) | |||
197 | 171 | ||
198 | v = CONFIG_KERNEL_START; | 172 | v = CONFIG_KERNEL_START; |
199 | p = memory_start; | 173 | p = memory_start; |
200 | show_tmem(memory_size); | ||
201 | for (s = 0; s < memory_size; s += PAGE_SIZE) { | 174 | for (s = 0; s < memory_size; s += PAGE_SIZE) { |
202 | f = _PAGE_PRESENT | _PAGE_ACCESSED | | 175 | f = _PAGE_PRESENT | _PAGE_ACCESSED | |
203 | _PAGE_SHARED | _PAGE_HWEXEC; | 176 | _PAGE_SHARED | _PAGE_HWEXEC; |
@@ -216,24 +189,6 @@ void __init mapin_ram(void) | |||
216 | /* is x a power of 2? */ | 189 | /* is x a power of 2? */ |
217 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) | 190 | #define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0)) |
218 | 191 | ||
219 | /* | ||
220 | * Set up a mapping for a block of I/O. | ||
221 | * virt, phys, size must all be page-aligned. | ||
222 | * This should only be called before ioremap is called. | ||
223 | */ | ||
224 | void __init io_block_mapping(unsigned long virt, phys_addr_t phys, | ||
225 | unsigned int size, int flags) | ||
226 | { | ||
227 | int i; | ||
228 | |||
229 | if (virt > CONFIG_KERNEL_START && virt < ioremap_bot) | ||
230 | ioremap_bot = ioremap_base = virt; | ||
231 | |||
232 | /* Put it in the page tables. */ | ||
233 | for (i = 0; i < size; i += PAGE_SIZE) | ||
234 | map_page(virt + i, phys + i, flags); | ||
235 | } | ||
236 | |||
237 | /* Scan the real Linux page tables and return a PTE pointer for | 192 | /* Scan the real Linux page tables and return a PTE pointer for |
238 | * a virtual address in a context. | 193 | * a virtual address in a context. |
239 | * Returns true (1) if PTE was found, zero otherwise. The pointer to | 194 | * Returns true (1) if PTE was found, zero otherwise. The pointer to |
@@ -284,3 +239,18 @@ unsigned long iopa(unsigned long addr) | |||
284 | 239 | ||
285 | return pa; | 240 | return pa; |
286 | } | 241 | } |
242 | |||
243 | __init_refok pte_t *pte_alloc_one_kernel(struct mm_struct *mm, | ||
244 | unsigned long address) | ||
245 | { | ||
246 | pte_t *pte; | ||
247 | if (mem_init_done) { | ||
248 | pte = (pte_t *)__get_free_page(GFP_KERNEL | | ||
249 | __GFP_REPEAT | __GFP_ZERO); | ||
250 | } else { | ||
251 | pte = (pte_t *)early_get_page(); | ||
252 | if (pte) | ||
253 | clear_page(pte); | ||
254 | } | ||
255 | return pte; | ||
256 | } | ||