acparser.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:7k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /******************************************************************************
  2.  *
  3.  * Module Name: acparser.h - AML Parser subcomponent prototypes and defines
  4.  *       $Revision: 54 $
  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 __ACPARSER_H__
  25. #define __ACPARSER_H__
  26. #define OP_HAS_RETURN_VALUE         1
  27. /* variable # arguments */
  28. #define ACPI_VAR_ARGS               ACPI_UINT32_MAX
  29. /* maximum virtual address */
  30. #define ACPI_MAX_AML                ((u8 *)(~0UL))
  31. #define ACPI_PARSE_DELETE_TREE          0x0001
  32. #define ACPI_PARSE_NO_TREE_DELETE       0x0000
  33. #define ACPI_PARSE_TREE_MASK            0x0001
  34. #define ACPI_PARSE_LOAD_PASS1           0x0010
  35. #define ACPI_PARSE_LOAD_PASS2           0x0020
  36. #define ACPI_PARSE_EXECUTE              0x0030
  37. #define ACPI_PARSE_MODE_MASK            0x0030
  38. /* psapi - Parser external interfaces */
  39. acpi_status
  40. acpi_psx_load_table (
  41. u8                      *pcode_addr,
  42. u32                     pcode_length);
  43. acpi_status
  44. acpi_psx_execute (
  45. acpi_namespace_node     *method_node,
  46. acpi_operand_object     **params,
  47. acpi_operand_object     **return_obj_desc);
  48. /******************************************************************************
  49.  *
  50.  * Parser interfaces
  51.  *
  52.  *****************************************************************************/
  53. /* psargs - Parse AML opcode arguments */
  54. u8 *
  55. acpi_ps_get_next_package_end (
  56. acpi_parse_state        *parser_state);
  57. u32
  58. acpi_ps_get_next_package_length (
  59. acpi_parse_state        *parser_state);
  60. NATIVE_CHAR *
  61. acpi_ps_get_next_namestring (
  62. acpi_parse_state        *parser_state);
  63. void
  64. acpi_ps_get_next_simple_arg (
  65. acpi_parse_state        *parser_state,
  66. u32                     arg_type,       /* type of argument */
  67. acpi_parse_object       *arg);           /* (OUT) argument data */
  68. void
  69. acpi_ps_get_next_namepath (
  70. acpi_parse_state        *parser_state,
  71. acpi_parse_object       *arg,
  72. u32                     *arg_count,
  73. u8                      method_call);
  74. acpi_parse_object *
  75. acpi_ps_get_next_field (
  76. acpi_parse_state        *parser_state);
  77. acpi_parse_object *
  78. acpi_ps_get_next_arg (
  79. acpi_parse_state        *parser_state,
  80. u32                     arg_type,
  81. u32                     *arg_count);
  82. /* psopcode - AML Opcode information */
  83. const acpi_opcode_info *
  84. acpi_ps_get_opcode_info (
  85. u16                     opcode);
  86. NATIVE_CHAR *
  87. acpi_ps_get_opcode_name (
  88. u16                     opcode);
  89. /* psparse - top level parsing routines */
  90. acpi_status
  91. acpi_ps_find_object (
  92. acpi_walk_state         *walk_state,
  93. acpi_parse_object       **out_op);
  94. void
  95. acpi_ps_delete_parse_tree (
  96. acpi_parse_object       *root);
  97. acpi_status
  98. acpi_ps_parse_loop (
  99. acpi_walk_state         *walk_state);
  100. acpi_status
  101. acpi_ps_parse_aml (
  102. acpi_walk_state         *walk_state);
  103. acpi_status
  104. acpi_ps_parse_table (
  105. u8                      *aml,
  106. u32                     aml_size,
  107. acpi_parse_downwards    descending_callback,
  108. acpi_parse_upwards      ascending_callback,
  109. acpi_parse_object       **root_object);
  110. u16
  111. acpi_ps_peek_opcode (
  112. acpi_parse_state        *state);
  113. /* psscope - Scope stack management routines */
  114. acpi_status
  115. acpi_ps_init_scope (
  116. acpi_parse_state        *parser_state,
  117. acpi_parse_object       *root);
  118. acpi_parse_object *
  119. acpi_ps_get_parent_scope (
  120. acpi_parse_state        *state);
  121. u8
  122. acpi_ps_has_completed_scope (
  123. acpi_parse_state        *parser_state);
  124. void
  125. acpi_ps_pop_scope (
  126. acpi_parse_state        *parser_state,
  127. acpi_parse_object       **op,
  128. u32                     *arg_list,
  129. u32                     *arg_count);
  130. acpi_status
  131. acpi_ps_push_scope (
  132. acpi_parse_state        *parser_state,
  133. acpi_parse_object       *op,
  134. u32                     remaining_args,
  135. u32                     arg_count);
  136. void
  137. acpi_ps_cleanup_scope (
  138. acpi_parse_state        *state);
  139. /* pstree - parse tree manipulation routines */
  140. void
  141. acpi_ps_append_arg(
  142. acpi_parse_object       *op,
  143. acpi_parse_object       *arg);
  144. acpi_parse_object*
  145. acpi_ps_find (
  146. acpi_parse_object       *scope,
  147. NATIVE_CHAR             *path,
  148. u16                     opcode,
  149. u32                     create);
  150. acpi_parse_object *
  151. acpi_ps_get_arg(
  152. acpi_parse_object       *op,
  153. u32                      argn);
  154. acpi_parse_object *
  155. acpi_ps_get_child (
  156. acpi_parse_object       *op);
  157. acpi_parse_object *
  158. acpi_ps_get_depth_next (
  159. acpi_parse_object       *origin,
  160. acpi_parse_object       *op);
  161. /* pswalk - parse tree walk routines */
  162. acpi_status
  163. acpi_ps_walk_parsed_aml (
  164. acpi_parse_object       *start_op,
  165. acpi_parse_object       *end_op,
  166. acpi_operand_object     *mth_desc,
  167. acpi_namespace_node     *start_node,
  168. acpi_operand_object     **params,
  169. acpi_operand_object     **caller_return_desc,
  170. acpi_owner_id           owner_id,
  171. acpi_parse_downwards    descending_callback,
  172. acpi_parse_upwards      ascending_callback);
  173. acpi_status
  174. acpi_ps_get_next_walk_op (
  175. acpi_walk_state         *walk_state,
  176. acpi_parse_object       *op,
  177. acpi_parse_upwards      ascending_callback);
  178. /* psutils - parser utilities */
  179. void
  180. acpi_ps_init_op (
  181. acpi_parse_object       *op,
  182. u16                     opcode);
  183. acpi_parse_object *
  184. acpi_ps_alloc_op (
  185. u16                     opcode);
  186. void
  187. acpi_ps_free_op (
  188. acpi_parse_object       *op);
  189. void
  190. acpi_ps_delete_parse_cache (
  191. void);
  192. u8
  193. acpi_ps_is_leading_char (
  194. u32                     c);
  195. u8
  196. acpi_ps_is_prefix_char (
  197. u32                     c);
  198. u32
  199. acpi_ps_get_name(
  200. acpi_parse_object       *op);
  201. void
  202. acpi_ps_set_name(
  203. acpi_parse_object       *op,
  204. u32                     name);
  205. /* psdump - display parser tree */
  206. u32
  207. acpi_ps_sprint_path (
  208. NATIVE_CHAR             *buffer_start,
  209. u32                     buffer_size,
  210. acpi_parse_object       *op);
  211. u32
  212. acpi_ps_sprint_op (
  213. NATIVE_CHAR             *buffer_start,
  214. u32                     buffer_size,
  215. acpi_parse_object       *op);
  216. void
  217. acpi_ps_show (
  218. acpi_parse_object       *op);
  219. #endif /* __ACPARSER_H__ */