utxferror.c 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. /*******************************************************************************
  2. *
  3. * Module Name: utxferror - Various error/warning output functions
  4. *
  5. ******************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2013, 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. #include <linux/export.h>
  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. /*******************************************************************************
  52. *
  53. * FUNCTION: acpi_error
  54. *
  55. * PARAMETERS: module_name - Caller's module name (for error output)
  56. * line_number - Caller's line number (for error output)
  57. * format - Printf format string + additional args
  58. *
  59. * RETURN: None
  60. *
  61. * DESCRIPTION: Print "ACPI Error" message with module/line/version info
  62. *
  63. ******************************************************************************/
  64. void ACPI_INTERNAL_VAR_XFACE
  65. acpi_error(const char *module_name, u32 line_number, const char *format, ...)
  66. {
  67. va_list arg_list;
  68. ACPI_MSG_REDIRECT_BEGIN;
  69. acpi_os_printf(ACPI_MSG_ERROR);
  70. va_start(arg_list, format);
  71. acpi_os_vprintf(format, arg_list);
  72. ACPI_MSG_SUFFIX;
  73. va_end(arg_list);
  74. ACPI_MSG_REDIRECT_END;
  75. }
  76. ACPI_EXPORT_SYMBOL(acpi_error)
  77. /*******************************************************************************
  78. *
  79. * FUNCTION: acpi_exception
  80. *
  81. * PARAMETERS: module_name - Caller's module name (for error output)
  82. * line_number - Caller's line number (for error output)
  83. * status - Status to be formatted
  84. * format - Printf format string + additional args
  85. *
  86. * RETURN: None
  87. *
  88. * DESCRIPTION: Print "ACPI Exception" message with module/line/version info
  89. * and decoded acpi_status.
  90. *
  91. ******************************************************************************/
  92. void ACPI_INTERNAL_VAR_XFACE
  93. acpi_exception(const char *module_name,
  94. u32 line_number, acpi_status status, const char *format, ...)
  95. {
  96. va_list arg_list;
  97. ACPI_MSG_REDIRECT_BEGIN;
  98. acpi_os_printf(ACPI_MSG_EXCEPTION "%s, ",
  99. acpi_format_exception(status));
  100. va_start(arg_list, format);
  101. acpi_os_vprintf(format, arg_list);
  102. ACPI_MSG_SUFFIX;
  103. va_end(arg_list);
  104. ACPI_MSG_REDIRECT_END;
  105. }
  106. ACPI_EXPORT_SYMBOL(acpi_exception)
  107. /*******************************************************************************
  108. *
  109. * FUNCTION: acpi_warning
  110. *
  111. * PARAMETERS: module_name - Caller's module name (for error output)
  112. * line_number - Caller's line number (for error output)
  113. * format - Printf format string + additional args
  114. *
  115. * RETURN: None
  116. *
  117. * DESCRIPTION: Print "ACPI Warning" message with module/line/version info
  118. *
  119. ******************************************************************************/
  120. void ACPI_INTERNAL_VAR_XFACE
  121. acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
  122. {
  123. va_list arg_list;
  124. ACPI_MSG_REDIRECT_BEGIN;
  125. acpi_os_printf(ACPI_MSG_WARNING);
  126. va_start(arg_list, format);
  127. acpi_os_vprintf(format, arg_list);
  128. ACPI_MSG_SUFFIX;
  129. va_end(arg_list);
  130. ACPI_MSG_REDIRECT_END;
  131. }
  132. ACPI_EXPORT_SYMBOL(acpi_warning)
  133. /*******************************************************************************
  134. *
  135. * FUNCTION: acpi_info
  136. *
  137. * PARAMETERS: module_name - Caller's module name (for error output)
  138. * line_number - Caller's line number (for error output)
  139. * format - Printf format string + additional args
  140. *
  141. * RETURN: None
  142. *
  143. * DESCRIPTION: Print generic "ACPI:" information message. There is no
  144. * module/line/version info in order to keep the message simple.
  145. *
  146. * TBD: module_name and line_number args are not needed, should be removed.
  147. *
  148. ******************************************************************************/
  149. void ACPI_INTERNAL_VAR_XFACE
  150. acpi_info(const char *module_name, u32 line_number, const char *format, ...)
  151. {
  152. va_list arg_list;
  153. ACPI_MSG_REDIRECT_BEGIN;
  154. acpi_os_printf(ACPI_MSG_INFO);
  155. va_start(arg_list, format);
  156. acpi_os_vprintf(format, arg_list);
  157. acpi_os_printf("\n");
  158. va_end(arg_list);
  159. ACPI_MSG_REDIRECT_END;
  160. }
  161. ACPI_EXPORT_SYMBOL(acpi_info)
  162. /*******************************************************************************
  163. *
  164. * FUNCTION: acpi_bios_error
  165. *
  166. * PARAMETERS: module_name - Caller's module name (for error output)
  167. * line_number - Caller's line number (for error output)
  168. * format - Printf format string + additional args
  169. *
  170. * RETURN: None
  171. *
  172. * DESCRIPTION: Print "ACPI Firmware Error" message with module/line/version
  173. * info
  174. *
  175. ******************************************************************************/
  176. void ACPI_INTERNAL_VAR_XFACE
  177. acpi_bios_error(const char *module_name,
  178. u32 line_number, const char *format, ...)
  179. {
  180. va_list arg_list;
  181. ACPI_MSG_REDIRECT_BEGIN;
  182. acpi_os_printf(ACPI_MSG_BIOS_ERROR);
  183. va_start(arg_list, format);
  184. acpi_os_vprintf(format, arg_list);
  185. ACPI_MSG_SUFFIX;
  186. va_end(arg_list);
  187. ACPI_MSG_REDIRECT_END;
  188. }
  189. ACPI_EXPORT_SYMBOL(acpi_bios_error)
  190. /*******************************************************************************
  191. *
  192. * FUNCTION: acpi_bios_warning
  193. *
  194. * PARAMETERS: module_name - Caller's module name (for error output)
  195. * line_number - Caller's line number (for error output)
  196. * format - Printf format string + additional args
  197. *
  198. * RETURN: None
  199. *
  200. * DESCRIPTION: Print "ACPI Firmware Warning" message with module/line/version
  201. * info
  202. *
  203. ******************************************************************************/
  204. void ACPI_INTERNAL_VAR_XFACE
  205. acpi_bios_warning(const char *module_name,
  206. u32 line_number, const char *format, ...)
  207. {
  208. va_list arg_list;
  209. ACPI_MSG_REDIRECT_BEGIN;
  210. acpi_os_printf(ACPI_MSG_BIOS_WARNING);
  211. va_start(arg_list, format);
  212. acpi_os_vprintf(format, arg_list);
  213. ACPI_MSG_SUFFIX;
  214. va_end(arg_list);
  215. ACPI_MSG_REDIRECT_END;
  216. }
  217. ACPI_EXPORT_SYMBOL(acpi_bios_warning)