summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2004-10-05 02:18:53 +0000
committernjl <njl@FreeBSD.org>2004-10-05 02:18:53 +0000
commit7195f265b611311cb80747362b5277bf1cdf09e9 (patch)
treedc6e4a0b343daea3209a7955830989770594001d
parenta8b1fd9efbf31e6a704f5f931cf33e9a689d5aac (diff)
downloadFreeBSD-src-7195f265b611311cb80747362b5277bf1cdf09e9.zip
FreeBSD-src-7195f265b611311cb80747362b5277bf1cdf09e9.tar.gz
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
-rw-r--r--usr.sbin/acpi/acpidump/acpi.c10
-rw-r--r--usr.sbin/acpi/acpidump/acpidump.c10
-rw-r--r--usr.sbin/acpi/acpidump/acpidump.h1
3 files changed, 16 insertions, 5 deletions
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);
diff --git a/usr.sbin/acpi/acpidump/acpidump.c b/usr.sbin/acpi/acpidump/acpidump.c
index b9b8b0a..0ebb5d0 100644
--- a/usr.sbin/acpi/acpidump/acpidump.c
+++ b/usr.sbin/acpi/acpidump/acpidump.c
@@ -37,6 +37,7 @@
#include "acpidump.h"
int dflag; /* Disassemble AML using iasl(8) */
+int sflag; /* Include secondary (SSDT) tables. */
int tflag; /* Dump contents of SDT tables */
int vflag; /* Use verbose messages */
@@ -44,7 +45,7 @@ static void
usage(const char *progname)
{
- fprintf(stderr, "usage: %s [-d] [-t] [-h] [-v] [-f dsdt_input] "
+ fprintf(stderr, "usage: %s [-d] [-s] [-t] [-h] [-v] [-f dsdt_input] "
"[-o dsdt_output]\n", progname);
exit(1);
}
@@ -62,11 +63,14 @@ main(int argc, char *argv[])
if (argc < 2)
usage(progname);
- while ((c = getopt(argc, argv, "dhtvf:o:")) != -1) {
+ while ((c = getopt(argc, argv, "dhstvf:o:")) != -1) {
switch (c) {
case 'd':
dflag = 1;
break;
+ case 's':
+ sflag = 1;
+ break;
case 't':
tflag = 1;
break;
@@ -122,7 +126,7 @@ main(int argc, char *argv[])
rsdt = NULL;
}
- /* Dump the DSDT to a file */
+ /* Dump the DSDT and SSDTs to a file */
if (dsdt_output_file != NULL) {
if (vflag)
warnx("saving DSDT file: %s", dsdt_output_file);
diff --git a/usr.sbin/acpi/acpidump/acpidump.h b/usr.sbin/acpi/acpidump/acpidump.h
index ca56398..b6f0a63 100644
--- a/usr.sbin/acpi/acpidump/acpidump.h
+++ b/usr.sbin/acpi/acpidump/acpidump.h
@@ -332,6 +332,7 @@ int acpi_checksum(void *, size_t);
/* Command line flags */
extern int dflag;
+extern int sflag;
extern int tflag;
extern int vflag;
OpenPOWER on IntegriCloud