Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/acpitools/acpidump - when dumping table bytes, make...



details:   https://anonhg.NetBSD.org/src/rev/0fc84b62cdbf
branches:  trunk
changeset: 762185:0fc84b62cdbf
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Feb 17 10:18:05 2011 +0000

description:
- when dumping table bytes, make sure to dump our header and not the next one
- also dump tables with bad checksums, unless the -s flag is specified

diffstat:

 usr.sbin/acpitools/acpidump/acpi.c     |  15 +++++++++------
 usr.sbin/acpitools/acpidump/acpidump.c |  14 +++++++++-----
 usr.sbin/acpitools/acpidump/acpidump.h |   3 ++-
 3 files changed, 20 insertions(+), 12 deletions(-)

diffs (119 lines):

diff -r 364309bd8c44 -r 0fc84b62cdbf usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c        Thu Feb 17 10:13:35 2011 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c        Thu Feb 17 10:18:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.7 2011/02/17 02:55:16 jmcneill Exp $ */
+/* $NetBSD: acpi.c,v 1.8 2011/02/17 10:18:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.7 2011/02/17 02:55:16 jmcneill Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.8 2011/02/17 10:18:05 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/endian.h>
@@ -1884,9 +1884,11 @@
 {
        printf("  ");
        acpi_print_string(sdp->Signature, ACPI_NAME_SIZE);
-       printf(": Length=%d, Revision=%d, Checksum=%d,\n",
+       printf(": Length=%d, Revision=%d, Checksum=%d",
               sdp->Length, sdp->Revision, sdp->Checksum);
-       printf("\tOEMID=");
+       if (acpi_checksum(sdp, sdp->Length))
+               printf(" (Incorrect)");
+       printf(",\n\tOEMID=");
        acpi_print_string(sdp->OemId, ACPI_OEM_ID_SIZE);
        printf(", OEM Table ID=");
        acpi_print_string(sdp->OemTableId, ACPI_OEM_TABLE_ID_SIZE);
@@ -1902,7 +1904,7 @@
        unsigned int i;
        uint8_t *p;
 
-       p = (uint8_t *)sdp + sizeof(*sdp);
+       p = (uint8_t *)sdp;
        printf("\n\tData={");
        for (i = 0; i < sdp->Length; i++) {
                if (cflag) {
@@ -2221,7 +2223,8 @@
                if (acpi_checksum(sdp, sdp->Length)) {
                        warnx("RSDT entry %d (sig %.4s) is corrupt", i,
                            sdp->Signature);
-                       continue;
+                       if (sflag)
+                               continue;
                }
                if (!memcmp(sdp->Signature, ACPI_SIG_FADT, 4))
                        acpi_handle_fadt(sdp);
diff -r 364309bd8c44 -r 0fc84b62cdbf usr.sbin/acpitools/acpidump/acpidump.c
--- a/usr.sbin/acpitools/acpidump/acpidump.c    Thu Feb 17 10:13:35 2011 +0000
+++ b/usr.sbin/acpitools/acpidump/acpidump.c    Thu Feb 17 10:18:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpidump.c,v 1.3 2011/02/17 02:55:16 jmcneill Exp $ */
+/* $NetBSD: acpidump.c,v 1.4 2011/02/17 10:18:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki%FreeBSD.org@localhost>
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: acpidump.c,v 1.3 2011/02/17 02:55:16 jmcneill Exp $");
+__RCSID("$NetBSD: acpidump.c,v 1.4 2011/02/17 10:18:05 jmcneill Exp $");
 
 
 #include <sys/param.h>
@@ -42,18 +42,19 @@
 
 #include "acpidump.h"
 
+int    cflag;  /* Dump unknown table data as characters */
 int    dflag;  /* Disassemble AML using iasl(8) */
+int    sflag;  /* Skip tables with bad checksums */
 int    tflag;  /* Dump contents of SDT tables */
 int    vflag;  /* Use verbose messages */
-int    cflag;  /* Dump unknown table data as characters */
 
 static void
 usage(void)
 {
        const char *progname = getprogname();
 
-       fprintf(stderr, "usage: %s [-c] [-d] [-t] [-h] [-v] [-f dsdt_input] "
-                       "[-o dsdt_output]\n", progname);
+       fprintf(stderr, "usage: %s [-c] [-d] [-s] [-t] [-h] [-v] "
+                       "[-f dsdt_input] [-o dsdt_output]\n", progname);
        fprintf(stderr, "To send ASL:\n\t%s -dt | gzip -c9 > foo.asl.gz\n",
            progname);
        exit(EXIT_FAILURE);
@@ -79,6 +80,9 @@
                case 'd':
                        dflag = 1;
                        break;
+               case 's':
+                       sflag = 1;
+                       break;
                case 't':
                        tflag = 1;
                        break;
diff -r 364309bd8c44 -r 0fc84b62cdbf usr.sbin/acpitools/acpidump/acpidump.h
--- a/usr.sbin/acpitools/acpidump/acpidump.h    Thu Feb 17 10:13:35 2011 +0000
+++ b/usr.sbin/acpitools/acpidump/acpidump.h    Thu Feb 17 10:18:05 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpidump.h,v 1.3 2011/02/17 02:55:16 jmcneill Exp $ */
+/* $NetBSD: acpidump.h,v 1.4 2011/02/17 10:18:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1999 Doug Rabson
@@ -83,6 +83,7 @@
 /* Command line flags */
 extern int     cflag;
 extern int     dflag;
+extern int     sflag;
 extern int     tflag;
 extern int     vflag;
 



Home | Main Index | Thread Index | Old Index