acinterp.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. /******************************************************************************
  2. *
  3. * Name: acinterp.h - Interpreter subcomponent prototypes and defines
  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 __ACINTERP_H__
  43. #define __ACINTERP_H__
  44. #define ACPI_WALK_OPERANDS (&(walk_state->operands [walk_state->num_operands -1]))
  45. /*
  46. * exconvrt - object conversion
  47. */
  48. acpi_status
  49. acpi_ex_convert_to_integer (
  50. union acpi_operand_object *obj_desc,
  51. union acpi_operand_object **result_desc,
  52. u32 flags);
  53. acpi_status
  54. acpi_ex_convert_to_buffer (
  55. union acpi_operand_object *obj_desc,
  56. union acpi_operand_object **result_desc);
  57. acpi_status
  58. acpi_ex_convert_to_string (
  59. union acpi_operand_object *obj_desc,
  60. union acpi_operand_object **result_desc,
  61. u32 type);
  62. /* Types for ->String conversion */
  63. #define ACPI_EXPLICIT_BYTE_COPY 0x00000000
  64. #define ACPI_EXPLICIT_CONVERT_HEX 0x00000001
  65. #define ACPI_IMPLICIT_CONVERT_HEX 0x00000002
  66. #define ACPI_EXPLICIT_CONVERT_DECIMAL 0x00000003
  67. acpi_status
  68. acpi_ex_convert_to_target_type (
  69. acpi_object_type destination_type,
  70. union acpi_operand_object *source_desc,
  71. union acpi_operand_object **result_desc,
  72. struct acpi_walk_state *walk_state);
  73. /*
  74. * exfield - ACPI AML (p-code) execution - field manipulation
  75. */
  76. acpi_status
  77. acpi_ex_common_buffer_setup (
  78. union acpi_operand_object *obj_desc,
  79. u32 buffer_length,
  80. u32 *datum_count);
  81. acpi_status
  82. acpi_ex_write_with_update_rule (
  83. union acpi_operand_object *obj_desc,
  84. acpi_integer mask,
  85. acpi_integer field_value,
  86. u32 field_datum_byte_offset);
  87. void
  88. acpi_ex_get_buffer_datum(
  89. acpi_integer *datum,
  90. void *buffer,
  91. u32 buffer_length,
  92. u32 byte_granularity,
  93. u32 buffer_offset);
  94. void
  95. acpi_ex_set_buffer_datum (
  96. acpi_integer merged_datum,
  97. void *buffer,
  98. u32 buffer_length,
  99. u32 byte_granularity,
  100. u32 buffer_offset);
  101. acpi_status
  102. acpi_ex_read_data_from_field (
  103. struct acpi_walk_state *walk_state,
  104. union acpi_operand_object *obj_desc,
  105. union acpi_operand_object **ret_buffer_desc);
  106. acpi_status
  107. acpi_ex_write_data_to_field (
  108. union acpi_operand_object *source_desc,
  109. union acpi_operand_object *obj_desc,
  110. union acpi_operand_object **result_desc);
  111. /*
  112. * exfldio - low level field I/O
  113. */
  114. acpi_status
  115. acpi_ex_extract_from_field (
  116. union acpi_operand_object *obj_desc,
  117. void *buffer,
  118. u32 buffer_length);
  119. acpi_status
  120. acpi_ex_insert_into_field (
  121. union acpi_operand_object *obj_desc,
  122. void *buffer,
  123. u32 buffer_length);
  124. acpi_status
  125. acpi_ex_access_region (
  126. union acpi_operand_object *obj_desc,
  127. u32 field_datum_byte_offset,
  128. acpi_integer *value,
  129. u32 read_write);
  130. /*
  131. * exmisc - misc support routines
  132. */
  133. acpi_status
  134. acpi_ex_get_object_reference (
  135. union acpi_operand_object *obj_desc,
  136. union acpi_operand_object **return_desc,
  137. struct acpi_walk_state *walk_state);
  138. acpi_status
  139. acpi_ex_concat_template (
  140. union acpi_operand_object *obj_desc,
  141. union acpi_operand_object *obj_desc2,
  142. union acpi_operand_object **actual_return_desc,
  143. struct acpi_walk_state *walk_state);
  144. acpi_status
  145. acpi_ex_do_concatenate (
  146. union acpi_operand_object *obj_desc,
  147. union acpi_operand_object *obj_desc2,
  148. union acpi_operand_object **actual_return_desc,
  149. struct acpi_walk_state *walk_state);
  150. acpi_status
  151. acpi_ex_do_logical_numeric_op (
  152. u16 opcode,
  153. acpi_integer integer0,
  154. acpi_integer integer1,
  155. u8 *logical_result);
  156. acpi_status
  157. acpi_ex_do_logical_op (
  158. u16 opcode,
  159. union acpi_operand_object *operand0,
  160. union acpi_operand_object *operand1,
  161. u8 *logical_result);
  162. acpi_integer
  163. acpi_ex_do_math_op (
  164. u16 opcode,
  165. acpi_integer operand0,
  166. acpi_integer operand1);
  167. acpi_status
  168. acpi_ex_create_mutex (
  169. struct acpi_walk_state *walk_state);
  170. acpi_status
  171. acpi_ex_create_processor (
  172. struct acpi_walk_state *walk_state);
  173. acpi_status
  174. acpi_ex_create_power_resource (
  175. struct acpi_walk_state *walk_state);
  176. acpi_status
  177. acpi_ex_create_region (
  178. u8 *aml_start,
  179. u32 aml_length,
  180. u8 region_space,
  181. struct acpi_walk_state *walk_state);
  182. acpi_status
  183. acpi_ex_create_table_region (
  184. struct acpi_walk_state *walk_state);
  185. acpi_status
  186. acpi_ex_create_event (
  187. struct acpi_walk_state *walk_state);
  188. acpi_status
  189. acpi_ex_create_alias (
  190. struct acpi_walk_state *walk_state);
  191. acpi_status
  192. acpi_ex_create_method (
  193. u8 *aml_start,
  194. u32 aml_length,
  195. struct acpi_walk_state *walk_state);
  196. /*
  197. * exconfig - dynamic table load/unload
  198. */
  199. acpi_status
  200. acpi_ex_load_op (
  201. union acpi_operand_object *obj_desc,
  202. union acpi_operand_object *target,
  203. struct acpi_walk_state *walk_state);
  204. acpi_status
  205. acpi_ex_load_table_op (
  206. struct acpi_walk_state *walk_state,
  207. union acpi_operand_object **return_desc);
  208. acpi_status
  209. acpi_ex_unload_table (
  210. union acpi_operand_object *ddb_handle);
  211. /*
  212. * exmutex - mutex support
  213. */
  214. acpi_status
  215. acpi_ex_acquire_mutex (
  216. union acpi_operand_object *time_desc,
  217. union acpi_operand_object *obj_desc,
  218. struct acpi_walk_state *walk_state);
  219. acpi_status
  220. acpi_ex_release_mutex (
  221. union acpi_operand_object *obj_desc,
  222. struct acpi_walk_state *walk_state);
  223. void
  224. acpi_ex_release_all_mutexes (
  225. struct acpi_thread_state *thread);
  226. void
  227. acpi_ex_unlink_mutex (
  228. union acpi_operand_object *obj_desc);
  229. /*
  230. * exprep - ACPI AML execution - prep utilities
  231. */
  232. acpi_status
  233. acpi_ex_prep_common_field_object (
  234. union acpi_operand_object *obj_desc,
  235. u8 field_flags,
  236. u8 field_attribute,
  237. u32 field_bit_position,
  238. u32 field_bit_length);
  239. acpi_status
  240. acpi_ex_prep_field_value (
  241. struct acpi_create_field_info *info);
  242. /*
  243. * exsystem - Interface to OS services
  244. */
  245. acpi_status
  246. acpi_ex_system_do_notify_op (
  247. union acpi_operand_object *value,
  248. union acpi_operand_object *obj_desc);
  249. acpi_status
  250. acpi_ex_system_do_suspend(
  251. acpi_integer time);
  252. acpi_status
  253. acpi_ex_system_do_stall (
  254. u32 time);
  255. acpi_status
  256. acpi_ex_system_acquire_mutex(
  257. union acpi_operand_object *time,
  258. union acpi_operand_object *obj_desc);
  259. acpi_status
  260. acpi_ex_system_release_mutex(
  261. union acpi_operand_object *obj_desc);
  262. acpi_status
  263. acpi_ex_system_signal_event(
  264. union acpi_operand_object *obj_desc);
  265. acpi_status
  266. acpi_ex_system_wait_event(
  267. union acpi_operand_object *time,
  268. union acpi_operand_object *obj_desc);
  269. acpi_status
  270. acpi_ex_system_reset_event(
  271. union acpi_operand_object *obj_desc);
  272. acpi_status
  273. acpi_ex_system_wait_semaphore (
  274. acpi_handle semaphore,
  275. u16 timeout);
  276. /*
  277. * exoparg1 - ACPI AML execution, 1 operand
  278. */
  279. acpi_status
  280. acpi_ex_opcode_0A_0T_1R (
  281. struct acpi_walk_state *walk_state);
  282. acpi_status
  283. acpi_ex_opcode_1A_0T_0R (
  284. struct acpi_walk_state *walk_state);
  285. acpi_status
  286. acpi_ex_opcode_1A_0T_1R (
  287. struct acpi_walk_state *walk_state);
  288. acpi_status
  289. acpi_ex_opcode_1A_1T_1R (
  290. struct acpi_walk_state *walk_state);
  291. acpi_status
  292. acpi_ex_opcode_1A_1T_0R (
  293. struct acpi_walk_state *walk_state);
  294. /*
  295. * exoparg2 - ACPI AML execution, 2 operands
  296. */
  297. acpi_status
  298. acpi_ex_opcode_2A_0T_0R (
  299. struct acpi_walk_state *walk_state);
  300. acpi_status
  301. acpi_ex_opcode_2A_0T_1R (
  302. struct acpi_walk_state *walk_state);
  303. acpi_status
  304. acpi_ex_opcode_2A_1T_1R (
  305. struct acpi_walk_state *walk_state);
  306. acpi_status
  307. acpi_ex_opcode_2A_2T_1R (
  308. struct acpi_walk_state *walk_state);
  309. /*
  310. * exoparg3 - ACPI AML execution, 3 operands
  311. */
  312. acpi_status
  313. acpi_ex_opcode_3A_0T_0R (
  314. struct acpi_walk_state *walk_state);
  315. acpi_status
  316. acpi_ex_opcode_3A_1T_1R (
  317. struct acpi_walk_state *walk_state);
  318. /*
  319. * exoparg6 - ACPI AML execution, 6 operands
  320. */
  321. acpi_status
  322. acpi_ex_opcode_6A_0T_1R (
  323. struct acpi_walk_state *walk_state);
  324. /*
  325. * exresolv - Object resolution and get value functions
  326. */
  327. acpi_status
  328. acpi_ex_resolve_to_value (
  329. union acpi_operand_object **stack_ptr,
  330. struct acpi_walk_state *walk_state);
  331. acpi_status
  332. acpi_ex_resolve_multiple (
  333. struct acpi_walk_state *walk_state,
  334. union acpi_operand_object *operand,
  335. acpi_object_type *return_type,
  336. union acpi_operand_object **return_desc);
  337. /*
  338. * exresnte - resolve namespace node
  339. */
  340. acpi_status
  341. acpi_ex_resolve_node_to_value (
  342. struct acpi_namespace_node **stack_ptr,
  343. struct acpi_walk_state *walk_state);
  344. /*
  345. * exresop - resolve operand to value
  346. */
  347. acpi_status
  348. acpi_ex_resolve_operands (
  349. u16 opcode,
  350. union acpi_operand_object **stack_ptr,
  351. struct acpi_walk_state *walk_state);
  352. /*
  353. * exdump - Interpreter debug output routines
  354. */
  355. void
  356. acpi_ex_dump_operand (
  357. union acpi_operand_object *obj_desc,
  358. u32 depth);
  359. void
  360. acpi_ex_dump_operands (
  361. union acpi_operand_object **operands,
  362. acpi_interpreter_mode interpreter_mode,
  363. char *ident,
  364. u32 num_levels,
  365. char *note,
  366. char *module_name,
  367. u32 line_number);
  368. #ifdef ACPI_FUTURE_USAGE
  369. void
  370. acpi_ex_dump_object_descriptor (
  371. union acpi_operand_object *object,
  372. u32 flags);
  373. void
  374. acpi_ex_dump_node (
  375. struct acpi_namespace_node *node,
  376. u32 flags);
  377. #endif /* ACPI_FUTURE_USAGE */
  378. /*
  379. * exnames - AML namestring support
  380. */
  381. acpi_status
  382. acpi_ex_get_name_string (
  383. acpi_object_type data_type,
  384. u8 *in_aml_address,
  385. char **out_name_string,
  386. u32 *out_name_length);
  387. /*
  388. * exstore - Object store support
  389. */
  390. acpi_status
  391. acpi_ex_store (
  392. union acpi_operand_object *val_desc,
  393. union acpi_operand_object *dest_desc,
  394. struct acpi_walk_state *walk_state);
  395. acpi_status
  396. acpi_ex_store_object_to_node (
  397. union acpi_operand_object *source_desc,
  398. struct acpi_namespace_node *node,
  399. struct acpi_walk_state *walk_state,
  400. u8 implicit_conversion);
  401. #define ACPI_IMPLICIT_CONVERSION TRUE
  402. #define ACPI_NO_IMPLICIT_CONVERSION FALSE
  403. /*
  404. * exstoren - resolve/store object
  405. */
  406. acpi_status
  407. acpi_ex_resolve_object (
  408. union acpi_operand_object **source_desc_ptr,
  409. acpi_object_type target_type,
  410. struct acpi_walk_state *walk_state);
  411. acpi_status
  412. acpi_ex_store_object_to_object (
  413. union acpi_operand_object *source_desc,
  414. union acpi_operand_object *dest_desc,
  415. union acpi_operand_object **new_desc,
  416. struct acpi_walk_state *walk_state);
  417. /*
  418. * exstorob - store object - buffer/string
  419. */
  420. acpi_status
  421. acpi_ex_store_buffer_to_buffer (
  422. union acpi_operand_object *source_desc,
  423. union acpi_operand_object *target_desc);
  424. acpi_status
  425. acpi_ex_store_string_to_string (
  426. union acpi_operand_object *source_desc,
  427. union acpi_operand_object *target_desc);
  428. /*
  429. * excopy - object copy
  430. */
  431. acpi_status
  432. acpi_ex_copy_integer_to_index_field (
  433. union acpi_operand_object *source_desc,
  434. union acpi_operand_object *target_desc);
  435. acpi_status
  436. acpi_ex_copy_integer_to_bank_field (
  437. union acpi_operand_object *source_desc,
  438. union acpi_operand_object *target_desc);
  439. acpi_status
  440. acpi_ex_copy_data_to_named_field (
  441. union acpi_operand_object *source_desc,
  442. struct acpi_namespace_node *node);
  443. acpi_status
  444. acpi_ex_copy_integer_to_buffer_field (
  445. union acpi_operand_object *source_desc,
  446. union acpi_operand_object *target_desc);
  447. /*
  448. * exutils - interpreter/scanner utilities
  449. */
  450. acpi_status
  451. acpi_ex_enter_interpreter (
  452. void);
  453. void
  454. acpi_ex_exit_interpreter (
  455. void);
  456. void
  457. acpi_ex_truncate_for32bit_table (
  458. union acpi_operand_object *obj_desc);
  459. u8
  460. acpi_ex_acquire_global_lock (
  461. u32 rule);
  462. void
  463. acpi_ex_release_global_lock (
  464. u8 locked);
  465. void
  466. acpi_ex_eisa_id_to_string (
  467. u32 numeric_id,
  468. char *out_string);
  469. void
  470. acpi_ex_unsigned_integer_to_string (
  471. acpi_integer value,
  472. char *out_string);
  473. /*
  474. * exregion - default op_region handlers
  475. */
  476. acpi_status
  477. acpi_ex_system_memory_space_handler (
  478. u32 function,
  479. acpi_physical_address address,
  480. u32 bit_width,
  481. acpi_integer *value,
  482. void *handler_context,
  483. void *region_context);
  484. acpi_status
  485. acpi_ex_system_io_space_handler (
  486. u32 function,
  487. acpi_physical_address address,
  488. u32 bit_width,
  489. acpi_integer *value,
  490. void *handler_context,
  491. void *region_context);
  492. acpi_status
  493. acpi_ex_pci_config_space_handler (
  494. u32 function,
  495. acpi_physical_address address,
  496. u32 bit_width,
  497. acpi_integer *value,
  498. void *handler_context,
  499. void *region_context);
  500. acpi_status
  501. acpi_ex_cmos_space_handler (
  502. u32 function,
  503. acpi_physical_address address,
  504. u32 bit_width,
  505. acpi_integer *value,
  506. void *handler_context,
  507. void *region_context);
  508. acpi_status
  509. acpi_ex_pci_bar_space_handler (
  510. u32 function,
  511. acpi_physical_address address,
  512. u32 bit_width,
  513. acpi_integer *value,
  514. void *handler_context,
  515. void *region_context);
  516. acpi_status
  517. acpi_ex_embedded_controller_space_handler (
  518. u32 function,
  519. acpi_physical_address address,
  520. u32 bit_width,
  521. acpi_integer *value,
  522. void *handler_context,
  523. void *region_context);
  524. acpi_status
  525. acpi_ex_sm_bus_space_handler (
  526. u32 function,
  527. acpi_physical_address address,
  528. u32 bit_width,
  529. acpi_integer *value,
  530. void *handler_context,
  531. void *region_context);
  532. acpi_status
  533. acpi_ex_data_table_space_handler (
  534. u32 function,
  535. acpi_physical_address address,
  536. u32 bit_width,
  537. acpi_integer *value,
  538. void *handler_context,
  539. void *region_context);
  540. #endif /* __INTERP_H__ */