1 /******************************************************************************* 2 * 3 * Module Name: utxferror - Various error/warning output functions 4 * 5 ******************************************************************************/ 6 7 /* 8 * Copyright (C) 2000 - 2014, 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 __UTXFERROR_C__ 45 #define EXPORT_ACPI_INTERFACES 46 47 #include <contrib/dev/acpica/include/acpi.h> 48 #include <contrib/dev/acpica/include/accommon.h> 49 50 51 #define _COMPONENT ACPI_UTILITIES 52 ACPI_MODULE_NAME ("utxferror") 53 54 /* 55 * This module is used for the in-kernel ACPICA as well as the ACPICA 56 * tools/applications. 57 */ 58 59 #ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */ 60 61 /******************************************************************************* 62 * 63 * FUNCTION: AcpiError 64 * 65 * PARAMETERS: ModuleName - Caller's module name (for error output) 66 * LineNumber - Caller's line number (for error output) 67 * Format - Printf format string + additional args 68 * 69 * RETURN: None 70 * 71 * DESCRIPTION: Print "ACPI Error" message with module/line/version info 72 * 73 ******************************************************************************/ 74 75 void ACPI_INTERNAL_VAR_XFACE 76 AcpiError ( 77 const char *ModuleName, 78 UINT32 LineNumber, 79 const char *Format, 80 ...) 81 { 82 va_list ArgList; 83 84 85 ACPI_MSG_REDIRECT_BEGIN; 86 AcpiOsPrintf (ACPI_MSG_ERROR); 87 88 va_start (ArgList, Format); 89 AcpiOsVprintf (Format, ArgList); 90 ACPI_MSG_SUFFIX; 91 va_end (ArgList); 92 93 ACPI_MSG_REDIRECT_END; 94 } 95 96 ACPI_EXPORT_SYMBOL (AcpiError) 97 98 99 /******************************************************************************* 100 * 101 * FUNCTION: AcpiException 102 * 103 * PARAMETERS: ModuleName - Caller's module name (for error output) 104 * LineNumber - Caller's line number (for error output) 105 * Status - Status to be formatted 106 * Format - Printf format string + additional args 107 * 108 * RETURN: None 109 * 110 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info 111 * and decoded ACPI_STATUS. 112 * 113 ******************************************************************************/ 114 115 void ACPI_INTERNAL_VAR_XFACE 116 AcpiException ( 117 const char *ModuleName, 118 UINT32 LineNumber, 119 ACPI_STATUS Status, 120 const char *Format, 121 ...) 122 { 123 va_list ArgList; 124 125 126 ACPI_MSG_REDIRECT_BEGIN; 127 AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status)); 128 129 va_start (ArgList, Format); 130 AcpiOsVprintf (Format, ArgList); 131 ACPI_MSG_SUFFIX; 132 va_end (ArgList); 133 134 ACPI_MSG_REDIRECT_END; 135 } 136 137 ACPI_EXPORT_SYMBOL (AcpiException) 138 139 140 /******************************************************************************* 141 * 142 * FUNCTION: AcpiWarning 143 * 144 * PARAMETERS: ModuleName - Caller's module name (for error output) 145 * LineNumber - Caller's line number (for error output) 146 * Format - Printf format string + additional args 147 * 148 * RETURN: None 149 * 150 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info 151 * 152 ******************************************************************************/ 153 154 void ACPI_INTERNAL_VAR_XFACE 155 AcpiWarning ( 156 const char *ModuleName, 157 UINT32 LineNumber, 158 const char *Format, 159 ...) 160 { 161 va_list ArgList; 162 163 164 ACPI_MSG_REDIRECT_BEGIN; 165 AcpiOsPrintf (ACPI_MSG_WARNING); 166 167 va_start (ArgList, Format); 168 AcpiOsVprintf (Format, ArgList); 169 ACPI_MSG_SUFFIX; 170 va_end (ArgList); 171 172 ACPI_MSG_REDIRECT_END; 173 } 174 175 ACPI_EXPORT_SYMBOL (AcpiWarning) 176 177 178 /******************************************************************************* 179 * 180 * FUNCTION: AcpiInfo 181 * 182 * PARAMETERS: ModuleName - Caller's module name (for error output) 183 * LineNumber - Caller's line number (for error output) 184 * Format - Printf format string + additional args 185 * 186 * RETURN: None 187 * 188 * DESCRIPTION: Print generic "ACPI:" information message. There is no 189 * module/line/version info in order to keep the message simple. 190 * 191 * TBD: ModuleName and LineNumber args are not needed, should be removed. 192 * 193 ******************************************************************************/ 194 195 void ACPI_INTERNAL_VAR_XFACE 196 AcpiInfo ( 197 const char *ModuleName, 198 UINT32 LineNumber, 199 const char *Format, 200 ...) 201 { 202 va_list ArgList; 203 204 #ifdef _KERNEL 205 /* Temporarily hide too verbose printfs. */ 206 if (!bootverbose) 207 return; 208 #endif 209 210 ACPI_MSG_REDIRECT_BEGIN; 211 AcpiOsPrintf (ACPI_MSG_INFO); 212 213 va_start (ArgList, Format); 214 AcpiOsVprintf (Format, ArgList); 215 AcpiOsPrintf ("\n"); 216 va_end (ArgList); 217 218 ACPI_MSG_REDIRECT_END; 219 } 220 221 ACPI_EXPORT_SYMBOL (AcpiInfo) 222 223 224 /******************************************************************************* 225 * 226 * FUNCTION: AcpiBiosError 227 * 228 * PARAMETERS: ModuleName - Caller's module name (for error output) 229 * LineNumber - Caller's line number (for error output) 230 * Format - Printf format string + additional args 231 * 232 * RETURN: None 233 * 234 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version 235 * info 236 * 237 ******************************************************************************/ 238 239 void ACPI_INTERNAL_VAR_XFACE 240 AcpiBiosError ( 241 const char *ModuleName, 242 UINT32 LineNumber, 243 const char *Format, 244 ...) 245 { 246 va_list ArgList; 247 248 249 ACPI_MSG_REDIRECT_BEGIN; 250 AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); 251 252 va_start (ArgList, Format); 253 AcpiOsVprintf (Format, ArgList); 254 ACPI_MSG_SUFFIX; 255 va_end (ArgList); 256 257 ACPI_MSG_REDIRECT_END; 258 } 259 260 ACPI_EXPORT_SYMBOL (AcpiBiosError) 261 262 263 /******************************************************************************* 264 * 265 * FUNCTION: AcpiBiosWarning 266 * 267 * PARAMETERS: ModuleName - Caller's module name (for error output) 268 * LineNumber - Caller's line number (for error output) 269 * Format - Printf format string + additional args 270 * 271 * RETURN: None 272 * 273 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version 274 * info 275 * 276 ******************************************************************************/ 277 278 void ACPI_INTERNAL_VAR_XFACE 279 AcpiBiosWarning ( 280 const char *ModuleName, 281 UINT32 LineNumber, 282 const char *Format, 283 ...) 284 { 285 va_list ArgList; 286 287 288 ACPI_MSG_REDIRECT_BEGIN; 289 AcpiOsPrintf (ACPI_MSG_BIOS_WARNING); 290 291 va_start (ArgList, Format); 292 AcpiOsVprintf (Format, ArgList); 293 ACPI_MSG_SUFFIX; 294 va_end (ArgList); 295 296 ACPI_MSG_REDIRECT_END; 297 } 298 299 ACPI_EXPORT_SYMBOL (AcpiBiosWarning) 300 301 #endif /* ACPI_NO_ERROR_MESSAGES */ 302