utxferror.c revision 281075
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
74void ACPI_INTERNAL_VAR_XFACE
75AcpiError (
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
95ACPI_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
114void ACPI_INTERNAL_VAR_XFACE
115AcpiException (
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    AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", AcpiFormatException (Status));
127
128    va_start (ArgList, Format);
129    AcpiOsVprintf (Format, ArgList);
130    ACPI_MSG_SUFFIX;
131    va_end (ArgList);
132
133    ACPI_MSG_REDIRECT_END;
134}
135
136ACPI_EXPORT_SYMBOL (AcpiException)
137
138
139/*******************************************************************************
140 *
141 * FUNCTION:    AcpiWarning
142 *
143 * PARAMETERS:  ModuleName          - Caller's module name (for error output)
144 *              LineNumber          - Caller's line number (for error output)
145 *              Format              - Printf format string + additional args
146 *
147 * RETURN:      None
148 *
149 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
150 *
151 ******************************************************************************/
152
153void ACPI_INTERNAL_VAR_XFACE
154AcpiWarning (
155    const char              *ModuleName,
156    UINT32                  LineNumber,
157    const char              *Format,
158    ...)
159{
160    va_list                 ArgList;
161
162
163    ACPI_MSG_REDIRECT_BEGIN;
164    AcpiOsPrintf (ACPI_MSG_WARNING);
165
166    va_start (ArgList, Format);
167    AcpiOsVprintf (Format, ArgList);
168    ACPI_MSG_SUFFIX;
169    va_end (ArgList);
170
171    ACPI_MSG_REDIRECT_END;
172}
173
174ACPI_EXPORT_SYMBOL (AcpiWarning)
175
176
177/*******************************************************************************
178 *
179 * FUNCTION:    AcpiInfo
180 *
181 * PARAMETERS:  ModuleName          - Caller's module name (for error output)
182 *              LineNumber          - Caller's line number (for error output)
183 *              Format              - Printf format string + additional args
184 *
185 * RETURN:      None
186 *
187 * DESCRIPTION: Print generic "ACPI:" information message. There is no
188 *              module/line/version info in order to keep the message simple.
189 *
190 * TBD: ModuleName and LineNumber args are not needed, should be removed.
191 *
192 ******************************************************************************/
193
194void ACPI_INTERNAL_VAR_XFACE
195AcpiInfo (
196    const char              *ModuleName,
197    UINT32                  LineNumber,
198    const char              *Format,
199    ...)
200{
201    va_list                 ArgList;
202
203#ifdef _KERNEL
204    /* Temporarily hide too verbose printfs. */
205    if (!bootverbose)
206	return;
207#endif
208
209    ACPI_MSG_REDIRECT_BEGIN;
210    AcpiOsPrintf (ACPI_MSG_INFO);
211
212    va_start (ArgList, Format);
213    AcpiOsVprintf (Format, ArgList);
214    AcpiOsPrintf ("\n");
215    va_end (ArgList);
216
217    ACPI_MSG_REDIRECT_END;
218}
219
220ACPI_EXPORT_SYMBOL (AcpiInfo)
221
222
223/*******************************************************************************
224 *
225 * FUNCTION:    AcpiBiosError
226 *
227 * PARAMETERS:  ModuleName          - Caller's module name (for error output)
228 *              LineNumber          - Caller's line number (for error output)
229 *              Format              - Printf format string + additional args
230 *
231 * RETURN:      None
232 *
233 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
234 *              info
235 *
236 ******************************************************************************/
237
238void ACPI_INTERNAL_VAR_XFACE
239AcpiBiosError (
240    const char              *ModuleName,
241    UINT32                  LineNumber,
242    const char              *Format,
243    ...)
244{
245    va_list                 ArgList;
246
247
248    ACPI_MSG_REDIRECT_BEGIN;
249    AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
250
251    va_start (ArgList, Format);
252    AcpiOsVprintf (Format, ArgList);
253    ACPI_MSG_SUFFIX;
254    va_end (ArgList);
255
256    ACPI_MSG_REDIRECT_END;
257}
258
259ACPI_EXPORT_SYMBOL (AcpiBiosError)
260
261
262/*******************************************************************************
263 *
264 * FUNCTION:    AcpiBiosWarning
265 *
266 * PARAMETERS:  ModuleName          - Caller's module name (for error output)
267 *              LineNumber          - Caller's line number (for error output)
268 *              Format              - Printf format string + additional args
269 *
270 * RETURN:      None
271 *
272 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
273 *              info
274 *
275 ******************************************************************************/
276
277void ACPI_INTERNAL_VAR_XFACE
278AcpiBiosWarning (
279    const char              *ModuleName,
280    UINT32                  LineNumber,
281    const char              *Format,
282    ...)
283{
284    va_list                 ArgList;
285
286
287    ACPI_MSG_REDIRECT_BEGIN;
288    AcpiOsPrintf (ACPI_MSG_BIOS_WARNING);
289
290    va_start (ArgList, Format);
291    AcpiOsVprintf (Format, ArgList);
292    ACPI_MSG_SUFFIX;
293    va_end (ArgList);
294
295    ACPI_MSG_REDIRECT_END;
296}
297
298ACPI_EXPORT_SYMBOL (AcpiBiosWarning)
299
300#endif /* ACPI_NO_ERROR_MESSAGES */
301