summaryrefslogtreecommitdiffstats
path: root/arch/unicore32/include/asm/io.h
diff options
context:
space:
mode:
authorLinus Torvalds2014-06-21 18:45:54 +0200
committerLinus Torvalds2014-06-21 18:45:54 +0200
commitf1b35b83054cf2b581befd48d32517fadf0d9b16 (patch)
treec36c0f38eda73a48b9f6a8237ce244a6710b8fe0 /arch/unicore32/include/asm/io.h
parentMerge tag 'char-misc-3.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
parentunicore32: Remove ARCH_HAS_CPUFREQ config option (diff)
downloadkernel-qcow2-linux-f1b35b83054cf2b581befd48d32517fadf0d9b16.tar.gz
kernel-qcow2-linux-f1b35b83054cf2b581befd48d32517fadf0d9b16.tar.xz
kernel-qcow2-linux-f1b35b83054cf2b581befd48d32517fadf0d9b16.zip
Merge tag 'for-linus' of git://github.com/gxt/linux
Pull UniCore32 bug fixes from Guan Xuetao: "This includes bugfixes to make unicore32 successfully build under defconfig, and some changes for allmodconfig (though not finished)" * tag 'for-linus' of git://github.com/gxt/linux: unicore32: Remove ARCH_HAS_CPUFREQ config option UniCore32: Change git tree location information in MAINTAINERS arch: unicore32: ksyms: export '__cpuc_coherent_kern_range' to avoid compiling failure arch: unicore32: ksyms: export 'pm_power_off' to avoid compiling failure. arch: unicore32: ksyms: export additional find_first_*() to avoid compiling failure arch:unicore32:mm: add devmem_is_allowed() to support STRICT_DEVMEM unicore32: include: asm: add missing ')' for PAGE_* macros in pgtable.h arch/unicore32/kernel/setup.c: add generic 'screen_info' to avoid compiling failure drivers: scsi: mvsas: fix compiling issue by adding 'MVS_' for "enum pci_interrupt_cause" arch: unicore32: kernel: ksyms: remove 'bswapsi2' and 'muldi3' to avoid compiling failure arch/unicore32/kernel/ksyms.c: remove 2 export symbols to avoid compiling failure drivers/rtc/rtc-puv3.c: remove "&dev->" for typo issue MIME-Version: 1.0 drivers/rtc/rtc-puv3.c: use dev_dbg() instead of dev_debug() for typo issue arch/unicore32/include/asm/io.h: add readl_relaxed() generic definition arch/unicore32/include/asm/ptrace.h: add generic definition for profile_pc() arch/unicore32/mm/alignment.c: include "asm/pgtable.h" to avoid compiling error arch/unicore32/kernel/clock.c: add readl() and writel() for 'PM_' macros arch/unicore32/kernel/module.c: use __vmalloc_node_range() instead of __vmalloc_area() arch/unicore32/kernel/ksyms.c: remove several undefined exported symbols
Diffstat (limited to 'arch/unicore32/include/asm/io.h')
-rw-r--r--arch/unicore32/include/asm/io.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index 39decb6e6f57..cb1d8fd2b16b 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -39,10 +39,37 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
#define ioremap_nocache(cookie, size) __uc32_ioremap(cookie, size)
#define iounmap(cookie) __uc32_iounmap(cookie)
+#define readb_relaxed readb
+#define readw_relaxed readw
+#define readl_relaxed readl
+
#define HAVE_ARCH_PIO_SIZE
#define PIO_OFFSET (unsigned int)(PCI_IOBASE)
#define PIO_MASK (unsigned int)(IO_SPACE_LIMIT)
#define PIO_RESERVED (PIO_OFFSET + PIO_MASK + 1)
+#ifdef CONFIG_STRICT_DEVMEM
+
+#include <linux/ioport.h>
+#include <linux/mm.h>
+
+/*
+ * devmem_is_allowed() checks to see if /dev/mem access to a certain
+ * address is valid. The argument is a physical page number.
+ * We mimic x86 here by disallowing access to system RAM as well as
+ * device-exclusive MMIO regions. This effectively disable read()/write()
+ * on /dev/mem.
+ */
+static inline int devmem_is_allowed(unsigned long pfn)
+{
+ if (iomem_is_exclusive(pfn << PAGE_SHIFT))
+ return 0;
+ if (!page_is_ram(pfn))
+ return 1;
+ return 0;
+}
+
+#endif /* CONFIG_STRICT_DEVMEM */
+
#endif /* __KERNEL__ */
#endif /* __UNICORE_IO_H__ */