[ARM] cachetype: move definitions to separate header
[safe/jmp/linux-2.6] / arch / arm / kernel / setup.c
index 238dd9b..e90422d 100644 (file)
 #include <linux/cpu.h>
 #include <linux/interrupt.h>
 #include <linux/smp.h>
+#include <linux/fs.h>
 
 #include <asm/cpu.h>
+#include <asm/cputype.h>
 #include <asm/elf.h>
 #include <asm/procinfo.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/cacheflush.h>
+#include <asm/cachetype.h>
 #include <asm/tlbflush.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/time.h>
+#include <asm/traps.h>
 
 #include "compat.h"
+#include "atags.h"
 
 #ifndef MEM_SIZE
 #define MEM_SIZE       (16*1024*1024)
@@ -60,9 +65,12 @@ extern int root_mountflags;
 extern void _stext, _text, _etext, __data_start, _edata, _end;
 
 unsigned int processor_id;
+EXPORT_SYMBOL(processor_id);
 unsigned int __machine_arch_type;
 EXPORT_SYMBOL(__machine_arch_type);
 
+unsigned int __atags_pointer __initdata;
+
 unsigned int system_rev;
 EXPORT_SYMBOL(system_rev);
 
@@ -75,6 +83,8 @@ EXPORT_SYMBOL(system_serial_high);
 unsigned int elf_hwcap;
 EXPORT_SYMBOL(elf_hwcap);
 
+unsigned long __initdata vmalloc_reserve = 128 << 20;
+
 
 #ifdef MULTI_CPU
 struct processor processor;
@@ -88,6 +98,9 @@ struct cpu_user_fns cpu_user;
 #ifdef MULTI_CACHE
 struct cpu_cache_fns cpu_cache;
 #endif
+#ifdef CONFIG_OUTER_CACHE
+struct outer_cache_fns outer_cache;
+#endif
 
 struct stack {
        u32 irq[3];
@@ -106,7 +119,7 @@ unsigned long phys_initrd_size __initdata = 0;
 static struct meminfo meminfo __initdata = { 0, };
 static const char *cpu_name;
 static const char *machine_name;
-static char command_line[COMMAND_LINE_SIZE];
+static char __initdata command_line[COMMAND_LINE_SIZE];
 
 static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
 static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } };
