diff options
author | Jean-Jacques Hiblot | 2018-08-09 16:17:43 +0200 |
---|---|---|
committer | Marek Vasut | 2018-08-21 16:21:37 +0200 |
commit | 999b204383ffb4eee1467604a935ed3a670c460e (patch) | |
tree | 0a4faf00e9082f3348b4b6f243fc7c1bf48f536d /drivers/core | |
parent | e7c865620e569df493e67d3772673108fce62064 (diff) |
dm: print the index of the device when dumping the dm tree
Command "dm tree" dumps the devices with class, driver, name information.
Add the index of the device in the class too, because the information is
useful for the bind/unbind commands.
Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/dump.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 58820cdb2f4..d7cdb1475d7 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -8,6 +8,7 @@ #include <mapmem.h> #include <dm/root.h> #include <dm/util.h> +#include <dm/uclass-internal.h> static void show_devices(struct udevice *dev, int depth, int last_flag) { @@ -15,7 +16,8 @@ static void show_devices(struct udevice *dev, int depth, int last_flag) struct udevice *child; /* print the first 11 characters to not break the tree-format. */ - printf(" %-10.10s [ %c ] %-10.10s ", dev->uclass->uc_drv->name, + printf(" %-10.10s %d [ %c ] %-10.10s ", dev->uclass->uc_drv->name, + dev_get_uclass_index(dev, NULL), dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name); for (i = depth; i >= 0; i--) { @@ -47,8 +49,8 @@ void dm_dump_all(void) root = dm_root(); if (root) { - printf(" Class Probed Driver Name\n"); - printf("----------------------------------------\n"); + printf(" Class index Probed Driver Name\n"); + printf("-----------------------------------------\n"); show_devices(root, -1, 0); } } @@ -60,9 +62,9 @@ void dm_dump_all(void) * * @dev: Device to display */ -static void dm_display_line(struct udevice *dev) +static void dm_display_line(struct udevice *dev, int index) { - printf("- %c %s @ %08lx", + printf("%i %c %s @ %08lx", index, dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ', dev->name, (ulong)map_to_sysmem(dev)); if (dev->seq != -1 || dev->req_seq != -1) @@ -78,6 +80,7 @@ void dm_dump_uclass(void) for (id = 0; id < UCLASS_COUNT; id++) { struct udevice *dev; + int i = 0; ret = uclass_get(id, &uc); if (ret) @@ -87,7 +90,8 @@ void dm_dump_uclass(void) if (list_empty(&uc->dev_head)) continue; list_for_each_entry(dev, &uc->dev_head, uclass_node) { - dm_display_line(dev); + dm_display_line(dev, i); + i++; } puts("\n"); } |