xref: /openbmc/linux/drivers/acpi/acpica/utxferror.c (revision 5b0bbfbd56118d2f5dca2b56ea47103470fa7aaa)
1cc84e262SBob Moore /*******************************************************************************
2cc84e262SBob Moore  *
3cc84e262SBob Moore  * Module Name: utxferror - Various error/warning output functions
4cc84e262SBob Moore  *
5cc84e262SBob Moore  ******************************************************************************/
6cc84e262SBob Moore 
7cc84e262SBob Moore /*
882a80941SDavid E. Box  * Copyright (C) 2000 - 2015, Intel Corp.
9cc84e262SBob Moore  * All rights reserved.
10cc84e262SBob Moore  *
11cc84e262SBob Moore  * Redistribution and use in source and binary forms, with or without
12cc84e262SBob Moore  * modification, are permitted provided that the following conditions
13cc84e262SBob Moore  * are met:
14cc84e262SBob Moore  * 1. Redistributions of source code must retain the above copyright
15cc84e262SBob Moore  *    notice, this list of conditions, and the following disclaimer,
16cc84e262SBob Moore  *    without modification.
17cc84e262SBob Moore  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18cc84e262SBob Moore  *    substantially similar to the "NO WARRANTY" disclaimer below
19cc84e262SBob Moore  *    ("Disclaimer") and any redistribution must be conditioned upon
20cc84e262SBob Moore  *    including a substantially similar Disclaimer requirement for further
21cc84e262SBob Moore  *    binary redistribution.
22cc84e262SBob Moore  * 3. Neither the names of the above-listed copyright holders nor the names
23cc84e262SBob Moore  *    of any contributors may be used to endorse or promote products derived
24cc84e262SBob Moore  *    from this software without specific prior written permission.
25cc84e262SBob Moore  *
26cc84e262SBob Moore  * Alternatively, this software may be distributed under the terms of the
27cc84e262SBob Moore  * GNU General Public License ("GPL") version 2 as published by the Free
28cc84e262SBob Moore  * Software Foundation.
29cc84e262SBob Moore  *
30cc84e262SBob Moore  * NO WARRANTY
31cc84e262SBob Moore  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32cc84e262SBob Moore  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33cc84e262SBob Moore  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34cc84e262SBob Moore  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35cc84e262SBob Moore  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36cc84e262SBob Moore  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37cc84e262SBob Moore  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38cc84e262SBob Moore  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39cc84e262SBob Moore  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40cc84e262SBob Moore  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41cc84e262SBob Moore  * POSSIBILITY OF SUCH DAMAGES.
42cc84e262SBob Moore  */
43cc84e262SBob Moore 
44839e928fSLv Zheng #define EXPORT_ACPI_INTERFACES
45839e928fSLv Zheng 
46cc84e262SBob Moore #include <acpi/acpi.h>
47cc84e262SBob Moore #include "accommon.h"
48cc84e262SBob Moore 
49cc84e262SBob Moore #define _COMPONENT          ACPI_UTILITIES
50cc84e262SBob Moore ACPI_MODULE_NAME("utxferror")
51cc84e262SBob Moore 
52cc84e262SBob Moore /*
53cc84e262SBob Moore  * This module is used for the in-kernel ACPICA as well as the ACPICA
54cc84e262SBob Moore  * tools/applications.
55cc84e262SBob Moore  */
56407e22afSLv Zheng #ifndef ACPI_NO_ERROR_MESSAGES	/* Entire module */
57cc84e262SBob Moore /*******************************************************************************
58cc84e262SBob Moore  *
59cc84e262SBob Moore  * FUNCTION:    acpi_error
60cc84e262SBob Moore  *
61cc84e262SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
62cc84e262SBob Moore  *              line_number         - Caller's line number (for error output)
63ba494beeSBob Moore  *              format              - Printf format string + additional args
64cc84e262SBob Moore  *
65cc84e262SBob Moore  * RETURN:      None
66cc84e262SBob Moore  *
67cc84e262SBob Moore  * DESCRIPTION: Print "ACPI Error" message with module/line/version info
68cc84e262SBob Moore  *
69cc84e262SBob Moore  ******************************************************************************/
70cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
71cc84e262SBob Moore acpi_error(const char *module_name, u32 line_number, const char *format, ...)
72cc84e262SBob Moore {
73cc84e262SBob Moore 	va_list arg_list;
74cc84e262SBob Moore 
75cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
76cc84e262SBob Moore 	acpi_os_printf(ACPI_MSG_ERROR);
77cc84e262SBob Moore 
78cc84e262SBob Moore 	va_start(arg_list, format);
79cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
80cc84e262SBob Moore 	ACPI_MSG_SUFFIX;
81cc84e262SBob Moore 	va_end(arg_list);
82cc84e262SBob Moore 
83cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
84cc84e262SBob Moore }
85cc84e262SBob Moore 
86cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_error)
87cc84e262SBob Moore 
88cc84e262SBob Moore /*******************************************************************************
89cc84e262SBob Moore  *
90cc84e262SBob Moore  * FUNCTION:    acpi_exception
91cc84e262SBob Moore  *
92cc84e262SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
93cc84e262SBob Moore  *              line_number         - Caller's line number (for error output)
94ba494beeSBob Moore  *              status              - Status to be formatted
95ba494beeSBob Moore  *              format              - Printf format string + additional args
96cc84e262SBob Moore  *
97cc84e262SBob Moore  * RETURN:      None
98cc84e262SBob Moore  *
99cc84e262SBob Moore  * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
100cc84e262SBob Moore  *              and decoded acpi_status.
101cc84e262SBob Moore  *
102cc84e262SBob Moore  ******************************************************************************/
103cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
104cc84e262SBob Moore acpi_exception(const char *module_name,
105cc84e262SBob Moore 	       u32 line_number, acpi_status status, const char *format, ...)
106cc84e262SBob Moore {
107cc84e262SBob Moore 	va_list arg_list;
108cc84e262SBob Moore 
109cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
110*5b0bbfbdSBob Moore 
111*5b0bbfbdSBob Moore 	/* For AE_OK, just print the message */
112*5b0bbfbdSBob Moore 
113*5b0bbfbdSBob Moore 	if (ACPI_SUCCESS(status)) {
114*5b0bbfbdSBob Moore 		acpi_os_printf(ACPI_MSG_EXCEPTION);
115*5b0bbfbdSBob Moore 
116*5b0bbfbdSBob Moore 	} else {
117cc84e262SBob Moore 		acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
118cc84e262SBob Moore 			       acpi_format_exception(status));
119*5b0bbfbdSBob Moore 	}
120cc84e262SBob Moore 	va_start(arg_list, format);
121cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
122cc84e262SBob Moore 	ACPI_MSG_SUFFIX;
123cc84e262SBob Moore 	va_end(arg_list);
124cc84e262SBob Moore 
125cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
126cc84e262SBob Moore }
127cc84e262SBob Moore 
128cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_exception)
129cc84e262SBob Moore 
130cc84e262SBob Moore /*******************************************************************************
131cc84e262SBob Moore  *
132cc84e262SBob Moore  * FUNCTION:    acpi_warning
133cc84e262SBob Moore  *
134cc84e262SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
135cc84e262SBob Moore  *              line_number         - Caller's line number (for error output)
136ba494beeSBob Moore  *              format              - Printf format string + additional args
137cc84e262SBob Moore  *
138cc84e262SBob Moore  * RETURN:      None
139cc84e262SBob Moore  *
140cc84e262SBob Moore  * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
141cc84e262SBob Moore  *
142cc84e262SBob Moore  ******************************************************************************/
143cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
144cc84e262SBob Moore acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
145cc84e262SBob Moore {
146cc84e262SBob Moore 	va_list arg_list;
147cc84e262SBob Moore 
148cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
149cc84e262SBob Moore 	acpi_os_printf(ACPI_MSG_WARNING);
150cc84e262SBob Moore 
151cc84e262SBob Moore 	va_start(arg_list, format);
152cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
153cc84e262SBob Moore 	ACPI_MSG_SUFFIX;
154cc84e262SBob Moore 	va_end(arg_list);
155cc84e262SBob Moore 
156cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
157cc84e262SBob Moore }
158cc84e262SBob Moore 
159cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_warning)
160cc84e262SBob Moore 
161cc84e262SBob Moore /*******************************************************************************
162cc84e262SBob Moore  *
163cc84e262SBob Moore  * FUNCTION:    acpi_info
164cc84e262SBob Moore  *
165cc84e262SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
166cc84e262SBob Moore  *              line_number         - Caller's line number (for error output)
167ba494beeSBob Moore  *              format              - Printf format string + additional args
168cc84e262SBob Moore  *
169cc84e262SBob Moore  * RETURN:      None
170cc84e262SBob Moore  *
171cc84e262SBob Moore  * DESCRIPTION: Print generic "ACPI:" information message. There is no
172cc84e262SBob Moore  *              module/line/version info in order to keep the message simple.
173cc84e262SBob Moore  *
174cc84e262SBob Moore  * TBD: module_name and line_number args are not needed, should be removed.
175cc84e262SBob Moore  *
176cc84e262SBob Moore  ******************************************************************************/
177cc84e262SBob Moore void ACPI_INTERNAL_VAR_XFACE
178cc84e262SBob Moore acpi_info(const char *module_name, u32 line_number, const char *format, ...)
179cc84e262SBob Moore {
180cc84e262SBob Moore 	va_list arg_list;
181cc84e262SBob Moore 
182cc84e262SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
183cc84e262SBob Moore 	acpi_os_printf(ACPI_MSG_INFO);
184cc84e262SBob Moore 
185cc84e262SBob Moore 	va_start(arg_list, format);
186cc84e262SBob Moore 	acpi_os_vprintf(format, arg_list);
187cc84e262SBob Moore 	acpi_os_printf("\n");
188cc84e262SBob Moore 	va_end(arg_list);
189cc84e262SBob Moore 
190cc84e262SBob Moore 	ACPI_MSG_REDIRECT_END;
191cc84e262SBob Moore }
192cc84e262SBob Moore 
193cc84e262SBob Moore ACPI_EXPORT_SYMBOL(acpi_info)
194cc84e262SBob Moore 
19562cdd141SBob Moore /*******************************************************************************
19662cdd141SBob Moore  *
19762cdd141SBob Moore  * FUNCTION:    acpi_bios_error
19862cdd141SBob Moore  *
19962cdd141SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
20062cdd141SBob Moore  *              line_number         - Caller's line number (for error output)
20162cdd141SBob Moore  *              format              - Printf format string + additional args
20262cdd141SBob Moore  *
20362cdd141SBob Moore  * RETURN:      None
20462cdd141SBob Moore  *
20562cdd141SBob Moore  * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
20662cdd141SBob Moore  *              info
20762cdd141SBob Moore  *
20862cdd141SBob Moore  ******************************************************************************/
20962cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE
21062cdd141SBob Moore acpi_bios_error(const char *module_name,
21162cdd141SBob Moore 		u32 line_number, const char *format, ...)
21262cdd141SBob Moore {
21362cdd141SBob Moore 	va_list arg_list;
21462cdd141SBob Moore 
21562cdd141SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
21662cdd141SBob Moore 	acpi_os_printf(ACPI_MSG_BIOS_ERROR);
21762cdd141SBob Moore 
21862cdd141SBob Moore 	va_start(arg_list, format);
21962cdd141SBob Moore 	acpi_os_vprintf(format, arg_list);
22062cdd141SBob Moore 	ACPI_MSG_SUFFIX;
22162cdd141SBob Moore 	va_end(arg_list);
22262cdd141SBob Moore 
22362cdd141SBob Moore 	ACPI_MSG_REDIRECT_END;
22462cdd141SBob Moore }
22562cdd141SBob Moore 
22662cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_error)
22762cdd141SBob Moore 
22862cdd141SBob Moore /*******************************************************************************
22962cdd141SBob Moore  *
23062cdd141SBob Moore  * FUNCTION:    acpi_bios_warning
23162cdd141SBob Moore  *
23262cdd141SBob Moore  * PARAMETERS:  module_name         - Caller's module name (for error output)
23362cdd141SBob Moore  *              line_number         - Caller's line number (for error output)
23462cdd141SBob Moore  *              format              - Printf format string + additional args
23562cdd141SBob Moore  *
23662cdd141SBob Moore  * RETURN:      None
23762cdd141SBob Moore  *
23862cdd141SBob Moore  * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
23962cdd141SBob Moore  *              info
24062cdd141SBob Moore  *
24162cdd141SBob Moore  ******************************************************************************/
24262cdd141SBob Moore void ACPI_INTERNAL_VAR_XFACE
24362cdd141SBob Moore acpi_bios_warning(const char *module_name,
24462cdd141SBob Moore 		  u32 line_number, const char *format, ...)
24562cdd141SBob Moore {
24662cdd141SBob Moore 	va_list arg_list;
24762cdd141SBob Moore 
24862cdd141SBob Moore 	ACPI_MSG_REDIRECT_BEGIN;
24962cdd141SBob Moore 	acpi_os_printf(ACPI_MSG_BIOS_WARNING);
25062cdd141SBob Moore 
25162cdd141SBob Moore 	va_start(arg_list, format);
25262cdd141SBob Moore 	acpi_os_vprintf(format, arg_list);
25362cdd141SBob Moore 	ACPI_MSG_SUFFIX;
25462cdd141SBob Moore 	va_end(arg_list);
25562cdd141SBob Moore 
25662cdd141SBob Moore 	ACPI_MSG_REDIRECT_END;
25762cdd141SBob Moore }
25862cdd141SBob Moore 
25962cdd141SBob Moore ACPI_EXPORT_SYMBOL(acpi_bios_warning)
260407e22afSLv Zheng #endif				/* ACPI_NO_ERROR_MESSAGES */
261