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