diff options
author | Bob Moore <robert.moore@intel.com> | 2006-01-27 16:43:00 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-31 03:25:09 -0500 |
commit | b8e4d89357fc434618a59c1047cac72641191805 (patch) | |
tree | ac97fcc6fdc277c682365900663872c96f2420bd /drivers/acpi/resources | |
parent | 292dd876ee765c478b27c93cc51e93a558ed58bf (diff) |
[ACPI] ACPICA 20060127
Implemented support in the Resource Manager to allow
unresolved namestring references within resource package
objects for the _PRT method. This support is in addition
to the previously implemented unresolved reference
support within the AML parser. If the interpreter slack
mode is enabled (true on Linux unless acpi=strict),
these unresolved references will be passed through
to the caller as a NULL package entry.
http://bugzilla.kernel.org/show_bug.cgi?id=5741
Implemented and deployed new macros and functions for
error and warning messages across the subsystem. These
macros are simpler and generate less code than their
predecessors. The new macros ACPI_ERROR, ACPI_EXCEPTION,
ACPI_WARNING, and ACPI_INFO replace the ACPI_REPORT_*
macros.
Implemented the acpi_cpu_flags type to simplify host OS
integration of the Acquire/Release Lock OSL interfaces.
Suggested by Steven Rostedt and Andrew Morton.
Fixed a problem where Alias ASL operators are sometimes
not correctly resolved. causing AE_AML_INTERNAL
http://bugzilla.kernel.org/show_bug.cgi?id=5189
http://bugzilla.kernel.org/show_bug.cgi?id=5674
Fixed several problems with the implementation of the
ConcatenateResTemplate ASL operator. As per the ACPI
specification, zero length buffers are now treated as a
single EndTag. One-length buffers always cause a fatal
exception. Non-zero length buffers that do not end with
a full 2-byte EndTag cause a fatal exception.
Fixed a possible structure overwrite in the
AcpiGetObjectInfo external interface. (With assistance
from Thomas Renninger)
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
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 1dfa6906d455..7d6481d9fbec 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, | |||
541 | 541 | ||
542 | for (table_index = 0; table_index < 4 && !name_found; | 542 | for (table_index = 0; table_index < 4 && !name_found; |
543 | table_index++) { | 543 | table_index++) { |
544 | if ((ACPI_TYPE_STRING == | 544 | if (*sub_object_list && /* Null object allowed */ |
545 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) | 545 | ((ACPI_TYPE_STRING == |
546 | || | 546 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) || |
547 | ((ACPI_TYPE_LOCAL_REFERENCE == | 547 | ((ACPI_TYPE_LOCAL_REFERENCE == |
548 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) | 548 | ACPI_GET_OBJECT_TYPE(*sub_object_list)) && |
549 | && ((*sub_object_list)->reference.opcode == | 549 | ((*sub_object_list)->reference.opcode == |
550 | AML_INT_NAMEPATH_OP))) { | 550 | AML_INT_NAMEPATH_OP)))) { |
551 | name_found = TRUE; | 551 | name_found = TRUE; |
552 | } else { | 552 | } else { |
553 | /* Look at the next element */ | 553 | /* Look at the next element */ |
diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c index 7f46ca0bf33a..8c128dea3252 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, | |||
207 | /* Each element of the top-level package must also be a package */ | 207 | /* Each element of the top-level package must also be a package */ |
208 | 208 | ||
209 | if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { | 209 | if (ACPI_GET_OBJECT_TYPE(*top_object_list) != ACPI_TYPE_PACKAGE) { |
210 | ACPI_REPORT_ERROR(("(PRT[%X]) Need sub-package, found %s\n", index, acpi_ut_get_object_type_name(*top_object_list))); | 210 | ACPI_ERROR((AE_INFO, |
211 | "(PRT[%X]) Need sub-package, found %s", | ||
212 | index, | ||
213 | acpi_ut_get_object_type_name | ||
214 | (*top_object_list))); | ||
211 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); | 215 | return_ACPI_STATUS(AE_AML_OPERAND_TYPE); |
212 | } | 216 | } |
213 | 217 | ||
214 | /* Each sub-package must be of length 4 */ | 218 | /* Each sub-package must be of length 4 */ |
215 | 219 | ||
216 | if ((*top_object_list)->package.count != 4) { | 220 | if ((*top_object_list)->package.count != 4) { |
217 | ACPI_REPORT_ERROR(("(PRT[%X]) Need package of length 4, found length %d\n", index, (*top_object_list)->package.count)); | 221 | ACPI_ERROR((AE_INFO, |
222 | "(PRT[%X]) Need package of length 4, found length %d", | ||
223 | index, (*top_object_list)->package.count)); | ||
218 | return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); | 224 | return_ACPI_STATUS(AE_AML_PACKAGE_LIMIT); |
219 | } | 225 | } |
220 | 226 | ||
@@ -231,7 +237,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
231 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 237 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
232 | user_prt->address = obj_desc->integer.value; | 238 | user_prt->address = obj_desc->integer.value; |
233 | } else { | 239 | } else { |
234 | ACPI_REPORT_ERROR(("(PRT[%X].Address) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); | 240 | ACPI_ERROR((AE_INFO, |
241 | "(PRT[%X].Address) Need Integer, found %s", | ||
242 | index, | ||
243 | acpi_ut_get_object_type_name(obj_desc))); | ||
235 | return_ACPI_STATUS(AE_BAD_DATA); | 244 | return_ACPI_STATUS(AE_BAD_DATA); |
236 | } | 245 | } |
237 | 246 | ||
@@ -241,65 +250,83 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
241 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 250 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
242 | user_prt->pin = (u32) obj_desc->integer.value; | 251 | user_prt->pin = (u32) obj_desc->integer.value; |
243 | } else { | 252 | } else { |
244 | ACPI_REPORT_ERROR(("(PRT[%X].Pin) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); | 253 | ACPI_ERROR((AE_INFO, |
254 | "(PRT[%X].Pin) Need Integer, found %s", | ||
255 | index, | ||
256 | acpi_ut_get_object_type_name(obj_desc))); | ||
245 | return_ACPI_STATUS(AE_BAD_DATA); | 257 | return_ACPI_STATUS(AE_BAD_DATA); |
246 | } | 258 | } |
247 | 259 | ||
248 | /* 3) Third subobject: Dereference the PRT.source_name */ | 260 | /* |
249 | 261 | * 3) Third subobject: Dereference the PRT.source_name | |
262 | * The name may be unresolved (slack mode), so allow a null object | ||
263 | */ | ||
250 | obj_desc = sub_object_list[2]; | 264 | obj_desc = sub_object_list[2]; |
251 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { | 265 | if (obj_desc) { |
252 | case ACPI_TYPE_LOCAL_REFERENCE: | 266 | switch (ACPI_GET_OBJECT_TYPE(obj_desc)) { |
253 | 267 | case ACPI_TYPE_LOCAL_REFERENCE: | |
254 | if (obj_desc->reference.opcode != AML_INT_NAMEPATH_OP) { | 268 | |
255 | ACPI_REPORT_ERROR(("(PRT[%X].Source) Need name, found reference op %X\n", index, obj_desc->reference.opcode)); | 269 | if (obj_desc->reference.opcode != |
270 | AML_INT_NAMEPATH_OP) { | ||
271 | ACPI_ERROR((AE_INFO, | ||
272 | "(PRT[%X].Source) Need name, found reference op %X", | ||
273 | index, | ||
274 | obj_desc->reference. | ||
275 | opcode)); | ||
276 | return_ACPI_STATUS(AE_BAD_DATA); | ||
277 | } | ||
278 | |||
279 | node = obj_desc->reference.node; | ||
280 | |||
281 | /* Use *remaining* length of the buffer as max for pathname */ | ||
282 | |||
283 | path_buffer.length = output_buffer->length - | ||
284 | (u32) ((u8 *) user_prt->source - | ||
285 | (u8 *) output_buffer->pointer); | ||
286 | path_buffer.pointer = user_prt->source; | ||
287 | |||
288 | status = | ||
289 | acpi_ns_handle_to_pathname((acpi_handle) | ||
290 | node, | ||
291 | &path_buffer); | ||
292 | |||
293 | /* +1 to include null terminator */ | ||
294 | |||
295 | user_prt->length += | ||
296 | (u32) ACPI_STRLEN(user_prt->source) + 1; | ||
297 | break; | ||
298 | |||
299 | case ACPI_TYPE_STRING: | ||
300 | |||
301 | ACPI_STRCPY(user_prt->source, | ||
302 | obj_desc->string.pointer); | ||
303 | |||
304 | /* | ||
305 | * Add to the Length field the length of the string | ||
306 | * (add 1 for terminator) | ||
307 | */ | ||
308 | user_prt->length += obj_desc->string.length + 1; | ||
309 | break; | ||
310 | |||
311 | case ACPI_TYPE_INTEGER: | ||
312 | /* | ||
313 | * If this is a number, then the Source Name is NULL, since the | ||
314 | * entire buffer was zeroed out, we can leave this alone. | ||
315 | * | ||
316 | * Add to the Length field the length of the u32 NULL | ||
317 | */ | ||
318 | user_prt->length += sizeof(u32); | ||
319 | break; | ||
320 | |||
321 | default: | ||
322 | |||
323 | ACPI_ERROR((AE_INFO, | ||
324 | "(PRT[%X].Source) Need Ref/String/Integer, found %s", | ||
325 | index, | ||
326 | acpi_ut_get_object_type_name | ||
327 | (obj_desc))); | ||
256 | return_ACPI_STATUS(AE_BAD_DATA); | 328 | return_ACPI_STATUS(AE_BAD_DATA); |
257 | } | 329 | } |
258 | |||
259 | node = obj_desc->reference.node; | ||
260 | |||
261 | /* Use *remaining* length of the buffer as max for pathname */ | ||
262 | |||
263 | path_buffer.length = output_buffer->length - | ||
264 | (u32) ((u8 *) user_prt->source - | ||
265 | (u8 *) output_buffer->pointer); | ||
266 | path_buffer.pointer = user_prt->source; | ||
267 | |||
268 | status = | ||
269 | acpi_ns_handle_to_pathname((acpi_handle) node, | ||
270 | &path_buffer); | ||
271 | |||
272 | /* +1 to include null terminator */ | ||
273 | |||
274 | user_prt->length += | ||
275 | (u32) ACPI_STRLEN(user_prt->source) + 1; | ||
276 | break; | ||
277 | |||
278 | case ACPI_TYPE_STRING: | ||
279 | |||
280 | ACPI_STRCPY(user_prt->source, obj_desc->string.pointer); | ||
281 | |||
282 | /* | ||
283 | * Add to the Length field the length of the string | ||
284 | * (add 1 for terminator) | ||
285 | */ | ||
286 | user_prt->length += obj_desc->string.length + 1; | ||
287 | break; | ||
288 | |||
289 | case ACPI_TYPE_INTEGER: | ||
290 | /* | ||
291 | * If this is a number, then the Source Name is NULL, since the | ||
292 | * entire buffer was zeroed out, we can leave this alone. | ||
293 | * | ||
294 | * Add to the Length field the length of the u32 NULL | ||
295 | */ | ||
296 | user_prt->length += sizeof(u32); | ||
297 | break; | ||
298 | |||
299 | default: | ||
300 | |||
301 | ACPI_REPORT_ERROR(("(PRT[%X].Source) Need Ref/String/Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); | ||
302 | return_ACPI_STATUS(AE_BAD_DATA); | ||
303 | } | 330 | } |
304 | 331 | ||
305 | /* Now align the current length */ | 332 | /* Now align the current length */ |
@@ -313,7 +340,10 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, | |||
313 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { | 340 | if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) { |
314 | user_prt->source_index = (u32) obj_desc->integer.value; | 341 | user_prt->source_index = (u32) obj_desc->integer.value; |
315 | } else { | 342 | } else { |
316 | ACPI_REPORT_ERROR(("(PRT[%X].source_index) Need Integer, found %s\n", index, acpi_ut_get_object_type_name(obj_desc))); | 343 | ACPI_ERROR((AE_INFO, |
344 | "(PRT[%X].source_index) Need Integer, found %s", | ||
345 | index, | ||
346 | acpi_ut_get_object_type_name(obj_desc))); | ||
317 | return_ACPI_STATUS(AE_BAD_DATA); | 347 | return_ACPI_STATUS(AE_BAD_DATA); |
318 | } | 348 | } |
319 | 349 | ||
diff --git a/drivers/acpi/resources/rsdump.c b/drivers/acpi/resources/rsdump.c index 98356e2482c5..e7de061cf883 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) | |||
692 | 692 | ||
693 | static void acpi_rs_out_string(char *title, char *value) | 693 | static void acpi_rs_out_string(char *title, char *value) |
694 | { | 694 | { |
695 | acpi_os_printf("%27s : %s\n", title, value); | 695 | acpi_os_printf("%27s : %s", title, value); |
696 | if (!*value) { | ||
697 | acpi_os_printf("[NULL NAMESTRING]"); | ||
698 | } | ||
699 | acpi_os_printf("\n"); | ||
696 | } | 700 | } |
697 | 701 | ||
698 | static void acpi_rs_out_integer8(char *title, u8 value) | 702 | 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 e4778a51c17e..1434e786477e 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) | |||
94 | acpi_gbl_get_resource_dispatch | 94 | acpi_gbl_get_resource_dispatch |
95 | [resource_index]); | 95 | [resource_index]); |
96 | if (ACPI_FAILURE(status)) { | 96 | if (ACPI_FAILURE(status)) { |
97 | ACPI_REPORT_ERROR(("Could not convert AML resource (Type %X) to resource, %s\n", *aml, acpi_format_exception(status))); | 97 | ACPI_EXCEPTION((AE_INFO, status, |
98 | "Could not convert AML resource (Type %X)", | ||
99 | *aml)); | ||
98 | return_ACPI_STATUS(status); | 100 | return_ACPI_STATUS(status); |
99 | } | 101 | } |
100 | 102 | ||
@@ -156,7 +158,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
156 | /* Validate the (internal) Resource Type */ | 158 | /* Validate the (internal) Resource Type */ |
157 | 159 | ||
158 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { | 160 | if (resource->type > ACPI_RESOURCE_TYPE_MAX) { |
159 | ACPI_REPORT_ERROR(("Invalid descriptor type (%X) in resource list\n", resource->type)); | 161 | ACPI_ERROR((AE_INFO, |
162 | "Invalid descriptor type (%X) in resource list", | ||
163 | resource->type)); | ||
160 | return_ACPI_STATUS(AE_BAD_DATA); | 164 | return_ACPI_STATUS(AE_BAD_DATA); |
161 | } | 165 | } |
162 | 166 | ||
@@ -169,7 +173,9 @@ acpi_rs_convert_resources_to_aml(struct acpi_resource *resource, | |||
169 | acpi_gbl_set_resource_dispatch | 173 | acpi_gbl_set_resource_dispatch |
170 | [resource->type]); | 174 | [resource->type]); |
171 | if (ACPI_FAILURE(status)) { | 175 | if (ACPI_FAILURE(status)) { |
172 | ACPI_REPORT_ERROR(("Could not convert resource (type %X) to AML, %s\n", resource->type, acpi_format_exception(status))); | 176 | ACPI_EXCEPTION((AE_INFO, status, |
177 | "Could not convert resource (type %X) to AML", | ||
178 | resource->type)); | ||
173 | return_ACPI_STATUS(status); | 179 | return_ACPI_STATUS(status); |
174 | } | 180 | } |
175 | 181 | ||
diff --git a/drivers/acpi/resources/rsmisc.c b/drivers/acpi/resources/rsmisc.c index 83bfe0dd3eba..ed866cf1c6d2 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, | |||
84 | ACPI_FUNCTION_TRACE("rs_get_resource"); | 84 | ACPI_FUNCTION_TRACE("rs_get_resource"); |
85 | 85 | ||
86 | if (((acpi_native_uint) resource) & 0x3) { | 86 | if (((acpi_native_uint) resource) & 0x3) { |
87 | acpi_os_printf | 87 | /* Each internal resource struct is expected to be 32-bit aligned */ |
88 | ("**** GET: Misaligned resource pointer: %p Type %2.2X Len %X\n", | 88 | |
89 | resource, resource->type, resource->length); | 89 | ACPI_WARNING((AE_INFO, |
90 | "Misaligned resource pointer (get): %p Type %2.2X Len %X", | ||
91 | resource, resource->type, resource->length)); | ||
90 | } | 92 | } |
91 | 93 | ||
92 | /* Extract the resource Length field (does not include header length) */ | 94 | /* Extract the resource Length field (does not include header length) */ |
@@ -274,15 +276,16 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, | |||
274 | break; | 276 | break; |
275 | 277 | ||
276 | default: | 278 | default: |
277 | acpi_os_printf | 279 | |
278 | ("*** Invalid conversion sub-opcode\n"); | 280 | ACPI_ERROR((AE_INFO, |
281 | "Invalid conversion sub-opcode")); | ||
279 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 282 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
280 | } | 283 | } |
281 | break; | 284 | break; |
282 | 285 | ||
283 | default: | 286 | default: |
284 | 287 | ||
285 | acpi_os_printf("*** Invalid conversion opcode\n"); | 288 | ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); |
286 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 289 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
287 | } | 290 | } |
288 | 291 | ||
@@ -486,15 +489,16 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, | |||
486 | break; | 489 | break; |
487 | 490 | ||
488 | default: | 491 | default: |
489 | acpi_os_printf | 492 | |
490 | ("*** Invalid conversion sub-opcode\n"); | 493 | ACPI_ERROR((AE_INFO, |
494 | "Invalid conversion sub-opcode")); | ||
491 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 495 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
492 | } | 496 | } |
493 | break; | 497 | break; |
494 | 498 | ||
495 | default: | 499 | default: |
496 | 500 | ||
497 | acpi_os_printf("*** Invalid conversion opcode\n"); | 501 | ACPI_ERROR((AE_INFO, "Invalid conversion opcode")); |
498 | return_ACPI_STATUS(AE_BAD_PARAMETER); | 502 | return_ACPI_STATUS(AE_BAD_PARAMETER); |
499 | } | 503 | } |
500 | 504 | ||
@@ -523,7 +527,9 @@ if (((aml->irq.flags & 0x09) == 0x00) || ((aml->irq.flags & 0x09) == 0x09)) { | |||
523 | * polarity/trigger interrupts are allowed (ACPI spec, section | 527 | * polarity/trigger interrupts are allowed (ACPI spec, section |
524 | * "IRQ Format"), so 0x00 and 0x09 are illegal. | 528 | * "IRQ Format"), so 0x00 and 0x09 are illegal. |
525 | */ | 529 | */ |
526 | ACPI_REPORT_ERROR(("Invalid interrupt polarity/trigger in resource list, %X\n", aml->irq.flags)); | 530 | ACPI_ERROR((AE_INFO, |
531 | "Invalid interrupt polarity/trigger in resource list, %X", | ||
532 | aml->irq.flags)); | ||
527 | return_ACPI_STATUS(AE_BAD_DATA); | 533 | return_ACPI_STATUS(AE_BAD_DATA); |
528 | } | 534 | } |
529 | 535 | ||
@@ -535,7 +541,7 @@ if (temp8 < 1) { | |||
535 | } | 541 | } |
536 | 542 | ||
537 | if (resource->data.dma.transfer == 0x03) { | 543 | if (resource->data.dma.transfer == 0x03) { |
538 | ACPI_REPORT_ERROR(("Invalid DMA.Transfer preference (3)\n")); | 544 | ACPI_ERROR((AE_INFO, "Invalid DMA.Transfer preference (3)")); |
539 | return_ACPI_STATUS(AE_BAD_DATA); | 545 | return_ACPI_STATUS(AE_BAD_DATA); |
540 | } | 546 | } |
541 | #endif | 547 | #endif |