blob: 9da4f8ef2e77bae10a07d766db2ae86899093c33 [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 Moore7735ca02017-02-08 11:00:08 +08008 * Copyright (C) 2000 - 2017, 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 Moorea2028622017-04-26 16:17:50 +080094 * status - Status value to be decoded/formatted
Bob Mooreba494be2012-07-12 09:40:10 +080095 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080096 *
97 * RETURN: None
98 *
Bob Mooree8141092017-11-17 15:42:17 -080099 * DESCRIPTION: Print an "ACPI Error" message with module/line/version
100 * info as well as decoded acpi_status.
Bob Moorecc84e262010-09-15 14:09:14 +0800101 *
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)) {
Bob Mooree8141092017-11-17 15:42:17 -0800114 acpi_os_printf(ACPI_MSG_ERROR);
Bob Moore5b0bbfb2015-05-21 10:31:44 +0800115
116 } else {
Bob Mooree8141092017-11-17 15:42:17 -0800117 acpi_os_printf(ACPI_MSG_ERROR "%s, ",
Bob Moore5b0bbfb2015-05-21 10:31:44 +0800118 acpi_format_exception(status));
119 }
Bob Moore1fad8732015-12-29 13:54:36 +0800120
Bob Moorecc84e262010-09-15 14:09:14 +0800121 va_start(arg_list, format);
122 acpi_os_vprintf(format, arg_list);
123 ACPI_MSG_SUFFIX;
124 va_end(arg_list);
125
126 ACPI_MSG_REDIRECT_END;
127}
128
129ACPI_EXPORT_SYMBOL(acpi_exception)
130
131/*******************************************************************************
132 *
133 * FUNCTION: acpi_warning
134 *
Bob Moorea2028622017-04-26 16:17:50 +0800135 * PARAMETERS: module_name - Caller's module name (for warning output)
136 * line_number - Caller's line number (for warning output)
Bob Mooreba494be2012-07-12 09:40:10 +0800137 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800138 *
139 * RETURN: None
140 *
141 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
142 *
143 ******************************************************************************/
144void ACPI_INTERNAL_VAR_XFACE
145acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
146{
147 va_list arg_list;
148
149 ACPI_MSG_REDIRECT_BEGIN;
150 acpi_os_printf(ACPI_MSG_WARNING);
151
152 va_start(arg_list, format);
153 acpi_os_vprintf(format, arg_list);
154 ACPI_MSG_SUFFIX;
155 va_end(arg_list);
156
157 ACPI_MSG_REDIRECT_END;
158}
159
160ACPI_EXPORT_SYMBOL(acpi_warning)
161
162/*******************************************************************************
163 *
164 * FUNCTION: acpi_info
165 *
Bob Moorea2028622017-04-26 16:17:50 +0800166 * PARAMETERS: format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800167 *
168 * RETURN: None
169 *
170 * DESCRIPTION: Print generic "ACPI:" information message. There is no
171 * module/line/version info in order to keep the message simple.
172 *
Bob Moorecc84e262010-09-15 14:09:14 +0800173 ******************************************************************************/
Bob Moore05fb04b2016-02-19 14:16:42 +0800174void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
Bob Moorecc84e262010-09-15 14:09:14 +0800175{
176 va_list arg_list;
177
178 ACPI_MSG_REDIRECT_BEGIN;
179 acpi_os_printf(ACPI_MSG_INFO);
180
181 va_start(arg_list, format);
182 acpi_os_vprintf(format, arg_list);
183 acpi_os_printf("\n");
184 va_end(arg_list);
185
186 ACPI_MSG_REDIRECT_END;
187}
188
189ACPI_EXPORT_SYMBOL(acpi_info)
190
Bob Moore62cdd142012-07-16 09:25:27 +0800191/*******************************************************************************
192 *
193 * FUNCTION: acpi_bios_error
194 *
195 * PARAMETERS: module_name - Caller's module name (for error output)
196 * line_number - Caller's line number (for error output)
197 * format - Printf format string + additional args
198 *
199 * RETURN: None
200 *
201 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
202 * info
203 *
204 ******************************************************************************/
205void ACPI_INTERNAL_VAR_XFACE
206acpi_bios_error(const char *module_name,
207 u32 line_number, const char *format, ...)
208{
209 va_list arg_list;
210
211 ACPI_MSG_REDIRECT_BEGIN;
212 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
213
214 va_start(arg_list, format);
215 acpi_os_vprintf(format, arg_list);
216 ACPI_MSG_SUFFIX;
217 va_end(arg_list);
218
219 ACPI_MSG_REDIRECT_END;
220}
221
222ACPI_EXPORT_SYMBOL(acpi_bios_error)
223
224/*******************************************************************************
225 *
226 * FUNCTION: acpi_bios_warning
227 *
Bob Moorea2028622017-04-26 16:17:50 +0800228 * PARAMETERS: module_name - Caller's module name (for warning output)
229 * line_number - Caller's line number (for warning output)
Bob Moore62cdd142012-07-16 09:25:27 +0800230 * format - Printf format string + additional args
231 *
232 * RETURN: None
233 *
234 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
235 * info
236 *
237 ******************************************************************************/
238void ACPI_INTERNAL_VAR_XFACE
239acpi_bios_warning(const char *module_name,
240 u32 line_number, const char *format, ...)
241{
242 va_list arg_list;
243
244 ACPI_MSG_REDIRECT_BEGIN;
245 acpi_os_printf(ACPI_MSG_BIOS_WARNING);
246
247 va_start(arg_list, format);
248 acpi_os_vprintf(format, arg_list);
249 ACPI_MSG_SUFFIX;
250 va_end(arg_list);
251
252 ACPI_MSG_REDIRECT_END;
253}
254
255ACPI_EXPORT_SYMBOL(acpi_bios_warning)
Lv Zheng407e22a2014-04-30 10:04:48 +0800256#endif /* ACPI_NO_ERROR_MESSAGES */