1cc84e262SBob Moore /******************************************************************************* 2cc84e262SBob Moore * 3cc84e262SBob Moore * Module Name: utxferror - Various error/warning output functions 4cc84e262SBob Moore * 5cc84e262SBob Moore ******************************************************************************/ 6cc84e262SBob Moore 7cc84e262SBob Moore /* 882a80941SDavid E. Box * Copyright (C) 2000 - 2015, Intel Corp. 9cc84e262SBob Moore * All rights reserved. 10cc84e262SBob Moore * 11cc84e262SBob Moore * Redistribution and use in source and binary forms, with or without 12cc84e262SBob Moore * modification, are permitted provided that the following conditions 13cc84e262SBob Moore * are met: 14cc84e262SBob Moore * 1. Redistributions of source code must retain the above copyright 15cc84e262SBob Moore * notice, this list of conditions, and the following disclaimer, 16cc84e262SBob Moore * without modification. 17cc84e262SBob Moore * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18cc84e262SBob Moore * substantially similar to the "NO WARRANTY" disclaimer below 19cc84e262SBob Moore * ("Disclaimer") and any redistribution must be conditioned upon 20cc84e262SBob Moore * including a substantially similar Disclaimer requirement for further 21cc84e262SBob Moore * binary redistribution. 22cc84e262SBob Moore * 3. Neither the names of the above-listed copyright holders nor the names 23cc84e262SBob Moore * of any contributors may be used to endorse or promote products derived 24cc84e262SBob Moore * from this software without specific prior written permission. 25cc84e262SBob Moore * 26cc84e262SBob Moore * Alternatively, this software may be distributed under the terms of the 27cc84e262SBob Moore * GNU General Public License ("GPL") version 2 as published by the Free 28cc84e262SBob Moore * Software Foundation. 29cc84e262SBob Moore * 30cc84e262SBob Moore * NO WARRANTY 31cc84e262SBob Moore * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32cc84e262SBob Moore * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33cc84e262SBob Moore * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34cc84e262SBob Moore * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35cc84e262SBob Moore * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36cc84e262SBob Moore * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37cc84e262SBob Moore * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38cc84e262SBob Moore * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39cc84e262SBob Moore * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40cc84e262SBob Moore * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41cc84e262SBob Moore * POSSIBILITY OF SUCH DAMAGES. 42cc84e262SBob Moore */ 43cc84e262SBob Moore 44839e928fSLv Zheng #define EXPORT_ACPI_INTERFACES 45839e928fSLv Zheng 46cc84e262SBob Moore #include <acpi/acpi.h> 47cc84e262SBob Moore #include "accommon.h" 48cc84e262SBob Moore 49cc84e262SBob Moore #define _COMPONENT ACPI_UTILITIES 50cc84e262SBob Moore ACPI_MODULE_NAME("utxferror") 51cc84e262SBob Moore 52cc84e262SBob Moore /* 53cc84e262SBob Moore * This module is used for the in-kernel ACPICA as well as the ACPICA 54cc84e262SBob Moore * tools/applications. 55cc84e262SBob Moore */ 56407e22afSLv Zheng #ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */ 57cc84e262SBob Moore /******************************************************************************* 58cc84e262SBob Moore * 59cc84e262SBob Moore * FUNCTION: acpi_error 60cc84e262SBob Moore * 61cc84e262SBob Moore * PARAMETERS: module_name - Caller's module name (for error output) 62cc84e262SBob Moore * line_number - Caller's line number (for error output) 63ba494beeSBob Moore * format - Printf format string + additional args 64cc84e262SBob Moore * 65cc84e262SBob Moore * RETURN: None 66cc84e262SBob Moore * 67cc84e262SBob Moore * DESCRIPTION: Print "ACPI Error" message with module/line/version info 68cc84e262SBob Moore * 69cc84e262SBob Moore ******************************************************************************/ 70cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE 71cc84e262SBob Moore acpi_error(const char *module_name, u32 line_number, const char *format, ...) 72cc84e262SBob Moore { 73cc84e262SBob Moore va_list arg_list; 74cc84e262SBob Moore 75cc84e262SBob Moore ACPI_MSG_REDIRECT_BEGIN; 76cc84e262SBob Moore acpi_os_printf(ACPI_MSG_ERROR); 77cc84e262SBob Moore 78cc84e262SBob Moore va_start(arg_list, format); 79cc84e262SBob Moore acpi_os_vprintf(format, arg_list); 80cc84e262SBob Moore ACPI_MSG_SUFFIX; 81cc84e262SBob Moore va_end(arg_list); 82cc84e262SBob Moore 83cc84e262SBob Moore ACPI_MSG_REDIRECT_END; 84cc84e262SBob Moore } 85cc84e262SBob Moore 86cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_error) 87cc84e262SBob Moore 88cc84e262SBob Moore /******************************************************************************* 89cc84e262SBob Moore * 90cc84e262SBob Moore * FUNCTION: acpi_exception 91cc84e262SBob Moore * 92cc84e262SBob Moore * PARAMETERS: module_name - Caller's module name (for error output) 93cc84e262SBob Moore * line_number - Caller's line number (for error output) 94ba494beeSBob Moore * status - Status to be formatted 95ba494beeSBob Moore * format - Printf format string + additional args 96cc84e262SBob Moore * 97cc84e262SBob Moore * RETURN: None 98cc84e262SBob Moore * 99cc84e262SBob Moore * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 100cc84e262SBob Moore * and decoded acpi_status. 101cc84e262SBob Moore * 102cc84e262SBob Moore ******************************************************************************/ 103cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE 104cc84e262SBob Moore acpi_exception(const char *module_name, 105cc84e262SBob Moore u32 line_number, acpi_status status, const char *format, ...) 106cc84e262SBob Moore { 107cc84e262SBob Moore va_list arg_list; 108cc84e262SBob Moore 109cc84e262SBob Moore ACPI_MSG_REDIRECT_BEGIN; 1105b0bbfbdSBob Moore 1115b0bbfbdSBob Moore /* For AE_OK, just print the message */ 1125b0bbfbdSBob Moore 1135b0bbfbdSBob Moore if (ACPI_SUCCESS(status)) { 1145b0bbfbdSBob Moore acpi_os_printf(ACPI_MSG_EXCEPTION); 1155b0bbfbdSBob Moore 1165b0bbfbdSBob Moore } else { 117cc84e262SBob Moore acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", 118cc84e262SBob Moore acpi_format_exception(status)); 1195b0bbfbdSBob Moore } 120*1fad8738SBob Moore 121cc84e262SBob Moore va_start(arg_list, format); 122cc84e262SBob Moore acpi_os_vprintf(format, arg_list); 123cc84e262SBob Moore ACPI_MSG_SUFFIX; 124cc84e262SBob Moore va_end(arg_list); 125cc84e262SBob Moore 126cc84e262SBob Moore ACPI_MSG_REDIRECT_END; 127cc84e262SBob Moore } 128cc84e262SBob Moore 129cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_exception) 130cc84e262SBob Moore 131cc84e262SBob Moore /******************************************************************************* 132cc84e262SBob Moore * 133cc84e262SBob Moore * FUNCTION: acpi_warning 134cc84e262SBob Moore * 135cc84e262SBob Moore * PARAMETERS: module_name - Caller's module name (for error output) 136cc84e262SBob Moore * line_number - Caller's line number (for error output) 137ba494beeSBob Moore * format - Printf format string + additional args 138cc84e262SBob Moore * 139cc84e262SBob Moore * RETURN: None 140cc84e262SBob Moore * 141cc84e262SBob Moore * DESCRIPTION: Print "ACPI Warning" message with module/line/version info 142cc84e262SBob Moore * 143cc84e262SBob Moore ******************************************************************************/ 144cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE 145cc84e262SBob Moore acpi_warning(const char *module_name, u32 line_number, const char *format, ...) 146cc84e262SBob Moore { 147cc84e262SBob Moore va_list arg_list; 148cc84e262SBob Moore 149cc84e262SBob Moore ACPI_MSG_REDIRECT_BEGIN; 150cc84e262SBob Moore acpi_os_printf(ACPI_MSG_WARNING); 151cc84e262SBob Moore 152cc84e262SBob Moore va_start(arg_list, format); 153cc84e262SBob Moore acpi_os_vprintf(format, arg_list); 154cc84e262SBob Moore ACPI_MSG_SUFFIX; 155cc84e262SBob Moore va_end(arg_list); 156cc84e262SBob Moore 157cc84e262SBob Moore ACPI_MSG_REDIRECT_END; 158cc84e262SBob Moore } 159cc84e262SBob Moore 160cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_warning) 161cc84e262SBob Moore 162cc84e262SBob Moore /******************************************************************************* 163cc84e262SBob Moore * 164cc84e262SBob Moore * FUNCTION: acpi_info 165cc84e262SBob Moore * 166cc84e262SBob Moore * PARAMETERS: module_name - Caller's module name (for error output) 167cc84e262SBob Moore * line_number - Caller's line number (for error output) 168ba494beeSBob Moore * format - Printf format string + additional args 169cc84e262SBob Moore * 170cc84e262SBob Moore * RETURN: None 171cc84e262SBob Moore * 172cc84e262SBob Moore * DESCRIPTION: Print generic "ACPI:" information message. There is no 173cc84e262SBob Moore * module/line/version info in order to keep the message simple. 174cc84e262SBob Moore * 175cc84e262SBob Moore * TBD: module_name and line_number args are not needed, should be removed. 176cc84e262SBob Moore * 177cc84e262SBob Moore ******************************************************************************/ 178cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE 179cc84e262SBob Moore acpi_info(const char *module_name, u32 line_number, const char *format, ...) 180cc84e262SBob Moore { 181cc84e262SBob Moore va_list arg_list; 182cc84e262SBob Moore 183cc84e262SBob Moore ACPI_MSG_REDIRECT_BEGIN; 184cc84e262SBob Moore acpi_os_printf(ACPI_MSG_INFO); 185cc84e262SBob Moore 186cc84e262SBob Moore va_start(arg_list, format); 187cc84e262SBob Moore acpi_os_vprintf(format, arg_list); 188cc84e262SBob Moore acpi_os_printf("\n"); 189cc84e262SBob Moore va_end(arg_list); 190cc84e262SBob Moore 191cc84e262SBob Moore ACPI_MSG_REDIRECT_END; 192cc84e262SBob Moore } 193cc84e262SBob Moore 194cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_info) 195cc84e262SBob Moore 19662cdd141SBob Moore /******************************************************************************* 19762cdd141SBob Moore * 19862cdd141SBob Moore * FUNCTION: acpi_bios_error 19962cdd141SBob Moore * 20062cdd141SBob Moore * PARAMETERS: module_name - Caller's module name (for error output) 20162cdd141SBob Moore * line_number - Caller's line number (for error output) 20262cdd141SBob Moore * format - Printf format string + additional args 20362cdd141SBob Moore * 20462cdd141SBob Moore * RETURN: None 20562cdd141SBob Moore * 20662cdd141SBob Moore * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version 20762cdd141SBob Moore * info 20862cdd141SBob Moore * 20962cdd141SBob Moore ******************************************************************************/ 21062cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE 21162cdd141SBob Moore acpi_bios_error(const char *module_name, 21262cdd141SBob Moore u32 line_number, const char *format, ...) 21362cdd141SBob Moore { 21462cdd141SBob Moore va_list arg_list; 21562cdd141SBob Moore 21662cdd141SBob Moore ACPI_MSG_REDIRECT_BEGIN; 21762cdd141SBob Moore acpi_os_printf(ACPI_MSG_BIOS_ERROR); 21862cdd141SBob Moore 21962cdd141SBob Moore va_start(arg_list, format); 22062cdd141SBob Moore acpi_os_vprintf(format, arg_list); 22162cdd141SBob Moore ACPI_MSG_SUFFIX; 22262cdd141SBob Moore va_end(arg_list); 22362cdd141SBob Moore 22462cdd141SBob Moore ACPI_MSG_REDIRECT_END; 22562cdd141SBob Moore } 22662cdd141SBob Moore 22762cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_error) 22862cdd141SBob Moore 22962cdd141SBob Moore /******************************************************************************* 23062cdd141SBob Moore * 23162cdd141SBob Moore * FUNCTION: acpi_bios_warning 23262cdd141SBob Moore * 23362cdd141SBob Moore * PARAMETERS: module_name - Caller's module name (for error output) 23462cdd141SBob Moore * line_number - Caller's line number (for error output) 23562cdd141SBob Moore * format - Printf format string + additional args 23662cdd141SBob Moore * 23762cdd141SBob Moore * RETURN: None 23862cdd141SBob Moore * 23962cdd141SBob Moore * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version 24062cdd141SBob Moore * info 24162cdd141SBob Moore * 24262cdd141SBob Moore ******************************************************************************/ 24362cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE 24462cdd141SBob Moore acpi_bios_warning(const char *module_name, 24562cdd141SBob Moore u32 line_number, const char *format, ...) 24662cdd141SBob Moore { 24762cdd141SBob Moore va_list arg_list; 24862cdd141SBob Moore 24962cdd141SBob Moore ACPI_MSG_REDIRECT_BEGIN; 25062cdd141SBob Moore acpi_os_printf(ACPI_MSG_BIOS_WARNING); 25162cdd141SBob Moore 25262cdd141SBob Moore va_start(arg_list, format); 25362cdd141SBob Moore acpi_os_vprintf(format, arg_list); 25462cdd141SBob Moore ACPI_MSG_SUFFIX; 25562cdd141SBob Moore va_end(arg_list); 25662cdd141SBob Moore 25762cdd141SBob Moore ACPI_MSG_REDIRECT_END; 25862cdd141SBob Moore } 25962cdd141SBob Moore 26062cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_warning) 261407e22afSLv Zheng #endif /* ACPI_NO_ERROR_MESSAGES */ 262