scroll mode for very long start menus
[reactos.git] / reactos / drivers / bus / acpi / include / acobject.h
1
2 /******************************************************************************
3 *
4 * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
5 * $Revision: 1.1 $
6 *
7 *****************************************************************************/
8
9 /*
10 * Copyright (C) 2000, 2001 R. Byron Moore
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27 #ifndef _ACOBJECT_H
28 #define _ACOBJECT_H
29
30
31 /*
32 * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
33 * to the interpreter, and to keep track of the various handlers such as
34 * address space handlers and notify handlers. The object is a constant
35 * size in order to allow them to be cached and reused.
36 *
37 * All variants of the ACPI_OPERAND_OBJECT are defined with the same
38 * sequence of field types, with fields that are not used in a particular
39 * variant being named "Reserved". This is not strictly necessary, but
40 * may in some circumstances simplify understanding if these structures
41 * need to be displayed in a debugger having limited (or no) support for
42 * union types. It also simplifies some debug code in Dump_table() which
43 * dumps multi-level values: fetching Buffer.Pointer suffices to pick up
44 * the value or next level for any of several types.
45 */
46
47 /******************************************************************************
48 *
49 * Common Descriptors
50 *
51 *****************************************************************************/
52
53 /*
54 * Common area for all objects.
55 *
56 * Data_type is used to differentiate between internal descriptors, and MUST
57 * be the first byte in this structure.
58 */
59
60
61 #define ACPI_OBJECT_COMMON_HEADER /* 32-bits plus 8-bit flag */\
62 u8 data_type; /* To differentiate various internal objs */\
63 u8 type; /* ACPI_OBJECT_TYPE */\
64 u16 reference_count; /* For object deletion management */\
65 u8 flags; \
66
67 /* Defines for flag byte above */
68
69 #define AOPOBJ_STATIC_ALLOCATION 0x1
70 #define AOPOBJ_DATA_VALID 0x2
71 #define AOPOBJ_INITIALIZED 0x4
72
73
74 /*
75 * Common bitfield for the field objects
76 */
77 #define ACPI_COMMON_FIELD_INFO /* Three 32-bit values plus 8*/\
78 u8 granularity;\
79 u16 length; \
80 u32 offset; /* Byte offset within containing object */\
81 u8 bit_offset; /* Bit offset within min read/write data unit */\
82 u8 access; /* Access_type */\
83 u8 lock_rule;\
84 u8 update_rule;\
85 u8 access_attribute;
86
87
88 /******************************************************************************
89 *
90 * Individual Object Descriptors
91 *
92 *****************************************************************************/
93
94
95 typedef struct /* COMMON */
96 {
97 ACPI_OBJECT_COMMON_HEADER
98
99 } ACPI_OBJECT_COMMON;
100
101
102 typedef struct /* CACHE_LIST */
103 {
104 ACPI_OBJECT_COMMON_HEADER
105 union acpi_operand_obj *next; /* Link for object cache and internal lists*/
106
107 } ACPI_OBJECT_CACHE_LIST;
108
109
110 typedef struct /* NUMBER - has value */
111 {
112 ACPI_OBJECT_COMMON_HEADER
113
114 ACPI_INTEGER value;
115
116 } ACPI_OBJECT_INTEGER;
117
118
119 typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
120 {
121 ACPI_OBJECT_COMMON_HEADER
122
123 u32 length;
124 NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */
125
126 } ACPI_OBJECT_STRING;
127
128
129 typedef struct /* BUFFER - has length and pointer - not null terminated */
130 {
131 ACPI_OBJECT_COMMON_HEADER
132
133 u32 length;
134 u8 *pointer; /* points to the buffer in allocated space */
135
136 } ACPI_OBJECT_BUFFER;
137
138
139 typedef struct /* PACKAGE - has count, elements, next element */
140 {
141 ACPI_OBJECT_COMMON_HEADER
142
143 u32 count; /* # of elements in package */
144
145 union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */
146 union acpi_operand_obj **next_element; /* used only while initializing */
147
148 } ACPI_OBJECT_PACKAGE;
149
150
151 typedef struct /* FIELD UNIT */
152 {
153 ACPI_OBJECT_COMMON_HEADER
154
155 ACPI_COMMON_FIELD_INFO
156
157 union acpi_operand_obj *extra; /* Pointer to executable AML (in field definition) */
158 ACPI_NAMESPACE_NODE *node; /* containing object */
159 union acpi_operand_obj *container; /* Containing object (Buffer) */
160
161 } ACPI_OBJECT_FIELD_UNIT;
162
163
164 typedef struct /* DEVICE - has handle and notification handler/context */
165 {
166 ACPI_OBJECT_COMMON_HEADER
167
168 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
169 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
170 union acpi_operand_obj *addr_handler; /* Handler for Address space */
171
172 } ACPI_OBJECT_DEVICE;
173
174
175 typedef struct /* EVENT */
176 {
177 ACPI_OBJECT_COMMON_HEADER
178 void *semaphore;
179
180 } ACPI_OBJECT_EVENT;
181
182
183 #define INFINITE_CONCURRENCY 0xFF
184
185 typedef struct /* METHOD */
186 {
187 ACPI_OBJECT_COMMON_HEADER
188 u8 method_flags;
189 u8 param_count;
190
191 u32 pcode_length;
192
193 void *semaphore;
194 u8 *pcode;
195
196 u8 concurrency;
197 u8 thread_count;
198 ACPI_OWNER_ID owning_id;
199
200 } ACPI_OBJECT_METHOD;
201
202
203 typedef struct acpi_obj_mutex /* MUTEX */
204 {
205 ACPI_OBJECT_COMMON_HEADER
206 u16 sync_level;
207 u16 acquisition_depth;
208
209 void *semaphore;
210 void *owner;
211 union acpi_operand_obj *prev; /* Link for list of acquired mutexes */
212 union acpi_operand_obj *next; /* Link for list of acquired mutexes */
213
214 } ACPI_OBJECT_MUTEX;
215
216
217 typedef struct /* REGION */
218 {
219 ACPI_OBJECT_COMMON_HEADER
220
221 u8 space_id;
222 u32 length;
223 ACPI_PHYSICAL_ADDRESS address;
224 union acpi_operand_obj *extra; /* Pointer to executable AML (in region definition) */
225
226 union acpi_operand_obj *addr_handler; /* Handler for system notifies */
227 ACPI_NAMESPACE_NODE *node; /* containing object */
228 union acpi_operand_obj *next;
229
230 } ACPI_OBJECT_REGION;
231
232
233 typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
234 {
235 ACPI_OBJECT_COMMON_HEADER
236
237 u32 system_level;
238 u32 resource_order;
239
240 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
241 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
242
243 } ACPI_OBJECT_POWER_RESOURCE;
244
245
246 typedef struct /* PROCESSOR - has Handle and notification handler/context*/
247 {
248 ACPI_OBJECT_COMMON_HEADER
249
250 u32 proc_id;
251 u32 length;
252 ACPI_IO_ADDRESS address;
253
254 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
255 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
256 union acpi_operand_obj *addr_handler; /* Handler for Address space */
257
258 } ACPI_OBJECT_PROCESSOR;
259
260
261 typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
262 {
263 ACPI_OBJECT_COMMON_HEADER
264
265 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
266 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
267 union acpi_operand_obj *addr_handler; /* Handler for Address space */
268
269 } ACPI_OBJECT_THERMAL_ZONE;
270
271
272 /*
273 * Internal types
274 */
275
276
277 typedef struct /* FIELD */
278 {
279 ACPI_OBJECT_COMMON_HEADER
280
281 ACPI_COMMON_FIELD_INFO
282
283 union acpi_operand_obj *container; /* Containing object */
284
285 } ACPI_OBJECT_FIELD;
286
287
288 typedef struct /* BANK FIELD */
289 {
290 ACPI_OBJECT_COMMON_HEADER
291
292 ACPI_COMMON_FIELD_INFO
293 u32 value; /* Value to store into Bank_select */
294
295 ACPI_HANDLE bank_select; /* Bank select register */
296 union acpi_operand_obj *container; /* Containing object */
297
298 } ACPI_OBJECT_BANK_FIELD;
299
300
301 typedef struct /* INDEX FIELD */
302 {
303 /*
304 * No container pointer needed since the index and data register definitions
305 * will define how to access the respective registers
306 */
307 ACPI_OBJECT_COMMON_HEADER
308
309 ACPI_COMMON_FIELD_INFO
310 u32 value; /* Value to store into Index register */
311
312 ACPI_HANDLE index; /* Index register */
313 ACPI_HANDLE data; /* Data register */
314
315 } ACPI_OBJECT_INDEX_FIELD;
316
317
318 typedef struct /* NOTIFY HANDLER */
319 {
320 ACPI_OBJECT_COMMON_HEADER
321
322 ACPI_NAMESPACE_NODE *node; /* Parent device */
323 NOTIFY_HANDLER handler;
324 void *context;
325
326 } ACPI_OBJECT_NOTIFY_HANDLER;
327
328
329 /* Flags for address handler */
330
331 #define ADDR_HANDLER_DEFAULT_INSTALLED 0x1
332
333
334 typedef struct /* ADDRESS HANDLER */
335 {
336 ACPI_OBJECT_COMMON_HEADER
337
338 u8 space_id;
339 u16 hflags;
340 ADDRESS_SPACE_HANDLER handler;
341
342 ACPI_NAMESPACE_NODE *node; /* Parent device */
343 void *context;
344 ADDRESS_SPACE_SETUP setup;
345 union acpi_operand_obj *region_list; /* regions using this handler */
346 union acpi_operand_obj *next;
347
348 } ACPI_OBJECT_ADDR_HANDLER;
349
350
351 /*
352 * The Reference object type is used for these opcodes:
353 * Arg[0-6], Local[0-7], Index_op, Name_op, Zero_op, One_op, Ones_op, Debug_op
354 */
355
356 typedef struct /* Reference - Local object type */
357 {
358 ACPI_OBJECT_COMMON_HEADER
359
360 u8 target_type; /* Used for Index_op */
361 u16 opcode;
362 u32 offset; /* Used for Arg_op, Local_op, and Index_op */
363
364 void *object; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */
365 ACPI_NAMESPACE_NODE *node;
366 union acpi_operand_obj **where;
367
368 } ACPI_OBJECT_REFERENCE;
369
370
371 /*
372 * Extra object is used as additional storage for types that
373 * have AML code in their declarations (Term_args) that must be
374 * evaluated at run time.
375 *
376 * Currently: Region and Field_unit types
377 */
378
379 typedef struct /* EXTRA */
380 {
381 ACPI_OBJECT_COMMON_HEADER
382 u8 byte_fill1;
383 u16 word_fill1;
384 u32 pcode_length;
385 u8 *pcode;
386 ACPI_NAMESPACE_NODE *method_REG; /* _REG method for this region (if any) */
387 void *region_context; /* Region-specific data */
388
389 } ACPI_OBJECT_EXTRA;
390
391
392 /******************************************************************************
393 *
394 * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
395 *
396 *****************************************************************************/
397
398 typedef union acpi_operand_obj
399 {
400 ACPI_OBJECT_COMMON common;
401 ACPI_OBJECT_CACHE_LIST cache;
402 ACPI_OBJECT_INTEGER integer;
403 ACPI_OBJECT_STRING string;
404 ACPI_OBJECT_BUFFER buffer;
405 ACPI_OBJECT_PACKAGE package;
406 ACPI_OBJECT_FIELD_UNIT field_unit;
407 ACPI_OBJECT_DEVICE device;
408 ACPI_OBJECT_EVENT event;
409 ACPI_OBJECT_METHOD method;
410 ACPI_OBJECT_MUTEX mutex;
411 ACPI_OBJECT_REGION region;
412 ACPI_OBJECT_POWER_RESOURCE power_resource;
413 ACPI_OBJECT_PROCESSOR processor;
414 ACPI_OBJECT_THERMAL_ZONE thermal_zone;
415 ACPI_OBJECT_FIELD field;
416 ACPI_OBJECT_BANK_FIELD bank_field;
417 ACPI_OBJECT_INDEX_FIELD index_field;
418 ACPI_OBJECT_REFERENCE reference;
419 ACPI_OBJECT_NOTIFY_HANDLER notify_handler;
420 ACPI_OBJECT_ADDR_HANDLER addr_handler;
421 ACPI_OBJECT_EXTRA extra;
422
423 } ACPI_OPERAND_OBJECT;
424
425 #endif /* _ACOBJECT_H */