From owner-p4-projects Tue Dec 3 14:38:18 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 94D4137B404; Tue, 3 Dec 2002 14:38:14 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0EC1137B401 for ; Tue, 3 Dec 2002 14:38:14 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9B24543EC2 for ; Tue, 3 Dec 2002 14:38:13 -0800 (PST) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gB3MY2mV082878 for ; Tue, 3 Dec 2002 14:34:02 -0800 (PST) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gB3MY1di082875 for perforce@freebsd.org; Tue, 3 Dec 2002 14:34:01 -0800 (PST) Date: Tue, 3 Dec 2002 14:34:01 -0800 (PST) Message-Id: <200212032234.gB3MY1di082875@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 21882 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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