Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
0002 /*******************************************************************************
0003  *
0004  * Module Name: utxferror - Various error/warning output functions
0005  *
0006  ******************************************************************************/
0007 
0008 #define EXPORT_ACPI_INTERFACES
0009 
0010 #include <acpi/acpi.h>
0011 #include "accommon.h"
0012 
0013 #define _COMPONENT          ACPI_UTILITIES
0014 ACPI_MODULE_NAME("utxferror")
0015 
0016 /*
0017  * This module is used for the in-kernel ACPICA as well as the ACPICA
0018  * tools/applications.
0019  */
0020 #ifndef ACPI_NO_ERROR_MESSAGES  /* Entire module */
0021 /*******************************************************************************
0022  *
0023  * FUNCTION:    acpi_error
0024  *
0025  * PARAMETERS:  module_name         - Caller's module name (for error output)
0026  *              line_number         - Caller's line number (for error output)
0027  *              format              - Printf format string + additional args
0028  *
0029  * RETURN:      None
0030  *
0031  * DESCRIPTION: Print "ACPI Error" message with module/line/version info
0032  *
0033  ******************************************************************************/
0034 void ACPI_INTERNAL_VAR_XFACE
0035 acpi_error(const char *module_name, u32 line_number, const char *format, ...)
0036 {
0037     va_list arg_list;
0038 
0039     ACPI_MSG_REDIRECT_BEGIN;
0040     acpi_os_printf(ACPI_MSG_ERROR);
0041 
0042     va_start(arg_list, format);
0043     acpi_os_vprintf(format, arg_list);
0044     ACPI_MSG_SUFFIX;
0045     va_end(arg_list);
0046 
0047     ACPI_MSG_REDIRECT_END;
0048 }
0049 
0050 ACPI_EXPORT_SYMBOL(acpi_error)
0051 
0052 /*******************************************************************************
0053  *
0054  * FUNCTION:    acpi_exception
0055  *
0056  * PARAMETERS:  module_name         - Caller's module name (for error output)
0057  *              line_number         - Caller's line number (for error output)
0058  *              status              - Status value to be decoded/formatted
0059  *              format              - Printf format string + additional args
0060  *
0061  * RETURN:      None
0062  *
0063  * DESCRIPTION: Print an "ACPI Error" message with module/line/version
0064  *              info as well as decoded acpi_status.
0065  *
0066  ******************************************************************************/
0067 void ACPI_INTERNAL_VAR_XFACE
0068 acpi_exception(const char *module_name,
0069            u32 line_number, acpi_status status, const char *format, ...)
0070 {
0071     va_list arg_list;
0072 
0073     ACPI_MSG_REDIRECT_BEGIN;
0074 
0075     /* For AE_OK, just print the message */
0076 
0077     if (ACPI_SUCCESS(status)) {
0078         acpi_os_printf(ACPI_MSG_ERROR);
0079 
0080     } else {
0081         acpi_os_printf(ACPI_MSG_ERROR "%s, ",
0082                    acpi_format_exception(status));
0083     }
0084 
0085     va_start(arg_list, format);
0086     acpi_os_vprintf(format, arg_list);
0087     ACPI_MSG_SUFFIX;
0088     va_end(arg_list);
0089 
0090     ACPI_MSG_REDIRECT_END;
0091 }
0092 
0093 ACPI_EXPORT_SYMBOL(acpi_exception)
0094 
0095 /*******************************************************************************
0096  *
0097  * FUNCTION:    acpi_warning
0098  *
0099  * PARAMETERS:  module_name         - Caller's module name (for warning output)
0100  *              line_number         - Caller's line number (for warning output)
0101  *              format              - Printf format string + additional args
0102  *
0103  * RETURN:      None
0104  *
0105  * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
0106  *
0107  ******************************************************************************/
0108 void ACPI_INTERNAL_VAR_XFACE
0109 acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
0110 {
0111     va_list arg_list;
0112 
0113     ACPI_MSG_REDIRECT_BEGIN;
0114     acpi_os_printf(ACPI_MSG_WARNING);
0115 
0116     va_start(arg_list, format);
0117     acpi_os_vprintf(format, arg_list);
0118     ACPI_MSG_SUFFIX;
0119     va_end(arg_list);
0120 
0121     ACPI_MSG_REDIRECT_END;
0122 }
0123 
0124 ACPI_EXPORT_SYMBOL(acpi_warning)
0125 
0126 /*******************************************************************************
0127  *
0128  * FUNCTION:    acpi_info
0129  *
0130  * PARAMETERS:  format              - Printf format string + additional args
0131  *
0132  * RETURN:      None
0133  *
0134  * DESCRIPTION: Print generic "ACPI:" information message. There is no
0135  *              module/line/version info in order to keep the message simple.
0136  *
0137  ******************************************************************************/
0138 void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
0139 {
0140     va_list arg_list;
0141 
0142     ACPI_MSG_REDIRECT_BEGIN;
0143     acpi_os_printf(ACPI_MSG_INFO);
0144 
0145     va_start(arg_list, format);
0146     acpi_os_vprintf(format, arg_list);
0147     acpi_os_printf("\n");
0148     va_end(arg_list);
0149 
0150     ACPI_MSG_REDIRECT_END;
0151 }
0152 
0153 ACPI_EXPORT_SYMBOL(acpi_info)
0154 
0155 /*******************************************************************************
0156  *
0157  * FUNCTION:    acpi_bios_error
0158  *
0159  * PARAMETERS:  module_name         - Caller's module name (for error output)
0160  *              line_number         - Caller's line number (for error output)
0161  *              format              - Printf format string + additional args
0162  *
0163  * RETURN:      None
0164  *
0165  * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
0166  *              info
0167  *
0168  ******************************************************************************/
0169 void ACPI_INTERNAL_VAR_XFACE
0170 acpi_bios_error(const char *module_name,
0171         u32 line_number, const char *format, ...)
0172 {
0173     va_list arg_list;
0174 
0175     ACPI_MSG_REDIRECT_BEGIN;
0176     acpi_os_printf(ACPI_MSG_BIOS_ERROR);
0177 
0178     va_start(arg_list, format);
0179     acpi_os_vprintf(format, arg_list);
0180     ACPI_MSG_SUFFIX;
0181     va_end(arg_list);
0182 
0183     ACPI_MSG_REDIRECT_END;
0184 }
0185 
0186 ACPI_EXPORT_SYMBOL(acpi_bios_error)
0187 
0188 /*******************************************************************************
0189  *
0190  * FUNCTION:    acpi_bios_exception
0191  *
0192  * PARAMETERS:  module_name         - Caller's module name (for error output)
0193  *              line_number         - Caller's line number (for error output)
0194  *              status              - Status value to be decoded/formatted
0195  *              format              - Printf format string + additional args
0196  *
0197  * RETURN:      None
0198  *
0199  * DESCRIPTION: Print an "ACPI Firmware Error" message with module/line/version
0200  *              info as well as decoded acpi_status.
0201  *
0202  ******************************************************************************/
0203 void ACPI_INTERNAL_VAR_XFACE
0204 acpi_bios_exception(const char *module_name,
0205             u32 line_number,
0206             acpi_status status, const char *format, ...)
0207 {
0208     va_list arg_list;
0209 
0210     ACPI_MSG_REDIRECT_BEGIN;
0211 
0212     /* For AE_OK, just print the message */
0213 
0214     if (ACPI_SUCCESS(status)) {
0215         acpi_os_printf(ACPI_MSG_BIOS_ERROR);
0216 
0217     } else {
0218         acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s, ",
0219                    acpi_format_exception(status));
0220     }
0221 
0222     va_start(arg_list, format);
0223     acpi_os_vprintf(format, arg_list);
0224     ACPI_MSG_SUFFIX;
0225     va_end(arg_list);
0226 
0227     ACPI_MSG_REDIRECT_END;
0228 }
0229 
0230 ACPI_EXPORT_SYMBOL(acpi_bios_exception)
0231 
0232 /*******************************************************************************
0233  *
0234  * FUNCTION:    acpi_bios_warning
0235  *
0236  * PARAMETERS:  module_name         - Caller's module name (for warning output)
0237  *              line_number         - Caller's line number (for warning output)
0238  *              format              - Printf format string + additional args
0239  *
0240  * RETURN:      None
0241  *
0242  * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
0243  *              info
0244  *
0245  ******************************************************************************/
0246 void ACPI_INTERNAL_VAR_XFACE
0247 acpi_bios_warning(const char *module_name,
0248           u32 line_number, const char *format, ...)
0249 {
0250     va_list arg_list;
0251 
0252     ACPI_MSG_REDIRECT_BEGIN;
0253     acpi_os_printf(ACPI_MSG_BIOS_WARNING);
0254 
0255     va_start(arg_list, format);
0256     acpi_os_vprintf(format, arg_list);
0257     ACPI_MSG_SUFFIX;
0258     va_end(arg_list);
0259 
0260     ACPI_MSG_REDIRECT_END;
0261 }
0262 
0263 ACPI_EXPORT_SYMBOL(acpi_bios_warning)
0264 #endif              /* ACPI_NO_ERROR_MESSAGES */