acdisasm.h 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. /******************************************************************************
  2. *
  3. * Name: acdisasm.h - AML disassembler
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2005, R. Byron Moore
  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. #ifndef __ACDISASM_H__
  43. #define __ACDISASM_H__
  44. #include "amlresrc.h"
  45. #define BLOCK_NONE 0
  46. #define BLOCK_PAREN 1
  47. #define BLOCK_BRACE 2
  48. #define BLOCK_COMMA_LIST 4
  49. struct acpi_external_list
  50. {
  51. char *path;
  52. struct acpi_external_list *next;
  53. };
  54. extern struct acpi_external_list *acpi_gbl_external_list;
  55. extern const char *acpi_gbl_io_decode[2];
  56. extern const char *acpi_gbl_word_decode[4];
  57. extern const char *acpi_gbl_consume_decode[2];
  58. extern const char *acpi_gbl_min_decode[2];
  59. extern const char *acpi_gbl_max_decode[2];
  60. extern const char *acpi_gbl_DECdecode[2];
  61. extern const char *acpi_gbl_RNGdecode[4];
  62. extern const char *acpi_gbl_MEMdecode[4];
  63. extern const char *acpi_gbl_RWdecode[2];
  64. extern const char *acpi_gbl_irq_decode[2];
  65. extern const char *acpi_gbl_HEdecode[2];
  66. extern const char *acpi_gbl_LLdecode[2];
  67. extern const char *acpi_gbl_SHRdecode[2];
  68. extern const char *acpi_gbl_TYPdecode[4];
  69. extern const char *acpi_gbl_BMdecode[2];
  70. extern const char *acpi_gbl_SIZdecode[4];
  71. extern const char *acpi_gbl_TTPdecode[2];
  72. extern const char *acpi_gbl_MTPdecode[4];
  73. extern const char *acpi_gbl_TRSdecode[2];
  74. extern const char *acpi_gbl_lock_rule[ACPI_NUM_LOCK_RULES];
  75. extern const char *acpi_gbl_access_types[ACPI_NUM_ACCESS_TYPES];
  76. extern const char *acpi_gbl_update_rules[ACPI_NUM_UPDATE_RULES];
  77. extern const char *acpi_gbl_match_ops[ACPI_NUM_MATCH_OPS];
  78. struct acpi_op_walk_info
  79. {
  80. u32 level;
  81. u32 bit_offset;
  82. };
  83. typedef
  84. acpi_status (*asl_walk_callback) (
  85. union acpi_parse_object *op,
  86. u32 level,
  87. void *context);
  88. /*
  89. * dmwalk
  90. */
  91. void
  92. acpi_dm_disassemble (
  93. struct acpi_walk_state *walk_state,
  94. union acpi_parse_object *origin,
  95. u32 num_opcodes);
  96. /*
  97. * dmopcode
  98. */
  99. void
  100. acpi_dm_disassemble_one_op (
  101. struct acpi_walk_state *walk_state,
  102. struct acpi_op_walk_info *info,
  103. union acpi_parse_object *op);
  104. void
  105. acpi_dm_decode_internal_object (
  106. union acpi_operand_object *obj_desc);
  107. u32
  108. acpi_dm_list_type (
  109. union acpi_parse_object *op);
  110. void
  111. acpi_dm_method_flags (
  112. union acpi_parse_object *op);
  113. void
  114. acpi_dm_field_flags (
  115. union acpi_parse_object *op);
  116. void
  117. acpi_dm_address_space (
  118. u8 space_id);
  119. void
  120. acpi_dm_region_flags (
  121. union acpi_parse_object *op);
  122. void
  123. acpi_dm_match_op (
  124. union acpi_parse_object *op);
  125. u8
  126. acpi_dm_comma_if_list_member (
  127. union acpi_parse_object *op);
  128. void
  129. acpi_dm_comma_if_field_member (
  130. union acpi_parse_object *op);
  131. /*
  132. * dmnames
  133. */
  134. u32
  135. acpi_dm_dump_name (
  136. char *name);
  137. acpi_status
  138. acpi_ps_display_object_pathname (
  139. struct acpi_walk_state *walk_state,
  140. union acpi_parse_object *op);
  141. void
  142. acpi_dm_namestring (
  143. char *name);
  144. /*
  145. * dmobject
  146. */
  147. void
  148. acpi_dm_display_internal_object (
  149. union acpi_operand_object *obj_desc,
  150. struct acpi_walk_state *walk_state);
  151. void
  152. acpi_dm_display_arguments (
  153. struct acpi_walk_state *walk_state);
  154. void
  155. acpi_dm_display_locals (
  156. struct acpi_walk_state *walk_state);
  157. void
  158. acpi_dm_dump_method_info (
  159. acpi_status status,
  160. struct acpi_walk_state *walk_state,
  161. union acpi_parse_object *op);
  162. /*
  163. * dmbuffer
  164. */
  165. void
  166. acpi_dm_disasm_byte_list (
  167. u32 level,
  168. u8 *byte_data,
  169. u32 byte_count);
  170. void
  171. acpi_dm_byte_list (
  172. struct acpi_op_walk_info *info,
  173. union acpi_parse_object *op);
  174. void
  175. acpi_is_eisa_id (
  176. union acpi_parse_object *op);
  177. void
  178. acpi_dm_eisa_id (
  179. u32 encoded_id);
  180. u8
  181. acpi_dm_is_unicode_buffer (
  182. union acpi_parse_object *op);
  183. u8
  184. acpi_dm_is_string_buffer (
  185. union acpi_parse_object *op);
  186. /*
  187. * dmresrc
  188. */
  189. void
  190. acpi_dm_resource_descriptor (
  191. struct acpi_op_walk_info *info,
  192. u8 *byte_data,
  193. u32 byte_count);
  194. u8
  195. acpi_dm_is_resource_descriptor (
  196. union acpi_parse_object *op);
  197. void
  198. acpi_dm_indent (
  199. u32 level);
  200. void
  201. acpi_dm_bit_list (
  202. u16 mask);
  203. void
  204. acpi_dm_decode_attribute (
  205. u8 attribute);
  206. /*
  207. * dmresrcl
  208. */
  209. void
  210. acpi_dm_word_descriptor (
  211. struct asl_word_address_desc *resource,
  212. u32 length,
  213. u32 level);
  214. void
  215. acpi_dm_dword_descriptor (
  216. struct asl_dword_address_desc *resource,
  217. u32 length,
  218. u32 level);
  219. void
  220. acpi_dm_extended_descriptor (
  221. struct asl_extended_address_desc *resource,
  222. u32 length,
  223. u32 level);
  224. void
  225. acpi_dm_qword_descriptor (
  226. struct asl_qword_address_desc *resource,
  227. u32 length,
  228. u32 level);
  229. void
  230. acpi_dm_memory24_descriptor (
  231. struct asl_memory_24_desc *resource,
  232. u32 length,
  233. u32 level);
  234. void
  235. acpi_dm_memory32_descriptor (
  236. struct asl_memory_32_desc *resource,
  237. u32 length,
  238. u32 level);
  239. void
  240. acpi_dm_fixed_mem32_descriptor (
  241. struct asl_fixed_memory_32_desc *resource,
  242. u32 length,
  243. u32 level);
  244. void
  245. acpi_dm_generic_register_descriptor (
  246. struct asl_general_register_desc *resource,
  247. u32 length,
  248. u32 level);
  249. void
  250. acpi_dm_interrupt_descriptor (
  251. struct asl_extended_xrupt_desc *resource,
  252. u32 length,
  253. u32 level);
  254. void
  255. acpi_dm_vendor_large_descriptor (
  256. struct asl_large_vendor_desc *resource,
  257. u32 length,
  258. u32 level);
  259. /*
  260. * dmresrcs
  261. */
  262. void
  263. acpi_dm_irq_descriptor (
  264. struct asl_irq_format_desc *resource,
  265. u32 length,
  266. u32 level);
  267. void
  268. acpi_dm_dma_descriptor (
  269. struct asl_dma_format_desc *resource,
  270. u32 length,
  271. u32 level);
  272. void
  273. acpi_dm_io_descriptor (
  274. struct asl_io_port_desc *resource,
  275. u32 length,
  276. u32 level);
  277. void
  278. acpi_dm_fixed_io_descriptor (
  279. struct asl_fixed_io_port_desc *resource,
  280. u32 length,
  281. u32 level);
  282. void
  283. acpi_dm_start_dependent_descriptor (
  284. struct asl_start_dependent_desc *resource,
  285. u32 length,
  286. u32 level);
  287. void
  288. acpi_dm_end_dependent_descriptor (
  289. struct asl_start_dependent_desc *resource,
  290. u32 length,
  291. u32 level);
  292. void
  293. acpi_dm_vendor_small_descriptor (
  294. struct asl_small_vendor_desc *resource,
  295. u32 length,
  296. u32 level);
  297. /*
  298. * dmutils
  299. */
  300. void
  301. acpi_dm_add_to_external_list (
  302. char *path);
  303. #endif /* __ACDISASM_H__ */