From 7b9d60fc1ff67b3959a7db394084b27268a7686d Mon Sep 17 00:00:00 2001 From: Sean Anderson Date: Fri, 17 Jan 2020 14:48:09 -0500 Subject: cmd: Add command to dump drivers and compatible strings This adds a subcommand to dm to dump out what drivers are installed, and their compatible strings. I have found this useful in ensuring that I have the correct drivers compiled, and that I have put in the correct compatible strings. Signed-off-by Sean Anderson Reviewed-by: Simon Glass --- drivers/core/dump.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drivers/core') diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 4704049aee..e73ebeabcc 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -96,3 +96,22 @@ void dm_dump_uclass(void) puts("\n"); } } + +void dm_dump_drivers(void) +{ + struct driver *d = ll_entry_start(struct driver, driver); + const int n_ents = ll_entry_count(struct driver, driver); + struct driver *entry; + const struct udevice_id *match; + + puts("Driver Compatible\n"); + puts("--------------------------------\n"); + for (entry = d; entry < d + n_ents; entry++) { + for (match = entry->of_match; match->compatible; match++) + printf("%-20.20s %s\n", + match == entry->of_match ? entry->name : "", + match->compatible); + if (match == entry->of_match) + printf("%-20.20s\n", entry->name); + } +} -- cgit v1.2.3