acpi: Be lenient about unknown revision of FADT, MADT, XSDT and RSDT
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 24 Sep 2013 05:52:41 +0000 (13:52 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Tue, 24 Sep 2013 06:00:41 +0000 (14:00 +0800)
Revision 5 FADT is found on on ASRock H77 Pro4-M, which is beyond the
revision even in ACPI-4.0a.  Since length is checked for these tables,
this commit should be safe.

sys/platform/pc32/acpica/acpi_fadt.c
sys/platform/pc32/acpica/acpi_madt.c
sys/platform/pc32/acpica/acpi_sdt.c
sys/platform/pc64/acpica/acpi_fadt.c
sys/platform/pc64/acpica/acpi_madt.c
sys/platform/pc64/acpica/acpi_sdt.c

index ec84176..d7886cd 100644 (file)
@@ -112,9 +112,8 @@ fadt_probe(void)
         * FADT in ACPI specification 1.0 - 4.0
         */
        if (fadt->fadt_hdr.sdth_rev < 1 || fadt->fadt_hdr.sdth_rev > 4) {
-               kprintf("fadt_probe: unsupported FADT revision %d\n",
+               kprintf("fadt_probe: unknown FADT revision %d\n",
                        fadt->fadt_hdr.sdth_rev);
-               goto back;
        }
 
        if (fadt->fadt_hdr.sdth_len < sizeof(*fadt)) {
index 2a7575c..4fd321f 100644 (file)
@@ -180,10 +180,8 @@ madt_check(vm_paddr_t madt_paddr)
         * MADT in ACPI specification 1.0 - 4.0
         */
        if (madt->madt_hdr.sdth_rev < 1 || madt->madt_hdr.sdth_rev > 3) {
-               kprintf("madt_check: unsupported MADT revision %d\n",
+               kprintf("madt_check: unknown MADT revision %d\n",
                        madt->madt_hdr.sdth_rev);
-               error = EOPNOTSUPP;
-               goto back;
        }
 
        if (madt->madt_hdr.sdth_len <
index 50f00b5..e8d2252 100644 (file)
@@ -204,8 +204,13 @@ sdt_search_xsdt(vm_paddr_t xsdt_paddr, const uint8_t *sig)
        }
 
        if (xsdt->xsdt_hdr.sdth_rev != 1) {
-               kprintf("sdt_search_xsdt: unsupported XSDT revision %d\n",
+               kprintf("sdt_search_xsdt: unknown XSDT revision %d\n",
                        xsdt->xsdt_hdr.sdth_rev);
+       }
+
+       if (xsdt->xsdt_hdr.sdth_len < sizeof(xsdt->xsdt_hdr)) {
+               kprintf("sdt_search_xsdt: invalid XSDT length %u\n",
+                       xsdt->xsdt_hdr.sdth_len);
                goto back;
        }
 
@@ -260,8 +265,13 @@ sdt_search_rsdt(vm_paddr_t rsdt_paddr, const uint8_t *sig)
        }
 
        if (rsdt->rsdt_hdr.sdth_rev != 1) {
-               kprintf("sdt_search_rsdt: unsupported RSDT revision %d\n",
+               kprintf("sdt_search_rsdt: unknown RSDT revision %d\n",
                        rsdt->rsdt_hdr.sdth_rev);
+       }
+
+       if (rsdt->rsdt_hdr.sdth_len < sizeof(rsdt->rsdt_hdr)) {
+               kprintf("sdt_search_rsdt: invalid RSDT length %u\n",
+                       rsdt->rsdt_hdr.sdth_len);
                goto back;
        }
 
index ec84176..d7886cd 100644 (file)
@@ -112,9 +112,8 @@ fadt_probe(void)
         * FADT in ACPI specification 1.0 - 4.0
         */
        if (fadt->fadt_hdr.sdth_rev < 1 || fadt->fadt_hdr.sdth_rev > 4) {
-               kprintf("fadt_probe: unsupported FADT revision %d\n",
+               kprintf("fadt_probe: unknown FADT revision %d\n",
                        fadt->fadt_hdr.sdth_rev);
-               goto back;
        }
 
        if (fadt->fadt_hdr.sdth_len < sizeof(*fadt)) {
index 2fb3c4c..22cc585 100644 (file)
@@ -180,10 +180,8 @@ madt_check(vm_paddr_t madt_paddr)
         * MADT in ACPI specification 1.0 - 4.0
         */
        if (madt->madt_hdr.sdth_rev < 1 || madt->madt_hdr.sdth_rev > 3) {
-               kprintf("madt_check: unsupported MADT revision %d\n",
+               kprintf("madt_check: unknown MADT revision %d\n",
                        madt->madt_hdr.sdth_rev);
-               error = EOPNOTSUPP;
-               goto back;
        }
 
        if (madt->madt_hdr.sdth_len <
index 50f00b5..e8d2252 100644 (file)
@@ -204,8 +204,13 @@ sdt_search_xsdt(vm_paddr_t xsdt_paddr, const uint8_t *sig)
        }
 
        if (xsdt->xsdt_hdr.sdth_rev != 1) {
-               kprintf("sdt_search_xsdt: unsupported XSDT revision %d\n",
+               kprintf("sdt_search_xsdt: unknown XSDT revision %d\n",
                        xsdt->xsdt_hdr.sdth_rev);
+       }
+
+       if (xsdt->xsdt_hdr.sdth_len < sizeof(xsdt->xsdt_hdr)) {
+               kprintf("sdt_search_xsdt: invalid XSDT length %u\n",
+                       xsdt->xsdt_hdr.sdth_len);
                goto back;
        }
 
@@ -260,8 +265,13 @@ sdt_search_rsdt(vm_paddr_t rsdt_paddr, const uint8_t *sig)
        }
 
        if (rsdt->rsdt_hdr.sdth_rev != 1) {
-               kprintf("sdt_search_rsdt: unsupported RSDT revision %d\n",
+               kprintf("sdt_search_rsdt: unknown RSDT revision %d\n",
                        rsdt->rsdt_hdr.sdth_rev);
+       }
+
+       if (rsdt->rsdt_hdr.sdth_len < sizeof(rsdt->rsdt_hdr)) {
+               kprintf("sdt_search_rsdt: invalid RSDT length %u\n",
+                       rsdt->rsdt_hdr.sdth_len);
                goto back;
        }