static void print_num(const char *, ulong);
+static void print_eth(int idx);
+
#ifndef CONFIG_ARM /* PowerPC and other */
static void print_lnum(const char *, u64);
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- int i;
bd_t *bd = gd->bd;
char buf[32];
print_str ("pevfreq", strmhz(buf, bd->bi_pevfreq));
#endif
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
-
+ print_eth(0);
#if defined(CONFIG_HAS_ETH1)
- puts ("\neth1addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]);
- }
+ print_eth(1);
#endif
-
#if defined(CONFIG_HAS_ETH2)
- puts ("\neth2addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]);
- }
+ print_eth(2);
#endif
-
#if defined(CONFIG_HAS_ETH3)
- puts ("\neth3addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet3addr[i]);
- }
+ print_eth(3);
#endif
-
#if defined(CONFIG_HAS_ETH4)
- puts ("\neth4addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet4addr[i]);
- }
+ print_eth(4);
#endif
-
#if defined(CONFIG_HAS_ETH5)
- puts ("\neth5addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet5addr[i]);
- }
+ print_eth(5);
#endif
#ifdef CONFIG_HERMES
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- int i;
bd_t *bd = gd->bd;
print_num ("memstart", (ulong)bd->bi_memstart);
print_num ("flashsize", (ulong)bd->bi_flashsize);
print_num ("flashoffset", (ulong)bd->bi_flashoffset);
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
+ print_eth(0);
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
printf ("baudrate = %ld bps\n", bd->bi_baudrate);
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
-#if defined(CONFIG_CMD_NET)
- int i;
-#endif
bd_t *bd = gd->bd;
print_num ("mem start", (ulong)bd->bi_memstart);
#endif
#if defined(CONFIG_CMD_NET)
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
+ print_eth(0);
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
#endif
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- int i;
bd_t *bd = gd->bd;
print_num ("mem start ", (ulong)bd->bi_memstart);
print_lnum ("mem size ", (u64)bd->bi_memsize);
print_num ("sram size ", (ulong)bd->bi_sramsize);
#endif
#if defined(CONFIG_CMD_NET)
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
+ print_eth(0);
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
#endif
printf ("baudrate = %ld bps\n", (ulong)bd->bi_baudrate);
int do_bdinfo(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
{
bd_t *bd = gd->bd;
-#if defined(CONFIG_CMD_NET)
- int i;
-#endif
#ifdef DEBUG
print_num("bd address ", (ulong) bd);
CONFIG_SYS_GBL_DATA_SIZE);
#if defined(CONFIG_CMD_NET)
- puts("ethaddr =");
- for (i = 0; i < 6; ++i) {
- printf("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
+ print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
#endif
printf("baudrate = %6ld bps\n", bd->bi_baudrate);
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- int i;
bd_t *bd = gd->bd;
char buf[32];
print_str ("vcofreq", strmhz(buf, bd->bi_vcofreq));
#endif
#if defined(CONFIG_CMD_NET)
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
-
+ print_eth(0);
#if defined(CONFIG_HAS_ETH1)
- puts ("\neth1addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet1addr[i]);
- }
+ print_eth(1);
#endif
-
#if defined(CONFIG_HAS_ETH2)
- puts ("\neth2addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet2addr[i]);
- }
+ print_eth(2);
#endif
-
#if defined(CONFIG_HAS_ETH3)
- puts ("\neth3addr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enet3addr[i]);
- }
+ print_eth(3);
#endif
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- int i;
bd_t *bd = gd->bd;
char buf[32];
print_num("flashsize", (ulong)bd->bi_flashsize);
print_num("flashoffset", (ulong)bd->bi_flashoffset);
- puts("ethaddr =");
- for (i = 0; i < 6; ++i)
- printf("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
+ print_eth(0);
printf("ip_addr = %pI4\n", &bd->bi_ip_addr);
printf("baudrate = %d bps\n", bd->bi_baudrate);
int do_bdinfo ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
- int i;
bd_t *bd = gd->bd;
print_num ("boot_params", (ulong)bd->bi_boot_params);
print_num ("flashsize", (ulong)bd->bi_flashsize);
print_num ("flashoffset", (ulong)bd->bi_flashoffset);
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
+ print_eth(0);
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
printf ("baudrate = %d bps\n", bd->bi_baudrate);
}
#if defined(CONFIG_CMD_NET)
- puts ("ethaddr =");
- for (i=0; i<6; ++i) {
- printf ("%c%02X", i ? ':' : ' ', bd->bi_enetaddr[i]);
- }
- puts ( "\n" );
+ print_eth(0);
printf ("ip_addr = %pI4\n", &bd->bi_ip_addr);
#endif
printf ("baudrate = %d bps\n", bd->bi_baudrate);
printf ("%-12s= 0x%08lX\n", name, value);
}
+static void print_eth(int idx)
+{
+ char name[10], *val;
+ if (idx)
+ sprintf(name, "eth%iaddr", idx);
+ else
+ strcpy(name, "ethaddr");
+ val = getenv(name);
+ if (!val)
+ val = "(not set)";
+ printf("%-12s= %s\n", name, val);
+}
+
#ifndef CONFIG_ARM
static void print_lnum(const char *name, u64 value)
{