1
2
3
4
5
6
7
8
9
10
11
12
13#include <linux/init.h>
14#include <linux/mm.h>
15#include <linux/bootmem.h>
16#include <asm/pgtable.h>
17#include <linux/seq_file.h>
18#include <linux/screen_info.h>
19#include <linux/utsname.h>
20#include <linux/pfn.h>
21#include <linux/cpu.h>
22#include <asm/setup.h>
23#include <arch/system.h>
24
25
26
27
28struct screen_info screen_info;
29
30extern int root_mountflags;
31extern char _etext, _edata, _end;
32
33char __initdata cris_command_line[COMMAND_LINE_SIZE] = { 0, };
34
35extern const unsigned long text_start, edata;
36extern unsigned long dram_start, dram_end;
37
38extern unsigned long romfs_start, romfs_length, romfs_in_flash;
39
40static struct cpu cpu_devices[NR_CPUS];
41
42extern void show_etrax_copyright(void);
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60void __init setup_arch(char **cmdline_p)
61{
62 extern void init_etrax_debug(void);
63 unsigned long bootmap_size;
64 unsigned long start_pfn, max_pfn;
65 unsigned long memory_start;
66
67
68
69 init_etrax_debug();
70
71
72
73 high_memory = &dram_end;
74
75 if(romfs_in_flash || !romfs_length) {
76
77
78
79 memory_start = (unsigned long) &_end;
80 } else {
81
82 printk("ROM fs in RAM, size %lu bytes\n", romfs_length);
83 memory_start = romfs_start + romfs_length;
84 }
85
86
87
88 init_mm.start_code = (unsigned long) &text_start;
89 init_mm.end_code = (unsigned long) &_etext;
90 init_mm.end_data = (unsigned long) &_edata;
91 init_mm.brk = (unsigned long) &_end;
92
93
94
95
96
97
98
99
100
101
102
103 start_pfn = PFN_UP(memory_start);
104 max_pfn = PFN_DOWN((unsigned long)high_memory);
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122 max_low_pfn = max_pfn;
123 min_low_pfn = PAGE_OFFSET >> PAGE_SHIFT;
124
125 bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn,
126 min_low_pfn,
127 max_low_pfn);
128
129
130
131 free_bootmem(PFN_PHYS(start_pfn), PFN_PHYS(max_pfn - start_pfn));
132
133
134
135
136
137
138
139
140
141
142 reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT);
143
144
145
146 paging_init();
147
148 *cmdline_p = cris_command_line;
149
150#ifdef CONFIG_ETRAX_CMDLINE
151 if (!strcmp(cris_command_line, "")) {
152 strlcpy(cris_command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
153 cris_command_line[COMMAND_LINE_SIZE - 1] = '\0';
154 }
155#endif
156
157
158 memcpy(boot_command_line, cris_command_line, COMMAND_LINE_SIZE);
159 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
160
161
162 show_etrax_copyright();
163
164
165 strcpy(init_utsname()->machine, cris_machine_name);
166}
167
168static void *c_start(struct seq_file *m, loff_t *pos)
169{
170 return *pos < nr_cpu_ids ? (void *)(int)(*pos + 1) : NULL;
171}
172
173static void *c_next(struct seq_file *m, void *v, loff_t *pos)
174{
175 ++*pos;
176 return c_start(m, pos);
177}
178
179static void c_stop(struct seq_file *m, void *v)
180{
181}
182
183extern int show_cpuinfo(struct seq_file *m, void *v);
184
185const struct seq_operations cpuinfo_op = {
186 .start = c_start,
187 .next = c_next,
188 .stop = c_stop,
189 .show = show_cpuinfo,
190};
191
192static int __init topology_init(void)
193{
194 int i;
195
196 for_each_possible_cpu(i) {
197 return register_cpu(&cpu_devices[i], i);
198 }
199
200 return 0;
201}
202
203subsys_initcall(topology_init);
204
205