acdisasm.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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_walk_parse_tree (
  93. union acpi_parse_object *op,
  94. asl_walk_callback descending_callback,
  95. asl_walk_callback ascending_callback,
  96. void *context);
  97. acpi_status
  98. acpi_dm_descending_op (
  99. union acpi_parse_object *op,
  100. u32 level,
  101. void *context);
  102. acpi_status
  103. acpi_dm_ascending_op (
  104. union acpi_parse_object *op,
  105. u32 level,
  106. void *context);
  107. /*
  108. * dmopcode
  109. */
  110. void
  111. acpi_dm_validate_name (
  112. char *name,
  113. union acpi_parse_object *op);
  114. u32
  115. acpi_dm_dump_name (
  116. char *name);
  117. void
  118. acpi_dm_unicode (
  119. union acpi_parse_object *op);
  120. void
  121. acpi_dm_disassemble (
  122. struct acpi_walk_state *walk_state,
  123. union acpi_parse_object *origin,
  124. u32 num_opcodes);
  125. void
  126. acpi_dm_namestring (
  127. char *name);
  128. void
  129. acpi_dm_display_path (
  130. union acpi_parse_object *op);
  131. void
  132. acpi_dm_disassemble_one_op (
  133. struct acpi_walk_state *walk_state,
  134. struct acpi_op_walk_info *info,
  135. union acpi_parse_object *op);
  136. void
  137. acpi_dm_decode_internal_object (
  138. union acpi_operand_object *obj_desc);
  139. u32
  140. acpi_dm_block_type (
  141. union acpi_parse_object *op);
  142. u32
  143. acpi_dm_list_type (
  144. union acpi_parse_object *op);
  145. acpi_status
  146. acpi_ps_display_object_pathname (
  147. struct acpi_walk_state *walk_state,
  148. union acpi_parse_object *op);
  149. void
  150. acpi_dm_method_flags (
  151. union acpi_parse_object *op);
  152. void
  153. acpi_dm_field_flags (
  154. union acpi_parse_object *op);
  155. void
  156. acpi_dm_address_space (
  157. u8 space_id);
  158. void
  159. acpi_dm_region_flags (
  160. union acpi_parse_object *op);
  161. void
  162. acpi_dm_match_op (
  163. union acpi_parse_object *op);
  164. void
  165. acpi_dm_match_keyword (
  166. union acpi_parse_object *op);
  167. u8
  168. acpi_dm_comma_if_list_member (
  169. union acpi_parse_object *op);
  170. void
  171. acpi_dm_comma_if_field_member (
  172. union acpi_parse_object *op);
  173. /*
  174. * dmobject
  175. */
  176. void
  177. acpi_dm_decode_node (
  178. struct acpi_namespace_node *node);
  179. void
  180. acpi_dm_display_internal_object (
  181. union acpi_operand_object *obj_desc,
  182. struct acpi_walk_state *walk_state);
  183. void
  184. acpi_dm_display_arguments (
  185. struct acpi_walk_state *walk_state);
  186. void
  187. acpi_dm_display_locals (
  188. struct acpi_walk_state *walk_state);
  189. void
  190. acpi_dm_dump_method_info (
  191. acpi_status status,
  192. struct acpi_walk_state *walk_state,
  193. union acpi_parse_object *op);
  194. /*
  195. * dmbuffer
  196. */
  197. void
  198. acpi_is_eisa_id (
  199. union acpi_parse_object *op);
  200. void
  201. acpi_dm_eisa_id (
  202. u32 encoded_id);
  203. u8
  204. acpi_dm_is_unicode_buffer (
  205. union acpi_parse_object *op);
  206. u8
  207. acpi_dm_is_string_buffer (
  208. union acpi_parse_object *op);
  209. /*
  210. * dmresrc
  211. */
  212. void
  213. acpi_dm_disasm_byte_list (
  214. u32 level,
  215. u8 *byte_data,
  216. u32 byte_count);
  217. void
  218. acpi_dm_byte_list (
  219. struct acpi_op_walk_info *info,
  220. union acpi_parse_object *op);
  221. void
  222. acpi_dm_resource_descriptor (
  223. struct acpi_op_walk_info *info,
  224. u8 *byte_data,
  225. u32 byte_count);
  226. u8
  227. acpi_dm_is_resource_descriptor (
  228. union acpi_parse_object *op);
  229. void
  230. acpi_dm_indent (
  231. u32 level);
  232. void
  233. acpi_dm_bit_list (
  234. u16 mask);
  235. void
  236. acpi_dm_decode_attribute (
  237. u8 attribute);
  238. /*
  239. * dmresrcl
  240. */
  241. void
  242. acpi_dm_io_flags (
  243. u8 flags);
  244. void
  245. acpi_dm_memory_flags (
  246. u8 flags,
  247. u8 specific_flags);
  248. void
  249. acpi_dm_word_descriptor (
  250. struct asl_word_address_desc *resource,
  251. u32 length,
  252. u32 level);
  253. void
  254. acpi_dm_dword_descriptor (
  255. struct asl_dword_address_desc *resource,
  256. u32 length,
  257. u32 level);
  258. void
  259. acpi_dm_extended_descriptor (
  260. struct asl_extended_address_desc *resource,
  261. u32 length,
  262. u32 level);
  263. void
  264. acpi_dm_qword_descriptor (
  265. struct asl_qword_address_desc *resource,
  266. u32 length,
  267. u32 level);
  268. void
  269. acpi_dm_memory24_descriptor (
  270. struct asl_memory_24_desc *resource,
  271. u32 length,
  272. u32 level);
  273. void
  274. acpi_dm_memory32_descriptor (
  275. struct asl_memory_32_desc *resource,
  276. u32 length,
  277. u32 level);
  278. void
  279. acpi_dm_fixed_mem32_descriptor (
  280. struct asl_fixed_memory_32_desc *resource,
  281. u32 length,
  282. u32 level);
  283. void
  284. acpi_dm_generic_register_descriptor (
  285. struct asl_general_register_desc *resource,
  286. u32 length,
  287. u32 level);
  288. void
  289. acpi_dm_interrupt_descriptor (
  290. struct asl_extended_xrupt_desc *resource,
  291. u32 length,
  292. u32 level);
  293. void
  294. acpi_dm_vendor_large_descriptor (
  295. struct asl_large_vendor_desc *resource,
  296. u32 length,
  297. u32 level);
  298. /*
  299. * dmresrcs
  300. */
  301. void
  302. acpi_dm_irq_descriptor (
  303. struct asl_irq_format_desc *resource,
  304. u32 length,
  305. u32 level);
  306. void
  307. acpi_dm_dma_descriptor (
  308. struct asl_dma_format_desc *resource,
  309. u32 length,
  310. u32 level);
  311. void
  312. acpi_dm_io_descriptor (
  313. struct asl_io_port_desc *resource,
  314. u32 length,
  315. u32 level);
  316. void
  317. acpi_dm_fixed_io_descriptor (
  318. struct asl_fixed_io_port_desc *resource,
  319. u32 length,
  320. u32 level);
  321. void
  322. acpi_dm_start_dependent_descriptor (
  323. struct asl_start_dependent_desc *resource,
  324. u32 length,
  325. u32 level);
  326. void
  327. acpi_dm_end_dependent_descriptor (
  328. struct asl_start_dependent_desc *resource,
  329. u32 length,
  330. u32 level);
  331. void
  332. acpi_dm_vendor_small_descriptor (
  333. struct asl_small_vendor_desc *resource,
  334. u32 length,
  335. u32 level);
  336. /*
  337. * dmutils
  338. */
  339. void
  340. acpi_dm_add_to_external_list (
  341. char *path);
  342. #endif /* __ACDISASM_H__ */