setup.c 32 KB

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