cmd: bdinfo: Print ethaddr of current MAC
Instead of always printing ethaddr of MAC 0, print eth%daddr of the current MAC. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
d8eb4e2c05
commit
a76315052b
1 changed files with 13 additions and 7 deletions
20
cmd/bdinfo.c
20
cmd/bdinfo.c
|
@ -42,19 +42,25 @@ void bdinfo_print_num_ll(const char *name, unsigned long long value)
|
||||||
printf("%-12s= 0x%.*llx\n", name, 2 * (int)sizeof(ulong), value);
|
printf("%-12s= 0x%.*llx\n", name, 2 * (int)sizeof(ulong), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_eth(int idx)
|
static void print_eth(void)
|
||||||
{
|
{
|
||||||
char name[10], *val;
|
const int idx = eth_get_dev_index();
|
||||||
|
uchar enetaddr[6];
|
||||||
|
char name[10];
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (idx)
|
if (idx)
|
||||||
sprintf(name, "eth%iaddr", idx);
|
sprintf(name, "eth%iaddr", idx);
|
||||||
else
|
else
|
||||||
strcpy(name, "ethaddr");
|
strcpy(name, "ethaddr");
|
||||||
val = env_get(name);
|
|
||||||
if (!val)
|
ret = eth_env_get_enetaddr_by_index("eth", idx, enetaddr);
|
||||||
val = "(not set)";
|
|
||||||
|
|
||||||
printf("current eth = %s\n", eth_get_name());
|
printf("current eth = %s\n", eth_get_name());
|
||||||
printf("%-12s= %s\n", name, val);
|
if (!ret)
|
||||||
|
printf("%-12s= (not set)\n", name);
|
||||||
|
else
|
||||||
|
printf("%-12s= %pM\n", name, enetaddr);
|
||||||
printf("IP addr = %s\n", env_get("ipaddr"));
|
printf("IP addr = %s\n", env_get("ipaddr"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +134,7 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
|
||||||
bdinfo_print_num_l("reloc off", gd->reloc_off);
|
bdinfo_print_num_l("reloc off", gd->reloc_off);
|
||||||
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
|
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
|
||||||
if (IS_ENABLED(CONFIG_CMD_NET))
|
if (IS_ENABLED(CONFIG_CMD_NET))
|
||||||
print_eth(0);
|
print_eth();
|
||||||
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
|
bdinfo_print_num_l("fdt_blob", (ulong)map_to_sysmem(gd->fdt_blob));
|
||||||
bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt));
|
bdinfo_print_num_l("new_fdt", (ulong)map_to_sysmem(gd->new_fdt));
|
||||||
bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size);
|
bdinfo_print_num_l("fdt_size", (ulong)gd->fdt_size);
|
||||||
|
|
Loading…
Reference in a new issue