Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / sh / kernel / setup.c
index 25b9d9e..1680bb0 100644 (file)
 #include <linux/root_dev.h>
 #include <linux/utsname.h>
 #include <linux/cpu.h>
+#include <linux/pfn.h>
+#include <linux/vs_cvirt.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
-#include <asm/io_generic.h>
 #include <asm/sections.h>
 #include <asm/irq.h>
 #include <asm/setup.h>
+#include <asm/clock.h>
 
 #ifdef CONFIG_SH_KGDB
 #include <asm/kgdb.h>
@@ -41,7 +43,7 @@ extern void * __rd_start, * __rd_end;
  * This value will be used at the very early stage of serial setup.
  * The bigger value means no problem.
  */
-struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 0, 10000000, };
+struct sh_cpuinfo boot_cpu_data = { CPU_SH_NONE, 10000000, };
 struct screen_info screen_info;
 
 #if defined(CONFIG_SH_UNKNOWN)
@@ -83,9 +85,9 @@ static struct sh_machine_vector* __init get_mv_byname(const char* name);
 /* ... */
 #define COMMAND_LINE ((char *) (PARAM+0x100))
 
-#define RAMDISK_IMAGE_START_MASK       0x07FF
+#define RAMDISK_IMAGE_START_MASK       0x07FF
 #define RAMDISK_PROMPT_FLAG            0x8000
-#define RAMDISK_LOAD_FLAG              0x4000  
+#define RAMDISK_LOAD_FLAG              0x4000
 
 static char command_line[COMMAND_LINE_SIZE] = { 0, };
 
@@ -186,7 +188,7 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
 
 static int __init sh_mv_setup(char **cmdline_p)
 {
-#if defined(CONFIG_SH_UNKNOWN)
+#ifdef CONFIG_SH_UNKNOWN
        extern struct sh_machine_vector mv_unknown;
 #endif
        struct sh_machine_vector *mv = NULL;
@@ -196,7 +198,7 @@ static int __init sh_mv_setup(char **cmdline_p)
 
        parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base, &mv_mmio_enable);
 
