aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaren Myneni <haren@us.ibm.com>2012-07-11 01:18:44 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-07-11 04:22:32 -0400
commite1612de9e4cdf375c3cf1c72434ab8abdcb3927e (patch)
treed2bf73a13ea6e92c9c79d4300294584ef82767c2
parent475d0094293b51353e342d1198377967dbc48169 (diff)
powerpc: Disable /dev/port interface on systems without an ISA bridge
Some power systems do not have legacy ISA devices. So, /dev/port is not a valid interface on these systems. User level tools such as kbdrate is trying to access the device using this interface which is causing the system crash. This patch will fix this issue by not creating this interface on these powerpc systems. Signed-off-by: Haren Myneni <haren@us.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/io.h8
-rw-r--r--drivers/char/mem.c11
-rw-r--r--include/linux/io.h9
3 files changed, 27 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index a3855b81eada..f94ef4213e9d 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -20,6 +20,14 @@ extern int check_legacy_ioport(unsigned long base_port);
20#define _PNPWRP 0xa79 20#define _PNPWRP 0xa79
21#define PNPBIOS_BASE 0xf000 21#define PNPBIOS_BASE 0xf000
22 22
23#if defined(CONFIG_PPC64) && defined(CONFIG_PCI)
24extern struct pci_dev *isa_bridge_pcidev;
25/*
26 * has legacy ISA devices ?
27 */
28#define arch_has_dev_port() (isa_bridge_pcidev != NULL)
29#endif
30
23#include <linux/device.h> 31#include <linux/device.h>
24#include <linux/io.h> 32#include <linux/io.h>
25 33
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 67c3371723cc..e5eedfa24c91 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -27,14 +27,16 @@
27#include <linux/splice.h> 27#include <linux/splice.h>
28#include <linux/pfn.h> 28#include <linux/pfn.h>
29#include <linux/export.h> 29#include <linux/export.h>
30#include <linux/io.h>
30 31
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32#include <asm/io.h>
33 33
34#ifdef CONFIG_IA64 34#ifdef CONFIG_IA64
35# include <linux/efi.h> 35# include <linux/efi.h>
36#endif 36#endif
37 37
38#define DEVPORT_MINOR 4
39
38static inline unsigned long size_inside_page(unsigned long start, 40static inline unsigned long size_inside_page(unsigned long start,
39 unsigned long size) 41 unsigned long size)
40{ 42{
@@ -894,6 +896,13 @@ static int __init chr_dev_init(void)
894 for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) { 896 for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) {
895 if (!devlist[minor].name) 897 if (!devlist[minor].name)
896 continue; 898 continue;
899
900 /*
901 * Create /dev/port?
902 */
903 if ((minor == DEVPORT_MINOR) && !arch_has_dev_port())
904 continue;
905
897 device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor), 906 device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor),
898 NULL, devlist[minor].name); 907 NULL, devlist[minor].name);
899 } 908 }
diff --git a/include/linux/io.h b/include/linux/io.h
index 7fd2d2138bf3..069e4075f872 100644
--- a/include/linux/io.h
+++ b/include/linux/io.h
@@ -67,4 +67,13 @@ int check_signature(const volatile void __iomem *io_addr,
67 const unsigned char *signature, int length); 67 const unsigned char *signature, int length);
68void devm_ioremap_release(struct device *dev, void *res); 68void devm_ioremap_release(struct device *dev, void *res);
69 69
70/*
71 * Some systems do not have legacy ISA devices.
72 * /dev/port is not a valid interface on these systems.
73 * So for those archs, <asm/io.h> should define the following symbol.
74 */
75#ifndef arch_has_dev_port
76#define arch_has_dev_port() (1)
77#endif
78
70#endif /* _LINUX_IO_H */ 79#endif /* _LINUX_IO_H */