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 dump bytes for tables that acpid...
details: https://anonhg.NetBSD.org/src/rev/c2abd2195574
branches: trunk
changeset: 762170:c2abd2195574
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Feb 17 02:55:16 2011 +0000
description:
dump bytes for tables that acpidump doesn't decode, and print them
as characters instead of hex if '-c' flag is provided
diffstat:
usr.sbin/acpitools/acpidump/acpi.c | 32 ++++++++++++++++++++++++++++++--
usr.sbin/acpitools/acpidump/acpidump.c | 12 ++++++++----
usr.sbin/acpitools/acpidump/acpidump.h | 3 ++-
3 files changed, 40 insertions(+), 7 deletions(-)
diffs (131 lines):
diff -r c8b7e0569f60 -r c2abd2195574 usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c Wed Feb 16 23:51:50 2011 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c Thu Feb 17 02:55:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.6 2010/12/19 16:25:16 jruoho Exp $ */
+/* $NetBSD: acpi.c,v 1.7 2011/02/17 02:55:16 jmcneill Exp $ */
/*-
* Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.6 2010/12/19 16:25:16 jruoho Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.7 2011/02/17 02:55:16 jmcneill Exp $");
#include <sys/param.h>
#include <sys/endian.h>
@@ -103,6 +103,7 @@
static void acpi_handle_wdat(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_wdrt(ACPI_TABLE_HEADER *sdp);
static void acpi_print_sdt(ACPI_TABLE_HEADER *sdp);
+static void acpi_dump_bytes(ACPI_TABLE_HEADER *sdp);
static void acpi_print_fadt(ACPI_TABLE_HEADER *sdp);
static void acpi_print_facs(ACPI_TABLE_FACS *facs);
static void acpi_print_dsdt(ACPI_TABLE_HEADER *dsdp);
@@ -1896,6 +1897,32 @@
}
static void
+acpi_dump_bytes(ACPI_TABLE_HEADER *sdp)
+{
+ unsigned int i;
+ uint8_t *p;
+
+ p = (uint8_t *)sdp + sizeof(*sdp);
+ printf("\n\tData={");
+ for (i = 0; i < sdp->Length; i++) {
+ if (cflag) {
+ if (i % 64 == 0)
+ printf("\n\t ");
+ else if (i % 16 == 0)
+ printf(" ");
+ printf("%c", (p[i] >= ' ' && p[i] <= '~') ? p[i] : '.');
+ } else {
+ if (i % 16 == 0)
+ printf("\n\t\t");
+ else if (i % 8 == 0)
+ printf(" ");
+ printf(" %02x", p[i]);
+ }
+ }
+ printf("\n\t}\n");
+}
+
+static void
acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp)
{
ACPI_TABLE_RSDT *rsdt;
@@ -2241,6 +2268,7 @@
else {
printf(BEGIN_COMMENT);
acpi_print_sdt(sdp);
+ acpi_dump_bytes(sdp);
printf(END_COMMENT);
}
}
diff -r c8b7e0569f60 -r c2abd2195574 usr.sbin/acpitools/acpidump/acpidump.c
--- a/usr.sbin/acpitools/acpidump/acpidump.c Wed Feb 16 23:51:50 2011 +0000
+++ b/usr.sbin/acpitools/acpidump/acpidump.c Thu Feb 17 02:55:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpidump.c,v 1.2 2009/12/22 08:44:03 cegger Exp $ */
+/* $NetBSD: acpidump.c,v 1.3 2011/02/17 02:55:16 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.2 2009/12/22 08:44:03 cegger Exp $");
+__RCSID("$NetBSD: acpidump.c,v 1.3 2011/02/17 02:55:16 jmcneill Exp $");
#include <sys/param.h>
@@ -45,13 +45,14 @@
int dflag; /* Disassemble AML using iasl(8) */
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 [-d] [-t] [-h] [-v] [-f dsdt_input] "
+ fprintf(stderr, "usage: %s [-c] [-d] [-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);
@@ -70,8 +71,11 @@
if (argc < 2)
usage();
- while ((c = getopt(argc, argv, "dhtvf:o:")) != -1) {
+ while ((c = getopt(argc, argv, "cdhtvf:o:")) != -1) {
switch (c) {
+ case 'c':
+ cflag = 1;
+ break;
case 'd':
dflag = 1;
break;
diff -r c8b7e0569f60 -r c2abd2195574 usr.sbin/acpitools/acpidump/acpidump.h
--- a/usr.sbin/acpitools/acpidump/acpidump.h Wed Feb 16 23:51:50 2011 +0000
+++ b/usr.sbin/acpitools/acpidump/acpidump.h Thu Feb 17 02:55:16 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpidump.h,v 1.2 2009/12/22 08:44:03 cegger Exp $ */
+/* $NetBSD: acpidump.h,v 1.3 2011/02/17 02:55:16 jmcneill Exp $ */
/*-
* Copyright (c) 1999 Doug Rabson
@@ -81,6 +81,7 @@
int acpi_checksum(void *, size_t);
/* Command line flags */
+extern int cflag;
extern int dflag;
extern int tflag;
extern int vflag;
Home |
Main Index |
Thread Index |
Old Index