aboutsummaryrefslogtreecommitdiff
path: root/arch/parisc/mm
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/mm')
-rw-r--r--arch/parisc/mm/fault.c4
-rw-r--r--arch/parisc/mm/init.c72
-rw-r--r--arch/parisc/mm/ioremap.c6
-rw-r--r--arch/parisc/mm/kmap.c166
4 files changed, 69 insertions, 179 deletions
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
index 641f9c920ee..f6f67554c62 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -24,10 +24,6 @@
/* dumped to the console via printk) */
-/* Defines for parisc_acctyp() */
-#define READ 0
-#define WRITE 1
-
/* Various important other fields */
#define bit22set(x) (x & 0x00000200)
#define bits23_25set(x) (x & 0x000001c0)
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 12117db0043..75ea9f2a8a4 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -6,7 +6,7 @@
* changed by Philipp Rumpf
* Copyright 1999 Philipp Rumpf (prumpf@tux.org)
* Copyright 2004 Randolph Chung (tausq@debian.org)
- * Copyright 2006 Helge Deller (deller@gmx.de)
+ * Copyright 2006-2007 Helge Deller (deller@gmx.de)
*
*/
@@ -24,6 +24,7 @@
#include <linux/pagemap.h> /* for release_pages and page_cache_release */
#include <asm/pgalloc.h>
+#include <asm/pgtable.h>
#include <asm/tlb.h>
#include <asm/pdc_chassis.h>
#include <asm/mmzone.h>
@@ -65,11 +66,11 @@ static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly;
physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly;
int npmem_ranges __read_mostly;
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
#define MAX_MEM (~0UL)
-#else /* !__LP64__ */
+#else /* !CONFIG_64BIT */
#define MAX_MEM (3584U*1024U*1024U)
-#endif /* !__LP64__ */
+#endif /* !CONFIG_64BIT */
static unsigned long mem_limit __read_mostly = MAX_MEM;
@@ -452,6 +453,8 @@ unsigned long pcxl_dma_start __read_mostly;
void __init mem_init(void)
{
+ int codesize, reservedpages, datasize, initsize;
+
high_memory = __va((max_pfn << PAGE_SHIFT));
#ifndef CONFIG_DISCONTIGMEM
@@ -466,7 +469,32 @@ void __init mem_init(void)
}
#endif
- printk(KERN_INFO "Memory: %luk available\n", num_physpages << (PAGE_SHIFT-10));
+ codesize = (unsigned long)_etext - (unsigned long)_text;
+ datasize = (unsigned long)_edata - (unsigned long)_etext;
+ initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
+
+ reservedpages = 0;
+{
+ unsigned long pfn;
+#ifdef CONFIG_DISCONTIGMEM
+ int i;
+
+ for (i = 0; i < npmem_ranges; i++) {
+ for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
+ if (PageReserved(pfn_to_page(pfn)))
+ reservedpages++;
+ }
+ }
+#else /* !CONFIG_DISCONTIGMEM */
+ for (pfn = 0; pfn < max_pfn; pfn++) {
+ /*
+ * Only count reserved RAM pages
+ */
+ if (PageReserved(pfn_to_page(pfn)))
+ reservedpages++;
+ }
+#endif
+}
#ifdef CONFIG_PA11
if (hppa_dma_ops == &pcxl_dma_ops) {
@@ -480,6 +508,38 @@ void __init mem_init(void)
vmalloc_start = SET_MAP_OFFSET(MAP_START);
#endif
+ printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
+ (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
+ num_physpages << (PAGE_SHIFT-10),
+ codesize >> 10,
+ reservedpages << (PAGE_SHIFT-10),
+ datasize >> 10,
+ initsize >> 10
+ );
+
+#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
+ printk("virtual kernel memory layout:\n"
+ " vmalloc : 0x%p - 0x%p (%4ld MB)\n"
+ " memory : 0x%p - 0x%p (%4ld MB)\n"
+ " .init : 0x%p - 0x%p (%4ld kB)\n"
+ " .data : 0x%p - 0x%p (%4ld kB)\n"
+ " .text : 0x%p - 0x%p (%4ld kB)\n",
+
+ (void*)VMALLOC_START, (void*)VMALLOC_END,
+ (VMALLOC_END - VMALLOC_START) >> 20,
+
+ __va(0), high_memory,
+ ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
+
+ __init_begin, __init_end,
+ ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10,
+
+ _etext, _edata,
+ ((unsigned long)_edata - (unsigned long)_etext) >> 10,
+
+ _text, _etext,
+ ((unsigned long)_etext - (unsigned long)_text) >> 10);
+#endif
}
unsigned long *empty_zero_page __read_mostly;
@@ -547,7 +607,7 @@ void show_mem(void)
printk("Zone list for zone %d on node %d: ", j, i);
for (k = 0; zl->zones[k] != NULL; k++)
- printk("[%d/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name);
+ printk("[%ld/%s] ", zone_to_nid(zl->zones[k]), zl->zones[k]->name);
printk("\n");
}
}
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
index 44b42c7f639..92d496ad07c 100644
--- a/arch/parisc/mm/ioremap.c
+++ b/arch/parisc/mm/ioremap.c
@@ -26,7 +26,7 @@
*/
void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
{
- void *addr;
+ void __iomem *addr;
struct vm_struct *area;
unsigned long offset, last_addr;
pgprot_t pgprot;
@@ -80,14 +80,14 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
if (!area)
return NULL;
- addr = area->addr;
+ addr = (void __iomem *) area->addr;
if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size,
phys_addr, pgprot)) {
vfree(addr);
return NULL;
}
- return (void __iomem *) (offset + (char *)addr);
+ return (void __iomem *) (offset + (char __iomem *)addr);
}
EXPORT_SYMBOL(__ioremap);
diff --git a/arch/parisc/mm/kmap.c b/arch/parisc/mm/kmap.c
deleted file mode 100644
index 1b1acd5e2f6..00000000000
--- a/arch/parisc/mm/kmap.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * kmap/page table map and unmap support routines
- *
- * Copyright 1999,2000 Hewlett-Packard Company
- * Copyright 2000 John Marvin <jsm at hp.com>
- * Copyright 2000 Grant Grundler <grundler at parisc-linux.org>
- * Copyright 2000 Philipp Rumpf <prumpf@tux.org>
- *
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-/*
-** Stolen mostly from arch/parisc/kernel/pci-dma.c
-*/
-
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/string.h>
-#include <linux/pci.h>
-
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
-
-#include <asm/io.h>
-#include <asm/page.h> /* get_order */
-
-#undef flush_cache_all
-#define flush_cache_all flush_all_caches
-
-typedef void (*pte_iterator_t) (pte_t * pte, unsigned long arg);
-
-#if 0
-/* XXX This routine could be used with iterate_page() to replace
- * unmap_uncached_page() and save a little code space but I didn't
- * do that since I'm not certain whether this is the right path. -PB
- */
-static void unmap_cached_pte(pte_t * pte, unsigned long addr, unsigned long arg)
-{
- pte_t page = *pte;
- pte_clear(&init_mm, addr, pte);
- if (!pte_none(page)) {
- if (pte_present(page)) {
- unsigned long map_nr = pte_pagenr(page);
- if (map_nr < max_mapnr)
- __free_page(mem_map + map_nr);
- } else {
- printk(KERN_CRIT
- "Whee.. Swapped out page in kernel page table\n");
- }
- }
-}
-#endif
-
-/* These two routines should probably check a few things... */
-static void set_uncached(pte_t * pte, unsigned long arg)
-{
- pte_val(*pte) |= _PAGE_NO_CACHE;
-}
-
-static void set_cached(pte_t * pte, unsigned long arg)
-{
- pte_val(*pte) &= ~_PAGE_NO_CACHE;
-}
-
-static inline void iterate_pte(pmd_t * pmd, unsigned long address,
- unsigned long size, pte_iterator_t op,
- unsigned long arg)
-{
- pte_t *pte;
- unsigned long end;
-
- if (pmd_none(*pmd))
- return;
- if (pmd_bad(*pmd)) {
- pmd_ERROR(*pmd);
- pmd_clear(pmd);
- return;
- }
- pte = pte_offset(pmd, address);
- address &= ~PMD_MASK;
- end = address + size;
- if (end > PMD_SIZE)
- end = PMD_SIZE;
- do {
- op(pte, arg);
- address += PAGE_SIZE;
- pte++;
- } while (address < end);
-}
-
-static inline void iterate_pmd(pgd_t * dir, unsigned long address,
- unsigned long size, pte_iterator_t op,
- unsigned long arg)
-{
- pmd_t *pmd;
- unsigned long end;
-
- if (pgd_none(*dir))
- return;
- if (pgd_bad(*dir)) {
- pgd_ERROR(*dir);
- pgd_clear(dir);
- return;
- }
- pmd = pmd_offset(dir, address);
- address &= ~PGDIR_MASK;
- end = address + size;
- if (end > PGDIR_SIZE)
- end = PGDIR_SIZE;
- do {
- iterate_pte(pmd, address, end - address, op, arg);
- address = (address + PMD_SIZE) & PMD_MASK;
- pmd++;
- } while (address < end);
-}
-
-static void iterate_pages(unsigned long address, unsigned long size,
- pte_iterator_t op, unsigned long arg)
-{
- pgd_t *dir;
- unsigned long end = address + size;
-
- dir = pgd_offset_k(address);
- flush_cache_all();
- do {
- iterate_pmd(dir, address, end - address, op, arg);
- address = (address + PGDIR_SIZE) & PGDIR_MASK;
- dir++;
- } while (address && (address < end));
- flush_tlb_all();
-}
-
-void
-kernel_set_cachemode(unsigned long vaddr, unsigned long size, int what)
-{
- switch (what) {
- case IOMAP_FULL_CACHING:
- iterate_pages(vaddr, size, set_cached, 0);
- flush_tlb_range(NULL, vaddr, size);
- break;
- case IOMAP_NOCACHE_SER:
- iterate_pages(vaddr, size, set_uncached, 0);
- flush_tlb_range(NULL, vaddr, size);
- break;
- default:
- printk(KERN_CRIT
- "kernel_set_cachemode mode %d not understood\n",
- what);
- break;
- }
-}