1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2015 Google, Inc
11 #include <dm/uclass-internal.h>
13 static void show_devices(struct udevice *dev, int depth, int last_flag)
16 struct udevice *child;
18 /* print the first 20 characters to not break the tree-format. */
19 printf(" %-10.10s %3d [ %c ] %-20.20s ", dev->uclass->uc_drv->name,
20 dev_get_uclass_index(dev, NULL),
21 dev->flags & DM_FLAG_ACTIVATED ? '+' : ' ', dev->driver->name);
23 for (i = depth; i >= 0; i--) {
24 is_last = (last_flag >> i) & 1;
38 printf("%s\n", dev->name);
40 list_for_each_entry(child, &dev->child_head, sibling_node) {
41 is_last = list_is_last(&child->sibling_node, &dev->child_head);
42 show_devices(child, depth + 1, (last_flag << 1) | is_last);
46 void dm_dump_all(void)
52 printf(" Class Index Probed Driver Name\n");
53 printf("-----------------------------------------------------------\n");
54 show_devices(root, -1, 0);
59 * dm_display_line() - Display information about a single device
61 * Displays a single line of information with an option prefix
63 * @dev: Device to display
65 static void dm_display_line(struct udevice *dev, int index)
67 printf("%-3i %c %s @ %08lx", index,
68 dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
69 dev->name, (ulong)map_to_sysmem(dev));
70 if (dev->seq != -1 || dev->req_seq != -1)
71 printf(", seq %d, (req %d)", dev->seq, dev->req_seq);
75 void dm_dump_uclass(void)
81 for (id = 0; id < UCLASS_COUNT; id++) {
85 ret = uclass_get(id, &uc);
89 printf("uclass %d: %s\n", id, uc->uc_drv->name);
90 if (list_empty(&uc->dev_head))
92 uclass_foreach_dev(dev, uc) {
93 dm_display_line(dev, i);