acdisasm.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. /******************************************************************************
  2. *
  3. * Name: acdisasm.h - AML disassembler
  4. *
  5. *****************************************************************************/
  6. /*
  7. * Copyright (C) 2000 - 2008, 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. #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. #define ACPI_DEFAULT_RESNAME *(u32 *) "__RD"
  50. struct acpi_external_list {
  51. char *path;
  52. char *internal_path;
  53. struct acpi_external_list *next;
  54. u32 value;
  55. u16 length;
  56. u8 type;
  57. };
  58. extern struct acpi_external_list *acpi_gbl_external_list;
  59. typedef const struct acpi_dmtable_info {
  60. u8 opcode;
  61. u8 offset;
  62. char *name;
  63. } acpi_dmtable_info;
  64. /*
  65. * Values for Opcode above.
  66. * Note: 0-7 must not change, used as a flag shift value
  67. */
  68. #define ACPI_DMT_FLAG0 0
  69. #define ACPI_DMT_FLAG1 1
  70. #define ACPI_DMT_FLAG2 2
  71. #define ACPI_DMT_FLAG3 3
  72. #define ACPI_DMT_FLAG4 4
  73. #define ACPI_DMT_FLAG5 5
  74. #define ACPI_DMT_FLAG6 6
  75. #define ACPI_DMT_FLAG7 7
  76. #define ACPI_DMT_FLAGS0 8
  77. #define ACPI_DMT_FLAGS2 9
  78. #define ACPI_DMT_UINT8 10
  79. #define ACPI_DMT_UINT16 11
  80. #define ACPI_DMT_UINT24 12
  81. #define ACPI_DMT_UINT32 13
  82. #define ACPI_DMT_UINT56 14
  83. #define ACPI_DMT_UINT64 15
  84. #define ACPI_DMT_STRING 16
  85. #define ACPI_DMT_NAME4 17
  86. #define ACPI_DMT_NAME6 18
  87. #define ACPI_DMT_NAME8 19
  88. #define ACPI_DMT_CHKSUM 20
  89. #define ACPI_DMT_SPACEID 21
  90. #define ACPI_DMT_GAS 22
  91. #define ACPI_DMT_ASF 23
  92. #define ACPI_DMT_DMAR 24
  93. #define ACPI_DMT_HEST 25
  94. #define ACPI_DMT_HESTNTFY 26
  95. #define ACPI_DMT_HESTNTYP 27
  96. #define ACPI_DMT_MADT 28
  97. #define ACPI_DMT_SRAT 29
  98. #define ACPI_DMT_EXIT 30
  99. #define ACPI_DMT_SIG 31
  100. typedef
  101. void (*acpi_dmtable_handler) (struct acpi_table_header * table);
  102. struct acpi_dmtable_data {
  103. char *signature;
  104. struct acpi_dmtable_info *table_info;
  105. acpi_dmtable_handler table_handler;
  106. char *name;
  107. };
  108. struct acpi_op_walk_info {
  109. u32 level;
  110. u32 last_level;
  111. u32 count;
  112. u32 bit_offset;
  113. u32 flags;
  114. struct acpi_walk_state *walk_state;
  115. };
  116. typedef
  117. acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
  118. u32 level, void *context);
  119. struct acpi_resource_tag {
  120. u32 bit_index;
  121. char *tag;
  122. };
  123. /* Strings used for decoding flags to ASL keywords */
  124. extern const char *acpi_gbl_word_decode[];
  125. extern const char *acpi_gbl_irq_decode[];
  126. extern const char *acpi_gbl_lock_rule[];
  127. extern const char *acpi_gbl_access_types[];
  128. extern const char *acpi_gbl_update_rules[];
  129. extern const char *acpi_gbl_match_ops[];
  130. extern struct acpi_dmtable_info acpi_dm_table_info_asf0[];
  131. extern struct acpi_dmtable_info acpi_dm_table_info_asf1[];
  132. extern struct acpi_dmtable_info acpi_dm_table_info_asf1a[];
  133. extern struct acpi_dmtable_info acpi_dm_table_info_asf2[];
  134. extern struct acpi_dmtable_info acpi_dm_table_info_asf2a[];
  135. extern struct acpi_dmtable_info acpi_dm_table_info_asf3[];
  136. extern struct acpi_dmtable_info acpi_dm_table_info_asf4[];
  137. extern struct acpi_dmtable_info acpi_dm_table_info_asf_hdr[];
  138. extern struct acpi_dmtable_info acpi_dm_table_info_boot[];
  139. extern struct acpi_dmtable_info acpi_dm_table_info_bert[];
  140. extern struct acpi_dmtable_info acpi_dm_table_info_cpep[];
  141. extern struct acpi_dmtable_info acpi_dm_table_info_cpep0[];
  142. extern struct acpi_dmtable_info acpi_dm_table_info_dbgp[];
  143. extern struct acpi_dmtable_info acpi_dm_table_info_dmar[];
  144. extern struct acpi_dmtable_info acpi_dm_table_info_dmar_hdr[];
  145. extern struct acpi_dmtable_info acpi_dm_table_info_dmar_scope[];
  146. extern struct acpi_dmtable_info acpi_dm_table_info_dmar0[];
  147. extern struct acpi_dmtable_info acpi_dm_table_info_dmar1[];
  148. extern struct acpi_dmtable_info acpi_dm_table_info_dmar2[];
  149. extern struct acpi_dmtable_info acpi_dm_table_info_ecdt[];
  150. extern struct acpi_dmtable_info acpi_dm_table_info_einj[];
  151. extern struct acpi_dmtable_info acpi_dm_table_info_einj0[];
  152. extern struct acpi_dmtable_info acpi_dm_table_info_erst[];
  153. extern struct acpi_dmtable_info acpi_dm_table_info_facs[];
  154. extern struct acpi_dmtable_info acpi_dm_table_info_fadt1[];
  155. extern struct acpi_dmtable_info acpi_dm_table_info_fadt2[];
  156. extern struct acpi_dmtable_info acpi_dm_table_info_gas[];
  157. extern struct acpi_dmtable_info acpi_dm_table_info_header[];
  158. extern struct acpi_dmtable_info acpi_dm_table_info_hest[];
  159. extern struct acpi_dmtable_info acpi_dm_table_info_hest9[];
  160. extern struct acpi_dmtable_info acpi_dm_table_info_hest_notify[];
  161. extern struct acpi_dmtable_info acpi_dm_table_info_hpet[];
  162. extern struct acpi_dmtable_info acpi_dm_table_info_madt[];
  163. extern struct acpi_dmtable_info acpi_dm_table_info_madt0[];
  164. extern struct acpi_dmtable_info acpi_dm_table_info_madt1[];
  165. extern struct acpi_dmtable_info acpi_dm_table_info_madt2[];
  166. extern struct acpi_dmtable_info acpi_dm_table_info_madt3[];
  167. extern struct acpi_dmtable_info acpi_dm_table_info_madt4[];
  168. extern struct acpi_dmtable_info acpi_dm_table_info_madt5[];
  169. extern struct acpi_dmtable_info acpi_dm_table_info_madt6[];
  170. extern struct acpi_dmtable_info acpi_dm_table_info_madt7[];
  171. extern struct acpi_dmtable_info acpi_dm_table_info_madt8[];
  172. extern struct acpi_dmtable_info acpi_dm_table_info_madt9[];
  173. extern struct acpi_dmtable_info acpi_dm_table_info_madt10[];
  174. extern struct acpi_dmtable_info acpi_dm_table_info_madt_hdr[];
  175. extern struct acpi_dmtable_info acpi_dm_table_info_mcfg[];
  176. extern struct acpi_dmtable_info acpi_dm_table_info_mcfg0[];
  177. extern struct acpi_dmtable_info acpi_dm_table_info_rsdp1[];
  178. extern struct acpi_dmtable_info acpi_dm_table_info_rsdp2[];
  179. extern struct acpi_dmtable_info acpi_dm_table_info_sbst[];
  180. extern struct acpi_dmtable_info acpi_dm_table_info_slic[];
  181. extern struct acpi_dmtable_info acpi_dm_table_info_slit[];
  182. extern struct acpi_dmtable_info acpi_dm_table_info_spcr[];
  183. extern struct acpi_dmtable_info acpi_dm_table_info_spmi[];
  184. extern struct acpi_dmtable_info acpi_dm_table_info_srat[];
  185. extern struct acpi_dmtable_info acpi_dm_table_info_srat_hdr[];
  186. extern struct acpi_dmtable_info acpi_dm_table_info_srat0[];
  187. extern struct acpi_dmtable_info acpi_dm_table_info_srat1[];
  188. extern struct acpi_dmtable_info acpi_dm_table_info_srat2[];
  189. extern struct acpi_dmtable_info acpi_dm_table_info_tcpa[];
  190. extern struct acpi_dmtable_info acpi_dm_table_info_wdrt[];
  191. /*
  192. * dmtable
  193. */
  194. void acpi_dm_dump_data_table(struct acpi_table_header *table);
  195. acpi_status
  196. acpi_dm_dump_table(u32 table_length,
  197. u32 table_offset,
  198. void *table,
  199. u32 sub_table_length, struct acpi_dmtable_info *info);
  200. void acpi_dm_line_header(u32 offset, u32 byte_length, char *name);
  201. void acpi_dm_line_header2(u32 offset, u32 byte_length, char *name, u32 value);
  202. /*
  203. * dmtbdump
  204. */
  205. void acpi_dm_dump_asf(struct acpi_table_header *table);
  206. void acpi_dm_dump_cpep(struct acpi_table_header *table);
  207. void acpi_dm_dump_dmar(struct acpi_table_header *table);
  208. void acpi_dm_dump_einj(struct acpi_table_header *table);
  209. void acpi_dm_dump_erst(struct acpi_table_header *table);
  210. void acpi_dm_dump_fadt(struct acpi_table_header *table);
  211. void acpi_dm_dump_hest(struct acpi_table_header *table);
  212. void acpi_dm_dump_mcfg(struct acpi_table_header *table);
  213. void acpi_dm_dump_madt(struct acpi_table_header *table);
  214. u32 acpi_dm_dump_rsdp(struct acpi_table_header *table);
  215. void acpi_dm_dump_rsdt(struct acpi_table_header *table);
  216. void acpi_dm_dump_slit(struct acpi_table_header *table);
  217. void acpi_dm_dump_srat(struct acpi_table_header *table);
  218. void acpi_dm_dump_xsdt(struct acpi_table_header *table);
  219. /*
  220. * dmwalk
  221. */
  222. void
  223. acpi_dm_disassemble(struct acpi_walk_state *walk_state,
  224. union acpi_parse_object *origin, u32 num_opcodes);
  225. void
  226. acpi_dm_walk_parse_tree(union acpi_parse_object *op,
  227. asl_walk_callback descending_callback,
  228. asl_walk_callback ascending_callback, void *context);
  229. /*
  230. * dmopcode
  231. */
  232. void
  233. acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
  234. struct acpi_op_walk_info *info,
  235. union acpi_parse_object *op);
  236. void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
  237. u32 acpi_dm_list_type(union acpi_parse_object *op);
  238. void acpi_dm_method_flags(union acpi_parse_object *op);
  239. void acpi_dm_field_flags(union acpi_parse_object *op);
  240. void acpi_dm_address_space(u8 space_id);
  241. void acpi_dm_region_flags(union acpi_parse_object *op);
  242. void acpi_dm_match_op(union acpi_parse_object *op);
  243. u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
  244. void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
  245. /*
  246. * dmnames
  247. */
  248. u32 acpi_dm_dump_name(char *name);
  249. acpi_status
  250. acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
  251. union acpi_parse_object *op);
  252. void acpi_dm_namestring(char *name);
  253. /*
  254. * dmobject
  255. */
  256. void
  257. acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
  258. struct acpi_walk_state *walk_state);
  259. void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
  260. void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
  261. void
  262. acpi_dm_dump_method_info(acpi_status status,
  263. struct acpi_walk_state *walk_state,
  264. union acpi_parse_object *op);
  265. /*
  266. * dmbuffer
  267. */
  268. void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
  269. void
  270. acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
  271. void acpi_dm_is_eisa_id(union acpi_parse_object *op);
  272. void acpi_dm_eisa_id(u32 encoded_id);
  273. u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
  274. u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
  275. /*
  276. * dmresrc
  277. */
  278. void acpi_dm_dump_integer8(u8 value, char *name);
  279. void acpi_dm_dump_integer16(u16 value, char *name);
  280. void acpi_dm_dump_integer32(u32 value, char *name);
  281. void acpi_dm_dump_integer64(u64 value, char *name);
  282. void
  283. acpi_dm_resource_template(struct acpi_op_walk_info *info,
  284. union acpi_parse_object *op,
  285. u8 * byte_data, u32 byte_count);
  286. acpi_status acpi_dm_is_resource_template(union acpi_parse_object *op);
  287. void acpi_dm_indent(u32 level);
  288. void acpi_dm_bit_list(u16 mask);
  289. void acpi_dm_decode_attribute(u8 attribute);
  290. void acpi_dm_descriptor_name(void);
  291. /*
  292. * dmresrcl
  293. */
  294. void
  295. acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
  296. void
  297. acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
  298. void
  299. acpi_dm_extended_descriptor(union aml_resource *resource,
  300. u32 length, u32 level);
  301. void
  302. acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
  303. void
  304. acpi_dm_memory24_descriptor(union aml_resource *resource,
  305. u32 length, u32 level);
  306. void
  307. acpi_dm_memory32_descriptor(union aml_resource *resource,
  308. u32 length, u32 level);
  309. void
  310. acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
  311. u32 length, u32 level);
  312. void
  313. acpi_dm_generic_register_descriptor(union aml_resource *resource,
  314. u32 length, u32 level);
  315. void
  316. acpi_dm_interrupt_descriptor(union aml_resource *resource,
  317. u32 length, u32 level);
  318. void
  319. acpi_dm_vendor_large_descriptor(union aml_resource *resource,
  320. u32 length, u32 level);
  321. void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
  322. /*
  323. * dmresrcs
  324. */
  325. void
  326. acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
  327. void
  328. acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
  329. void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
  330. void
  331. acpi_dm_fixed_io_descriptor(union aml_resource *resource,
  332. u32 length, u32 level);
  333. void
  334. acpi_dm_start_dependent_descriptor(union aml_resource *resource,
  335. u32 length, u32 level);
  336. void
  337. acpi_dm_end_dependent_descriptor(union aml_resource *resource,
  338. u32 length, u32 level);
  339. void
  340. acpi_dm_vendor_small_descriptor(union aml_resource *resource,
  341. u32 length, u32 level);
  342. /*
  343. * dmutils
  344. */
  345. void acpi_dm_add_to_external_list(char *path, u8 type, u32 value);
  346. /*
  347. * dmrestag
  348. */
  349. void acpi_dm_find_resources(union acpi_parse_object *root);
  350. void
  351. acpi_dm_check_resource_reference(union acpi_parse_object *op,
  352. struct acpi_walk_state *walk_state);
  353. #endif /* __ACDISASM_H__ */