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