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 <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/core/dump.c b/drivers/core/dump.c
index 4704049..e73ebea 100644
--- a/drivers/core/dump.c
+++ b/drivers/core/dump.c
@@ -96,3 +96,22 @@
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);
+ }
+}