aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/mm/init_32.c5
-rw-r--r--arch/powerpc/mm/mmu_decl.h1
-rw-r--r--arch/powerpc/mm/pgtable_32.c4
-rw-r--r--include/linux/lmb.h1
-rw-r--r--lib/lmb.c7
5 files changed, 16 insertions, 2 deletions
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 703c7c2e0d9f..4ec900af332f 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -82,6 +82,11 @@ extern struct task_struct *current_set[NR_CPUS];
82int __map_without_bats; 82int __map_without_bats;
83int __map_without_ltlbs; 83int __map_without_ltlbs;
84 84
85/*
86 * This tells the system to allow ioremapping memory marked as reserved.
87 */
88int __allow_ioremap_reserved;
89
85/* max amount of low RAM to map in */ 90/* max amount of low RAM to map in */
86unsigned long __max_low_memory = MAX_LOW_MEM; 91unsigned long __max_low_memory = MAX_LOW_MEM;
87 92
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 9aa39fe74f8a..34dacc32250d 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -115,6 +115,7 @@ extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
115extern void invalidate_tlbcam_entry(int index); 115extern void invalidate_tlbcam_entry(int index);
116 116
117extern int __map_without_bats; 117extern int __map_without_bats;
118extern int __allow_ioremap_reserved;
118extern unsigned long ioremap_base; 119extern unsigned long ioremap_base;
119extern unsigned int rtas_data, rtas_size; 120extern unsigned int rtas_data, rtas_size;
120 121
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index b55bbe87acb8..177e4038b43c 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -26,6 +26,7 @@
26#include <linux/vmalloc.h> 26#include <linux/vmalloc.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/lmb.h>
29 30
30#include <asm/pgtable.h> 31#include <asm/pgtable.h>
31#include <asm/pgalloc.h> 32#include <asm/pgalloc.h>
@@ -191,7 +192,8 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
191 * Don't allow anybody to remap normal RAM that we're using. 192 * Don't allow anybody to remap normal RAM that we're using.
192 * mem_init() sets high_memory so only do the check after that. 193 * mem_init() sets high_memory so only do the check after that.
193 */ 194 */
194 if (mem_init_done && (p < virt_to_phys(high_memory))) { 195 if (mem_init_done && (p < virt_to_phys(high_memory)) &&
196 !(__allow_ioremap_reserved && lmb_is_region_reserved(p, size))) {
195 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n", 197 printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
196 (unsigned long long)p, __builtin_return_address(0)); 198 (unsigned long long)p, __builtin_return_address(0));
197 return NULL; 199 return NULL;
diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index 2442e3f3d033..ef82b8fcbddb 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -54,6 +54,7 @@ extern u64 __init lmb_phys_mem_size(void);
54extern u64 lmb_end_of_DRAM(void); 54extern u64 lmb_end_of_DRAM(void);
55extern void __init lmb_enforce_memory_limit(u64 memory_limit); 55extern void __init lmb_enforce_memory_limit(u64 memory_limit);
56extern int __init lmb_is_reserved(u64 addr); 56extern int __init lmb_is_reserved(u64 addr);
57extern int lmb_is_region_reserved(u64 base, u64 size);
57extern int lmb_find(struct lmb_property *res); 58extern int lmb_find(struct lmb_property *res);
58 59
59extern void lmb_dump_all(void); 60extern void lmb_dump_all(void);
diff --git a/lib/lmb.c b/lib/lmb.c
index 0343c05609f0..9cee17142b2c 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -263,7 +263,7 @@ long __init lmb_reserve(u64 base, u64 size)
263 return lmb_add_region(_rgn, base, size); 263 return lmb_add_region(_rgn, base, size);
264} 264}
265 265
266long __init lmb_overlaps_region(struct lmb_region *rgn, u64 base, u64 size) 266long lmb_overlaps_region(struct lmb_region *rgn, u64 base, u64 size)
267{ 267{
268 unsigned long i; 268 unsigned long i;
269 269
@@ -493,6 +493,11 @@ int __init lmb_is_reserved(u64 addr)
493 return 0; 493 return 0;
494} 494}
495 495
496int lmb_is_region_reserved(u64 base, u64 size)
497{
498 return lmb_overlaps_region(&lmb.reserved, base, size);
499}
500
496/* 501/*
497 * Given a <base, len>, find which memory regions belong to this range. 502 * Given a <base, len>, find which memory regions belong to this range.
498 * Adjust the request and return a contiguous chunk. 503 * Adjust the request and return a contiguous chunk.