common_util.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. /*
  2. * (C) Copyright 2001
  3. * Denis Peter, MPL AG Switzerland, d.peter@mpl.ch
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <command.h>
  9. #include <video_fb.h>
  10. #include "common_util.h"
  11. #include <asm/processor.h>
  12. #include <asm/byteorder.h>
  13. #include <i2c.h>
  14. #include <pci.h>
  15. #include <malloc.h>
  16. #include <bzlib.h>
  17. #include <video.h>
  18. #ifdef CONFIG_PIP405
  19. #include "../pip405/pip405.h"
  20. #include <asm/4xx_pci.h>
  21. #endif
  22. #if defined(CONFIG_TARGET_MIP405) || defined(CONFIG_TARGET_MIP405T)
  23. #include "../mip405/mip405.h"
  24. #include <asm/4xx_pci.h>
  25. #endif
  26. DECLARE_GLOBAL_DATA_PTR;
  27. extern int mem_test(ulong start, ulong ramsize, int quiet);
  28. #define I2C_BACKUP_ADDR 0x7C00 /* 0x200 bytes for backup */
  29. #define IMAGE_SIZE CONFIG_SYS_MONITOR_LEN /* ugly, but it works for now */
  30. #if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) \
  31. || defined(CONFIG_TARGET_MIP405T)
  32. /*-----------------------------------------------------------------------
  33. * On PIP/MIP405 we have 3 (4) possible boot mode
  34. *
  35. * - Boot from Flash (Flash CS = CS0, MPS CS = CS1)
  36. * - Boot from MPS (Flash CS = CS1, MPS CS = CS0)
  37. * - Boot from PCI with Flash map (Flash CS = CS0, MPS CS = CS1)
  38. * - Boot from PCI with MPS map (Flash CS = CS1, MPS CS = CS0)
  39. * The flash init is the first board specific routine which is called
  40. * after code relocation (running from SDRAM)
  41. * The first thing we do is to map the Flash CS to the Flash area and
  42. * the MPS CS to the MPS area. Since the flash size is unknown at this
  43. * point, we use the max flash size and the lowest flash address as base.
  44. *
  45. * After flash detection we adjust the size of the CS area accordingly.
  46. * update_flash_size() will fix in wrong values in the flash_info structure,
  47. * misc_init_r() will fix the values in the board info structure
  48. */
  49. int get_boot_mode(void)
  50. {
  51. unsigned long pbcr;
  52. int res = 0;
  53. pbcr = mfdcr(CPC0_PSR);
  54. if ((pbcr & PSR_ROM_WIDTH_MASK) == 0)
  55. /* boot via MPS or MPS mapping */
  56. res = BOOT_MPS;
  57. if (pbcr & PSR_ROM_LOC)
  58. /* boot via PCI.. */
  59. res |= BOOT_PCI;
  60. return res;
  61. }
  62. /* Map the flash high (in boot area)
  63. This code can only be executed from SDRAM (after relocation).
  64. */
  65. void setup_cs_reloc(void)
  66. {
  67. int mode;
  68. /*
  69. * since we are relocated, we can set-up the CS finaly
  70. * but first of all, switch off PCI mapping (in case it
  71. * was a PCI boot)
  72. */
  73. out32r(PMM0MA, 0L);
  74. /* get boot mode */
  75. mode = get_boot_mode();
  76. /*
  77. * we map the flash high in every case
  78. * first find out to which CS the flash is attached to
  79. */
  80. if (mode & BOOT_MPS) {
  81. /* map flash high on CS1 and MPS on CS0 */
  82. mtdcr(EBC0_CFGADDR, PB0AP);
  83. mtdcr(EBC0_CFGDATA, MPS_AP);
  84. mtdcr(EBC0_CFGADDR, PB0CR);
  85. mtdcr(EBC0_CFGDATA, MPS_CR);
  86. /*
  87. * we use the default values (max values) for the flash
  88. * because its real size is not yet known
  89. */
  90. mtdcr(EBC0_CFGADDR, PB1AP);
  91. mtdcr(EBC0_CFGDATA, FLASH_AP);
  92. mtdcr(EBC0_CFGADDR, PB1CR);
  93. mtdcr(EBC0_CFGDATA, FLASH_CR_B);
  94. } else {
  95. /* map flash high on CS0 and MPS on CS1 */
  96. mtdcr(EBC0_CFGADDR, PB1AP);
  97. mtdcr(EBC0_CFGDATA, MPS_AP);
  98. mtdcr(EBC0_CFGADDR, PB1CR);
  99. mtdcr(EBC0_CFGDATA, MPS_CR);
  100. /*
  101. * we use the default values (max values) for the flash
  102. * because its real size is not yet known
  103. */
  104. mtdcr(EBC0_CFGADDR, PB0AP);
  105. mtdcr(EBC0_CFGDATA, FLASH_AP);
  106. mtdcr(EBC0_CFGADDR, PB0CR);
  107. mtdcr(EBC0_CFGDATA, FLASH_CR_B);
  108. }
  109. }
  110. #endif /* #if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) */
  111. #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
  112. /* adjust flash start and protection info */
  113. int update_flash_size(int flash_size)
  114. {
  115. int i = 0, mode;
  116. flash_info_t *info = &flash_info[0];
  117. unsigned long flashcr;
  118. unsigned long flash_base = (0 - flash_size) & 0xFFF00000;
  119. if (flash_size > 128*1024*1024) {
  120. printf("\n ### ERROR, wrong flash size: %X, reset board ###\n",
  121. flash_size);
  122. hang();
  123. }
  124. if ((flash_size >> 20) != 0)
  125. i = __ilog2(flash_size >> 20);
  126. /* set up flash CS according to the size */
  127. mode = get_boot_mode();
  128. if (mode & BOOT_MPS) {
  129. /* flash is on CS1 */
  130. mtdcr(EBC0_CFGADDR, PB1CR);
  131. flashcr = mfdcr(EBC0_CFGDATA);
  132. /* we map the flash high in every case */
  133. flashcr &= 0x0001FFFF; /* mask out address bits */
  134. flashcr |= flash_base; /* start addr */
  135. flashcr |= (i << 17); /* size addr */
  136. mtdcr(EBC0_CFGADDR, PB1CR);
  137. mtdcr(EBC0_CFGDATA, flashcr);
  138. } else {
  139. /* flash is on CS0 */
  140. mtdcr(EBC0_CFGADDR, PB0CR);
  141. flashcr = mfdcr(EBC0_CFGDATA);
  142. /* we map the flash high in every case */
  143. flashcr &= 0x0001FFFF; /* mask out address bits */
  144. flashcr |= flash_base; /* start addr */
  145. flashcr |= (i << 17); /* size addr */
  146. mtdcr(EBC0_CFGADDR, PB0CR);
  147. mtdcr(EBC0_CFGDATA, flashcr);
  148. }
  149. for (i = 0; i < info->sector_count; i++)
  150. /* adjust sector start address */
  151. info->start[i] = flash_base +
  152. (info->start[i] - CONFIG_SYS_FLASH_BASE);
  153. /* unprotect all sectors */
  154. flash_protect(FLAG_PROTECT_CLEAR,
  155. info->start[0],
  156. 0xFFFFFFFF,
  157. info);
  158. flash_protect_default();
  159. /* protect reset vector too*/
  160. flash_protect(FLAG_PROTECT_SET,
  161. info->start[info->sector_count-1],
  162. 0xFFFFFFFF,
  163. info);
  164. return 0;
  165. }
  166. #endif
  167. static int
  168. mpl_prg(uchar *src, ulong size)
  169. {
  170. ulong start;
  171. flash_info_t *info = &flash_info[0];
  172. int i, rc;
  173. #if defined(CONFIG_PIP405) || defined(CONFIG_TARGET_MIP405) || \
  174. defined(CONFIG_TARGET_MIP405T)
  175. char *copystr = (char *)src;
  176. ulong *magic = (ulong *)src;
  177. if (uimage_to_cpu (magic[0]) != IH_MAGIC) {
  178. puts("Bad Magic number\n");
  179. return -1;
  180. }
  181. /* some more checks before we delete the Flash... */
  182. /* Checking the ISO_STRING prevents to program a
  183. * wrong Firmware Image into the flash.
  184. */
  185. i = 4; /* skip Magic number */
  186. while (1) {
  187. if (strncmp(&copystr[i], "MEV-", 4) == 0)
  188. break;
  189. if (i++ >= 0x100) {
  190. puts("Firmware Image for unknown Target\n");
  191. return -1;
  192. }
  193. }
  194. /* we have the ISO STRING, check */
  195. if (strncmp(&copystr[i], CONFIG_ISO_STRING, sizeof(CONFIG_ISO_STRING)-1) != 0) {
  196. printf("Wrong Firmware Image: %s\n", &copystr[i]);
  197. return -1;
  198. }
  199. start = 0 - size;
  200. /* unprotect sectors used by u-boot */
  201. flash_protect(FLAG_PROTECT_CLEAR,
  202. start,
  203. 0xFFFFFFFF,
  204. info);
  205. /* search start sector */
  206. for (i = info->sector_count-1; i > 0; i--)
  207. if (start >= info->start[i])
  208. break;
  209. /* now erase flash */
  210. printf("Erasing at %lx (sector %d) (start %lx)\n",
  211. start,i,info->start[i]);
  212. if ((rc = flash_erase (info, i, info->sector_count-1)) != 0) {
  213. puts("ERROR ");
  214. flash_perror(rc);
  215. return (1);
  216. }
  217. #endif
  218. printf("flash erased, programming from 0x%lx 0x%lx Bytes\n",
  219. (ulong)src, size);
  220. if ((rc = flash_write ((char *)src, start, size)) != 0) {
  221. puts("ERROR ");
  222. flash_perror(rc);
  223. return (1);
  224. }
  225. puts("OK programming done\n");
  226. return 0;
  227. }
  228. static int
  229. mpl_prg_image(uchar *ld_addr)
  230. {
  231. unsigned long len;
  232. uchar *data;
  233. image_header_t *hdr = (image_header_t *)ld_addr;
  234. int rc;
  235. #if defined(CONFIG_FIT)
  236. if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
  237. puts ("Non legacy image format not supported\n");
  238. return -1;
  239. }
  240. #endif
  241. if (!image_check_magic (hdr)) {
  242. puts("Bad Magic Number\n");
  243. return 1;
  244. }
  245. image_print_contents (hdr);
  246. if (!image_check_os (hdr, IH_OS_U_BOOT)) {
  247. puts("No U-Boot Image\n");
  248. return 1;
  249. }
  250. if (!image_check_type (hdr, IH_TYPE_FIRMWARE)) {
  251. puts("No Firmware Image\n");
  252. return 1;
  253. }
  254. if (!image_check_hcrc (hdr)) {
  255. puts("Bad Header Checksum\n");
  256. return 1;
  257. }
  258. puts("Verifying Checksum ... ");
  259. if (!image_check_dcrc (hdr)) {
  260. puts("Bad Data CRC\n");
  261. return 1;
  262. }
  263. puts("OK\n");
  264. data = (uchar *)image_get_data (hdr);
  265. len = image_get_data_size (hdr);
  266. if (image_get_comp (hdr) != IH_COMP_NONE) {
  267. uchar *buf;
  268. /* reserve space for uncompressed image */
  269. if ((buf = malloc(IMAGE_SIZE)) == NULL) {
  270. puts("Insufficient space for decompression\n");
  271. return 1;
  272. }
  273. switch (image_get_comp (hdr)) {
  274. case IH_COMP_GZIP:
  275. puts("Uncompressing (GZIP) ... ");
  276. rc = gunzip ((void *)(buf), IMAGE_SIZE, data, &len);
  277. if (rc != 0) {
  278. puts("GUNZIP ERROR\n");
  279. free(buf);
  280. return 1;
  281. }
  282. puts("OK\n");
  283. break;
  284. #ifdef CONFIG_BZIP2
  285. case IH_COMP_BZIP2:
  286. puts("Uncompressing (BZIP2) ... ");
  287. {
  288. uint retlen = IMAGE_SIZE;
  289. rc = BZ2_bzBuffToBuffDecompress ((char *)(buf), &retlen,
  290. (char *)data, len, 0, 0);
  291. len = retlen;
  292. }
  293. if (rc != BZ_OK) {
  294. printf ("BUNZIP2 ERROR: %d\n", rc);
  295. free(buf);
  296. return 1;
  297. }
  298. puts("OK\n");
  299. break;
  300. #endif
  301. default:
  302. printf ("Unimplemented compression type %d\n",
  303. image_get_comp (hdr));
  304. free(buf);
  305. return 1;
  306. }
  307. rc = mpl_prg(buf, len);
  308. free(buf);
  309. } else {
  310. rc = mpl_prg(data, len);
  311. }
  312. return(rc);
  313. }
  314. void get_backup_values(backup_t *buf)
  315. {
  316. i2c_read(CONFIG_SYS_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)buf,sizeof(backup_t));
  317. }
  318. void set_backup_values(int overwrite)
  319. {
  320. backup_t back;
  321. int i;
  322. get_backup_values(&back);
  323. if(!overwrite) {
  324. if(strncmp(back.signature,"MPL\0",4)==0) {
  325. puts("Not possible to write Backup\n");
  326. return;
  327. }
  328. }
  329. memcpy(back.signature,"MPL\0",4);
  330. i = getenv_f("serial#",back.serial_name,16);
  331. if(i < 0) {
  332. puts("Not possible to write Backup\n");
  333. return;
  334. }
  335. back.serial_name[16]=0;
  336. i = getenv_f("ethaddr",back.eth_addr,20);
  337. if(i < 0) {
  338. puts("Not possible to write Backup\n");
  339. return;
  340. }
  341. back.eth_addr[20]=0;
  342. i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR, I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
  343. }
  344. void clear_env_values(void)
  345. {
  346. backup_t back;
  347. unsigned char env_crc[4];
  348. memset(&back,0xff,sizeof(backup_t));
  349. memset(env_crc,0x00,4);
  350. i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR,I2C_BACKUP_ADDR,2,(void *)&back,sizeof(backup_t));
  351. i2c_write(CONFIG_SYS_DEF_EEPROM_ADDR,CONFIG_ENV_OFFSET,2,(void *)env_crc,4);
  352. }
  353. /*
  354. * check crc of "older" environment
  355. */
  356. int check_env_old_size(ulong oldsize)
  357. {
  358. ulong crc, len, new;
  359. unsigned off;
  360. uchar buf[64];
  361. /* read old CRC */
  362. eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR,
  363. CONFIG_ENV_OFFSET,
  364. (uchar *)&crc, sizeof(ulong));
  365. new = 0;
  366. len = oldsize;
  367. off = sizeof(long);
  368. len = oldsize-off;
  369. while (len > 0) {
  370. int n = (len > sizeof(buf)) ? sizeof(buf) : len;
  371. eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, buf, n);
  372. new = crc32 (new, buf, n);
  373. len -= n;
  374. off += n;
  375. }
  376. return (crc == new);
  377. }
  378. static ulong oldsizes[] = {
  379. 0x200,
  380. 0x800,
  381. 0
  382. };
  383. void copy_old_env(ulong size)
  384. {
  385. uchar name_buf[64];
  386. uchar value_buf[0x800];
  387. uchar c;
  388. ulong len;
  389. unsigned off;
  390. uchar *name, *value;
  391. name = &name_buf[0];
  392. value = &value_buf[0];
  393. len=size;
  394. off = sizeof(long);
  395. while (len > off) {
  396. eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, &c, 1);
  397. if(c != '=') {
  398. *name++=c;
  399. off++;
  400. }
  401. else {
  402. *name++='\0';
  403. off++;
  404. do {
  405. eeprom_read (CONFIG_SYS_DEF_EEPROM_ADDR, CONFIG_ENV_OFFSET+off, &c, 1);
  406. *value++=c;
  407. off++;
  408. if(c == '\0')
  409. break;
  410. } while(len > off);
  411. name = &name_buf[0];
  412. value = &value_buf[0];
  413. if(strncmp((char *)name,"baudrate",8)!=0) {
  414. setenv((char *)name,(char *)value);
  415. }
  416. }
  417. }
  418. }
  419. void check_env(void)
  420. {
  421. char *s;
  422. int i=0;
  423. char buf[32];
  424. backup_t back;
  425. s=getenv("serial#");
  426. if(!s) {
  427. while(oldsizes[i]) {
  428. if(check_env_old_size(oldsizes[i]))
  429. break;
  430. i++;
  431. }
  432. if(!oldsizes[i]) {
  433. /* no old environment has been found */
  434. get_backup_values (&back);
  435. if (strncmp (back.signature, "MPL\0", 4) == 0) {
  436. sprintf (buf, "%s", back.serial_name);
  437. setenv ("serial#", buf);
  438. sprintf (buf, "%s", back.eth_addr);
  439. setenv ("ethaddr", buf);
  440. printf ("INFO: serial# and ethaddr recovered, use saveenv\n");
  441. return;
  442. }
  443. }
  444. else {
  445. copy_old_env(oldsizes[i]);
  446. puts("INFO: old environment ajusted, use saveenv\n");
  447. }
  448. }
  449. else {
  450. /* check if back up is set */
  451. get_backup_values(&back);
  452. if(strncmp(back.signature,"MPL\0",4)!=0) {
  453. set_backup_values(0);
  454. }
  455. }
  456. }
  457. int do_mplcommon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  458. {
  459. ulong ld_addr;
  460. int result;
  461. ulong size = IMAGE_SIZE;
  462. ulong src = MULTI_PURPOSE_SOCKET_ADDR;
  463. backup_t back;
  464. if (strcmp(argv[1], "flash") == 0)
  465. {
  466. #if defined(CONFIG_CMD_FDC)
  467. if (strcmp(argv[2], "floppy") == 0) {
  468. char *local_args[3];
  469. extern int do_fdcboot (cmd_tbl_t *, int, int, char *[]);
  470. puts("\nupdating bootloader image from floppy\n");
  471. local_args[0] = argv[0];
  472. if(argc==4) {
  473. local_args[1] = argv[3];
  474. local_args[2] = NULL;
  475. ld_addr=simple_strtoul(argv[3], NULL, 16);
  476. result=do_fdcboot(cmdtp, 0, 2, local_args);
  477. }
  478. else {
  479. local_args[1] = NULL;
  480. ld_addr=CONFIG_SYS_LOAD_ADDR;
  481. result=do_fdcboot(cmdtp, 0, 1, local_args);
  482. }
  483. result=mpl_prg_image((uchar *)ld_addr);
  484. return result;
  485. }
  486. #endif
  487. if (strcmp(argv[2], "mem") == 0) {
  488. if(argc==4) {
  489. ld_addr=simple_strtoul(argv[3], NULL, 16);
  490. }
  491. else {
  492. ld_addr=load_addr;
  493. }
  494. printf ("\nupdating bootloader image from memory at %lX\n",ld_addr);
  495. result=mpl_prg_image((uchar *)ld_addr);
  496. return result;
  497. }
  498. if (strcmp(argv[2], "mps") == 0) {
  499. puts("\nupdating bootloader image from MPS\n");
  500. result=mpl_prg((uchar *)src,size);
  501. return result;
  502. }
  503. }
  504. if (strcmp(argv[1], "clearenvvalues") == 0)
  505. {
  506. if (strcmp(argv[2], "yes") == 0)
  507. {
  508. clear_env_values();
  509. return 0;
  510. }
  511. }
  512. if (strcmp(argv[1], "getback") == 0) {
  513. get_backup_values(&back);
  514. back.signature[3]=0;
  515. back.serial_name[16]=0;
  516. back.eth_addr[20]=0;
  517. printf("GetBackUp: signature: %s\n",back.signature);
  518. printf(" serial#: %s\n",back.serial_name);
  519. printf(" ethaddr: %s\n",back.eth_addr);
  520. return 0;
  521. }
  522. if (strcmp(argv[1], "setback") == 0) {
  523. set_backup_values(1);
  524. return 0;
  525. }
  526. return cmd_usage(cmdtp);
  527. }
  528. #ifdef CONFIG_VIDEO
  529. /******************************************************
  530. * Routines to display the Board information
  531. * to the screen (since the VGA will be initialized as last,
  532. * we must resend the infos)
  533. */
  534. #ifdef CONFIG_CONSOLE_EXTRA_INFO
  535. extern GraphicDevice ctfb;
  536. extern int get_boot_mode(void);
  537. void video_get_info_str (int line_number, char *info)
  538. {
  539. /* init video info strings for graphic console */
  540. PPC4xx_SYS_INFO sys_info;
  541. char rev;
  542. int i,boot;
  543. unsigned long pvr;
  544. char buf[64];
  545. char buf1[32], buf2[32], buf3[32], buf4[32];
  546. char cpustr[16];
  547. char *s, *e, bc;
  548. switch (line_number)
  549. {
  550. case 2:
  551. /* CPU and board infos */
  552. pvr=get_pvr();
  553. get_sys_info (&sys_info);
  554. switch (pvr) {
  555. case PVR_405GP_RB: rev='B'; break;
  556. case PVR_405GP_RC: rev='C'; break;
  557. case PVR_405GP_RD: rev='D'; break;
  558. case PVR_405GP_RE: rev='E'; break;
  559. case PVR_405GPR_RB: rev='B'; break;
  560. default: rev='?'; break;
  561. }
  562. if(pvr==PVR_405GPR_RB)
  563. sprintf(cpustr,"PPC405GPr %c",rev);
  564. else
  565. sprintf(cpustr,"PPC405GP %c",rev);
  566. /* Board info */
  567. i=0;
  568. s=getenv ("serial#");
  569. #ifdef CONFIG_PIP405
  570. if (!s || strncmp (s, "PIP405", 6)) {
  571. strcpy(buf,"### No HW ID - assuming PIP405");
  572. }
  573. #endif
  574. #if defined(CONFIG_TARGET_MIP405) || defined(CONFIG_TARGET_MIP405T)
  575. if (!s || strncmp (s, "MIP405", 6)) {
  576. strcpy(buf,"### No HW ID - assuming MIP405");
  577. }
  578. #endif
  579. else {
  580. for (e = s; *e; ++e) {
  581. if (*e == ' ')
  582. break;
  583. }
  584. for (; s < e; ++s) {
  585. if (*s == '_') {
  586. ++s;
  587. break;
  588. }
  589. buf[i++] = *s;
  590. }
  591. strcpy(&buf[i]," SN ");
  592. i+=4;
  593. for (; s < e; ++s) {
  594. buf[i++] = *s;
  595. }
  596. buf[i++]=0;
  597. }
  598. sprintf (info," %s %s %s MHz (%s/%s/%s MHz)",
  599. buf, cpustr,
  600. strmhz (buf1, gd->cpu_clk),
  601. strmhz (buf2, sys_info.freqPLB),
  602. strmhz (buf3, sys_info.freqPLB / sys_info.pllOpbDiv),
  603. strmhz (buf4, sys_info.freqPLB / sys_info.pllExtBusDiv));
  604. return;
  605. case 3:
  606. /* Memory Info */
  607. boot = get_boot_mode();
  608. bc = in8 (CONFIG_PORT_ADDR);
  609. sprintf(info, " %luMB RAM, %luMB Flash Cfg 0x%02X %s %s",
  610. gd->bd->bi_memsize / 0x100000,
  611. gd->bd->bi_flashsize / 0x100000,
  612. bc,
  613. (boot & BOOT_MPS) ? "MPS boot" : "Flash boot",
  614. ctfb.modeIdent);
  615. return;
  616. case 1:
  617. strcpy(buf, CONFIG_IDENT_STRING);
  618. sprintf (info, " %s", &buf[1]);
  619. return;
  620. }
  621. /* no more info lines */
  622. *info = 0;
  623. return;
  624. }
  625. #endif /* CONFIG_CONSOLE_EXTRA_INFO */
  626. #endif /* CONFIG_VIDEO */