Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame^] | 66 | #define ACPI_PARSE_DISASSEMBLE 0x0200 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 69 | /****************************************************************************** |
| 70 | * |
| 71 | * Parser interfaces |
| 72 | * |
| 73 | *****************************************************************************/ |
| 74 | |
| 75 | |
| 76 | /* |
| 77 | * psxface - Parser external interfaces |
| 78 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | acpi_status |
| 80 | acpi_psx_load_table ( |
| 81 | u8 *pcode_addr, |
| 82 | u32 pcode_length); |
| 83 | |
| 84 | acpi_status |
| 85 | acpi_psx_execute ( |
| 86 | struct acpi_parameter_info *info); |
| 87 | |
| 88 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 89 | /* |
| 90 | * psargs - Parse AML opcode arguments |
| 91 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 92 | u8 * |
| 93 | acpi_ps_get_next_package_end ( |
| 94 | struct acpi_parse_state *parser_state); |
| 95 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | char * |
| 97 | acpi_ps_get_next_namestring ( |
| 98 | struct acpi_parse_state *parser_state); |
| 99 | |
| 100 | void |
| 101 | acpi_ps_get_next_simple_arg ( |
| 102 | struct acpi_parse_state *parser_state, |
| 103 | u32 arg_type, |
| 104 | union acpi_parse_object *arg); |
| 105 | |
| 106 | acpi_status |
| 107 | acpi_ps_get_next_namepath ( |
| 108 | struct acpi_walk_state *walk_state, |
| 109 | struct acpi_parse_state *parser_state, |
| 110 | union acpi_parse_object *arg, |
| 111 | u8 method_call); |
| 112 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | acpi_status |
| 114 | acpi_ps_get_next_arg ( |
| 115 | struct acpi_walk_state *walk_state, |
| 116 | struct acpi_parse_state *parser_state, |
| 117 | u32 arg_type, |
| 118 | union acpi_parse_object **return_arg); |
| 119 | |
| 120 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 121 | /* |
| 122 | * psfind |
| 123 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | union acpi_parse_object * |
| 125 | acpi_ps_find_name ( |
| 126 | union acpi_parse_object *scope, |
| 127 | u32 name, |
| 128 | u32 opcode); |
| 129 | |
| 130 | union acpi_parse_object* |
| 131 | acpi_ps_get_parent ( |
| 132 | union acpi_parse_object *op); |
| 133 | |
| 134 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 135 | /* |
| 136 | * psopcode - AML Opcode information |
| 137 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | const struct acpi_opcode_info * |
| 139 | acpi_ps_get_opcode_info ( |
| 140 | u16 opcode); |
| 141 | |
| 142 | char * |
| 143 | acpi_ps_get_opcode_name ( |
| 144 | u16 opcode); |
| 145 | |
| 146 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 147 | /* |
| 148 | * psparse - top level parsing routines |
| 149 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | acpi_status |
| 151 | acpi_ps_parse_aml ( |
| 152 | struct acpi_walk_state *walk_state); |
| 153 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 154 | u32 |
| 155 | acpi_ps_get_opcode_size ( |
| 156 | u32 opcode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 157 | |
| 158 | u16 |
| 159 | acpi_ps_peek_opcode ( |
| 160 | struct acpi_parse_state *state); |
| 161 | |
Robert Moore | 73459f7 | 2005-06-24 00:00:00 -0400 | [diff] [blame^] | 162 | acpi_status |
| 163 | acpi_ps_complete_this_op ( |
| 164 | struct acpi_walk_state *walk_state, |
| 165 | union acpi_parse_object *op); |
| 166 | |
| 167 | acpi_status |
| 168 | acpi_ps_next_parse_state ( |
| 169 | struct acpi_walk_state *walk_state, |
| 170 | union acpi_parse_object *op, |
| 171 | acpi_status callback_status); |
| 172 | |
| 173 | |
| 174 | /* |
| 175 | * psloop - main parse loop |
| 176 | */ |
| 177 | acpi_status |
| 178 | acpi_ps_parse_loop ( |
| 179 | struct acpi_walk_state *walk_state); |
| 180 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 182 | /* |
| 183 | * psscope - Scope stack management routines |
| 184 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | acpi_status |
| 186 | acpi_ps_init_scope ( |
| 187 | struct acpi_parse_state *parser_state, |
| 188 | union acpi_parse_object *root); |
| 189 | |
| 190 | union acpi_parse_object * |
| 191 | acpi_ps_get_parent_scope ( |
| 192 | struct acpi_parse_state *state); |
| 193 | |
| 194 | u8 |
| 195 | acpi_ps_has_completed_scope ( |
| 196 | struct acpi_parse_state *parser_state); |
| 197 | |
| 198 | void |
| 199 | acpi_ps_pop_scope ( |
| 200 | struct acpi_parse_state *parser_state, |
| 201 | union acpi_parse_object **op, |
| 202 | u32 *arg_list, |
| 203 | u32 *arg_count); |
| 204 | |
| 205 | acpi_status |
| 206 | acpi_ps_push_scope ( |
| 207 | struct acpi_parse_state *parser_state, |
| 208 | union acpi_parse_object *op, |
| 209 | u32 remaining_args, |
| 210 | u32 arg_count); |
| 211 | |
| 212 | void |
| 213 | acpi_ps_cleanup_scope ( |
| 214 | struct acpi_parse_state *state); |
| 215 | |
| 216 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 217 | /* |
| 218 | * pstree - parse tree manipulation routines |
| 219 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | void |
| 221 | acpi_ps_append_arg( |
| 222 | union acpi_parse_object *op, |
| 223 | union acpi_parse_object *arg); |
| 224 | |
| 225 | union acpi_parse_object* |
| 226 | acpi_ps_find ( |
| 227 | union acpi_parse_object *scope, |
| 228 | char *path, |
| 229 | u16 opcode, |
| 230 | u32 create); |
| 231 | |
| 232 | union acpi_parse_object * |
| 233 | acpi_ps_get_arg( |
| 234 | union acpi_parse_object *op, |
| 235 | u32 argn); |
| 236 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 237 | #ifdef ACPI_FUTURE_USAGE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | union acpi_parse_object * |
| 239 | acpi_ps_get_depth_next ( |
| 240 | union acpi_parse_object *origin, |
| 241 | union acpi_parse_object *op); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 242 | #endif /* ACPI_FUTURE_USAGE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | |
| 244 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 245 | /* |
| 246 | * pswalk - parse tree walk routines |
| 247 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | acpi_status |
| 249 | acpi_ps_walk_parsed_aml ( |
| 250 | union acpi_parse_object *start_op, |
| 251 | union acpi_parse_object *end_op, |
| 252 | union acpi_operand_object *mth_desc, |
| 253 | struct acpi_namespace_node *start_node, |
| 254 | union acpi_operand_object **params, |
| 255 | union acpi_operand_object **caller_return_desc, |
| 256 | acpi_owner_id owner_id, |
| 257 | acpi_parse_downwards descending_callback, |
| 258 | acpi_parse_upwards ascending_callback); |
| 259 | |
| 260 | acpi_status |
| 261 | acpi_ps_get_next_walk_op ( |
| 262 | struct acpi_walk_state *walk_state, |
| 263 | union acpi_parse_object *op, |
| 264 | acpi_parse_upwards ascending_callback); |
| 265 | |
| 266 | acpi_status |
| 267 | acpi_ps_delete_completed_op ( |
| 268 | struct acpi_walk_state *walk_state); |
| 269 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 270 | void |
| 271 | acpi_ps_delete_parse_tree ( |
| 272 | union acpi_parse_object *root); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 273 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 274 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 275 | /* |
| 276 | * psutils - parser utilities |
| 277 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 278 | union acpi_parse_object * |
| 279 | acpi_ps_create_scope_op ( |
| 280 | void); |
| 281 | |
| 282 | void |
| 283 | acpi_ps_init_op ( |
| 284 | union acpi_parse_object *op, |
| 285 | u16 opcode); |
| 286 | |
| 287 | union acpi_parse_object * |
| 288 | acpi_ps_alloc_op ( |
| 289 | u16 opcode); |
| 290 | |
| 291 | void |
| 292 | acpi_ps_free_op ( |
| 293 | union acpi_parse_object *op); |
| 294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 295 | u8 |
| 296 | acpi_ps_is_leading_char ( |
| 297 | u32 c); |
| 298 | |
| 299 | u8 |
| 300 | acpi_ps_is_prefix_char ( |
| 301 | u32 c); |
| 302 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 303 | #ifdef ACPI_FUTURE_USAGE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 304 | u32 |
| 305 | acpi_ps_get_name( |
| 306 | union acpi_parse_object *op); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 307 | #endif /* ACPI_FUTURE_USAGE */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | void |
| 310 | acpi_ps_set_name( |
| 311 | union acpi_parse_object *op, |
| 312 | u32 name); |
| 313 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 315 | /* |
| 316 | * psdump - display parser tree |
| 317 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | u32 |
| 319 | acpi_ps_sprint_path ( |
| 320 | char *buffer_start, |
| 321 | u32 buffer_size, |
| 322 | union acpi_parse_object *op); |
| 323 | |
| 324 | u32 |
| 325 | acpi_ps_sprint_op ( |
| 326 | char *buffer_start, |
| 327 | u32 buffer_size, |
| 328 | union acpi_parse_object *op); |
| 329 | |
| 330 | void |
| 331 | acpi_ps_show ( |
| 332 | union acpi_parse_object *op); |
| 333 | |
| 334 | |
| 335 | #endif /* __ACPARSER_H__ */ |