/******************************************************************************1*2* Name: acstruct.h - Internal structs3*4*****************************************************************************/56/*7* Copyright (C) 2000 - 2011, Intel Corp.8* All rights reserved.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions, and the following disclaimer,15* without modification.16* 2. Redistributions in binary form must reproduce at minimum a disclaimer17* substantially similar to the "NO WARRANTY" disclaimer below18* ("Disclaimer") and any redistribution must be conditioned upon19* including a substantially similar Disclaimer requirement for further20* binary redistribution.21* 3. Neither the names of the above-listed copyright holders nor the names22* of any contributors may be used to endorse or promote products derived23* from this software without specific prior written permission.24*25* Alternatively, this software may be distributed under the terms of the26* GNU General Public License ("GPL") version 2 as published by the Free27* Software Foundation.28*29* NO WARRANTY30* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS31* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT32* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR33* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT34* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL35* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS36* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)37* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,38* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING39* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE40* POSSIBILITY OF SUCH DAMAGES.41*/4243#ifndef __ACSTRUCT_H__44#define __ACSTRUCT_H__4546/* acpisrc:struct_defs -- for acpisrc conversion */4748/*****************************************************************************49*50* Tree walking typedefs and structs51*52****************************************************************************/5354/*55* Walk state - current state of a parse tree walk. Used for both a leisurely56* stroll through the tree (for whatever reason), and for control method57* execution.58*/59#define ACPI_NEXT_OP_DOWNWARD 160#define ACPI_NEXT_OP_UPWARD 26162/*63* Groups of definitions for walk_type used for different implementations of64* walkers (never simultaneously) - flags for interpreter:65*/66#define ACPI_WALK_NON_METHOD 067#define ACPI_WALK_METHOD 0x0168#define ACPI_WALK_METHOD_RESTART 0x026970/* Flags for i_aSL compiler only */7172#define ACPI_WALK_CONST_REQUIRED 0x1073#define ACPI_WALK_CONST_OPTIONAL 0x207475struct acpi_walk_state {76struct acpi_walk_state *next; /* Next walk_state in list */77u8 descriptor_type; /* To differentiate various internal objs */78u8 walk_type;79u16 opcode; /* Current AML opcode */80u8 next_op_info; /* Info about next_op */81u8 num_operands; /* Stack pointer for Operands[] array */82u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */83acpi_owner_id owner_id; /* Owner of objects created during the walk */84u8 last_predicate; /* Result of last predicate */85u8 current_result;86u8 return_used;87u8 scope_depth;88u8 pass_number; /* Parse pass during table load */89u8 result_size; /* Total elements for the result stack */90u8 result_count; /* Current number of occupied elements of result stack */91u32 aml_offset;92u32 arg_types;93u32 method_breakpoint; /* For single stepping */94u32 user_breakpoint; /* User AML breakpoint */95u32 parse_flags;9697struct acpi_parse_state parser_state; /* Current state of parser */98u32 prev_arg_types;99u32 arg_count; /* push for fixed or var args */100101struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */102struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */103union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */104union acpi_operand_object **params;105106u8 *aml_last_while;107union acpi_operand_object **caller_return_desc;108union acpi_generic_state *control_state; /* List of control states (nested IFs) */109struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */110union acpi_operand_object *implicit_return_obj;111struct acpi_namespace_node *method_call_node; /* Called method Node */112union acpi_parse_object *method_call_op; /* method_call Op if running a method */113union acpi_operand_object *method_desc; /* Method descriptor if running a method */114struct acpi_namespace_node *method_node; /* Method node if running a method. */115union acpi_parse_object *op; /* Current parser op */116const struct acpi_opcode_info *op_info; /* Info on current opcode */117union acpi_parse_object *origin; /* Start of walk [Obsolete] */118union acpi_operand_object *result_obj;119union acpi_generic_state *results; /* Stack of accumulated results */120union acpi_operand_object *return_desc; /* Return object, if any */121union acpi_generic_state *scope_info; /* Stack of nested scopes */122union acpi_parse_object *prev_op; /* Last op that was processed */123union acpi_parse_object *next_op; /* next op to be processed */124struct acpi_thread_state *thread;125acpi_parse_downwards descending_callback;126acpi_parse_upwards ascending_callback;127};128129/* Info used by acpi_ns_initialize_objects and acpi_ds_initialize_objects */130131struct acpi_init_walk_info {132u32 table_index;133u32 object_count;134u32 method_count;135u32 device_count;136u32 op_region_count;137u32 field_count;138u32 buffer_count;139u32 package_count;140u32 op_region_init;141u32 field_init;142u32 buffer_init;143u32 package_init;144acpi_owner_id owner_id;145};146147struct acpi_get_devices_info {148acpi_walk_callback user_function;149void *context;150const char *hid;151};152153union acpi_aml_operands {154union acpi_operand_object *operands[7];155156struct {157struct acpi_object_integer *type;158struct acpi_object_integer *code;159struct acpi_object_integer *argument;160161} fatal;162163struct {164union acpi_operand_object *source;165struct acpi_object_integer *index;166union acpi_operand_object *target;167168} index;169170struct {171union acpi_operand_object *source;172struct acpi_object_integer *index;173struct acpi_object_integer *length;174union acpi_operand_object *target;175176} mid;177};178179/*180* Structure used to pass object evaluation parameters.181* Purpose is to reduce CPU stack use.182*/183struct acpi_evaluate_info {184struct acpi_namespace_node *prefix_node;185char *pathname;186union acpi_operand_object *obj_desc;187union acpi_operand_object **parameters;188struct acpi_namespace_node *resolved_node;189union acpi_operand_object *return_object;190u8 param_count;191u8 pass_number;192u8 return_object_type;193u8 flags;194};195196/* Values for Flags above */197198#define ACPI_IGNORE_RETURN_VALUE 1199200/* Info used by acpi_ns_initialize_devices */201202struct acpi_device_walk_info {203struct acpi_table_desc *table_desc;204struct acpi_evaluate_info *evaluate_info;205u32 device_count;206u32 num_STA;207u32 num_INI;208};209210/* TBD: [Restructure] Merge with struct above */211212struct acpi_walk_info {213u32 debug_level;214u32 count;215acpi_owner_id owner_id;216u8 display_type;217};218219/* Display Types */220221#define ACPI_DISPLAY_SUMMARY (u8) 0222#define ACPI_DISPLAY_OBJECTS (u8) 1223#define ACPI_DISPLAY_MASK (u8) 1224225#define ACPI_DISPLAY_SHORT (u8) 2226227#endif228229230