setup.c 32 KB

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