sh: Add a command line option for disabling I/O trapping.
authorPaul Mundt <lethal@linux-sh.org>
Thu, 2 Apr 2009 03:31:16 +0000 (12:31 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Thu, 2 Apr 2009 03:31:16 +0000 (12:31 +0900)
This adds a 'noiotrap' kernel command line option to permit disabling of
I/O trapping. This is mostly useful for running on emulators where the
physical device limitations are not an issue.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Documentation/kernel-parameters.txt
arch/sh/kernel/io_trapped.c

index 240257dd4238fc55608989541b79c37e40101abc..8b2067cceadce28f8b4b319dd50df2b59a956a2e 100644 (file)
@@ -1544,6 +1544,8 @@ and is between 256 and 4096 characters. It is defined in the file
                        Valid arguments: on, off
                        Default: on
 
+       noiotrap        [SH] Disables trapped I/O port accesses.
+
        noirqdebug      [X86-32] Disables the code which attempts to detect and
                        disable unhandled interrupt sources.
 
index 39cd7f3aec7bc34b2139a272c497b2bbf8141276..c22853b059efd118528cbff82a02b399412add8c 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/bitops.h>
 #include <linux/vmalloc.h>
 #include <linux/module.h>
+#include <linux/init.h>
 #include <asm/system.h>
 #include <asm/mmu_context.h>
 #include <asm/uaccess.h>
@@ -32,6 +33,15 @@ EXPORT_SYMBOL_GPL(trapped_mem);
 #endif
 static DEFINE_SPINLOCK(trapped_lock);
 
+static int trapped_io_disable __read_mostly;
+
+static int __init trapped_io_setup(char *__unused)
+{
+       trapped_io_disable = 1;
+       return 1;
+}
+__setup("noiotrap", trapped_io_setup);
+
 int register_trapped_io(struct trapped_io *tiop)
 {
        struct resource *res;
@@ -39,6 +49,9 @@ int register_trapped_io(struct trapped_io *tiop)
        struct page *pages[TRAPPED_PAGES_MAX];
        int k, n;
 
+       if (unlikely(trapped_io_disable))
+               return 0;
+
        /* structure must be page aligned */
        if ((unsigned long)tiop & (PAGE_SIZE - 1))
                goto bad;