aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2006-01-27 16:43:00 -0500
committerLen Brown <len.brown@intel.com>2006-01-31 03:25:09 -0500
commitb8e4d89357fc434618a59c1047cac72641191805 (patch)
treeac97fcc6fdc277c682365900663872c96f2420bd /drivers/acpi/utilities
parent292dd876ee765c478b27c93cc51e93a558ed58bf (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/utilities')
-rw-r--r--drivers/acpi/utilities/utalloc.c51
-rw-r--r--drivers/acpi/utilities/utcopy.c5
-rw-r--r--drivers/acpi/utilities/utdelete.c10
-rw-r--r--drivers/acpi/utilities/uteval.c20
-rw-r--r--drivers/acpi/utilities/utglobal.c4
-rw-r--r--drivers/acpi/utilities/utinit.c8
-rw-r--r--drivers/acpi/utilities/utmath.c8
-rw-r--r--drivers/acpi/utilities/utmisc.c90
-rw-r--r--drivers/acpi/utilities/utmutex.c29
-rw-r--r--drivers/acpi/utilities/utobject.c29
-rw-r--r--drivers/acpi/utilities/utresrc.c16
-rw-r--r--drivers/acpi/utilities/utxface.c14
12 files changed, 182 insertions, 102 deletions
diff --git a/drivers/acpi/utilities/utalloc.c b/drivers/acpi/utilities/utalloc.c
index 0efcbdf7e620..03b0044974c2 100644
--- a/drivers/acpi/utilities/utalloc.c
+++ b/drivers/acpi/utilities/utalloc.c
@@ -301,8 +301,8 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
301 /* Check for an inadvertent size of zero bytes */ 301 /* Check for an inadvertent size of zero bytes */
302 302
303 if (!size) { 303 if (!size) {
304 _ACPI_REPORT_ERROR(module, line, 304 ACPI_ERROR((module, line,
305 ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n")); 305 "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte"));
306 size = 1; 306 size = 1;
307 } 307 }
308 308
@@ -310,9 +310,9 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
310 if (!allocation) { 310 if (!allocation) {
311 /* Report allocation error */ 311 /* Report allocation error */
312 312
313 _ACPI_REPORT_ERROR(module, line, 313 ACPI_ERROR((module, line,
314 ("ut_allocate: Could not allocate size %X\n", 314 "ut_allocate: Could not allocate size %X",
315 (u32) size)); 315 (u32) size));
316 316
317 return_PTR(NULL); 317 return_PTR(NULL);
318 } 318 }
@@ -344,8 +344,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
344 /* Check for an inadvertent size of zero bytes */ 344 /* Check for an inadvertent size of zero bytes */
345 345
346 if (!size) { 346 if (!size) {
347 _ACPI_REPORT_ERROR(module, line, 347 ACPI_ERROR((module, line,
348 ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n")); 348 "Attempt to allocate zero bytes, allocating 1 byte"));
349 size = 1; 349 size = 1;
350 } 350 }
351 351
@@ -353,9 +353,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
353 if (!allocation) { 353 if (!allocation) {
354 /* Report allocation error */ 354 /* Report allocation error */
355 355
356 _ACPI_REPORT_ERROR(module, line, 356 ACPI_ERROR((module, line,
357 ("ut_callocate: Could not allocate size %X\n", 357 "Could not allocate size %X", (u32) size));
358 (u32) size));
359 return_PTR(NULL); 358 return_PTR(NULL);
360 } 359 }
361 360
@@ -480,9 +479,8 @@ void *acpi_ut_callocate_and_track(acpi_size size,
480 if (!allocation) { 479 if (!allocation) {
481 /* Report allocation error */ 480 /* Report allocation error */
482 481
483 _ACPI_REPORT_ERROR(module, line, 482 ACPI_ERROR((module, line,
484 ("ut_callocate: Could not allocate size %X\n", 483 "Could not allocate size %X", (u32) size));
485 (u32) size));
486 return (NULL); 484 return (NULL);
487 } 485 }
488 486
@@ -524,8 +522,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
524 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation); 522 ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
525 523
526 if (NULL == allocation) { 524 if (NULL == allocation) {
527 _ACPI_REPORT_ERROR(module, line, 525 ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
528 ("acpi_ut_free: Attempt to delete a NULL address\n"));
529 526
530 return_VOID; 527 return_VOID;
531 } 528 }
@@ -540,14 +537,11 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
540 status = acpi_ut_remove_allocation(debug_block, 537 status = acpi_ut_remove_allocation(debug_block,
541 component, module, line); 538 component, module, line);
542 if (ACPI_FAILURE(status)) { 539 if (ACPI_FAILURE(status)) {
543 ACPI_REPORT_ERROR(("Could not free memory, %s\n", 540 ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
544 acpi_format_exception(status)));
545 } 541 }
546 542
547 acpi_os_free(debug_block); 543 acpi_os_free(debug_block);
548
549 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation)); 544 ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
550
551 return_VOID; 545 return_VOID;
552} 546}
553 547
@@ -624,10 +618,12 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
624 */ 618 */
625 element = acpi_ut_find_allocation(allocation); 619 element = acpi_ut_find_allocation(allocation);
626 if (element) { 620 if (element) {
627 ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation)); 621 ACPI_ERROR((AE_INFO,
622 "ut_track_allocation: Allocation already present in list! (%p)",
623 allocation));
628 624
629 ACPI_REPORT_ERROR(("Element %p Address %p\n", 625 ACPI_ERROR((AE_INFO, "Element %p Address %p",
630 element, allocation)); 626 element, allocation));
631 627
632 goto unlock_and_exit; 628 goto unlock_and_exit;
633 } 629 }
@@ -687,8 +683,8 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
687 if (NULL == mem_list->list_head) { 683 if (NULL == mem_list->list_head) {
688 /* No allocations! */ 684 /* No allocations! */
689 685
690 _ACPI_REPORT_ERROR(module, line, 686 ACPI_ERROR((module, line,
691 ("ut_remove_allocation: Empty allocation list, nothing to free!\n")); 687 "Empty allocation list, nothing to free!"));
692 688
693 return_ACPI_STATUS(AE_OK); 689 return_ACPI_STATUS(AE_OK);
694 } 690 }
@@ -863,10 +859,11 @@ void acpi_ut_dump_allocations(u32 component, char *module)
863 /* Print summary */ 859 /* Print summary */
864 860
865 if (!num_outstanding) { 861 if (!num_outstanding) {
866 ACPI_REPORT_INFO(("No outstanding allocations\n")); 862 ACPI_INFO((AE_INFO, "No outstanding allocations"));
867 } else { 863 } else {
868 ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n", 864 ACPI_ERROR((AE_INFO,
869 num_outstanding, num_outstanding)); 865 "%d(%X) Outstanding allocations",
866 num_outstanding, num_outstanding));
870 } 867 }
871 868
872 return_VOID; 869 return_VOID;
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 1a4da006822a..df2d32096b72 100644
--- a/drivers/acpi/utilities/utcopy.c
+++ b/drivers/acpi/utilities/utcopy.c
@@ -606,7 +606,8 @@ acpi_ut_copy_eobject_to_iobject(union acpi_object *external_object,
606 /* 606 /*
607 * Packages as external input to control methods are not supported, 607 * Packages as external input to control methods are not supported,
608 */ 608 */
609 ACPI_REPORT_ERROR(("Packages as parameters not implemented!\n")); 609 ACPI_ERROR((AE_INFO,
610 "Packages as parameters not implemented!"));
610 611
611 return_ACPI_STATUS(AE_NOT_IMPLEMENTED); 612 return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
612 } 613 }
@@ -869,7 +870,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
869 count + 870 count +
870 1) * sizeof(void *)); 871 1) * sizeof(void *));
871 if (!dest_obj->package.elements) { 872 if (!dest_obj->package.elements) {
872 ACPI_REPORT_ERROR(("Package allocation failure\n")); 873 ACPI_ERROR((AE_INFO, "Package allocation failure"));
873 return_ACPI_STATUS(AE_NO_MEMORY); 874 return_ACPI_STATUS(AE_NO_MEMORY);
874 } 875 }
875 876
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 1079a1a1f195..1db9695b0029 100644
--- a/drivers/acpi/utilities/utdelete.c
+++ b/drivers/acpi/utilities/utdelete.c
@@ -363,7 +363,7 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
363 363
364 default: 364 default:
365 365
366 ACPI_REPORT_ERROR(("Unknown action (%X)\n", action)); 366 ACPI_ERROR((AE_INFO, "Unknown action (%X)", action));
367 break; 367 break;
368 } 368 }
369 369
@@ -373,7 +373,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
373 */ 373 */
374 if (count > ACPI_MAX_REFERENCE_COUNT) { 374 if (count > ACPI_MAX_REFERENCE_COUNT) {
375 375
376 ACPI_REPORT_WARNING(("Large Reference Count (%X) in object %p\n\n", count, object)); 376 ACPI_WARNING((AE_INFO,
377 "Large Reference Count (%X) in object %p",
378 count, object));
377 } 379 }
378 380
379 return; 381 return;
@@ -532,8 +534,8 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
532 534
533 error_exit: 535 error_exit:
534 536
535 ACPI_REPORT_ERROR(("Could not update object reference count, %s\n", 537 ACPI_EXCEPTION((AE_INFO, status,
536 acpi_format_exception(status))); 538 "Could not update object reference count"));
537 539
538 return_ACPI_STATUS(status); 540 return_ACPI_STATUS(status);
539} 541}
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index f4dc374a0eec..106cc97cb4af 100644
--- a/drivers/acpi/utilities/uteval.c
+++ b/drivers/acpi/utilities/uteval.c
@@ -154,8 +154,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
154 acpi_ut_get_node_name(prefix_node), 154 acpi_ut_get_node_name(prefix_node),
155 path)); 155 path));
156 } else { 156 } else {
157 ACPI_REPORT_MTERROR("Method execution failed", 157 ACPI_ERROR_METHOD("Method execution failed",
158 prefix_node, path, status); 158 prefix_node, path, status);
159 } 159 }
160 160
161 return_ACPI_STATUS(status); 161 return_ACPI_STATUS(status);
@@ -165,8 +165,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
165 165
166 if (!info.return_object) { 166 if (!info.return_object) {
167 if (expected_return_btypes) { 167 if (expected_return_btypes) {
168 ACPI_REPORT_MTERROR("No object was returned from", 168 ACPI_ERROR_METHOD("No object was returned from",
169 prefix_node, path, AE_NOT_EXIST); 169 prefix_node, path, AE_NOT_EXIST);
170 170
171 return_ACPI_STATUS(AE_NOT_EXIST); 171 return_ACPI_STATUS(AE_NOT_EXIST);
172 } 172 }
@@ -211,10 +211,14 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
211 /* Is the return object one of the expected types? */ 211 /* Is the return object one of the expected types? */
212 212
213 if (!(expected_return_btypes & return_btype)) { 213 if (!(expected_return_btypes & return_btype)) {
214 ACPI_REPORT_MTERROR("Return object type is incorrect", 214 ACPI_ERROR_METHOD("Return object type is incorrect",
215 prefix_node, path, AE_TYPE); 215 prefix_node, path, AE_TYPE);
216 216
217 ACPI_REPORT_ERROR(("Type returned from %s was incorrect: %s, expected Btypes: %X\n", path, acpi_ut_get_object_type_name(info.return_object), expected_return_btypes)); 217 ACPI_ERROR((AE_INFO,
218 "Type returned from %s was incorrect: %s, expected Btypes: %X",
219 path,
220 acpi_ut_get_object_type_name(info.return_object),
221 expected_return_btypes));
218 222
219 /* On error exit, we must delete the return object */ 223 /* On error exit, we must delete the return object */
220 224
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 87ca9a0a8b76..ffd13383a325 100644
--- a/drivers/acpi/utilities/utglobal.c
+++ b/drivers/acpi/utilities/utglobal.c
@@ -121,8 +121,8 @@ const char *acpi_format_exception(acpi_status status)
121 if (!exception) { 121 if (!exception) {
122 /* Exception code was not recognized */ 122 /* Exception code was not recognized */
123 123
124 ACPI_REPORT_ERROR(("Unknown exception code: 0x%8.8X\n", 124 ACPI_ERROR((AE_INFO,
125 status)); 125 "Unknown exception code: 0x%8.8X", status));
126 126
127 exception = "UNKNOWN_STATUS_CODE"; 127 exception = "UNKNOWN_STATUS_CODE";
128 } 128 }
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index 7565ba6f90d5..ba771b4f39bc 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -72,9 +72,9 @@ static void
72acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset) 72acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset)
73{ 73{
74 74
75 ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n", 75 ACPI_WARNING((AE_INFO,
76 register_name, value, (u32) offset, 76 "Invalid FADT value %s=%X at offset %X FADT=%p",
77 acpi_gbl_FADT)); 77 register_name, value, (u32) offset, acpi_gbl_FADT));
78} 78}
79 79
80/****************************************************************************** 80/******************************************************************************
@@ -221,7 +221,7 @@ void acpi_ut_subsystem_shutdown(void)
221 /* Just exit if subsystem is already shutdown */ 221 /* Just exit if subsystem is already shutdown */
222 222
223 if (acpi_gbl_shutdown) { 223 if (acpi_gbl_shutdown) {
224 ACPI_REPORT_ERROR(("ACPI Subsystem is already terminated\n")); 224 ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
225 return_VOID; 225 return_VOID;
226 } 226 }
227 227
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
index 06214201329d..4a3360484e72 100644
--- a/drivers/acpi/utilities/utmath.c
+++ b/drivers/acpi/utilities/utmath.c
@@ -82,7 +82,7 @@ acpi_ut_short_divide(acpi_integer dividend,
82 /* Always check for a zero divisor */ 82 /* Always check for a zero divisor */
83 83
84 if (divisor == 0) { 84 if (divisor == 0) {
85 ACPI_REPORT_ERROR(("Divide by zero\n")); 85 ACPI_ERROR((AE_INFO, "Divide by zero"));
86 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 86 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
87 } 87 }
88 88
@@ -144,7 +144,7 @@ acpi_ut_divide(acpi_integer in_dividend,
144 /* Always check for a zero divisor */ 144 /* Always check for a zero divisor */
145 145
146 if (in_divisor == 0) { 146 if (in_divisor == 0) {
147 ACPI_REPORT_ERROR(("Divide by zero\n")); 147 ACPI_ERROR((AE_INFO, "Divide by zero"));
148 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 148 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
149 } 149 }
150 150
@@ -266,7 +266,7 @@ acpi_ut_short_divide(acpi_integer in_dividend,
266 /* Always check for a zero divisor */ 266 /* Always check for a zero divisor */
267 267
268 if (divisor == 0) { 268 if (divisor == 0) {
269 ACPI_REPORT_ERROR(("Divide by zero\n")); 269 ACPI_ERROR((AE_INFO, "Divide by zero"));
270 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 270 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
271 } 271 }
272 272
@@ -292,7 +292,7 @@ acpi_ut_divide(acpi_integer in_dividend,
292 /* Always check for a zero divisor */ 292 /* Always check for a zero divisor */
293 293
294 if (in_divisor == 0) { 294 if (in_divisor == 0) {
295 ACPI_REPORT_ERROR(("Divide by zero\n")); 295 ACPI_ERROR((AE_INFO, "Divide by zero"));
296 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO); 296 return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
297 } 297 }
298 298
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index a77ffcd5570f..7364f5f8c9cd 100644
--- a/drivers/acpi/utilities/utmisc.c
+++ b/drivers/acpi/utilities/utmisc.c
@@ -72,8 +72,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
72 /* Guard against multiple allocations of ID to the same location */ 72 /* Guard against multiple allocations of ID to the same location */
73 73
74 if (*owner_id) { 74 if (*owner_id) {
75 ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n", 75 ACPI_ERROR((AE_INFO, "Owner ID [%2.2X] already exists",
76 *owner_id)); 76 *owner_id));
77 return_ACPI_STATUS(AE_ALREADY_EXISTS); 77 return_ACPI_STATUS(AE_ALREADY_EXISTS);
78 } 78 }
79 79
@@ -143,7 +143,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
143 * methods, or there may be a bug where the IDs are not released. 143 * methods, or there may be a bug where the IDs are not released.
144 */ 144 */
145 status = AE_OWNER_ID_LIMIT; 145 status = AE_OWNER_ID_LIMIT;
146 ACPI_REPORT_ERROR(("Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT\n")); 146 ACPI_ERROR((AE_INFO,
147 "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT"));
147 148
148 exit: 149 exit:
149 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 150 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -180,7 +181,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
180 /* Zero is not a valid owner_iD */ 181 /* Zero is not a valid owner_iD */
181 182
182 if (owner_id == 0) { 183 if (owner_id == 0) {
183 ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id)); 184 ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id));
184 return_VOID; 185 return_VOID;
185 } 186 }
186 187
@@ -205,8 +206,9 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
205 if (acpi_gbl_owner_id_mask[index] & bit) { 206 if (acpi_gbl_owner_id_mask[index] & bit) {
206 acpi_gbl_owner_id_mask[index] ^= bit; 207 acpi_gbl_owner_id_mask[index] ^= bit;
207 } else { 208 } else {
208 ACPI_REPORT_ERROR(("Release of non-allocated owner_id: %2.2X\n", 209 ACPI_ERROR((AE_INFO,
209 owner_id + 1)); 210 "Release of non-allocated owner_id: %2.2X",
211 owner_id + 1));
210 } 212 }
211 213
212 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); 214 (void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -837,55 +839,95 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
837 839
838/******************************************************************************* 840/*******************************************************************************
839 * 841 *
840 * FUNCTION: acpi_ut_report_error 842 * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
841 * 843 *
842 * PARAMETERS: module_name - Caller's module name (for error output) 844 * PARAMETERS: module_name - Caller's module name (for error output)
843 * line_number - Caller's line number (for error output) 845 * line_number - Caller's line number (for error output)
846 * Format - Printf format string + additional args
844 * 847 *
845 * RETURN: None 848 * RETURN: None
846 * 849 *
847 * DESCRIPTION: Print error message 850 * DESCRIPTION: Print message with module/line/version info
848 * 851 *
849 ******************************************************************************/ 852 ******************************************************************************/
850 853
851void acpi_ut_report_error(char *module_name, u32 line_number) 854void ACPI_INTERNAL_VAR_XFACE
855acpi_ut_error(char *module_name, u32 line_number, char *format, ...)
852{ 856{
857 va_list args;
853 858
854 acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number); 859 acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
860
861 va_start(args, format);
862 acpi_os_vprintf(format, args);
863 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
855} 864}
856 865
857/******************************************************************************* 866void ACPI_INTERNAL_VAR_XFACE
858 * 867acpi_ut_exception(char *module_name,
859 * FUNCTION: acpi_ut_report_warning 868 u32 line_number, acpi_status status, char *format, ...)
860 * 869{
861 * PARAMETERS: module_name - Caller's module name (for error output) 870 va_list args;
862 * line_number - Caller's line number (for error output)
863 *
864 * RETURN: None
865 *
866 * DESCRIPTION: Print warning message
867 *
868 ******************************************************************************/
869 871
870void acpi_ut_report_warning(char *module_name, u32 line_number) 872 acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name,
873 line_number, acpi_format_exception(status));
874
875 va_start(args, format);
876 acpi_os_vprintf(format, args);
877 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
878}
879
880void ACPI_INTERNAL_VAR_XFACE
881acpi_ut_warning(char *module_name, u32 line_number, char *format, ...)
871{ 882{
883 va_list args;
872 884
873 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number); 885 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
886
887 va_start(args, format);
888 acpi_os_vprintf(format, args);
889 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
890}
891
892void ACPI_INTERNAL_VAR_XFACE
893acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
894{
895 va_list args;
896
897 acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
898
899 va_start(args, format);
900 acpi_os_vprintf(format, args);
901 acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
874} 902}
875 903
876/******************************************************************************* 904/*******************************************************************************
877 * 905 *
878 * FUNCTION: acpi_ut_report_info 906 * FUNCTION: acpi_ut_report_error, Warning, Info
879 * 907 *
880 * PARAMETERS: module_name - Caller's module name (for error output) 908 * PARAMETERS: module_name - Caller's module name (for error output)
881 * line_number - Caller's line number (for error output) 909 * line_number - Caller's line number (for error output)
882 * 910 *
883 * RETURN: None 911 * RETURN: None
884 * 912 *
885 * DESCRIPTION: Print information message 913 * DESCRIPTION: Print error message
914 *
915 * Note: Legacy only, should be removed when no longer used by drivers.
886 * 916 *
887 ******************************************************************************/ 917 ******************************************************************************/
888 918
919void acpi_ut_report_error(char *module_name, u32 line_number)
920{
921
922 acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
923}
924
925void acpi_ut_report_warning(char *module_name, u32 line_number)
926{
927
928 acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
929}
930
889void acpi_ut_report_info(char *module_name, u32 line_number) 931void acpi_ut_report_info(char *module_name, u32 line_number)
890{ 932{
891 933
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index ffaff55270b1..45a7244df924 100644
--- a/drivers/acpi/utilities/utmutex.c
+++ b/drivers/acpi/utilities/utmutex.c
@@ -216,12 +216,20 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
216 for (i = mutex_id; i < MAX_MUTEX; i++) { 216 for (i = mutex_id; i < MAX_MUTEX; i++) {
217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) { 217 if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
218 if (i == mutex_id) { 218 if (i == mutex_id) {
219 ACPI_REPORT_ERROR(("Mutex [%s] already acquired by this thread [%X]\n", acpi_ut_get_mutex_name(mutex_id), this_thread_id)); 219 ACPI_ERROR((AE_INFO,
220 "Mutex [%s] already acquired by this thread [%X]",
221 acpi_ut_get_mutex_name
222 (mutex_id),
223 this_thread_id));
220 224
221 return (AE_ALREADY_ACQUIRED); 225 return (AE_ALREADY_ACQUIRED);
222 } 226 }
223 227
224 ACPI_REPORT_ERROR(("Invalid acquire order: Thread %X owns [%s], wants [%s]\n", this_thread_id, acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); 228 ACPI_ERROR((AE_INFO,
229 "Invalid acquire order: Thread %X owns [%s], wants [%s]",
230 this_thread_id,
231 acpi_ut_get_mutex_name(i),
232 acpi_ut_get_mutex_name(mutex_id)));
225 233
226 return (AE_ACQUIRE_DEADLOCK); 234 return (AE_ACQUIRE_DEADLOCK);
227 } 235 }
@@ -244,7 +252,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
244 acpi_gbl_mutex_info[mutex_id].use_count++; 252 acpi_gbl_mutex_info[mutex_id].use_count++;
245 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id; 253 acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
246 } else { 254 } else {
247 ACPI_REPORT_ERROR(("Thread %X could not acquire Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); 255 ACPI_EXCEPTION((AE_INFO, status,
256 "Thread %X could not acquire Mutex [%X]",
257 this_thread_id, mutex_id));
248 } 258 }
249 259
250 return (status); 260 return (status);
@@ -282,7 +292,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
282 * Mutex must be acquired in order to release it! 292 * Mutex must be acquired in order to release it!
283 */ 293 */
284 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) { 294 if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
285 ACPI_REPORT_ERROR(("Mutex [%X] is not acquired, cannot release\n", mutex_id)); 295 ACPI_ERROR((AE_INFO,
296 "Mutex [%X] is not acquired, cannot release",
297 mutex_id));
286 298
287 return (AE_NOT_ACQUIRED); 299 return (AE_NOT_ACQUIRED);
288 } 300 }
@@ -303,7 +315,10 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
303 continue; 315 continue;
304 } 316 }
305 317
306 ACPI_REPORT_ERROR(("Invalid release order: owns [%s], releasing [%s]\n", acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id))); 318 ACPI_ERROR((AE_INFO,
319 "Invalid release order: owns [%s], releasing [%s]",
320 acpi_ut_get_mutex_name(i),
321 acpi_ut_get_mutex_name(mutex_id)));
307 322
308 return (AE_RELEASE_DEADLOCK); 323 return (AE_RELEASE_DEADLOCK);
309 } 324 }
@@ -319,7 +334,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
319 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1); 334 acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1);
320 335
321 if (ACPI_FAILURE(status)) { 336 if (ACPI_FAILURE(status)) {
322 ACPI_REPORT_ERROR(("Thread %X could not release Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status))); 337 ACPI_EXCEPTION((AE_INFO, status,
338 "Thread %X could not release Mutex [%X]",
339 this_thread_id, mutex_id));
323 } else { 340 } else {
324 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, 341 ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
325 "Thread %X released Mutex [%s]\n", 342 "Thread %X released Mutex [%s]\n",
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 1b6b21577805..7ee2d1d98071 100644
--- a/drivers/acpi/utilities/utobject.c
+++ b/drivers/acpi/utilities/utobject.c
@@ -177,8 +177,8 @@ union acpi_operand_object *acpi_ut_create_buffer_object(acpi_size buffer_size)
177 177
178 buffer = ACPI_MEM_CALLOCATE(buffer_size); 178 buffer = ACPI_MEM_CALLOCATE(buffer_size);
179 if (!buffer) { 179 if (!buffer) {
180 ACPI_REPORT_ERROR(("Could not allocate size %X\n", 180 ACPI_ERROR((AE_INFO, "Could not allocate size %X",
181 (u32) buffer_size)); 181 (u32) buffer_size));
182 acpi_ut_remove_reference(buffer_desc); 182 acpi_ut_remove_reference(buffer_desc);
183 return_PTR(NULL); 183 return_PTR(NULL);
184 } 184 }
@@ -229,8 +229,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
229 */ 229 */
230 string = ACPI_MEM_CALLOCATE(string_size + 1); 230 string = ACPI_MEM_CALLOCATE(string_size + 1);
231 if (!string) { 231 if (!string) {
232 ACPI_REPORT_ERROR(("Could not allocate size %X\n", 232 ACPI_ERROR((AE_INFO, "Could not allocate size %X",
233 (u32) string_size)); 233 (u32) string_size));
234 acpi_ut_remove_reference(string_desc); 234 acpi_ut_remove_reference(string_desc);
235 return_PTR(NULL); 235 return_PTR(NULL);
236 } 236 }
@@ -312,8 +312,8 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
312 312
313 object = acpi_os_acquire_object(acpi_gbl_operand_cache); 313 object = acpi_os_acquire_object(acpi_gbl_operand_cache);
314 if (!object) { 314 if (!object) {
315 _ACPI_REPORT_ERROR(module_name, line_number, 315 ACPI_ERROR((module_name, line_number,
316 ("Could not allocate an object descriptor\n")); 316 "Could not allocate an object descriptor"));
317 317
318 return_PTR(NULL); 318 return_PTR(NULL);
319 } 319 }
@@ -347,9 +347,9 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
347 /* Object must be an union acpi_operand_object */ 347 /* Object must be an union acpi_operand_object */
348 348
349 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) { 349 if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
350 ACPI_REPORT_ERROR(("%p is not an ACPI Operand object [%s]\n", 350 ACPI_ERROR((AE_INFO,
351 object, 351 "%p is not an ACPI Operand object [%s]", object,
352 acpi_ut_get_descriptor_name(object))); 352 acpi_ut_get_descriptor_name(object)));
353 return_VOID; 353 return_VOID;
354 } 354 }
355 355
@@ -451,7 +451,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
451 * Notably, Locals and Args are not supported, but this may be 451 * Notably, Locals and Args are not supported, but this may be
452 * required eventually. 452 * required eventually.
453 */ 453 */
454 ACPI_REPORT_ERROR(("Unsupported Reference opcode=%X in object %p\n", internal_object->reference.opcode, internal_object)); 454 ACPI_ERROR((AE_INFO,
455 "Unsupported Reference opcode=%X in object %p",
456 internal_object->reference.opcode,
457 internal_object));
455 status = AE_TYPE; 458 status = AE_TYPE;
456 break; 459 break;
457 } 460 }
@@ -459,9 +462,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
459 462
460 default: 463 default:
461 464
462 ACPI_REPORT_ERROR(("Unsupported type=%X in object %p\n", 465 ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p",
463 ACPI_GET_OBJECT_TYPE(internal_object), 466 ACPI_GET_OBJECT_TYPE(internal_object),
464 internal_object)); 467 internal_object));
465 status = AE_TYPE; 468 status = AE_TYPE;
466 break; 469 break;
467 } 470 }
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 36bf9e4bf529..16461317113f 100644
--- a/drivers/acpi/utilities/utresrc.c
+++ b/drivers/acpi/utilities/utresrc.c
@@ -486,6 +486,7 @@ u32 acpi_ut_get_descriptor_length(void *aml)
486 * RETURN: Status, pointer to the end tag 486 * RETURN: Status, pointer to the end tag
487 * 487 *
488 * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template 488 * DESCRIPTION: Find the end_tag resource descriptor in an AML resource template
489 * Note: allows a buffer length of zero.
489 * 490 *
490 ******************************************************************************/ 491 ******************************************************************************/
491 492
@@ -504,6 +505,13 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
504 aml = obj_desc->buffer.pointer; 505 aml = obj_desc->buffer.pointer;
505 end_aml = aml + obj_desc->buffer.length; 506 end_aml = aml + obj_desc->buffer.length;
506 507
508 /* Allow a buffer length of zero */
509
510 if (!obj_desc->buffer.length) {
511 *end_tag = aml;
512 return_ACPI_STATUS(AE_OK);
513 }
514
507 /* Walk the resource template, one descriptor per iteration */ 515 /* Walk the resource template, one descriptor per iteration */
508 516
509 while (aml < end_aml) { 517 while (aml < end_aml) {
@@ -518,6 +526,14 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
518 526
519 if (acpi_ut_get_resource_type(aml) == 527 if (acpi_ut_get_resource_type(aml) ==
520 ACPI_RESOURCE_NAME_END_TAG) { 528 ACPI_RESOURCE_NAME_END_TAG) {
529 /*
530 * There must be at least one more byte in the buffer for
531 * the 2nd byte of the end_tag
532 */
533 if ((aml + 1) >= end_aml) {
534 return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
535 }
536
521 /* Return the pointer to the end_tag */ 537 /* Return the pointer to the end_tag */
522 538
523 *end_tag = aml; 539 *end_tag = aml;
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index b4bc94883200..308a960871be 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -75,8 +75,7 @@ acpi_status acpi_initialize_subsystem(void)
75 75
76 status = acpi_os_initialize(); 76 status = acpi_os_initialize();
77 if (ACPI_FAILURE(status)) { 77 if (ACPI_FAILURE(status)) {
78 ACPI_REPORT_ERROR(("OSL failed to initialize, %s\n", 78 ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
79 acpi_format_exception(status)));
80 return_ACPI_STATUS(status); 79 return_ACPI_STATUS(status);
81 } 80 }
82 81
@@ -88,8 +87,8 @@ acpi_status acpi_initialize_subsystem(void)
88 87
89 status = acpi_ut_mutex_initialize(); 88 status = acpi_ut_mutex_initialize();
90 if (ACPI_FAILURE(status)) { 89 if (ACPI_FAILURE(status)) {
91 ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n", 90 ACPI_EXCEPTION((AE_INFO, status,
92 acpi_format_exception(status))); 91 "During Global Mutex creation"));
93 return_ACPI_STATUS(status); 92 return_ACPI_STATUS(status);
94 } 93 }
95 94
@@ -99,15 +98,14 @@ acpi_status acpi_initialize_subsystem(void)
99 */ 98 */
100 status = acpi_ns_root_initialize(); 99 status = acpi_ns_root_initialize();
101 if (ACPI_FAILURE(status)) { 100 if (ACPI_FAILURE(status)) {
102 ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n", 101 ACPI_EXCEPTION((AE_INFO, status,
103 acpi_format_exception(status))); 102 "During Namespace initialization"));
104 return_ACPI_STATUS(status); 103 return_ACPI_STATUS(status);
105 } 104 }
106 105
107 /* If configured, initialize the AML debugger */ 106 /* If configured, initialize the AML debugger */
108 107
109 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); 108 ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
110
111 return_ACPI_STATUS(status); 109 return_ACPI_STATUS(status);
112} 110}
113 111
@@ -154,7 +152,7 @@ acpi_status acpi_enable_subsystem(u32 flags)
154 152
155 status = acpi_enable(); 153 status = acpi_enable();
156 if (ACPI_FAILURE(status)) { 154 if (ACPI_FAILURE(status)) {
157 ACPI_REPORT_WARNING(("acpi_enable failed\n")); 155 ACPI_WARNING((AE_INFO, "acpi_enable failed"));
158 return_ACPI_STATUS(status); 156 return_ACPI_STATUS(status);
159 } 157 }
160 } 158 }