blob: 6bb85d691fcba1f8514b814831c6fac6a5134a9d [file] [log] [blame]
Erik Schmauss95857632018-03-14 16:13:07 -07001// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
Bob Moorecc84e262010-09-15 14:09:14 +08002/*******************************************************************************
3 *
4 * Module Name: utxferror - Various error/warning output functions
5 *
6 ******************************************************************************/
7
Lv Zheng839e9282013-10-29 09:29:51 +08008#define EXPORT_ACPI_INTERFACES
9
Bob Moorecc84e262010-09-15 14:09:14 +080010#include <acpi/acpi.h>
11#include "accommon.h"
Bob Moorecc84e262010-09-15 14:09:14 +080012
13#define _COMPONENT ACPI_UTILITIES
14ACPI_MODULE_NAME("utxferror")
15
16/*
17 * This module is used for the in-kernel ACPICA as well as the ACPICA
18 * tools/applications.
Bob Moorecc84e262010-09-15 14:09:14 +080019 */
Lv Zheng407e22a2014-04-30 10:04:48 +080020#ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */
Bob Moorecc84e262010-09-15 14:09:14 +080021/*******************************************************************************
22 *
23 * FUNCTION: acpi_error
24 *
25 * PARAMETERS: module_name - Caller's module name (for error output)
26 * line_number - Caller's line number (for error output)
Bob Mooreba494be2012-07-12 09:40:10 +080027 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080028 *
29 * RETURN: None
30 *
31 * DESCRIPTION: Print "ACPI Error" message with module/line/version info
32 *
33 ******************************************************************************/
34void ACPI_INTERNAL_VAR_XFACE
35acpi_error(const char *module_name, u32 line_number, const char *format, ...)
36{
37 va_list arg_list;
38
39 ACPI_MSG_REDIRECT_BEGIN;
40 acpi_os_printf(ACPI_MSG_ERROR);
41
42 va_start(arg_list, format);
43 acpi_os_vprintf(format, arg_list);
44 ACPI_MSG_SUFFIX;
45 va_end(arg_list);
46
47 ACPI_MSG_REDIRECT_END;
48}
49
50ACPI_EXPORT_SYMBOL(acpi_error)
51
52/*******************************************************************************
53 *
54 * FUNCTION: acpi_exception
55 *
56 * PARAMETERS: module_name - Caller's module name (for error output)
57 * line_number - Caller's line number (for error output)
Bob Moorea2028622017-04-26 16:17:50 +080058 * status - Status value to be decoded/formatted
Bob Mooreba494be2012-07-12 09:40:10 +080059 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +080060 *
61 * RETURN: None
62 *
Bob Mooree8141092017-11-17 15:42:17 -080063 * DESCRIPTION: Print an "ACPI Error" message with module/line/version
64 * info as well as decoded acpi_status.
Bob Moorecc84e262010-09-15 14:09:14 +080065 *
66 ******************************************************************************/
67void ACPI_INTERNAL_VAR_XFACE
68acpi_exception(const char *module_name,
69 u32 line_number, acpi_status status, const char *format, ...)
70{
71 va_list arg_list;
72
73 ACPI_MSG_REDIRECT_BEGIN;
Bob Moorecc84e262010-09-15 14:09:14 +080074
Bob Moore5b0bbfb2015-05-21 10:31:44 +080075 /* For AE_OK, just print the message */
76
77 if (ACPI_SUCCESS(status)) {
Bob Mooree8141092017-11-17 15:42:17 -080078 acpi_os_printf(ACPI_MSG_ERROR);
Bob Moore5b0bbfb2015-05-21 10:31:44 +080079
80 } else {
Bob Mooree8141092017-11-17 15:42:17 -080081 acpi_os_printf(ACPI_MSG_ERROR "%s, ",
Bob Moore5b0bbfb2015-05-21 10:31:44 +080082 acpi_format_exception(status));
83 }
Bob Moore1fad8732015-12-29 13:54:36 +080084
Bob Moorecc84e262010-09-15 14:09:14 +080085 va_start(arg_list, format);
86 acpi_os_vprintf(format, arg_list);
87 ACPI_MSG_SUFFIX;
88 va_end(arg_list);
89
90 ACPI_MSG_REDIRECT_END;
91}
92
93ACPI_EXPORT_SYMBOL(acpi_exception)
94
95/*******************************************************************************
96 *
97 * FUNCTION: acpi_warning
98 *
Bob Moorea2028622017-04-26 16:17:50 +080099 * PARAMETERS: module_name - Caller's module name (for warning output)
100 * line_number - Caller's line number (for warning output)
Bob Mooreba494be2012-07-12 09:40:10 +0800101 * format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800102 *
103 * RETURN: None
104 *
105 * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
106 *
107 ******************************************************************************/
108void ACPI_INTERNAL_VAR_XFACE
109acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
110{
111 va_list arg_list;
112
113 ACPI_MSG_REDIRECT_BEGIN;
114 acpi_os_printf(ACPI_MSG_WARNING);
115
116 va_start(arg_list, format);
117 acpi_os_vprintf(format, arg_list);
118 ACPI_MSG_SUFFIX;
119 va_end(arg_list);
120
121 ACPI_MSG_REDIRECT_END;
122}
123
124ACPI_EXPORT_SYMBOL(acpi_warning)
125
126/*******************************************************************************
127 *
128 * FUNCTION: acpi_info
129 *
Bob Moorea2028622017-04-26 16:17:50 +0800130 * PARAMETERS: format - Printf format string + additional args
Bob Moorecc84e262010-09-15 14:09:14 +0800131 *
132 * RETURN: None
133 *
134 * DESCRIPTION: Print generic "ACPI:" information message. There is no
135 * module/line/version info in order to keep the message simple.
136 *
Bob Moorecc84e262010-09-15 14:09:14 +0800137 ******************************************************************************/
Bob Moore05fb04b2016-02-19 14:16:42 +0800138void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
Bob Moorecc84e262010-09-15 14:09:14 +0800139{
140 va_list arg_list;
141
142 ACPI_MSG_REDIRECT_BEGIN;
143 acpi_os_printf(ACPI_MSG_INFO);
144
145 va_start(arg_list, format);
146 acpi_os_vprintf(format, arg_list);
147 acpi_os_printf("\n");
148 va_end(arg_list);
149
150 ACPI_MSG_REDIRECT_END;
151}
152
153ACPI_EXPORT_SYMBOL(acpi_info)
154
Bob Moore62cdd142012-07-16 09:25:27 +0800155/*******************************************************************************
156 *
157 * FUNCTION: acpi_bios_error
158 *
159 * PARAMETERS: module_name - Caller's module name (for error output)
160 * line_number - Caller's line number (for error output)
161 * format - Printf format string + additional args
162 *
163 * RETURN: None
164 *
165 * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
166 * info
167 *
168 ******************************************************************************/
169void ACPI_INTERNAL_VAR_XFACE
170acpi_bios_error(const char *module_name,
171 u32 line_number, const char *format, ...)
172{
173 va_list arg_list;
174
175 ACPI_MSG_REDIRECT_BEGIN;
176 acpi_os_printf(ACPI_MSG_BIOS_ERROR);
177
178 va_start(arg_list, format);
179 acpi_os_vprintf(format, arg_list);
180 ACPI_MSG_SUFFIX;
181 va_end(arg_list);
182
183 ACPI_MSG_REDIRECT_END;
184}
185
186ACPI_EXPORT_SYMBOL(acpi_bios_error)
187
188/*******************************************************************************
189 *
190 * FUNCTION: acpi_bios_warning
191 *
Bob Moorea2028622017-04-26 16:17:50 +0800192 * PARAMETERS: module_name - Caller's module name (for warning output)
193 * line_number - Caller's line number (for warning output)
Bob Moore62cdd142012-07-16 09:25:27 +0800194 * format - Printf format string + additional args
195 *
196 * RETURN: None
197 *
198 * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
199 * info
200 *
201 ******************************************************************************/
202void ACPI_INTERNAL_VAR_XFACE
203acpi_bios_warning(const char *module_name,
204 u32 line_number, const char *format, ...)
205{
206 va_list arg_list;
207
208 ACPI_MSG_REDIRECT_BEGIN;
209 acpi_os_printf(ACPI_MSG_BIOS_WARNING);
210
211 va_start(arg_list, format);
212 acpi_os_vprintf(format, arg_list);
213 ACPI_MSG_SUFFIX;
214 va_end(arg_list);
215
216 ACPI_MSG_REDIRECT_END;
217}
218
219ACPI_EXPORT_SYMBOL(acpi_bios_warning)
Lv Zheng407e22a2014-04-30 10:04:48 +0800220#endif /* ACPI_NO_ERROR_MESSAGES */