Merge branch 'for-next' into for-linus
[safe/jmp/linux-2.6] / arch / ia64 / sn / kernel / setup.c
index 1d009f9..d00dfc1 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/interrupt.h>
 #include <linux/acpi.h>
 #include <linux/compiler.h>
-#include <linux/sched.h>
 #include <linux/root_dev.h>
 #include <linux/nodemask.h>
 #include <linux/pm.h>
@@ -65,7 +64,6 @@ extern void sn_timer_init(void);
 extern unsigned long last_time_offset;
 extern void (*ia64_mark_idle) (int);
 extern void snidle(int);
-extern unsigned long long (*ia64_printk_clock)(void);
 
 unsigned long sn_rtc_cycles_per_second;
 EXPORT_SYMBOL(sn_rtc_cycles_per_second);
@@ -167,7 +165,7 @@ void __init early_sn_setup(void)
         * IO on SN2 is done via SAL calls, early_printk won't work without this.
         *
         * This code duplicates some of the ACPI table parsing that is in efi.c & sal.c.
-        * Any changes to those file may have to be made hereas well.
+        * Any changes to those file may have to be made here as well.
         */
        efi_systab = (efi_system_table_t *) __va(ia64_boot_param->efi_systab);
        config_tables = __va(efi_systab->tables);
@@ -194,7 +192,7 @@ void __init early_sn_setup(void)
 }
 
 extern int platform_intr_list[];
-static int __initdata shub_1_1_found;
+static int __cpuinitdata shub_1_1_found;
 
 /*
  * sn_check_for_wars
@@ -202,7 +200,7 @@ static int __initdata shub_1_1_found;
  * Set flag for enabling shub specific wars
  */
 
-static inline int __init is_shub_1_1(int nasid)
+static inline int __cpuinit is_shub_1_1(int nasid)
 {
        unsigned long id;
        int rev;
@@ -214,7 +212,7 @@ static inline int __init is_shub_1_1(int nasid)
        return rev <= 2;
 }
 
