summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/bdinfo.c33
-rw-r--r--cmd/bootflow.c27
-rw-r--r--cmd/ide.c22
-rw-r--r--cmd/tpm_test.c1
4 files changed, 57 insertions, 26 deletions
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index f709904c516..365357ca545 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -11,6 +11,7 @@
#include <dm.h>
#include <env.h>
#include <lmb.h>
+#include <mapmem.h>
#include <net.h>
#include <video.h>
#include <vsprintf.h>
@@ -41,17 +42,26 @@ void bdinfo_print_num_ll(const char *name, unsigned long long 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)
sprintf(name, "eth%iaddr", idx);
else
strcpy(name, "ethaddr");
- val = env_get(name);
- if (!val)
- val = "(not set)";
- printf("%-12s= %s\n", name, val);
+
+ ret = eth_env_get_enetaddr_by_index("eth", idx, enetaddr);
+
+ printf("current eth = %s\n", eth_get_name());
+ if (!ret)
+ printf("%-12s= (not set)\n", name);
+ else
+ printf("%-12s= %pM\n", name, enetaddr);
+ printf("IP addr = %s\n", env_get("ipaddr"));
}
void bdinfo_print_mhz(const char *name, unsigned long hz)
@@ -123,13 +133,10 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
bdinfo_print_num_l("relocaddr", gd->relocaddr);
bdinfo_print_num_l("reloc off", gd->reloc_off);
printf("%-12s= %u-bit\n", "Build", (uint)sizeof(void *) * 8);
- if (IS_ENABLED(CONFIG_CMD_NET)) {
- printf("current eth = %s\n", eth_get_name());
- print_eth(0);
- printf("IP addr = %s\n", env_get("ipaddr"));
- }
- bdinfo_print_num_l("fdt_blob", (ulong)gd->fdt_blob);
- bdinfo_print_num_l("new_fdt", (ulong)gd->new_fdt);
+ if (IS_ENABLED(CONFIG_CMD_NET))
+ print_eth();
+ 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("fdt_size", (ulong)gd->fdt_size);
if (IS_ENABLED(CONFIG_VIDEO))
show_video_info();
diff --git a/cmd/bootflow.c b/cmd/bootflow.c
index 42f6e14a437..cfe34226989 100644
--- a/cmd/bootflow.c
+++ b/cmd/bootflow.c
@@ -181,6 +181,9 @@ static int do_bootflow_scan(struct cmd_tbl *cmdtp, int flag, int argc,
if (list)
show_footer(i, num_valid);
+ if (IS_ENABLED(CONFIG_CMD_BOOTFLOW_FULL) && !num_valid && !list)
+ printf("No bootflows found; try again with -l\n");
+
return 0;
}
@@ -387,6 +390,11 @@ static int do_bootflow_menu(struct cmd_tbl *cmdtp, int flag, int argc,
bool text_mode = false;
int ret;
+ if (!IS_ENABLED(CONFIG_EXPO)) {
+ printf("Menu not supported\n");
+ return CMD_RET_FAILURE;
+ }
+
if (argc > 1 && *argv[1] == '-')
text_mode = strchr(argv[1], 't');
@@ -394,20 +402,15 @@ static int do_bootflow_menu(struct cmd_tbl *cmdtp, int flag, int argc,
if (ret)
return CMD_RET_FAILURE;
- if (IS_ENABLED(CONFIG_EXPO)) {
- ret = bootflow_menu_run(std, text_mode, &bflow);
- if (ret) {
- if (ret == -EAGAIN)
- printf("Nothing chosen\n");
- else
- printf("Menu failed (err=%d)\n", ret);
+ ret = bootflow_menu_run(std, text_mode, &bflow);
+ if (ret) {
+ if (ret == -EAGAIN)
+ printf("Nothing chosen\n");
+ else {
+ printf("Menu failed (err=%d)\n", ret);
+ return CMD_RET_FAILURE;
}
- } else {
- printf("Menu not supported\n");
- ret = -ENOSYS;
}
- if (ret)
- return CMD_RET_FAILURE;
printf("Selected: %s\n", bflow->os_name ? bflow->os_name : bflow->name);
std->cur_bootflow = bflow;
diff --git a/cmd/ide.c b/cmd/ide.c
index 6739f0b12d1..ddc87d3a0bb 100644
--- a/cmd/ide.c
+++ b/cmd/ide.c
@@ -10,12 +10,15 @@
#include <common.h>
#include <blk.h>
+#include <dm.h>
#include <config.h>
#include <watchdog.h>
#include <command.h>
#include <image.h>
#include <asm/byteorder.h>
#include <asm/io.h>
+#include <dm/device-internal.h>
+#include <dm/uclass-internal.h>
#include <ide.h>
#include <ata.h>
@@ -31,8 +34,25 @@ int do_ide(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
if (argc == 2) {
if (strncmp(argv[1], "res", 3) == 0) {
+ struct udevice *dev;
+ int ret;
+
puts("\nReset IDE: ");
- ide_init();
+ ret = uclass_find_first_device(UCLASS_IDE, &dev);
+ ret = device_remove(dev, DM_REMOVE_NORMAL);
+ if (!ret)
+ ret = device_chld_unbind(dev, NULL);
+ if (ret) {
+ printf("Cannot remove IDE (err=%dE)\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
+ ret = uclass_first_device_err(UCLASS_IDE, &dev);
+ if (ret) {
+ printf("Init failed (err=%dE)\n", ret);
+ return CMD_RET_FAILURE;
+ }
+
return 0;
}
}
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c
index b35eae81dc3..c4ed8e59012 100644
--- a/cmd/tpm_test.c
+++ b/cmd/tpm_test.c
@@ -471,6 +471,7 @@ static int test_write_limit(struct udevice *dev)
break;
case TPM_MAXNVWRITES:
assert(i >= TPM_MAX_NV_WRITES_NOOWNER);
+ break;
default:
pr_err("\tunexpected error code %d (0x%x)\n",
result, result);