acinterp.h 20 KB

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