diff options
Diffstat (limited to 'arch/arm/mm/mmap.c')
-rw-r--r-- | arch/arm/mm/mmap.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c index 4f5b39687df5..b0a98305055c 100644 --- a/arch/arm/mm/mmap.c +++ b/arch/arm/mm/mmap.c | |||
@@ -144,3 +144,25 @@ int valid_mmap_phys_addr_range(unsigned long pfn, size_t size) | |||
144 | { | 144 | { |
145 | return !(pfn + (size >> PAGE_SHIFT) > 0x00100000); | 145 | return !(pfn + (size >> PAGE_SHIFT) > 0x00100000); |
146 | } | 146 | } |
147 | |||
148 | #ifdef CONFIG_STRICT_DEVMEM | ||
149 | |||
150 | #include <linux/ioport.h> | ||
151 | |||
152 | /* | ||
153 | * devmem_is_allowed() checks to see if /dev/mem access to a certain | ||
154 | * address is valid. The argument is a physical page number. | ||
155 | * We mimic x86 here by disallowing access to system RAM as well as | ||
156 | * device-exclusive MMIO regions. This effectively disable read()/write() | ||
157 | * on /dev/mem. | ||
158 | */ | ||
159 | int devmem_is_allowed(unsigned long pfn) | ||
160 | { | ||
161 | if (iomem_is_exclusive(pfn << PAGE_SHIFT)) | ||
162 | return 0; | ||
163 | if (!page_is_ram(pfn)) | ||
164 | return 1; | ||
165 | return 0; | ||
166 | } | ||
167 | |||
168 | #endif | ||