xref: /openbmc/linux/drivers/acpi/acpica/utxferror.c (revision 597473720f4dc69749542bfcfed4a927a43d935e)
195857638SErik Schmauss // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
2cc84e262SBob Moore /*******************************************************************************
3cc84e262SBob Moore  *
4cc84e262SBob Moore  * Module Name: utxferror - Various error/warning output functions
5cc84e262SBob Moore  *
6cc84e262SBob Moore  ******************************************************************************/
7cc84e262SBob Moore 
8839e928fSLv Zheng #define EXPORT_ACPI_INTERFACES
9839e928fSLv Zheng 
10cc84e262SBob Moore #include <acpi/acpi.h>
11cc84e262SBob Moore #include "accommon.h"
12cc84e262SBob Moore 
13cc84e262SBob Moore #define _COMPONENT          ACPI_UTILITIES
14cc84e262SBob Moore ACPI_MODULE_NAME("utxferror")
15cc84e262SBob Moore 
16cc84e262SBob Moore /*
17cc84e262SBob Moore  * This module is used for the in-kernel ACPICA as well as the ACPICA
18cc84e262SBob Moore  * tools/applications.
19cc84e262SBob Moore  */
20407e22afSLv Zheng #ifndef ACPI_NO_ERROR_MESSAGES	/* Entire module */
21cc84e262SBob Moore /*******************************************************************************
22cc84e262SBob Moore  *
23cc84e262SBob Moore  * FUNCTION:    acpi_error
24cc84e262SBob Moore  *
25cc84e262SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
26cc84e262SBob Moore  *              line_number         - Caller's line number (for error output)
27ba494beeSBob Moore  *              format              - Printf format string + additional args
28cc84e262SBob Moore  *
29cc84e262SBob Moore  * RETURN:      None
30cc84e262SBob Moore  *
31cc84e262SBob Moore  * DESCRIPTION: Print "ACPI Error" message with module/line/version info
32cc84e262SBob Moore  *
33cc84e262SBob Moore  ******************************************************************************/
34cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
acpi_error(const char * module_name,u32 line_number,const char * format,...)35cc84e262SBob Moore acpi_error(const char *module_name, u32 line_number, const char *format, ...)
36cc84e262SBob Moore {
37cc84e262SBob Moore 	va_list arg_list;
38cc84e262SBob Moore 
39cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
40cc84e262SBob Moore 	acpi_os_printf(ACPI_MSG_ERROR);
41cc84e262SBob Moore 
42cc84e262SBob Moore 	va_start(arg_list, format);
43cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
44cc84e262SBob Moore 	ACPI_MSG_SUFFIX;
45cc84e262SBob Moore 	va_end(arg_list);
46cc84e262SBob Moore 
47cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
48cc84e262SBob Moore }
49cc84e262SBob Moore 
ACPI_EXPORT_SYMBOL(acpi_error)50cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_error)
51cc84e262SBob Moore 
52cc84e262SBob Moore /*******************************************************************************
53cc84e262SBob Moore  *
54cc84e262SBob Moore  * FUNCTION:    acpi_exception
55cc84e262SBob Moore  *
56cc84e262SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
57cc84e262SBob Moore  *              line_number         - Caller's line number (for error output)
58a2028624SBob Moore  *              status              - Status value to be decoded/formatted
59ba494beeSBob Moore  *              format              - Printf format string + additional args
60cc84e262SBob Moore  *
61cc84e262SBob Moore  * RETURN:      None
62cc84e262SBob Moore  *
63e814109bSBob Moore  * DESCRIPTION: Print an "ACPI Error" message with module/line/version
64e814109bSBob Moore  *              info as well as decoded acpi_status.
65cc84e262SBob Moore  *
66cc84e262SBob Moore  ******************************************************************************/
67cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
68cc84e262SBob Moore acpi_exception(const char *module_name,
69cc84e262SBob Moore 	       u32 line_number, acpi_status status, const char *format, ...)
70cc84e262SBob Moore {
71cc84e262SBob Moore 	va_list arg_list;
72cc84e262SBob Moore 
73cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
745b0bbfbdSBob Moore 
755b0bbfbdSBob Moore 	/* For AE_OK, just print the message */
765b0bbfbdSBob Moore 
775b0bbfbdSBob Moore 	if (ACPI_SUCCESS(status)) {
78e814109bSBob Moore 		acpi_os_printf(ACPI_MSG_ERROR);
795b0bbfbdSBob Moore 
805b0bbfbdSBob Moore 	} else {
81e814109bSBob Moore 		acpi_os_printf(ACPI_MSG_ERROR "%s, ",
82cc84e262SBob Moore 			       acpi_format_exception(status));
835b0bbfbdSBob Moore 	}
841fad8738SBob Moore 
85cc84e262SBob Moore 	va_start(arg_list, format);
86cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
87cc84e262SBob Moore 	ACPI_MSG_SUFFIX;
88cc84e262SBob Moore 	va_end(arg_list);
89cc84e262SBob Moore 
90cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
91cc84e262SBob Moore }
92cc84e262SBob Moore 
ACPI_EXPORT_SYMBOL(acpi_exception)93cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_exception)
94cc84e262SBob Moore 
95cc84e262SBob Moore /*******************************************************************************
96cc84e262SBob Moore  *
97cc84e262SBob Moore  * FUNCTION:    acpi_warning
98cc84e262SBob Moore  *
99a2028624SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for warning output)
100a2028624SBob Moore  *              line_number         - Caller's line number (for warning output)
101ba494beeSBob Moore  *              format              - Printf format string + additional args
102cc84e262SBob Moore  *
103cc84e262SBob Moore  * RETURN:      None
104cc84e262SBob Moore  *
105cc84e262SBob Moore  * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
106cc84e262SBob Moore  *
107cc84e262SBob Moore  ******************************************************************************/
108cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
109cc84e262SBob Moore acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
110cc84e262SBob Moore {
111cc84e262SBob Moore 	va_list arg_list;
112cc84e262SBob Moore 
113cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
114cc84e262SBob Moore 	acpi_os_printf(ACPI_MSG_WARNING);
115cc84e262SBob Moore 
116cc84e262SBob Moore 	va_start(arg_list, format);
117cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
118cc84e262SBob Moore 	ACPI_MSG_SUFFIX;
119cc84e262SBob Moore 	va_end(arg_list);
120cc84e262SBob Moore 
121cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
122cc84e262SBob Moore }
123cc84e262SBob Moore 
ACPI_EXPORT_SYMBOL(acpi_warning)124cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_warning)
125cc84e262SBob Moore 
126cc84e262SBob Moore /*******************************************************************************
127cc84e262SBob Moore  *
128cc84e262SBob Moore  * FUNCTION:    acpi_info
129cc84e262SBob Moore  *
130a2028624SBob Moore  * PARAMETERS:  format              - Printf format string + additional args
131cc84e262SBob Moore  *
132cc84e262SBob Moore  * RETURN:      None
133cc84e262SBob Moore  *
134cc84e262SBob Moore  * DESCRIPTION: Print generic "ACPI:" information message. There is no
135cc84e262SBob Moore  *              module/line/version info in order to keep the message simple.
136cc84e262SBob Moore  *
137cc84e262SBob Moore  ******************************************************************************/
13805fb04b5SBob Moore void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
139cc84e262SBob Moore {
140cc84e262SBob Moore 	va_list arg_list;
141cc84e262SBob Moore 
142cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
143cc84e262SBob Moore 	acpi_os_printf(ACPI_MSG_INFO);
144cc84e262SBob Moore 
145cc84e262SBob Moore 	va_start(arg_list, format);
146cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
147cc84e262SBob Moore 	acpi_os_printf("\n");
148cc84e262SBob Moore 	va_end(arg_list);
149cc84e262SBob Moore 
150cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
151cc84e262SBob Moore }
152cc84e262SBob Moore 
ACPI_EXPORT_SYMBOL(acpi_info)153cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_info)
154cc84e262SBob Moore 
15562cdd141SBob Moore /*******************************************************************************
15662cdd141SBob Moore  *
15762cdd141SBob Moore  * FUNCTION:    acpi_bios_error
15862cdd141SBob Moore  *
15962cdd141SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
16062cdd141SBob Moore  *              line_number         - Caller's line number (for error output)
16162cdd141SBob Moore  *              format              - Printf format string + additional args
16262cdd141SBob Moore  *
16362cdd141SBob Moore  * RETURN:      None
16462cdd141SBob Moore  *
16562cdd141SBob Moore  * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
16662cdd141SBob Moore  *              info
16762cdd141SBob Moore  *
16862cdd141SBob Moore  ******************************************************************************/
16962cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE
17062cdd141SBob Moore acpi_bios_error(const char *module_name,
17162cdd141SBob Moore 		u32 line_number, const char *format, ...)
17262cdd141SBob Moore {
17362cdd141SBob Moore 	va_list arg_list;
17462cdd141SBob Moore 
17562cdd141SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
17662cdd141SBob Moore 	acpi_os_printf(ACPI_MSG_BIOS_ERROR);
17762cdd141SBob Moore 
17862cdd141SBob Moore 	va_start(arg_list, format);
17962cdd141SBob Moore 	acpi_os_vprintf(format, arg_list);
18062cdd141SBob Moore 	ACPI_MSG_SUFFIX;
18162cdd141SBob Moore 	va_end(arg_list);
18262cdd141SBob Moore 
18362cdd141SBob Moore 	ACPI_MSG_REDIRECT_END;
18462cdd141SBob Moore }
18562cdd141SBob Moore 
ACPI_EXPORT_SYMBOL(acpi_bios_error)18662cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_error)
18762cdd141SBob Moore 
18862cdd141SBob Moore /*******************************************************************************
18962cdd141SBob Moore  *
190*f13c274dSBob Moore  * FUNCTION:    acpi_bios_exception
191*f13c274dSBob Moore  *
192*f13c274dSBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
193*f13c274dSBob Moore  *              line_number         - Caller's line number (for error output)
194*f13c274dSBob Moore  *              status              - Status value to be decoded/formatted
195*f13c274dSBob Moore  *              format              - Printf format string + additional args
196*f13c274dSBob Moore  *
197*f13c274dSBob Moore  * RETURN:      None
198*f13c274dSBob Moore  *
199*f13c274dSBob Moore  * DESCRIPTION: Print an "ACPI Firmware Error" message with module/line/version
200*f13c274dSBob Moore  *              info as well as decoded acpi_status.
201*f13c274dSBob Moore  *
202*f13c274dSBob Moore  ******************************************************************************/
203*f13c274dSBob Moore void ACPI_INTERNAL_VAR_XFACE
204*f13c274dSBob Moore acpi_bios_exception(const char *module_name,
205*f13c274dSBob Moore 		    u32 line_number,
206*f13c274dSBob Moore 		    acpi_status status, const char *format, ...)
207*f13c274dSBob Moore {
208*f13c274dSBob Moore 	va_list arg_list;
209*f13c274dSBob Moore 
210*f13c274dSBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
211*f13c274dSBob Moore 
212*f13c274dSBob Moore 	/* For AE_OK, just print the message */
213*f13c274dSBob Moore 
214*f13c274dSBob Moore 	if (ACPI_SUCCESS(status)) {
215*f13c274dSBob Moore 		acpi_os_printf(ACPI_MSG_BIOS_ERROR);
216*f13c274dSBob Moore 
217*f13c274dSBob Moore 	} else {
218*f13c274dSBob Moore 		acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s, ",
219*f13c274dSBob Moore 			       acpi_format_exception(status));
220*f13c274dSBob Moore 	}
221*f13c274dSBob Moore 
222*f13c274dSBob Moore 	va_start(arg_list, format);
223*f13c274dSBob Moore 	acpi_os_vprintf(format, arg_list);
224*f13c274dSBob Moore 	ACPI_MSG_SUFFIX;
225*f13c274dSBob Moore 	va_end(arg_list);
226*f13c274dSBob Moore 
227*f13c274dSBob Moore 	ACPI_MSG_REDIRECT_END;
228*f13c274dSBob Moore }
229*f13c274dSBob Moore 
ACPI_EXPORT_SYMBOL(acpi_bios_exception)230*f13c274dSBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_exception)
231*f13c274dSBob Moore 
232*f13c274dSBob Moore /*******************************************************************************
233*f13c274dSBob Moore  *
23462cdd141SBob Moore  * FUNCTION:    acpi_bios_warning
23562cdd141SBob Moore  *
236a2028624SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for warning output)
237a2028624SBob Moore  *              line_number         - Caller's line number (for warning output)
23862cdd141SBob Moore  *              format              - Printf format string + additional args
23962cdd141SBob Moore  *
24062cdd141SBob Moore  * RETURN:      None
24162cdd141SBob Moore  *
24262cdd141SBob Moore  * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
24362cdd141SBob Moore  *              info
24462cdd141SBob Moore  *
24562cdd141SBob Moore  ******************************************************************************/
24662cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE
24762cdd141SBob Moore acpi_bios_warning(const char *module_name,
24862cdd141SBob Moore 		  u32 line_number, const char *format, ...)
24962cdd141SBob Moore {
25062cdd141SBob Moore 	va_list arg_list;
25162cdd141SBob Moore 
25262cdd141SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
25362cdd141SBob Moore 	acpi_os_printf(ACPI_MSG_BIOS_WARNING);
25462cdd141SBob Moore 
25562cdd141SBob Moore 	va_start(arg_list, format);
25662cdd141SBob Moore 	acpi_os_vprintf(format, arg_list);
25762cdd141SBob Moore 	ACPI_MSG_SUFFIX;
25862cdd141SBob Moore 	va_end(arg_list);
25962cdd141SBob Moore 
26062cdd141SBob Moore 	ACPI_MSG_REDIRECT_END;
26162cdd141SBob Moore }
26262cdd141SBob Moore 
26362cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_warning)
264407e22afSLv Zheng #endif				/* ACPI_NO_ERROR_MESSAGES */
265