]> err.no Git - linux-2.6/blobdiff - arch/ia64/sn/kernel/iomv.c
Merge branch 'master' into 83xx
[linux-2.6] / arch / ia64 / sn / kernel / iomv.c
index fec6d8b8237b7191b88cb2e9fca2d2df75e6970f..ab7e2fd40798ea8702d4b4c5bcd167b3310d0645 100644 (file)
@@ -1,35 +1,47 @@
-/* 
+/*
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2000-2003, 2006 Silicon Graphics, Inc. All rights reserved.
  */
 
 #include <linux/module.h>
+#include <linux/acpi.h>
 #include <asm/io.h>
 #include <asm/delay.h>
+#include <asm/vga.h>
 #include <asm/sn/nodepda.h>
 #include <asm/sn/simulator.h>
 #include <asm/sn/pda.h>
 #include <asm/sn/sn_cpuid.h>
 #include <asm/sn/shub_mmr.h>
+#include <asm/sn/acpi.h>
+
+#define IS_LEGACY_VGA_IOPORT(p) \
+       (((p) >= 0x3b0 && (p) <= 0x3bb) || ((p) >= 0x3c0 && (p) <= 0x3df))
 
 /**
  * sn_io_addr - convert an in/out port to an i/o address
  * @port: port to convert
  *
  * Legacy in/out instructions are converted to ld/st instructions
- * on IA64.  This routine will convert a port number into a valid 
+ * on IA64.  This routine will convert a port number into a valid
  * SN i/o address.  Used by sn_in*() and sn_out*().
  */
+
 void *sn_io_addr(unsigned long port)
 {
        if (!IS_RUNNING_ON_SIMULATOR()) {
+               if (IS_LEGACY_VGA_IOPORT(port))
+                       return (__ia64_mk_io_addr(port));
                /* On sn2, legacy I/O ports don't point at anything */
                if (port < (64 * 1024))
                        return NULL;
-               return ((void *)(port | __IA64_UNCACHED_OFFSET));
+               if (SN_ACPI_BASE_SUPPORT())
+                       return (__ia64_mk_io_addr(port));
+               else
+                       return ((void *)(port | __IA64_UNCACHED_OFFSET));
        } else {
                /* but the simulator uses them... */
                unsigned long addr;