| 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 |
|
| 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 |
|
| 78 | acpi_status
|
| 79 | acpi_psx_load_table (
|
| 80 | u8 *pcode_addr,
|
| 81 | u32 pcode_length);
|
| 82 |
|
| 83 | acpi_status
|
| 84 | acpi_psx_execute (
|
| 85 | struct acpi_parameter_info *info);
|
| 86 |
|
| 87 |
|
| 88 | |
| 89 | * psargs - Parse AML opcode arguments
|
| 90 |
|
| 91 | u8 *
|
| 92 | acpi_ps_get_next_package_end (
|
| 93 | struct acpi_parse_state *parser_state);
|
| 94 |
|
| 95 | char *
|
| 96 | acpi_ps_get_next_namestring (
|
| 97 | struct acpi_parse_state *parser_state);
|
| 98 |
|
| 99 | void
|
| 100 | acpi_ps_get_next_simple_arg (
|
| 101 | struct acpi_parse_state *parser_state,
|
| 102 | u32 arg_type,
|
| 103 | union acpi_parse_object *arg);
|
| 104 |
|
| 105 | acpi_status
|
| 106 | acpi_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 |
|
| 112 | acpi_status
|
| 113 | acpi_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 |
|
| 123 | union acpi_parse_object *
|
| 124 | acpi_ps_find_name (
|
| 125 | union acpi_parse_object *scope,
|
| 126 | u32 name,
|
| 127 | u32 opcode);
|
| 128 |
|
| 129 | union acpi_parse_object*
|
| 130 | acpi_ps_get_parent (
|
| 131 | union acpi_parse_object *op);
|
| 132 |
|
| 133 |
|
| 134 | |
| 135 | * psopcode - AML Opcode information
|
| 136 |
|
| 137 | const struct acpi_opcode_info *
|
| 138 | acpi_ps_get_opcode_info (
|
| 139 | u16 opcode);
|
| 140 |
|
| 141 | char *
|
| 142 | acpi_ps_get_opcode_name (
|
| 143 | u16 opcode);
|
| 144 |
|
| 145 |
|
| 146 | |
| 147 | * psparse - top level parsing routines
|
| 148 |
|
| 149 | acpi_status
|
| 150 | acpi_ps_parse_aml (
|
| 151 | struct acpi_walk_state *walk_state);
|
| 152 |
|
| 153 | u32
|
| 154 | acpi_ps_get_opcode_size (
|
| 155 | u32 opcode);
|
| 156 |
|
| 157 | u16
|
| 158 | acpi_ps_peek_opcode (
|
| 159 | struct acpi_parse_state *state);
|
| 160 |
|
| 161 |
|
| 162 | |
| 163 | * psscope - Scope stack management routines
|
| 164 |
|
| 165 | acpi_status
|
| 166 | acpi_ps_init_scope (
|
| 167 | struct acpi_parse_state *parser_state,
|
| 168 | union acpi_parse_object *root);
|
| 169 |
|
| 170 | union acpi_parse_object *
|
| 171 | acpi_ps_get_parent_scope (
|
| 172 | struct acpi_parse_state *state);
|
| 173 |
|
| 174 | u8
|
| 175 | acpi_ps_has_completed_scope (
|
| 176 | struct acpi_parse_state *parser_state);
|
| 177 |
|
| 178 | void
|
| 179 | acpi_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 |
|
| 185 | acpi_status
|
| 186 | acpi_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 |
|
| 192 | void
|
| 193 | acpi_ps_cleanup_scope (
|
| 194 | struct acpi_parse_state *state);
|
| 195 |
|
| 196 |
|
| 197 | |
| 198 | * pstree - parse tree manipulation routines
|
| 199 |
|
| 200 | void
|
| 201 | acpi_ps_append_arg(
|
| 202 | union acpi_parse_object *op,
|
| 203 | union acpi_parse_object *arg);
|
| 204 |
|
| 205 | union acpi_parse_object*
|
| 206 | acpi_ps_find (
|
| 207 | union acpi_parse_object *scope,
|
| 208 | char *path,
|
| 209 | u16 opcode,
|
| 210 | u32 create);
|
| 211 |
|
| 212 | union acpi_parse_object *
|
| 213 | acpi_ps_get_arg(
|
| 214 | union acpi_parse_object *op,
|
| 215 | u32 argn);
|
| 216 |
|
| 217 | #ifdef ACPI_FUTURE_USAGE
|
| 218 | union acpi_parse_object *
|
| 219 | acpi_ps_get_depth_next (
|
| 220 | union acpi_parse_object *origin,
|
| 221 | union acpi_parse_object *op);
|
| 222 | #endif
|
| 223 |
|
| 224 |
|
| 225 | |
| 226 | * pswalk - parse tree walk routines
|
| 227 |
|
| 228 | acpi_status
|
| 229 | acpi_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 |
|
| 240 | acpi_status
|
| 241 | acpi_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 |
|
| 246 | acpi_status
|
| 247 | acpi_ps_delete_completed_op (
|
| 248 | struct acpi_walk_state *walk_state);
|
| 249 |
|
| 250 | void
|
| 251 | acpi_ps_delete_parse_tree (
|
| 252 | union acpi_parse_object *root);
|
| 253 |
|
| 254 |
|
| 255 | |
| 256 | * psutils - parser utilities
|
| 257 |
|
| 258 | union acpi_parse_object *
|
| 259 | acpi_ps_create_scope_op (
|
| 260 | void);
|
| 261 |
|
| 262 | void
|
| 263 | acpi_ps_init_op (
|
| 264 | union acpi_parse_object *op,
|
| 265 | u16 opcode);
|
| 266 |
|
| 267 | union acpi_parse_object *
|
| 268 | acpi_ps_alloc_op (
|
| 269 | u16 opcode);
|
| 270 |
|
| 271 | void
|
| 272 | acpi_ps_free_op (
|
| 273 | union acpi_parse_object *op);
|
| 274 |
|
| 275 | u8
|
| 276 | acpi_ps_is_leading_char (
|
| 277 | u32 c);
|
| 278 |
|
| 279 | u8
|
| 280 | acpi_ps_is_prefix_char (
|
| 281 | u32 c);
|
| 282 |
|
| 283 | #ifdef ACPI_FUTURE_USAGE
|
| 284 | u32
|
| 285 | acpi_ps_get_name(
|
| 286 | union acpi_parse_object *op);
|
| 287 | #endif
|
| 288 |
|
| 289 | void
|
| 290 | acpi_ps_set_name(
|
| 291 | union acpi_parse_object *op,
|
| 292 | u32 name);
|
| 293 |
|
| 294 | #ifdef ACPI_ENABLE_OBJECT_CACHE
|
| 295 | void
|
| 296 | acpi_ps_delete_parse_cache (
|
| 297 | void);
|
| 298 | #endif
|
| 299 |
|
| 300 |
|
| 301 | |
| 302 | * psdump - display parser tree
|
| 303 |
|
| 304 | u32
|
| 305 | acpi_ps_sprint_path (
|
| 306 | char *buffer_start,
|
| 307 | u32 buffer_size,
|
| 308 | union acpi_parse_object *op);
|
| 309 |
|
| 310 | u32
|
| 311 | acpi_ps_sprint_op (
|
| 312 | char *buffer_start,
|
| 313 | u32 buffer_size,
|
| 314 | union acpi_parse_object *op);
|
| 315 |
|
| 316 | void
|
| 317 | acpi_ps_show (
|
| 318 | union acpi_parse_object *op);
|
| 319 |
|
| 320 |
|
| 321 | #endif
|