[PATCH 2/4] cmd/acpi: add optional index parameter to acpi dump
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Tue Apr 21 00:08:02 CEST 2026
Add an optional index parameter defaulting to the `acpi dump`
sub-command.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
cmd/acpi.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/cmd/acpi.c b/cmd/acpi.c
index a88cd995460..3aba9ed7a16 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -12,6 +12,7 @@
#include <asm/acpi_table.h>
#include <asm/global_data.h>
#include <linux/errno.h>
+#include <limits.h>
#include <dm/acpi.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -51,11 +52,11 @@ static void dump_hdr(struct acpi_table_header *hdr, bool chksums)
}
}
-static int dump_table_name(const char *sig)
+static int dump_table_name(const char *sig, ulong idx)
{
struct acpi_table_header *hdr;
- hdr = acpi_find_table(sig, 0);
+ hdr = acpi_find_table(sig, idx);
if (!hdr)
return -ENOENT;
printf("%.*s @ %16lx\n", ACPI_NAME_LEN, hdr->signature,
@@ -183,9 +184,11 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
{
const char *name;
char sig[ACPI_NAME_LEN];
+ char *endp;
+ ulong idx = 0;
int ret;
- if (argc < 2)
+ if (argc < 2 || argc > 3)
return CMD_RET_USAGE;
name = argv[1];
@@ -193,8 +196,12 @@ static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Table name '%s' must be four characters\n", name);
return CMD_RET_FAILURE;
}
+
+ if (argc >= 3)
+ idx = hextoul(argv[2], &endp);
+
str_to_upper(name, sig, ACPI_NAME_LEN);
- ret = dump_table_name(sig);
+ ret = dump_table_name(sig, idx);
if (ret) {
printf("Table '%.*s' not found\n", ACPI_NAME_LEN, sig);
return CMD_RET_FAILURE;
@@ -207,10 +214,10 @@ U_BOOT_LONGHELP(acpi,
"list [-c] - list ACPI tables [check checksums]\n"
"acpi items [-d] - List/dump each piece of ACPI data from devices\n"
"acpi set [<addr>] - Set or show address of ACPI tables\n"
- "acpi dump <name> - Dump ACPI table");
+ "acpi dump <name> [<index>] - Dump ACPI table instance");
U_BOOT_CMD_WITH_SUBCMDS(acpi, "ACPI tables", acpi_help_text,
U_BOOT_SUBCMD_MKENT(list, 2, 1, do_acpi_list),
U_BOOT_SUBCMD_MKENT(items, 2, 1, do_acpi_items),
U_BOOT_SUBCMD_MKENT(set, 2, 1, do_acpi_set),
- U_BOOT_SUBCMD_MKENT(dump, 2, 1, do_acpi_dump));
+ U_BOOT_SUBCMD_MKENT(dump, 3, 1, do_acpi_dump));
--
2.53.0
More information about the U-Boot
mailing list