score: move save arg5 and arg6 instruction in front of enable_irq
[safe/jmp/linux-2.6] / arch / score / kernel / setup.c
1 /*
2  * arch/score/kernel/setup.c
3  *
4  * Score Processor version.
5  *
6  * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
7  *  Chen Liqin <liqin.chen@sunplusct.com>
8  *  Lennox Wu <lennox.wu@sunplusct.com>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, see the file COPYING, or write
22  * to the Free Software Foundation, Inc.,
23  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
24  */
25
26 #include <linux/bootmem.h>
27 #include <linux/initrd.h>
28 #include <linux/ioport.h>
29 #include <linux/seq_file.h>
30 #include <linux/screen_info.h>
31
32 #include <asm-generic/sections.h>
33
34 struct screen_info screen_info;
35 unsigned long kernelsp;
36
37 static char command_line[COMMAND_LINE_SIZE];
38 static struct resource code_resource = { .name = "Kernel code",};
39 static struct resource data_resource = { .name = "Kernel data",};
40
41 static void __init bootmem_init(void)
42 {
43         unsigned long reserved_end, bootmap_size;
44         unsigned long size = initrd_end - initrd_start;
45
46         reserved_end = (unsigned long)_end;
47
48         min_low_pfn = 0;
49         max_low_pfn = MEM_SIZE / PAGE_SIZE;
50
51         /* Initialize the boot-time allocator with low memory only. */
52         bootmap_size = init_bootmem_node(NODE_DATA(0), reserved_end,
53                                          min_low_pfn, max_low_pfn);
54         add_active_range(0, min_low_pfn, max_low_pfn);
55
56         free_bootmem(PFN_PHYS(reserved_end),
57                      (max_low_pfn - reserved_end) << PAGE_SHIFT);
58         memory_present(0, reserved_end, max_low_pfn);
59
60         /* Reserve space for the bootmem bitmap. */
61         reserve_bootmem(PFN_PHYS(reserved_end), bootmap_size, BOOTMEM_DEFAULT);
62
63         if (size == 0) {
64                 printk(KERN_INFO "Initrd not found or empty");
65                 goto disable;
66         }
67
68         if (__pa(initrd_end) > PFN_PHYS(max_low_pfn)) {
69                 printk(KERN_ERR "Initrd extends beyond end of memory");
70                 goto disable;
71         }
72
73         /* Reserve space for the initrd bitmap. */
74         reserve_bootmem(__pa(initrd_start), size, BOOTMEM_DEFAULT);
75         initrd_below_start_ok = 1;
76
77         pr_info("Initial ramdisk at: 0x%lx (%lu bytes)\n",
78                  initrd_start, size);
79         return;
80 disable:
81         printk(KERN_CONT " - disabling initrd\n");
82         initrd_start = 0;
83         initrd_end = 0;
84 }
85
86 static void __init resource_init(void)
87 {
88         struct resource *res;
89
90         code_resource.start = (unsigned long)_text;
91         code_resource.end = (unsigned long)_etext - 1;
92         data_resource.start = (unsigned long)_etext;
93         data_resource.end = (unsigned long)_edata - 1;
94
95         res = alloc_bootmem(sizeof(struct resource));
96         res->name = "System RAM";
97         res->start = 0;
98         res->end = MEM_SIZE - 1;
99         res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
100         request_resource(&iomem_resource, res);
101
102         request_resource(res, &code_resource);
103         request_resource(res, &data_resource);
104 }
105
106 void __init setup_arch(char **cmdline_p)
107 {
108         randomize_va_space = 0;
109         *cmdline_p = command_line;
110
111         cpu_cache_init();
112         tlb_init();
113         bootmem_init();
114         paging_init();
115         resource_init();
116 }
117
118 static int show_cpuinfo(struct seq_file *m, void *v)
119 {
120         unsigned long n = (unsigned long) v - 1;
121
122         seq_printf(m, "processor\t\t: %ld\n", n);
123         seq_printf(m, "\n");
124
125         return 0;
126 }
127
128 static void *c_start(struct seq_file *m, loff_t *pos)
129 {
130         unsigned long i = *pos;
131
132         return i < 1 ? (void *) (i + 1) : NULL;
133 }
134
135 static void *c_next(struct seq_file *m, void *v, loff_t *pos)
136 {
137         ++*pos;
138         return c_start(m, pos);
139 }
140
141 static void c_stop(struct seq_file *m, void *v)
142 {
143 }
144
145 const struct seq_operations cpuinfo_op = {
146         .start  = c_start,
147         .next   = c_next,
148         .stop   = c_stop,
149         .show   = show_cpuinfo,
150 };
151
152 static int __init topology_init(void)
153 {
154         return 0;
155 }
156
157 subsys_initcall(topology_init);