blob: 98d578753101e3ff4b7bcf73c83fdb679bc7c765 [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/*
David E. Box82a80942015-02-05 15:20:45 +08008 * Copyright (C) 2000 - 2015, 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
Lv Zheng839e9282013-10-29 09:29:51 +080044#define EXPORT_ACPI_INTERFACES
45
Bob Moorecc84e262010-09-15 14:09:14 +080046#include <acpi/acpi.h>
47#include "accommon.h"
Bob Moorecc84e262010-09-15 14:09:14 +080048
49#define _COMPONENT ACPI_UTILITIES
50ACPI_MODULE_NAME("utxferror")
51
52/*
53 * This module is used for the in-kernel ACPICA as well as the ACPICA
54 * tools/applications.
Bob Moorecc84e262010-09-15 14:09:14 +080055 */
Lv Zheng407e22a2014-04-30 10:04:48 +080056#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */
Bob Moorecc84e262010-09-15 14:09:14 +080057/*******************************************************************************
58 *
59 * FUNCTION: acpi_error
60 *
61 * PARAMETERS: module_name - Caller's module name (for error output)
62 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +080063 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080064 *
65 * RETURN: None
66 *
67 * DESCRIPTION: Print "ACPI Error" message with module/line/version info
68 *
69 ******************************************************************************/
70void ACPI_INTERNAL_VAR_XFACE
71acpi_error(const char *module_name, u32 line_number, const char *format, ...)
72{
73 va_list arg_list;
74
75 ACPI_MSG_REDIRECT_BEGIN;
76 acpi_os_printf(ACPI_MSG_ERROR);
77
78 va_start(arg_list, format);
79 acpi_os_vprintf(format, arg_list);
80 ACPI_MSG_SUFFIX;
81 va_end(arg_list);
82
83 ACPI_MSG_REDIRECT_END;
84}
85
86ACPI_EXPORT_SYMBOL(acpi_error)
87
88/*******************************************************************************
89 *
90 * FUNCTION: acpi_exception
91 *
92 * PARAMETERS: module_name - Caller's module name (for error output)
93 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +080094 * status - Status to be formatted
95 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080096 *
97 * RETURN: None
98 *
99 * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
100 * and decoded acpi_status.
101 *
102 ******************************************************************************/
103void ACPI_INTERNAL_VAR_XFACE
104acpi_exception(const char *module_name,
105 u32 line_number, acpi_status status, const char *format, ...)
106{
107 va_list arg_list;
108
109 ACPI_MSG_REDIRECT_BEGIN;
Bob Moorecc84e262010-09-15 14:09:14 +0800110
Bob Moore5b0bbfb2015-05-21 10:31:44 +0800111 /* For AE_OK, just print the message */
112
113 if (ACPI_SUCCESS(status)) {
114 acpi_os_printf(ACPI_MSG_EXCEPTION);
115
116 } else {
117 acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
118 acpi_format_exception(status));
119 }
Bob Moorecc84e262010-09-15 14:09:14 +0800120 va_start(arg_list, format);
121 acpi_os_vprintf(format, arg_list);
122 ACPI_MSG_SUFFIX;
123 va_end(arg_list);
124
125 ACPI_MSG_REDIRECT_END;
126}
127
128ACPI_EXPORT_SYMBOL(acpi_exception)
129
130/*******************************************************************************
131 *
132 * FUNCTION: acpi_warning
133 *
134 * PARAMETERS: module_name - Caller's module name (for error output)
135 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +0800136 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800137 *
138 * RETURN: None
139 *
140 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
141 *
142 ******************************************************************************/
143void ACPI_INTERNAL_VAR_XFACE
144acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
145{
146 va_list arg_list;
147
148 ACPI_MSG_REDIRECT_BEGIN;
149 acpi_os_printf(ACPI_MSG_WARNING);
150
151 va_start(arg_list, format);
152 acpi_os_vprintf(format, arg_list);
153 ACPI_MSG_SUFFIX;
154 va_end(arg_list);
155
156 ACPI_MSG_REDIRECT_END;
157}
158
159ACPI_EXPORT_SYMBOL(acpi_warning)
160
161/*******************************************************************************
162 *
163 * FUNCTION: acpi_info
164 *
165 * PARAMETERS: module_name - Caller's module name (for error output)
166 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +0800167 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800168 *
169 * RETURN: None
170 *
171 * DESCRIPTION: Print generic "ACPI:" information message. There is no
172 * module/line/version info in order to keep the message simple.
173 *
174 * TBD: module_name and line_number args are not needed, should be removed.
175 *
176 ******************************************************************************/
177void ACPI_INTERNAL_VAR_XFACE
178acpi_info(const char *module_name, u32 line_number, const char *format, ...)
179{
180 va_list arg_list;
181
182 ACPI_MSG_REDIRECT_BEGIN;
183 acpi_os_printf(ACPI_MSG_INFO);
184
185 va_start(arg_list, format);
186 acpi_os_vprintf(format, arg_list);
187 acpi_os_printf("\n");
188 va_end(arg_list);
189
190 ACPI_MSG_REDIRECT_END;
191}
192
193ACPI_EXPORT_SYMBOL(acpi_info)
194
Bob Moore62cdd142012-07-16 09:25:27 +0800195/*******************************************************************************
196 *
197 * FUNCTION: acpi_bios_error
198 *
199 * PARAMETERS: module_name - Caller's module name (for error output)
200 * line_number - Caller's line number (for error output)
201 * format - Printf format string + additional args
202 *
203 * RETURN: None
204 *
205 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
206 * info
207 *
208 ******************************************************************************/
209void ACPI_INTERNAL_VAR_XFACE
210acpi_bios_error(const char *module_name,
211 u32 line_number, const char *format, ...)
212{
213 va_list arg_list;
214
215 ACPI_MSG_REDIRECT_BEGIN;
216 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
217
218 va_start(arg_list, format);
219 acpi_os_vprintf(format, arg_list);
220 ACPI_MSG_SUFFIX;
221 va_end(arg_list);
222
223 ACPI_MSG_REDIRECT_END;
224}
225
226ACPI_EXPORT_SYMBOL(acpi_bios_error)
227
228/*******************************************************************************
229 *
230 * FUNCTION: acpi_bios_warning
231 *
232 * PARAMETERS: module_name - Caller's module name (for error output)
233 * line_number - Caller's line number (for error output)
234 * format - Printf format string + additional args
235 *
236 * RETURN: None
237 *
238 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
239 * info
240 *
241 ******************************************************************************/
242void ACPI_INTERNAL_VAR_XFACE
243acpi_bios_warning(const char *module_name,
244 u32 line_number, const char *format, ...)
245{
246 va_list arg_list;
247
248 ACPI_MSG_REDIRECT_BEGIN;
249 acpi_os_printf(ACPI_MSG_BIOS_WARNING);
250
251 va_start(arg_list, format);
252 acpi_os_vprintf(format, arg_list);
253 ACPI_MSG_SUFFIX;
254 va_end(arg_list);
255
256 ACPI_MSG_REDIRECT_END;
257}
258
259ACPI_EXPORT_SYMBOL(acpi_bios_warning)
Lv Zheng407e22a2014-04-30 10:04:48 +0800260#endif /* ACPI_NO_ERROR_MESSAGES */