diff options
Diffstat (limited to 'drivers/acpi/resources')
-rw-r--r-- | drivers/acpi/resources/rscalc.c | 14 | ||||
-rw-r--r-- | drivers/acpi/resources/rscreate.c | 144 | ||||
-rw-r--r-- | drivers/acpi/resources/rsdump.c | 6 | ||||
-rw-r--r-- | drivers/acpi/resources/rslist.c | 12 | ||||
-rw-r--r-- | drivers/acpi/resources/rsmisc.c | 28 |
5 files changed, 125 insertions, 79 deletions
diff --git a/drivers/acpi/resources/rscalc.c b/drivers/acpi/resources/rscalc.c index 1dfa6906d45..7d6481d9fbe 100644 --- a/drivers/acpi/resources/rscalc.c +++ b/drivers/acpi/resources/rscalc.c @@ -541,13 +541,13 @@ acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, for (table_index = 0; table_index < 4 && !name_found; table_index++) { - if ((ACPI_TYPE_STRING == - ACPI_GET_OBJECT_TYPE(*sub_object_list)) - || - ((ACPI_TYPE_LOCAL_REFERENCE == - ACPI_GET_OBJECT_TYPE(*sub_object_list)) - && ((*sub_object_list)->reference.opcode == - AML_INT_NAMEPATH_OP))) { + if (*sub_object_list && /* Null object allowed */ + ((ACPI_TYPE_STRING == + ACPI_GET_OBJECT_TYPE(*sub_object_list)) || + ((ACPI_TYPE_LOCAL_REFERENCE == + ACPI_GET_OBJECT_TYPE(*sub_object_list)) && + ((*sub_object_list)->reference.opcode == + AML_INT_NAMEPATH_OP)))) { name_found = TRUE; } else { /* Look at the next element */ diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 7f46ca0bf33..8c128dea325 100644 --- a/drivers/acpi/resources/rscreate.c +++ b/drivers/acpi/resources/rscreate.c @@ -207,14 +207,20 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, /* Each element of the top-level package must also be a package */ if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { - ACPI_REPORT_ERROR(("(PRT[%X]) Need sub-package, found %s\n", index, acpi_ut_get_object_type_name(*top_object_list))); + ACPI_ERROR((AE_INFO, + "(PRT[%X]) Need sub-package, found %s", + index, + acpi_ut_get_object_type_name + (*top_object_list))); return_ACPI_STATUS(AE_AML_OPERAND_TYPE); } /* Each sub-package must be of length 4 */ if ((*top_object_list)->package.count != 4) { - ACPI_REPORT_ERROR(("(PRT[%X]) Need package of length 4, found length %d\n", index, (*top_object_list)->package.count)); + ACPI_ERROR((AE_INFO, + "(PRT[%X]) Need package of length 4, found length %d", + index, (*top_object_list)->package.count)); return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); } @@ -231,7 +237,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->address = obj_desc->integer.value; } else { - ACPI_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_ERROR((AE_INFO, + "(PRT[%X].Address) Need Integer, found %s", + index, + acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } @@ -241,65 +250,83 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->pin = (u32) obj_desc->integer.value; } else { - ACPI_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_ERROR((AE_INFO, + "(PRT[%X].Pin) Need Integer, found %s", + index, + acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } - /* 3) Third subobject: Dereference the PRT.source_name */ - + /* + * 3) Third subobject: Dereference the PRT.source_name + * The name may be unresolved (slack mode), so allow a null object + */ obj_desc = sub_object_list[2]; - switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { - case ACPI_TYPE_LOCAL_REFERENCE: - - if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { - ACPI_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); + if (obj_desc) { + switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { + case ACPI_TYPE_LOCAL_REFERENCE: + + if (obj_desc->reference.opcode != + AML_INT_NAMEPATH_OP) { + ACPI_ERROR((AE_INFO, + "(PRT[%X].Source) Need name, found reference op %X", + index, + obj_desc->reference. + opcode)); + return_ACPI_STATUS(AE_BAD_DATA); + } + + node = obj_desc->reference.node; + + /* Use *remaining* length of the buffer as max for pathname */ + + path_buffer.length = output_buffer->length - + (u32) ((u8 *) user_prt->source - + (u8 *) output_buffer->pointer); + path_buffer.pointer = user_prt->source; + + status = + acpi_ns_handle_to_pathname((acpi_handle) + node, + &path_buffer); + + /* +1 to include null terminator */ + + user_prt->length += + (u32) ACPI_STRLEN(user_prt->source) + 1; + break; + + case ACPI_TYPE_STRING: + + ACPI_STRCPY(user_prt->source, + obj_desc->string.pointer); + + /* + * Add to the Length field the length of the string + * (add 1 for terminator) + */ + user_prt->length += obj_desc->string.length + 1; + break; + + case ACPI_TYPE_INTEGER: + /* + * If this is a number, then the Source Name is NULL, since the + * entire buffer was zeroed out, we can leave this alone. + * + * Add to the Length field the length of the u32 NULL + */ + user_prt->length += sizeof(u32); + break; + + default: + + ACPI_ERROR((AE_INFO, + "(PRT[%X].Source) Need Ref/String/Integer, found %s", + index, + acpi_ut_get_object_type_name + (obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } - - node = obj_desc->reference.node; - - /* Use *remaining* length of the buffer as max for pathname */ - - path_buffer.length = output_buffer->length - - (u32) ((u8 *) user_prt->source - - (u8 *) output_buffer->pointer); - path_buffer.pointer = user_prt->source; - - status = - acpi_ns_handle_to_pathname((acpi_handle) node, - &path_buffer); - - /* +1 to include null terminator */ - - user_prt->length += - (u32) ACPI_STRLEN(user_prt->source) + 1; - break; - - case ACPI_TYPE_STRING: - - ACPI_STRCPY(user_prt->source, obj_desc->string.pointer); - - /* - * Add to the Length field the length of the string - * (add 1 for terminator) - */ - user_prt->length += obj_desc->string.length + 1; - break; - - case ACPI_TYPE_INTEGER: - /* - * If this is a number, then the Source Name is NULL, since the - * entire buffer was zeroed out, we can leave this alone. - * - * Add to the Length field the length of the u32 NULL - */ - user_prt->length += sizeof(u32); - break; - - default: - - ACPI_REPORT_ERROR(("(PRT[%X].Source) Need Ref/String/Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); - return_ACPI_STATUS(AE_BAD_DATA); } /* Now align the current length */ @@ -313,7 +340,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { user_prt->source_index = (u32) obj_desc->integer.value; } else { - ACPI_REPORT_ERROR(("(PRT[%X].source_index) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); + ACPI_ERROR((AE_INFO, + "(PRT[%X].source_index) Need Integer, found %s", + index, + acpi_ut_get_object_type_name(obj_desc))); return_ACPI_STATUS(AE_BAD_DATA); } diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 98356e2482c..e7de061cf88 100644 --- a/drivers/acpi/resources/rsdump.c +++ b/drivers/acpi/resources/rsdump.c @@ -692,7 +692,11 @@ void acpi_rs_dump_irq_list(u8 * route_table) static void acpi_rs_out_string(char *title, char *value) { - acpi_os_printf("%27s : %s\n", title, value); + acpi_os_printf("%27s : %s", title, value); + if (!*value) { + acpi_os_printf("[NULL NAMESTRING]"); + } + acpi_os_printf("\n"); } static void acpi_rs_out_integer8(char *title, u8 value) diff --git a/drivers/acpi/resources/rslist.c b/drivers/acpi/resources/rslist.c index e4778a51c17..1434e786477 100644 --- a/drivers/acpi/resources/rslist.c +++ b/drivers/acpi/resources/rslist.c @@ -94,7 +94,9 @@ acpi_rs_convert_aml_to_resources(u8 * aml, u32 aml_length, u8 * output_buffer) acpi_gbl_get_resource_dispatch [resource_index]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not convert AML resource (Type %X)", + *aml)); return_ACPI_STATUS(status); } @@ -156,7 +158,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, /* Validate the (internal) Resource Type */ if (resource->type > ACPI_RESOURCE_TYPE_MAX) { - ACPI_REPORT_ERROR(("Invalid descriptor type (%X) in resource list\n", resource->type)); + ACPI_ERROR((AE_INFO, + "Invalid descriptor type (%X) in resource list", + resource->type)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -169,7 +173,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, acpi_gbl_set_resource_dispatch [resource->type]); if (ACPI_FAILURE(status)) { - ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); + ACPI_EXCEPTION((AE_INFO, status, + "Could not convert resource (type %X) to AML", + resource->type)); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 83bfe0dd3eb..ed866cf1c6d 100644 --- a/drivers/acpi/resources/rsmisc.c +++ b/drivers/acpi/resources/rsmisc.c @@ -84,9 +84,11 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, ACPI_FUNCTION_TRACE("rs_get_resource"); if (((acpi_native_uint) resource) & 0x3) { - acpi_os_printf - ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", - resource, resource->type, resource->length); + /* Each internal resource struct is expected to be 32-bit aligned */ + + ACPI_WARNING((AE_INFO, + "Misaligned resource pointer (get): %p Type %2.2X Len %X", + resource, resource->type, resource->length)); } /* Extract the resource Length field (does not include header length) */ @@ -274,15 +276,16 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, break; default: - acpi_os_printf - ("*** Invalid conversion sub-opcode\n"); + + ACPI_ERROR((AE_INFO, + "Invalid conversion sub-opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } break; default: - acpi_os_printf("*** Invalid conversion opcode\n"); + ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -486,15 +489,16 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, break; default: - acpi_os_printf - ("*** Invalid conversion sub-opcode\n"); + + ACPI_ERROR((AE_INFO, + "Invalid conversion sub-opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } break; default: - acpi_os_printf("*** Invalid conversion opcode\n"); + ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); return_ACPI_STATUS(AE_BAD_PARAMETER); } @@ -523,7 +527,9 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { * polarity/trigger interrupts are allowed (ACPI spec, section * "IRQ Format"), so 0x00 and 0x09 are illegal. */ - ACPI_REPORT_ERROR(("Invalid interrupt polarity/trigger in resource list, %X\n", aml->irq.flags)); + ACPI_ERROR((AE_INFO, + "Invalid interrupt polarity/trigger in resource list, %X", + aml->irq.flags)); return_ACPI_STATUS(AE_BAD_DATA); } @@ -535,7 +541,7 @@ if (temp8 < 1) { } if (resource->data.dma.transfer == 0x03) { - ACPI_REPORT_ERROR(("Invalid DMA.Transfer preference (3)\n")); + ACPI_ERROR((AE_INFO, "Invalid DMA.Transfer preference (3)")); return_ACPI_STATUS(AE_BAD_DATA); } #endif |