acdispat.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. /******************************************************************************
  2. *
  3. * Name: acdispat.h - dispatcher (parser to interpreter interface)
  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 _ACDISPAT_H_
  43. #define _ACDISPAT_H_
  44. #define NAMEOF_LOCAL_NTE "__L0"
  45. #define NAMEOF_ARG_NTE "__A0"
  46. /*
  47. * dsopcode - support for late evaluation
  48. */
  49. acpi_status
  50. acpi_ds_get_buffer_field_arguments (
  51. union acpi_operand_object *obj_desc);
  52. acpi_status
  53. acpi_ds_get_region_arguments (
  54. union acpi_operand_object *rgn_desc);
  55. acpi_status
  56. acpi_ds_get_buffer_arguments (
  57. union acpi_operand_object *obj_desc);
  58. acpi_status
  59. acpi_ds_get_package_arguments (
  60. union acpi_operand_object *obj_desc);
  61. acpi_status
  62. acpi_ds_eval_buffer_field_operands (
  63. struct acpi_walk_state *walk_state,
  64. union acpi_parse_object *op);
  65. acpi_status
  66. acpi_ds_eval_region_operands (
  67. struct acpi_walk_state *walk_state,
  68. union acpi_parse_object *op);
  69. acpi_status
  70. acpi_ds_eval_data_object_operands (
  71. struct acpi_walk_state *walk_state,
  72. union acpi_parse_object *op,
  73. union acpi_operand_object *obj_desc);
  74. acpi_status
  75. acpi_ds_initialize_region (
  76. acpi_handle obj_handle);
  77. /*
  78. * dsctrl - Parser/Interpreter interface, control stack routines
  79. */
  80. acpi_status
  81. acpi_ds_exec_begin_control_op (
  82. struct acpi_walk_state *walk_state,
  83. union acpi_parse_object *op);
  84. acpi_status
  85. acpi_ds_exec_end_control_op (
  86. struct acpi_walk_state *walk_state,
  87. union acpi_parse_object *op);
  88. /*
  89. * dsexec - Parser/Interpreter interface, method execution callbacks
  90. */
  91. acpi_status
  92. acpi_ds_get_predicate_value (
  93. struct acpi_walk_state *walk_state,
  94. union acpi_operand_object *result_obj);
  95. acpi_status
  96. acpi_ds_exec_begin_op (
  97. struct acpi_walk_state *walk_state,
  98. union acpi_parse_object **out_op);
  99. acpi_status
  100. acpi_ds_exec_end_op (
  101. struct acpi_walk_state *state);
  102. /*
  103. * dsfield - Parser/Interpreter interface for AML fields
  104. */
  105. acpi_status
  106. acpi_ds_create_field (
  107. union acpi_parse_object *op,
  108. struct acpi_namespace_node *region_node,
  109. struct acpi_walk_state *walk_state);
  110. acpi_status
  111. acpi_ds_create_bank_field (
  112. union acpi_parse_object *op,
  113. struct acpi_namespace_node *region_node,
  114. struct acpi_walk_state *walk_state);
  115. acpi_status
  116. acpi_ds_create_index_field (
  117. union acpi_parse_object *op,
  118. struct acpi_namespace_node *region_node,
  119. struct acpi_walk_state *walk_state);
  120. acpi_status
  121. acpi_ds_create_buffer_field (
  122. union acpi_parse_object *op,
  123. struct acpi_walk_state *walk_state);
  124. acpi_status
  125. acpi_ds_init_field_objects (
  126. union acpi_parse_object *op,
  127. struct acpi_walk_state *walk_state);
  128. /*
  129. * dsload - Parser/Interpreter interface, namespace load callbacks
  130. */
  131. acpi_status
  132. acpi_ds_load1_begin_op (
  133. struct acpi_walk_state *walk_state,
  134. union acpi_parse_object **out_op);
  135. acpi_status
  136. acpi_ds_load1_end_op (
  137. struct acpi_walk_state *walk_state);
  138. acpi_status
  139. acpi_ds_load2_begin_op (
  140. struct acpi_walk_state *walk_state,
  141. union acpi_parse_object **out_op);
  142. acpi_status
  143. acpi_ds_load2_end_op (
  144. struct acpi_walk_state *walk_state);
  145. acpi_status
  146. acpi_ds_init_callbacks (
  147. struct acpi_walk_state *walk_state,
  148. u32 pass_number);
  149. /*
  150. * dsmthdat - method data (locals/args)
  151. */
  152. acpi_status
  153. acpi_ds_store_object_to_local (
  154. u16 opcode,
  155. u32 index,
  156. union acpi_operand_object *src_desc,
  157. struct acpi_walk_state *walk_state);
  158. acpi_status
  159. acpi_ds_method_data_get_entry (
  160. u16 opcode,
  161. u32 index,
  162. struct acpi_walk_state *walk_state,
  163. union acpi_operand_object ***node);
  164. void
  165. acpi_ds_method_data_delete_all (
  166. struct acpi_walk_state *walk_state);
  167. u8
  168. acpi_ds_is_method_value (
  169. union acpi_operand_object *obj_desc);
  170. acpi_status
  171. acpi_ds_method_data_get_value (
  172. u16 opcode,
  173. u32 index,
  174. struct acpi_walk_state *walk_state,
  175. union acpi_operand_object **dest_desc);
  176. acpi_status
  177. acpi_ds_method_data_init_args (
  178. union acpi_operand_object **params,
  179. u32 max_param_count,
  180. struct acpi_walk_state *walk_state);
  181. acpi_status
  182. acpi_ds_method_data_get_node (
  183. u16 opcode,
  184. u32 index,
  185. struct acpi_walk_state *walk_state,
  186. struct acpi_namespace_node **node);
  187. void
  188. acpi_ds_method_data_init (
  189. struct acpi_walk_state *walk_state);
  190. /*
  191. * dsmethod - Parser/Interpreter interface - control method parsing
  192. */
  193. acpi_status
  194. acpi_ds_parse_method (
  195. acpi_handle obj_handle);
  196. acpi_status
  197. acpi_ds_call_control_method (
  198. struct acpi_thread_state *thread,
  199. struct acpi_walk_state *walk_state,
  200. union acpi_parse_object *op);
  201. acpi_status
  202. acpi_ds_restart_control_method (
  203. struct acpi_walk_state *walk_state,
  204. union acpi_operand_object *return_desc);
  205. acpi_status
  206. acpi_ds_terminate_control_method (
  207. struct acpi_walk_state *walk_state);
  208. acpi_status
  209. acpi_ds_begin_method_execution (
  210. struct acpi_namespace_node *method_node,
  211. union acpi_operand_object *obj_desc,
  212. struct acpi_namespace_node *calling_method_node);
  213. /*
  214. * dsinit
  215. */
  216. acpi_status
  217. acpi_ds_initialize_objects (
  218. struct acpi_table_desc *table_desc,
  219. struct acpi_namespace_node *start_node);
  220. /*
  221. * dsobject - Parser/Interpreter interface - object initialization and conversion
  222. */
  223. acpi_status
  224. acpi_ds_build_internal_buffer_obj (
  225. struct acpi_walk_state *walk_state,
  226. union acpi_parse_object *op,
  227. u32 buffer_length,
  228. union acpi_operand_object **obj_desc_ptr);
  229. acpi_status
  230. acpi_ds_build_internal_package_obj (
  231. struct acpi_walk_state *walk_state,
  232. union acpi_parse_object *op,
  233. u32 package_length,
  234. union acpi_operand_object **obj_desc);
  235. acpi_status
  236. acpi_ds_init_object_from_op (
  237. struct acpi_walk_state *walk_state,
  238. union acpi_parse_object *op,
  239. u16 opcode,
  240. union acpi_operand_object **obj_desc);
  241. acpi_status
  242. acpi_ds_create_node (
  243. struct acpi_walk_state *walk_state,
  244. struct acpi_namespace_node *node,
  245. union acpi_parse_object *op);
  246. /*
  247. * dsutils - Parser/Interpreter interface utility routines
  248. */
  249. void
  250. acpi_ds_clear_implicit_return (
  251. struct acpi_walk_state *walk_state);
  252. u8
  253. acpi_ds_do_implicit_return (
  254. union acpi_operand_object *return_desc,
  255. struct acpi_walk_state *walk_state,
  256. u8 add_reference);
  257. u8
  258. acpi_ds_is_result_used (
  259. union acpi_parse_object *op,
  260. struct acpi_walk_state *walk_state);
  261. void
  262. acpi_ds_delete_result_if_not_used (
  263. union acpi_parse_object *op,
  264. union acpi_operand_object *result_obj,
  265. struct acpi_walk_state *walk_state);
  266. acpi_status
  267. acpi_ds_create_operand (
  268. struct acpi_walk_state *walk_state,
  269. union acpi_parse_object *arg,
  270. u32 args_remaining);
  271. acpi_status
  272. acpi_ds_create_operands (
  273. struct acpi_walk_state *walk_state,
  274. union acpi_parse_object *first_arg);
  275. acpi_status
  276. acpi_ds_resolve_operands (
  277. struct acpi_walk_state *walk_state);
  278. void
  279. acpi_ds_clear_operands (
  280. struct acpi_walk_state *walk_state);
  281. /*
  282. * dswscope - Scope Stack manipulation
  283. */
  284. acpi_status
  285. acpi_ds_scope_stack_push (
  286. struct acpi_namespace_node *node,
  287. acpi_object_type type,
  288. struct acpi_walk_state *walk_state);
  289. acpi_status
  290. acpi_ds_scope_stack_pop (
  291. struct acpi_walk_state *walk_state);
  292. void
  293. acpi_ds_scope_stack_clear (
  294. struct acpi_walk_state *walk_state);
  295. /*
  296. * dswstate - parser WALK_STATE management routines
  297. */
  298. acpi_status
  299. acpi_ds_obj_stack_push (
  300. void *object,
  301. struct acpi_walk_state *walk_state);
  302. acpi_status
  303. acpi_ds_obj_stack_pop (
  304. u32 pop_count,
  305. struct acpi_walk_state *walk_state);
  306. struct acpi_walk_state *
  307. acpi_ds_create_walk_state (
  308. acpi_owner_id owner_id,
  309. union acpi_parse_object *origin,
  310. union acpi_operand_object *mth_desc,
  311. struct acpi_thread_state *thread);
  312. acpi_status
  313. acpi_ds_init_aml_walk (
  314. struct acpi_walk_state *walk_state,
  315. union acpi_parse_object *op,
  316. struct acpi_namespace_node *method_node,
  317. u8 *aml_start,
  318. u32 aml_length,
  319. struct acpi_parameter_info *info,
  320. u32 pass_number);
  321. acpi_status
  322. acpi_ds_obj_stack_pop_and_delete (
  323. u32 pop_count,
  324. struct acpi_walk_state *walk_state);
  325. void
  326. acpi_ds_delete_walk_state (
  327. struct acpi_walk_state *walk_state);
  328. struct acpi_walk_state *
  329. acpi_ds_pop_walk_state (
  330. struct acpi_thread_state *thread);
  331. void
  332. acpi_ds_push_walk_state (
  333. struct acpi_walk_state *walk_state,
  334. struct acpi_thread_state *thread);
  335. acpi_status
  336. acpi_ds_result_stack_pop (
  337. struct acpi_walk_state *walk_state);
  338. acpi_status
  339. acpi_ds_result_stack_push (
  340. struct acpi_walk_state *walk_state);
  341. acpi_status
  342. acpi_ds_result_stack_clear (
  343. struct acpi_walk_state *walk_state);
  344. struct acpi_walk_state *
  345. acpi_ds_get_current_walk_state (
  346. struct acpi_thread_state *thread);
  347. #ifdef ACPI_FUTURE_USAGE
  348. acpi_status
  349. acpi_ds_result_remove (
  350. union acpi_operand_object **object,
  351. u32 index,
  352. struct acpi_walk_state *walk_state);
  353. #endif
  354. acpi_status
  355. acpi_ds_result_pop (
  356. union acpi_operand_object **object,
  357. struct acpi_walk_state *walk_state);
  358. acpi_status
  359. acpi_ds_result_push (
  360. union acpi_operand_object *object,
  361. struct acpi_walk_state *walk_state);
  362. acpi_status
  363. acpi_ds_result_pop_from_bottom (
  364. union acpi_operand_object **object,
  365. struct acpi_walk_state *walk_state);
  366. #ifdef ACPI_ENABLE_OBJECT_CACHE
  367. void
  368. acpi_ds_delete_walk_state_cache (
  369. void);
  370. #endif
  371. #endif /* _ACDISPAT_H_ */