diff options
author | Kyle McMartin <kyle@parisc-linux.org> | 2007-02-17 00:18:23 -0500 |
---|---|---|
committer | Kyle McMartin <kyle@parisc-linux.org> | 2007-02-17 00:18:23 -0500 |
commit | e7b3ca08549caccf5d6e1cf066780bf4f0ae77a7 (patch) | |
tree | 7e5745bea06675cfce60d6813ee3b4d5e19cbb56 /arch/parisc/mm | |
parent | 62d0cfcb27cf755cebdc93ca95dabc83608007cd (diff) | |
parent | cb6efb39163bfb6bb6475fa7c8a5e08e44dbf14a (diff) |
Merge branch 'parisc' from /home/kyle/repos/parisc-2.6.git
Conflicts:
arch/parisc/hpux/sys_hpux.c
arch/parisc/mm/ioremap.c
Diffstat (limited to 'arch/parisc/mm')
-rw-r--r-- | arch/parisc/mm/init.c | 64 | ||||
-rw-r--r-- | arch/parisc/mm/ioremap.c | 6 | ||||
-rw-r--r-- | arch/parisc/mm/kmap.c | 166 |
3 files changed, 65 insertions, 171 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c index 0667f2b4f977..fc49a5ed78cc 100644 --- a/arch/parisc/mm/init.c +++ b/arch/parisc/mm/init.c | |||
@@ -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> |
@@ -453,6 +454,8 @@ unsigned long pcxl_dma_start __read_mostly; | |||
453 | 454 | ||
454 | void __init mem_init(void) | 455 | void __init mem_init(void) |
455 | { | 456 | { |
457 | int codesize, reservedpages, datasize, initsize; | ||
458 | |||
456 | high_memory = __va((max_pfn << PAGE_SHIFT)); | 459 | high_memory = __va((max_pfn << PAGE_SHIFT)); |
457 | 460 | ||
458 | #ifndef CONFIG_DISCONTIGMEM | 461 | #ifndef CONFIG_DISCONTIGMEM |
@@ -467,7 +470,32 @@ void __init mem_init(void) | |||
467 | } | 470 | } |
468 | #endif | 471 | #endif |
469 | 472 | ||
470 | printk(KERN_INFO "Memory: %luk available\n", num_physpages << (PAGE_SHIFT-10)); | 473 | codesize = (unsigned long)_etext - (unsigned long)_text; |
474 | datasize = (unsigned long)_edata - (unsigned long)_etext; | ||
475 | initsize = (unsigned long)__init_end - (unsigned long)__init_begin; | ||
476 | |||
477 | reservedpages = 0; | ||
478 | { | ||
479 | unsigned long pfn; | ||
480 | #ifdef CONFIG_DISCONTIGMEM | ||
481 | int i; | ||
482 | |||
483 | for (i = 0; i < npmem_ranges; i++) { | ||
484 | for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) { | ||
485 | if (PageReserved(pfn_to_page(pfn))) | ||
486 | reservedpages++; | ||
487 | } | ||
488 | } | ||
489 | #else /* !CONFIG_DISCONTIGMEM */ | ||
490 | for (pfn = 0; pfn < max_pfn; pfn++) { | ||
491 | /* | ||
492 | * Only count reserved RAM pages | ||
493 | */ | ||
494 | if (PageReserved(pfn_to_page(pfn))) | ||
495 | reservedpages++; | ||
496 | } | ||
497 | #endif | ||
498 | } | ||
471 | 499 | ||
472 | #ifdef CONFIG_PA11 | 500 | #ifdef CONFIG_PA11 |
473 | if (hppa_dma_ops == &pcxl_dma_ops) { | 501 | if (hppa_dma_ops == &pcxl_dma_ops) { |
@@ -481,6 +509,38 @@ void __init mem_init(void) | |||
481 | vmalloc_start = SET_MAP_OFFSET(MAP_START); | 509 | vmalloc_start = SET_MAP_OFFSET(MAP_START); |
482 | #endif | 510 | #endif |
483 | 511 | ||
512 | printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n", | ||
513 | (unsigned long)nr_free_pages() << (PAGE_SHIFT-10), | ||
514 | num_physpages << (PAGE_SHIFT-10), | ||
515 | codesize >> 10, | ||
516 | reservedpages << (PAGE_SHIFT-10), | ||
517 | datasize >> 10, | ||
518 | initsize >> 10 | ||
519 | ); | ||
520 | |||
521 | #ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ | ||
522 | printk("virtual kernel memory layout:\n" | ||
523 | " vmalloc : 0x%p - 0x%p (%4ld MB)\n" | ||
524 | " memory : 0x%p - 0x%p (%4ld MB)\n" | ||
525 | " .init : 0x%p - 0x%p (%4ld kB)\n" | ||
526 | " .data : 0x%p - 0x%p (%4ld kB)\n" | ||
527 | " .text : 0x%p - 0x%p (%4ld kB)\n", | ||
528 | |||
529 | (void*)VMALLOC_START, (void*)VMALLOC_END, | ||
530 | (VMALLOC_END - VMALLOC_START) >> 20, | ||
531 | |||
532 | __va(0), high_memory, | ||
533 | ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, | ||
534 | |||
535 | __init_begin, __init_end, | ||
536 | ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10, | ||
537 | |||
538 | _etext, _edata, | ||
539 | ((unsigned long)_edata - (unsigned long)_etext) >> 10, | ||
540 | |||
541 | _text, _etext, | ||
542 | ((unsigned long)_etext - (unsigned long)_text) >> 10); | ||
543 | #endif | ||
484 | } | 544 | } |
485 | 545 | ||
486 | unsigned long *empty_zero_page __read_mostly; | 546 | unsigned long *empty_zero_page __read_mostly; |
@@ -548,7 +608,7 @@ void show_mem(void) | |||
548 | 608 | ||
549 | printk("Zone list for zone %d on node %d: ", j, i); | 609 | printk("Zone list for zone %d on node %d: ", j, i); |
550 | for (k = 0; zl->zones[k] != NULL; k++) | 610 | for (k = 0; zl->zones[k] != NULL; k++) |
551 | printk("[%d/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name); | 611 | printk("[%ld/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name); |
552 | printk("\n"); | 612 | printk("\n"); |
553 | } | 613 | } |
554 | } | 614 | } |
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 | } | ||