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 "acpi.h"
48 #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 
205     ACPI_MSG_REDIRECT_BEGIN;
206     AcpiOsPrintf (ACPI_MSG_INFO);
207 
208     va_start (ArgList, Format);
209     AcpiOsVprintf (Format, ArgList);
210     AcpiOsPrintf ("\n");
211     va_end (ArgList);
212 
213     ACPI_MSG_REDIRECT_END;
214 }
215 
216 ACPI_EXPORT_SYMBOL (AcpiInfo)
217 
218 
219 /*******************************************************************************
220  *
221  * FUNCTION:    AcpiBiosError
222  *
223  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
224  *              LineNumber          - Caller's line number (for error output)
225  *              Format              - Printf format string + additional args
226  *
227  * RETURN:      None
228  *
229  * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
230  *              info
231  *
232  ******************************************************************************/
233 
234 void ACPI_INTERNAL_VAR_XFACE
235 AcpiBiosError (
236     const char              *ModuleName,
237     UINT32                  LineNumber,
238     const char              *Format,
239     ...)
240 {
241     va_list                 ArgList;
242 
243 
244     ACPI_MSG_REDIRECT_BEGIN;
245     AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
246 
247     va_start (ArgList, Format);
248     AcpiOsVprintf (Format, ArgList);
249     ACPI_MSG_SUFFIX;
250     va_end (ArgList);
251 
252     ACPI_MSG_REDIRECT_END;
253 }
254 
255 ACPI_EXPORT_SYMBOL (AcpiBiosError)
256 
257 
258 /*******************************************************************************
259  *
260  * FUNCTION:    AcpiBiosWarning
261  *
262  * PARAMETERS:  ModuleName          - Caller's module name (for error output)
263  *              LineNumber          - Caller's line number (for error output)
264  *              Format              - Printf format string + additional args
265  *
266  * RETURN:      None
267  *
268  * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
269  *              info
270  *
271  ******************************************************************************/
272 
273 void ACPI_INTERNAL_VAR_XFACE
274 AcpiBiosWarning (
275     const char              *ModuleName,
276     UINT32                  LineNumber,
277     const char              *Format,
278     ...)
279 {
280     va_list                 ArgList;
281 
282 
283     ACPI_MSG_REDIRECT_BEGIN;
284     AcpiOsPrintf (ACPI_MSG_BIOS_WARNING);
285 
286     va_start (ArgList, Format);
287     AcpiOsVprintf (Format, ArgList);
288     ACPI_MSG_SUFFIX;
289     va_end (ArgList);
290 
291     ACPI_MSG_REDIRECT_END;
292 }
293 
294 ACPI_EXPORT_SYMBOL (AcpiBiosWarning)
295 
296 #endif /* ACPI_NO_ERROR_MESSAGES */
297