Commit | Line | Data |
---|---|---|
1394f032 | 1 | /* |
550d5538 | 2 | * arch/blackfin/kernel/setup.c |
1394f032 | 3 | * |
550d5538 | 4 | * Copyright 2004-2006 Analog Devices Inc. |
1394f032 | 5 | * |
550d5538 | 6 | * Enter bugs at http://blackfin.uclinux.org/ |
1394f032 | 7 | * |
550d5538 | 8 | * Licensed under the GPL-2 or later. |
1394f032 BW |
9 | */ |
10 | ||
11 | #include <linux/delay.h> | |
12 | #include <linux/console.h> | |
13 | #include <linux/bootmem.h> | |
14 | #include <linux/seq_file.h> | |
15 | #include <linux/cpu.h> | |
16 | #include <linux/module.h> | |
1394f032 | 17 | #include <linux/tty.h> |
856783b3 | 18 | #include <linux/pfn.h> |
1394f032 BW |
19 | |
20 | #include <linux/ext2_fs.h> | |
21 | #include <linux/cramfs_fs.h> | |
22 | #include <linux/romfs_fs.h> | |
23 | ||
3bebca2d | 24 | #include <asm/cplb.h> |
1394f032 BW |
25 | #include <asm/cacheflush.h> |
26 | #include <asm/blackfin.h> | |
27 | #include <asm/cplbinit.h> | |
1754a5d9 | 28 | #include <asm/div64.h> |
7adfb58f | 29 | #include <asm/fixed_code.h> |
ce3afa1c | 30 | #include <asm/early_printk.h> |
1394f032 | 31 | |
6cda2e90 MH |
32 | static DEFINE_PER_CPU(struct cpu, cpu_devices); |
33 | ||
a9c59c27 | 34 | u16 _bfin_swrst; |
d45118b1 | 35 | EXPORT_SYMBOL(_bfin_swrst); |
a9c59c27 | 36 | |
1394f032 BW |
37 | unsigned long memory_start, memory_end, physical_mem_end; |
38 | unsigned long reserved_mem_dcache_on; | |
39 | unsigned long reserved_mem_icache_on; | |
40 | EXPORT_SYMBOL(memory_start); | |
41 | EXPORT_SYMBOL(memory_end); | |
42 | EXPORT_SYMBOL(physical_mem_end); | |
43 | EXPORT_SYMBOL(_ramend); | |
44 | ||
45 | #ifdef CONFIG_MTD_UCLINUX | |
46 | unsigned long memory_mtd_end, memory_mtd_start, mtd_size; | |
47 | unsigned long _ebss; | |
48 | EXPORT_SYMBOL(memory_mtd_end); | |
49 | EXPORT_SYMBOL(memory_mtd_start); | |
50 | EXPORT_SYMBOL(mtd_size); | |
51 | #endif | |
52 | ||
5e10b4a6 | 53 | char __initdata command_line[COMMAND_LINE_SIZE]; |
1394f032 | 54 | |
856783b3 YL |
55 | /* boot memmap, for parsing "memmap=" */ |
56 | #define BFIN_MEMMAP_MAX 128 /* number of entries in bfin_memmap */ | |
57 | #define BFIN_MEMMAP_RAM 1 | |
58 | #define BFIN_MEMMAP_RESERVED 2 | |
59 | struct bfin_memmap { | |
60 | int nr_map; | |
61 | struct bfin_memmap_entry { | |
62 | unsigned long long addr; /* start of memory segment */ | |
63 | unsigned long long size; | |
64 | unsigned long type; | |
65 | } map[BFIN_MEMMAP_MAX]; | |
66 | } bfin_memmap __initdata; | |
67 | ||
68 | /* for memmap sanitization */ | |
69 | struct change_member { | |
70 | struct bfin_memmap_entry *pentry; /* pointer to original entry */ | |
71 | unsigned long long addr; /* address for this change point */ | |
72 | }; | |
73 | static struct change_member change_point_list[2*BFIN_MEMMAP_MAX] __initdata; | |
74 | static struct change_member *change_point[2*BFIN_MEMMAP_MAX] __initdata; | |
75 | static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata; | |
76 | static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata; | |
77 | ||
1394f032 BW |
78 | void __init bf53x_cache_init(void) |
79 | { | |
3bebca2d | 80 | #if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE) |
1394f032 BW |
81 | generate_cpl_tables(); |
82 | #endif | |
83 | ||
3bebca2d | 84 | #ifdef CONFIG_BFIN_ICACHE |
1394f032 BW |
85 | bfin_icache_init(); |
86 | printk(KERN_INFO "Instruction Cache Enabled\n"); | |
87 | #endif | |
88 | ||
3bebca2d | 89 | #ifdef CONFIG_BFIN_DCACHE |
1394f032 BW |
90 | bfin_dcache_init(); |
91 | printk(KERN_INFO "Data Cache Enabled" | |
3bebca2d | 92 | # if defined CONFIG_BFIN_WB |
1394f032 | 93 | " (write-back)" |
3bebca2d | 94 | # elif defined CONFIG_BFIN_WT |
1394f032 BW |
95 | " (write-through)" |
96 | # endif | |
97 | "\n"); | |
98 | #endif | |
99 | } | |
100 | ||
52a07812 | 101 | void __init bf53x_relocate_l1_mem(void) |
1394f032 BW |
102 | { |
103 | unsigned long l1_code_length; | |
104 | unsigned long l1_data_a_length; | |
105 | unsigned long l1_data_b_length; | |
106 | ||
107 | l1_code_length = _etext_l1 - _stext_l1; | |
108 | if (l1_code_length > L1_CODE_LENGTH) | |
109 | l1_code_length = L1_CODE_LENGTH; | |
110 | /* cannot complain as printk is not available as yet. | |
111 | * But we can continue booting and complain later! | |
112 | */ | |
113 | ||
114 | /* Copy _stext_l1 to _etext_l1 to L1 instruction SRAM */ | |
115 | dma_memcpy(_stext_l1, _l1_lma_start, l1_code_length); | |
116 | ||
117 | l1_data_a_length = _ebss_l1 - _sdata_l1; | |
118 | if (l1_data_a_length > L1_DATA_A_LENGTH) | |
119 | l1_data_a_length = L1_DATA_A_LENGTH; | |
120 | ||
121 | /* Copy _sdata_l1 to _ebss_l1 to L1 data bank A SRAM */ | |
122 | dma_memcpy(_sdata_l1, _l1_lma_start + l1_code_length, l1_data_a_length); | |
123 | ||
124 | l1_data_b_length = _ebss_b_l1 - _sdata_b_l1; | |
125 | if (l1_data_b_length > L1_DATA_B_LENGTH) | |
126 | l1_data_b_length = L1_DATA_B_LENGTH; | |
127 | ||
128 | /* Copy _sdata_b_l1 to _ebss_b_l1 to L1 data bank B SRAM */ | |
129 | dma_memcpy(_sdata_b_l1, _l1_lma_start + l1_code_length + | |
130 | l1_data_a_length, l1_data_b_length); | |
131 | ||
132 | } | |
133 | ||
856783b3 YL |
134 | /* add_memory_region to memmap */ |
135 | static void __init add_memory_region(unsigned long long start, | |
136 | unsigned long long size, int type) | |
137 | { | |
138 | int i; | |
139 | ||
140 | i = bfin_memmap.nr_map; | |
141 | ||
142 | if (i == BFIN_MEMMAP_MAX) { | |
143 | printk(KERN_ERR "Ooops! Too many entries in the memory map!\n"); | |
144 | return; | |
145 | } | |
146 | ||
147 | bfin_memmap.map[i].addr = start; | |
148 | bfin_memmap.map[i].size = size; | |
149 | bfin_memmap.map[i].type = type; | |
150 | bfin_memmap.nr_map++; | |
151 | } | |
152 | ||
153 | /* | |
154 | * Sanitize the boot memmap, removing overlaps. | |
155 | */ | |
156 | static int __init sanitize_memmap(struct bfin_memmap_entry *map, int *pnr_map) | |
157 | { | |
158 | struct change_member *change_tmp; | |
159 | unsigned long current_type, last_type; | |
160 | unsigned long long last_addr; | |
161 | int chgidx, still_changing; | |
162 | int overlap_entries; | |
163 | int new_entry; | |
164 | int old_nr, new_nr, chg_nr; | |
165 | int i; | |
166 | ||
167 | /* | |
168 | Visually we're performing the following (1,2,3,4 = memory types) | |
169 | ||
170 | Sample memory map (w/overlaps): | |
171 | ____22__________________ | |
172 | ______________________4_ | |
173 | ____1111________________ | |
174 | _44_____________________ | |
175 | 11111111________________ | |
176 | ____________________33__ | |
177 | ___________44___________ | |
178 | __________33333_________ | |
179 | ______________22________ | |
180 | ___________________2222_ | |
181 | _________111111111______ | |
182 | _____________________11_ | |
183 | _________________4______ | |
184 | ||
185 | Sanitized equivalent (no overlap): | |
186 | 1_______________________ | |
187 | _44_____________________ | |
188 | ___1____________________ | |
189 | ____22__________________ | |
190 | ______11________________ | |
191 | _________1______________ | |
192 | __________3_____________ | |
193 | ___________44___________ | |
194 | _____________33_________ | |
195 | _______________2________ | |
196 | ________________1_______ | |
197 | _________________4______ | |
198 | ___________________2____ | |
199 | ____________________33__ | |
200 | ______________________4_ | |
201 | */ | |
202 | /* if there's only one memory region, don't bother */ | |
203 | if (*pnr_map < 2) | |
204 | return -1; | |
205 | ||
206 | old_nr = *pnr_map; | |
207 | ||
208 | /* bail out if we find any unreasonable addresses in memmap */ | |
209 | for (i = 0; i < old_nr; i++) | |
210 | if (map[i].addr + map[i].size < map[i].addr) | |
211 | return -1; | |
212 | ||
213 | /* create pointers for initial change-point information (for sorting) */ | |
214 | for (i = 0; i < 2*old_nr; i++) | |
215 | change_point[i] = &change_point_list[i]; | |
216 | ||
217 | /* record all known change-points (starting and ending addresses), | |
218 | omitting those that are for empty memory regions */ | |
219 | chgidx = 0; | |
220 | for (i = 0; i < old_nr; i++) { | |
221 | if (map[i].size != 0) { | |
222 | change_point[chgidx]->addr = map[i].addr; | |
223 | change_point[chgidx++]->pentry = &map[i]; | |
224 | change_point[chgidx]->addr = map[i].addr + map[i].size; | |
225 | change_point[chgidx++]->pentry = &map[i]; | |
226 | } | |
227 | } | |
228 | chg_nr = chgidx; /* true number of change-points */ | |
229 | ||
230 | /* sort change-point list by memory addresses (low -> high) */ | |
231 | still_changing = 1; | |
232 | while (still_changing) { | |
233 | still_changing = 0; | |
234 | for (i = 1; i < chg_nr; i++) { | |
235 | /* if <current_addr> > <last_addr>, swap */ | |
236 | /* or, if current=<start_addr> & last=<end_addr>, swap */ | |
237 | if ((change_point[i]->addr < change_point[i-1]->addr) || | |
238 | ((change_point[i]->addr == change_point[i-1]->addr) && | |
239 | (change_point[i]->addr == change_point[i]->pentry->addr) && | |
240 | (change_point[i-1]->addr != change_point[i-1]->pentry->addr)) | |
241 | ) { | |
242 | change_tmp = change_point[i]; | |
243 | change_point[i] = change_point[i-1]; | |
244 | change_point[i-1] = change_tmp; | |
245 | still_changing = 1; | |
246 | } | |
247 | } | |
248 | } | |
249 | ||
250 | /* create a new memmap, removing overlaps */ | |
251 | overlap_entries = 0; /* number of entries in the overlap table */ | |
252 | new_entry = 0; /* index for creating new memmap entries */ | |
253 | last_type = 0; /* start with undefined memory type */ | |
254 | last_addr = 0; /* start with 0 as last starting address */ | |
255 | /* loop through change-points, determining affect on the new memmap */ | |
256 | for (chgidx = 0; chgidx < chg_nr; chgidx++) { | |
257 | /* keep track of all overlapping memmap entries */ | |
258 | if (change_point[chgidx]->addr == change_point[chgidx]->pentry->addr) { | |
259 | /* add map entry to overlap list (> 1 entry implies an overlap) */ | |
260 | overlap_list[overlap_entries++] = change_point[chgidx]->pentry; | |
261 | } else { | |
262 | /* remove entry from list (order independent, so swap with last) */ | |
263 | for (i = 0; i < overlap_entries; i++) { | |
264 | if (overlap_list[i] == change_point[chgidx]->pentry) | |
265 | overlap_list[i] = overlap_list[overlap_entries-1]; | |
266 | } | |
267 | overlap_entries--; | |
268 | } | |
269 | /* if there are overlapping entries, decide which "type" to use */ | |
270 | /* (larger value takes precedence -- 1=usable, 2,3,4,4+=unusable) */ | |
271 | current_type = 0; | |
272 | for (i = 0; i < overlap_entries; i++) | |
273 | if (overlap_list[i]->type > current_type) | |
274 | current_type = overlap_list[i]->type; | |
275 | /* continue building up new memmap based on this information */ | |
276 | if (current_type != last_type) { | |
277 | if (last_type != 0) { | |
278 | new_map[new_entry].size = | |
279 | change_point[chgidx]->addr - last_addr; | |
280 | /* move forward only if the new size was non-zero */ | |
281 | if (new_map[new_entry].size != 0) | |
282 | if (++new_entry >= BFIN_MEMMAP_MAX) | |
283 | break; /* no more space left for new entries */ | |
284 | } | |
285 | if (current_type != 0) { | |
286 | new_map[new_entry].addr = change_point[chgidx]->addr; | |
287 | new_map[new_entry].type = current_type; | |
288 | last_addr = change_point[chgidx]->addr; | |
289 | } | |
290 | last_type = current_type; | |
291 | } | |
292 | } | |
293 | new_nr = new_entry; /* retain count for new entries */ | |
294 | ||
295 | /* copy new mapping into original location */ | |
296 | memcpy(map, new_map, new_nr*sizeof(struct bfin_memmap_entry)); | |
297 | *pnr_map = new_nr; | |
298 | ||
299 | return 0; | |
300 | } | |
301 | ||
302 | static void __init print_memory_map(char *who) | |
303 | { | |
304 | int i; | |
305 | ||
306 | for (i = 0; i < bfin_memmap.nr_map; i++) { | |
307 | printk(KERN_DEBUG " %s: %016Lx - %016Lx ", who, | |
308 | bfin_memmap.map[i].addr, | |
309 | bfin_memmap.map[i].addr + bfin_memmap.map[i].size); | |
310 | switch (bfin_memmap.map[i].type) { | |
311 | case BFIN_MEMMAP_RAM: | |
312 | printk("(usable)\n"); | |
313 | break; | |
314 | case BFIN_MEMMAP_RESERVED: | |
315 | printk("(reserved)\n"); | |
316 | break; | |
317 | default: printk("type %lu\n", bfin_memmap.map[i].type); | |
318 | break; | |
319 | } | |
320 | } | |
321 | } | |
322 | ||
323 | static __init int parse_memmap(char *arg) | |
324 | { | |
325 | unsigned long long start_at, mem_size; | |
326 | ||
327 | if (!arg) | |
328 | return -EINVAL; | |
329 | ||
330 | mem_size = memparse(arg, &arg); | |
331 | if (*arg == '@') { | |
332 | start_at = memparse(arg+1, &arg); | |
333 | add_memory_region(start_at, mem_size, BFIN_MEMMAP_RAM); | |
334 | } else if (*arg == '$') { | |
335 | start_at = memparse(arg+1, &arg); | |
336 | add_memory_region(start_at, mem_size, BFIN_MEMMAP_RESERVED); | |
337 | } | |
338 | ||
339 | return 0; | |
340 | } | |
341 | ||
1394f032 BW |
342 | /* |
343 | * Initial parsing of the command line. Currently, we support: | |
344 | * - Controlling the linux memory size: mem=xxx[KMG] | |
345 | * - Controlling the physical memory size: max_mem=xxx[KMG][$][#] | |
346 | * $ -> reserved memory is dcacheable | |
347 | * # -> reserved memory is icacheable | |
856783b3 YL |
348 | * - "memmap=XXX[KkmM][@][$]XXX[KkmM]" defines a memory region |
349 | * @ from <start> to <start>+<mem>, type RAM | |
350 | * $ from <start> to <start>+<mem>, type RESERVED | |
351 | * | |
1394f032 BW |
352 | */ |
353 | static __init void parse_cmdline_early(char *cmdline_p) | |
354 | { | |
355 | char c = ' ', *to = cmdline_p; | |
356 | unsigned int memsize; | |
357 | for (;;) { | |
358 | if (c == ' ') { | |
1394f032 BW |
359 | if (!memcmp(to, "mem=", 4)) { |
360 | to += 4; | |
361 | memsize = memparse(to, &to); | |
362 | if (memsize) | |
363 | _ramend = memsize; | |
364 | ||
365 | } else if (!memcmp(to, "max_mem=", 8)) { | |
366 | to += 8; | |
367 | memsize = memparse(to, &to); | |
368 | if (memsize) { | |
369 | physical_mem_end = memsize; | |
370 | if (*to != ' ') { | |
371 | if (*to == '$' | |
372 | || *(to + 1) == '$') | |
373 | reserved_mem_dcache_on = | |
374 | 1; | |
375 | if (*to == '#' | |
376 | || *(to + 1) == '#') | |
377 | reserved_mem_icache_on = | |
378 | 1; | |
379 | } | |
380 | } | |
ce3afa1c RG |
381 | } else if (!memcmp(to, "earlyprintk=", 12)) { |
382 | to += 12; | |
383 | setup_early_printk(to); | |
856783b3 YL |
384 | } else if (!memcmp(to, "memmap=", 7)) { |
385 | to += 7; | |
386 | parse_memmap(to); | |
1394f032 | 387 | } |
1394f032 BW |
388 | } |
389 | c = *(to++); | |
390 | if (!c) | |
391 | break; | |
392 | } | |
393 | } | |
394 | ||
856783b3 YL |
395 | /* |
396 | * Setup memory defaults from user config. | |
397 | * The physical memory layout looks like: | |
398 | * | |
399 | * [_rambase, _ramstart]: kernel image | |
400 | * [memory_start, memory_end]: dynamic memory managed by kernel | |
401 | * [memory_end, _ramend]: reserved memory | |
402 | * [meory_mtd_start(memory_end), | |
403 | * memory_mtd_start + mtd_size]: rootfs (if any) | |
404 | * [_ramend - DMA_UNCACHED_REGION, | |
405 | * _ramend]: uncached DMA region | |
406 | * [_ramend, physical_mem_end]: memory not managed by kernel | |
407 | * | |
408 | */ | |
409 | static __init void memory_setup(void) | |
1394f032 | 410 | { |
c0eab3b7 MF |
411 | #ifdef CONFIG_MTD_UCLINUX |
412 | unsigned long mtd_phys = 0; | |
413 | #endif | |
414 | ||
856783b3 | 415 | _rambase = (unsigned long)_stext; |
b7627acc | 416 | _ramstart = (unsigned long)_end; |
1394f032 | 417 | |
856783b3 YL |
418 | if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) { |
419 | console_init(); | |
420 | panic("DMA region exceeds memory limit: %lu.\n", | |
421 | _ramend - _ramstart); | |
1aafd909 | 422 | } |
1394f032 BW |
423 | memory_end = _ramend - DMA_UNCACHED_REGION; |
424 | ||
b97b8a99 BS |
425 | #ifdef CONFIG_MPU |
426 | /* Round up to multiple of 4MB. */ | |
427 | memory_start = (_ramstart + 0x3fffff) & ~0x3fffff; | |
428 | #else | |
1394f032 | 429 | memory_start = PAGE_ALIGN(_ramstart); |
b97b8a99 | 430 | #endif |
1394f032 BW |
431 | |
432 | #if defined(CONFIG_MTD_UCLINUX) | |
433 | /* generic memory mapped MTD driver */ | |
434 | memory_mtd_end = memory_end; | |
435 | ||
436 | mtd_phys = _ramstart; | |
437 | mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 8))); | |
438 | ||
439 | # if defined(CONFIG_EXT2_FS) || defined(CONFIG_EXT3_FS) | |
440 | if (*((unsigned short *)(mtd_phys + 0x438)) == EXT2_SUPER_MAGIC) | |
441 | mtd_size = | |
442 | PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x404)) << 10); | |
443 | # endif | |
444 | ||
445 | # if defined(CONFIG_CRAMFS) | |
446 | if (*((unsigned long *)(mtd_phys)) == CRAMFS_MAGIC) | |
447 | mtd_size = PAGE_ALIGN(*((unsigned long *)(mtd_phys + 0x4))); | |
448 | # endif | |
449 | ||
450 | # if defined(CONFIG_ROMFS_FS) | |
451 | if (((unsigned long *)mtd_phys)[0] == ROMSB_WORD0 | |
452 | && ((unsigned long *)mtd_phys)[1] == ROMSB_WORD1) | |
453 | mtd_size = | |
454 | PAGE_ALIGN(be32_to_cpu(((unsigned long *)mtd_phys)[2])); | |
3bebca2d | 455 | # if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263) |
1394f032 BW |
456 | /* Due to a Hardware Anomaly we need to limit the size of usable |
457 | * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on | |
458 | * 05000263 - Hardware loop corrupted when taking an ICPLB exception | |
459 | */ | |
460 | # if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO)) | |
461 | if (memory_end >= 56 * 1024 * 1024) | |
462 | memory_end = 56 * 1024 * 1024; | |
463 | # else | |
464 | if (memory_end >= 60 * 1024 * 1024) | |
465 | memory_end = 60 * 1024 * 1024; | |
466 | # endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */ | |
467 | # endif /* ANOMALY_05000263 */ | |
468 | # endif /* CONFIG_ROMFS_FS */ | |
469 | ||
470 | memory_end -= mtd_size; | |
471 | ||
472 | if (mtd_size == 0) { | |
473 | console_init(); | |
474 | panic("Don't boot kernel without rootfs attached.\n"); | |
475 | } | |
476 | ||
477 | /* Relocate MTD image to the top of memory after the uncached memory area */ | |
b7627acc | 478 | dma_memcpy((char *)memory_end, _end, mtd_size); |
1394f032 BW |
479 | |
480 | memory_mtd_start = memory_end; | |
481 | _ebss = memory_mtd_start; /* define _ebss for compatible */ | |
482 | #endif /* CONFIG_MTD_UCLINUX */ | |
483 | ||
3bebca2d | 484 | #if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263) |
1394f032 BW |
485 | /* Due to a Hardware Anomaly we need to limit the size of usable |
486 | * instruction memory to max 60MB, 56 if HUNT_FOR_ZERO is on | |
487 | * 05000263 - Hardware loop corrupted when taking an ICPLB exception | |
488 | */ | |
489 | #if (defined(CONFIG_DEBUG_HUNT_FOR_ZERO)) | |
490 | if (memory_end >= 56 * 1024 * 1024) | |
491 | memory_end = 56 * 1024 * 1024; | |
492 | #else | |
493 | if (memory_end >= 60 * 1024 * 1024) | |
494 | memory_end = 60 * 1024 * 1024; | |
495 | #endif /* CONFIG_DEBUG_HUNT_FOR_ZERO */ | |
496 | printk(KERN_NOTICE "Warning: limiting memory to %liMB due to hardware anomaly 05000263\n", memory_end >> 20); | |
497 | #endif /* ANOMALY_05000263 */ | |
498 | ||
b97b8a99 BS |
499 | #ifdef CONFIG_MPU |
500 | page_mask_nelts = ((_ramend >> PAGE_SHIFT) + 31) / 32; | |
501 | page_mask_order = get_order(3 * page_mask_nelts * sizeof(long)); | |
502 | #endif | |
503 | ||
1394f032 | 504 | #if !defined(CONFIG_MTD_UCLINUX) |
856783b3 YL |
505 | /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/ |
506 | memory_end -= SIZE_4K; | |
1394f032 | 507 | #endif |
856783b3 | 508 | |
1394f032 BW |
509 | init_mm.start_code = (unsigned long)_stext; |
510 | init_mm.end_code = (unsigned long)_etext; | |
511 | init_mm.end_data = (unsigned long)_edata; | |
512 | init_mm.brk = (unsigned long)0; | |
513 | ||
856783b3 YL |
514 | printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20); |
515 | printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); | |
516 | ||
b7627acc | 517 | printk(KERN_INFO "Memory map:\n" |
8929ecf8 | 518 | KERN_INFO " fixedcode = 0x%p-0x%p\n" |
856783b3 YL |
519 | KERN_INFO " text = 0x%p-0x%p\n" |
520 | KERN_INFO " rodata = 0x%p-0x%p\n" | |
b7627acc | 521 | KERN_INFO " bss = 0x%p-0x%p\n" |
856783b3 YL |
522 | KERN_INFO " data = 0x%p-0x%p\n" |
523 | KERN_INFO " stack = 0x%p-0x%p\n" | |
524 | KERN_INFO " init = 0x%p-0x%p\n" | |
856783b3 YL |
525 | KERN_INFO " available = 0x%p-0x%p\n" |
526 | #ifdef CONFIG_MTD_UCLINUX | |
527 | KERN_INFO " rootfs = 0x%p-0x%p\n" | |
528 | #endif | |
529 | #if DMA_UNCACHED_REGION > 0 | |
530 | KERN_INFO " DMA Zone = 0x%p-0x%p\n" | |
531 | #endif | |
8929ecf8 MF |
532 | , (void *)FIXED_CODE_START, (void *)FIXED_CODE_END, |
533 | _stext, _etext, | |
856783b3 | 534 | __start_rodata, __end_rodata, |
b7627acc | 535 | __bss_start, __bss_stop, |
856783b3 YL |
536 | _sdata, _edata, |
537 | (void *)&init_thread_union, | |
538 | (void *)((int)(&init_thread_union) + 0x2000), | |
b7627acc MF |
539 | __init_begin, __init_end, |
540 | (void *)_ramstart, (void *)memory_end | |
856783b3 YL |
541 | #ifdef CONFIG_MTD_UCLINUX |
542 | , (void *)memory_mtd_start, (void *)(memory_mtd_start + mtd_size) | |
543 | #endif | |
544 | #if DMA_UNCACHED_REGION > 0 | |
545 | , (void *)(_ramend - DMA_UNCACHED_REGION), (void *)(_ramend) | |
546 | #endif | |
547 | ); | |
548 | } | |
549 | ||
2e8d7965 YL |
550 | /* |
551 | * Find the lowest, highest page frame number we have available | |
552 | */ | |
553 | void __init find_min_max_pfn(void) | |
554 | { | |
555 | int i; | |
556 | ||
557 | max_pfn = 0; | |
558 | min_low_pfn = memory_end; | |
559 | ||
560 | for (i = 0; i < bfin_memmap.nr_map; i++) { | |
561 | unsigned long start, end; | |
562 | /* RAM? */ | |
563 | if (bfin_memmap.map[i].type != BFIN_MEMMAP_RAM) | |
564 | continue; | |
565 | start = PFN_UP(bfin_memmap.map[i].addr); | |
566 | end = PFN_DOWN(bfin_memmap.map[i].addr + | |
567 | bfin_memmap.map[i].size); | |
568 | if (start >= end) | |
569 | continue; | |
570 | if (end > max_pfn) | |
571 | max_pfn = end; | |
572 | if (start < min_low_pfn) | |
573 | min_low_pfn = start; | |
574 | } | |
575 | } | |
576 | ||
856783b3 YL |
577 | static __init void setup_bootmem_allocator(void) |
578 | { | |
579 | int bootmap_size; | |
580 | int i; | |
2e8d7965 | 581 | unsigned long start_pfn, end_pfn; |
856783b3 YL |
582 | unsigned long curr_pfn, last_pfn, size; |
583 | ||
584 | /* mark memory between memory_start and memory_end usable */ | |
585 | add_memory_region(memory_start, | |
586 | memory_end - memory_start, BFIN_MEMMAP_RAM); | |
587 | /* sanity check for overlap */ | |
588 | sanitize_memmap(bfin_memmap.map, &bfin_memmap.nr_map); | |
589 | print_memory_map("boot memmap"); | |
590 | ||
2e8d7965 YL |
591 | /* intialize globals in linux/bootmem.h */ |
592 | find_min_max_pfn(); | |
593 | /* pfn of the last usable page frame */ | |
594 | if (max_pfn > memory_end >> PAGE_SHIFT) | |
595 | max_pfn = memory_end >> PAGE_SHIFT; | |
596 | /* pfn of last page frame directly mapped by kernel */ | |
597 | max_low_pfn = max_pfn; | |
598 | /* pfn of the first usable page frame after kernel image*/ | |
599 | if (min_low_pfn < memory_start >> PAGE_SHIFT) | |
600 | min_low_pfn = memory_start >> PAGE_SHIFT; | |
601 | ||
602 | start_pfn = PAGE_OFFSET >> PAGE_SHIFT; | |
603 | end_pfn = memory_end >> PAGE_SHIFT; | |
856783b3 YL |
604 | |
605 | /* | |
606 | * give all the memory to the bootmap allocator, tell it to put the | |
607 | * boot mem_map at the start of memory. | |
608 | */ | |
609 | bootmap_size = init_bootmem_node(NODE_DATA(0), | |
610 | memory_start >> PAGE_SHIFT, /* map goes here */ | |
2e8d7965 | 611 | start_pfn, end_pfn); |
856783b3 YL |
612 | |
613 | /* register the memmap regions with the bootmem allocator */ | |
614 | for (i = 0; i < bfin_memmap.nr_map; i++) { | |
615 | /* | |
616 | * Reserve usable memory | |
617 | */ | |
618 | if (bfin_memmap.map[i].type != BFIN_MEMMAP_RAM) | |
619 | continue; | |
620 | /* | |
621 | * We are rounding up the start address of usable memory: | |
622 | */ | |
623 | curr_pfn = PFN_UP(bfin_memmap.map[i].addr); | |
2e8d7965 | 624 | if (curr_pfn >= end_pfn) |
856783b3 YL |
625 | continue; |
626 | /* | |
627 | * ... and at the end of the usable range downwards: | |
628 | */ | |
629 | last_pfn = PFN_DOWN(bfin_memmap.map[i].addr + | |
630 | bfin_memmap.map[i].size); | |
631 | ||
2e8d7965 YL |
632 | if (last_pfn > end_pfn) |
633 | last_pfn = end_pfn; | |
856783b3 YL |
634 | |
635 | /* | |
636 | * .. finally, did all the rounding and playing | |
637 | * around just make the area go away? | |
638 | */ | |
639 | if (last_pfn <= curr_pfn) | |
640 | continue; | |
641 | ||
642 | size = last_pfn - curr_pfn; | |
643 | free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); | |
644 | } | |
645 | ||
646 | /* reserve memory before memory_start, including bootmap */ | |
647 | reserve_bootmem(PAGE_OFFSET, | |
648 | memory_start + bootmap_size + PAGE_SIZE - 1 - PAGE_OFFSET, | |
649 | BOOTMEM_DEFAULT); | |
650 | } | |
651 | ||
652 | void __init setup_arch(char **cmdline_p) | |
653 | { | |
654 | unsigned long l1_length, sclk, cclk; | |
856783b3 YL |
655 | |
656 | #ifdef CONFIG_DUMMY_CONSOLE | |
657 | conswitchp = &dummy_con; | |
658 | #endif | |
659 | ||
660 | #if defined(CONFIG_CMDLINE_BOOL) | |
661 | strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line)); | |
662 | command_line[sizeof(command_line) - 1] = 0; | |
663 | #endif | |
664 | ||
665 | /* Keep a copy of command line */ | |
666 | *cmdline_p = &command_line[0]; | |
667 | memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); | |
668 | boot_command_line[COMMAND_LINE_SIZE - 1] = '\0'; | |
669 | ||
670 | /* setup memory defaults from the user config */ | |
671 | physical_mem_end = 0; | |
672 | _ramend = CONFIG_MEM_SIZE * 1024 * 1024; | |
673 | ||
674 | memset(&bfin_memmap, 0, sizeof(bfin_memmap)); | |
675 | ||
676 | parse_cmdline_early(&command_line[0]); | |
677 | ||
678 | if (physical_mem_end == 0) | |
679 | physical_mem_end = _ramend; | |
680 | ||
681 | memory_setup(); | |
682 | ||
683 | cclk = get_cclk(); | |
684 | sclk = get_sclk(); | |
685 | ||
686 | #if !defined(CONFIG_BFIN_KERNEL_CLOCK) | |
687 | if (ANOMALY_05000273 && cclk == sclk) | |
688 | panic("ANOMALY 05000273, SCLK can not be same as CCLK"); | |
689 | #endif | |
690 | ||
691 | #ifdef BF561_FAMILY | |
692 | if (ANOMALY_05000266) { | |
693 | bfin_read_IMDMA_D0_IRQ_STATUS(); | |
694 | bfin_read_IMDMA_D1_IRQ_STATUS(); | |
695 | } | |
696 | #endif | |
697 | printk(KERN_INFO "Hardware Trace "); | |
698 | if (bfin_read_TBUFCTL() & 0x1) | |
699 | printk("Active "); | |
700 | else | |
701 | printk("Off "); | |
702 | if (bfin_read_TBUFCTL() & 0x2) | |
703 | printk("and Enabled\n"); | |
704 | else | |
705 | printk("and Disabled\n"); | |
706 | ||
707 | #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) | |
708 | /* we need to initialize the Flashrom device here since we might | |
709 | * do things with flash early on in the boot | |
710 | */ | |
711 | flash_probe(); | |
712 | #endif | |
713 | ||
7728ec33 RG |
714 | _bfin_swrst = bfin_read_SWRST(); |
715 | ||
716 | if (_bfin_swrst & RESET_DOUBLE) | |
717 | printk(KERN_INFO "Recovering from Double Fault event\n"); | |
718 | else if (_bfin_swrst & RESET_WDOG) | |
719 | printk(KERN_INFO "Recovering from Watchdog event\n"); | |
720 | else if (_bfin_swrst & RESET_SOFTWARE) | |
721 | printk(KERN_NOTICE "Reset caused by Software reset\n"); | |
722 | ||
550d5538 | 723 | printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n"); |
de3025f4 JZ |
724 | if (bfin_compiled_revid() == 0xffff) |
725 | printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU); | |
726 | else if (bfin_compiled_revid() == -1) | |
727 | printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU); | |
728 | else | |
729 | printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid()); | |
730 | if (bfin_revid() != bfin_compiled_revid()) { | |
731 | if (bfin_compiled_revid() == -1) | |
732 | printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n", | |
733 | bfin_revid()); | |
734 | else if (bfin_compiled_revid() != 0xffff) | |
735 | printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n", | |
736 | bfin_compiled_revid(), bfin_revid()); | |
737 | } | |
1394f032 BW |
738 | if (bfin_revid() < SUPPORTED_REVID) |
739 | printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n", | |
740 | CPU, bfin_revid()); | |
741 | printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n"); | |
742 | ||
b5c0e2e8 | 743 | printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n", |
1394f032 BW |
744 | cclk / 1000000, sclk / 1000000); |
745 | ||
1aafd909 | 746 | if (ANOMALY_05000273 && (cclk >> 1) <= sclk) |
1394f032 | 747 | printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n"); |
1394f032 | 748 | |
856783b3 | 749 | setup_bootmem_allocator(); |
1394f032 | 750 | |
1394f032 BW |
751 | paging_init(); |
752 | ||
753 | /* check the size of the l1 area */ | |
754 | l1_length = _etext_l1 - _stext_l1; | |
755 | if (l1_length > L1_CODE_LENGTH) | |
34e0fc89 | 756 | panic("L1 code memory overflow\n"); |
1394f032 BW |
757 | |
758 | l1_length = _ebss_l1 - _sdata_l1; | |
759 | if (l1_length > L1_DATA_A_LENGTH) | |
34e0fc89 | 760 | panic("L1 data memory overflow\n"); |
1394f032 | 761 | |
7adfb58f BS |
762 | /* Copy atomic sequences to their fixed location, and sanity check that |
763 | these locations are the ones that we advertise to userspace. */ | |
764 | memcpy((void *)FIXED_CODE_START, &fixed_code_start, | |
765 | FIXED_CODE_END - FIXED_CODE_START); | |
766 | BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start | |
767 | != SIGRETURN_STUB - FIXED_CODE_START); | |
768 | BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start | |
769 | != ATOMIC_XCHG32 - FIXED_CODE_START); | |
770 | BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start | |
771 | != ATOMIC_CAS32 - FIXED_CODE_START); | |
772 | BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start | |
773 | != ATOMIC_ADD32 - FIXED_CODE_START); | |
774 | BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start | |
775 | != ATOMIC_SUB32 - FIXED_CODE_START); | |
776 | BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start | |
777 | != ATOMIC_IOR32 - FIXED_CODE_START); | |
778 | BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start | |
779 | != ATOMIC_AND32 - FIXED_CODE_START); | |
780 | BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start | |
781 | != ATOMIC_XOR32 - FIXED_CODE_START); | |
9f336a53 RG |
782 | BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start |
783 | != SAFE_USER_INSTRUCTION - FIXED_CODE_START); | |
29440a2b | 784 | |
8be80ed3 | 785 | init_exception_vectors(); |
29440a2b | 786 | bf53x_cache_init(); |
1394f032 BW |
787 | } |
788 | ||
1394f032 BW |
789 | static int __init topology_init(void) |
790 | { | |
6cda2e90 MH |
791 | int cpu; |
792 | ||
793 | for_each_possible_cpu(cpu) { | |
794 | struct cpu *c = &per_cpu(cpu_devices, cpu); | |
795 | ||
796 | register_cpu(c, cpu); | |
797 | } | |
798 | ||
1394f032 | 799 | return 0; |
1394f032 BW |
800 | } |
801 | ||
802 | subsys_initcall(topology_init); | |
803 | ||
52a07812 | 804 | static u_long get_vco(void) |
1394f032 BW |
805 | { |
806 | u_long msel; | |
807 | u_long vco; | |
808 | ||
809 | msel = (bfin_read_PLL_CTL() >> 9) & 0x3F; | |
810 | if (0 == msel) | |
811 | msel = 64; | |
812 | ||
813 | vco = CONFIG_CLKIN_HZ; | |
814 | vco >>= (1 & bfin_read_PLL_CTL()); /* DF bit */ | |
815 | vco = msel * vco; | |
816 | return vco; | |
817 | } | |
818 | ||
2f6cf7bf | 819 | /* Get the Core clock */ |
1394f032 BW |
820 | u_long get_cclk(void) |
821 | { | |
822 | u_long csel, ssel; | |
823 | if (bfin_read_PLL_STAT() & 0x1) | |
824 | return CONFIG_CLKIN_HZ; | |
825 | ||
826 | ssel = bfin_read_PLL_DIV(); | |
827 | csel = ((ssel >> 4) & 0x03); | |
828 | ssel &= 0xf; | |
829 | if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */ | |
830 | return get_vco() / ssel; | |
831 | return get_vco() >> csel; | |
832 | } | |
1394f032 BW |
833 | EXPORT_SYMBOL(get_cclk); |
834 | ||
835 | /* Get the System clock */ | |
836 | u_long get_sclk(void) | |
837 | { | |
838 | u_long ssel; | |
839 | ||
840 | if (bfin_read_PLL_STAT() & 0x1) | |
841 | return CONFIG_CLKIN_HZ; | |
842 | ||
843 | ssel = (bfin_read_PLL_DIV() & 0xf); | |
844 | if (0 == ssel) { | |
845 | printk(KERN_WARNING "Invalid System Clock\n"); | |
846 | ssel = 1; | |
847 | } | |
848 | ||
849 | return get_vco() / ssel; | |
850 | } | |
1394f032 BW |
851 | EXPORT_SYMBOL(get_sclk); |
852 | ||
2f6cf7bf MF |
853 | unsigned long sclk_to_usecs(unsigned long sclk) |
854 | { | |
1754a5d9 MF |
855 | u64 tmp = USEC_PER_SEC * (u64)sclk; |
856 | do_div(tmp, get_sclk()); | |
857 | return tmp; | |
2f6cf7bf MF |
858 | } |
859 | EXPORT_SYMBOL(sclk_to_usecs); | |
860 | ||
861 | unsigned long usecs_to_sclk(unsigned long usecs) | |
862 | { | |
1754a5d9 MF |
863 | u64 tmp = get_sclk() * (u64)usecs; |
864 | do_div(tmp, USEC_PER_SEC); | |
865 | return tmp; | |
2f6cf7bf MF |
866 | } |
867 | EXPORT_SYMBOL(usecs_to_sclk); | |
868 | ||
1394f032 BW |
869 | /* |
870 | * Get CPU information for use by the procfs. | |
871 | */ | |
872 | static int show_cpuinfo(struct seq_file *m, void *v) | |
873 | { | |
066954a3 | 874 | char *cpu, *mmu, *fpu, *vendor, *cache; |
1394f032 BW |
875 | uint32_t revid; |
876 | ||
877 | u_long cclk = 0, sclk = 0; | |
878 | u_int dcache_size = 0, dsup_banks = 0; | |
879 | ||
880 | cpu = CPU; | |
881 | mmu = "none"; | |
882 | fpu = "none"; | |
883 | revid = bfin_revid(); | |
1394f032 BW |
884 | |
885 | cclk = get_cclk(); | |
886 | sclk = get_sclk(); | |
887 | ||
73b0c0b0 | 888 | switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) { |
066954a3 MF |
889 | case 0xca: |
890 | vendor = "Analog Devices"; | |
73b0c0b0 RG |
891 | break; |
892 | default: | |
066954a3 MF |
893 | vendor = "unknown"; |
894 | break; | |
73b0c0b0 | 895 | } |
1394f032 | 896 | |
73b0c0b0 RG |
897 | seq_printf(m, "processor\t: %d\n" |
898 | "vendor_id\t: %s\n" | |
899 | "cpu family\t: 0x%x\n" | |
900 | "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK)\n" | |
901 | "stepping\t: %d\n", | |
902 | 0, | |
903 | vendor, | |
904 | (bfin_read_CHIPID() & CHIPID_FAMILY), | |
905 | cpu, cclk/1000000, sclk/1000000, | |
906 | revid); | |
907 | ||
908 | seq_printf(m, "cpu MHz\t\t: %lu.%03lu/%lu.%03lu\n", | |
909 | cclk/1000000, cclk%1000000, | |
910 | sclk/1000000, sclk%1000000); | |
911 | seq_printf(m, "bogomips\t: %lu.%02lu\n" | |
912 | "Calibration\t: %lu loops\n", | |
913 | (loops_per_jiffy * HZ) / 500000, | |
914 | ((loops_per_jiffy * HZ) / 5000) % 100, | |
915 | (loops_per_jiffy * HZ)); | |
916 | ||
917 | /* Check Cache configutation */ | |
1f83b8f1 MF |
918 | switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) { |
919 | case ACACHE_BSRAM: | |
066954a3 | 920 | cache = "dbank-A/B\t: cache/sram"; |
1f83b8f1 MF |
921 | dcache_size = 16; |
922 | dsup_banks = 1; | |
923 | break; | |
924 | case ACACHE_BCACHE: | |
066954a3 | 925 | cache = "dbank-A/B\t: cache/cache"; |
1f83b8f1 MF |
926 | dcache_size = 32; |
927 | dsup_banks = 2; | |
928 | break; | |
929 | case ASRAM_BSRAM: | |
066954a3 | 930 | cache = "dbank-A/B\t: sram/sram"; |
1f83b8f1 MF |
931 | dcache_size = 0; |
932 | dsup_banks = 0; | |
933 | break; | |
934 | default: | |
066954a3 | 935 | cache = "unknown"; |
73b0c0b0 RG |
936 | dcache_size = 0; |
937 | dsup_banks = 0; | |
1394f032 BW |
938 | break; |
939 | } | |
940 | ||
73b0c0b0 RG |
941 | /* Is it turned on? */ |
942 | if (!((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE))) | |
943 | dcache_size = 0; | |
1394f032 | 944 | |
73b0c0b0 RG |
945 | seq_printf(m, "cache size\t: %d KB(L1 icache) " |
946 | "%d KB(L1 dcache-%s) %d KB(L2 cache)\n", | |
947 | BFIN_ICACHESIZE / 1024, dcache_size, | |
948 | #if defined CONFIG_BFIN_WB | |
949 | "wb" | |
950 | #elif defined CONFIG_BFIN_WT | |
951 | "wt" | |
952 | #endif | |
da27abb7 | 953 | "", 0); |
73b0c0b0 RG |
954 | |
955 | seq_printf(m, "%s\n", cache); | |
956 | ||
957 | seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n", | |
3bebca2d | 958 | BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES); |
1394f032 | 959 | seq_printf(m, |
73b0c0b0 | 960 | "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n", |
3bebca2d RG |
961 | dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS, |
962 | BFIN_DLINES); | |
963 | #ifdef CONFIG_BFIN_ICACHE_LOCK | |
1394f032 BW |
964 | switch (read_iloc()) { |
965 | case WAY0_L: | |
966 | seq_printf(m, "Way0 Locked-Down\n"); | |
967 | break; | |
968 | case WAY1_L: | |
969 | seq_printf(m, "Way1 Locked-Down\n"); | |
970 | break; | |
971 | case WAY01_L: | |
972 | seq_printf(m, "Way0,Way1 Locked-Down\n"); | |
973 | break; | |
974 | case WAY2_L: | |
975 | seq_printf(m, "Way2 Locked-Down\n"); | |
976 | break; | |
977 | case WAY02_L: | |
978 | seq_printf(m, "Way0,Way2 Locked-Down\n"); | |
979 | break; | |
980 | case WAY12_L: | |
981 | seq_printf(m, "Way1,Way2 Locked-Down\n"); | |
982 | break; | |
983 | case WAY012_L: | |
984 | seq_printf(m, "Way0,Way1 & Way2 Locked-Down\n"); | |
985 | break; | |
986 | case WAY3_L: | |
987 | seq_printf(m, "Way3 Locked-Down\n"); | |
988 | break; | |
989 | case WAY03_L: | |
990 | seq_printf(m, "Way0,Way3 Locked-Down\n"); | |
991 | break; | |
992 | case WAY13_L: | |
993 | seq_printf(m, "Way1,Way3 Locked-Down\n"); | |
994 | break; | |
995 | case WAY013_L: | |
996 | seq_printf(m, "Way 0,Way1,Way3 Locked-Down\n"); | |
997 | break; | |
998 | case WAY32_L: | |
999 | seq_printf(m, "Way3,Way2 Locked-Down\n"); | |
1000 | break; | |
1001 | case WAY320_L: | |
1002 | seq_printf(m, "Way3,Way2,Way0 Locked-Down\n"); | |
1003 | break; | |
1004 | case WAY321_L: | |
1005 | seq_printf(m, "Way3,Way2,Way1 Locked-Down\n"); | |
1006 | break; | |
1007 | case WAYALL_L: | |
1008 | seq_printf(m, "All Ways are locked\n"); | |
1009 | break; | |
1010 | default: | |
1011 | seq_printf(m, "No Ways are locked\n"); | |
1012 | } | |
1013 | #endif | |
73b0c0b0 | 1014 | |
066954a3 | 1015 | seq_printf(m, "board name\t: %s\n", bfin_board_name); |
73b0c0b0 RG |
1016 | seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n", |
1017 | physical_mem_end >> 10, (void *)0, (void *)physical_mem_end); | |
1018 | seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n", | |
1019 | ((int)memory_end - (int)_stext) >> 10, | |
1020 | _stext, | |
1021 | (void *)memory_end); | |
1022 | ||
1394f032 BW |
1023 | return 0; |
1024 | } | |
1025 | ||
1026 | static void *c_start(struct seq_file *m, loff_t *pos) | |
1027 | { | |
1028 | return *pos < NR_CPUS ? ((void *)0x12345678) : NULL; | |
1029 | } | |
1030 | ||
1031 | static void *c_next(struct seq_file *m, void *v, loff_t *pos) | |
1032 | { | |
1033 | ++*pos; | |
1034 | return c_start(m, pos); | |
1035 | } | |
1036 | ||
1037 | static void c_stop(struct seq_file *m, void *v) | |
1038 | { | |
1039 | } | |
1040 | ||
03a44825 | 1041 | const struct seq_operations cpuinfo_op = { |
1394f032 BW |
1042 | .start = c_start, |
1043 | .next = c_next, | |
1044 | .stop = c_stop, | |
1045 | .show = show_cpuinfo, | |
1046 | }; | |
1047 | ||
5e10b4a6 | 1048 | void __init cmdline_init(const char *r0) |
1394f032 BW |
1049 | { |
1050 | if (r0) | |
52a07812 | 1051 | strncpy(command_line, r0, COMMAND_LINE_SIZE); |
1394f032 | 1052 | } |