From patchwork Mon Jan 14 17:55:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Schmauss, Erik" X-Patchwork-Id: 10763259 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 60B7C6C5 for ; Mon, 14 Jan 2019 17:59:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 520752969B for ; Mon, 14 Jan 2019 17:59:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 463DE297AF; Mon, 14 Jan 2019 17:59:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCF952969B for ; Mon, 14 Jan 2019 17:59:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726741AbfANR74 (ORCPT ); Mon, 14 Jan 2019 12:59:56 -0500 Received: from mga14.intel.com ([192.55.52.115]:14127 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbfANR7y (ORCPT ); Mon, 14 Jan 2019 12:59:54 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jan 2019 09:59:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,478,1539673200"; d="scan'208";a="134495173" Received: from bartok.jf.intel.com ([10.54.75.137]) by fmsmga002.fm.intel.com with ESMTP; 14 Jan 2019 09:59:45 -0800 From: Erik Schmauss To: rjw@rjwysocki.net, linux-acpi@vger.kernel.org Cc: Bob Moore , Erik Schmauss Subject: [PATCH 1/4] ACPICA: Convert more ACPI errors to firmware errors Date: Mon, 14 Jan 2019 09:55:23 -0800 Message-Id: <20190114175526.32570-2-erik.schmauss@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114175526.32570-1-erik.schmauss@intel.com> References: <20190114175526.32570-1-erik.schmauss@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bob Moore 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 Signed-off-by: Erik Schmauss --- drivers/acpi/acpica/dsopcode.c | 15 +++++------ drivers/acpi/acpica/exoparg2.c | 8 +++--- drivers/acpi/acpica/utxferror.c | 44 +++++++++++++++++++++++++++++++++ include/acpi/acoutput.h | 2 ++ include/acpi/acpixf.h | 6 +++++ 5 files changed, 64 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 78f9de260d5f..a0b821031063 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c @@ -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; } diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index 3a477566ba1b..e9509b1c9a3a 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c @@ -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; } diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index 6bb85d691fcb..a1ed7fced4db 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c @@ -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 diff --git a/include/acpi/acoutput.h b/include/acpi/acoutput.h index 6db9a6d40c85..93a280703318 100644 --- a/include/acpi/acoutput.h +++ b/include/acpi/acoutput.h @@ -201,6 +201,7 @@ #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) @@ -213,6 +214,7 @@ #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) diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h index 7aa38b648564..f0adda015fc7 100644 --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@ -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,