utxferror.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*******************************************************************************
  2. *
  3. * Module Name: utxferror - Various error/warning output functions
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2016, 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 to be 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 error output)
  118. * line_number - Caller's line number (for error 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: module_name - Caller's module name (for error output)
  144. * line_number - Caller's line number (for error output)
  145. * format - Printf format string + additional args
  146. *
  147. * RETURN: None
  148. *
  149. * DESCRIPTION: Print generic "ACPI:" information message. There is no
  150. * module/line/version info in order to keep the message simple.
  151. *
  152. * TBD: module_name and line_number args are not needed, should be removed.
  153. *
  154. ******************************************************************************/
  155. void ACPI_INTERNAL_VAR_XFACE acpi_info(const char *format, ...)
  156. {
  157. va_list arg_list;
  158. ACPI_MSG_REDIRECT_BEGIN;
  159. acpi_os_printf(ACPI_MSG_INFO);
  160. va_start(arg_list, format);
  161. acpi_os_vprintf(format, arg_list);
  162. acpi_os_printf("\n");
  163. va_end(arg_list);
  164. ACPI_MSG_REDIRECT_END;
  165. }
  166. ACPI_EXPORT_SYMBOL(acpi_info)
  167. /*******************************************************************************
  168. *
  169. * FUNCTION: acpi_bios_error
  170. *
  171. * PARAMETERS: module_name - Caller's module name (for error output)
  172. * line_number - Caller's line number (for error output)
  173. * format - Printf format string + additional args
  174. *
  175. * RETURN: None
  176. *
  177. * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
  178. * info
  179. *
  180. ******************************************************************************/
  181. void ACPI_INTERNAL_VAR_XFACE
  182. acpi_bios_error(const char *module_name,
  183. u32 line_number, const char *format, ...)
  184. {
  185. va_list arg_list;
  186. ACPI_MSG_REDIRECT_BEGIN;
  187. acpi_os_printf(ACPI_MSG_BIOS_ERROR);
  188. va_start(arg_list, format);
  189. acpi_os_vprintf(format, arg_list);
  190. ACPI_MSG_SUFFIX;
  191. va_end(arg_list);
  192. ACPI_MSG_REDIRECT_END;
  193. }
  194. ACPI_EXPORT_SYMBOL(acpi_bios_error)
  195. /*******************************************************************************
  196. *
  197. * FUNCTION: acpi_bios_warning
  198. *
  199. * PARAMETERS: module_name - Caller's module name (for error output)
  200. * line_number - Caller's line number (for error output)
  201. * format - Printf format string + additional args
  202. *
  203. * RETURN: None
  204. *
  205. * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
  206. * info
  207. *
  208. ******************************************************************************/
  209. void ACPI_INTERNAL_VAR_XFACE
  210. acpi_bios_warning(const char *module_name,
  211. u32 line_number, const char *format, ...)
  212. {
  213. va_list arg_list;
  214. ACPI_MSG_REDIRECT_BEGIN;
  215. acpi_os_printf(ACPI_MSG_BIOS_WARNING);
  216. va_start(arg_list, format);
  217. acpi_os_vprintf(format, arg_list);
  218. ACPI_MSG_SUFFIX;
  219. va_end(arg_list);
  220. ACPI_MSG_REDIRECT_END;
  221. }
  222. ACPI_EXPORT_SYMBOL(acpi_bios_warning)
  223. #endif /* ACPI_NO_ERROR_MESSAGES */