cmd_bdinfo.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. * (C) Copyright 2003
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /*
  24. * Boot support
  25. */
  26. #include <common.h>
  27. #include <command.h>
  28. #include <net.h> /* for print_IPaddr */
  29. #if (CONFIG_COMMANDS & CFG_CMD_BDI)
  30. static void print_num(const char *, ulong);
  31. #ifndef CONFIG_ARM /* PowerPC and other */
  32. #ifdef CONFIG_PPC
  33. static void print_str(const char *, const char *);
  34. int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  35. {
  36. DECLARE_GLOBAL_DATA_PTR;
  37. int i;
  38. bd_t *bd = gd->bd;
  39. char buf[32];
  40. #ifdef DEBUG
  41. print_num ("bd address", (ulong)bd );
  42. #endif
  43. print_num ("memstart", bd->bi_memstart );
  44. print_num ("memsize", bd->bi_memsize );
  45. print_num ("flashstart", bd->bi_flashstart );
  46. print_num ("flashsize", bd->bi_flashsize );
  47. print_num ("flashoffset", bd->bi_flashoffset );
  48. print_num ("sramstart", bd->bi_sramstart );
  49. print_num ("sramsize", bd->bi_sramsize );
  50. #if defined(CONFIG_5xx) || defined(CONFIG_8xx) || \
  51. defined(CONFIG_8260) || defined(CONFIG_E500)
  52. print_num ("immr_base", bd->bi_immr_base );
  53. #endif
  54. print_num ("bootflags", bd->bi_bootflags );
  55. #if defined(CONFIG_405GP) || defined(CONFIG_405CR) || \
  56. defined(CONFIG_405EP) || defined(CONFIG_XILINX_ML300)
  57. print_str ("procfreq", strmhz(buf, bd->bi_procfreq));
  58. print_str ("plb_busfreq", strmhz(buf, bd->bi_plb_busfreq));
  59. #if defined(CONFIG_405GP) || defined(CONFIG_405EP) || defined(CONFIG_XILINX_ML300)
  60. print_str ("pci_busfreq", strmhz(buf, bd->bi_pci_busfreq));
  61. #endif
  62. #else /* ! CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_ML300 */
  63. #if defined(CONFIG_8260) || defined(CONFIG_MPC8560)
  64. print_str ("vco", strmhz(buf, bd->bi_vco));
  65. print_str ("sccfreq", strmhz(buf, bd->bi_sccfreq));
  66. print_str ("brgfreq", strmhz(buf, bd->bi_brgfreq));
  67. #endif
  68. print_str ("intfreq", strmhz(buf, bd->bi_intfreq));
  69. #if defined(CONFIG_8260) || defined(CONFIG_MPC8560)
  70. print_str ("cpmfreq", strmhz(buf, bd->bi_cpmfreq));
  71. #endif
  72. print_str ("busfreq", strmhz(buf, bd->bi_busfreq));
  73. #endif /* CONFIG_405GP, CONFIG_405CR, CONFIG_405EP, CONFIG_XILINX_ML300 */
  74. puts ("ethaddr =");
  75. for (i=0; i<6; ++i) {
  76. printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
  77. }
  78. #if (defined CONFIG_PN62) || (defined CONFIG_PPCHAMELEONEVB) || \
  79. (defined CONFIG_MPC8540ADS) || (defined CONFIG_MPC8560ADS) || \
  80. (defined CONFIG_MPC8555CDS)
  81. puts ("\neth1addr =");
  82. for (i=0; i<6; ++i) {
  83. printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]);
  84. }
  85. #endif /* CONFIG_PN62 */
  86. #if defined(CONFIG_MPC8540ADS) || defined(CONFIG_MPC8560ADS) || defined(CONFIG_MPC8555CDS)
  87. puts ("\neth2addr =");
  88. for (i=0; i<6; ++i) {
  89. printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]);
  90. }
  91. #endif
  92. #ifdef CONFIG_HERMES
  93. print_str ("ethspeed", strmhz(buf, bd->bi_ethspeed));
  94. #endif
  95. puts ("\nIP addr = "); print_IPaddr (bd->bi_ip_addr);
  96. printf ("\nbaudrate = %6ld bps\n", bd->bi_baudrate );
  97. return 0;
  98. }
  99. #elif defined(CONFIG_NIOS) /* NIOS*/
  100. int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  101. {
  102. DECLARE_GLOBAL_DATA_PTR;
  103. int i;
  104. bd_t *bd = gd->bd;
  105. print_num ("memstart", (ulong)bd->bi_memstart);
  106. print_num ("memsize", (ulong)bd->bi_memsize);
  107. print_num ("flashstart", (ulong)bd->bi_flashstart);
  108. print_num ("flashsize", (ulong)bd->bi_flashsize);
  109. print_num ("flashoffset", (ulong)bd->bi_flashoffset);
  110. puts ("ethaddr =");
  111. for (i=0; i<6; ++i) {
  112. printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
  113. }
  114. puts ("\nip_addr = ");
  115. print_IPaddr (bd->bi_ip_addr);
  116. printf ("\nbaudrate = %ld bps\n", bd->bi_baudrate);
  117. return 0;
  118. }
  119. #else /* ! PPC, which leaves MIPS */
  120. int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  121. {
  122. DECLARE_GLOBAL_DATA_PTR;
  123. int i;
  124. bd_t *bd = gd->bd;
  125. print_num ("boot_params", (ulong)bd->bi_boot_params);
  126. print_num ("memstart", (ulong)bd->bi_memstart);
  127. print_num ("memsize", (ulong)bd->bi_memsize);
  128. print_num ("flashstart", (ulong)bd->bi_flashstart);
  129. print_num ("flashsize", (ulong)bd->bi_flashsize);
  130. print_num ("flashoffset", (ulong)bd->bi_flashoffset);
  131. puts ("ethaddr =");
  132. for (i=0; i<6; ++i) {
  133. printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
  134. }
  135. puts ("\nip_addr = ");
  136. print_IPaddr (bd->bi_ip_addr);
  137. printf ("\nbaudrate = %d bps\n", bd->bi_baudrate);
  138. return 0;
  139. }
  140. #endif /* MIPS */
  141. #else /* ARM */
  142. int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  143. {
  144. DECLARE_GLOBAL_DATA_PTR;
  145. int i;
  146. bd_t *bd = gd->bd;
  147. print_num ("arch_number", bd->bi_arch_number);
  148. print_num ("env_t", (ulong)bd->bi_env);
  149. print_num ("boot_params", (ulong)bd->bi_boot_params);
  150. for (i=0; i<CONFIG_NR_DRAM_BANKS; ++i) {
  151. print_num("DRAM bank", i);
  152. print_num("-> start", bd->bi_dram[i].start);
  153. print_num("-> size", bd->bi_dram[i].size);
  154. }
  155. puts ("ethaddr =");
  156. for (i=0; i<6; ++i) {
  157. printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
  158. }
  159. puts ( "\n"
  160. "ip_addr = ");
  161. print_IPaddr (bd->bi_ip_addr);
  162. printf ("\n"
  163. "baudrate = %d bps\n", bd->bi_baudrate);
  164. return 0;
  165. }
  166. #endif /* CONFIG_ARM XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
  167. static void print_num(const char *name, ulong value)
  168. {
  169. printf ("%-12s= 0x%08lX\n", name, value);
  170. }
  171. #ifdef CONFIG_PPC
  172. static void print_str(const char *name, const char *str)
  173. {
  174. printf ("%-12s= %6s MHz\n", name, str);
  175. }
  176. #endif /* CONFIG_PPC */
  177. /* -------------------------------------------------------------------- */
  178. U_BOOT_CMD(
  179. bdinfo, 1, 1, do_bdinfo,
  180. "bdinfo - print Board Info structure\n",
  181. NULL
  182. );
  183. #endif /* CFG_CMD_BDI */