@@ -269,9 +282,9 @@ static inline void dump_cache(const char *prefix, int cpu, unsigned int cache)
 
 static void __init dump_cpu_info(int cpu)
 {
-       unsigned int info = read_cpuid(CPUID_CACHETYPE);
+       unsigned int info = read_cpuid_cachetype();
 
-       if (info != processor_id) {
+       if (info != read_cpuid_id()) {
                printk("CPU%u: D %s %s cache\n", cpu, cache_is_vivt() ? "VIVT" : "VIPT",
                       cache_types[CACHE_TYPE(info)]);
                if (CACHE_S(info)) {
@@ -290,18 +303,31 @@ int cpu_architecture(void)
 {
        int cpu_arch;
 
-       if ((processor_id & 0x0008f000) == 0) {
+       if ((read_cpuid_id() & 0x0008f000) == 0) {
                cpu_arch = CPU_ARCH_UNKNOWN;
-       } else if ((processor_id & 0x0008f000) == 0x00007000) {
-               cpu_arch = (processor_id & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3;
-       } else if ((processor_id & 0x00080000) == 0x00000000) {
-               cpu_arch = (processor_id >> 16) & 7;
+       } else if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
+               cpu_arch = (read_cpuid_id() & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3;
+       } else if ((read_cpuid_id() & 0x00080000) == 0x00000000) {
+               cpu_arch = (read_cpuid_id() >> 16) & 7;
                if (cpu_arch)
                        cpu_arch += CPU_ARCH_ARMv3;
-       } else {
-               /* the revised CPUID */
-               cpu_arch = ((processor_id >> 12) & 0xf) - 0xb + CPU_ARCH_ARMv6;
-       }
+       } else if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
+               unsigned int mmfr0;
+
+               /* Revised CPUID format. Read the Memory Model Feature
+                * Register 0 and check for VMSAv7 or PMSAv7 */
+               asm("mrc        p15, 0, %0, c0, c1, 4"
+                   : "=r" (mmfr0));
+               if ((mmfr0 & 0x0000000f) == 0x00000003 ||
+                   (mmfr0 & 0x000000f0) == 0x00000030)
+                       cpu_arch = CPU_ARCH_ARMv7;
+               else if ((mmfr0 & 0x0000000f) == 0x00000002 ||
+                        (mmfr0 & 0x000000f0) == 0x00000020)
+                       cpu_arch = CPU_ARCH_ARMv6;
+               else
+                       cpu_arch = CPU_ARCH_UNKNOWN;
+       } else
+               cpu_arch = CPU_ARCH_UNKNOWN;
 
        return cpu_arch;
 }
@@ -322,10 +348,10 @@ static void __init setup_processor(void)
         * types.  The linker builds this table for us from the
         * entries in arch/arm/mm/proc-*.S
         */
-       list = lookup_processor_type(processor_id);
+       list = lookup_processor_type(read_cpuid_id());
        if (!list) {
                printk("CPU configuration botched (ID %08x), unable "
-                      "to continue.\n", processor_id);
+                      "to continue.\n", read_cpuid_id());
                while (1);
        }
 
@@ -345,7 +371,7 @@ static void __init setup_processor(void)
 #endif
 
        printk("CPU: %s [%08x] revision %d (ARMv%s), cr=%08lx\n",
-              cpu_name, processor_id, (int)processor_id & 15,
+              cpu_name, read_cpuid_id(), read_cpuid_id() & 15,
               proc_arch[cpu_architecture()], cr_alignment);
 
        sprintf(init_utsname()->machine, "%s%c", list->arch_name, ENDIANNESS);
@@ -354,9 +380,6 @@ static void __init setup_processor(void)
 #ifndef CONFIG_ARM_THUMB
        elf_hwcap &= ~HWCAP_THUMB;
 #endif
-#ifndef CONFIG_VFP
-       elf_hwcap &= ~HWCAP_VFP;
-#endif
 
        cpu_proc_init();
 }
@@ -482,6 +505,17 @@ static void __init early_mem(char **p)
 __early_param("mem=", early_mem);
 
 /*
+ * vmalloc=size forces the vmalloc area to be exactly 'size'
+ * bytes. This can be used to increase (or decrease) the vmalloc
+ * area - the default is 128m.
+ */
+static void __init early_vmalloc(char **arg)
+{
+       vmalloc_reserve = memparse(*arg, arg);
+}
+__early_param("vmalloc=", early_vmalloc);
+
+/*
  * Initial parsing of the command line.
  */
 static void __init parse_cmdline(char **cmdline_p, char *from)
@@ -780,7 +814,9 @@ void __init setup_arch(char **cmdline_p)
        if (mdesc->soft_reboot)
                reboot_setup("s");
 
-       if (mdesc->boot_params)
+       if (__atags_pointer)
+               tags = phys_to_virt(__atags_pointer);
+       else if (mdesc->boot_params)
                tags = phys_to_virt(mdesc->boot_params);
 
        /*
@@ -798,6 +834,7 @@ void __init setup_arch(char **cmdline_p)
        if (tags->hdr.tag == ATAG_CORE) {
                if (meminfo.nr_banks != 0)
                        squash_mem_tags(tags);
+               save_atags(tags);
                parse_tags(tags);
        }
 
@@ -806,8 +843,8 @@ void __init setup_arch(char **cmdline_p)
        init_mm.end_data   = (unsigned long) &_edata;
        init_mm.brk        = (unsigned long) &_end;
 
-       memcpy(saved_command_line, from, COMMAND_LINE_SIZE);
-       saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
+       memcpy(boot_command_line, from, COMMAND_LINE_SIZE);
+       boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
        parse_cmdline(cmdline_p, from);
        paging_init(&meminfo, mdesc);
        request_standard_resources(&meminfo, mdesc);
@@ -832,6 +869,7 @@ void __init setup_arch(char **cmdline_p)
        conswitchp = &dummy_con;
 #endif
 #endif
+       early_trap_init();
 }
 
 
@@ -839,8 +877,11 @@ static int __init topology_init(void)
 {
        int cpu;
 
-       for_each_possible_cpu(cpu)
-               register_cpu(&per_cpu(cpu_data, cpu).cpu, cpu);
+       for_each_possible_cpu(cpu) {
+               struct cpuinfo_arm *cpuinfo = &per_cpu(cpu_data, cpu);
+               cpuinfo->cpu.hotpluggable = 1;
+               register_cpu(&cpuinfo->cpu, cpu);
+       }
 
        return 0;
 }
@@ -858,6 +899,7 @@ static const char *hwcap_str[] = {
        "edsp",
        "java",
        "iwmmxt",
+       "crunch",
        NULL
 };
 
@@ -882,7 +924,7 @@ static int c_show(struct seq_file *m, void *v)
        int i;
 
        seq_printf(m, "Processor\t: %s rev %d (%s)\n",
-                  cpu_name, (int)processor_id & 15, elf_platform);
+                  cpu_name, read_cpuid_id() & 15, elf_platform);
 
 #if defined(CONFIG_SMP)
        for_each_online_cpu(i) {
@@ -909,30 +951,30 @@ static int c_show(struct seq_file *m, void *v)
                if (elf_hwcap & (1 << i))
                        seq_printf(m, "%s ", hwcap_str[i]);
 
-       seq_printf(m, "\nCPU implementer\t: 0x%02x\n", processor_id >> 24);
+       seq_printf(m, "\nCPU implementer\t: 0x%02x\n", read_cpuid_id() >> 24);
        seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]);
 
-       if ((processor_id & 0x0008f000) == 0x00000000) {
+       if ((read_cpuid_id() & 0x0008f000) == 0x00000000) {
                /* pre-ARM7 */
-               seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4);
+               seq_printf(m, "CPU part\t: %07x\n", read_cpuid_id() >> 4);
        } else {
-               if ((processor_id & 0x0008f000) == 0x00007000) {
+               if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
                        /* ARM7 */
                        seq_printf(m, "CPU variant\t: 0x%02x\n",
-                                  (processor_id >> 16) & 127);
+                                  (read_cpuid_id() >> 16) & 127);
                } else {
                        /* post-ARM7 */
                        seq_printf(m, "CPU variant\t: 0x%x\n",
-                                  (processor_id >> 20) & 15);
+                                  (read_cpuid_id() >> 20) & 15);
                }
                seq_printf(m, "CPU part\t: 0x%03x\n",
-                          (processor_id >> 4) & 0xfff);
+                          (read_cpuid_id() >> 4) & 0xfff);
        }
-       seq_printf(m, "CPU revision\t: %d\n", processor_id & 15);
+       seq_printf(m, "CPU revision\t: %d\n", read_cpuid_id() & 15);
 
        {
-               unsigned int cache_info = read_cpuid(CPUID_CACHETYPE);
-               if (cache_info != processor_id) {
+               unsigned int cache_info = read_cpuid_cachetype();
+               if (cache_info != read_cpuid_id()) {
                        seq_printf(m, "Cache type\t: %s\n"
                                      "Cache clean\t: %s\n"
                                      "Cache lockdown\t: %s\n"
@@ -976,7 +1018,7 @@ static void c_stop(struct seq_file *m, void *v)
 {
 }
 
-struct seq_operations cpuinfo_op = {
+const struct seq_operations cpuinfo_op = {
        .start  = c_start,
        .next   = c_next,
        .stop   = c_stop,