Pull percpu-dtc into release branch
[sfrench/cifs-2.6.git] / arch / ia64 / kernel / setup.c
index 5fa09d141ab7a8545a963dfb1e9e60fdb316ea7e..6e19da122ae3a75952513aaa49166f511440c2ac 100644 (file)
@@ -75,7 +75,6 @@ extern void ia64_setup_printk_clock(void);
 
 DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info);
 DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);
-DEFINE_PER_CPU(unsigned long, ia64_phys_stacked_size_p8);
 unsigned long ia64_cycles_per_usec;
 struct ia64_boot_param *ia64_boot_param;
 struct screen_info screen_info;
@@ -91,8 +90,6 @@ static struct resource code_resource = {
        .name   = "Kernel code",
        .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
 };
-extern void efi_initialize_iomem_resources(struct resource *,
-               struct resource *);
 extern char _text[], _end[], _etext[];
 
 unsigned long ia64_max_cacheline_size;
@@ -251,6 +248,12 @@ reserve_memory (void)
        }
 #endif
 
+#ifdef CONFIG_PROC_VMCORE
+       if (reserve_elfcorehdr(&rsvd_region[n].start,
+                              &rsvd_region[n].end) == 0)
+               n++;
+#endif
+
        efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
        n++;
 
@@ -453,6 +456,30 @@ static int __init parse_elfcorehdr(char *arg)
        return 0;
 }
 early_param("elfcorehdr", parse_elfcorehdr);
+
+int __init reserve_elfcorehdr(unsigned long *start, unsigned long *end)
+{
+       unsigned long length;
+
+       /* We get the address using the kernel command line,
+        * but the size is extracted from the EFI tables.
+        * Both address and size are required for reservation
+        * to work properly.
+        */
+
+       if (elfcorehdr_addr >= ELFCORE_ADDR_MAX)
+               return -EINVAL;
+
+       if ((length = vmcore_find_descriptor_size(elfcorehdr_addr)) == 0) {
+               elfcorehdr_addr = ELFCORE_ADDR_MAX;
+               return -EINVAL;
+       }
+
+       *start = (unsigned long)__va(elfcorehdr_addr);
+       *end = *start + length;
+       return 0;
+}
+
 #endif /* CONFIG_PROC_VMCORE */
 
 void __init
@@ -612,7 +639,7 @@ show_cpuinfo (struct seq_file *m, void *v)
                   "features   : %s\n"
                   "cpu number : %lu\n"
                   "cpu regs   : %u\n"
-                  "cpu MHz    : %lu.%06lu\n"
+                  "cpu MHz    : %lu.%03lu\n"
                   "itc MHz    : %lu.%06lu\n"
                   "BogoMIPS   : %lu.%02lu\n",
                   cpunum, c->vendor, c->family, c->model,
@@ -664,12 +691,15 @@ struct seq_operations cpuinfo_op = {
        .show =         show_cpuinfo
 };
 
-static char brandname[128];
+#define MAX_BRANDS     8
+static char brandname[MAX_BRANDS][128];
 
 static char * __cpuinit
 get_model_name(__u8 family, __u8 model)
 {
+       static int overflow;
        char brand[128];
+       int i;
 
        memcpy(brand, "Unknown", 8);
        if (ia64_pal_get_brand_info(brand)) {
@@ -681,12 +711,17 @@ get_model_name(__u8 family, __u8 model)
                        case 2: memcpy(brand, "Madison up to 9M cache", 23); break;
                }
        }
-       if (brandname[0] == '\0')
-               return strcpy(brandname, brand);
-       else if (strcmp(brandname, brand) == 0)
-               return brandname;
-       else
-               return kstrdup(brand, GFP_KERNEL);
+       for (i = 0; i < MAX_BRANDS; i++)
+               if (strcmp(brandname[i], brand) == 0)
+                       return brandname[i];
+       for (i = 0; i < MAX_BRANDS; i++)
+               if (brandname[i][0] == '\0')
+                       return strcpy(brandname[i], brand);
+       if (overflow++ == 0)
+               printk(KERN_ERR
+                      "%s: Table overflow. Some processor model information will be missing\n",
+                      __FUNCTION__);
+       return "Unknown";
 }
 
 static void __cpuinit
@@ -833,6 +868,7 @@ void __cpuinit
 cpu_init (void)
 {
        extern void __cpuinit ia64_mmu_init (void *);
+       static unsigned long max_num_phys_stacked = IA64_NUM_PHYS_STACK_REG;
        unsigned long num_phys_stacked;
        pal_vm_info_2_u_t vmi;
        unsigned int max_ctx;
@@ -946,7 +982,10 @@ cpu_init (void)
                num_phys_stacked = 96;
        }
        /* size of physical stacked register partition plus 8 bytes: */
-       __get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
+       if (num_phys_stacked > max_num_phys_stacked) {
+               ia64_patch_phys_stack_reg(num_phys_stacked*8 + 8);
+               max_num_phys_stacked = num_phys_stacked;
+       }
        platform_cpu_init();
        pm_idle = default_idle;
 }