-static void __init sn_check_for_wars(void)
+static void __cpuinit sn_check_for_wars(void)
 {
        int cnode;
 
@@ -243,7 +241,7 @@ static void __init sn_check_for_wars(void)
  * Note:  This stuff is duped here because Altix requires the PCDP to
  * locate a usable VGA device due to lack of proper ACPI support.  Structures
  * could be used from drivers/firmware/pcdp.h, but it was decided that moving
- * this file to a more public location just for Altix use was undesireable.
+ * this file to a more public location just for Altix use was undesirable.
  */
 
 struct hcdp_uart_desc {
@@ -348,8 +346,7 @@ sn_scan_pcdp(void)
                        continue;       /* not PCI interconnect */
 
                if (if_pci.translation & PCDP_PCI_TRANS_IOPORT)
-                       vga_console_iobase =
-                               if_pci.ioport_tra | __IA64_UNCACHED_OFFSET;
+                       vga_console_iobase = if_pci.ioport_tra;
 
                if (if_pci.translation & PCDP_PCI_TRANS_MMIO)
                        vga_console_membase =
@@ -362,14 +359,6 @@ sn_scan_pcdp(void)
 
 static unsigned long sn2_rtc_initial;
 
-static unsigned long long ia64_sn2_printk_clock(void)
-{
-       unsigned long rtc_now = rtc_time();
-
-       return (rtc_now - sn2_rtc_initial) *
-               (1000000000 / sn_rtc_cycles_per_second);
-}
-
 /**
  * sn_setup - SN platform setup routine
  * @cmdline_p: kernel command line
@@ -397,6 +386,8 @@ void __init sn_setup(char **cmdline_p)
        ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
        ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
 
+       /* Load the new DSDT and SSDT tables into the global table list. */
+       acpi_table_init();
 
 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
        /*
@@ -427,7 +418,8 @@ void __init sn_setup(char **cmdline_p)
         *      bus containing the VGA console.
         */
        if (vga_console_iobase) {
-               io_space[0].mmio_base = vga_console_iobase;
+               io_space[0].mmio_base =
+                       (unsigned long) ioremap(vga_console_iobase, 0);
                io_space[0].sparse = 0;
        }
 
@@ -467,8 +459,6 @@ void __init sn_setup(char **cmdline_p)
 
        platform_intr_list[ACPI_INTERRUPT_CPEI] = IA64_CPE_VECTOR;
 
-       ia64_printk_clock = ia64_sn2_printk_clock;
-
        printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
 
        /*
@@ -522,7 +512,6 @@ static void __init sn_init_pdas(char **cmdline_p)
        for_each_online_node(cnode) {
                nodepdaindr[cnode] =
                    alloc_bootmem_node(NODE_DATA(cnode), sizeof(nodepda_t));
-               memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));
                memset(nodepdaindr[cnode]->phys_cpuid, -1,
                    sizeof(nodepdaindr[cnode]->phys_cpuid));
                spin_lock_init(&nodepdaindr[cnode]->ptc_lock);
@@ -531,11 +520,9 @@ static void __init sn_init_pdas(char **cmdline_p)
        /*
         * Allocate & initialize nodepda for TIOs.  For now, put them on node 0.
         */
-       for (cnode = num_online_nodes(); cnode < num_cnodes; cnode++) {
+       for (cnode = num_online_nodes(); cnode < num_cnodes; cnode++)
                nodepdaindr[cnode] =
                    alloc_bootmem_node(NODE_DATA(0), sizeof(nodepda_t));
-               memset(nodepdaindr[cnode], 0, sizeof(nodepda_t));
-       }
 
        /*
         * Now copy the array of nodepda pointers to each nodepda.
@@ -580,7 +567,7 @@ void __cpuinit sn_cpu_init(void)
        int slice;
        int cnode;
        int i;
-       static int wars_have_been_checked;
+       static int wars_have_been_checked, set_cpu0_number;
 
        cpuid = smp_processor_id();
        if (cpuid == 0 && IS_MEDUSA()) {
@@ -605,8 +592,16 @@ void __cpuinit sn_cpu_init(void)
        /*
         * Don't check status. The SAL call is not supported on all PROMs
         * but a failure is harmless.
+        * Architechtuallly, cpu_init is always called twice on cpu 0. We
+        * should set cpu_number on cpu 0 once.
         */
-       (void) ia64_sn_set_cpu_number(cpuid);
+       if (cpuid == 0) {
+               if (!set_cpu0_number) {
+                       (void) ia64_sn_set_cpu_number(cpuid);
+                       set_cpu0_number = 1;
+               }
+       } else
+               (void) ia64_sn_set_cpu_number(cpuid);
 
        /*
         * The boot cpu makes this call again after platform initialization is
@@ -737,8 +732,7 @@ void __init build_cnode_tables(void)
                kl_config_hdr_t *klgraph_header;
                nasid = cnodeid_to_nasid(node);
                klgraph_header = ia64_sn_get_klconfig_addr(nasid);
-               if (klgraph_header == NULL)
-                       BUG();
+               BUG_ON(klgraph_header == NULL);
                brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info);
                while (brd) {
                        if (board_needs_cnode(brd->brd_type) && physical_node_map[brd->brd_nasid] < 0) {
@@ -755,7 +749,7 @@ nasid_slice_to_cpuid(int nasid, int slice)
 {
        long cpu;
 
-       for (cpu = 0; cpu < NR_CPUS; cpu++)
+       for (cpu = 0; cpu < nr_cpu_ids; cpu++)
                if (cpuid_to_nasid(cpu) == nasid &&
                                        cpuid_to_slice(cpu) == slice)
                        return cpu;
@@ -769,5 +763,13 @@ int sn_prom_feature_available(int id)
                return 0;
        return test_bit(id, sn_prom_features);
 }
+
+void
+sn_kernel_launch_event(void)
+{
+       /* ignore status until we understand possible failure, if any*/
+       if (ia64_sn_kernel_launch_event())
+               printk(KERN_ERR "KEXEC is not supported in this PROM, Please update the PROM.\n");
+}
 EXPORT_SYMBOL(sn_prom_feature_available);