at v2.6.13 8.3 kB view raw
1/****************************************************************************** 2 * 3 * Module Name: acparser.h - AML Parser subcomponent prototypes and defines 4 * 5 *****************************************************************************/ 6 7/* 8 * Copyright (C) 2000 - 2005, R. Byron Moore 9 * All rights reserved. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions, and the following disclaimer, 16 * without modification. 17 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18 * substantially similar to the "NO WARRANTY" disclaimer below 19 * ("Disclaimer") and any redistribution must be conditioned upon 20 * including a substantially similar Disclaimer requirement for further 21 * binary redistribution. 22 * 3. Neither the names of the above-listed copyright holders nor the names 23 * of any contributors may be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * Alternatively, this software may be distributed under the terms of the 27 * GNU General Public License ("GPL") version 2 as published by the Free 28 * Software Foundation. 29 * 30 * NO WARRANTY 31 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41 * POSSIBILITY OF SUCH DAMAGES. 42 */ 43 44 45#ifndef __ACPARSER_H__ 46#define __ACPARSER_H__ 47 48 49#define OP_HAS_RETURN_VALUE 1 50 51/* variable # arguments */ 52 53#define ACPI_VAR_ARGS ACPI_UINT32_MAX 54 55 56#define ACPI_PARSE_DELETE_TREE 0x0001 57#define ACPI_PARSE_NO_TREE_DELETE 0x0000 58#define ACPI_PARSE_TREE_MASK 0x0001 59 60#define ACPI_PARSE_LOAD_PASS1 0x0010 61#define ACPI_PARSE_LOAD_PASS2 0x0020 62#define ACPI_PARSE_EXECUTE 0x0030 63#define ACPI_PARSE_MODE_MASK 0x0030 64 65#define ACPI_PARSE_DEFERRED_OP 0x0100 66 67 68/****************************************************************************** 69 * 70 * Parser interfaces 71 * 72 *****************************************************************************/ 73 74 75/* 76 * psxface - Parser external interfaces 77 */ 78acpi_status 79acpi_psx_load_table ( 80 u8 *pcode_addr, 81 u32 pcode_length); 82 83acpi_status 84acpi_psx_execute ( 85 struct acpi_parameter_info *info); 86 87 88/* 89 * psargs - Parse AML opcode arguments 90 */ 91u8 * 92acpi_ps_get_next_package_end ( 93 struct acpi_parse_state *parser_state); 94 95char * 96acpi_ps_get_next_namestring ( 97 struct acpi_parse_state *parser_state); 98 99void 100acpi_ps_get_next_simple_arg ( 101 struct acpi_parse_state *parser_state, 102 u32 arg_type, 103 union acpi_parse_object *arg); 104 105acpi_status 106acpi_ps_get_next_namepath ( 107 struct acpi_walk_state *walk_state, 108 struct acpi_parse_state *parser_state, 109 union acpi_parse_object *arg, 110 u8 method_call); 111 112acpi_status 113acpi_ps_get_next_arg ( 114 struct acpi_walk_state *walk_state, 115 struct acpi_parse_state *parser_state, 116 u32 arg_type, 117 union acpi_parse_object **return_arg); 118 119 120/* 121 * psfind 122 */ 123union acpi_parse_object * 124acpi_ps_find_name ( 125 union acpi_parse_object *scope, 126 u32 name, 127 u32 opcode); 128 129union acpi_parse_object* 130acpi_ps_get_parent ( 131 union acpi_parse_object *op); 132 133 134/* 135 * psopcode - AML Opcode information 136 */ 137const struct acpi_opcode_info * 138acpi_ps_get_opcode_info ( 139 u16 opcode); 140 141char * 142acpi_ps_get_opcode_name ( 143 u16 opcode); 144 145 146/* 147 * psparse - top level parsing routines 148 */ 149acpi_status 150acpi_ps_parse_aml ( 151 struct acpi_walk_state *walk_state); 152 153u32 154acpi_ps_get_opcode_size ( 155 u32 opcode); 156 157u16 158acpi_ps_peek_opcode ( 159 struct acpi_parse_state *state); 160 161 162/* 163 * psscope - Scope stack management routines 164 */ 165acpi_status 166acpi_ps_init_scope ( 167 struct acpi_parse_state *parser_state, 168 union acpi_parse_object *root); 169 170union acpi_parse_object * 171acpi_ps_get_parent_scope ( 172 struct acpi_parse_state *state); 173 174u8 175acpi_ps_has_completed_scope ( 176 struct acpi_parse_state *parser_state); 177 178void 179acpi_ps_pop_scope ( 180 struct acpi_parse_state *parser_state, 181 union acpi_parse_object **op, 182 u32 *arg_list, 183 u32 *arg_count); 184 185acpi_status 186acpi_ps_push_scope ( 187 struct acpi_parse_state *parser_state, 188 union acpi_parse_object *op, 189 u32 remaining_args, 190 u32 arg_count); 191 192void 193acpi_ps_cleanup_scope ( 194 struct acpi_parse_state *state); 195 196 197/* 198 * pstree - parse tree manipulation routines 199 */ 200void 201acpi_ps_append_arg( 202 union acpi_parse_object *op, 203 union acpi_parse_object *arg); 204 205union acpi_parse_object* 206acpi_ps_find ( 207 union acpi_parse_object *scope, 208 char *path, 209 u16 opcode, 210 u32 create); 211 212union acpi_parse_object * 213acpi_ps_get_arg( 214 union acpi_parse_object *op, 215 u32 argn); 216 217#ifdef ACPI_FUTURE_USAGE 218union acpi_parse_object * 219acpi_ps_get_depth_next ( 220 union acpi_parse_object *origin, 221 union acpi_parse_object *op); 222#endif /* ACPI_FUTURE_USAGE */ 223 224 225/* 226 * pswalk - parse tree walk routines 227 */ 228acpi_status 229acpi_ps_walk_parsed_aml ( 230 union acpi_parse_object *start_op, 231 union acpi_parse_object *end_op, 232 union acpi_operand_object *mth_desc, 233 struct acpi_namespace_node *start_node, 234 union acpi_operand_object **params, 235 union acpi_operand_object **caller_return_desc, 236 acpi_owner_id owner_id, 237 acpi_parse_downwards descending_callback, 238 acpi_parse_upwards ascending_callback); 239 240acpi_status 241acpi_ps_get_next_walk_op ( 242 struct acpi_walk_state *walk_state, 243 union acpi_parse_object *op, 244 acpi_parse_upwards ascending_callback); 245 246acpi_status 247acpi_ps_delete_completed_op ( 248 struct acpi_walk_state *walk_state); 249 250void 251acpi_ps_delete_parse_tree ( 252 union acpi_parse_object *root); 253 254 255/* 256 * psutils - parser utilities 257 */ 258union acpi_parse_object * 259acpi_ps_create_scope_op ( 260 void); 261 262void 263acpi_ps_init_op ( 264 union acpi_parse_object *op, 265 u16 opcode); 266 267union acpi_parse_object * 268acpi_ps_alloc_op ( 269 u16 opcode); 270 271void 272acpi_ps_free_op ( 273 union acpi_parse_object *op); 274 275u8 276acpi_ps_is_leading_char ( 277 u32 c); 278 279u8 280acpi_ps_is_prefix_char ( 281 u32 c); 282 283#ifdef ACPI_FUTURE_USAGE 284u32 285acpi_ps_get_name( 286 union acpi_parse_object *op); 287#endif /* ACPI_FUTURE_USAGE */ 288 289void 290acpi_ps_set_name( 291 union acpi_parse_object *op, 292 u32 name); 293 294#ifdef ACPI_ENABLE_OBJECT_CACHE 295void 296acpi_ps_delete_parse_cache ( 297 void); 298#endif 299 300 301/* 302 * psdump - display parser tree 303 */ 304u32 305acpi_ps_sprint_path ( 306 char *buffer_start, 307 u32 buffer_size, 308 union acpi_parse_object *op); 309 310u32 311acpi_ps_sprint_op ( 312 char *buffer_start, 313 u32 buffer_size, 314 union acpi_parse_object *op); 315 316void 317acpi_ps_show ( 318 union acpi_parse_object *op); 319 320 321#endif /* __ACPARSER_H__ */