diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-12-11 16:41:05 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-12-11 16:41:05 +0000 |
commit | 97b7ae4257ef7ba8ed9b7944a4f56a49af3e8abb (patch) | |
tree | bf175d9a387ad897d3061b24fa88ac0dfe8ba52b /arch/mips/mm/init.c | |
parent | 1bb58fdb51c720e86c239ed5957ecac02d9b0920 (diff) |
Memmap fixes from Maciej.
Diffstat (limited to 'arch/mips/mm/init.c')
-rw-r--r-- | arch/mips/mm/init.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index c632eee00..7035b1574 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -41,7 +41,6 @@ static unsigned long totalram_pages; -extern void prom_fixup_mem_map(unsigned long start, unsigned long end); extern void prom_free_prom_memory(void); @@ -271,7 +270,30 @@ void __init paging_init(void) free_area_init(zones_size); } -extern int page_is_ram(unsigned long pagenr); +#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) + +static inline int page_is_ram(unsigned long pagenr) +{ + int i; + + for (i = 0; i < boot_mem_map.nr_map; i++) { + unsigned long addr, end; + + if (boot_mem_map.map[i].type != BOOT_MEM_RAM) + /* not usable memory */ + continue; + + addr = PFN_UP(boot_mem_map.map[i].addr); + end = PFN_DOWN(boot_mem_map.map[i].addr + + boot_mem_map.map[i].size); + + if (pagenr >= addr && pagenr < end) + return 1; + } + + return 0; +} void __init mem_init(void) { |