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 #include <linux/export.h> 45 #include <acpi/acpi.h> 46 #include "accommon.h" 47 48 #define _COMPONENT ACPI_UTILITIES 49 ACPI_MODULE_NAME("utxferror") 50 51 /* 52 * This module is used for the in-kernel ACPICA as well as the ACPICA 53 * tools/applications. 54 */ 55 /******************************************************************************* 56 * 57 * FUNCTION: acpi_error 58 * 59 * PARAMETERS: module_name - Caller's module name (for error output) 60 * line_number - Caller's line number (for error output) 61 * format - Printf format string + additional args 62 * 63 * RETURN: None 64 * 65 * DESCRIPTION: Print "ACPI Error" message with module/line/version info 66 * 67 ******************************************************************************/ 68 void ACPI_INTERNAL_VAR_XFACE 69 acpi_error(const char *module_name, u32 line_number, const char *format, ...) 70 { 71 va_list arg_list; 72 73 ACPI_MSG_REDIRECT_BEGIN; 74 acpi_os_printf(ACPI_MSG_ERROR); 75 76 va_start(arg_list, format); 77 acpi_os_vprintf(format, arg_list); 78 ACPI_MSG_SUFFIX; 79 va_end(arg_list); 80 81 ACPI_MSG_REDIRECT_END; 82 } 83 84 ACPI_EXPORT_SYMBOL(acpi_error) 85 86 /******************************************************************************* 87 * 88 * FUNCTION: acpi_exception 89 * 90 * PARAMETERS: module_name - Caller's module name (for error output) 91 * line_number - Caller's line number (for error output) 92 * status - Status to be formatted 93 * format - Printf format string + additional args 94 * 95 * RETURN: None 96 * 97 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 98 * and decoded acpi_status. 99 * 100 ******************************************************************************/ 101 void ACPI_INTERNAL_VAR_XFACE 102 acpi_exception(const char *module_name, 103 u32 line_number, acpi_status status, const char *format, ...) 104 { 105 va_list arg_list; 106 107 ACPI_MSG_REDIRECT_BEGIN; 108 acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ", 109 acpi_format_exception(status)); 110 111 va_start(arg_list, format); 112 acpi_os_vprintf(format, arg_list); 113 ACPI_MSG_SUFFIX; 114 va_end(arg_list); 115 116 ACPI_MSG_REDIRECT_END; 117 } 118 119 ACPI_EXPORT_SYMBOL(acpi_exception) 120 121 /******************************************************************************* 122 * 123 * FUNCTION: acpi_warning 124 * 125 * PARAMETERS: module_name - Caller's module name (for error output) 126 * line_number - Caller's line number (for error output) 127 * format - Printf format string + additional args 128 * 129 * RETURN: None 130 * 131 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info 132 * 133 ******************************************************************************/ 134 void ACPI_INTERNAL_VAR_XFACE 135 acpi_warning(const char *module_name, u32 line_number, const char *format, ...) 136 { 137 va_list arg_list; 138 139 ACPI_MSG_REDIRECT_BEGIN; 140 acpi_os_printf(ACPI_MSG_WARNING); 141 142 va_start(arg_list, format); 143 acpi_os_vprintf(format, arg_list); 144 ACPI_MSG_SUFFIX; 145 va_end(arg_list); 146 147 ACPI_MSG_REDIRECT_END; 148 } 149 150 ACPI_EXPORT_SYMBOL(acpi_warning) 151 152 /******************************************************************************* 153 * 154 * FUNCTION: acpi_info 155 * 156 * PARAMETERS: module_name - Caller's module name (for error output) 157 * line_number - Caller's line number (for error output) 158 * format - Printf format string + additional args 159 * 160 * RETURN: None 161 * 162 * DESCRIPTION: Print generic "ACPI:" information message. There is no 163 * module/line/version info in order to keep the message simple. 164 * 165 * TBD: module_name and line_number args are not needed, should be removed. 166 * 167 ******************************************************************************/ 168 void ACPI_INTERNAL_VAR_XFACE 169 acpi_info(const char *module_name, u32 line_number, const char *format, ...) 170 { 171 va_list arg_list; 172 173 ACPI_MSG_REDIRECT_BEGIN; 174 acpi_os_printf(ACPI_MSG_INFO); 175 176 va_start(arg_list, format); 177 acpi_os_vprintf(format, arg_list); 178 acpi_os_printf("\n"); 179 va_end(arg_list); 180 181 ACPI_MSG_REDIRECT_END; 182 } 183 184 ACPI_EXPORT_SYMBOL(acpi_info) 185 186 /******************************************************************************* 187 * 188 * FUNCTION: acpi_bios_error 189 * 190 * PARAMETERS: module_name - Caller's module name (for error output) 191 * line_number - Caller's line number (for error output) 192 * format - Printf format string + additional args 193 * 194 * RETURN: None 195 * 196 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version 197 * info 198 * 199 ******************************************************************************/ 200 void ACPI_INTERNAL_VAR_XFACE 201 acpi_bios_error(const char *module_name, 202 u32 line_number, const char *format, ...) 203 { 204 va_list arg_list; 205 206 ACPI_MSG_REDIRECT_BEGIN; 207 acpi_os_printf(ACPI_MSG_BIOS_ERROR); 208 209 va_start(arg_list, format); 210 acpi_os_vprintf(format, arg_list); 211 ACPI_MSG_SUFFIX; 212 va_end(arg_list); 213 214 ACPI_MSG_REDIRECT_END; 215 } 216 217 ACPI_EXPORT_SYMBOL(acpi_bios_error) 218 219 /******************************************************************************* 220 * 221 * FUNCTION: acpi_bios_warning 222 * 223 * PARAMETERS: module_name - Caller's module name (for error output) 224 * line_number - Caller's line number (for error output) 225 * format - Printf format string + additional args 226 * 227 * RETURN: None 228 * 229 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version 230 * info 231 * 232 ******************************************************************************/ 233 void ACPI_INTERNAL_VAR_XFACE 234 acpi_bios_warning(const char *module_name, 235 u32 line_number, const char *format, ...) 236 { 237 va_list arg_list; 238 239 ACPI_MSG_REDIRECT_BEGIN; 240 acpi_os_printf(ACPI_MSG_BIOS_WARNING); 241 242 va_start(arg_list, format); 243 acpi_os_vprintf(format, arg_list); 244 ACPI_MSG_SUFFIX; 245 va_end(arg_list); 246 247 ACPI_MSG_REDIRECT_END; 248 } 249 250 ACPI_EXPORT_SYMBOL(acpi_bios_warning) 251