aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakanori Watanabe <takawata@FreeBSD.org>2023-06-22 10:08:21 +0000
committerTakanori Watanabe <takawata@FreeBSD.org>2024-10-02 06:36:41 +0000
commitf5a04b16b1895b331d6b54534321a8395fc2d5de (patch)
tree06e579434fe91b5aec4f49ad5e8e1e07528c2c00
parentd9d2e3ab7cf2b60ac5afe0d1a0a14d5bc39d7061 (diff)
downloadsrc-f5a04b16b1895b331d6b54534321a8395fc2d5de.tar.gz
src-f5a04b16b1895b331d6b54534321a8395fc2d5de.zip
acpidump: add 's' option to parse dsdt and ssdt's separately. In some machine, they may not be parsed if they are concatinated into one image.
Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D46796
-rw-r--r--usr.sbin/acpi/acpidump/acpi.c16
-rw-r--r--usr.sbin/acpi/acpidump/acpidump.814
-rw-r--r--usr.sbin/acpi/acpidump/acpidump.c11
-rw-r--r--usr.sbin/acpi/acpidump/acpidump.h1
4 files changed, 39 insertions, 3 deletions
diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index af0068649fbb..fe68b5062351 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -2644,6 +2644,22 @@ aml_disassemble(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
}
void
+aml_disassemble_separate(ACPI_TABLE_HEADER *rsdt, ACPI_TABLE_HEADER *dsdp)
+{
+ ACPI_TABLE_HEADER *ssdt = NULL;
+
+ aml_disassemble(NULL, dsdp);
+ if (rsdt != NULL) {
+ for (;;) {
+ ssdt = sdt_from_rsdt(rsdt, "SSDT", ssdt);
+ if (ssdt == NULL)
+ break;
+ aml_disassemble(NULL, ssdt);
+ }
+ }
+}
+
+void
sdt_print_all(ACPI_TABLE_HEADER *rsdp)
{
acpi_handle_rsdt(rsdp);
diff --git a/usr.sbin/acpi/acpidump/acpidump.8 b/usr.sbin/acpi/acpidump/acpidump.8
index dc8f724ea738..f193b9a3511a 100644
--- a/usr.sbin/acpi/acpidump/acpidump.8
+++ b/usr.sbin/acpi/acpidump/acpidump.8
@@ -133,13 +133,25 @@ The following options are supported by
.Nm :
.Bl -tag -width indent
.It Fl d
-Disassemble the DSDT into ASL using
+Concatenate the DSDT and the SSDT's into single image and disassemble the image into ASL using
.Xr iasl 8
and print the results to stdout.
.It Fl t
Dump the contents of the various fixed tables listed above.
.It Fl h
Displays usage and exit.
+.It Fl s
+Disassemble each of the DSDT and the SSDT's into ASL using
+.Xr iasl 8
+and print the results to stdout.
+This will avoid
+.Xr iasl 8
+error on disassembling concatenated image.
+If both
+.Fl d
+and
+.Fl s
+are specified, the last option is effective.
.It Fl v
Enable verbose messages.
.It Fl f Ar dsdt_input
diff --git a/usr.sbin/acpi/acpidump/acpidump.c b/usr.sbin/acpi/acpidump/acpidump.c
index 23978aca010b..0fad7e68ef47 100644
--- a/usr.sbin/acpi/acpidump/acpidump.c
+++ b/usr.sbin/acpi/acpidump/acpidump.c
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
if (argc < 2)
usage(progname);
- while ((c = getopt(argc, argv, "dhtvf:o:")) != -1) {
+ while ((c = getopt(argc, argv, "dhtvsf:o:")) != -1) {
switch (c) {
case 'd':
dflag = 1;
@@ -82,6 +82,9 @@ main(int argc, char *argv[])
case 'o':
dsdt_output_file = optarg;
break;
+ case 's':
+ dflag = 2;
+ break;
case 'h':
default:
usage(progname);
@@ -136,7 +139,11 @@ main(int argc, char *argv[])
if (dflag) {
if (vflag)
warnx("disassembling DSDT, iasl messages follow");
- aml_disassemble(rsdt, sdt);
+ if (dflag == 1) {
+ aml_disassemble(rsdt, sdt);
+ } else {
+ aml_disassemble_separate(rsdt, sdt);
+ }
if (vflag)
warnx("iasl processing complete");
}
diff --git a/usr.sbin/acpi/acpidump/acpidump.h b/usr.sbin/acpi/acpidump/acpidump.h
index 80f86a748d76..872facbad59d 100644
--- a/usr.sbin/acpi/acpidump/acpidump.h
+++ b/usr.sbin/acpi/acpidump/acpidump.h
@@ -144,6 +144,7 @@ void sdt_print_all(ACPI_TABLE_HEADER *);
/* Disassemble the AML in the DSDT */
void aml_disassemble(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
+void aml_disassemble_separate(ACPI_TABLE_HEADER *, ACPI_TABLE_HEADER *);
/* Routines for accessing tables in physical memory */
ACPI_TABLE_RSDP *acpi_find_rsd_ptr(void);