summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig7
-rw-r--r--cmd/Makefile1
-rw-r--r--cmd/dm.c22
-rw-r--r--cmd/fs.c11
-rw-r--r--cmd/lsblk.c51
-rw-r--r--cmd/part.c27
6 files changed, 116 insertions, 3 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 192b3b262f1..0ead88eff14 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1088,6 +1088,13 @@ config CMD_LOADS
help
Load an S-Record file over serial line
+config CMD_LSBLK
+ depends on BLK
+ bool "lsblk - list block drivers and devices"
+ help
+ Print list of available block device drivers, and for each, the list
+ of known block devices.
+
config CMD_MMC
bool "mmc"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 974ad48b0af..006075a0481 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -84,6 +84,7 @@ obj-$(CONFIG_CMD_LED) += led.o
obj-$(CONFIG_CMD_LICENSE) += license.o
obj-y += load.o
obj-$(CONFIG_CMD_LOG) += log.o
+obj-$(CONFIG_CMD_LSBLK) += lsblk.o
obj-$(CONFIG_ID_EEPROM) += mac.o
obj-$(CONFIG_CMD_MD5SUM) += md5sum.o
obj-$(CONFIG_CMD_MEMORY) += mem.o
diff --git a/cmd/dm.c b/cmd/dm.c
index 4e307ac5245..1dd19fe45b5 100644
--- a/cmd/dm.c
+++ b/cmd/dm.c
@@ -48,11 +48,29 @@ static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc,
return 0;
}
+static int do_dm_dump_driver_compat(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ dm_dump_driver_compat();
+
+ return 0;
+}
+
+static int do_dm_dump_static_driver_info(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ dm_dump_static_driver_info();
+
+ return 0;
+}
+
static struct cmd_tbl test_commands[] = {
U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
U_BOOT_CMD_MKENT(drivers, 1, 1, do_dm_dump_drivers, "", ""),
+ U_BOOT_CMD_MKENT(compat, 1, 1, do_dm_dump_driver_compat, "", ""),
+ U_BOOT_CMD_MKENT(static, 1, 1, do_dm_dump_static_driver_info, "", ""),
};
static __maybe_unused void dm_reloc(void)
@@ -94,5 +112,7 @@ U_BOOT_CMD(
"tree Dump driver model tree ('*' = activated)\n"
"dm uclass Dump list of instances for each uclass\n"
"dm devres Dump list of device resources for each device\n"
- "dm drivers Dump list of drivers and their compatible strings"
+ "dm drivers Dump list of drivers with uclass and instances\n"
+ "dm compat Dump list of drivers with compatibility strings\n"
+ "dm static Dump list of drivers with static platform data"
);
diff --git a/cmd/fs.c b/cmd/fs.c
index 3a0c465c157..5ad11647c2d 100644
--- a/cmd/fs.c
+++ b/cmd/fs.c
@@ -100,3 +100,14 @@ U_BOOT_CMD(
"fstype <interface> <dev>:<part> <varname>\n"
"- set environment variable to filesystem type\n"
);
+
+static int do_fstypes_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ return do_fs_types(cmdtp, flag, argc, argv);
+}
+
+U_BOOT_CMD(
+ fstypes, 1, 1, do_fstypes_wrapper,
+ "List supported filesystem types", ""
+);
diff --git a/cmd/lsblk.c b/cmd/lsblk.c
new file mode 100644
index 00000000000..ece8bbf108c
--- /dev/null
+++ b/cmd/lsblk.c
@@ -0,0 +1,51 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2020
+ * Niel Fourie, DENX Software Engineering, lusus@denx.de.
+ */
+
+#include <common.h>
+#include <dm.h>
+
+static int do_lsblk(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ struct driver *d = ll_entry_start(struct driver, driver);
+ const int n_ents = ll_entry_count(struct driver, driver);
+ struct driver *entry;
+ struct udevice *udev;
+ struct uclass *uc;
+ struct blk_desc *desc;
+ int ret, i;
+
+ ret = uclass_get(UCLASS_BLK, &uc);
+ if (ret) {
+ puts("Could not get BLK uclass.\n");
+ return CMD_RET_FAILURE;
+ }
+ puts("Block Driver Devices\n");
+ puts("-----------------------------\n");
+ for (entry = d; entry < d + n_ents; entry++) {
+ if (entry->id != UCLASS_BLK)
+ continue;
+ i = 0;
+ printf("%-20.20s", entry->name);
+ uclass_foreach_dev(udev, uc) {
+ if (udev->driver != entry)
+ continue;
+ desc = dev_get_uclass_platdata(udev);
+ printf("%c %s %u", i ? ',' : ':',
+ blk_get_if_type_name(desc->if_type),
+ desc->devnum);
+ i++;
+ }
+ if (!i)
+ puts(": <none>");
+ puts("\n");
+ }
+
+ return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(lsblk, 1, 0, do_lsblk, "list block drivers and devices",
+ "- display list of block device drivers and attached block devices"
+);
diff --git a/cmd/part.c b/cmd/part.c
index 216f14bf5d7..3395c17b892 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -182,6 +182,26 @@ static int do_part_number(int argc, char *const argv[])
return do_part_info(argc, argv, CMD_PART_INFO_NUMBER);
}
+static int do_part_types(int argc, char * const argv[])
+{
+ struct part_driver *drv = ll_entry_start(struct part_driver,
+ part_driver);
+ const int n_ents = ll_entry_count(struct part_driver, part_driver);
+ struct part_driver *entry;
+ int i = 0;
+
+ puts("Supported partition tables");
+
+ for (entry = drv; entry != drv + n_ents; entry++) {
+ printf("%c %s", i ? ',' : ':', entry->name);
+ i++;
+ }
+ if (!i)
+ puts(": <none>");
+ puts("\n");
+ return CMD_RET_SUCCESS;
+}
+
static int do_part(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
@@ -198,7 +218,8 @@ static int do_part(struct cmd_tbl *cmdtp, int flag, int argc,
return do_part_size(argc - 2, argv + 2);
else if (!strcmp(argv[1], "number"))
return do_part_number(argc - 2, argv + 2);
-
+ else if (!strcmp(argv[1], "types"))
+ return do_part_types(argc - 2, argv + 2);
return CMD_RET_USAGE;
}
@@ -222,5 +243,7 @@ U_BOOT_CMD(
" part can be either partition number or partition name\n"
"part number <interface> <dev> <part> <varname>\n"
" - set environment variable to the partition number using the partition name\n"
- " part must be specified as partition name"
+ " part must be specified as partition name\n"
+ "part types\n"
+ " - list supported partition table types"
);