aboutsummaryrefslogtreecommitdiff
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 0efcbdf7e62..03b0044974c 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)
/* Check for an inadvertent size of zero bytes */
if (!size) {
- _ACPI_REPORT_ERROR(module, line,
- ("ut_allocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
+ ACPI_ERROR((module, line,
+ "ut_allocate: Attempt to allocate zero bytes, allocating 1 byte"));
size = 1;
}
@@ -310,9 +310,9 @@ void *acpi_ut_allocate(acpi_size size, u32 component, char *module, u32 line)
if (!allocation) {
/* Report allocation error */
- _ACPI_REPORT_ERROR(module, line,
- ("ut_allocate: Could not allocate size %X\n",
- (u32) size));
+ ACPI_ERROR((module, line,
+ "ut_allocate: Could not allocate size %X",
+ (u32) size));
return_PTR(NULL);
}
@@ -344,8 +344,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
/* Check for an inadvertent size of zero bytes */
if (!size) {
- _ACPI_REPORT_ERROR(module, line,
- ("ut_callocate: Attempt to allocate zero bytes, allocating 1 byte\n"));
+ ACPI_ERROR((module, line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
size = 1;
}
@@ -353,9 +353,8 @@ void *acpi_ut_callocate(acpi_size size, u32 component, char *module, u32 line)
if (!allocation) {
/* Report allocation error */
- _ACPI_REPORT_ERROR(module, line,
- ("ut_callocate: Could not allocate size %X\n",
- (u32) size));
+ ACPI_ERROR((module, line,
+ "Could not allocate size %X", (u32) size));
return_PTR(NULL);
}
@@ -480,9 +479,8 @@ void *acpi_ut_callocate_and_track(acpi_size size,
if (!allocation) {
/* Report allocation error */
- _ACPI_REPORT_ERROR(module, line,
- ("ut_callocate: Could not allocate size %X\n",
- (u32) size));
+ ACPI_ERROR((module, line,
+ "Could not allocate size %X", (u32) size));
return (NULL);
}
@@ -524,8 +522,7 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
ACPI_FUNCTION_TRACE_PTR("ut_free", allocation);
if (NULL == allocation) {
- _ACPI_REPORT_ERROR(module, line,
- ("acpi_ut_free: Attempt to delete a NULL address\n"));
+ ACPI_ERROR((module, line, "Attempt to delete a NULL address"));
return_VOID;
}
@@ -540,14 +537,11 @@ acpi_ut_free_and_track(void *allocation, u32 component, char *module, u32 line)
status = acpi_ut_remove_allocation(debug_block,
component, module, line);
if (ACPI_FAILURE(status)) {
- ACPI_REPORT_ERROR(("Could not free memory, %s\n",
- acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status, "Could not free memory"));
}
acpi_os_free(debug_block);
-
ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p freed\n", allocation));
-
return_VOID;
}
@@ -624,10 +618,12 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation,
*/
element = acpi_ut_find_allocation(allocation);
if (element) {
- ACPI_REPORT_ERROR(("ut_track_allocation: Allocation already present in list! (%p)\n", allocation));
+ ACPI_ERROR((AE_INFO,
+ "ut_track_allocation: Allocation already present in list! (%p)",
+ allocation));
- ACPI_REPORT_ERROR(("Element %p Address %p\n",
- element, allocation));
+ ACPI_ERROR((AE_INFO, "Element %p Address %p",
+ element, allocation));
goto unlock_and_exit;
}
@@ -687,8 +683,8 @@ acpi_ut_remove_allocation(struct acpi_debug_mem_block *allocation,
if (NULL == mem_list->list_head) {
/* No allocations! */
- _ACPI_REPORT_ERROR(module, line,
- ("ut_remove_allocation: Empty allocation list, nothing to free!\n"));
+ ACPI_ERROR((module, line,
+ "Empty allocation list, nothing to free!"));
return_ACPI_STATUS(AE_OK);
}
@@ -863,10 +859,11 @@ void acpi_ut_dump_allocations(u32 component, char *module)
/* Print summary */
if (!num_outstanding) {
- ACPI_REPORT_INFO(("No outstanding allocations\n"));
+ ACPI_INFO((AE_INFO, "No outstanding allocations"));
} else {
- ACPI_REPORT_ERROR(("%d(%X) Outstanding allocations\n",
- num_outstanding, num_outstanding));
+ ACPI_ERROR((AE_INFO,
+ "%d(%X) Outstanding allocations",
+ num_outstanding, num_outstanding));
}
return_VOID;
diff --git a/drivers/acpi/utilities/utcopy.c b/drivers/acpi/utilities/utcopy.c
index 1a4da006822..df2d32096b7 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,
/*
* Packages as external input to control methods are not supported,
*/
- ACPI_REPORT_ERROR(("Packages as parameters not implemented!\n"));
+ ACPI_ERROR((AE_INFO,
+ "Packages as parameters not implemented!"));
return_ACPI_STATUS(AE_NOT_IMPLEMENTED);
}
@@ -869,7 +870,7 @@ acpi_ut_copy_ipackage_to_ipackage(union acpi_operand_object *source_obj,
count +
1) * sizeof(void *));
if (!dest_obj->package.elements) {
- ACPI_REPORT_ERROR(("Package allocation failure\n"));
+ ACPI_ERROR((AE_INFO, "Package allocation failure"));
return_ACPI_STATUS(AE_NO_MEMORY);
}
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c
index 1079a1a1f19..1db9695b002 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)
default:
- ACPI_REPORT_ERROR(("Unknown action (%X)\n", action));
+ ACPI_ERROR((AE_INFO, "Unknown action (%X)", action));
break;
}
@@ -373,7 +373,9 @@ acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action)
*/
if (count > ACPI_MAX_REFERENCE_COUNT) {
- ACPI_REPORT_WARNING(("Large Reference Count (%X) in object %p\n\n", count, object));
+ ACPI_WARNING((AE_INFO,
+ "Large Reference Count (%X) in object %p",
+ count, object));
}
return;
@@ -532,8 +534,8 @@ acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action)
error_exit:
- ACPI_REPORT_ERROR(("Could not update object reference count, %s\n",
- acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status,
+ "Could not update object reference count"));
return_ACPI_STATUS(status);
}
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c
index f4dc374a0ee..106cc97cb4a 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,
acpi_ut_get_node_name(prefix_node),
path));
} else {
- ACPI_REPORT_MTERROR("Method execution failed",
- prefix_node, path, status);
+ ACPI_ERROR_METHOD("Method execution failed",
+ prefix_node, path, status);
}
return_ACPI_STATUS(status);
@@ -165,8 +165,8 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
if (!info.return_object) {
if (expected_return_btypes) {
- ACPI_REPORT_MTERROR("No object was returned from",
- prefix_node, path, AE_NOT_EXIST);
+ ACPI_ERROR_METHOD("No object was returned from",
+ prefix_node, path, AE_NOT_EXIST);
return_ACPI_STATUS(AE_NOT_EXIST);
}
@@ -211,10 +211,14 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node,
/* Is the return object one of the expected types? */
if (!(expected_return_btypes & return_btype)) {
- ACPI_REPORT_MTERROR("Return object type is incorrect",
- prefix_node, path, AE_TYPE);
-
- 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));
+ ACPI_ERROR_METHOD("Return object type is incorrect",
+ prefix_node, path, AE_TYPE);
+
+ ACPI_ERROR((AE_INFO,
+ "Type returned from %s was incorrect: %s, expected Btypes: %X",
+ path,
+ acpi_ut_get_object_type_name(info.return_object),
+ expected_return_btypes));
/* On error exit, we must delete the return object */
diff --git a/drivers/acpi/utilities/utglobal.c b/drivers/acpi/utilities/utglobal.c
index 87ca9a0a8b7..ffd13383a32 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)
if (!exception) {
/* Exception code was not recognized */
- ACPI_REPORT_ERROR(("Unknown exception code: 0x%8.8X\n",
- status));
+ ACPI_ERROR((AE_INFO,
+ "Unknown exception code: 0x%8.8X", status));
exception = "UNKNOWN_STATUS_CODE";
}
diff --git a/drivers/acpi/utilities/utinit.c b/drivers/acpi/utilities/utinit.c
index 7565ba6f90d..ba771b4f39b 100644
--- a/drivers/acpi/utilities/utinit.c
+++ b/drivers/acpi/utilities/utinit.c
@@ -72,9 +72,9 @@ static void
acpi_ut_fadt_register_error(char *register_name, u32 value, acpi_size offset)
{
- ACPI_REPORT_WARNING(("Invalid FADT value %s=%X at offset %X FADT=%p\n",
- register_name, value, (u32) offset,
- acpi_gbl_FADT));
+ ACPI_WARNING((AE_INFO,
+ "Invalid FADT value %s=%X at offset %X FADT=%p",
+ register_name, value, (u32) offset, acpi_gbl_FADT));
}
/******************************************************************************
@@ -221,7 +221,7 @@ void acpi_ut_subsystem_shutdown(void)
/* Just exit if subsystem is already shutdown */
if (acpi_gbl_shutdown) {
- ACPI_REPORT_ERROR(("ACPI Subsystem is already terminated\n"));
+ ACPI_ERROR((AE_INFO, "ACPI Subsystem is already terminated"));
return_VOID;
}
diff --git a/drivers/acpi/utilities/utmath.c b/drivers/acpi/utilities/utmath.c
index 06214201329..4a3360484e7 100644
--- a/drivers/acpi/utilities/utmath.c
+++ b/drivers/acpi/utilities/utmath.c
@@ -82,7 +82,7 @@ acpi_ut_short_divide(acpi_integer dividend,
/* Always check for a zero divisor */
if (divisor == 0) {
- ACPI_REPORT_ERROR(("Divide by zero\n"));
+ ACPI_ERROR((AE_INFO, "Divide by zero"));
return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
}
@@ -144,7 +144,7 @@ acpi_ut_divide(acpi_integer in_dividend,
/* Always check for a zero divisor */
if (in_divisor == 0) {
- ACPI_REPORT_ERROR(("Divide by zero\n"));
+ ACPI_ERROR((AE_INFO, "Divide by zero"));
return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
}
@@ -266,7 +266,7 @@ acpi_ut_short_divide(acpi_integer in_dividend,
/* Always check for a zero divisor */
if (divisor == 0) {
- ACPI_REPORT_ERROR(("Divide by zero\n"));
+ ACPI_ERROR((AE_INFO, "Divide by zero"));
return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
}
@@ -292,7 +292,7 @@ acpi_ut_divide(acpi_integer in_dividend,
/* Always check for a zero divisor */
if (in_divisor == 0) {
- ACPI_REPORT_ERROR(("Divide by zero\n"));
+ ACPI_ERROR((AE_INFO, "Divide by zero"));
return_ACPI_STATUS(AE_AML_DIVIDE_BY_ZERO);
}
diff --git a/drivers/acpi/utilities/utmisc.c b/drivers/acpi/utilities/utmisc.c
index a77ffcd5570..7364f5f8c9c 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)
/* Guard against multiple allocations of ID to the same location */
if (*owner_id) {
- ACPI_REPORT_ERROR(("Owner ID [%2.2X] already exists\n",
- *owner_id));
+ ACPI_ERROR((AE_INFO, "Owner ID [%2.2X] already exists",
+ *owner_id));
return_ACPI_STATUS(AE_ALREADY_EXISTS);
}
@@ -143,7 +143,8 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id)
* methods, or there may be a bug where the IDs are not released.
*/
status = AE_OWNER_ID_LIMIT;
- ACPI_REPORT_ERROR(("Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT\n"));
+ ACPI_ERROR((AE_INFO,
+ "Could not allocate new owner_id (255 max), AE_OWNER_ID_LIMIT"));
exit:
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -180,7 +181,7 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
/* Zero is not a valid owner_iD */
if (owner_id == 0) {
- ACPI_REPORT_ERROR(("Invalid owner_id: %2.2X\n", owner_id));
+ ACPI_ERROR((AE_INFO, "Invalid owner_id: %2.2X", owner_id));
return_VOID;
}
@@ -205,8 +206,9 @@ void acpi_ut_release_owner_id(acpi_owner_id * owner_id_ptr)
if (acpi_gbl_owner_id_mask[index] & bit) {
acpi_gbl_owner_id_mask[index] ^= bit;
} else {
- ACPI_REPORT_ERROR(("Release of non-allocated owner_id: %2.2X\n",
- owner_id + 1));
+ ACPI_ERROR((AE_INFO,
+ "Release of non-allocated owner_id: %2.2X",
+ owner_id + 1));
}
(void)acpi_ut_release_mutex(ACPI_MTX_CACHES);
@@ -837,55 +839,95 @@ u8 acpi_ut_generate_checksum(u8 * buffer, u32 length)
/*******************************************************************************
*
- * FUNCTION: acpi_ut_report_error
+ * FUNCTION: acpi_ut_error, acpi_ut_warning, acpi_ut_info
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
+ * Format - Printf format string + additional args
*
* RETURN: None
*
- * DESCRIPTION: Print error message
+ * DESCRIPTION: Print message with module/line/version info
*
******************************************************************************/
-void acpi_ut_report_error(char *module_name, u32 line_number)
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_error(char *module_name, u32 line_number, char *format, ...)
{
+ va_list args;
acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
+
+ va_start(args, format);
+ acpi_os_vprintf(format, args);
+ acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
}
-/*******************************************************************************
- *
- * FUNCTION: acpi_ut_report_warning
- *
- * PARAMETERS: module_name - Caller's module name (for error output)
- * line_number - Caller's line number (for error output)
- *
- * RETURN: None
- *
- * DESCRIPTION: Print warning message
- *
- ******************************************************************************/
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_exception(char *module_name,
+ u32 line_number, acpi_status status, char *format, ...)
+{
+ va_list args;
-void acpi_ut_report_warning(char *module_name, u32 line_number)
+ acpi_os_printf("ACPI Exception (%s-%04d): %s, ", module_name,
+ line_number, acpi_format_exception(status));
+
+ va_start(args, format);
+ acpi_os_vprintf(format, args);
+ acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
+}
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_warning(char *module_name, u32 line_number, char *format, ...)
{
+ va_list args;
acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
+
+ va_start(args, format);
+ acpi_os_vprintf(format, args);
+ acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
+}
+
+void ACPI_INTERNAL_VAR_XFACE
+acpi_ut_info(char *module_name, u32 line_number, char *format, ...)
+{
+ va_list args;
+
+ acpi_os_printf("ACPI (%s-%04d): ", module_name, line_number);
+
+ va_start(args, format);
+ acpi_os_vprintf(format, args);
+ acpi_os_printf(" [%X]\n", ACPI_CA_VERSION);
}
/*******************************************************************************
*
- * FUNCTION: acpi_ut_report_info
+ * FUNCTION: acpi_ut_report_error, Warning, Info
*
* PARAMETERS: module_name - Caller's module name (for error output)
* line_number - Caller's line number (for error output)
*
* RETURN: None
*
- * DESCRIPTION: Print information message
+ * DESCRIPTION: Print error message
+ *
+ * Note: Legacy only, should be removed when no longer used by drivers.
*
******************************************************************************/
+void acpi_ut_report_error(char *module_name, u32 line_number)
+{
+
+ acpi_os_printf("ACPI Error (%s-%04d): ", module_name, line_number);
+}
+
+void acpi_ut_report_warning(char *module_name, u32 line_number)
+{
+
+ acpi_os_printf("ACPI Warning (%s-%04d): ", module_name, line_number);
+}
+
void acpi_ut_report_info(char *module_name, u32 line_number)
{
diff --git a/drivers/acpi/utilities/utmutex.c b/drivers/acpi/utilities/utmutex.c
index ffaff55270b..45a7244df92 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)
for (i = mutex_id; i < MAX_MUTEX; i++) {
if (acpi_gbl_mutex_info[i].thread_id == this_thread_id) {
if (i == mutex_id) {
- ACPI_REPORT_ERROR(("Mutex [%s] already acquired by this thread [%X]\n", acpi_ut_get_mutex_name(mutex_id), this_thread_id));
+ ACPI_ERROR((AE_INFO,
+ "Mutex [%s] already acquired by this thread [%X]",
+ acpi_ut_get_mutex_name
+ (mutex_id),
+ this_thread_id));
return (AE_ALREADY_ACQUIRED);
}
- 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)));
+ ACPI_ERROR((AE_INFO,
+ "Invalid acquire order: Thread %X owns [%s], wants [%s]",
+ this_thread_id,
+ acpi_ut_get_mutex_name(i),
+ acpi_ut_get_mutex_name(mutex_id)));
return (AE_ACQUIRE_DEADLOCK);
}
@@ -244,7 +252,9 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
acpi_gbl_mutex_info[mutex_id].use_count++;
acpi_gbl_mutex_info[mutex_id].thread_id = this_thread_id;
} else {
- ACPI_REPORT_ERROR(("Thread %X could not acquire Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status,
+ "Thread %X could not acquire Mutex [%X]",
+ this_thread_id, mutex_id));
}
return (status);
@@ -282,7 +292,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
* Mutex must be acquired in order to release it!
*/
if (acpi_gbl_mutex_info[mutex_id].thread_id == ACPI_MUTEX_NOT_ACQUIRED) {
- ACPI_REPORT_ERROR(("Mutex [%X] is not acquired, cannot release\n", mutex_id));
+ ACPI_ERROR((AE_INFO,
+ "Mutex [%X] is not acquired, cannot release",
+ mutex_id));
return (AE_NOT_ACQUIRED);
}
@@ -303,7 +315,10 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
continue;
}
- ACPI_REPORT_ERROR(("Invalid release order: owns [%s], releasing [%s]\n", acpi_ut_get_mutex_name(i), acpi_ut_get_mutex_name(mutex_id)));
+ ACPI_ERROR((AE_INFO,
+ "Invalid release order: owns [%s], releasing [%s]",
+ acpi_ut_get_mutex_name(i),
+ acpi_ut_get_mutex_name(mutex_id)));
return (AE_RELEASE_DEADLOCK);
}
@@ -319,7 +334,9 @@ acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
acpi_os_signal_semaphore(acpi_gbl_mutex_info[mutex_id].mutex, 1);
if (ACPI_FAILURE(status)) {
- ACPI_REPORT_ERROR(("Thread %X could not release Mutex [%X] %s\n", this_thread_id, mutex_id, acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status,
+ "Thread %X could not release Mutex [%X]",
+ this_thread_id, mutex_id));
} else {
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
"Thread %X released Mutex [%s]\n",
diff --git a/drivers/acpi/utilities/utobject.c b/drivers/acpi/utilities/utobject.c
index 1b6b2157780..7ee2d1d9807 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)
buffer = ACPI_MEM_CALLOCATE(buffer_size);
if (!buffer) {
- ACPI_REPORT_ERROR(("Could not allocate size %X\n",
- (u32) buffer_size));
+ ACPI_ERROR((AE_INFO, "Could not allocate size %X",
+ (u32) buffer_size));
acpi_ut_remove_reference(buffer_desc);
return_PTR(NULL);
}
@@ -229,8 +229,8 @@ union acpi_operand_object *acpi_ut_create_string_object(acpi_size string_size)
*/
string = ACPI_MEM_CALLOCATE(string_size + 1);
if (!string) {
- ACPI_REPORT_ERROR(("Could not allocate size %X\n",
- (u32) string_size));
+ ACPI_ERROR((AE_INFO, "Could not allocate size %X",
+ (u32) string_size));
acpi_ut_remove_reference(string_desc);
return_PTR(NULL);
}
@@ -312,8 +312,8 @@ void *acpi_ut_allocate_object_desc_dbg(char *module_name,
object = acpi_os_acquire_object(acpi_gbl_operand_cache);
if (!object) {
- _ACPI_REPORT_ERROR(module_name, line_number,
- ("Could not allocate an object descriptor\n"));
+ ACPI_ERROR((module_name, line_number,
+ "Could not allocate an object descriptor"));
return_PTR(NULL);
}
@@ -347,9 +347,9 @@ void acpi_ut_delete_object_desc(union acpi_operand_object *object)
/* Object must be an union acpi_operand_object */
if (ACPI_GET_DESCRIPTOR_TYPE(object) != ACPI_DESC_TYPE_OPERAND) {
- ACPI_REPORT_ERROR(("%p is not an ACPI Operand object [%s]\n",
- object,
- acpi_ut_get_descriptor_name(object)));
+ ACPI_ERROR((AE_INFO,
+ "%p is not an ACPI Operand object [%s]", object,
+ acpi_ut_get_descriptor_name(object)));
return_VOID;
}
@@ -451,7 +451,10 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
* Notably, Locals and Args are not supported, but this may be
* required eventually.
*/
- ACPI_REPORT_ERROR(("Unsupported Reference opcode=%X in object %p\n", internal_object->reference.opcode, internal_object));
+ ACPI_ERROR((AE_INFO,
+ "Unsupported Reference opcode=%X in object %p",
+ internal_object->reference.opcode,
+ internal_object));
status = AE_TYPE;
break;
}
@@ -459,9 +462,9 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object,
default:
- ACPI_REPORT_ERROR(("Unsupported type=%X in object %p\n",
- ACPI_GET_OBJECT_TYPE(internal_object),
- internal_object));
+ ACPI_ERROR((AE_INFO, "Unsupported type=%X in object %p",
+ ACPI_GET_OBJECT_TYPE(internal_object),
+ internal_object));
status = AE_TYPE;
break;
}
diff --git a/drivers/acpi/utilities/utresrc.c b/drivers/acpi/utilities/utresrc.c
index 36bf9e4bf52..16461317113 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)
* RETURN: Status, pointer to the end tag
*
* DESCRIPTION: Find the end_tag resource descriptor in an AML resource template
+ * Note: allows a buffer length of zero.
*
******************************************************************************/
@@ -504,6 +505,13 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
aml = obj_desc->buffer.pointer;
end_aml = aml + obj_desc->buffer.length;
+ /* Allow a buffer length of zero */
+
+ if (!obj_desc->buffer.length) {
+ *end_tag = aml;
+ return_ACPI_STATUS(AE_OK);
+ }
+
/* Walk the resource template, one descriptor per iteration */
while (aml < end_aml) {
@@ -518,6 +526,14 @@ acpi_ut_get_resource_end_tag(union acpi_operand_object * obj_desc,
if (acpi_ut_get_resource_type(aml) ==
ACPI_RESOURCE_NAME_END_TAG) {
+ /*
+ * There must be at least one more byte in the buffer for
+ * the 2nd byte of the end_tag
+ */
+ if ((aml + 1) >= end_aml) {
+ return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
+ }
+
/* Return the pointer to the end_tag */
*end_tag = aml;
diff --git a/drivers/acpi/utilities/utxface.c b/drivers/acpi/utilities/utxface.c
index b4bc9488320..308a960871b 100644
--- a/drivers/acpi/utilities/utxface.c
+++ b/drivers/acpi/utilities/utxface.c
@@ -75,8 +75,7 @@ acpi_status acpi_initialize_subsystem(void)
status = acpi_os_initialize();
if (ACPI_FAILURE(status)) {
- ACPI_REPORT_ERROR(("OSL failed to initialize, %s\n",
- acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status, "During OSL initialization"));
return_ACPI_STATUS(status);
}
@@ -88,8 +87,8 @@ acpi_status acpi_initialize_subsystem(void)
status = acpi_ut_mutex_initialize();
if (ACPI_FAILURE(status)) {
- ACPI_REPORT_ERROR(("Global mutex creation failure, %s\n",
- acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status,
+ "During Global Mutex creation"));
return_ACPI_STATUS(status);
}
@@ -99,15 +98,14 @@ acpi_status acpi_initialize_subsystem(void)
*/
status = acpi_ns_root_initialize();
if (ACPI_FAILURE(status)) {
- ACPI_REPORT_ERROR(("Namespace initialization failure, %s\n",
- acpi_format_exception(status)));
+ ACPI_EXCEPTION((AE_INFO, status,
+ "During Namespace initialization"));
return_ACPI_STATUS(status);
}
/* If configured, initialize the AML debugger */
ACPI_DEBUGGER_EXEC(status = acpi_db_initialize());
-
return_ACPI_STATUS(status);
}
@@ -154,7 +152,7 @@ acpi_status acpi_enable_subsystem(u32 flags)
status = acpi_enable();
if (ACPI_FAILURE(status)) {
- ACPI_REPORT_WARNING(("acpi_enable failed\n"));
+ ACPI_WARNING((AE_INFO, "acpi_enable failed"));
return_ACPI_STATUS(status);
}
}