utxferror.c 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. /*******************************************************************************
  2. *
  3. * Module Name: utxferror - Various error/warning output functions
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2017, Intel Corp.
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions, and the following disclaimer,
  15. * without modification.
  16. * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  17. * substantially similar to the "NO WARRANTY" disclaimer below
  18. * ("Disclaimer") and any redistribution must be conditioned upon
  19. * including a substantially similar Disclaimer requirement for further
  20. * binary redistribution.
  21. * 3. Neither the names of the above-listed copyright holders nor the names
  22. * of any contributors may be used to endorse or promote products derived
  23. * from this software without specific prior written permission.
  24. *
  25. * Alternatively, this software may be distributed under the terms of the
  26. * GNU General Public License ("GPL") version 2 as published by the Free
  27. * Software Foundation.
  28. *
  29. * NO WARRANTY
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
  33. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  34. * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  35. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  36. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  37. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  38. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  39. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGES.
  41. */
  42. #define EXPORT_ACPI_INTERFACES
  43. #include <acpi/acpi.h>
  44. #include "accommon.h"
  45. #define _COMPONENT ACPI_UTILITIES
  46. ACPI_MODULE_NAME("utxferror")
  47. /*
  48. * This module is used for the in-kernel ACPICA as well as the ACPICA
  49. * tools/applications.
  50. */
  51. #ifndef ACPI_NO_ERROR_MESSAGES /* Entire module */
  52. /*******************************************************************************
  53. *
  54. * FUNCTION: acpi_error
  55. *
  56. * PARAMETERS: module_name - Caller's module name (for error output)
  57. * line_number - Caller's line number (for error output)
  58. * format - Printf format string + additional args
  59. *
  60. * RETURN: None
  61. *
  62. * DESCRIPTION: Print "ACPI Error" message with module/line/version info
  63. *
  64. ******************************************************************************/
  65. void ACPI_INTERNAL_VAR_XFACE
  66. acpi_error(const char *module_name, u32 line_number, const char *format, ...)
  67. {
  68. va_list arg_list;
  69. ACPI_MSG_REDIRECT_BEGIN;
  70. acpi_os_printf(ACPI_MSG_ERROR);
  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_error)
  78. /*******************************************************************************
  79. *
  80. * FUNCTION: acpi_exception
  81. *
  82. * PARAMETERS: module_name - Caller's module name (for error output)
  83. * line_number - Caller's line number (for error output)
  84. * status - Status value to be decoded/formatted
  85. * format - Printf format string + additional args
  86. *
  87. * RETURN: None
  88. *
  89. * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
  90. * and decoded acpi_status.
  91. *
  92. ******************************************************************************/
  93. void ACPI_INTERNAL_VAR_XFACE
  94. acpi_exception(const char *module_name,
  95. u32 line_number, acpi_status status, const char *format, ...)
  96. {
  97. va_list arg_list;
  98. ACPI_MSG_REDIRECT_BEGIN;
  99. /* For AE_OK, just print the message */
  100. if (ACPI_SUCCESS(status)) {
  101. acpi_os_printf(ACPI_MSG_EXCEPTION);
  102. } else {
  103. acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
  104. acpi_format_exception(status));
  105. }
  106. va_start(arg_list, format);
  107. acpi_os_vprintf(format, arg_list);
  108. ACPI_MSG_SUFFIX;
  109. va_end(arg_list);
  110. ACPI_MSG_REDIRECT_END;
  111. }
  112. ACPI_EXPORT_SYMBOL(acpi_exception)
  113. /*******************************************************************************
  114. *
  115. * FUNCTION: acpi_warning
  116. *
  117. * PARAMETERS: module_name - Caller's module name (for warning output)
  118. * line_number - Caller's line number (for warning output)
  119. * format - Printf format string + additional args
  120. *
  121. * RETURN: None
  122. *
  123. * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
  124. *
  125. ******************************************************************************/
  126. void ACPI_INTERNAL_VAR_XFACE
  127. acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
  128. {
  129. va_list arg_list;
  130. ACPI_MSG_REDIRECT_BEGIN;
  131. acpi_os_printf(ACPI_MSG_WARNING);
  132. va_start(arg_list, format);
  133. acpi_os_vprintf(format, arg_list);
  134. ACPI_MSG_SUFFIX;
  135. va_end(arg_list);
  136. ACPI_MSG_REDIRECT_END;
  137. }
  138. ACPI_EXPORT_SYMBOL(acpi_warning)
  139. /*******************************************************************************
  140. *
  141. * FUNCTION: acpi_info
  142. *
  143. * PARAMETERS: format - Printf format string + additional args
  144. *
  145. * RETURN: None
  146. *
  147. * DESCRIPTION: Print generic "ACPI:" information message. There is no
  148. * module/line/version info in order to keep the message simple.
  149. *
  150. ******************************************************************************/
  151. void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
  152. {
  153. va_list arg_list;
  154. ACPI_MSG_REDIRECT_BEGIN;
  155. acpi_os_printf(ACPI_MSG_INFO);
  156. va_start(arg_list, format);
  157. acpi_os_vprintf(format, arg_list);
  158. acpi_os_printf("\n");
  159. va_end(arg_list);
  160. ACPI_MSG_REDIRECT_END;
  161. }
  162. ACPI_EXPORT_SYMBOL(acpi_info)
  163. /*******************************************************************************
  164. *
  165. * FUNCTION: acpi_bios_error
  166. *
  167. * PARAMETERS: module_name - Caller's module name (for error output)
  168. * line_number - Caller's line number (for error output)
  169. * format - Printf format string + additional args
  170. *
  171. * RETURN: None
  172. *
  173. * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
  174. * info
  175. *
  176. ******************************************************************************/
  177. void ACPI_INTERNAL_VAR_XFACE
  178. acpi_bios_error(const char *module_name,
  179. u32 line_number, const char *format, ...)
  180. {
  181. va_list arg_list;
  182. ACPI_MSG_REDIRECT_BEGIN;
  183. acpi_os_printf(ACPI_MSG_BIOS_ERROR);
  184. va_start(arg_list, format);
  185. acpi_os_vprintf(format, arg_list);
  186. ACPI_MSG_SUFFIX;
  187. va_end(arg_list);
  188. ACPI_MSG_REDIRECT_END;
  189. }
  190. ACPI_EXPORT_SYMBOL(acpi_bios_error)
  191. /*******************************************************************************
  192. *
  193. * FUNCTION: acpi_bios_warning
  194. *
  195. * PARAMETERS: module_name - Caller's module name (for warning output)
  196. * line_number - Caller's line number (for warning output)
  197. * format - Printf format string + additional args
  198. *
  199. * RETURN: None
  200. *
  201. * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
  202. * info
  203. *
  204. ******************************************************************************/
  205. void ACPI_INTERNAL_VAR_XFACE
  206. acpi_bios_warning(const char *module_name,
  207. u32 line_number, const char *format, ...)
  208. {
  209. va_list arg_list;
  210. ACPI_MSG_REDIRECT_BEGIN;
  211. acpi_os_printf(ACPI_MSG_BIOS_WARNING);
  212. va_start(arg_list, format);
  213. acpi_os_vprintf(format, arg_list);
  214. ACPI_MSG_SUFFIX;
  215. va_end(arg_list);
  216. ACPI_MSG_REDIRECT_END;
  217. }
  218. ACPI_EXPORT_SYMBOL(acpi_bios_warning)
  219. #endif /* ACPI_NO_ERROR_MESSAGES */