acdisasm.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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. char *path;
  51. struct acpi_external_list *next;
  52. };
  53. extern struct acpi_external_list *acpi_gbl_external_list;
  54. extern const char *acpi_gbl_io_decode[2];
  55. extern const char *acpi_gbl_word_decode[4];
  56. extern const char *acpi_gbl_consume_decode[2];
  57. extern const char *acpi_gbl_config_decode[4];
  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. u32 level;
  80. u32 bit_offset;
  81. struct acpi_walk_state *walk_state;
  82. };
  83. typedef
  84. acpi_status(*asl_walk_callback) (union acpi_parse_object * op,
  85. u32 level, void *context);
  86. /*
  87. * dmwalk
  88. */
  89. void
  90. acpi_dm_disassemble(struct acpi_walk_state *walk_state,
  91. union acpi_parse_object *origin, u32 num_opcodes);
  92. /*
  93. * dmopcode
  94. */
  95. void
  96. acpi_dm_disassemble_one_op(struct acpi_walk_state *walk_state,
  97. struct acpi_op_walk_info *info,
  98. union acpi_parse_object *op);
  99. void acpi_dm_decode_internal_object(union acpi_operand_object *obj_desc);
  100. u32 acpi_dm_list_type(union acpi_parse_object *op);
  101. void acpi_dm_method_flags(union acpi_parse_object *op);
  102. void acpi_dm_field_flags(union acpi_parse_object *op);
  103. void acpi_dm_address_space(u8 space_id);
  104. void acpi_dm_region_flags(union acpi_parse_object *op);
  105. void acpi_dm_match_op(union acpi_parse_object *op);
  106. u8 acpi_dm_comma_if_list_member(union acpi_parse_object *op);
  107. void acpi_dm_comma_if_field_member(union acpi_parse_object *op);
  108. /*
  109. * dmnames
  110. */
  111. u32 acpi_dm_dump_name(char *name);
  112. acpi_status
  113. acpi_ps_display_object_pathname(struct acpi_walk_state *walk_state,
  114. union acpi_parse_object *op);
  115. void acpi_dm_namestring(char *name);
  116. /*
  117. * dmobject
  118. */
  119. void
  120. acpi_dm_display_internal_object(union acpi_operand_object *obj_desc,
  121. struct acpi_walk_state *walk_state);
  122. void acpi_dm_display_arguments(struct acpi_walk_state *walk_state);
  123. void acpi_dm_display_locals(struct acpi_walk_state *walk_state);
  124. void
  125. acpi_dm_dump_method_info(acpi_status status,
  126. struct acpi_walk_state *walk_state,
  127. union acpi_parse_object *op);
  128. /*
  129. * dmbuffer
  130. */
  131. void acpi_dm_disasm_byte_list(u32 level, u8 * byte_data, u32 byte_count);
  132. void
  133. acpi_dm_byte_list(struct acpi_op_walk_info *info, union acpi_parse_object *op);
  134. void acpi_dm_is_eisa_id(union acpi_parse_object *op);
  135. void acpi_dm_eisa_id(u32 encoded_id);
  136. u8 acpi_dm_is_unicode_buffer(union acpi_parse_object *op);
  137. u8 acpi_dm_is_string_buffer(union acpi_parse_object *op);
  138. /*
  139. * dmresrc
  140. */
  141. void acpi_dm_dump_integer8(u8 value, char *name);
  142. void acpi_dm_dump_integer16(u16 value, char *name);
  143. void acpi_dm_dump_integer32(u32 value, char *name);
  144. void acpi_dm_dump_integer64(u64 value, char *name);
  145. void
  146. acpi_dm_resource_template(struct acpi_op_walk_info *info,
  147. u8 * byte_data, u32 byte_count);
  148. u8 acpi_dm_is_resource_template(union acpi_parse_object *op);
  149. void acpi_dm_indent(u32 level);
  150. void acpi_dm_bit_list(u16 mask);
  151. void acpi_dm_decode_attribute(u8 attribute);
  152. /*
  153. * dmresrcl
  154. */
  155. void
  156. acpi_dm_word_descriptor(union aml_resource *resource, u32 length, u32 level);
  157. void
  158. acpi_dm_dword_descriptor(union aml_resource *resource, u32 length, u32 level);
  159. void
  160. acpi_dm_extended_descriptor(union aml_resource *resource,
  161. u32 length, u32 level);
  162. void
  163. acpi_dm_qword_descriptor(union aml_resource *resource, u32 length, u32 level);
  164. void
  165. acpi_dm_memory24_descriptor(union aml_resource *resource,
  166. u32 length, u32 level);
  167. void
  168. acpi_dm_memory32_descriptor(union aml_resource *resource,
  169. u32 length, u32 level);
  170. void
  171. acpi_dm_fixed_memory32_descriptor(union aml_resource *resource,
  172. u32 length, u32 level);
  173. void
  174. acpi_dm_generic_register_descriptor(union aml_resource *resource,
  175. u32 length, u32 level);
  176. void
  177. acpi_dm_interrupt_descriptor(union aml_resource *resource,
  178. u32 length, u32 level);
  179. void
  180. acpi_dm_vendor_large_descriptor(union aml_resource *resource,
  181. u32 length, u32 level);
  182. void acpi_dm_vendor_common(char *name, u8 * byte_data, u32 length, u32 level);
  183. /*
  184. * dmresrcs
  185. */
  186. void
  187. acpi_dm_irq_descriptor(union aml_resource *resource, u32 length, u32 level);
  188. void
  189. acpi_dm_dma_descriptor(union aml_resource *resource, u32 length, u32 level);
  190. void acpi_dm_io_descriptor(union aml_resource *resource, u32 length, u32 level);
  191. void
  192. acpi_dm_fixed_io_descriptor(union aml_resource *resource,
  193. u32 length, u32 level);
  194. void
  195. acpi_dm_start_dependent_descriptor(union aml_resource *resource,
  196. u32 length, u32 level);
  197. void
  198. acpi_dm_end_dependent_descriptor(union aml_resource *resource,
  199. u32 length, u32 level);
  200. void
  201. acpi_dm_vendor_small_descriptor(union aml_resource *resource,
  202. u32 length, u32 level);
  203. /*
  204. * dmutils
  205. */
  206. void acpi_dm_add_to_external_list(char *path);
  207. #endif /* __ACDISASM_H__ */