acstruct.h 7.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7
/******************************************************************************
 *
 * Name: acstruct.h - Internal structs
 *
 *****************************************************************************/

/*
8
 * Copyright (C) 2000 - 2012, Intel Corp.
L
Linus Torvalds 已提交
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions, and the following disclaimer,
 *    without modification.
 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
 *    substantially similar to the "NO WARRANTY" disclaimer below
 *    ("Disclaimer") and any redistribution must be conditioned upon
 *    including a substantially similar Disclaimer requirement for further
 *    binary redistribution.
 * 3. Neither the names of the above-listed copyright holders nor the names
 *    of any contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * Alternatively, this software may be distributed under the terms of the
 * GNU General Public License ("GPL") version 2 as published by the Free
 * Software Foundation.
 *
 * NO WARRANTY
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGES.
 */

#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__

B
Bob Moore 已提交
47 48
/* acpisrc:struct_defs -- for acpisrc conversion */

L
Linus Torvalds 已提交
49 50 51 52 53 54 55
/*****************************************************************************
 *
 * Tree walking typedefs and structs
 *
 ****************************************************************************/

/*
B
Bob Moore 已提交
56 57 58
 * Walk state - current state of a parse tree walk.  Used for both a leisurely
 * stroll through the tree (for whatever reason), and for control method
 * execution.
L
Linus Torvalds 已提交
59 60 61 62
 */
#define ACPI_NEXT_OP_DOWNWARD       1
#define ACPI_NEXT_OP_UPWARD         2

B
Bob Moore 已提交
63 64 65 66
/*
 * Groups of definitions for walk_type used for different implementations of
 * walkers (never simultaneously) - flags for interpreter:
 */
L
Linus Torvalds 已提交
67
#define ACPI_WALK_NON_METHOD        0
B
Bob Moore 已提交
68 69 70 71 72 73 74
#define ACPI_WALK_METHOD            0x01
#define ACPI_WALK_METHOD_RESTART    0x02

/* Flags for i_aSL compiler only */

#define ACPI_WALK_CONST_REQUIRED    0x10
#define ACPI_WALK_CONST_OPTIONAL    0x20
L
Linus Torvalds 已提交
75

L
Len Brown 已提交
76
struct acpi_walk_state {
B
Bob Moore 已提交
77 78
	struct acpi_walk_state *next;	/* Next walk_state in list */
	u8 descriptor_type;	/* To differentiate various internal objs */
L
Len Brown 已提交
79
	u8 walk_type;
B
Bob Moore 已提交
80
	u16 opcode;		/* Current AML opcode */
L
Len Brown 已提交
81 82
	u8 next_op_info;	/* Info about next_op */
	u8 num_operands;	/* Stack pointer for Operands[] array */
83
	u8 operand_index;	/* Index into operand stack, to be used by acpi_ds_obj_stack_push */
B
Bob Moore 已提交
84 85 86
	acpi_owner_id owner_id;	/* Owner of objects created during the walk */
	u8 last_predicate;	/* Result of last predicate */
	u8 current_result;
L
Len Brown 已提交
87 88 89
	u8 return_used;
	u8 scope_depth;
	u8 pass_number;		/* Parse pass during table load */
90 91
	u8 result_size;		/* Total elements for the result stack */
	u8 result_count;	/* Current number of occupied elements of result stack */
L
Len Brown 已提交
92 93 94 95 96
	u32 aml_offset;
	u32 arg_types;
	u32 method_breakpoint;	/* For single stepping */
	u32 user_breakpoint;	/* User AML breakpoint */
	u32 parse_flags;
B
Bob Moore 已提交
97 98

	struct acpi_parse_state parser_state;	/* Current state of parser */
L
Len Brown 已提交
99
	u32 prev_arg_types;
B
Bob Moore 已提交
100
	u32 arg_count;		/* push for fixed or var args */
L
Len Brown 已提交
101 102

	struct acpi_namespace_node arguments[ACPI_METHOD_NUM_ARGS];	/* Control method arguments */
B
Bob Moore 已提交
103 104 105 106 107
	struct acpi_namespace_node local_variables[ACPI_METHOD_NUM_LOCALS];	/* Control method locals */
	union acpi_operand_object *operands[ACPI_OBJ_NUM_OPERANDS + 1];	/* Operands passed to the interpreter (+1 for NULL terminator) */
	union acpi_operand_object **params;

