fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / i386 / mach-es7000 / es7000plat.c
index 70db264..3d0fc85 100644 (file)
@@ -50,28 +50,45 @@ struct mip_reg              *mip_reg;
 struct mip_reg         *host_reg;
 int                    mip_port;
 unsigned long          mip_addr, host_addr;
-extern int (*platform_rename_gsi)();
 
-static int __init
+/*
+ * GSI override for ES7000 platforms.
+ */
+
+static unsigned int base;
+
+static int
 es7000_rename_gsi(int ioapic, int gsi)
 {
-       if (ioapic)
-               return gsi;
-       else {
-               if (gsi == 0)
-                       return 13;
-               if (gsi == 1)
-                       return 16;
-               if (gsi == 4)
-                       return 17;
-               if (gsi == 6)
-                       return 18;
-               if (gsi == 7)
-                       return 19;
-               if (gsi == 8)
-                       return 20;
+       if (es7000_plat == ES7000_ZORRO)
                return gsi;
-        }
+
+       if (!base) {
+               int i;
+               for (i = 0; i < nr_ioapics; i++)
+                       base += nr_ioapic_registers[i];
+       }
+
+       if (!ioapic && (gsi < 16)) 
+               gsi += base;
+       return gsi;
+}
+
+void __init
+setup_unisys(void)
+{
+       /*
+        * Determine the generation of the ES7000 currently running.
+        *
+        * es7000_plat = 1 if the machine is a 5xx ES7000 box
+        * es7000_plat = 2 if the machine is a x86_64 ES7000 box
+        *
+        */
+       if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
+               es7000_plat = ES7000_ZORRO;
+       else
+               es7000_plat = ES7000_CLASSIC;
+       ioapic_renumber_irq = es7000_rename_gsi;
 }
 
 /*
@@ -79,7 +96,7 @@ es7000_rename_gsi(int ioapic, int gsi)
  */
 
 int __init
-parse_unisys_oem (char *oemptr, int oem_entries)
+parse_unisys_oem (char *oemptr)
 {
        int                     i;
        int                     success = 0;
@@ -94,7 +111,7 @@ parse_unisys_oem (char *oemptr, int oem_entries)
 
        tp += 8;
 
-       for (i=0; i <= oem_entries; i++) {
+       for (i=0; i <= 6; i++) {
                type = *tp++;
                size = *tp++;
                tp -= 2;
@@ -129,23 +146,19 @@ parse_unisys_oem (char *oemptr, int oem_entries)
                default:
                        break;
                }
-               if (i == 6) break;
                tp += size;
        }
 
        if (success < 2) {
-               printk("\nNo ES7000 found.\n");
-               es7000_plat = 0;
-       } else {
-               printk("\nEnabling ES7000 specific features...\n");
-               es7000_plat = 1;
-               platform_rename_gsi = es7000_rename_gsi;
-       }
+               es7000_plat = NON_UNISYS;
+       } else
+               setup_unisys();
        return es7000_plat;
 }
 
+#ifdef CONFIG_ACPI
 int __init
-find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length)
+find_unisys_acpi_oem_table(unsigned long *oem_addr)
 {
        struct acpi_table_rsdp          *rsdp = NULL;
        unsigned long                   rsdp_phys = 0;
@@ -189,15 +202,14 @@ find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length)
                                acpi_table_print(header, sdt.entry[i].pa);
                                t = (struct oem_table *) __acpi_map_table(sdt.entry[i].pa, header->length);
                                addr = (void *) __acpi_map_table(t->OEMTableAddr, t->OEMTableSize);
-                               *length = header->length;
                                *oem_addr = (unsigned long) addr;
                                return 0;
                        }
                }
        }
-       printk("ES7000: did not find Unisys ACPI OEM table!\n");
        return -1;
 }
+#endif
 
 static void
 es7000_spin(int n)
@@ -239,7 +251,7 @@ es7000_mip_write(struct mip_reg *mip_reg)
        }
 
        status = ((unsigned long long)mip_reg->off_0 &
-               (unsigned long long)0xffff0000000000) >> 48;
+               (unsigned long long)0xffff0000000000ULL) >> 48;
        mip_reg->off_38 = ((unsigned long long)mip_reg->off_38 &
                (unsigned long long)~MIP_VALID);
        return status;