xref: /openbmc/linux/drivers/acpi/acpica/utxferror.c (revision 95857638889aeea1b10a16b55041adf3e3ab84c4)
1*95857638SErik 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
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 
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 
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 
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 
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 
18662cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_error)
18762cdd141SBob Moore 
18862cdd141SBob Moore /*******************************************************************************
18962cdd141SBob Moore  *
19062cdd141SBob Moore  * FUNCTION:    acpi_bios_warning
19162cdd141SBob Moore  *
192a2028624SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for warning output)
193a2028624SBob Moore  *              line_number         - Caller's line number (for warning output)
19462cdd141SBob Moore  *              format              - Printf format string + additional args
19562cdd141SBob Moore  *
19662cdd141SBob Moore  * RETURN:      None
19762cdd141SBob Moore  *
19862cdd141SBob Moore  * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
19962cdd141SBob Moore  *              info
20062cdd141SBob Moore  *
20162cdd141SBob Moore  ******************************************************************************/
20262cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE
20362cdd141SBob Moore acpi_bios_warning(const char *module_name,
20462cdd141SBob Moore 		  u32 line_number, const char *format, ...)
20562cdd141SBob Moore {
20662cdd141SBob Moore 	va_list arg_list;
20762cdd141SBob Moore 
20862cdd141SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
20962cdd141SBob Moore 	acpi_os_printf(ACPI_MSG_BIOS_WARNING);
21062cdd141SBob Moore 
21162cdd141SBob Moore 	va_start(arg_list, format);
21262cdd141SBob Moore 	acpi_os_vprintf(format, arg_list);
21362cdd141SBob Moore 	ACPI_MSG_SUFFIX;
21462cdd141SBob Moore 	va_end(arg_list);
21562cdd141SBob Moore 
21662cdd141SBob Moore 	ACPI_MSG_REDIRECT_END;
21762cdd141SBob Moore }
21862cdd141SBob Moore 
21962cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_warning)
220407e22afSLv Zheng #endif				/* ACPI_NO_ERROR_MESSAGES */
221