acexcep.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
  2. /******************************************************************************
  3. *
  4. * Name: acexcep.h - Exception codes returned by the ACPI subsystem
  5. *
  6. * Copyright (C) 2000 - 2018, Intel Corp.
  7. *
  8. *****************************************************************************/
  9. #ifndef __ACEXCEP_H__
  10. #define __ACEXCEP_H__
  11. /* This module contains all possible exception codes for acpi_status */
  12. /*
  13. * Exception code classes
  14. */
  15. #define AE_CODE_ENVIRONMENTAL 0x0000 /* General ACPICA environment */
  16. #define AE_CODE_PROGRAMMER 0x1000 /* External ACPICA interface caller */
  17. #define AE_CODE_ACPI_TABLES 0x2000 /* ACPI tables */
  18. #define AE_CODE_AML 0x3000 /* From executing AML code */
  19. #define AE_CODE_CONTROL 0x4000 /* Internal control codes */
  20. #define AE_CODE_MAX 0x4000
  21. #define AE_CODE_MASK 0xF000
  22. /*
  23. * Macros to insert the exception code classes
  24. */
  25. #define EXCEP_ENV(code) ((acpi_status) (code | AE_CODE_ENVIRONMENTAL))
  26. #define EXCEP_PGM(code) ((acpi_status) (code | AE_CODE_PROGRAMMER))
  27. #define EXCEP_TBL(code) ((acpi_status) (code | AE_CODE_ACPI_TABLES))
  28. #define EXCEP_AML(code) ((acpi_status) (code | AE_CODE_AML))
  29. #define EXCEP_CTL(code) ((acpi_status) (code | AE_CODE_CONTROL))
  30. /*
  31. * Exception info table. The "Description" field is used only by the
  32. * ACPICA help application (acpihelp).
  33. */
  34. struct acpi_exception_info {
  35. char *name;
  36. #ifdef ACPI_HELP_APP
  37. char *description;
  38. #endif
  39. };
  40. #ifdef ACPI_HELP_APP
  41. #define EXCEP_TXT(name,description) {name, description}
  42. #else
  43. #define EXCEP_TXT(name,description) {name}
  44. #endif
  45. /*
  46. * Success is always zero, failure is non-zero
  47. */
  48. #define ACPI_SUCCESS(a) (!(a))
  49. #define ACPI_FAILURE(a) (a)
  50. #define AE_OK (acpi_status) 0x0000
  51. #define ACPI_ENV_EXCEPTION(status) (status & AE_CODE_ENVIRONMENTAL)
  52. #define ACPI_AML_EXCEPTION(status) (status & AE_CODE_AML)
  53. #define ACPI_PROG_EXCEPTION(status) (status & AE_CODE_PROGRAMMER)
  54. #define ACPI_TABLE_EXCEPTION(status) (status & AE_CODE_ACPI_TABLES)
  55. #define ACPI_CNTL_EXCEPTION(status) (status & AE_CODE_CONTROL)
  56. /*
  57. * Environmental exceptions
  58. */
  59. #define AE_ERROR EXCEP_ENV (0x0001)
  60. #define AE_NO_ACPI_TABLES EXCEP_ENV (0x0002)
  61. #define AE_NO_NAMESPACE EXCEP_ENV (0x0003)
  62. #define AE_NO_MEMORY EXCEP_ENV (0x0004)
  63. #define AE_NOT_FOUND EXCEP_ENV (0x0005)
  64. #define AE_NOT_EXIST EXCEP_ENV (0x0006)
  65. #define AE_ALREADY_EXISTS EXCEP_ENV (0x0007)
  66. #define AE_TYPE EXCEP_ENV (0x0008)
  67. #define AE_NULL_OBJECT EXCEP_ENV (0x0009)
  68. #define AE_NULL_ENTRY EXCEP_ENV (0x000A)
  69. #define AE_BUFFER_OVERFLOW EXCEP_ENV (0x000B)
  70. #define AE_STACK_OVERFLOW EXCEP_ENV (0x000C)
  71. #define AE_STACK_UNDERFLOW EXCEP_ENV (0x000D)
  72. #define AE_NOT_IMPLEMENTED EXCEP_ENV (0x000E)
  73. #define AE_SUPPORT EXCEP_ENV (0x000F)
  74. #define AE_LIMIT EXCEP_ENV (0x0010)
  75. #define AE_TIME EXCEP_ENV (0x0011)
  76. #define AE_ACQUIRE_DEADLOCK EXCEP_ENV (0x0012)
  77. #define AE_RELEASE_DEADLOCK EXCEP_ENV (0x0013)
  78. #define AE_NOT_ACQUIRED EXCEP_ENV (0x0014)
  79. #define AE_ALREADY_ACQUIRED EXCEP_ENV (0x0015)
  80. #define AE_NO_HARDWARE_RESPONSE EXCEP_ENV (0x0016)
  81. #define AE_NO_GLOBAL_LOCK EXCEP_ENV (0x0017)
  82. #define AE_ABORT_METHOD EXCEP_ENV (0x0018)
  83. #define AE_SAME_HANDLER EXCEP_ENV (0x0019)
  84. #define AE_NO_HANDLER EXCEP_ENV (0x001A)
  85. #define AE_OWNER_ID_LIMIT EXCEP_ENV (0x001B)
  86. #define AE_NOT_CONFIGURED EXCEP_ENV (0x001C)
  87. #define AE_ACCESS EXCEP_ENV (0x001D)
  88. #define AE_IO_ERROR EXCEP_ENV (0x001E)
  89. #define AE_NUMERIC_OVERFLOW EXCEP_ENV (0x001F)
  90. #define AE_HEX_OVERFLOW EXCEP_ENV (0x0020)
  91. #define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021)
  92. #define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022)
  93. #define AE_END_OF_TABLE EXCEP_ENV (0x0023)
  94. #define AE_CODE_ENV_MAX 0x0023
  95. /*
  96. * Programmer exceptions
  97. */
  98. #define AE_BAD_PARAMETER EXCEP_PGM (0x0001)
  99. #define AE_BAD_CHARACTER EXCEP_PGM (0x0002)
  100. #define AE_BAD_PATHNAME EXCEP_PGM (0x0003)
  101. #define AE_BAD_DATA EXCEP_PGM (0x0004)
  102. #define AE_BAD_HEX_CONSTANT EXCEP_PGM (0x0005)
  103. #define AE_BAD_OCTAL_CONSTANT EXCEP_PGM (0x0006)
  104. #define AE_BAD_DECIMAL_CONSTANT EXCEP_PGM (0x0007)
  105. #define AE_MISSING_ARGUMENTS EXCEP_PGM (0x0008)
  106. #define AE_BAD_ADDRESS EXCEP_PGM (0x0009)
  107. #define AE_CODE_PGM_MAX 0x0009
  108. /*
  109. * Acpi table exceptions
  110. */
  111. #define AE_BAD_SIGNATURE EXCEP_TBL (0x0001)
  112. #define AE_BAD_HEADER EXCEP_TBL (0x0002)
  113. #define AE_BAD_CHECKSUM EXCEP_TBL (0x0003)
  114. #define AE_BAD_VALUE EXCEP_TBL (0x0004)
  115. #define AE_INVALID_TABLE_LENGTH EXCEP_TBL (0x0005)
  116. #define AE_CODE_TBL_MAX 0x0005
  117. /*
  118. * AML exceptions. These are caused by problems with
  119. * the actual AML byte stream
  120. */
  121. #define AE_AML_BAD_OPCODE EXCEP_AML (0x0001)
  122. #define AE_AML_NO_OPERAND EXCEP_AML (0x0002)
  123. #define AE_AML_OPERAND_TYPE EXCEP_AML (0x0003)
  124. #define AE_AML_OPERAND_VALUE EXCEP_AML (0x0004)
  125. #define AE_AML_UNINITIALIZED_LOCAL EXCEP_AML (0x0005)
  126. #define AE_AML_UNINITIALIZED_ARG EXCEP_AML (0x0006)
  127. #define AE_AML_UNINITIALIZED_ELEMENT EXCEP_AML (0x0007)
  128. #define AE_AML_NUMERIC_OVERFLOW EXCEP_AML (0x0008)
  129. #define AE_AML_REGION_LIMIT EXCEP_AML (0x0009)
  130. #define AE_AML_BUFFER_LIMIT EXCEP_AML (0x000A)
  131. #define AE_AML_PACKAGE_LIMIT EXCEP_AML (0x000B)
  132. #define AE_AML_DIVIDE_BY_ZERO EXCEP_AML (0x000C)
  133. #define AE_AML_BAD_NAME EXCEP_AML (0x000D)
  134. #define AE_AML_NAME_NOT_FOUND EXCEP_AML (0x000E)
  135. #define AE_AML_INTERNAL EXCEP_AML (0x000F)
  136. #define AE_AML_INVALID_SPACE_ID EXCEP_AML (0x0010)
  137. #define AE_AML_STRING_LIMIT EXCEP_AML (0x0011)
  138. #define AE_AML_NO_RETURN_VALUE EXCEP_AML (0x0012)
  139. #define AE_AML_METHOD_LIMIT EXCEP_AML (0x0013)
  140. #define AE_AML_NOT_OWNER EXCEP_AML (0x0014)
  141. #define AE_AML_MUTEX_ORDER EXCEP_AML (0x0015)
  142. #define AE_AML_MUTEX_NOT_ACQUIRED EXCEP_AML (0x0016)
  143. #define AE_AML_INVALID_RESOURCE_TYPE EXCEP_AML (0x0017)
  144. #define AE_AML_INVALID_INDEX EXCEP_AML (0x0018)
  145. #define AE_AML_REGISTER_LIMIT EXCEP_AML (0x0019)
  146. #define AE_AML_NO_WHILE EXCEP_AML (0x001A)
  147. #define AE_AML_ALIGNMENT EXCEP_AML (0x001B)
  148. #define AE_AML_NO_RESOURCE_END_TAG EXCEP_AML (0x001C)
  149. #define AE_AML_BAD_RESOURCE_VALUE EXCEP_AML (0x001D)
  150. #define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E)
  151. #define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F)
  152. #define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020)
  153. #define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021)
  154. #define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022)
  155. #define AE_AML_TARGET_TYPE EXCEP_AML (0x0023)
  156. #define AE_CODE_AML_MAX 0x0023
  157. /*
  158. * Internal exceptions used for control
  159. */
  160. #define AE_CTRL_RETURN_VALUE EXCEP_CTL (0x0001)
  161. #define AE_CTRL_PENDING EXCEP_CTL (0x0002)
  162. #define AE_CTRL_TERMINATE EXCEP_CTL (0x0003)
  163. #define AE_CTRL_TRUE EXCEP_CTL (0x0004)
  164. #define AE_CTRL_FALSE EXCEP_CTL (0x0005)
  165. #define AE_CTRL_DEPTH EXCEP_CTL (0x0006)
  166. #define AE_CTRL_END EXCEP_CTL (0x0007)
  167. #define AE_CTRL_TRANSFER EXCEP_CTL (0x0008)
  168. #define AE_CTRL_BREAK EXCEP_CTL (0x0009)
  169. #define AE_CTRL_CONTINUE EXCEP_CTL (0x000A)
  170. #define AE_CTRL_PARSE_CONTINUE EXCEP_CTL (0x000B)
  171. #define AE_CTRL_PARSE_PENDING EXCEP_CTL (0x000C)
  172. #define AE_CODE_CTRL_MAX 0x000C
  173. /* Exception strings for acpi_format_exception */
  174. #ifdef ACPI_DEFINE_EXCEPTION_TABLE
  175. /*
  176. * String versions of the exception codes above
  177. * These strings must match the corresponding defines exactly
  178. */
  179. static const struct acpi_exception_info acpi_gbl_exception_names_env[] = {
  180. EXCEP_TXT("AE_OK", "No error"),
  181. EXCEP_TXT("AE_ERROR", "Unspecified error"),
  182. EXCEP_TXT("AE_NO_ACPI_TABLES", "ACPI tables could not be found"),
  183. EXCEP_TXT("AE_NO_NAMESPACE", "A namespace has not been loaded"),
  184. EXCEP_TXT("AE_NO_MEMORY", "Insufficient dynamic memory"),
  185. EXCEP_TXT("AE_NOT_FOUND", "A requested entity is not found"),
  186. EXCEP_TXT("AE_NOT_EXIST", "A required entity does not exist"),
  187. EXCEP_TXT("AE_ALREADY_EXISTS", "An entity already exists"),
  188. EXCEP_TXT("AE_TYPE", "The object type is incorrect"),
  189. EXCEP_TXT("AE_NULL_OBJECT", "A required object was missing"),
  190. EXCEP_TXT("AE_NULL_ENTRY", "The requested object does not exist"),
  191. EXCEP_TXT("AE_BUFFER_OVERFLOW", "The buffer provided is too small"),
  192. EXCEP_TXT("AE_STACK_OVERFLOW", "An internal stack overflowed"),
  193. EXCEP_TXT("AE_STACK_UNDERFLOW", "An internal stack underflowed"),
  194. EXCEP_TXT("AE_NOT_IMPLEMENTED", "The feature is not implemented"),
  195. EXCEP_TXT("AE_SUPPORT", "The feature is not supported"),
  196. EXCEP_TXT("AE_LIMIT", "A predefined limit was exceeded"),
  197. EXCEP_TXT("AE_TIME", "A time limit or timeout expired"),
  198. EXCEP_TXT("AE_ACQUIRE_DEADLOCK",
  199. "Internal error, attempt was made to acquire a mutex in improper order"),
  200. EXCEP_TXT("AE_RELEASE_DEADLOCK",
  201. "Internal error, attempt was made to release a mutex in improper order"),
  202. EXCEP_TXT("AE_NOT_ACQUIRED",
  203. "An attempt to release a mutex or Global Lock without a previous acquire"),
  204. EXCEP_TXT("AE_ALREADY_ACQUIRED",
  205. "Internal error, attempt was made to acquire a mutex twice"),
  206. EXCEP_TXT("AE_NO_HARDWARE_RESPONSE",
  207. "Hardware did not respond after an I/O operation"),
  208. EXCEP_TXT("AE_NO_GLOBAL_LOCK", "There is no FACS Global Lock"),
  209. EXCEP_TXT("AE_ABORT_METHOD", "A control method was aborted"),
  210. EXCEP_TXT("AE_SAME_HANDLER",
  211. "Attempt was made to install the same handler that is already installed"),
  212. EXCEP_TXT("AE_NO_HANDLER",
  213. "A handler for the operation is not installed"),
  214. EXCEP_TXT("AE_OWNER_ID_LIMIT",
  215. "There are no more Owner IDs available for ACPI tables or control methods"),
  216. EXCEP_TXT("AE_NOT_CONFIGURED",
  217. "The interface is not part of the current subsystem configuration"),
  218. EXCEP_TXT("AE_ACCESS", "Permission denied for the requested operation"),
  219. EXCEP_TXT("AE_IO_ERROR", "An I/O error occurred"),
  220. EXCEP_TXT("AE_NUMERIC_OVERFLOW",
  221. "Overflow during string-to-integer conversion"),
  222. EXCEP_TXT("AE_HEX_OVERFLOW",
  223. "Overflow during ASCII hex-to-binary conversion"),
  224. EXCEP_TXT("AE_DECIMAL_OVERFLOW",
  225. "Overflow during ASCII decimal-to-binary conversion"),
  226. EXCEP_TXT("AE_OCTAL_OVERFLOW",
  227. "Overflow during ASCII octal-to-binary conversion"),
  228. EXCEP_TXT("AE_END_OF_TABLE", "Reached the end of table")
  229. };
  230. static const struct acpi_exception_info acpi_gbl_exception_names_pgm[] = {
  231. EXCEP_TXT(NULL, NULL),
  232. EXCEP_TXT("AE_BAD_PARAMETER", "A parameter is out of range or invalid"),
  233. EXCEP_TXT("AE_BAD_CHARACTER",
  234. "An invalid character was found in a name"),
  235. EXCEP_TXT("AE_BAD_PATHNAME",
  236. "An invalid character was found in a pathname"),
  237. EXCEP_TXT("AE_BAD_DATA",
  238. "A package or buffer contained incorrect data"),
  239. EXCEP_TXT("AE_BAD_HEX_CONSTANT", "Invalid character in a Hex constant"),
  240. EXCEP_TXT("AE_BAD_OCTAL_CONSTANT",
  241. "Invalid character in an Octal constant"),
  242. EXCEP_TXT("AE_BAD_DECIMAL_CONSTANT",
  243. "Invalid character in a Decimal constant"),
  244. EXCEP_TXT("AE_MISSING_ARGUMENTS",
  245. "Too few arguments were passed to a control method"),
  246. EXCEP_TXT("AE_BAD_ADDRESS", "An illegal null I/O address")
  247. };
  248. static const struct acpi_exception_info acpi_gbl_exception_names_tbl[] = {
  249. EXCEP_TXT(NULL, NULL),
  250. EXCEP_TXT("AE_BAD_SIGNATURE", "An ACPI table has an invalid signature"),
  251. EXCEP_TXT("AE_BAD_HEADER", "Invalid field in an ACPI table header"),
  252. EXCEP_TXT("AE_BAD_CHECKSUM", "An ACPI table checksum is not correct"),
  253. EXCEP_TXT("AE_BAD_VALUE", "An invalid value was found in a table"),
  254. EXCEP_TXT("AE_INVALID_TABLE_LENGTH",
  255. "The FADT or FACS has improper length")
  256. };
  257. static const struct acpi_exception_info acpi_gbl_exception_names_aml[] = {
  258. EXCEP_TXT(NULL, NULL),
  259. EXCEP_TXT("AE_AML_BAD_OPCODE", "Invalid AML opcode encountered"),
  260. EXCEP_TXT("AE_AML_NO_OPERAND", "A required operand is missing"),
  261. EXCEP_TXT("AE_AML_OPERAND_TYPE",
  262. "An operand of an incorrect type was encountered"),
  263. EXCEP_TXT("AE_AML_OPERAND_VALUE",
  264. "The operand had an inappropriate or invalid value"),
  265. EXCEP_TXT("AE_AML_UNINITIALIZED_LOCAL",
  266. "Method tried to use an uninitialized local variable"),
  267. EXCEP_TXT("AE_AML_UNINITIALIZED_ARG",
  268. "Method tried to use an uninitialized argument"),
  269. EXCEP_TXT("AE_AML_UNINITIALIZED_ELEMENT",
  270. "Method tried to use an empty package element"),
  271. EXCEP_TXT("AE_AML_NUMERIC_OVERFLOW",
  272. "Overflow during BCD conversion or other"),
  273. EXCEP_TXT("AE_AML_REGION_LIMIT",
  274. "Tried to access beyond the end of an Operation Region"),
  275. EXCEP_TXT("AE_AML_BUFFER_LIMIT",
  276. "Tried to access beyond the end of a buffer"),
  277. EXCEP_TXT("AE_AML_PACKAGE_LIMIT",
  278. "Tried to access beyond the end of a package"),
  279. EXCEP_TXT("AE_AML_DIVIDE_BY_ZERO",
  280. "During execution of AML Divide operator"),
  281. EXCEP_TXT("AE_AML_BAD_NAME",
  282. "An ACPI name contains invalid character(s)"),
  283. EXCEP_TXT("AE_AML_NAME_NOT_FOUND",
  284. "Could not resolve a named reference"),
  285. EXCEP_TXT("AE_AML_INTERNAL", "An internal error within the interprete"),
  286. EXCEP_TXT("AE_AML_INVALID_SPACE_ID",
  287. "An Operation Region SpaceID is invalid"),
  288. EXCEP_TXT("AE_AML_STRING_LIMIT",
  289. "String is longer than 200 characters"),
  290. EXCEP_TXT("AE_AML_NO_RETURN_VALUE",
  291. "A method did not return a required value"),
  292. EXCEP_TXT("AE_AML_METHOD_LIMIT",
  293. "A control method reached the maximum reentrancy limit of 255"),
  294. EXCEP_TXT("AE_AML_NOT_OWNER",
  295. "A thread tried to release a mutex that it does not own"),
  296. EXCEP_TXT("AE_AML_MUTEX_ORDER", "Mutex SyncLevel release mismatch"),
  297. EXCEP_TXT("AE_AML_MUTEX_NOT_ACQUIRED",
  298. "Attempt to release a mutex that was not previously acquired"),
  299. EXCEP_TXT("AE_AML_INVALID_RESOURCE_TYPE",
  300. "Invalid resource type in resource list"),
  301. EXCEP_TXT("AE_AML_INVALID_INDEX",
  302. "Invalid Argx or Localx (x too large)"),
  303. EXCEP_TXT("AE_AML_REGISTER_LIMIT",
  304. "Bank value or Index value beyond range of register"),
  305. EXCEP_TXT("AE_AML_NO_WHILE", "Break or Continue without a While"),
  306. EXCEP_TXT("AE_AML_ALIGNMENT",
  307. "Non-aligned memory transfer on platform that does not support this"),
  308. EXCEP_TXT("AE_AML_NO_RESOURCE_END_TAG",
  309. "No End Tag in a resource list"),
  310. EXCEP_TXT("AE_AML_BAD_RESOURCE_VALUE",
  311. "Invalid value of a resource element"),
  312. EXCEP_TXT("AE_AML_CIRCULAR_REFERENCE",
  313. "Two references refer to each other"),
  314. EXCEP_TXT("AE_AML_BAD_RESOURCE_LENGTH",
  315. "The length of a Resource Descriptor in the AML is incorrect"),
  316. EXCEP_TXT("AE_AML_ILLEGAL_ADDRESS",
  317. "A memory, I/O, or PCI configuration address is invalid"),
  318. EXCEP_TXT("AE_AML_LOOP_TIMEOUT",
  319. "An AML While loop exceeded the maximum execution time"),
  320. EXCEP_TXT("AE_AML_UNINITIALIZED_NODE",
  321. "A namespace node is uninitialized or unresolved"),
  322. EXCEP_TXT("AE_AML_TARGET_TYPE",
  323. "A target operand of an incorrect type was encountered")
  324. };
  325. static const struct acpi_exception_info acpi_gbl_exception_names_ctrl[] = {
  326. EXCEP_TXT(NULL, NULL),
  327. EXCEP_TXT("AE_CTRL_RETURN_VALUE", "A Method returned a value"),
  328. EXCEP_TXT("AE_CTRL_PENDING", "Method is calling another method"),
  329. EXCEP_TXT("AE_CTRL_TERMINATE", "Terminate the executing method"),
  330. EXCEP_TXT("AE_CTRL_TRUE", "An If or While predicate result"),
  331. EXCEP_TXT("AE_CTRL_FALSE", "An If or While predicate result"),
  332. EXCEP_TXT("AE_CTRL_DEPTH", "Maximum search depth has been reached"),
  333. EXCEP_TXT("AE_CTRL_END", "An If or While predicate is false"),
  334. EXCEP_TXT("AE_CTRL_TRANSFER", "Transfer control to called method"),
  335. EXCEP_TXT("AE_CTRL_BREAK", "A Break has been executed"),
  336. EXCEP_TXT("AE_CTRL_CONTINUE", "A Continue has been executed"),
  337. EXCEP_TXT("AE_CTRL_PARSE_CONTINUE", "Used to skip over bad opcodes"),
  338. EXCEP_TXT("AE_CTRL_PARSE_PENDING", "Used to implement AML While loops")
  339. };
  340. #endif /* EXCEPTION_TABLE */
  341. #endif /* __ACEXCEP_H__ */