diff options
Diffstat (limited to 'arch/parisc/mm')
-rw-r--r-- | arch/parisc/mm/fault.c | 4 | ||||
-rw-r--r-- | arch/parisc/mm/init.c | 72 | ||||
-rw-r--r-- | arch/parisc/mm/ioremap.c | 6 | ||||
-rw-r--r-- | arch/parisc/mm/kmap.c | 166 |
4 files changed, 69 insertions, 179 deletions
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 641f9c920eee..f6f67554c623 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c | |||
@@ -24,10 +24,6 @@ | |||
24 | /* dumped to the console via printk) */ | 24 | /* dumped to the console via printk) */ |
25 | 25 | ||
26 | 26 | ||
27 | /* Defines for parisc_acctyp() */ | ||
28 | #define READ 0 | ||
29 | #define WRITE 1 | ||
30 | |||
31 | /* Various important other fields */ | 27 | /* Various important other fields */ |
32 | #define bit22set(x) (x & 0x00000200) | 28 | #define bit22set(x) (x & 0x00000200) |
33 | #define bits23_25set(x) (x & 0x000001c0) | 29 | #define bits23_25set(x) (x & 0x000001c0) |
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 12117db0043b..75ea9f2a8a41 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * changed by Philipp Rumpf | 6 | * changed by Philipp Rumpf |
7 | * Copyright 1999 Philipp Rumpf (prumpf@tux.org) | 7 | * Copyright 1999 Philipp Rumpf (prumpf@tux.org) |
8 | * Copyright 2004 Randolph Chung (tausq@debian.org) | 8 | * Copyright 2004 Randolph Chung (tausq@debian.org) |
9 | * Copyright 2006 Helge Deller (deller@gmx.de) | 9 | * Copyright 2006-2007 Helge Deller (deller@gmx.de) |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/pagemap.h> /* for release_pages and page_cache_release */ | 24 | #include <linux/pagemap.h> /* for release_pages and page_cache_release */ |
25 | 25 | ||
26 | #include <asm/pgalloc.h> | 26 | #include <asm/pgalloc.h> |
27 | #include <asm/pgtable.h> | ||
27 | #include <asm/tlb.h> | 28 | #include <asm/tlb.h> |
28 | #include <asm/pdc_chassis.h> | 29 | #include <asm/pdc_chassis.h> |
29 | #include <asm/mmzone.h> | 30 | #include <asm/mmzone.h> |
@@ -65,11 +66,11 @@ static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly; | |||
65 | physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; | 66 | physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly; |
66 | int npmem_ranges __read_mostly; | 67 | int npmem_ranges __read_mostly; |
67 | 68 | ||
68 | #ifdef __LP64__ | 69 | #ifdef CONFIG_64BIT |
69 | #define MAX_MEM (~0UL) | 70 | #define MAX_MEM (~0UL) |
70 | #else /* !__LP64__ */ | 71 | #else /* !CONFIG_64BIT */ |
71 | #define MAX_MEM (3584U*1024U*1024U) | 72 | #define MAX_MEM (3584U*1024U*1024U) |
72 | #endif /* !__LP64__ */ | 73 | #endif /* !CONFIG_64BIT */ |
73 | 74 | ||
74 | static unsigned long mem_limit __read_mostly = MAX_MEM; | 75 | static unsigned long mem_limit __read_mostly = MAX_MEM; |
75 | 76 | ||
@@ -452,6 +453,8 @@ unsigned long pcxl_dma_start __read_mostly; | |||
452 | 453 | ||
453 | void __init mem_init(void) | 454 | void __init mem_init(void) |
454 | { | 455 | { |
456 | int codesize, reservedpages, datasize, initsize; | ||
457 | |||
455 | high_memory = __va((max_pfn << PAGE_SHIFT)); | 458 | high_memory = __va((max_pfn << PAGE_SHIFT)); |
456 | 459 | ||
457 | #ifndef CONFIG_DISCONTIGMEM | 460 | #ifndef CONFIG_DISCONTIGMEM |
@@ -466,7 +469,32 @@ void __init mem_init(void) | |||
466 | } | 469 | } |
467 | #endif | 470 | #endif |
468 | 471 | ||
469 | printk(KERN_INFO "Memory: %luk available\n", num_physpages << (PAGE_SHIFT-10)); | 472 | codesize = (unsigned long)_etext - (unsigned long)_text; |
473 | datasize = (unsigned long)_edata - (unsigned long)_etext; | ||
474 | initsize = (unsigned long)__init_end - (unsigned long)__init_begin; | ||
475 | |||
476 | reservedpages = 0; | ||
477 | { | ||
478 | unsigned long pfn; | ||
479 | #ifdef CONFIG_DISCONTIGMEM | ||
480 | int i; | ||
481 | |||
482 | for (i = 0; i < npmem_ranges; i++) { | ||
483 | for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) { | ||
484 | if (PageReserved(pfn_to_page(pfn))) | ||
485 | reservedpages++; | ||
486 | } | ||
487 | } | ||
488 | #else /* !CONFIG_DISCONTIGMEM */ | ||
489 | for (pfn = 0; pfn < max_pfn; pfn++) { | ||
490 | /* | ||
491 | * Only count reserved RAM pages | ||
492 | */ | ||
493 | if (PageReserved(pfn_to_page(pfn))) | ||
494 | reservedpages++; | ||
495 | } | ||
496 | #endif | ||
497 | } | ||
470 | 498 | ||
471 | #ifdef CONFIG_PA11 | 499 | #ifdef CONFIG_PA11 |
472 | if (hppa_dma_ops == &pcxl_dma_ops) { | 500 | if (hppa_dma_ops == &pcxl_dma_ops) { |
@@ -480,6 +508,38 @@ void __init mem_init(void) | |||
480 | vmalloc_start = SET_MAP_OFFSET(MAP_START); | 508 | vmalloc_start = SET_MAP_OFFSET(MAP_START); |
481 | #endif | 509 | #endif |
482 | 510 | ||
511 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", | ||
512 | (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), | ||
513 | num_physpages << (PAGE_SHIFT-10), | ||
514 | codesize >> 10, | ||
515 | reservedpages << (PAGE_SHIFT-10), | ||
516 | datasize >> 10, | ||
517 | initsize >> 10 | ||
518 | ); | ||
519 | |||
520 | #ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ | ||
521 | printk("virtual kernel memory layout:\n" | ||
522 | " vmalloc : 0x%p - 0x%p (%4ld MB)\n" | ||
523 | " memory : 0x%p - 0x%p (%4ld MB)\n" | ||
524 | " .init : 0x%p - 0x%p (%4ld kB)\n" | ||
525 | " .data : 0x%p - 0x%p (%4ld kB)\n" | ||
526 | " .text : 0x%p - 0x%p (%4ld kB)\n", | ||
527 | |||
528 | (void*)VMALLOC_START, (void*)VMALLOC_END, | ||
529 | (VMALLOC_END - VMALLOC_START) >> 20, | ||
530 | |||
531 | __va(0), high_memory, | ||
532 | ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, | ||
533 | |||
534 | __init_begin, __init_end, | ||
535 | ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10, | ||
536 | |||
537 | _etext, _edata, | ||
538 | ((unsigned long)_edata - (unsigned long)_etext) >> 10, | ||
539 | |||
540 | _text, _etext, | ||
541 | ((unsigned long)_etext - (unsigned long)_text) >> 10); | ||
542 | #endif | ||
483 | } | 543 | } |
484 | 544 | ||
485 | unsigned long *empty_zero_page __read_mostly; | 545 | unsigned long *empty_zero_page __read_mostly; |
@@ -547,7 +607,7 @@ void show_mem(void) | |||
547 | 607 | ||
548 | printk("Zone list for zone %d on node %d: ", j, i); | 608 | printk("Zone list for zone %d on node %d: ", j, i); |
549 | for (k = 0; zl->zones[k] != NULL; k++) | 609 | for (k = 0; zl->zones[k] != NULL; k++) |
550 | printk("[%d/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name); | 610 | printk("[%ld/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name); |
551 | printk("\n"); | 611 | printk("\n"); |
552 | } | 612 | } |
553 | } | 613 | } |
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c index 44b42c7f639d..92d496ad07c9 100644 --- a/arch/parisc/mm/ioremap.c +++ b/arch/parisc/mm/ioremap.c | |||
@@ -26,7 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) | 27 | void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) |
28 | { | 28 | { |
29 | void *addr; | 29 | void __iomem *addr; |
30 | struct vm_struct *area; | 30 | struct vm_struct *area; |
31 | unsigned long offset, last_addr; | 31 | unsigned long offset, last_addr; |
32 | pgprot_t pgprot; | 32 | pgprot_t pgprot; |
@@ -80,14 +80,14 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l | |||
80 | if (!area) | 80 | if (!area) |
81 | return NULL; | 81 | return NULL; |
82 | 82 | ||
83 | addr = area->addr; | 83 | addr = (void __iomem *) area->addr; |
84 | if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, | 84 | if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, |
85 | phys_addr, pgprot)) { | 85 | phys_addr, pgprot)) { |
86 | vfree(addr); | 86 | vfree(addr); |
87 | return NULL; | 87 | return NULL; |
88 | } | 88 | } |
89 | 89 | ||
90 | return (void __iomem *) (offset + (char *)addr); | 90 | return (void __iomem *) (offset + (char __iomem *)addr); |
91 | } | 91 | } |
92 | EXPORT_SYMBOL(__ioremap); | 92 | EXPORT_SYMBOL(__ioremap); |
93 | 93 | ||
diff --git a/arch/parisc/mm/kmap.c b/arch/parisc/mm/kmap.c deleted file mode 100644 index 1b1acd5e2f6e..000000000000 --- a/arch/parisc/mm/kmap.c +++ /dev/null | |||
@@ -1,166 +0,0 @@ | |||
1 | /* | ||
2 | * kmap/page table map and unmap support routines | ||
3 | * | ||
4 | * Copyright 1999,2000 Hewlett-Packard Company | ||
5 | * Copyright 2000 John Marvin <jsm at hp.com> | ||
6 | * Copyright 2000 Grant Grundler <grundler at parisc-linux.org> | ||
7 | * Copyright 2000 Philipp Rumpf <prumpf@tux.org> | ||
8 | * | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2 of the License, or | ||
13 | * (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | /* | ||
25 | ** Stolen mostly from arch/parisc/kernel/pci-dma.c | ||
26 | */ | ||
27 | |||
28 | #include <linux/types.h> | ||
29 | #include <linux/mm.h> | ||
30 | #include <linux/string.h> | ||
31 | #include <linux/pci.h> | ||
32 | |||
33 | #include <linux/slab.h> | ||
34 | #include <linux/vmalloc.h> | ||
35 | |||
36 | #include <asm/uaccess.h> | ||
37 | #include <asm/pgalloc.h> | ||
38 | |||
39 | #include <asm/io.h> | ||
40 | #include <asm/page.h> /* get_order */ | ||
41 | |||
42 | #undef flush_cache_all | ||
43 | #define flush_cache_all flush_all_caches | ||
44 | |||
45 | typedef void (*pte_iterator_t) (pte_t * pte, unsigned long arg); | ||
46 | |||
47 | #if 0 | ||
48 | /* XXX This routine could be used with iterate_page() to replace | ||
49 | * unmap_uncached_page() and save a little code space but I didn't | ||
50 | * do that since I'm not certain whether this is the right path. -PB | ||
51 | */ | ||
52 | static void unmap_cached_pte(pte_t * pte, unsigned long addr, unsigned long arg) | ||
53 | { | ||
54 | pte_t page = *pte; | ||
55 | pte_clear(&init_mm, addr, pte); | ||
56 | if (!pte_none(page)) { | ||
57 | if (pte_present(page)) { | ||
58 | unsigned long map_nr = pte_pagenr(page); | ||
59 | if (map_nr < max_mapnr) | ||
60 | __free_page(mem_map + map_nr); | ||
61 | } else { | ||
62 | printk(KERN_CRIT | ||
63 | "Whee.. Swapped out page in kernel page table\n"); | ||
64 | } | ||
65 | } | ||
66 | } | ||
67 | #endif | ||
68 | |||
69 | /* These two routines should probably check a few things... */ | ||
70 | static void set_uncached(pte_t * pte, unsigned long arg) | ||
71 | { | ||
72 | pte_val(*pte) |= _PAGE_NO_CACHE; | ||
73 | } | ||
74 | |||
75 | static void set_cached(pte_t * pte, unsigned long arg) | ||
76 | { | ||
77 | pte_val(*pte) &= ~_PAGE_NO_CACHE; | ||
78 | } | ||
79 | |||
80 | static inline void iterate_pte(pmd_t * pmd, unsigned long address, | ||
81 | unsigned long size, pte_iterator_t op, | ||
82 | unsigned long arg) | ||
83 | { | ||
84 | pte_t *pte; | ||
85 | unsigned long end; | ||
86 | |||
87 | if (pmd_none(*pmd)) | ||
88 | return; | ||
89 | if (pmd_bad(*pmd)) { | ||
90 | pmd_ERROR(*pmd); | ||
91 | pmd_clear(pmd); | ||
92 | return; | ||
93 | } | ||
94 | pte = pte_offset(pmd, address); | ||
95 | address &= ~PMD_MASK; | ||
96 | end = address + size; | ||
97 | if (end > PMD_SIZE) | ||
98 | end = PMD_SIZE; | ||
99 | do { | ||
100 | op(pte, arg); | ||
101 | address += PAGE_SIZE; | ||
102 | pte++; | ||
103 | } while (address < end); | ||
104 | } | ||
105 | |||
106 | static inline void iterate_pmd(pgd_t * dir, unsigned long address, | ||
107 | unsigned long size, pte_iterator_t op, | ||
108 | unsigned long arg) | ||
109 | { | ||
110 | pmd_t *pmd; | ||
111 | unsigned long end; | ||
112 | |||
113 | if (pgd_none(*dir)) | ||
114 | return; | ||
115 | if (pgd_bad(*dir)) { | ||
116 | pgd_ERROR(*dir); | ||
117 | pgd_clear(dir); | ||
118 | return; | ||
119 | } | ||
120 | pmd = pmd_offset(dir, address); | ||
121 | address &= ~PGDIR_MASK; | ||
122 | end = address + size; | ||
123 | if (end > PGDIR_SIZE) | ||
124 | end = PGDIR_SIZE; | ||
125 | do { | ||
126 | iterate_pte(pmd, address, end - address, op, arg); | ||
127 | address = (address + PMD_SIZE) & PMD_MASK; | ||
128 | pmd++; | ||
129 | } while (address < end); | ||
130 | } | ||
131 | |||
132 | static void iterate_pages(unsigned long address, unsigned long size, | ||
133 | pte_iterator_t op, unsigned long arg) | ||
134 | { | ||
135 | pgd_t *dir; | ||
136 | unsigned long end = address + size; | ||
137 | |||
138 | dir = pgd_offset_k(address); | ||
139 | flush_cache_all(); | ||
140 | do { | ||
141 | iterate_pmd(dir, address, end - address, op, arg); | ||
142 | address = (address + PGDIR_SIZE) & PGDIR_MASK; | ||
143 | dir++; | ||
144 | } while (address && (address < end)); | ||
145 | flush_tlb_all(); | ||
146 | } | ||
147 | |||
148 | void | ||
149 | kernel_set_cachemode(unsigned long vaddr, unsigned long size, int what) | ||
150 | { | ||
151 | switch (what) { | ||
152 | case IOMAP_FULL_CACHING: | ||
153 | iterate_pages(vaddr, size, set_cached, 0); | ||
154 | flush_tlb_range(NULL, vaddr, size); | ||
155 | break; | ||
156 | case IOMAP_NOCACHE_SER: | ||
157 | iterate_pages(vaddr, size, set_uncached, 0); | ||
158 | flush_tlb_range(NULL, vaddr, size); | ||
159 | break; | ||
160 | default: | ||
161 | printk(KERN_CRIT | ||
162 | "kernel_set_cachemode mode %d not understood\n", | ||
163 | what); | ||
164 | break; | ||
165 | } | ||
166 | } | ||