acpi: Add an acpi command to list/dump generated ACPI items

Add a command that shows the individual blocks of data generated by each
device, effectively splitting the full table into its component parts.
This can be helpful for debugging.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c
index 076fb4f..b566f4f 100644
--- a/drivers/core/acpi.c
+++ b/drivers/core/acpi.c
@@ -119,6 +119,22 @@
 	return 0;
 }
 
+void acpi_dump_items(enum acpi_dump_option option)
+{
+	int i;
+
+	for (i = 0; i < item_count; i++) {
+		struct acpi_item *item = &acpi_item[i];
+
+		printf("dev '%s', type %d, size %x\n", item->dev->name,
+		       item->type, item->size);
+		if (option == ACPI_DUMP_CONTENTS) {
+			print_buffer(0, item->buf, 1, item->size, 0);
+			printf("\n");
+		}
+	}
+}
+
 static struct acpi_item *find_acpi_item(const char *devname)
 {
 	int i;