summaryrefslogtreecommitdiff
path: root/usr.sbin/acpidump
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2007-02-22 19:09:27 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2007-02-22 19:09:27 +0000
commit7b957b62ebc65d4f300af06463bb68b56cf3e597 (patch)
tree5115f69e1cab801641fb61cd31f8f87069fd5aea /usr.sbin/acpidump
parent90f87489f35b6526225602784c2ff8a7361ff4ad (diff)
Added changes to dump all tables not just DSDT
-o generates files of form <prefix>.<sig>.<num> eg. -o foo generates foo.DSDT.1 foo.FACP.0 foo.MCFG.2 etc ok marco@
Diffstat (limited to 'usr.sbin/acpidump')
-rw-r--r--usr.sbin/acpidump/acpi.c6
-rw-r--r--usr.sbin/acpidump/aml_dump.c20
2 files changed, 17 insertions, 9 deletions
diff --git a/usr.sbin/acpidump/acpi.c b/usr.sbin/acpidump/acpi.c
index d350444372a..390c649c21f 100644
--- a/usr.sbin/acpidump/acpi.c
+++ b/usr.sbin/acpidump/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.3 2005/07/21 16:38:55 fgsch Exp $ */
+/* $OpenBSD: acpi.c,v 1.4 2007/02/22 19:09:26 jordan Exp $ */
/*-
* Copyright (c) 1998 Doug Rabson
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: acpi.c,v 1.3 2005/07/21 16:38:55 fgsch Exp $
+ * $Id: acpi.c,v 1.4 2007/02/22 19:09:26 jordan Exp $
* $FreeBSD: src/usr.sbin/acpi/acpidump/acpi.c,v 1.3 2000/11/08 02:37:00 iwasaki Exp $
*/
#include <sys/types.h>
@@ -343,12 +343,14 @@ acpi_handle_rsdt(struct ACPIsdt *rsdp)
int entries;
struct ACPIsdt *sdp;
+ aml_dump(rsdp);
entries = (rsdp->len - SIZEOF_SDT_HDR) / sizeof(u_int32_t);
acpi_print_rsdt(rsdp);
for (i = 0; i < entries; i++) {
sdp = (struct ACPIsdt *) acpi_map_sdt(rsdp->body[i]);
if (acpi_checksum(sdp, sdp->len))
errx(1, "RSDT entry %d is corrupt", i);
+ aml_dump(sdp);
if (!memcmp(sdp->signature, "FACP", 4)) {
acpi_handle_facp((struct FACPbody *) sdp->body);
} else {
diff --git a/usr.sbin/acpidump/aml_dump.c b/usr.sbin/acpidump/aml_dump.c
index 11acc4858e1..b18e957261d 100644
--- a/usr.sbin/acpidump/aml_dump.c
+++ b/usr.sbin/acpidump/aml_dump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aml_dump.c,v 1.1 2005/06/02 20:09:39 tholo Exp $ */
+/* $OpenBSD: aml_dump.c,v 1.2 2007/02/22 19:09:26 jordan Exp $ */
/*-
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* All rights reserved.
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: aml_dump.c,v 1.1 2005/06/02 20:09:39 tholo Exp $
+ * $Id: aml_dump.c,v 1.2 2007/02/22 19:09:26 jordan Exp $
* $FreeBSD: src/usr.sbin/acpi/acpidump/aml_dump.c,v 1.3 2000/11/08 02:37:00 iwasaki Exp $
*/
@@ -40,8 +40,10 @@
char *aml_dumpfile = NULL;
void
-aml_dump(struct ACPIsdt *dsdp)
+aml_dump(struct ACPIsdt *hdr)
{
+ static int hdr_index;
+ char name[128];
int fd;
mode_t mode;
@@ -49,13 +51,17 @@ aml_dump(struct ACPIsdt *dsdp)
return;
}
+ snprintf(name, sizeof(name), "%s.%c%c%c%c.%d",
+ aml_dumpfile, hdr->signature[0], hdr->signature[1],
+ hdr->signature[2], hdr->signature[3],
+ hdr_index++);
+
mode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
- fd = open(aml_dumpfile, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd == -1) {
return;
}
- write(fd, dsdp, SIZEOF_SDT_HDR);
- write(fd, dsdp->body, dsdp->len - SIZEOF_SDT_HDR);
+ write(fd, hdr, SIZEOF_SDT_HDR);
+ write(fd, hdr->body, hdr->len - SIZEOF_SDT_HDR);
close(fd);
}
-