/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */1/******************************************************************************2*3* Name: acstruct.h - Internal structs4*5* Copyright (C) 2000 - 2025, Intel Corp.6*7*****************************************************************************/89#ifndef __ACSTRUCT_H__10#define __ACSTRUCT_H__1112/* acpisrc:struct_defs -- for acpisrc conversion */1314/*****************************************************************************15*16* Tree walking typedefs and structs17*18****************************************************************************/1920/*21* Walk state - current state of a parse tree walk. Used for both a leisurely22* stroll through the tree (for whatever reason), and for control method23* execution.24*/25#define ACPI_NEXT_OP_DOWNWARD 126#define ACPI_NEXT_OP_UPWARD 22728/*29* Groups of definitions for walk_type used for different implementations of30* walkers (never simultaneously) - flags for interpreter:31*/32#define ACPI_WALK_NON_METHOD 033#define ACPI_WALK_METHOD 0x0134#define ACPI_WALK_METHOD_RESTART 0x023536struct acpi_walk_state {37struct acpi_walk_state *next; /* Next walk_state in list */38u8 descriptor_type; /* To differentiate various internal objs */39u8 walk_type;40u16 opcode; /* Current AML opcode */41u8 next_op_info; /* Info about next_op */42u8 num_operands; /* Stack pointer for Operands[] array */43u8 operand_index; /* Index into operand stack, to be used by acpi_ds_obj_stack_push */44acpi_owner_id owner_id; /* Owner of objects created during the walk */45u8 last_predicate; /* Result of last predicate */46u8 current_result;47u8 return_used;48u8 scope_depth;49u8 pass_number; /* Parse pass during table load */50u8 namespace_override; /* Override existing objects */51u8 result_size; /* Total elements for the result stack */52u8 result_count; /* Current number of occupied elements of result stack */53u8 *aml;54u32 arg_types;55u32 method_breakpoint; /* For single stepping */56u32 user_breakpoint; /* User AML breakpoint */57u32 parse_flags;5859struct acpi_parse_state parser_state; /* Current state of parser */60u32 prev_arg_types;61u32 arg_count; /* push for fixed or var args */62u16 method_nesting_depth;63u8 method_is_nested;6465struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */66struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */67union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */68union acpi_operand_object **params;6970u8 *aml_last_while;71union acpi_operand_object **caller_return_desc;72union acpi_generic_state *control_state; /* List of control states (nested IFs) */73struct acpi_namespace_node *deferred_node; /* Used when executing deferred opcodes */74union acpi_operand_object *implicit_return_obj;75struct acpi_namespace_node *method_call_node; /* Called method Node */76union acpi_parse_object *method_call_op; /* method_call Op if running a method */77union acpi_operand_object *method_desc; /* Method descriptor if running a method */78struct acpi_namespace_node *method_node; /* Method node if running a method */79char *method_pathname; /* Full pathname of running method */80union acpi_parse_object *op; /* Current parser op */81const struct acpi_opcode_info *op_info; /* Info on current opcode */82union acpi_parse_object *origin; /* Start of walk [Obsolete] */83union acpi_operand_object *result_obj;84union acpi_generic_state *results; /* Stack of accumulated results */85union acpi_operand_object *return_desc; /* Return object, if any */86union acpi_generic_state *scope_info; /* Stack of nested scopes */87union acpi_parse_object *prev_op; /* Last op that was processed */88union acpi_parse_object *next_op; /* next op to be processed */89struct acpi_thread_state *thread;90acpi_parse_downwards descending_callback;91acpi_parse_upwards ascending_callback;92};9394/* Info used by acpi_ns_initialize_objects and acpi_ds_initialize_objects */9596struct acpi_init_walk_info {97u32 table_index;98u32 object_count;99u32 method_count;100u32 serial_method_count;101u32 non_serial_method_count;102u32 serialized_method_count;103u32 device_count;104u32 op_region_count;105u32 field_count;106u32 buffer_count;107u32 package_count;108u32 op_region_init;109u32 field_init;110u32 buffer_init;111u32 package_init;112acpi_owner_id owner_id;113};114115struct acpi_get_devices_info {116acpi_walk_callback user_function;117void *context;118const char *hid;119};120121union acpi_aml_operands {122union acpi_operand_object *operands[7];123124struct {125struct acpi_object_integer *type;126struct acpi_object_integer *code;127struct acpi_object_integer *argument;128129} fatal;130131struct {132union acpi_operand_object *source;133struct acpi_object_integer *index;134union acpi_operand_object *target;135136} index;137138struct {139union acpi_operand_object *source;140struct acpi_object_integer *index;141struct acpi_object_integer *length;142union acpi_operand_object *target;143144} mid;145};146147/*148* Structure used to pass object evaluation information and parameters.149* Purpose is to reduce CPU stack use.150*/151struct acpi_evaluate_info {152/* The first 3 elements are passed by the caller to acpi_ns_evaluate */153154struct acpi_namespace_node *prefix_node; /* Input: starting node */155const char *relative_pathname; /* Input: path relative to prefix_node */156union acpi_operand_object **parameters; /* Input: argument list */157158struct acpi_namespace_node *node; /* Resolved node (prefix_node:relative_pathname) */159union acpi_operand_object *obj_desc; /* Object attached to the resolved node */160char *full_pathname; /* Full pathname of the resolved node */161162const union acpi_predefined_info *predefined; /* Used if Node is a predefined name */163union acpi_operand_object *return_object; /* Object returned from the evaluation */164union acpi_operand_object *parent_package; /* Used if return object is a Package */165166u32 return_flags; /* Used for return value analysis */167u32 return_btype; /* Bitmapped type of the returned object */168u16 param_count; /* Count of the input argument list */169u16 node_flags; /* Same as Node->Flags */170u8 pass_number; /* Parser pass number */171u8 return_object_type; /* Object type of the returned object */172u8 flags; /* General flags */173};174175/* Values for Flags above */176177#define ACPI_IGNORE_RETURN_VALUE 1178179/* Defines for return_flags field above */180181#define ACPI_OBJECT_REPAIRED 1182#define ACPI_OBJECT_WRAPPED 2183184/* Info used by acpi_ns_initialize_devices */185186struct acpi_device_walk_info {187struct acpi_table_desc *table_desc;188struct acpi_evaluate_info *evaluate_info;189u32 device_count;190u32 num_STA;191u32 num_INI;192};193194/* Info used by Acpi acpi_db_display_fields */195196struct acpi_region_walk_info {197u32 debug_level;198u32 count;199acpi_owner_id owner_id;200u8 display_type;201u32 address_space_id;202};203204/* TBD: [Restructure] Merge with struct above */205206struct acpi_walk_info {207u32 debug_level;208u32 count;209acpi_owner_id owner_id;210u8 display_type;211};212213/* Display Types */214215#define ACPI_DISPLAY_SUMMARY (u8) 0216#define ACPI_DISPLAY_OBJECTS (u8) 1217#define ACPI_DISPLAY_MASK (u8) 1218219#define ACPI_DISPLAY_SHORT (u8) 2220221#endif222223224