2 /******************************************************************************
4 * Name: acobject.h - Definition of acpi_operand_object (Internal object only)
7 *****************************************************************************/
10 * Copyright (C) 2000, 2001 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
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 /******************************************************************************
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 /* SIZE/ALIGNMENT: 32-bits plus trailing 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 */\
67 /* Defines for flag byte above */
69 #define AOPOBJ_STATIC_ALLOCATION 0x1
70 #define AOPOBJ_STATIC_POINTER 0x2
71 #define AOPOBJ_DATA_VALID 0x4
72 #define AOPOBJ_ZERO_CONST 0x4
73 #define AOPOBJ_INITIALIZED 0x8
77 * Common bitfield for the field objects
78 * "Field Datum" -- a datum from the actual field object
79 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
81 #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
83 u16 bit_length; /* Length of field in bits */\
84 u32 base_byte_offset; /* Byte offset within containing object */\
85 u8 access_bit_width; /* Read/Write size in bits (from ASL Access_type)*/\
86 u8 access_byte_width; /* Read/Write size in bytes */\
87 u8 update_rule; /* How neighboring field bits are handled */\
88 u8 lock_rule; /* Global Lock: 1 = "Must Lock" */\
89 u8 start_field_bit_offset;/* Bit offset within first field datum (0-63) */\
90 u8 datum_valid_bits; /* Valid bit in first "Field datum" */\
91 u8 end_field_valid_bits; /* Valid bits in the last "field datum" */\
92 u8 end_buffer_valid_bits; /* Valid bits in the last "buffer datum" */\
93 u32 value; /* Value to store into the Bank or Index register */
96 /* Access flag bits */
98 #define AFIELD_SINGLE_DATUM 0x1
102 * Fields common to both Strings and Buffers
104 #define ACPI_COMMON_BUFFER_INFO \
108 /******************************************************************************
110 * Individual Object Descriptors
112 *****************************************************************************/
115 typedef struct /* COMMON */
117 ACPI_OBJECT_COMMON_HEADER
119 } ACPI_OBJECT_COMMON;
122 typedef struct /* CACHE_LIST */
124 ACPI_OBJECT_COMMON_HEADER
125 union acpi_operand_obj *next; /* Link for object cache and internal lists*/
127 } ACPI_OBJECT_CACHE_LIST;
130 typedef struct /* NUMBER - has value */
132 ACPI_OBJECT_COMMON_HEADER
136 } ACPI_OBJECT_INTEGER;
139 typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
141 ACPI_OBJECT_COMMON_HEADER
142 ACPI_COMMON_BUFFER_INFO
143 NATIVE_CHAR *pointer; /* String value in AML stream or in allocated space */
145 } ACPI_OBJECT_STRING;
148 typedef struct /* BUFFER - has length and pointer - not null terminated */
150 ACPI_OBJECT_COMMON_HEADER
151 ACPI_COMMON_BUFFER_INFO
152 u8 *pointer; /* Buffer value in AML stream or in allocated space */
154 } ACPI_OBJECT_BUFFER;
157 typedef struct /* PACKAGE - has count, elements, next element */
159 ACPI_OBJECT_COMMON_HEADER
161 u32 count; /* # of elements in package */
162 union acpi_operand_obj **elements; /* Array of pointers to Acpi_objects */
163 union acpi_operand_obj **next_element; /* used only while initializing */
165 } ACPI_OBJECT_PACKAGE;
168 typedef struct /* DEVICE - has handle and notification handler/context */
170 ACPI_OBJECT_COMMON_HEADER
172 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
173 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
174 union acpi_operand_obj *addr_handler; /* Handler for Address space */
176 } ACPI_OBJECT_DEVICE;
179 typedef struct /* EVENT */
181 ACPI_OBJECT_COMMON_HEADER
187 #define INFINITE_CONCURRENCY 0xFF
189 typedef struct /* METHOD */
191 ACPI_OBJECT_COMMON_HEADER
202 acpi_owner_id owning_id;
204 } ACPI_OBJECT_METHOD;
207 typedef struct acpi_obj_mutex /* MUTEX */
209 ACPI_OBJECT_COMMON_HEADER
211 u16 acquisition_depth;
215 union acpi_operand_obj *prev; /* Link for list of acquired mutexes */
216 union acpi_operand_obj *next; /* Link for list of acquired mutexes */
221 typedef struct /* REGION */
223 ACPI_OBJECT_COMMON_HEADER
227 ACPI_PHYSICAL_ADDRESS address;
228 union acpi_operand_obj *extra; /* Pointer to executable AML (in region definition) */
230 union acpi_operand_obj *addr_handler; /* Handler for system notifies */
231 acpi_namespace_node *node; /* containing object */
232 union acpi_operand_obj *next;
234 } ACPI_OBJECT_REGION;
237 typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
239 ACPI_OBJECT_COMMON_HEADER
244 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
245 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
247 } ACPI_OBJECT_POWER_RESOURCE;
250 typedef struct /* PROCESSOR - has Handle and notification handler/context*/
252 ACPI_OBJECT_COMMON_HEADER
256 ACPI_IO_ADDRESS address;
258 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
259 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
260 union acpi_operand_obj *addr_handler; /* Handler for Address space */
262 } ACPI_OBJECT_PROCESSOR;
265 typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
267 ACPI_OBJECT_COMMON_HEADER
269 union acpi_operand_obj *sys_handler; /* Handler for system notifies */
270 union acpi_operand_obj *drv_handler; /* Handler for driver notifies */
271 union acpi_operand_obj *addr_handler; /* Handler for Address space */
273 } ACPI_OBJECT_THERMAL_ZONE;
277 * Fields. All share a common header/info field.
280 typedef struct /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
282 ACPI_OBJECT_COMMON_HEADER
283 ACPI_COMMON_FIELD_INFO
284 union acpi_operand_obj *region_obj; /* Containing Operation Region object */
285 /* (REGION/BANK fields only) */
286 } ACPI_OBJECT_FIELD_COMMON;
289 typedef struct /* REGION FIELD */
291 ACPI_OBJECT_COMMON_HEADER
292 ACPI_COMMON_FIELD_INFO
293 union acpi_operand_obj *region_obj; /* Containing Op_region object */
295 } ACPI_OBJECT_REGION_FIELD;
298 typedef struct /* BANK FIELD */
300 ACPI_OBJECT_COMMON_HEADER
301 ACPI_COMMON_FIELD_INFO
303 union acpi_operand_obj *region_obj; /* Containing Op_region object */
304 union acpi_operand_obj *bank_register_obj; /* Bank_select Register object */
306 } ACPI_OBJECT_BANK_FIELD;
309 typedef struct /* INDEX FIELD */
311 ACPI_OBJECT_COMMON_HEADER
312 ACPI_COMMON_FIELD_INFO
315 * No "Region_obj" pointer needed since the Index and Data registers
316 * are each field definitions unto themselves.
318 union acpi_operand_obj *index_obj; /* Index register */
319 union acpi_operand_obj *data_obj; /* Data register */
322 } ACPI_OBJECT_INDEX_FIELD;
325 /* The Buffer_field is different in that it is part of a Buffer, not an Op_region */
327 typedef struct /* BUFFER FIELD */
329 ACPI_OBJECT_COMMON_HEADER
330 ACPI_COMMON_FIELD_INFO
332 union acpi_operand_obj *extra; /* Pointer to executable AML (in field definition) */
333 acpi_namespace_node *node; /* Parent (containing) object node */
334 union acpi_operand_obj *buffer_obj; /* Containing Buffer object */
336 } ACPI_OBJECT_BUFFER_FIELD;
343 typedef struct /* NOTIFY HANDLER */
345 ACPI_OBJECT_COMMON_HEADER
347 acpi_namespace_node *node; /* Parent device */
348 acpi_notify_handler handler;
351 } ACPI_OBJECT_NOTIFY_HANDLER;
354 /* Flags for address handler */
356 #define ADDR_HANDLER_DEFAULT_INSTALLED 0x1
359 typedef struct /* ADDRESS HANDLER */
361 ACPI_OBJECT_COMMON_HEADER
365 acpi_adr_space_handler handler;
367 acpi_namespace_node *node; /* Parent device */
369 acpi_adr_space_setup setup;
370 union acpi_operand_obj *region_list; /* regions using this handler */
371 union acpi_operand_obj *next;
373 } ACPI_OBJECT_ADDR_HANDLER;
377 * The Reference object type is used for these opcodes:
378 * Arg[0-6], Local[0-7], Index_op, Name_op, Zero_op, One_op, Ones_op, Debug_op
381 typedef struct /* Reference - Local object type */
383 ACPI_OBJECT_COMMON_HEADER
385 u8 target_type; /* Used for Index_op */
387 u32 offset; /* Used for Arg_op, Local_op, and Index_op */
389 void *object; /* Name_op=>HANDLE to obj, Index_op=>acpi_operand_object */
390 acpi_namespace_node *node;
391 union acpi_operand_obj **where;
393 } ACPI_OBJECT_REFERENCE;
397 * Extra object is used as additional storage for types that
398 * have AML code in their declarations (Term_args) that must be
399 * evaluated at run time.
401 * Currently: Region and Field_unit types
404 typedef struct /* EXTRA */
406 ACPI_OBJECT_COMMON_HEADER
411 acpi_namespace_node *method_REG; /* _REG method for this region (if any) */
412 void *region_context; /* Region-specific data */
417 /******************************************************************************
419 * acpi_operand_object Descriptor - a giant union of all of the above
421 *****************************************************************************/
423 typedef union acpi_operand_obj
425 ACPI_OBJECT_COMMON common;
426 ACPI_OBJECT_CACHE_LIST cache;
427 ACPI_OBJECT_INTEGER integer;
428 ACPI_OBJECT_STRING string;
429 ACPI_OBJECT_BUFFER buffer;
430 ACPI_OBJECT_PACKAGE package;
431 ACPI_OBJECT_BUFFER_FIELD buffer_field;
432 ACPI_OBJECT_DEVICE device;
433 ACPI_OBJECT_EVENT event;
434 ACPI_OBJECT_METHOD method;
435 ACPI_OBJECT_MUTEX mutex;
436 ACPI_OBJECT_REGION region;
437 ACPI_OBJECT_POWER_RESOURCE power_resource;
438 ACPI_OBJECT_PROCESSOR processor;
439 ACPI_OBJECT_THERMAL_ZONE thermal_zone;
440 ACPI_OBJECT_FIELD_COMMON common_field;
441 ACPI_OBJECT_REGION_FIELD field;
442 ACPI_OBJECT_BANK_FIELD bank_field;
443 ACPI_OBJECT_INDEX_FIELD index_field;
444 ACPI_OBJECT_REFERENCE reference;
445 ACPI_OBJECT_NOTIFY_HANDLER notify_handler;
446 ACPI_OBJECT_ADDR_HANDLER addr_handler;
447 ACPI_OBJECT_EXTRA extra;
449 } acpi_operand_object;
451 #endif /* _ACOBJECT_H */