1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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
This commit is contained in:
Nate Lawson 2004-10-05 02:18:53 +00:00
parent 842ba60ee2
commit 62c7bde198
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=136128
3 changed files with 16 additions and 5 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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;