utxferror.c 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
  2. /*******************************************************************************
  3. *
  4. * Module Name: utxferror - Various error/warning output functions
  5. *
  6. ******************************************************************************/
  7. #define EXPORT_ACPI_INTERFACES
  8. #include <acpi/acpi.h>
  9. #include "accommon.h"
  10. #define _COMPONENT ACPI_UTILITIES
  11. ACPI_MODULE_NAME("utxferror")
  12. /*
  13. * This module is used for the in-kernel ACPICA as well as the ACPICA
  14. * tools/applications.
  15. */
  16. #ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */
  17. /*******************************************************************************
  18. *
  19. * FUNCTION: acpi_error
  20. *
  21. * PARAMETERS: module_name - Caller's module name (for error output)
  22. * line_number - Caller's line number (for error output)
  23. * format - Printf format string + additional args
  24. *
  25. * RETURN: None
  26. *
  27. * DESCRIPTION: Print "ACPI Error" message with module/line/version info
  28. *
  29. ******************************************************************************/
  30. void ACPI_INTERNAL_VAR_XFACE
  31. acpi_error(const char *module_name, u32 line_number, const char *format, ...)
  32. {
  33. va_list arg_list;
  34. ACPI_MSG_REDIRECT_BEGIN;
  35. acpi_os_printf(ACPI_MSG_ERROR);
  36. va_start(arg_list, format);
  37. acpi_os_vprintf(format, arg_list);
  38. ACPI_MSG_SUFFIX;
  39. va_end(arg_list);
  40. ACPI_MSG_REDIRECT_END;
  41. }
  42. ACPI_EXPORT_SYMBOL(acpi_error)
  43. /*******************************************************************************
  44. *
  45. * FUNCTION: acpi_exception
  46. *
  47. * PARAMETERS: module_name - Caller's module name (for error output)
  48. * line_number - Caller's line number (for error output)
  49. * status - Status value to be decoded/formatted
  50. * format - Printf format string + additional args
  51. *
  52. * RETURN: None
  53. *
  54. * DESCRIPTION: Print an "ACPI Error" message with module/line/version
  55. * info as well as decoded acpi_status.
  56. *
  57. ******************************************************************************/
  58. void ACPI_INTERNAL_VAR_XFACE
  59. acpi_exception(const char *module_name,
  60. u32 line_number, acpi_status status, const char *format, ...)
  61. {
  62. va_list arg_list;
  63. ACPI_MSG_REDIRECT_BEGIN;
  64. /* For AE_OK, just print the message */
  65. if (ACPI_SUCCESS(status)) {
  66. acpi_os_printf(ACPI_MSG_ERROR);
  67. } else {
  68. acpi_os_printf(ACPI_MSG_ERROR "%s, ",
  69. acpi_format_exception(status));
  70. }
  71. va_start(arg_list, format);
  72. acpi_os_vprintf(format, arg_list);
  73. ACPI_MSG_SUFFIX;
  74. va_end(arg_list);
  75. ACPI_MSG_REDIRECT_END;
  76. }
  77. ACPI_EXPORT_SYMBOL(acpi_exception)
  78. /*******************************************************************************
  79. *
  80. * FUNCTION: acpi_warning
  81. *
  82. * PARAMETERS: module_name - Caller's module name (for warning output)
  83. * line_number - Caller's line number (for warning output)
  84. * format - Printf format string + additional args
  85. *
  86. * RETURN: None
  87. *
  88. * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
  89. *
  90. ******************************************************************************/
  91. void ACPI_INTERNAL_VAR_XFACE
  92. acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
  93. {
  94. va_list arg_list;
  95. ACPI_MSG_REDIRECT_BEGIN;
  96. acpi_os_printf(ACPI_MSG_WARNING);
  97. va_start(arg_list, format);
  98. acpi_os_vprintf(format, arg_list);
  99. ACPI_MSG_SUFFIX;
  100. va_end(arg_list);
  101. ACPI_MSG_REDIRECT_END;
  102. }
  103. ACPI_EXPORT_SYMBOL(acpi_warning)
  104. /*******************************************************************************
  105. *
  106. * FUNCTION: acpi_info
  107. *
  108. * PARAMETERS: format - Printf format string + additional args
  109. *
  110. * RETURN: None
  111. *
  112. * DESCRIPTION: Print generic "ACPI:" information message. There is no
  113. * module/line/version info in order to keep the message simple.
  114. *
  115. ******************************************************************************/
  116. void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
  117. {
  118. va_list arg_list;
  119. ACPI_MSG_REDIRECT_BEGIN;
  120. acpi_os_printf(ACPI_MSG_INFO);
  121. va_start(arg_list, format);
  122. acpi_os_vprintf(format, arg_list);
  123. acpi_os_printf("\n");
  124. va_end(arg_list);
  125. ACPI_MSG_REDIRECT_END;
  126. }
  127. ACPI_EXPORT_SYMBOL(acpi_info)
  128. /*******************************************************************************
  129. *
  130. * FUNCTION: acpi_bios_error
  131. *
  132. * PARAMETERS: module_name - Caller's module name (for error output)
  133. * line_number - Caller's line number (for error output)
  134. * format - Printf format string + additional args
  135. *
  136. * RETURN: None
  137. *
  138. * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
  139. * info
  140. *
  141. ******************************************************************************/
  142. void ACPI_INTERNAL_VAR_XFACE
  143. acpi_bios_error(const char *module_name,
  144. u32 line_number, const char *format, ...)
  145. {
  146. va_list arg_list;
  147. ACPI_MSG_REDIRECT_BEGIN;
  148. acpi_os_printf(ACPI_MSG_BIOS_ERROR);
  149. va_start(arg_list, format);
  150. acpi_os_vprintf(format, arg_list);
  151. ACPI_MSG_SUFFIX;
  152. va_end(arg_list);
  153. ACPI_MSG_REDIRECT_END;
  154. }
  155. ACPI_EXPORT_SYMBOL(acpi_bios_error)
  156. /*******************************************************************************
  157. *
  158. * FUNCTION: acpi_bios_exception
  159. *
  160. * PARAMETERS: module_name - Caller's module name (for error output)
  161. * line_number - Caller's line number (for error output)
  162. * status - Status value to be decoded/formatted
  163. * format - Printf format string + additional args
  164. *
  165. * RETURN: None
  166. *
  167. * DESCRIPTION: Print an "ACPI Firmware Error" message with module/line/version
  168. * info as well as decoded acpi_status.
  169. *
  170. ******************************************************************************/
  171. void ACPI_INTERNAL_VAR_XFACE
  172. acpi_bios_exception(const char *module_name,
  173. u32 line_number,
  174. acpi_status status, const char *format, ...)
  175. {
  176. va_list arg_list;
  177. ACPI_MSG_REDIRECT_BEGIN;
  178. /* For AE_OK, just print the message */
  179. if (ACPI_SUCCESS(status)) {
  180. acpi_os_printf(ACPI_MSG_BIOS_ERROR);
  181. } else {
  182. acpi_os_printf(ACPI_MSG_BIOS_ERROR "%s, ",
  183. acpi_format_exception(status));
  184. }
  185. va_start(arg_list, format);
  186. acpi_os_vprintf(format, arg_list);
  187. ACPI_MSG_SUFFIX;
  188. va_end(arg_list);
  189. ACPI_MSG_REDIRECT_END;
  190. }
  191. ACPI_EXPORT_SYMBOL(acpi_bios_exception)
  192. /*******************************************************************************
  193. *
  194. * FUNCTION: acpi_bios_warning
  195. *
  196. * PARAMETERS: module_name - Caller's module name (for warning output)
  197. * line_number - Caller's line number (for warning output)
  198. * format - Printf format string + additional args
  199. *
  200. * RETURN: None
  201. *
  202. * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
  203. * info
  204. *
  205. ******************************************************************************/
  206. void ACPI_INTERNAL_VAR_XFACE
  207. acpi_bios_warning(const char *module_name,
  208. u32 line_number, const char *format, ...)
  209. {
  210. va_list arg_list;
  211. ACPI_MSG_REDIRECT_BEGIN;
  212. acpi_os_printf(ACPI_MSG_BIOS_WARNING);
  213. va_start(arg_list, format);
  214. acpi_os_vprintf(format, arg_list);
  215. ACPI_MSG_SUFFIX;
  216. va_end(arg_list);
  217. ACPI_MSG_REDIRECT_END;
  218. }
  219. ACPI_EXPORT_SYMBOL(acpi_bios_warning)
  220. #endif /* ACPI_NO_ERROR_MESSAGES */