aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/mm/ioremap.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index baff1da354e0..af78e50ca6ce 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -86,6 +86,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
86 pgprot_t prot; 86 pgprot_t prot;
87 int retval; 87 int retval;
88 void __iomem *ret_addr; 88 void __iomem *ret_addr;
89 int ram_region;
89 90
90 /* Don't allow wraparound or zero size */ 91 /* Don't allow wraparound or zero size */
91 last_addr = phys_addr + size - 1; 92 last_addr = phys_addr + size - 1;
@@ -108,12 +109,23 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
108 /* 109 /*
109 * Don't allow anybody to remap normal RAM that we're using.. 110 * Don't allow anybody to remap normal RAM that we're using..
110 */ 111 */
111 pfn = phys_addr >> PAGE_SHIFT; 112 /* First check if whole region can be identified as RAM or not */
112 last_pfn = last_addr >> PAGE_SHIFT; 113 ram_region = region_is_ram(phys_addr, size);
113 if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL, 114 if (ram_region > 0) {
114 __ioremap_check_ram) == 1) 115 WARN_ONCE(1, "ioremap on RAM at 0x%lx - 0x%lx\n",
116 (unsigned long int)phys_addr,
117 (unsigned long int)last_addr);
115 return NULL; 118 return NULL;
119 }
116 120
121 /* If could not be identified(-1), check page by page */
122 if (ram_region < 0) {
123 pfn = phys_addr >> PAGE_SHIFT;
124 last_pfn = last_addr >> PAGE_SHIFT;
125 if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
126 __ioremap_check_ram) == 1)
127 return NULL;
128 }
117 /* 129 /*
118 * Mappings have to be page-aligned 130 * Mappings have to be page-aligned
119 */ 131 */