Date: Tue, 3 Dec 2002 22:07:39 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 21897 for review Message-ID: <200212040607.gB467dlf011494@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=21897 Change 21897 by marcel@marcel_nfs on 2002/12/03 22:07:04 Step 1 in making acpidump work on the HP box. For ACPI 2.0, the RSDT is actually a XSDT, which is the same as a RSDT except that the entries are 64-bit instead of 32-bit. Update struct ACPIrsdp to add the address of the xsdt. As per the spec, we use the XSDT if present otherwise we use the RSDT. Deal with the differences in acpi_handle_rsdt(), where we handle both. I renamed rsdt to sdt where it makes sense, but long exposure to ACPI tends to annihilate ones sensibility :-) The FACP parsing is not called from acpi_handle_sdt, as it's currently only good for unclean reboots. That's step 2... Affected files ... .. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi.c#3 edit .. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpidump.c#5 edit .. //depot/projects/ia64/usr.sbin/acpi/acpidump/acpidump.h#5 edit Differences ... ==== //depot/projects/ia64/usr.sbin/acpi/acpidump/acpi.c#3 (text+ko) ==== @@ -192,24 +192,6 @@ } void -acpi_print_rsdt(struct ACPIsdt *rsdp) -{ - int i, entries; - - acpi_print_sdt(rsdp); - entries = (rsdp->len - SIZEOF_SDT_HDR) / sizeof(u_int32_t); - printf(BEGIN_COMMENT); - printf("\tEntries={ "); - for (i = 0; i < entries; i++) { - if (i > 0) - printf(", "); - printf("0x%08x", rsdp->body[i]); - } - printf(" }\n"); - printf(END_COMMENT); -} - -void acpi_print_facp(struct FACPbody *facp) { char sep; @@ -327,28 +309,55 @@ printf(BEGIN_COMMENT); printf("RSD PTR: Checksum=%d, OEMID=", rp->sum); acpi_print_string(rp->oem, 6); - printf(", RsdtAddress=0x%08x\n", rp->addr); + printf(", RsdtAddress=0x%08x, XsdtAddress=0x%016x\n", rp->rsdt, + rp->xsdt); printf(END_COMMENT); } void -acpi_handle_rsdt(struct ACPIsdt *rsdp) +acpi_handle_sdt(struct ACPIsdt *sdp) { - int i; - int entries; - struct ACPIsdt *sdp; + struct ACPIsdt *sdp_child; + char *p, *end; + + acpi_print_sdt(sdp); + printf(BEGIN_COMMENT); + printf("\tEntries={ "); + p = (void*)sdp->body; + end = p + (sdp->len - SIZEOF_SDT_HDR); + while (p < end) { + if (p != (void*)sdp->body) + printf(", "); + if (sdp->signature[0] == 'X') { + printf("0x%016x", *((u_int64_t*)p)); + p += sizeof(u_int64_t); + } else { + printf("0x%08x", *((u_int32_t*)p)); + p += sizeof(u_int32_t); + } + } + printf(" }\n"); + printf(END_COMMENT); - 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\n", i); - if (!memcmp(sdp->signature, "FACP", 4)) { - acpi_handle_facp((struct FACPbody *) sdp->body); + p = (void*)sdp->body; + while (p < end) { + if (sdp->signature[0] == 'X') { + sdp_child = acpi_map_sdt(*((u_int64_t*)p)); + p += sizeof(u_int64_t); } else { - acpi_print_sdt(sdp); + sdp_child = acpi_map_sdt(*((u_int32_t*)p)); + p += sizeof(u_int32_t); } + + if (acpi_checksum(sdp_child, sdp_child->len)) + errx(1, "SDT at %p is corrupt\n", sdp_child); + if (!memcmp(sdp_child->signature, "FACP", 4)) { + printf("FACP!!!\n"); +#if 0 + acpi_handle_facp((struct FACPbody *)sdp_child->body); +#endif + } else + acpi_print_sdt(sdp_child); } } ==== //depot/projects/ia64/usr.sbin/acpi/acpidump/acpidump.c#5 (text+ko) ==== @@ -86,22 +86,25 @@ asl_dump_from_devmem() { struct ACPIrsdp *rp; - struct ACPIsdt *rsdp; + struct ACPIsdt *sdp; + vm_offset_t sdt_addr; 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); - if (memcmp(rsdp->signature, "RSDT", 4)) { -hd(rsdp, 256); - errx(1, "RSDT is not a RSDT\n"); + sdt_addr = (rp->xsdt != 0) ? rp->xsdt : rp->rsdt; + sdp = (struct ACPIsdt*) acpi_map_sdt(sdt_addr); + if (memcmp(sdp->signature, "RSDT", 4) != 0 && + memcmp(sdp->signature, "XSDT", 4) != 0) { + hd(sdp, 256); + errx(1, "SDT is not a RSDT nor a XSDT\n"); } - if (acpi_checksum(rsdp, rsdp->len)) - errx(1, "RSDT checksum corrupted\n"); + if (acpi_checksum(sdp, sdp->len)) + errx(1, "RSDT/XSDT checksum corrupted\n"); - acpi_handle_rsdt(rsdp); + acpi_handle_sdt(sdp); } static void ==== //depot/projects/ia64/usr.sbin/acpi/acpidump/acpidump.h#5 (text+ko) ==== @@ -52,7 +52,11 @@ u_char sum; u_char oem[6]; u_char res; - u_int32_t addr; + u_int32_t rsdt; + u_int32_t length; + u_int64_t xsdt; + u_char xsum; + u_char _spare_[3]; } __packed; /* System Description Table */ 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?200212040607.gB467dlf011494>