aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/resources/rscreate.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
index 1358c06a969c..cc48ab05676c 100644
--- a/drivers/acpi/resources/rscreate.c
+++ b/drivers/acpi/resources/rscreate.c
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer); 191 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
192 192
193 for (index = 0; index < number_of_elements; index++) { 193 for (index = 0; index < number_of_elements; index++) {
194 int source_name_index = 2;
195 int source_index_index = 3;
196
194 /* 197 /*
195 * Point user_prt past this current structure 198 * Point user_prt past this current structure
196 * 199 *
@@ -261,10 +264,28 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
261 } 264 }
262 265
263 /* 266 /*
267 * If BIOS erroneously reversed the _PRT source_name and source_index,
268 * then reverse them back.
269 */
270 if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) {
271 if (acpi_gbl_enable_interpreter_slack) {
272 source_name_index = 3;
273 source_index_index = 2;
274 printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n");
275 } else {
276 ACPI_ERROR((AE_INFO,
277 "(PRT[%X].source_index) Need Integer, found %s",
278 index,
279 acpi_ut_get_object_type_name(sub_object_list[3])));
280 return_ACPI_STATUS(AE_BAD_DATA);
281 }
282 }
283
284 /*
264 * 3) Third subobject: Dereference the PRT.source_name 285 * 3) Third subobject: Dereference the PRT.source_name
265 * The name may be unresolved (slack mode), so allow a null object 286 * The name may be unresolved (slack mode), so allow a null object
266 */ 287 */
267 obj_desc = sub_object_list[2]; 288 obj_desc = sub_object_list[source_name_index];
268 if (obj_desc) { 289 if (obj_desc) {
269 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { 290 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
270 case ACPI_TYPE_LOCAL_REFERENCE: 291 case ACPI_TYPE_LOCAL_REFERENCE:
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
339 360
340 /* 4) Fourth subobject: Dereference the PRT.source_index */ 361 /* 4) Fourth subobject: Dereference the PRT.source_index */
341 362
342 obj_desc = sub_object_list[3]; 363 obj_desc = sub_object_list[source_index_index];
343 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { 364 if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
344 user_prt->source_index = (u32) obj_desc->integer.value; 365 user_prt->source_index = (u32) obj_desc->integer.value;
345 } else { 366 } else {