utxferror.c 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. /*******************************************************************************
  2. *
  3. * Module Name: utxferror - Various error/warning output functions
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2014, 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. acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
  100. acpi_format_exception(status));
  101. va_start(arg_list, format);
  102. acpi_os_vprintf(format, arg_list);
  103. ACPI_MSG_SUFFIX;
  104. va_end(arg_list);
  105. ACPI_MSG_REDIRECT_END;
  106. }
  107. ACPI_EXPORT_SYMBOL(acpi_exception)
  108. /*******************************************************************************
  109. *
  110. * FUNCTION: acpi_warning
  111. *
  112. * PARAMETERS: module_name - Caller's module name (for error output)
  113. * line_number - Caller's line number (for error output)
  114. * format - Printf format string + additional args
  115. *
  116. * RETURN: None
  117. *
  118. * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
  119. *
  120. ******************************************************************************/
  121. void ACPI_INTERNAL_VAR_XFACE
  122. acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
  123. {
  124. va_list arg_list;
  125. ACPI_MSG_REDIRECT_BEGIN;
  126. acpi_os_printf(ACPI_MSG_WARNING);
  127. va_start(arg_list, format);
  128. acpi_os_vprintf(format, arg_list);
  129. ACPI_MSG_SUFFIX;
  130. va_end(arg_list);
  131. ACPI_MSG_REDIRECT_END;
  132. }
  133. ACPI_EXPORT_SYMBOL(acpi_warning)
  134. /*******************************************************************************
  135. *
  136. * FUNCTION: acpi_info
  137. *
  138. * PARAMETERS: module_name - Caller's module name (for error output)
  139. * line_number - Caller's line number (for error output)
  140. * format - Printf format string + additional args
  141. *
  142. * RETURN: None
  143. *
  144. * DESCRIPTION: Print generic "ACPI:" information message. There is no
  145. * module/line/version info in order to keep the message simple.
  146. *
  147. * TBD: module_name and line_number args are not needed, should be removed.
  148. *
  149. ******************************************************************************/
  150. void ACPI_INTERNAL_VAR_XFACE
  151. acpi_info(const char *module_name, u32 line_number, 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 error output)
  196. * line_number - Caller's line number (for error 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 */