blob: 2255c289a714db37938d0b96345de10335dbc7ae [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Mike Frysinger550d5532008-02-02 15:55:37 +08002 * arch/blackfin/kernel/setup.c
Bryan Wu1394f032007-05-06 14:50:22 -07003 *
Mike Frysinger550d5532008-02-02 15:55:37 +08004 * Copyright 2004-2006 Analog Devices Inc.
Bryan Wu1394f032007-05-06 14:50:22 -07005 *
Mike Frysinger550d5532008-02-02 15:55:37 +08006 * Enter bugs at http://blackfin.uclinux.org/
Bryan Wu1394f032007-05-06 14:50:22 -07007 *
Mike Frysinger550d5532008-02-02 15:55:37 +08008 * Licensed under the GPL-2 or later.
Bryan Wu1394f032007-05-06 14:50:22 -07009 */
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>
Bryan Wu1394f032007-05-06 14:50:22 -070017#include <linux/tty.h>
Yi Li856783b2008-02-09 02:26:01 +080018#include <linux/pfn.h>
Bryan Wu1394f032007-05-06 14:50:22 -070019
20#include <linux/ext2_fs.h>
21#include <linux/cramfs_fs.h>
22#include <linux/romfs_fs.h>
23
Robin Getz3bebca22007-10-10 23:55:26 +080024#include <asm/cplb.h>
Bryan Wu1394f032007-05-06 14:50:22 -070025#include <asm/cacheflush.h>
26#include <asm/blackfin.h>
27#include <asm/cplbinit.h>
Mike Frysinger1754a5d2007-11-23 11:28:11 +080028#include <asm/div64.h>
Bernd Schmidt7adfb582007-06-21 11:34:16 +080029#include <asm/fixed_code.h>
Robin Getzce3afa12007-10-09 17:28:36 +080030#include <asm/early_printk.h>
Bryan Wu1394f032007-05-06 14:50:22 -070031
Michael Hennerich6cda2e92008-02-02 15:10:51 +080032static DEFINE_PER_CPU(struct cpu, cpu_devices);
33
Mike Frysingera9c59c22007-05-21 18:09:32 +080034u16 _bfin_swrst;
Mike Frysingerd45118b2008-02-25 12:24:44 +080035EXPORT_SYMBOL(_bfin_swrst);
Mike Frysingera9c59c22007-05-21 18:09:32 +080036
Bryan Wu1394f032007-05-06 14:50:22 -070037unsigned long memory_start, memory_end, physical_mem_end;
38unsigned long reserved_mem_dcache_on;
39unsigned long reserved_mem_icache_on;
40EXPORT_SYMBOL(memory_start);
41EXPORT_SYMBOL(memory_end);
42EXPORT_SYMBOL(physical_mem_end);
43EXPORT_SYMBOL(_ramend);
44
45#ifdef CONFIG_MTD_UCLINUX
46unsigned long memory_mtd_end, memory_mtd_start, mtd_size;
47unsigned long _ebss;
48EXPORT_SYMBOL(memory_mtd_end);
49EXPORT_SYMBOL(memory_mtd_start);
50EXPORT_SYMBOL(mtd_size);
51#endif
52
Mike Frysinger5e10b4a2007-06-11 16:44:09 +080053char __initdata command_line[COMMAND_LINE_SIZE];
Bryan Wu1394f032007-05-06 14:50:22 -070054
Yi Li856783b2008-02-09 02:26:01 +080055/* 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
59struct 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 */
69struct change_member {
70 struct bfin_memmap_entry *pentry; /* pointer to original entry */
71 unsigned long long addr; /* address for this change point */
72};
73static struct change_member change_point_list[2*BFIN_MEMMAP_MAX] __initdata;
74static struct change_member *change_point[2*BFIN_MEMMAP_MAX] __initdata;
75static struct bfin_memmap_entry *overlap_list[BFIN_MEMMAP_MAX] __initdata;
76static struct bfin_memmap_entry new_map[BFIN_MEMMAP_MAX] __initdata;
77
Bryan Wu1394f032007-05-06 14:50:22 -070078void __init bf53x_cache_init(void)
79{
Robin Getz3bebca22007-10-10 23:55:26 +080080#if defined(CONFIG_BFIN_DCACHE) || defined(CONFIG_BFIN_ICACHE)
Bryan Wu1394f032007-05-06 14:50:22 -070081 generate_cpl_tables();
82#endif
83
Robin Getz3bebca22007-10-10 23:55:26 +080084#ifdef CONFIG_BFIN_ICACHE
Bryan Wu1394f032007-05-06 14:50:22 -070085 bfin_icache_init();
86 printk(KERN_INFO "Instruction Cache Enabled\n");
87#endif
88
Robin Getz3bebca22007-10-10 23:55:26 +080089#ifdef CONFIG_BFIN_DCACHE
Bryan Wu1394f032007-05-06 14:50:22 -070090 bfin_dcache_init();
91 printk(KERN_INFO "Data Cache Enabled"
Robin Getz3bebca22007-10-10 23:55:26 +080092# if defined CONFIG_BFIN_WB
Bryan Wu1394f032007-05-06 14:50:22 -070093 " (write-back)"
Robin Getz3bebca22007-10-10 23:55:26 +080094# elif defined CONFIG_BFIN_WT
Bryan Wu1394f032007-05-06 14:50:22 -070095 " (write-through)"
96# endif
97 "\n");
98#endif
99}
100
Mike Frysinger52a07812007-06-11 15:31:30 +0800101void __init bf53x_relocate_l1_mem(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700102{
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
Yi Li856783b2008-02-09 02:26:01 +0800134/* add_memory_region to memmap */
135static 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 */
156static 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
302static 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
323static __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
Bryan Wu1394f032007-05-06 14:50:22 -0700342/*
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
Yi Li856783b2008-02-09 02:26:01 +0800348 * - "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 *
Bryan Wu1394f032007-05-06 14:50:22 -0700352 */
353static __init void parse_cmdline_early(char *cmdline_p)
354{
355 char c = ' ', *to = cmdline_p;
356 unsigned int memsize;
357 for (;;) {
358 if (c == ' ') {
Bryan Wu1394f032007-05-06 14:50:22 -0700359 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 }
Robin Getzce3afa12007-10-09 17:28:36 +0800381 } else if (!memcmp(to, "earlyprintk=", 12)) {
382 to += 12;
383 setup_early_printk(to);
Yi Li856783b2008-02-09 02:26:01 +0800384 } else if (!memcmp(to, "memmap=", 7)) {
385 to += 7;
386 parse_memmap(to);
Bryan Wu1394f032007-05-06 14:50:22 -0700387 }
Bryan Wu1394f032007-05-06 14:50:22 -0700388 }
389 c = *(to++);
390 if (!c)
391 break;
392 }
393}
394
Yi Li856783b2008-02-09 02:26:01 +0800395/*
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 */
409static __init void memory_setup(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700410{
Mike Frysingerc0eab3b2008-02-02 15:36:11 +0800411#ifdef CONFIG_MTD_UCLINUX
412 unsigned long mtd_phys = 0;
413#endif
414
Yi Li856783b2008-02-09 02:26:01 +0800415 _rambase = (unsigned long)_stext;
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800416 _ramstart = (unsigned long)_end;
Bryan Wu1394f032007-05-06 14:50:22 -0700417
Yi Li856783b2008-02-09 02:26:01 +0800418 if (DMA_UNCACHED_REGION > (_ramend - _ramstart)) {
419 console_init();
420 panic("DMA region exceeds memory limit: %lu.\n",
421 _ramend - _ramstart);
Mike Frysinger1aafd902007-07-25 11:19:14 +0800422 }
Bryan Wu1394f032007-05-06 14:50:22 -0700423 memory_end = _ramend - DMA_UNCACHED_REGION;
424
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800425#ifdef CONFIG_MPU
426 /* Round up to multiple of 4MB. */
427 memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
428#else
Bryan Wu1394f032007-05-06 14:50:22 -0700429 memory_start = PAGE_ALIGN(_ramstart);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800430#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700431
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]));
Robin Getz3bebca22007-10-10 23:55:26 +0800455# if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
Bryan Wu1394f032007-05-06 14:50:22 -0700456 /* 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 */
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800478 dma_memcpy((char *)memory_end, _end, mtd_size);
Bryan Wu1394f032007-05-06 14:50:22 -0700479
480 memory_mtd_start = memory_end;
481 _ebss = memory_mtd_start; /* define _ebss for compatible */
482#endif /* CONFIG_MTD_UCLINUX */
483
Robin Getz3bebca22007-10-10 23:55:26 +0800484#if (defined(CONFIG_BFIN_ICACHE) && ANOMALY_05000263)
Bryan Wu1394f032007-05-06 14:50:22 -0700485 /* 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
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800499#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
Bryan Wu1394f032007-05-06 14:50:22 -0700504#if !defined(CONFIG_MTD_UCLINUX)
Yi Li856783b2008-02-09 02:26:01 +0800505 /*In case there is no valid CPLB behind memory_end make sure we don't get to close*/
506 memory_end -= SIZE_4K;
Bryan Wu1394f032007-05-06 14:50:22 -0700507#endif
Yi Li856783b2008-02-09 02:26:01 +0800508
Bryan Wu1394f032007-05-06 14:50:22 -0700509 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
Yi Li856783b2008-02-09 02:26:01 +0800514 printk(KERN_INFO "Board Memory: %ldMB\n", physical_mem_end >> 20);
515 printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20);
516
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800517 printk(KERN_INFO "Memory map:\n"
Mike Frysinger8929ecf82008-02-22 16:35:20 +0800518 KERN_INFO " fixedcode = 0x%p-0x%p\n"
Yi Li856783b2008-02-09 02:26:01 +0800519 KERN_INFO " text = 0x%p-0x%p\n"
520 KERN_INFO " rodata = 0x%p-0x%p\n"
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800521 KERN_INFO " bss = 0x%p-0x%p\n"
Yi Li856783b2008-02-09 02:26:01 +0800522 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"
Yi Li856783b2008-02-09 02:26:01 +0800525 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
Mike Frysinger8929ecf82008-02-22 16:35:20 +0800532 , (void *)FIXED_CODE_START, (void *)FIXED_CODE_END,
533 _stext, _etext,
Yi Li856783b2008-02-09 02:26:01 +0800534 __start_rodata, __end_rodata,
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800535 __bss_start, __bss_stop,
Yi Li856783b2008-02-09 02:26:01 +0800536 _sdata, _edata,
537 (void *)&init_thread_union,
538 (void *)((int)(&init_thread_union) + 0x2000),
Mike Frysingerb7627ac2008-02-02 15:53:17 +0800539 __init_begin, __init_end,
540 (void *)_ramstart, (void *)memory_end
Yi Li856783b2008-02-09 02:26:01 +0800541#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
550static __init void setup_bootmem_allocator(void)
551{
552 int bootmap_size;
553 int i;
554 unsigned long min_pfn, max_pfn;
555 unsigned long curr_pfn, last_pfn, size;
556
557 /* mark memory between memory_start and memory_end usable */
558 add_memory_region(memory_start,
559 memory_end - memory_start, BFIN_MEMMAP_RAM);
560 /* sanity check for overlap */
561 sanitize_memmap(bfin_memmap.map, &bfin_memmap.nr_map);
562 print_memory_map("boot memmap");
563
564 min_pfn = PAGE_OFFSET >> PAGE_SHIFT;
565 max_pfn = memory_end >> PAGE_SHIFT;
566
567 /*
568 * give all the memory to the bootmap allocator, tell it to put the
569 * boot mem_map at the start of memory.
570 */
571 bootmap_size = init_bootmem_node(NODE_DATA(0),
572 memory_start >> PAGE_SHIFT, /* map goes here */
573 min_pfn, max_pfn);
574
575 /* register the memmap regions with the bootmem allocator */
576 for (i = 0; i < bfin_memmap.nr_map; i++) {
577 /*
578 * Reserve usable memory
579 */
580 if (bfin_memmap.map[i].type != BFIN_MEMMAP_RAM)
581 continue;
582 /*
583 * We are rounding up the start address of usable memory:
584 */
585 curr_pfn = PFN_UP(bfin_memmap.map[i].addr);
586 if (curr_pfn >= max_pfn)
587 continue;
588 /*
589 * ... and at the end of the usable range downwards:
590 */
591 last_pfn = PFN_DOWN(bfin_memmap.map[i].addr +
592 bfin_memmap.map[i].size);
593
594 if (last_pfn > max_pfn)
595 last_pfn = max_pfn;
596
597 /*
598 * .. finally, did all the rounding and playing
599 * around just make the area go away?
600 */
601 if (last_pfn <= curr_pfn)
602 continue;
603
604 size = last_pfn - curr_pfn;
605 free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size));
606 }
607
608 /* reserve memory before memory_start, including bootmap */
609 reserve_bootmem(PAGE_OFFSET,
610 memory_start + bootmap_size + PAGE_SIZE - 1 - PAGE_OFFSET,
611 BOOTMEM_DEFAULT);
612}
613
614void __init setup_arch(char **cmdline_p)
615{
616 unsigned long l1_length, sclk, cclk;
Yi Li856783b2008-02-09 02:26:01 +0800617
618#ifdef CONFIG_DUMMY_CONSOLE
619 conswitchp = &dummy_con;
620#endif
621
622#if defined(CONFIG_CMDLINE_BOOL)
623 strncpy(&command_line[0], CONFIG_CMDLINE, sizeof(command_line));
624 command_line[sizeof(command_line) - 1] = 0;
625#endif
626
627 /* Keep a copy of command line */
628 *cmdline_p = &command_line[0];
629 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
630 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
631
632 /* setup memory defaults from the user config */
633 physical_mem_end = 0;
634 _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
635
636 memset(&bfin_memmap, 0, sizeof(bfin_memmap));
637
638 parse_cmdline_early(&command_line[0]);
639
640 if (physical_mem_end == 0)
641 physical_mem_end = _ramend;
642
643 memory_setup();
644
645 cclk = get_cclk();
646 sclk = get_sclk();
647
648#if !defined(CONFIG_BFIN_KERNEL_CLOCK)
649 if (ANOMALY_05000273 && cclk == sclk)
650 panic("ANOMALY 05000273, SCLK can not be same as CCLK");
651#endif
652
653#ifdef BF561_FAMILY
654 if (ANOMALY_05000266) {
655 bfin_read_IMDMA_D0_IRQ_STATUS();
656 bfin_read_IMDMA_D1_IRQ_STATUS();
657 }
658#endif
659 printk(KERN_INFO "Hardware Trace ");
660 if (bfin_read_TBUFCTL() & 0x1)
661 printk("Active ");
662 else
663 printk("Off ");
664 if (bfin_read_TBUFCTL() & 0x2)
665 printk("and Enabled\n");
666 else
667 printk("and Disabled\n");
668
669#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
670 /* we need to initialize the Flashrom device here since we might
671 * do things with flash early on in the boot
672 */
673 flash_probe();
674#endif
675
Robin Getz7728ec32007-10-29 18:12:15 +0800676 _bfin_swrst = bfin_read_SWRST();
677
678 if (_bfin_swrst & RESET_DOUBLE)
679 printk(KERN_INFO "Recovering from Double Fault event\n");
680 else if (_bfin_swrst & RESET_WDOG)
681 printk(KERN_INFO "Recovering from Watchdog event\n");
682 else if (_bfin_swrst & RESET_SOFTWARE)
683 printk(KERN_NOTICE "Reset caused by Software reset\n");
684
Mike Frysinger550d5532008-02-02 15:55:37 +0800685 printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n");
Jie Zhangde3025f2007-06-25 18:04:12 +0800686 if (bfin_compiled_revid() == 0xffff)
687 printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
688 else if (bfin_compiled_revid() == -1)
689 printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
690 else
691 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
692 if (bfin_revid() != bfin_compiled_revid()) {
693 if (bfin_compiled_revid() == -1)
694 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
695 bfin_revid());
696 else if (bfin_compiled_revid() != 0xffff)
697 printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
698 bfin_compiled_revid(), bfin_revid());
699 }
Bryan Wu1394f032007-05-06 14:50:22 -0700700 if (bfin_revid() < SUPPORTED_REVID)
701 printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
702 CPU, bfin_revid());
703 printk(KERN_INFO "Blackfin Linux support by http://blackfin.uclinux.org/\n");
704
Mike Frysingerb5c0e2e2007-09-12 17:31:59 +0800705 printk(KERN_INFO "Processor Speed: %lu MHz core clock and %lu MHz System Clock\n",
Bryan Wu1394f032007-05-06 14:50:22 -0700706 cclk / 1000000, sclk / 1000000);
707
Mike Frysinger1aafd902007-07-25 11:19:14 +0800708 if (ANOMALY_05000273 && (cclk >> 1) <= sclk)
Bryan Wu1394f032007-05-06 14:50:22 -0700709 printk("\n\n\nANOMALY_05000273: CCLK must be >= 2*SCLK !!!\n\n\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700710
Yi Li856783b2008-02-09 02:26:01 +0800711 setup_bootmem_allocator();
Bryan Wu1394f032007-05-06 14:50:22 -0700712
Bryan Wu1394f032007-05-06 14:50:22 -0700713 paging_init();
714
715 /* check the size of the l1 area */
716 l1_length = _etext_l1 - _stext_l1;
717 if (l1_length > L1_CODE_LENGTH)
Michael Hennerich34e0fc82007-07-12 16:17:18 +0800718 panic("L1 code memory overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700719
720 l1_length = _ebss_l1 - _sdata_l1;
721 if (l1_length > L1_DATA_A_LENGTH)
Michael Hennerich34e0fc82007-07-12 16:17:18 +0800722 panic("L1 data memory overflow\n");
Bryan Wu1394f032007-05-06 14:50:22 -0700723
Bernd Schmidt7adfb582007-06-21 11:34:16 +0800724 /* Copy atomic sequences to their fixed location, and sanity check that
725 these locations are the ones that we advertise to userspace. */
726 memcpy((void *)FIXED_CODE_START, &fixed_code_start,
727 FIXED_CODE_END - FIXED_CODE_START);
728 BUG_ON((char *)&sigreturn_stub - (char *)&fixed_code_start
729 != SIGRETURN_STUB - FIXED_CODE_START);
730 BUG_ON((char *)&atomic_xchg32 - (char *)&fixed_code_start
731 != ATOMIC_XCHG32 - FIXED_CODE_START);
732 BUG_ON((char *)&atomic_cas32 - (char *)&fixed_code_start
733 != ATOMIC_CAS32 - FIXED_CODE_START);
734 BUG_ON((char *)&atomic_add32 - (char *)&fixed_code_start
735 != ATOMIC_ADD32 - FIXED_CODE_START);
736 BUG_ON((char *)&atomic_sub32 - (char *)&fixed_code_start
737 != ATOMIC_SUB32 - FIXED_CODE_START);
738 BUG_ON((char *)&atomic_ior32 - (char *)&fixed_code_start
739 != ATOMIC_IOR32 - FIXED_CODE_START);
740 BUG_ON((char *)&atomic_and32 - (char *)&fixed_code_start
741 != ATOMIC_AND32 - FIXED_CODE_START);
742 BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
743 != ATOMIC_XOR32 - FIXED_CODE_START);
Robin Getz9f336a52007-10-29 18:23:28 +0800744 BUG_ON((char *)&safe_user_instruction - (char *)&fixed_code_start
745 != SAFE_USER_INSTRUCTION - FIXED_CODE_START);
Bernd Schmidt29440a22007-07-12 16:25:29 +0800746
Bernd Schmidt8be80ed2007-07-25 14:44:49 +0800747 init_exception_vectors();
Bernd Schmidt29440a22007-07-12 16:25:29 +0800748 bf53x_cache_init();
Bryan Wu1394f032007-05-06 14:50:22 -0700749}
750
Bryan Wu1394f032007-05-06 14:50:22 -0700751static int __init topology_init(void)
752{
Michael Hennerich6cda2e92008-02-02 15:10:51 +0800753 int cpu;
754
755 for_each_possible_cpu(cpu) {
756 struct cpu *c = &per_cpu(cpu_devices, cpu);
757
758 register_cpu(c, cpu);
759 }
760
Bryan Wu1394f032007-05-06 14:50:22 -0700761 return 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700762}
763
764subsys_initcall(topology_init);
765
Mike Frysinger52a07812007-06-11 15:31:30 +0800766static u_long get_vco(void)
Bryan Wu1394f032007-05-06 14:50:22 -0700767{
768 u_long msel;
769 u_long vco;
770
771 msel = (bfin_read_PLL_CTL() >> 9) & 0x3F;
772 if (0 == msel)
773 msel = 64;
774
775 vco = CONFIG_CLKIN_HZ;
776 vco >>= (1 & bfin_read_PLL_CTL()); /* DF bit */
777 vco = msel * vco;
778 return vco;
779}
780
Mike Frysinger2f6cf7bf2007-10-21 22:59:49 +0800781/* Get the Core clock */
Bryan Wu1394f032007-05-06 14:50:22 -0700782u_long get_cclk(void)
783{
784 u_long csel, ssel;
785 if (bfin_read_PLL_STAT() & 0x1)
786 return CONFIG_CLKIN_HZ;
787
788 ssel = bfin_read_PLL_DIV();
789 csel = ((ssel >> 4) & 0x03);
790 ssel &= 0xf;
791 if (ssel && ssel < (1 << csel)) /* SCLK > CCLK */
792 return get_vco() / ssel;
793 return get_vco() >> csel;
794}
Bryan Wu1394f032007-05-06 14:50:22 -0700795EXPORT_SYMBOL(get_cclk);
796
797/* Get the System clock */
798u_long get_sclk(void)
799{
800 u_long ssel;
801
802 if (bfin_read_PLL_STAT() & 0x1)
803 return CONFIG_CLKIN_HZ;
804
805 ssel = (bfin_read_PLL_DIV() & 0xf);
806 if (0 == ssel) {
807 printk(KERN_WARNING "Invalid System Clock\n");
808 ssel = 1;
809 }
810
811 return get_vco() / ssel;
812}
Bryan Wu1394f032007-05-06 14:50:22 -0700813EXPORT_SYMBOL(get_sclk);
814
Mike Frysinger2f6cf7bf2007-10-21 22:59:49 +0800815unsigned long sclk_to_usecs(unsigned long sclk)
816{
Mike Frysinger1754a5d2007-11-23 11:28:11 +0800817 u64 tmp = USEC_PER_SEC * (u64)sclk;
818 do_div(tmp, get_sclk());
819 return tmp;
Mike Frysinger2f6cf7bf2007-10-21 22:59:49 +0800820}
821EXPORT_SYMBOL(sclk_to_usecs);
822
823unsigned long usecs_to_sclk(unsigned long usecs)
824{
Mike Frysinger1754a5d2007-11-23 11:28:11 +0800825 u64 tmp = get_sclk() * (u64)usecs;
826 do_div(tmp, USEC_PER_SEC);
827 return tmp;
Mike Frysinger2f6cf7bf2007-10-21 22:59:49 +0800828}
829EXPORT_SYMBOL(usecs_to_sclk);
830
Bryan Wu1394f032007-05-06 14:50:22 -0700831/*
832 * Get CPU information for use by the procfs.
833 */
834static int show_cpuinfo(struct seq_file *m, void *v)
835{
Mike Frysinger066954a2007-10-21 22:36:06 +0800836 char *cpu, *mmu, *fpu, *vendor, *cache;
Bryan Wu1394f032007-05-06 14:50:22 -0700837 uint32_t revid;
838
839 u_long cclk = 0, sclk = 0;
840 u_int dcache_size = 0, dsup_banks = 0;
841
842 cpu = CPU;
843 mmu = "none";
844 fpu = "none";
845 revid = bfin_revid();
Bryan Wu1394f032007-05-06 14:50:22 -0700846
847 cclk = get_cclk();
848 sclk = get_sclk();
849
Robin Getz73b0c0b2007-10-21 17:03:31 +0800850 switch (bfin_read_CHIPID() & CHIPID_MANUFACTURE) {
Mike Frysinger066954a2007-10-21 22:36:06 +0800851 case 0xca:
852 vendor = "Analog Devices";
Robin Getz73b0c0b2007-10-21 17:03:31 +0800853 break;
854 default:
Mike Frysinger066954a2007-10-21 22:36:06 +0800855 vendor = "unknown";
856 break;
Robin Getz73b0c0b2007-10-21 17:03:31 +0800857 }
Bryan Wu1394f032007-05-06 14:50:22 -0700858
Robin Getz73b0c0b2007-10-21 17:03:31 +0800859 seq_printf(m, "processor\t: %d\n"
860 "vendor_id\t: %s\n"
861 "cpu family\t: 0x%x\n"
862 "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK)\n"
863 "stepping\t: %d\n",
864 0,
865 vendor,
866 (bfin_read_CHIPID() & CHIPID_FAMILY),
867 cpu, cclk/1000000, sclk/1000000,
868 revid);
Bryan Wu1394f032007-05-06 14:50:22 -0700869
Robin Getz73b0c0b2007-10-21 17:03:31 +0800870 seq_printf(m, "cpu MHz\t\t: %lu.%03lu/%lu.%03lu\n",
871 cclk/1000000, cclk%1000000,
872 sclk/1000000, sclk%1000000);
873 seq_printf(m, "bogomips\t: %lu.%02lu\n"
874 "Calibration\t: %lu loops\n",
875 (loops_per_jiffy * HZ) / 500000,
876 ((loops_per_jiffy * HZ) / 5000) % 100,
877 (loops_per_jiffy * HZ));
878
879 /* Check Cache configutation */
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800880 switch (bfin_read_DMEM_CONTROL() & (1 << DMC0_P | 1 << DMC1_P)) {
881 case ACACHE_BSRAM:
Mike Frysinger066954a2007-10-21 22:36:06 +0800882 cache = "dbank-A/B\t: cache/sram";
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800883 dcache_size = 16;
884 dsup_banks = 1;
885 break;
886 case ACACHE_BCACHE:
Mike Frysinger066954a2007-10-21 22:36:06 +0800887 cache = "dbank-A/B\t: cache/cache";
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800888 dcache_size = 32;
889 dsup_banks = 2;
890 break;
891 case ASRAM_BSRAM:
Mike Frysinger066954a2007-10-21 22:36:06 +0800892 cache = "dbank-A/B\t: sram/sram";
Mike Frysinger1f83b8f2007-07-12 22:58:21 +0800893 dcache_size = 0;
894 dsup_banks = 0;
895 break;
896 default:
Mike Frysinger066954a2007-10-21 22:36:06 +0800897 cache = "unknown";
Robin Getz73b0c0b2007-10-21 17:03:31 +0800898 dcache_size = 0;
899 dsup_banks = 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700900 break;
901 }
902
Robin Getz73b0c0b2007-10-21 17:03:31 +0800903 /* Is it turned on? */
904 if (!((bfin_read_DMEM_CONTROL()) & (ENDCPLB | DMC_ENABLE)))
905 dcache_size = 0;
Bryan Wu1394f032007-05-06 14:50:22 -0700906
Robin Getz73b0c0b2007-10-21 17:03:31 +0800907 seq_printf(m, "cache size\t: %d KB(L1 icache) "
908 "%d KB(L1 dcache-%s) %d KB(L2 cache)\n",
909 BFIN_ICACHESIZE / 1024, dcache_size,
910#if defined CONFIG_BFIN_WB
911 "wb"
912#elif defined CONFIG_BFIN_WT
913 "wt"
914#endif
Mike Frysingerda27abb2007-10-22 10:55:35 +0800915 "", 0);
Robin Getz73b0c0b2007-10-21 17:03:31 +0800916
917 seq_printf(m, "%s\n", cache);
918
919 seq_printf(m, "icache setup\t: %d Sub-banks/%d Ways, %d Lines/Way\n",
Robin Getz3bebca22007-10-10 23:55:26 +0800920 BFIN_ISUBBANKS, BFIN_IWAYS, BFIN_ILINES);
Bryan Wu1394f032007-05-06 14:50:22 -0700921 seq_printf(m,
Robin Getz73b0c0b2007-10-21 17:03:31 +0800922 "dcache setup\t: %d Super-banks/%d Sub-banks/%d Ways, %d Lines/Way\n",
Robin Getz3bebca22007-10-10 23:55:26 +0800923 dsup_banks, BFIN_DSUBBANKS, BFIN_DWAYS,
924 BFIN_DLINES);
925#ifdef CONFIG_BFIN_ICACHE_LOCK
Bryan Wu1394f032007-05-06 14:50:22 -0700926 switch (read_iloc()) {
927 case WAY0_L:
928 seq_printf(m, "Way0 Locked-Down\n");
929 break;
930 case WAY1_L:
931 seq_printf(m, "Way1 Locked-Down\n");
932 break;
933 case WAY01_L:
934 seq_printf(m, "Way0,Way1 Locked-Down\n");
935 break;
936 case WAY2_L:
937 seq_printf(m, "Way2 Locked-Down\n");
938 break;
939 case WAY02_L:
940 seq_printf(m, "Way0,Way2 Locked-Down\n");
941 break;
942 case WAY12_L:
943 seq_printf(m, "Way1,Way2 Locked-Down\n");
944 break;
945 case WAY012_L:
946 seq_printf(m, "Way0,Way1 & Way2 Locked-Down\n");
947 break;
948 case WAY3_L:
949 seq_printf(m, "Way3 Locked-Down\n");
950 break;
951 case WAY03_L:
952 seq_printf(m, "Way0,Way3 Locked-Down\n");
953 break;
954 case WAY13_L:
955 seq_printf(m, "Way1,Way3 Locked-Down\n");
956 break;
957 case WAY013_L:
958 seq_printf(m, "Way 0,Way1,Way3 Locked-Down\n");
959 break;
960 case WAY32_L:
961 seq_printf(m, "Way3,Way2 Locked-Down\n");
962 break;
963 case WAY320_L:
964 seq_printf(m, "Way3,Way2,Way0 Locked-Down\n");
965 break;
966 case WAY321_L:
967 seq_printf(m, "Way3,Way2,Way1 Locked-Down\n");
968 break;
969 case WAYALL_L:
970 seq_printf(m, "All Ways are locked\n");
971 break;
972 default:
973 seq_printf(m, "No Ways are locked\n");
974 }
975#endif
Robin Getz73b0c0b2007-10-21 17:03:31 +0800976
Mike Frysinger066954a2007-10-21 22:36:06 +0800977 seq_printf(m, "board name\t: %s\n", bfin_board_name);
Robin Getz73b0c0b2007-10-21 17:03:31 +0800978 seq_printf(m, "board memory\t: %ld kB (0x%p -> 0x%p)\n",
979 physical_mem_end >> 10, (void *)0, (void *)physical_mem_end);
980 seq_printf(m, "kernel memory\t: %d kB (0x%p -> 0x%p)\n",
981 ((int)memory_end - (int)_stext) >> 10,
982 _stext,
983 (void *)memory_end);
984
Bryan Wu1394f032007-05-06 14:50:22 -0700985 return 0;
986}
987
988static void *c_start(struct seq_file *m, loff_t *pos)
989{
990 return *pos < NR_CPUS ? ((void *)0x12345678) : NULL;
991}
992
993static void *c_next(struct seq_file *m, void *v, loff_t *pos)
994{
995 ++*pos;
996 return c_start(m, pos);
997}
998
999static void c_stop(struct seq_file *m, void *v)
1000{
1001}
1002
Jan Engelhardt03a44822008-02-08 04:21:19 -08001003const struct seq_operations cpuinfo_op = {
Bryan Wu1394f032007-05-06 14:50:22 -07001004 .start = c_start,
1005 .next = c_next,
1006 .stop = c_stop,
1007 .show = show_cpuinfo,
1008};
1009
Mike Frysinger5e10b4a2007-06-11 16:44:09 +08001010void __init cmdline_init(const char *r0)
Bryan Wu1394f032007-05-06 14:50:22 -07001011{
1012 if (r0)
Mike Frysinger52a07812007-06-11 15:31:30 +08001013 strncpy(command_line, r0, COMMAND_LINE_SIZE);
Bryan Wu1394f032007-05-06 14:50:22 -07001014}