blob: e966a2e47b765e6c097ca7973b54fa2d987ab6cd [file] [log] [blame]
Bob Moorecc84e262010-09-15 14:09:14 +08001/*******************************************************************************
2 *
3 * Module Name: utxferror - Various error/warning output functions
4 *
5 ******************************************************************************/
6
7/*
Bob Moore25f044e2013-01-25 05:38:56 +00008 * Copyright (C) 2000 - 2013, Intel Corp.
Bob Moorecc84e262010-09-15 14:09:14 +08009 * 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
Paul Gortmaker214f2c92011-10-26 16:22:14 -040044#include <linux/export.h>
Bob Moorecc84e262010-09-15 14:09:14 +080045#include <acpi/acpi.h>
46#include "accommon.h"
Bob Moorecc84e262010-09-15 14:09:14 +080047
48#define _COMPONENT ACPI_UTILITIES
49ACPI_MODULE_NAME("utxferror")
50
51/*
52 * This module is used for the in-kernel ACPICA as well as the ACPICA
53 * tools/applications.
Bob Moorecc84e262010-09-15 14:09:14 +080054 */
Bob Moorecc84e262010-09-15 14:09:14 +080055/*******************************************************************************
56 *
57 * FUNCTION: acpi_error
58 *
59 * PARAMETERS: module_name - Caller's module name (for error output)
60 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +080061 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080062 *
63 * RETURN: None
64 *
65 * DESCRIPTION: Print "ACPI Error" message with module/line/version info
66 *
67 ******************************************************************************/
68void ACPI_INTERNAL_VAR_XFACE
69acpi_error(const char *module_name, u32 line_number, const char *format, ...)
70{
71 va_list arg_list;
72
73 ACPI_MSG_REDIRECT_BEGIN;
74 acpi_os_printf(ACPI_MSG_ERROR);
75
76 va_start(arg_list, format);
77 acpi_os_vprintf(format, arg_list);
78 ACPI_MSG_SUFFIX;
79 va_end(arg_list);
80
81 ACPI_MSG_REDIRECT_END;
82}
83
84ACPI_EXPORT_SYMBOL(acpi_error)
85
86/*******************************************************************************
87 *
88 * FUNCTION: acpi_exception
89 *
90 * PARAMETERS: module_name - Caller's module name (for error output)
91 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +080092 * status - Status to be formatted
93 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080094 *
95 * RETURN: None
96 *
97 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
98 * and decoded acpi_status.
99 *
100 ******************************************************************************/
101void ACPI_INTERNAL_VAR_XFACE
102acpi_exception(const char *module_name,
103 u32 line_number, acpi_status status, const char *format, ...)
104{
105 va_list arg_list;
106
107 ACPI_MSG_REDIRECT_BEGIN;
108 acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
109 acpi_format_exception(status));
110
111 va_start(arg_list, format);
112 acpi_os_vprintf(format, arg_list);
113 ACPI_MSG_SUFFIX;
114 va_end(arg_list);
115
116 ACPI_MSG_REDIRECT_END;
117}
118
119ACPI_EXPORT_SYMBOL(acpi_exception)
120
121/*******************************************************************************
122 *
123 * FUNCTION: acpi_warning
124 *
125 * PARAMETERS: module_name - Caller's module name (for error output)
126 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +0800127 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800128 *
129 * RETURN: None
130 *
131 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
132 *
133 ******************************************************************************/
134void ACPI_INTERNAL_VAR_XFACE
135acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
136{
137 va_list arg_list;
138
139 ACPI_MSG_REDIRECT_BEGIN;
140 acpi_os_printf(ACPI_MSG_WARNING);
141
142 va_start(arg_list, format);
143 acpi_os_vprintf(format, arg_list);
144 ACPI_MSG_SUFFIX;
145 va_end(arg_list);
146
147 ACPI_MSG_REDIRECT_END;
148}
149
150ACPI_EXPORT_SYMBOL(acpi_warning)
151
152/*******************************************************************************
153 *
154 * FUNCTION: acpi_info
155 *
156 * PARAMETERS: module_name - Caller's module name (for error output)
157 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +0800158 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800159 *
160 * RETURN: None
161 *
162 * DESCRIPTION: Print generic "ACPI:" information message. There is no
163 * module/line/version info in order to keep the message simple.
164 *
165 * TBD: module_name and line_number args are not needed, should be removed.
166 *
167 ******************************************************************************/
168void ACPI_INTERNAL_VAR_XFACE
169acpi_info(const char *module_name, u32 line_number, const char *format, ...)
170{
171 va_list arg_list;
172
173 ACPI_MSG_REDIRECT_BEGIN;
174 acpi_os_printf(ACPI_MSG_INFO);
175
176 va_start(arg_list, format);
177 acpi_os_vprintf(format, arg_list);
178 acpi_os_printf("\n");
179 va_end(arg_list);
180
181 ACPI_MSG_REDIRECT_END;
182}
183
184ACPI_EXPORT_SYMBOL(acpi_info)
185
Bob Moore62cdd142012-07-16 09:25:27 +0800186/*******************************************************************************
187 *
188 * FUNCTION: acpi_bios_error
189 *
190 * PARAMETERS: module_name - Caller's module name (for error output)
191 * line_number - Caller's line number (for error output)
192 * format - Printf format string + additional args
193 *
194 * RETURN: None
195 *
196 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
197 * info
198 *
199 ******************************************************************************/
200void ACPI_INTERNAL_VAR_XFACE
201acpi_bios_error(const char *module_name,
202 u32 line_number, const char *format, ...)
203{
204 va_list arg_list;
205
206 ACPI_MSG_REDIRECT_BEGIN;
207 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
208
209 va_start(arg_list, format);
210 acpi_os_vprintf(format, arg_list);
211 ACPI_MSG_SUFFIX;
212 va_end(arg_list);
213
214 ACPI_MSG_REDIRECT_END;
215}
216
217ACPI_EXPORT_SYMBOL(acpi_bios_error)
218
219/*******************************************************************************
220 *
221 * FUNCTION: acpi_bios_warning
222 *
223 * PARAMETERS: module_name - Caller's module name (for error output)
224 * line_number - Caller's line number (for error output)
225 * format - Printf format string + additional args
226 *
227 * RETURN: None
228 *
229 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
230 * info
231 *
232 ******************************************************************************/
233void ACPI_INTERNAL_VAR_XFACE
234acpi_bios_warning(const char *module_name,
235 u32 line_number, const char *format, ...)
236{
237 va_list arg_list;
238
239 ACPI_MSG_REDIRECT_BEGIN;
240 acpi_os_printf(ACPI_MSG_BIOS_WARNING);
241
242 va_start(arg_list, format);
243 acpi_os_vprintf(format, arg_list);
244 ACPI_MSG_SUFFIX;
245 va_end(arg_list);
246
247 ACPI_MSG_REDIRECT_END;
248}
249
250ACPI_EXPORT_SYMBOL(acpi_bios_warning)