From 7195f265b611311cb80747362b5277bf1cdf09e9 Mon Sep 17 00:00:00 2001 From: njl Date: Tue, 5 Oct 2004 02:18:53 +0000 Subject: Add the -s flag to make dumping SSDTs optional (disabled by default). Since we can only override the DSDT, a custom ASL dumped previously that contained SSDTs would result in lots of multiple definition errors. A longer-term fix involves adding the ability to override SSDTs to ACPI-CA. MFC after: 3 days --- usr.sbin/acpi/acpidump/acpi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'usr.sbin/acpi/acpidump/acpi.c') diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index af8ea27..fee5f53 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -719,6 +719,7 @@ sdt_load_devmem(void) return (rsdp); } +/* Write the DSDT to a file, concatenating any SSDTs (if present). */ static int write_dsdt(int fd, struct ACPIsdt *rsdt, struct ACPIsdt *dsdt) { @@ -726,12 +727,13 @@ write_dsdt(int fd, struct ACPIsdt *rsdt, struct ACPIsdt *dsdt) struct ACPIsdt *ssdt; uint8_t sum; + /* Create a new checksum to account for the DSDT and any SSDTs. */ sdt = *dsdt; if (rsdt != NULL) { sdt.check = 0; sum = acpi_checksum(dsdt->body, dsdt->len - SIZEOF_SDT_HDR); ssdt = sdt_from_rsdt(rsdt, "SSDT", NULL); - while (ssdt != NULL) { + while (sflag && ssdt != NULL) { sdt.len += ssdt->len - SIZEOF_SDT_HDR; sum += acpi_checksum(ssdt->body, ssdt->len - SIZEOF_SDT_HDR); @@ -740,9 +742,13 @@ write_dsdt(int fd, struct ACPIsdt *rsdt, struct ACPIsdt *dsdt) sum += acpi_checksum(&sdt, SIZEOF_SDT_HDR); sdt.check -= sum; } + + /* Write out the DSDT header and body. */ write(fd, &sdt, SIZEOF_SDT_HDR); write(fd, dsdt->body, dsdt->len - SIZEOF_SDT_HDR); - if (rsdt != NULL) { + + /* Write out any SSDTs (if present and the user requested this.) */ + if (sflag && rsdt != NULL) { ssdt = sdt_from_rsdt(rsdt, "SSDT", NULL); while (ssdt != NULL) { write(fd, ssdt->body, ssdt->len - SIZEOF_SDT_HDR); -- cgit v1.1