diff options
-rw-r--r-- | arch/unicore32/include/asm/io.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h index d6920301465a..cb1d8fd2b16b 100644 --- a/arch/unicore32/include/asm/io.h +++ b/arch/unicore32/include/asm/io.h | |||
@@ -48,5 +48,28 @@ extern void __uc32_iounmap(volatile void __iomem *addr); | |||
48 | #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) | 48 | #define PIO_MASK (unsigned int)(IO_SPACE_LIMIT) |
49 | #define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) | 49 | #define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1) |
50 | 50 | ||
51 | #ifdef CONFIG_STRICT_DEVMEM | ||
52 | |||
53 | #include <linux/ioport.h> | ||
54 | #include <linux/mm.h> | ||
55 | |||
56 | /* | ||
57 | * devmem_is_allowed() checks to see if /dev/mem access to a certain | ||
58 | * address is valid. The argument is a physical page number. | ||
59 | * We mimic x86 here by disallowing access to system RAM as well as | ||
60 | * device-exclusive MMIO regions. This effectively disable read()/write() | ||
61 | * on /dev/mem. | ||
62 | */ | ||
63 | static inline int devmem_is_allowed(unsigned long pfn) | ||
64 | { | ||
65 | if (iomem_is_exclusive(pfn << PAGE_SHIFT)) | ||
66 | return 0; | ||
67 | if (!page_is_ram(pfn)) | ||
68 | return 1; | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | #endif /* CONFIG_STRICT_DEVMEM */ | ||
73 | |||
51 | #endif /* __KERNEL__ */ | 74 | #endif /* __KERNEL__ */ |
52 | #endif /* __UNICORE_IO_H__ */ | 75 | #endif /* __UNICORE_IO_H__ */ |