1 /******************************************************************************* 2 * 3 * Module Name: utxferror - Various error/warning output functions 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2013, Intel Corp. 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 #define EXPORT_ACPI_INTERFACES 45 46 #include <acpi/acpi.h> 47 #include "accommon.h" 48 49 #define _COMPONENT ACPI_UTILITIES 50 ACPI_MODULE_NAME("utxferror") 51 52 /* 53 * This module is used for the in-kernel ACPICA as well as the ACPICA 54 * tools/applications. 55 */ 56 /******************************************************************************* 57 * 58 * FUNCTION: acpi_error 59 * 60 * PARAMETERS: module_name - Caller's module name (for error output) 61 * line_number - Caller's line number (for error output) 62 * format - Printf format string + additional args 63 * 64 * RETURN: None 65 * 66 * DESCRIPTION: Print "ACPI Error" message with module/line/version info 67 * 68 ******************************************************************************/ 69 void ACPI_INTERNAL_VAR_XFACE 70 acpi_error(const char *module_name, u32 line_number, const char *format, ...) 71 { 72 va_list arg_list; 73 74 ACPI_MSG_REDIRECT_BEGIN; 75 acpi_os_printf(ACPI_MSG_ERROR); 76 77 va_start(arg_list, format); 78 acpi_os_vprintf(format, arg_list); 79 ACPI_MSG_SUFFIX; 80 va_end(arg_list); 81 82 ACPI_MSG_REDIRECT_END; 83 } 84 85 ACPI_EXPORT_SYMBOL(acpi_error) 86 87 /******************************************************************************* 88 * 89 * FUNCTION: acpi_exception 90 * 91 * PARAMETERS: module_name - Caller's module name (for error output) 92 * line_number - Caller's line number (for error output) 93 * status - Status to be formatted 94 * format - Printf format string + additional args 95 * 96 * RETURN: None 97 * 98 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 99 * and decoded acpi_status. 100 * 101 ******************************************************************************/ 102 void ACPI_INTERNAL_VAR_XFACE 103 acpi_exception(const char *module_name, 104 u32 line_number, acpi_status status, const char *format, ...) 105 { 106 va_list arg_list; 107 108 ACPI_MSG_REDIRECT_BEGIN; 109 acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", 110 acpi_format_exception(status)); 111 112 va_start(arg_list, format); 113 acpi_os_vprintf(format, arg_list); 114 ACPI_MSG_SUFFIX; 115 va_end(arg_list); 116 117 ACPI_MSG_REDIRECT_END; 118 } 119 120 ACPI_EXPORT_SYMBOL(acpi_exception) 121 122 /******************************************************************************* 123 * 124 * FUNCTION: acpi_warning 125 * 126 * PARAMETERS: module_name - Caller's module name (for error output) 127 * line_number - Caller's line number (for error output) 128 * format - Printf format string + additional args 129 * 130 * RETURN: None 131 * 132 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info 133 * 134 ******************************************************************************/ 135 void ACPI_INTERNAL_VAR_XFACE 136 acpi_warning(const char *module_name, u32 line_number, const char *format, ...) 137 { 138 va_list arg_list; 139 140 ACPI_MSG_REDIRECT_BEGIN; 141 acpi_os_printf(ACPI_MSG_WARNING); 142 143 va_start(arg_list, format); 144 acpi_os_vprintf(format, arg_list); 145 ACPI_MSG_SUFFIX; 146 va_end(arg_list); 147 148 ACPI_MSG_REDIRECT_END; 149 } 150 151 ACPI_EXPORT_SYMBOL(acpi_warning) 152 153 /******************************************************************************* 154 * 155 * FUNCTION: acpi_info 156 * 157 * PARAMETERS: module_name - Caller's module name (for error output) 158 * line_number - Caller's line number (for error output) 159 * format - Printf format string + additional args 160 * 161 * RETURN: None 162 * 163 * DESCRIPTION: Print generic "ACPI:" information message. There is no 164 * module/line/version info in order to keep the message simple. 165 * 166 * TBD: module_name and line_number args are not needed, should be removed. 167 * 168 ******************************************************************************/ 169 void ACPI_INTERNAL_VAR_XFACE 170 acpi_info(const char *module_name, u32 line_number, const char *format, ...) 171 { 172 va_list arg_list; 173 174 ACPI_MSG_REDIRECT_BEGIN; 175 acpi_os_printf(ACPI_MSG_INFO); 176 177 va_start(arg_list, format); 178 acpi_os_vprintf(format, arg_list); 179 acpi_os_printf("\n"); 180 va_end(arg_list); 181 182 ACPI_MSG_REDIRECT_END; 183 } 184 185 ACPI_EXPORT_SYMBOL(acpi_info) 186 187 /******************************************************************************* 188 * 189 * FUNCTION: acpi_bios_error 190 * 191 * PARAMETERS: module_name - Caller's module name (for error output) 192 * line_number - Caller's line number (for error output) 193 * format - Printf format string + additional args 194 * 195 * RETURN: None 196 * 197 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version 198 * info 199 * 200 ******************************************************************************/ 201 void ACPI_INTERNAL_VAR_XFACE 202 acpi_bios_error(const char *module_name, 203 u32 line_number, const char *format, ...) 204 { 205 va_list arg_list; 206 207 ACPI_MSG_REDIRECT_BEGIN; 208 acpi_os_printf(ACPI_MSG_BIOS_ERROR); 209 210 va_start(arg_list, format); 211 acpi_os_vprintf(format, arg_list); 212 ACPI_MSG_SUFFIX; 213 va_end(arg_list); 214 215 ACPI_MSG_REDIRECT_END; 216 } 217 218 ACPI_EXPORT_SYMBOL(acpi_bios_error) 219 220 /******************************************************************************* 221 * 222 * FUNCTION: acpi_bios_warning 223 * 224 * PARAMETERS: module_name - Caller's module name (for error output) 225 * line_number - Caller's line number (for error output) 226 * format - Printf format string + additional args 227 * 228 * RETURN: None 229 * 230 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version 231 * info 232 * 233 ******************************************************************************/ 234 void ACPI_INTERNAL_VAR_XFACE 235 acpi_bios_warning(const char *module_name, 236 u32 line_number, const char *format, ...) 237 { 238 va_list arg_list; 239 240 ACPI_MSG_REDIRECT_BEGIN; 241 acpi_os_printf(ACPI_MSG_BIOS_WARNING); 242 243 va_start(arg_list, format); 244 acpi_os_vprintf(format, arg_list); 245 ACPI_MSG_SUFFIX; 246 va_end(arg_list); 247 248 ACPI_MSG_REDIRECT_END; 249 } 250 251 ACPI_EXPORT_SYMBOL(acpi_bios_warning) 252