- Kai Germaschewski: ISDN update (including Makefiles)
[davej-history.git] / drivers / acpi / include / acobject.h
blobc801ff117bd9f8031d83073434c201bf3d513879
2 /******************************************************************************
4 * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
5 * $Revision: 75 $
7 *****************************************************************************/
9 /*
10 * Copyright (C) 2000 R. Byron Moore
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.
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.
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
27 #ifndef _ACOBJECT_H
28 #define _ACOBJECT_H
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.
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.
47 /******************************************************************************
49 * Common Descriptors
51 *****************************************************************************/
54 * Common area for all objects.
56 * Data_type is used to differentiate between internal descriptors, and MUST
57 * be the first byte in this structure.
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; \
67 /* Defines for flag byte above */
69 #define AOPOBJ_STATIC_ALLOCATION 0x1
70 #define AOPOBJ_DATA_VALID 0x2
71 #define AOPOBJ_INITIALIZED 0x4
75 * Common bitfield for the field objects
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;
88 /******************************************************************************
90 * Individual Object Descriptors
92 *****************************************************************************/
95 typedef struct /* COMMON */
97 ACPI_OBJECT_COMMON_HEADER
99 } ACPI_OBJECT_COMMON;
102 typedef struct /* CACHE_LIST */
104 ACPI_OBJECT_COMMON_HEADER
105 union acpi_operand_obj *next; /* Link for object cache and internal lists*/
107 } ACPI_OBJECT_CACHE_LIST;
110 typedef struct /* NUMBER - has value */
112 ACPI_OBJECT_COMMON_HEADER
114 ACPI_INTEGER value;
116 } ACPI_OBJECT_NUMBER;
119 typedef struct /* STRING - has length and pointer */
121 ACPI_OBJECT_COMMON_HEADER
123 u32 length;
124 NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */
126 } ACPI_OBJECT_STRING;
129 typedef struct /* BUFFER - has length, sequence, and pointer */
131 ACPI_OBJECT_COMMON_HEADER
133 u32 length;
134 u32 sequence; /* Sequential count of buffers created */
136 u8 *pointer; /* points to the buffer in allocated space */
138 } ACPI_OBJECT_BUFFER;
141 typedef struct /* PACKAGE - has count, elements, next element */
143 ACPI_OBJECT_COMMON_HEADER
145 u32 count; /* # of elements in package */
147 union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */
148 union acpi_operand_obj **next_element; /* used only while initializing */
150 } ACPI_OBJECT_PACKAGE;
153 typedef struct /* FIELD UNIT */
155 ACPI_OBJECT_COMMON_HEADER
157 ACPI_COMMON_FIELD_INFO
159 union acpi_operand_obj *extra; /* Pointer to executable AML (in field definition) */
160 ACPI_NAMESPACE_NODE *node; /* containing object */
161 union acpi_operand_obj *container; /* Containing object (Buffer) */
163 } ACPI_OBJECT_FIELD_UNIT;
166 typedef struct /* DEVICE - has handle and notification handler/context */
168 ACPI_OBJECT_COMMON_HEADER
170 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
171 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
172 union acpi_operand_obj *addr_handler; /* Handler for Address space */
174 } ACPI_OBJECT_DEVICE;
177 typedef struct /* EVENT */
179 ACPI_OBJECT_COMMON_HEADER
181 void *semaphore;
183 } ACPI_OBJECT_EVENT;
186 #define INFINITE_CONCURRENCY 0xFF
188 typedef struct /* METHOD */
190 ACPI_OBJECT_COMMON_HEADER
191 u8 method_flags;
192 u8 param_count;
194 u32 pcode_length;
196 void *semaphore;
197 u8 *pcode;
199 u8 concurrency;
200 u8 thread_count;
201 ACPI_OWNER_ID owning_id;
203 } ACPI_OBJECT_METHOD;
206 typedef struct /* MUTEX */
208 ACPI_OBJECT_COMMON_HEADER
209 u16 sync_level;
211 void *semaphore;
213 } ACPI_OBJECT_MUTEX;
216 typedef struct /* REGION */
218 ACPI_OBJECT_COMMON_HEADER
220 u8 space_id;
221 u32 length;
222 ACPI_PHYSICAL_ADDRESS address;
223 union acpi_operand_obj *extra; /* Pointer to executable AML (in region definition) */
225 union acpi_operand_obj *addr_handler; /* Handler for system notifies */
226 ACPI_NAMESPACE_NODE *node; /* containing object */
227 union acpi_operand_obj *next;
229 } ACPI_OBJECT_REGION;
232 typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
234 ACPI_OBJECT_COMMON_HEADER
236 u32 system_level;
237 u32 resource_order;
239 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
240 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
242 } ACPI_OBJECT_POWER_RESOURCE;
245 typedef struct /* PROCESSOR - has Handle and notification handler/context*/
247 ACPI_OBJECT_COMMON_HEADER
249 u32 proc_id;
250 u32 length;
251 ACPI_IO_ADDRESS address;
253 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
254 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
255 union acpi_operand_obj *addr_handler; /* Handler for Address space */
257 } ACPI_OBJECT_PROCESSOR;
260 typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
262 ACPI_OBJECT_COMMON_HEADER
264 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
265 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
266 union acpi_operand_obj *addr_handler; /* Handler for Address space */
268 } ACPI_OBJECT_THERMAL_ZONE;
272 * Internal types
276 typedef struct /* FIELD */
278 ACPI_OBJECT_COMMON_HEADER
280 ACPI_COMMON_FIELD_INFO
282 union acpi_operand_obj *container; /* Containing object */
284 } ACPI_OBJECT_FIELD;
287 typedef struct /* BANK FIELD */
289 ACPI_OBJECT_COMMON_HEADER
291 ACPI_COMMON_FIELD_INFO
292 u32 value; /* Value to store into Bank_select */
294 ACPI_HANDLE bank_select; /* Bank select register */
295 union acpi_operand_obj *container; /* Containing object */
297 } ACPI_OBJECT_BANK_FIELD;
300 typedef struct /* INDEX FIELD */
303 * No container pointer needed since the index and data register definitions
304 * will define how to access the respective registers
306 ACPI_OBJECT_COMMON_HEADER
308 ACPI_COMMON_FIELD_INFO
309 u32 value; /* Value to store into Index register */
311 ACPI_HANDLE index; /* Index register */
312 ACPI_HANDLE data; /* Data register */
314 } ACPI_OBJECT_INDEX_FIELD;
317 typedef struct /* NOTIFY HANDLER */
319 ACPI_OBJECT_COMMON_HEADER
321 ACPI_NAMESPACE_NODE *node; /* Parent device */
322 NOTIFY_HANDLER handler;
323 void *context;
325 } ACPI_OBJECT_NOTIFY_HANDLER;
328 /* Flags for address handler */
330 #define ADDR_HANDLER_DEFAULT_INSTALLED 0x1
333 typedef struct /* ADDRESS HANDLER */
335 ACPI_OBJECT_COMMON_HEADER
337 u8 space_id;
338 u16 hflags;
339 ADDRESS_SPACE_HANDLER handler;
341 ACPI_NAMESPACE_NODE *node; /* Parent device */
342 void *context;
343 ADDRESS_SPACE_SETUP setup;
344 union acpi_operand_obj *region_list; /* regions using this handler */
345 union acpi_operand_obj *next;
347 } ACPI_OBJECT_ADDR_HANDLER;
351 * The Reference object type is used for these opcodes:
352 * Arg[0-6], Local[0-7], Index_op, Name_op, Zero_op, One_op, Ones_op, Debug_op
355 typedef struct /* Reference - Local object type */
357 ACPI_OBJECT_COMMON_HEADER
359 u8 target_type; /* Used for Index_op */
360 u16 op_code;
361 u32 offset; /* Used for Arg_op, Local_op, and Index_op */
363 void *object; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */
364 ACPI_NAMESPACE_NODE *node;
365 union acpi_operand_obj **where;
367 } ACPI_OBJECT_REFERENCE;
371 * Extra object is used as additional storage for types that
372 * have AML code in their declarations (Term_args) that must be
373 * evaluated at run time.
375 * Currently: Region and Field_unit types
378 typedef struct /* EXTRA */
380 ACPI_OBJECT_COMMON_HEADER
381 u8 byte_fill1;
382 u16 word_fill1;
383 u32 pcode_length;
384 u8 *pcode;
385 ACPI_NAMESPACE_NODE *method_REG; /* _REG method for this region (if any) */
386 void *region_context; /* Region-specific data */
388 } ACPI_OBJECT_EXTRA;
391 /******************************************************************************
393 * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
395 *****************************************************************************/
397 typedef union acpi_operand_obj
399 ACPI_OBJECT_COMMON common;
400 ACPI_OBJECT_CACHE_LIST cache;
401 ACPI_OBJECT_NUMBER number;
402 ACPI_OBJECT_STRING string;
403 ACPI_OBJECT_BUFFER buffer;
404 ACPI_OBJECT_PACKAGE package;
405 ACPI_OBJECT_FIELD_UNIT field_unit;
406 ACPI_OBJECT_DEVICE device;
407 ACPI_OBJECT_EVENT event;
408 ACPI_OBJECT_METHOD method;
409 ACPI_OBJECT_MUTEX mutex;
410 ACPI_OBJECT_REGION region;
411 ACPI_OBJECT_POWER_RESOURCE power_resource;
412 ACPI_OBJECT_PROCESSOR processor;
413 ACPI_OBJECT_THERMAL_ZONE thermal_zone;
414 ACPI_OBJECT_FIELD field;
415 ACPI_OBJECT_BANK_FIELD bank_field;
416 ACPI_OBJECT_INDEX_FIELD index_field;
417 ACPI_OBJECT_REFERENCE reference;
418 ACPI_OBJECT_NOTIFY_HANDLER notify_handler;
419 ACPI_OBJECT_ADDR_HANDLER addr_handler;
420 ACPI_OBJECT_EXTRA extra;
422 } ACPI_OPERAND_OBJECT;
424 #endif /* _ACOBJECT_H */