Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jul 2002 20:24:28 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 14568 for review
Message-ID:  <200207210324.g6L3OSMW068369@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=14568

Change 14568 by peter@peter_ia64 on 2002/07/20 20:24:16

	drop in a hack that I was using to give an explicit address to
	the dump routines.  The itanium2 system does not provide the usual
	pointers in a place where this can find.

Affected files ...

.. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi_user.c#2 edit
.. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpidump.c#3 edit

Differences ...

==== //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi_user.c#2 (text+ko) ====

@@ -52,8 +52,8 @@
 
 LIST_HEAD(acpi_user_mapping_list, acpi_user_mapping) maplist;
 
-static void
-acpi_user_init()
+void
+acpi_user_init(void)
 {
 
 	if (acpi_mem_fd == -1) {

==== //depot/projects/ia64/usr.sbin/acpi/acpidump/acpidump.c#3 (text+ko) ====

@@ -36,6 +36,8 @@
 
 #include "acpidump.h"
 
+u_int64_t xaddr;
+
 static void
 asl_dump_from_file(char *file)
 {
@@ -47,21 +49,62 @@
 	acpi_dump_dsdt(dp, end);
 }
 
+void
+hd(void *buf, int len)
+{
+	unsigned char *p;
+	int n, i;
+
+	p = buf;
+	for (n = 0; n < len; n += 16) {
+		for (i = n; i < n + 16; i++) {
+			if ((i % 16) == 0) {	/* beginning of line */
+				printf("0x%04x ", i);
+			}
+			if ((i % 2) == 0) {
+				printf(" ");
+			}
+			if (i < len)
+				printf("%02x", p[i]);
+			else
+				printf("  ");
+		}
+		printf("        ");	/* Why does \t come out as '?' ? */
+		for (i = n; i < n + 16; i++) {
+			if (i >= len)
+				break;
+			if (p[i] >= ' ' && p[i] <= '~')
+				printf("%c", p[i]);
+			else
+				printf(".");
+		}
+		printf("\n");
+	}
+}
+
 static void
 asl_dump_from_devmem()
 {
 	struct	ACPIrsdp *rp;
 	struct	ACPIsdt *rsdp;
 
+if (xaddr == 0) {
 	rp = acpi_find_rsd_ptr();
 	if (!rp)
 		errx(1, "Can't find ACPI information\n");
 
 	acpi_print_rsd_ptr(rp);
 	rsdp = (struct ACPIsdt *) acpi_map_sdt(rp->addr);
-	if (memcmp(rsdp->signature, "RSDT", 4) ||
-	    acpi_checksum(rsdp, rsdp->len))
-		errx(1, "RSDT is corrupted\n");
+} else {
+	acpi_user_init();
+	rsdp = (struct ACPIsdt *) acpi_map_sdt(xaddr);
+}
+	if (memcmp(rsdp->signature, "RSDT", 4)) {
+hd(rsdp, 256);
+		errx(1, "RSDT is not a RSDT\n");
+	}
+	if (acpi_checksum(rsdp, rsdp->len))
+		errx(1, "RSDT checksum corrupted\n");
 
 	acpi_handle_rsdt(rsdp);
 }
@@ -82,7 +125,7 @@
 	char	c, *progname;
 
 	progname = argv[0];
-	while ((c = getopt(argc, argv, "f:o:hr")) != -1) {
+	while ((c = getopt(argc, argv, "f:o:hrx:")) != -1) {
 		switch (c) {
 		case 'f':
 			asl_dump_from_file(optarg);
@@ -96,6 +139,10 @@
 		case 'r':
 			rflag++;
 			break;
+		case 'x':
+			xaddr = strtol(optarg, 0, 0);
+			printf("xaddr = %p\n", xaddr);
+			break;
 		default:
 			argc -= optind;
 			argv += optind;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200207210324.g6L3OSMW068369>