diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-11-19 04:26:19 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-01-27 23:18:47 -0500 |
commit | 249cfea914002baac0af4b080306e6b820cd86b2 (patch) | |
tree | 32102587d3cd80986274db5deaee2ab5b7f5adab /arch/sh/mm | |
parent | 2b6a8d455b1368d769da234336314b8364feb781 (diff) |
sh: Split out pgtable.h in to _32 and _64 variants.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm')
-rw-r--r-- | arch/sh/mm/ioremap_64.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/arch/sh/mm/ioremap_64.c b/arch/sh/mm/ioremap_64.c index 95462a0f3120..e27d16519235 100644 --- a/arch/sh/mm/ioremap_64.c +++ b/arch/sh/mm/ioremap_64.c | |||
@@ -1,23 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | * This file is subject to the terms and conditions of the GNU General Public | 2 | * arch/sh/mm/ioremap_64.c |
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * arch/sh64/mm/ioremap.c | ||
7 | * | 3 | * |
8 | * Copyright (C) 2000, 2001 Paolo Alberelli | 4 | * Copyright (C) 2000, 2001 Paolo Alberelli |
9 | * Copyright (C) 2003, 2004 Paul Mundt | 5 | * Copyright (C) 2003 - 2007 Paul Mundt |
10 | * | 6 | * |
11 | * Mostly derived from arch/sh/mm/ioremap.c which, in turn is mostly | 7 | * Mostly derived from arch/sh/mm/ioremap.c which, in turn is mostly |
12 | * derived from arch/i386/mm/ioremap.c . | 8 | * derived from arch/i386/mm/ioremap.c . |
13 | * | 9 | * |
14 | * (C) Copyright 1995 1996 Linus Torvalds | 10 | * (C) Copyright 1995 1996 Linus Torvalds |
11 | * | ||
12 | * This file is subject to the terms and conditions of the GNU General Public | ||
13 | * License. See the file "COPYING" in the main directory of this archive | ||
14 | * for more details. | ||
15 | */ | 15 | */ |
16 | #include <linux/vmalloc.h> | 16 | #include <linux/vmalloc.h> |
17 | #include <linux/ioport.h> | 17 | #include <linux/ioport.h> |
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
21 | #include <linux/bootmem.h> | ||
21 | #include <linux/proc_fs.h> | 22 | #include <linux/proc_fs.h> |
22 | #include <asm/page.h> | 23 | #include <asm/page.h> |
23 | #include <asm/pgalloc.h> | 24 | #include <asm/pgalloc.h> |
@@ -42,7 +43,8 @@ static unsigned long shmedia_ioremap(struct resource *, u32, int); | |||
42 | * have to convert them into an offset in a page-aligned mapping, but the | 43 | * have to convert them into an offset in a page-aligned mapping, but the |
43 | * caller shouldn't need to know that small detail. | 44 | * caller shouldn't need to know that small detail. |
44 | */ | 45 | */ |
45 | void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) | 46 | void *__ioremap(unsigned long phys_addr, unsigned long size, |
47 | unsigned long flags) | ||
46 | { | 48 | { |
47 | void * addr; | 49 | void * addr; |
48 | struct vm_struct * area; | 50 | struct vm_struct * area; |
@@ -83,7 +85,7 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag | |||
83 | } | 85 | } |
84 | EXPORT_SYMBOL(__ioremap); | 86 | EXPORT_SYMBOL(__ioremap); |
85 | 87 | ||
86 | void iounmap(void *addr) | 88 | void __iounmap(void *addr) |
87 | { | 89 | { |
88 | struct vm_struct *area; | 90 | struct vm_struct *area; |
89 | 91 | ||
@@ -96,7 +98,7 @@ void iounmap(void *addr) | |||
96 | 98 | ||
97 | kfree(area); | 99 | kfree(area); |
98 | } | 100 | } |
99 | EXPORT_SYMBOL(iounmap); | 101 | EXPORT_SYMBOL(__iounmap); |
100 | 102 | ||
101 | static struct resource shmedia_iomap = { | 103 | static struct resource shmedia_iomap = { |
102 | .name = "shmedia_iomap", | 104 | .name = "shmedia_iomap", |
@@ -265,6 +267,7 @@ static __init_refok void *sh64_get_page(void) | |||
265 | static void shmedia_mapioaddr(unsigned long pa, unsigned long va) | 267 | static void shmedia_mapioaddr(unsigned long pa, unsigned long va) |
266 | { | 268 | { |
267 | pgd_t *pgdp; | 269 | pgd_t *pgdp; |
270 | pud_t *pudp; | ||
268 | pmd_t *pmdp; | 271 | pmd_t *pmdp; |
269 | pte_t *ptep, pte; | 272 | pte_t *ptep, pte; |
270 | pgprot_t prot; | 273 | pgprot_t prot; |
@@ -274,11 +277,17 @@ static void shmedia_mapioaddr(unsigned long pa, unsigned long va) | |||
274 | 277 | ||
275 | pgdp = pgd_offset_k(va); | 278 | pgdp = pgd_offset_k(va); |
276 | if (pgd_none(*pgdp) || !pgd_present(*pgdp)) { | 279 | if (pgd_none(*pgdp) || !pgd_present(*pgdp)) { |
280 | pudp = (pud_t *)sh64_get_page(); | ||
281 | set_pgd(pgdp, __pgd((unsigned long)pudp | _KERNPG_TABLE)); | ||
282 | } | ||
283 | |||
284 | pudp = pud_offset(pgdp, va); | ||
285 | if (pud_none(*pudp) || !pud_present(*pudp)) { | ||
277 | pmdp = (pmd_t *)sh64_get_page(); | 286 | pmdp = (pmd_t *)sh64_get_page(); |
278 | set_pgd(pgdp, __pgd((unsigned long)pmdp | _KERNPG_TABLE)); | 287 | set_pud(pudp, __pud((unsigned long)pmdp | _KERNPG_TABLE)); |
279 | } | 288 | } |
280 | 289 | ||
281 | pmdp = pmd_offset(pgdp, va); | 290 | pmdp = pmd_offset(pudp, va); |
282 | if (pmd_none(*pmdp) || !pmd_present(*pmdp) ) { | 291 | if (pmd_none(*pmdp) || !pmd_present(*pmdp) ) { |
283 | ptep = (pte_t *)sh64_get_page(); | 292 | ptep = (pte_t *)sh64_get_page(); |
284 | set_pmd(pmdp, __pmd((unsigned long)ptep + _PAGE_TABLE)); | 293 | set_pmd(pmdp, __pmd((unsigned long)ptep + _PAGE_TABLE)); |
@@ -302,12 +311,19 @@ static void shmedia_mapioaddr(unsigned long pa, unsigned long va) | |||
302 | static void shmedia_unmapioaddr(unsigned long vaddr) | 311 | static void shmedia_unmapioaddr(unsigned long vaddr) |
303 | { | 312 | { |
304 | pgd_t *pgdp; | 313 | pgd_t *pgdp; |
314 | pud_t *pudp; | ||
305 | pmd_t *pmdp; | 315 | pmd_t *pmdp; |
306 | pte_t *ptep; | 316 | pte_t *ptep; |
307 | 317 | ||
308 | pgdp = pgd_offset_k(vaddr); | 318 | pgdp = pgd_offset_k(vaddr); |
309 | pmdp = pmd_offset(pgdp, vaddr); | 319 | if (pgd_none(*pgdp) || pgd_bad(*pgdp)) |
320 | return; | ||
321 | |||
322 | pudp = pud_offset(pgdp, vaddr); | ||
323 | if (pud_none(*pudp) || pud_bad(*pudp)) | ||
324 | return; | ||
310 | 325 | ||
326 | pmdp = pmd_offset(pudp, vaddr); | ||
311 | if (pmd_none(*pmdp) || pmd_bad(*pmdp)) | 327 | if (pmd_none(*pmdp) || pmd_bad(*pmdp)) |
312 | return; | 328 | return; |
313 | 329 | ||