	u8 *aml_last_while;
L
Len Brown 已提交
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
	union acpi_operand_object **caller_return_desc;
	union acpi_generic_state *control_state;	/* List of control states (nested IFs) */
	struct acpi_namespace_node *deferred_node;	/* Used when executing deferred opcodes */
	union acpi_operand_object *implicit_return_obj;
	struct acpi_namespace_node *method_call_node;	/* Called method Node */
	union acpi_parse_object *method_call_op;	/* method_call Op if running a method */
	union acpi_operand_object *method_desc;	/* Method descriptor if running a method */
	struct acpi_namespace_node *method_node;	/* Method node if running a method. */
	union acpi_parse_object *op;	/* Current parser op */
	const struct acpi_opcode_info *op_info;	/* Info on current opcode */
	union acpi_parse_object *origin;	/* Start of walk [Obsolete] */
	union acpi_operand_object *result_obj;
	union acpi_generic_state *results;	/* Stack of accumulated results */
	union acpi_operand_object *return_desc;	/* Return object, if any */
	union acpi_generic_state *scope_info;	/* Stack of nested scopes */
	union acpi_parse_object *prev_op;	/* Last op that was processed */
	union acpi_parse_object *next_op;	/* next op to be processed */
B
Bob Moore 已提交
125
	struct acpi_thread_state *thread;
L
Len Brown 已提交
126 127
	acpi_parse_downwards descending_callback;
	acpi_parse_upwards ascending_callback;
L
Linus Torvalds 已提交
128 129
};

130
/* Info used by acpi_ns_initialize_objects and acpi_ds_initialize_objects */
L
Linus Torvalds 已提交
131

L
Len Brown 已提交
132
struct acpi_init_walk_info {
133
	u32 table_index;
134 135 136 137 138 139 140 141 142 143 144 145
	u32 object_count;
	u32 method_count;
	u32 device_count;
	u32 op_region_count;
	u32 field_count;
	u32 buffer_count;
	u32 package_count;
	u32 op_region_init;
	u32 field_init;
	u32 buffer_init;
	u32 package_init;
	acpi_owner_id owner_id;
L
Linus Torvalds 已提交
146 147
};

L
Len Brown 已提交
148 149 150
struct acpi_get_devices_info {
	acpi_walk_callback user_function;
	void *context;
151
	const char *hid;
L
Linus Torvalds 已提交
152 153
};

L
Len Brown 已提交
154 155
union acpi_aml_operands {
	union acpi_operand_object *operands[7];
L
Linus Torvalds 已提交
156

L
Len Brown 已提交
157 158 159 160
	struct {
		struct acpi_object_integer *type;
		struct acpi_object_integer *code;
		struct acpi_object_integer *argument;
L
Linus Torvalds 已提交
161 162 163

	} fatal;

L
Len Brown 已提交
164 165 166 167
	struct {
		union acpi_operand_object *source;
		struct acpi_object_integer *index;
		union acpi_operand_object *target;
L
Linus Torvalds 已提交
168 169 170

	} index;

L
Len Brown 已提交
171 172 173 174 175
	struct {
		union acpi_operand_object *source;
		struct acpi_object_integer *index;
		struct acpi_object_integer *length;
		union acpi_operand_object *target;
L
Linus Torvalds 已提交
176 177 178 179

	} mid;
};

B
Bob Moore 已提交
180 181 182 183 184 185 186
/*
 * Structure used to pass object evaluation parameters.
 * Purpose is to reduce CPU stack use.
 */
struct acpi_evaluate_info {
	struct acpi_namespace_node *prefix_node;
	char *pathname;
L
Len Brown 已提交
187 188
	union acpi_operand_object *obj_desc;
	union acpi_operand_object **parameters;
B
Bob Moore 已提交
189
	struct acpi_namespace_node *resolved_node;
L
Len Brown 已提交
190
	union acpi_operand_object *return_object;
191
	u8 param_count;
L
Len Brown 已提交
192 193
	u8 pass_number;
	u8 return_object_type;
B
Bob Moore 已提交
194
	u8 flags;
L
Linus Torvalds 已提交
195 196
};

B
Bob Moore 已提交
197 198 199 200 201 202 203 204 205
/* Values for Flags above */

#define ACPI_IGNORE_RETURN_VALUE        1

/* Info used by acpi_ns_initialize_devices */

struct acpi_device_walk_info {
	struct acpi_table_desc *table_desc;
	struct acpi_evaluate_info *evaluate_info;
206 207 208
	u32 device_count;
	u32 num_STA;
	u32 num_INI;
B
Bob Moore 已提交
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
};

/* TBD: [Restructure] Merge with struct above */

struct acpi_walk_info {
	u32 debug_level;
	u32 count;
	acpi_owner_id owner_id;
	u8 display_type;
};

/* Display Types */

#define ACPI_DISPLAY_SUMMARY        (u8) 0
#define ACPI_DISPLAY_OBJECTS        (u8) 1
#define ACPI_DISPLAY_MASK           (u8) 1

#define ACPI_DISPLAY_SHORT          (u8) 2

L
Linus Torvalds 已提交
228
#endif