import of ftp.dlink.com/GPL/DSMG-600_reB/ppclinux.tar.gz
[linux-2.4.21-pre4.git] / drivers / acpi / include / acstruct.h
1 /******************************************************************************
2  *
3  * Name: acstruct.h - Internal structs
4  *       $Revision: 1.1.1.1 $
5  *
6  *****************************************************************************/
7
8 /*
9  *  Copyright (C) 2000, 2001 R. Byron Moore
10  *
11  *  This program is free software; you can redistribute it and/or modify
12  *  it under the terms of the GNU General Public License as published by
13  *  the Free Software Foundation; either version 2 of the License, or
14  *  (at your option) any later version.
15  *
16  *  This program is distributed in the hope that it will be useful,
17  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  *  GNU General Public License for more details.
20  *
21  *  You should have received a copy of the GNU General Public License
22  *  along with this program; if not, write to the Free Software
23  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24  */
25
26 #ifndef __ACSTRUCT_H__
27 #define __ACSTRUCT_H__
28
29
30 /*****************************************************************************
31  *
32  * Tree walking typedefs and structs
33  *
34  ****************************************************************************/
35
36
37 /*
38  * Walk state - current state of a parse tree walk.  Used for both a leisurely stroll through
39  * the tree (for whatever reason), and for control method execution.
40  */
41
42 #define NEXT_OP_DOWNWARD    1
43 #define NEXT_OP_UPWARD      2
44
45 #define WALK_NON_METHOD     0
46 #define WALK_METHOD         1
47 #define WALK_METHOD_RESTART 2
48
49 typedef struct acpi_walk_state
50 {
51         u8                      data_type;                          /* To differentiate various internal objs MUST BE FIRST!*/\
52         acpi_owner_id           owner_id;                           /* Owner of objects created during the walk */
53         u8                      last_predicate;                     /* Result of last predicate */
54         u8                      current_result;                     /* */
55         u8                      next_op_info;                       /* Info about Next_op */
56         u8                      num_operands;                       /* Stack pointer for Operands[] array */
57         u8                      return_used;
58         u8                      walk_type;
59         u16                     current_sync_level;                 /* Mutex Sync (nested acquire) level */
60         u16                     opcode;                             /* Current AML opcode */
61         u32                     arg_count;                          /* push for fixed or var args */
62         u32                     aml_offset;
63         u32                     arg_types;
64         u32                     method_breakpoint;                  /* For single stepping */
65         u32                     parse_flags;
66         u32                     prev_arg_types;
67
68
69         u8                      *aml_last_while;
70         struct acpi_node        arguments[MTH_NUM_ARGS];            /* Control method arguments */
71         union acpi_operand_obj  **caller_return_desc;
72         acpi_generic_state      *control_state;                     /* List of control states (nested IFs) */
73         struct acpi_node        local_variables[MTH_NUM_LOCALS];    /* Control method locals */
74         struct acpi_node        *method_call_node;                  /* Called method Node*/
75         acpi_parse_object       *method_call_op;                    /* Method_call Op if running a method */
76         union acpi_operand_obj  *method_desc;                       /* Method descriptor if running a method */
77         struct acpi_node        *method_node;                       /* Method Node if running a method */
78         acpi_parse_object       *op;                                /* Current parser op */
79         union acpi_operand_obj  *operands[OBJ_NUM_OPERANDS+1];      /* Operands passed to the interpreter (+1 for NULL terminator) */
80         const acpi_opcode_info  *op_info;                           /* Info on current opcode */
81         acpi_parse_object       *origin;                            /* Start of walk [Obsolete] */
82         union acpi_operand_obj  **params;
83         acpi_parse_state        parser_state;                       /* Current state of parser */
84         union acpi_operand_obj  *result_obj;
85         acpi_generic_state      *results;                           /* Stack of accumulated results */
86         union acpi_operand_obj  *return_desc;                       /* Return object, if any */
87         acpi_generic_state      *scope_info;                        /* Stack of nested scopes */
88
89 /* TBD: Obsolete with removal of WALK procedure ? */
90         acpi_parse_object       *prev_op;                           /* Last op that was processed */
91         acpi_parse_object       *next_op;                           /* next op to be processed */
92
93
94         acpi_parse_downwards    descending_callback;
95         acpi_parse_upwards      ascending_callback;
96         struct acpi_walk_list   *walk_list;
97         struct acpi_walk_state  *next;                              /* Next Walk_state in list */
98
99
100 } acpi_walk_state;
101
102
103 /*
104  * Walk list - head of a tree of walk states.  Multiple walk states are created when there
105  * are nested control methods executing.
106  */
107 typedef struct acpi_walk_list
108 {
109
110         acpi_walk_state         *walk_state;
111         ACPI_OBJECT_MUTEX       acquired_mutex_list;               /* List of all currently acquired mutexes */
112
113 } acpi_walk_list;
114
115
116 /* Info used by Acpi_ps_init_objects */
117
118 typedef struct acpi_init_walk_info
119 {
120         u16                     method_count;
121         u16                     op_region_count;
122         u16                     field_count;
123         u16                     op_region_init;
124         u16                     field_init;
125         u16                     object_count;
126         acpi_table_desc         *table_desc;
127
128 } acpi_init_walk_info;
129
130
131 /* Info used by TBD */
132
133 typedef struct acpi_device_walk_info
134 {
135         u16                     device_count;
136         u16                     num_STA;
137         u16                     num_INI;
138         acpi_table_desc         *table_desc;
139
140 } acpi_device_walk_info;
141
142
143 /* TBD: [Restructure] Merge with struct above */
144
145 typedef struct acpi_walk_info
146 {
147         u32                     debug_level;
148         u32                     owner_id;
149         u8                      display_type;
150
151 } acpi_walk_info;
152
153 /* Display Types */
154
155 #define ACPI_DISPLAY_SUMMARY    0
156 #define ACPI_DISPLAY_OBJECTS    1
157
158 typedef struct acpi_get_devices_info
159 {
160         acpi_walk_callback      user_function;
161         void                    *context;
162         NATIVE_CHAR             *hid;
163
164 } acpi_get_devices_info;
165
166
167 typedef union acpi_aml_operands
168 {
169         acpi_operand_object         *operands[7];
170
171         struct
172         {
173                 ACPI_OBJECT_INTEGER     *type;
174                 ACPI_OBJECT_INTEGER     *code;
175                 ACPI_OBJECT_INTEGER     *argument;
176
177         } fatal;
178
179         struct
180         {
181                 acpi_operand_object     *source;
182                 ACPI_OBJECT_INTEGER     *index;
183                 acpi_operand_object     *target;
184
185         } index;
186
187         struct
188         {
189                 acpi_operand_object     *source;
190                 ACPI_OBJECT_INTEGER     *index;
191                 ACPI_OBJECT_INTEGER     *length;
192                 acpi_operand_object     *target;
193
194         } mid;
195
196 } ACPI_AML_OPERANDS;
197
198
199 #endif