ACPICA: Convert more ACPI errors to firmware errors
authorBob Moore <robert.moore@intel.com>
Mon, 14 Jan 2019 17:55:23 +0000 (09:55 -0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 15 Jan 2019 17:04:02 +0000 (18:04 +0100)
ACPICA commit f3198c12f2df9d170b3da891a180b774cfe01e59

Also adds a new firmware error function, acpi_bios_exception.

Link: https://github.com/acpica/acpica/commit/f3198c12
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Schmauss <erik.schmauss@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/dsopcode.c
drivers/acpi/acpica/exoparg2.c
drivers/acpi/acpica/utxferror.c
include/acpi/acoutput.h
include/acpi/acpixf.h

index 78f9de2..a0b8210 100644 (file)
@@ -130,8 +130,8 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
                /* Must have a valid (>0) bit count */
 
                if (bit_count == 0) {
-                       ACPI_ERROR((AE_INFO,
-                                   "Attempt to CreateField of length zero"));
+                       ACPI_BIOS_ERROR((AE_INFO,
+                                        "Attempt to CreateField of length zero"));
                        status = AE_AML_OPERAND_VALUE;
                        goto cleanup;
                }
@@ -194,12 +194,13 @@ acpi_ds_init_buffer_field(u16 aml_opcode,
        /* Entire field must fit within the current length of the buffer */
 
        if ((bit_offset + bit_count) > (8 * (u32)buffer_desc->buffer.length)) {
-               ACPI_ERROR((AE_INFO,
-                           "Field [%4.4s] at bit offset/length %u/%u "
-                           "exceeds size of target Buffer (%u bits)",
-                           acpi_ut_get_node_name(result_desc), bit_offset,
-                           bit_count, 8 * (u32)buffer_desc->buffer.length));
                status = AE_AML_BUFFER_LIMIT;
+               ACPI_BIOS_EXCEPTION((AE_INFO, status,
+                                    "Field [%4.4s] at bit offset/length %u/%u "
+                                    "exceeds size of target Buffer (%u bits)",
+                                    acpi_ut_get_node_name(result_desc),
+                                    bit_offset, bit_count,
+                                    8 * (u32)buffer_desc->buffer.length));
                goto cleanup;
        }
 
index 3a47756..e9509b1 100644 (file)
@@ -390,10 +390,10 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state)
                /* Failure means that the Index was beyond the end of the object */
 
                if (ACPI_FAILURE(status)) {
-                       ACPI_EXCEPTION((AE_INFO, status,
-                                       "Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
-                                       ACPI_FORMAT_UINT64(index),
-                                       (u32)length));
+                       ACPI_BIOS_EXCEPTION((AE_INFO, status,
+                                            "Index (0x%X%8.8X) is beyond end of object (length 0x%X)",
+                                            ACPI_FORMAT_UINT64(index),
+                                            (u32)length));
                        goto cleanup;
                }
 
index 6bb85d6..a1ed7fc 100644 (file)
@@ -185,6 +185,50 @@ acpi_bios_error(const char *module_name,
 
 ACPI_EXPORT_SYMBOL(acpi_bios_error)
 
+/*******************************************************************************
+ *
+ * FUNCTION:    acpi_bios_exception
+ *
+ * PARAMETERS:  module_name         - Caller's module name (for error output)
+ *              line_number         - Caller's line number (for error output)
+ *              status              - Status value to be decoded/formatted
+ *              format              - Printf format string + additional args
+ *
+ * RETURN:      None
+ *
+ * DESCRIPTION: Print an "ACPI Firmware Error" message with module/line/version
+ *              info as well as decoded acpi_status.
+ *
+ ******************************************************************************/
+void ACPI_INTERNAL_VAR_XFACE
+acpi_bios_exception(const char *module_name,
+                   u32 line_number,
+                   acpi_status status, const char *format, ...)
+{
+       va_list arg_list;
+
+       ACPI_MSG_REDIRECT_BEGIN;
+
+       /* For AE_OK, just print the message */
+
+       if (ACPI_SUCCESS(status)) {
+               acpi_os_printf(ACPI_MSG_BIOS_ERROR);
+
+       } else {
+               acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s, ",
+                              acpi_format_exception(status));
+       }
+
+       va_start(arg_list, format);
+       acpi_os_vprintf(format, arg_list);
+       ACPI_MSG_SUFFIX;
+       va_end(arg_list);
+
+       ACPI_MSG_REDIRECT_END;
+}
+
+ACPI_EXPORT_SYMBOL(acpi_bios_exception)
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_bios_warning
index 6db9a6d..93a2807 100644 (file)
 #define ACPI_EXCEPTION(plist)           acpi_exception plist
 #define ACPI_ERROR(plist)               acpi_error plist
 #define ACPI_BIOS_WARNING(plist)        acpi_bios_warning plist
+#define ACPI_BIOS_EXCEPTION(plist)      acpi_bios_exception plist
 #define ACPI_BIOS_ERROR(plist)          acpi_bios_error plist
 #define ACPI_DEBUG_OBJECT(obj,l,i)      acpi_ex_do_debug_object(obj,l,i)
 
 #define ACPI_EXCEPTION(plist)
 #define ACPI_ERROR(plist)
 #define ACPI_BIOS_WARNING(plist)
+#define ACPI_BIOS_EXCEPTION(plist)
 #define ACPI_BIOS_ERROR(plist)
 #define ACPI_DEBUG_OBJECT(obj,l,i)
 
index 7aa38b6..f0adda0 100644 (file)
@@ -903,6 +903,12 @@ ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
                                acpi_bios_error(const char *module_name,
                                                u32 line_number,
                                                const char *format, ...))
+ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(4)
+                               void ACPI_INTERNAL_VAR_XFACE
+                               acpi_bios_exception(const char *module_name,
+                                                   u32 line_number,
+                                                   acpi_status status,
+                                                   const char *format, ...))
 ACPI_MSG_DEPENDENT_RETURN_VOID(ACPI_PRINTF_LIKE(3)
                                void ACPI_INTERNAL_VAR_XFACE
                                acpi_bios_warning(const char *module_name,