acinterp.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:16k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /******************************************************************************
  2.  *
  3.  * Name: acinterp.h - Interpreter subcomponent prototypes and defines
  4.  *       $Revision: 116 $
  5.  *
  6.  *****************************************************************************/
  7. /*
  8.  *  Copyright (C) 2000, 2001 R. Byron Moore
  9.  *
  10.  *  This program is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2 of the License, or
  13.  *  (at your option) any later version.
  14.  *
  15.  *  This program is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with this program; if not, write to the Free Software
  22.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  23.  */
  24. #ifndef __ACINTERP_H__
  25. #define __ACINTERP_H__
  26. #define WALK_OPERANDS       &(walk_state->operands [walk_state->num_operands -1])
  27. /* Interpreter constants */
  28. #define AML_END_OF_BLOCK            -1
  29. #define PUSH_PKG_LENGTH             1
  30. #define DO_NOT_PUSH_PKG_LENGTH      0
  31. #define STACK_TOP                   0
  32. #define STACK_BOTTOM                (u32) -1
  33. /* Constants for global "When_to_parse_methods" */
  34. #define METHOD_PARSE_AT_INIT        0x0
  35. #define METHOD_PARSE_JUST_IN_TIME   0x1
  36. #define METHOD_DELETE_AT_COMPLETION 0x2
  37. acpi_status
  38. acpi_ex_resolve_operands (
  39. u16                     opcode,
  40. acpi_operand_object     **stack_ptr,
  41. acpi_walk_state         *walk_state);
  42. /*
  43.  * amxface - External interpreter interfaces
  44.  */
  45. acpi_status
  46. acpi_ex_load_table (
  47. acpi_table_type         table_id);
  48. acpi_status
  49. acpi_ex_execute_method (
  50. acpi_namespace_node     *method_node,
  51. acpi_operand_object     **params,
  52. acpi_operand_object     **return_obj_desc);
  53. /*
  54.  * amconvrt - object conversion
  55.  */
  56. acpi_status
  57. acpi_ex_convert_to_integer (
  58. acpi_operand_object     *obj_desc,
  59. acpi_operand_object     **result_desc,
  60. acpi_walk_state         *walk_state);
  61. acpi_status
  62. acpi_ex_convert_to_buffer (
  63. acpi_operand_object     *obj_desc,
  64. acpi_operand_object     **result_desc,
  65. acpi_walk_state         *walk_state);
  66. acpi_status
  67. acpi_ex_convert_to_string (
  68. acpi_operand_object     *obj_desc,
  69. acpi_operand_object     **result_desc,
  70. u32                     base,
  71. u32                     max_length,
  72. acpi_walk_state         *walk_state);
  73. acpi_status
  74. acpi_ex_convert_to_target_type (
  75. acpi_object_type8       destination_type,
  76. acpi_operand_object     **obj_desc,
  77. acpi_walk_state         *walk_state);
  78. /*
  79.  * amfield - ACPI AML (p-code) execution - field manipulation
  80.  */
  81. acpi_status
  82. acpi_ex_extract_from_field (
  83. acpi_operand_object     *obj_desc,
  84. void                    *buffer,
  85. u32                     buffer_length);
  86. acpi_status
  87. acpi_ex_insert_into_field (
  88. acpi_operand_object     *obj_desc,
  89. void                    *buffer,
  90. u32                     buffer_length);
  91. acpi_status
  92. acpi_ex_setup_field (
  93. acpi_operand_object     *obj_desc,
  94. u32                     field_byte_offset);
  95. acpi_status
  96. acpi_ex_read_field_datum (
  97. acpi_operand_object     *obj_desc,
  98. u32                     field_byte_offset,
  99. u32                     *value);
  100. acpi_status
  101. acpi_ex_common_access_field (
  102. u32                     mode,
  103. acpi_operand_object     *obj_desc,
  104. void                    *buffer,
  105. u32                     buffer_length);
  106. acpi_status
  107. acpi_ex_access_index_field (
  108. u32                     mode,
  109. acpi_operand_object     *obj_desc,
  110. void                    *buffer,
  111. u32                     buffer_length);
  112. acpi_status
  113. acpi_ex_access_bank_field (
  114. u32                     mode,
  115. acpi_operand_object     *obj_desc,
  116. void                    *buffer,
  117. u32                     buffer_length);
  118. acpi_status
  119. acpi_ex_access_region_field (
  120. u32                     mode,
  121. acpi_operand_object     *obj_desc,
  122. void                    *buffer,
  123. u32                     buffer_length);
  124. acpi_status
  125. acpi_ex_access_buffer_field (
  126. u32                     mode,
  127. acpi_operand_object     *obj_desc,
  128. void                    *buffer,
  129. u32                     buffer_length);
  130. acpi_status
  131. acpi_ex_read_data_from_field (
  132. acpi_operand_object     *obj_desc,
  133. acpi_operand_object     **ret_buffer_desc);
  134. acpi_status
  135. acpi_ex_write_data_to_field (
  136. acpi_operand_object     *source_desc,
  137. acpi_operand_object     *obj_desc);
  138. /*
  139.  * ammisc - ACPI AML (p-code) execution - specific opcodes
  140.  */
  141. acpi_status
  142. acpi_ex_opcode_3A_0T_0R (
  143. acpi_walk_state         *walk_state);
  144. acpi_status
  145. acpi_ex_opcode_3A_1T_1R (
  146. acpi_walk_state         *walk_state);
  147. acpi_status
  148. acpi_ex_opcode_6A_0T_1R (
  149. acpi_walk_state         *walk_state);
  150. acpi_status
  151. acpi_ex_get_object_reference (
  152. acpi_operand_object     *obj_desc,
  153. acpi_operand_object     **return_desc,
  154. acpi_walk_state         *walk_state);
  155. acpi_status
  156. acpi_ex_do_concatenate (
  157. acpi_operand_object     *obj_desc,
  158. acpi_operand_object     *obj_desc2,
  159. acpi_operand_object     **actual_return_desc,
  160. acpi_walk_state         *walk_state);
  161. u8
  162. acpi_ex_do_logical_op (
  163. u16                     opcode,
  164. acpi_integer            operand0,
  165. acpi_integer            operand1);
  166. acpi_integer
  167. acpi_ex_do_math_op (
  168. u16                     opcode,
  169. acpi_integer            operand0,
  170. acpi_integer            operand1);
  171. acpi_status
  172. acpi_ex_load_op (
  173. acpi_operand_object     *rgn_desc,
  174. acpi_operand_object     *ddb_handle);
  175. acpi_status
  176. acpi_ex_unload_table (
  177. acpi_operand_object     *ddb_handle);
  178. acpi_status
  179. acpi_ex_create_mutex (
  180. acpi_walk_state         *walk_state);
  181. acpi_status
  182. acpi_ex_create_processor (
  183. acpi_walk_state         *walk_state);
  184. acpi_status
  185. acpi_ex_create_power_resource (
  186. acpi_walk_state         *walk_state);
  187. acpi_status
  188. acpi_ex_create_region (
  189. u8                      *aml_start,
  190. u32                     aml_length,
  191. u8                      region_space,
  192. acpi_walk_state         *walk_state);
  193. acpi_status
  194. acpi_ex_create_table_region (
  195. acpi_walk_state         *walk_state);
  196. acpi_status
  197. acpi_ex_create_event (
  198. acpi_walk_state         *walk_state);
  199. acpi_status
  200. acpi_ex_create_alias (
  201. acpi_walk_state         *walk_state);
  202. acpi_status
  203. acpi_ex_create_method (
  204. u8                      *aml_start,
  205. u32                     aml_length,
  206. acpi_walk_state         *walk_state);
  207. /*
  208.  * ammutex - mutex support
  209.  */
  210. acpi_status
  211. acpi_ex_acquire_mutex (
  212. acpi_operand_object     *time_desc,
  213. acpi_operand_object     *obj_desc,
  214. acpi_walk_state         *walk_state);
  215. acpi_status
  216. acpi_ex_release_mutex (
  217. acpi_operand_object     *obj_desc,
  218. acpi_walk_state         *walk_state);
  219. acpi_status
  220. acpi_ex_release_all_mutexes (
  221. acpi_operand_object     *mutex_list);
  222. void
  223. acpi_ex_unlink_mutex (
  224. acpi_operand_object     *obj_desc);
  225. /*
  226.  * amprep - ACPI AML (p-code) execution - prep utilities
  227.  */
  228. acpi_status
  229. acpi_ex_prep_common_field_object (
  230. acpi_operand_object     *obj_desc,
  231. u8                      field_flags,
  232. u32                     field_position,
  233. u32                     field_length);
  234. acpi_status
  235. acpi_ex_prep_region_field_value (
  236. acpi_namespace_node     *node,
  237. acpi_handle             region,
  238. u8                      field_flags,
  239. u32                     field_position,
  240. u32                     field_length);
  241. acpi_status
  242. acpi_ex_prep_bank_field_value (
  243. acpi_namespace_node     *node,
  244. acpi_namespace_node     *region_node,
  245. acpi_namespace_node     *bank_register_node,
  246. u32                     bank_val,
  247. u8                      field_flags,
  248. u32                     field_position,
  249. u32                     field_length);
  250. acpi_status
  251. acpi_ex_prep_index_field_value (
  252. acpi_namespace_node     *node,
  253. acpi_namespace_node     *index_reg,
  254. acpi_namespace_node     *data_reg,
  255. u8                      field_flags,
  256. u32                     field_position,
  257. u32                     field_length);
  258. acpi_status
  259. acpi_ex_prep_field_value (
  260. ACPI_CREATE_FIELD_INFO  *info);
  261. /*
  262.  * amsystem - Interface to OS services
  263.  */
  264. acpi_status
  265. acpi_ex_system_do_notify_op (
  266. acpi_operand_object     *value,
  267. acpi_operand_object     *obj_desc);
  268. void
  269. acpi_ex_system_do_suspend(
  270. u32                     time);
  271. void
  272. acpi_ex_system_do_stall (
  273. u32                     time);
  274. acpi_status
  275. acpi_ex_system_acquire_mutex(
  276. acpi_operand_object     *time,
  277. acpi_operand_object     *obj_desc);
  278. acpi_status
  279. acpi_ex_system_release_mutex(
  280. acpi_operand_object     *obj_desc);
  281. acpi_status
  282. acpi_ex_system_signal_event(
  283. acpi_operand_object     *obj_desc);
  284. acpi_status
  285. acpi_ex_system_wait_event(
  286. acpi_operand_object     *time,
  287. acpi_operand_object     *obj_desc);
  288. acpi_status
  289. acpi_ex_system_reset_event(
  290. acpi_operand_object     *obj_desc);
  291. acpi_status
  292. acpi_ex_system_wait_semaphore (
  293. acpi_handle             semaphore,
  294. u32                     timeout);
  295. /*
  296.  * ammonadic - ACPI AML (p-code) execution, monadic operators
  297.  */
  298. acpi_status
  299. acpi_ex_opcode_1A_0T_0R (
  300. acpi_walk_state         *walk_state);
  301. acpi_status
  302. acpi_ex_opcode_1A_0T_1R (
  303. acpi_walk_state         *walk_state);
  304. acpi_status
  305. acpi_ex_opcode_1A_1T_1R (
  306. acpi_walk_state         *walk_state);
  307. acpi_status
  308. acpi_ex_opcode_1A_1T_0R (
  309. acpi_walk_state         *walk_state);
  310. /*
  311.  * amdyadic - ACPI AML (p-code) execution, dyadic operators
  312.  */
  313. acpi_status
  314. acpi_ex_opcode_2A_0T_0R (
  315. acpi_walk_state         *walk_state);
  316. acpi_status
  317. acpi_ex_opcode_2A_0T_1R (
  318. acpi_walk_state         *walk_state);
  319. acpi_status
  320. acpi_ex_opcode_2A_1T_1R (
  321. acpi_walk_state         *walk_state);
  322. acpi_status
  323. acpi_ex_opcode_2A_2T_1R (
  324. acpi_walk_state         *walk_state);
  325. /*
  326.  * amresolv  - Object resolution and get value functions
  327.  */
  328. acpi_status
  329. acpi_ex_resolve_to_value (
  330. acpi_operand_object     **stack_ptr,
  331. acpi_walk_state         *walk_state);
  332. acpi_status
  333. acpi_ex_resolve_node_to_value (
  334. acpi_namespace_node     **stack_ptr,
  335. acpi_walk_state         *walk_state);
  336. acpi_status
  337. acpi_ex_resolve_object_to_value (
  338. acpi_operand_object     **stack_ptr,
  339. acpi_walk_state         *walk_state);
  340. acpi_status
  341. acpi_ex_get_buffer_field_value (
  342. acpi_operand_object     *field_desc,
  343. acpi_operand_object     *result_desc);
  344. /*
  345.  * amdump - Scanner debug output routines
  346.  */
  347. void
  348. acpi_ex_show_hex_value (
  349. u32                     byte_count,
  350. u8                      *aml_start,
  351. u32                     lead_space);
  352. acpi_status
  353. acpi_ex_dump_operand (
  354. acpi_operand_object     *entry_desc);
  355. void
  356. acpi_ex_dump_operands (
  357. acpi_operand_object     **operands,
  358. operating_mode          interpreter_mode,
  359. NATIVE_CHAR             *ident,
  360. u32                     num_levels,
  361. NATIVE_CHAR             *note,
  362. NATIVE_CHAR             *module_name,
  363. u32                     line_number);
  364. void
  365. acpi_ex_dump_object_descriptor (
  366. acpi_operand_object     *object,
  367. u32                     flags);
  368. void
  369. acpi_ex_dump_node (
  370. acpi_namespace_node     *node,
  371. u32                     flags);
  372. /*
  373.  * amnames - interpreter/scanner name load/execute
  374.  */
  375. NATIVE_CHAR *
  376. acpi_ex_allocate_name_string (
  377. u32                     prefix_count,
  378. u32                     num_name_segs);
  379. u32
  380. acpi_ex_good_char (
  381. u32                     character);
  382. acpi_status
  383. acpi_ex_name_segment (
  384. u8                      **in_aml_address,
  385. NATIVE_CHAR             *name_string);
  386. acpi_status
  387. acpi_ex_get_name_string (
  388. acpi_object_type8       data_type,
  389. u8                      *in_aml_address,
  390. NATIVE_CHAR             **out_name_string,
  391. u32                     *out_name_length);
  392. acpi_status
  393. acpi_ex_do_name (
  394. acpi_object_type        data_type,
  395. operating_mode          load_exec_mode);
  396. /*
  397.  * amstore - Object store support
  398.  */
  399. acpi_status
  400. acpi_ex_store (
  401. acpi_operand_object     *val_desc,
  402. acpi_operand_object     *dest_desc,
  403. acpi_walk_state         *walk_state);
  404. acpi_status
  405. acpi_ex_store_object_to_index (
  406. acpi_operand_object     *val_desc,
  407. acpi_operand_object     *dest_desc,
  408. acpi_walk_state         *walk_state);
  409. acpi_status
  410. acpi_ex_store_object_to_node (
  411. acpi_operand_object     *source_desc,
  412. acpi_namespace_node     *node,
  413. acpi_walk_state         *walk_state);
  414. acpi_status
  415. acpi_ex_store_object_to_object (
  416. acpi_operand_object     *source_desc,
  417. acpi_operand_object     *dest_desc,
  418. acpi_walk_state         *walk_state);
  419. /*
  420.  *
  421.  */
  422. acpi_status
  423. acpi_ex_resolve_object (
  424. acpi_operand_object     **source_desc_ptr,
  425. acpi_object_type8       target_type,
  426. acpi_walk_state         *walk_state);
  427. acpi_status
  428. acpi_ex_store_object (
  429. acpi_operand_object     *source_desc,
  430. acpi_object_type8       target_type,
  431. acpi_operand_object     **target_desc_ptr,
  432. acpi_walk_state         *walk_state);
  433. /*
  434.  * amcopy - object copy
  435.  */
  436. acpi_status
  437. acpi_ex_copy_buffer_to_buffer (
  438. acpi_operand_object     *source_desc,
  439. acpi_operand_object     *target_desc);
  440. acpi_status
  441. acpi_ex_copy_string_to_string (
  442. acpi_operand_object     *source_desc,
  443. acpi_operand_object     *target_desc);
  444. acpi_status
  445. acpi_ex_copy_integer_to_index_field (
  446. acpi_operand_object     *source_desc,
  447. acpi_operand_object     *target_desc);
  448. acpi_status
  449. acpi_ex_copy_integer_to_bank_field (
  450. acpi_operand_object     *source_desc,
  451. acpi_operand_object     *target_desc);
  452. acpi_status
  453. acpi_ex_copy_data_to_named_field (
  454. acpi_operand_object     *source_desc,
  455. acpi_namespace_node     *node);
  456. acpi_status
  457. acpi_ex_copy_integer_to_buffer_field (
  458. acpi_operand_object     *source_desc,
  459. acpi_operand_object     *target_desc);
  460. /*
  461.  * amutils - interpreter/scanner utilities
  462.  */
  463. acpi_status
  464. acpi_ex_enter_interpreter (
  465. void);
  466. void
  467. acpi_ex_exit_interpreter (
  468. void);
  469. void
  470. acpi_ex_truncate_for32bit_table (
  471. acpi_operand_object     *obj_desc,
  472. acpi_walk_state         *walk_state);
  473. u8
  474. acpi_ex_validate_object_type (
  475. acpi_object_type        type);
  476. u8
  477. acpi_ex_acquire_global_lock (
  478. u32                     rule);
  479. acpi_status
  480. acpi_ex_release_global_lock (
  481. u8                      locked);
  482. u32
  483. acpi_ex_digits_needed (
  484. acpi_integer            value,
  485. u32                     base);
  486. acpi_status
  487. acpi_ex_eisa_id_to_string (
  488. u32                     numeric_id,
  489. NATIVE_CHAR             *out_string);
  490. acpi_status
  491. acpi_ex_unsigned_integer_to_string (
  492. acpi_integer            value,
  493. NATIVE_CHAR             *out_string);
  494. /*
  495.  * amregion - default Op_region handlers
  496.  */
  497. acpi_status
  498. acpi_ex_system_memory_space_handler (
  499. u32                     function,
  500. ACPI_PHYSICAL_ADDRESS   address,
  501. u32                     bit_width,
  502. u32                     *value,
  503. void                    *handler_context,
  504. void                    *region_context);
  505. acpi_status
  506. acpi_ex_system_io_space_handler (
  507. u32                     function,
  508. ACPI_PHYSICAL_ADDRESS   address,
  509. u32                     bit_width,
  510. u32                     *value,
  511. void                    *handler_context,
  512. void                    *region_context);
  513. acpi_status
  514. acpi_ex_pci_config_space_handler (
  515. u32                     function,
  516. ACPI_PHYSICAL_ADDRESS   address,
  517. u32                     bit_width,
  518. u32                     *value,
  519. void                    *handler_context,
  520. void                    *region_context);
  521. acpi_status
  522. acpi_ex_cmos_space_handler (
  523. u32                     function,
  524. ACPI_PHYSICAL_ADDRESS   address,
  525. u32                     bit_width,
  526. u32                     *value,
  527. void                    *handler_context,
  528. void                    *region_context);
  529. acpi_status
  530. acpi_ex_pci_bar_space_handler (
  531. u32                     function,
  532. ACPI_PHYSICAL_ADDRESS   address,
  533. u32                     bit_width,
  534. u32                     *value,
  535. void                    *handler_context,
  536. void                    *region_context);
  537. acpi_status
  538. acpi_ex_embedded_controller_space_handler (
  539. u32                     function,
  540. ACPI_PHYSICAL_ADDRESS   address,
  541. u32                     bit_width,
  542. u32                     *value,
  543. void                    *handler_context,
  544. void                    *region_context);
  545. acpi_status
  546. acpi_ex_sm_bus_space_handler (
  547. u32                     function,
  548. ACPI_PHYSICAL_ADDRESS   address,
  549. u32                     bit_width,
  550. u32                     *value,
  551. void                    *handler_context,
  552. void                    *region_context);
  553. #endif /* __INTERP_H__ */