acdispat.h 14 KB

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