Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Dec 2002 14:34:01 -0800 (PST)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 21882 for review
Message-ID:  <200212032234.gB3MY1di082875@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=21882

Change 21882 by peter@peter_itanic2 on 2002/12/03 14:33:45

	fix the code that allows you to specify the RSD address as disclosed by dmesg.

Affected files ...

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

Differences ...

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

@@ -149,7 +149,7 @@
 
 	/* 1st stage: parse only w/o printing */
 	init_namespace();
-	aml_new_name_group((int)dp);
+	aml_new_name_group((uintptr_t)dp);
 	bzero(&asl_env, sizeof(asl_env));
 
 	asl_env.dp = dp;

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

@@ -96,17 +96,28 @@
  */
 
 struct ACPIrsdp *
-acpi_find_rsd_ptr()
+acpi_find_rsd_ptr(long hint)
 {
-	int		i;
+	long		i;
 	u_int8_t	buf[sizeof(struct ACPIrsdp)];
 
 	acpi_user_init();
+	pread(acpi_mem_fd, buf, 16, hint);
+	if (!memcmp(buf, "RSD PTR ", 8)) {
+		/* Read the rest of the structure */
+		pread(acpi_mem_fd, buf + 16, sizeof(struct ACPIrsdp) - 16, hint + 16);
+
+		/* Verify checksum before accepting it. */
+		if (acpi_checksum(buf, sizeof(struct ACPIrsdp)))
+			goto notrsd;
+		return (acpi_map_physical(hint, sizeof(struct ACPIrsdp)));
+	}
+notrsd:
 	for (i = 0; i < 1024 * 1024; i += 16) {
-		read(acpi_mem_fd, buf, 16);
+		pread(acpi_mem_fd, buf, 16, i);
 		if (!memcmp(buf, "RSD PTR ", 8)) {
 			/* Read the rest of the structure */
-			read(acpi_mem_fd, buf + 16, sizeof(struct ACPIrsdp) - 16);
+			pread(acpi_mem_fd, buf + 16, sizeof(struct ACPIrsdp) - 16, i + 16);
 
 			/* Verify checksum before accepting it. */
 			if (acpi_checksum(buf, sizeof(struct ACPIrsdp)))

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

@@ -36,7 +36,7 @@
 
 #include "acpidump.h"
 
-u_int64_t xaddr;
+long xaddr;
 
 static void
 asl_dump_from_file(char *file)
@@ -88,17 +88,12 @@
 	struct	ACPIrsdp *rp;
 	struct	ACPIsdt *rsdp;
 
-if (xaddr == 0) {
-	rp = acpi_find_rsd_ptr();
+	rp = acpi_find_rsd_ptr(xaddr);
 	if (!rp)
 		errx(1, "Can't find ACPI information\n");
 
 	acpi_print_rsd_ptr(rp);
 	rsdp = (struct ACPIsdt *) acpi_map_sdt(rp->addr);
-} 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");
@@ -141,7 +136,7 @@
 			break;
 		case 'x':
 			xaddr = strtol(optarg, 0, 0);
-			printf("xaddr = %p\n", xaddr);
+			printf("xaddr = 0x%lx\n", xaddr);
 			break;
 		default:
 			argc -= optind;

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

@@ -157,7 +157,7 @@
 } __packed;
 
 void		*acpi_map_physical(vm_offset_t, size_t);
-struct ACPIrsdp	*acpi_find_rsd_ptr(void);
+struct ACPIrsdp	*acpi_find_rsd_ptr(long);
 int		 acpi_checksum(void *, size_t);
 struct ACPIsdt	*acpi_map_sdt(vm_offset_t);
 void		 acpi_print_rsd_ptr(struct ACPIrsdp *);

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?200212032234.gB3MY1di082875>