From: Bob Moore Date: Tue, 10 Jun 2008 06:16:47 +0000 (+0800) Subject: ACPICA: Workaround for reversed _PRT entries from BIOS X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d0e184abc5983281ef189db2c759d65d56eb1b80;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ACPICA: Workaround for reversed _PRT entries from BIOS Some BIOSs erroneously reverse the _PRT SourceName and the SourceIndex. Detect and repair this problem. MS ACPI also allows and repairs this problem, thus ACPICA must also. Signed-off-by: Bob Moore Signed-off-by: Lin Ming Signed-off-by: Len Brown Signed-off-by: Andi Kleen --- diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index faddaee1bc07..70c84ece87f1 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -284,6 +284,23 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, } } + /* + * If the BIOS has erroneously reversed the _PRT source_name (index 2) + * and the source_index (index 3), fix it. _PRT is important enough to + * workaround this BIOS error. This also provides compatibility with + * other ACPI implementations. + */ + obj_desc = sub_object_list[3]; + if (!obj_desc + || (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER)) { + sub_object_list[3] = sub_object_list[2]; + sub_object_list[2] = obj_desc; + + ACPI_WARNING((AE_INFO, + "(PRT[%X].Source) SourceName and SourceIndex are reversed, fixed", + index)); + } + /* * 3) Third subobject: Dereference the PRT.source_name * The name may be unresolved (slack mode), so allow a null object