-#ifdef CONFIG_SH_GENERIC
+#ifdef CONFIG_SH_UNKNOWN
        if (mv == NULL) {
                mv = &mv_unknown;
                if (*mv_name != '\0') {
@@ -206,9 +208,6 @@ static int __init sh_mv_setup(char **cmdline_p)
        }
        sh_mv = *mv;
 #endif
-#ifdef CONFIG_SH_UNKNOWN
-       sh_mv = mv_unknown;
-#endif
 
        /*
         * Manually walk the vec, fill in anything that the board hasn't yet
@@ -231,10 +230,8 @@ static int __init sh_mv_setup(char **cmdline_p)
        mv_set(readb);  mv_set(readw);  mv_set(readl);
        mv_set(writeb); mv_set(writew); mv_set(writel);
 
-       mv_set(ioremap);
-       mv_set(iounmap);
-
-       mv_set(isa_port2addr);
+       mv_set(ioport_map);
+       mv_set(ioport_unmap);
        mv_set(irq_demux);
 
 #ifdef CONFIG_SH_UNKNOWN
@@ -273,29 +270,13 @@ void __init setup_arch(char **cmdline_p)
        init_mm.end_data = (unsigned long) _edata;
        init_mm.brk = (unsigned long) _end;
 
-       code_resource.start = virt_to_bus(_text);
-       code_resource.end = virt_to_bus(_etext)-1;
-       data_resource.start = virt_to_bus(_etext);
-       data_resource.end = virt_to_bus(_edata)-1;
+       code_resource.start = (unsigned long)virt_to_phys(_text);
+       code_resource.end = (unsigned long)virt_to_phys(_etext)-1;
+       data_resource.start = (unsigned long)virt_to_phys(_etext);
+       data_resource.end = (unsigned long)virt_to_phys(_edata)-1;
 
        sh_mv_setup(cmdline_p);
 
-#define PFN_UP(x)      (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
-#define PFN_DOWN(x)    ((x) >> PAGE_SHIFT)
-#define PFN_PHYS(x)    ((x) << PAGE_SHIFT)
-
-#ifdef CONFIG_DISCONTIGMEM
-       NODE_DATA(0)->bdata = &discontig_node_bdata[0];
-       NODE_DATA(1)->bdata = &discontig_node_bdata[1];
-
-       bootmap_size = init_bootmem_node(NODE_DATA(1), 
-                                        PFN_UP(__MEMORY_START_2ND),
-                                        PFN_UP(__MEMORY_START_2ND),
-                                        PFN_DOWN(__MEMORY_START_2ND+__MEMORY_SIZE_2ND));
-       free_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, __MEMORY_SIZE_2ND);
-       reserve_bootmem_node(NODE_DATA(1), __MEMORY_START_2ND, bootmap_size);
-#endif
-
        /*
         * Find the highest page frame number we have available
         */
@@ -306,10 +287,10 @@ void __init setup_arch(char **cmdline_p)
         */
        max_low_pfn = max_pfn;
 
-       /*
+       /*
         * Partially used pages are not usable - thus
         * we are rounding upwards:
-        */
+        */
        start_pfn = PFN_UP(__pa(_end));
 
        /*
@@ -360,12 +341,12 @@ void __init setup_arch(char **cmdline_p)
        reserve_bootmem_node(NODE_DATA(0), __MEMORY_START, PAGE_SIZE);
 
 #ifdef CONFIG_BLK_DEV_INITRD
-       ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
-       if (&__rd_start != &__rd_end) {
+       ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
+       if (&__rd_start != &__rd_end) {
                LOADER_TYPE = 1;
                INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START;
                INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start;
-       }
+       }
 
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
@@ -421,9 +402,8 @@ static int __init topology_init(void)
 {
        int cpu_id;
 
-       for (cpu_id = 0; cpu_id < NR_CPUS; cpu_id++)
-               if (cpu_possible(cpu_id))
-                       register_cpu(&cpu[cpu_id], cpu_id, NULL);
+       for_each_possible_cpu(cpu_id)
+               register_cpu(&cpu[cpu_id], cpu_id, NULL);
 
        return 0;
 }
@@ -447,6 +427,9 @@ static const char *cpu_name[] = {
        [CPU_ST40GX1]   = "ST40GX1",
        [CPU_SH4_202]   = "SH4-202",
        [CPU_SH4_501]   = "SH4-501",
+       [CPU_SH7770]    = "SH7770",
+       [CPU_SH7780]    = "SH7780",
+       [CPU_SH7781]    = "SH7781",
        [CPU_SH_NONE]   = "Unknown"
 };
 
@@ -457,7 +440,7 @@ const char *get_cpu_subtype(void)
 
 #ifdef CONFIG_PROC_FS
 static const char *cpu_flags[] = {
-       "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr",
+       "none", "fpu", "p2flush", "mmuassoc", "dsp", "perfctr", "ptea", NULL
 };
 
 static void show_cpuflags(struct seq_file *m)
@@ -471,7 +454,7 @@ static void show_cpuflags(struct seq_file *m)
                return;
        }
 
-       for (i = 0; i < cpu_data->flags; i++)
+       for (i = 0; cpu_flags[i]; i++)
                if ((cpu_data->flags & (1 << i)))
                        seq_printf(m, " %s", cpu_flags[i+1]);
 
@@ -484,7 +467,8 @@ static void show_cacheinfo(struct seq_file *m, const char *type, struct cache_in
 
        cache_size = info.ways * info.sets * info.linesz;
 
-       seq_printf(m, "%s size\t: %dKiB\n", type, cache_size >> 10);
+       seq_printf(m, "%s size\t: %2dKiB (%d-way)\n",
+                  type, cache_size >> 10, info.ways);
 }
 
 /*
@@ -498,7 +482,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                seq_printf(m, "machine\t\t: %s\n", get_system_type());
 
        seq_printf(m, "processor\t: %d\n", cpu);
-       seq_printf(m, "cpu family\t: %s\n", system_utsname.machine);
+       seq_printf(m, "cpu family\t: %s\n", vx_new_uts(machine));
        seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype());
 
        show_cpuflags(m);
@@ -523,21 +507,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                     boot_cpu_data.loops_per_jiffy/(500000/HZ),
                     (boot_cpu_data.loops_per_jiffy/(5000/HZ)) % 100);
 
-#define PRINT_CLOCK(name, value) \
-       seq_printf(m, name " clock\t: %d.%02dMHz\n", \
-                    ((value) / 1000000), ((value) % 1000000)/10000)
-       
-       PRINT_CLOCK("cpu", boot_cpu_data.cpu_clock);
-       PRINT_CLOCK("bus", boot_cpu_data.bus_clock);
-#ifdef CONFIG_CPU_SUBTYPE_ST40STB1
-       PRINT_CLOCK("memory", boot_cpu_data.memory_clock);
-#endif
-       PRINT_CLOCK("module", boot_cpu_data.module_clock);
-
-       return 0;
+       return show_clocks(m);
 }
 
-
 static void *c_start(struct seq_file *m, loff_t *pos)
 {
        return *pos < NR_CPUS ? cpu_data + *pos : NULL;
@@ -608,7 +580,7 @@ static int __init kgdb_parse_options(char *options)
                options += map->namelen + 1;
 
                options = (*options == ',') ? options+1 : options;
-               
+
                /* Read optional parameters (baud/parity/bits) */
                baud = simple_strtoul(options, &options, 10);
                if (baud != 0) {