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 /* 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 */\
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*/\
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 */\
88 /******************************************************************************
90 * Individual Object Descriptors
92 *****************************************************************************/
95 typedef struct /* COMMON */
97 ACPI_OBJECT_COMMON_HEADER
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
116 } ACPI_OBJECT_INTEGER
;
119 typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
121 ACPI_OBJECT_COMMON_HEADER
124 NATIVE_CHAR
*pointer
; /* String value in AML stream or in allocated space */
126 } ACPI_OBJECT_STRING
;
129 typedef struct /* BUFFER - has length and pointer - not null terminated */
131 ACPI_OBJECT_COMMON_HEADER
134 u8
*pointer
; /* points to the buffer in allocated space */
136 } ACPI_OBJECT_BUFFER
;
139 typedef struct /* PACKAGE - has count, elements, next element */
141 ACPI_OBJECT_COMMON_HEADER
143 u32 count
; /* # of elements in package */
145 union acpi_operand_obj
**elements
; /* Array of pointers to Acpi_objects */
146 union acpi_operand_obj
**next_element
; /* used only while initializing */
148 } ACPI_OBJECT_PACKAGE
;
151 typedef struct /* FIELD UNIT */
153 ACPI_OBJECT_COMMON_HEADER
155 ACPI_COMMON_FIELD_INFO
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) */
161 } ACPI_OBJECT_FIELD_UNIT
;
164 typedef struct /* DEVICE - has handle and notification handler/context */
166 ACPI_OBJECT_COMMON_HEADER
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 */
172 } ACPI_OBJECT_DEVICE
;
175 typedef struct /* EVENT */
177 ACPI_OBJECT_COMMON_HEADER
183 #define INFINITE_CONCURRENCY 0xFF
185 typedef struct /* METHOD */
187 ACPI_OBJECT_COMMON_HEADER
198 ACPI_OWNER_ID owning_id
;
200 } ACPI_OBJECT_METHOD
;
203 typedef struct acpi_obj_mutex
/* MUTEX */
205 ACPI_OBJECT_COMMON_HEADER
207 u16 acquisition_depth
;
211 union acpi_operand_obj
*prev
; /* Link for list of acquired mutexes */
212 union acpi_operand_obj
*next
; /* Link for list of acquired mutexes */
217 typedef struct /* REGION */
219 ACPI_OBJECT_COMMON_HEADER
223 ACPI_PHYSICAL_ADDRESS address
;
224 union acpi_operand_obj
*extra
; /* Pointer to executable AML (in region definition) */
226 union acpi_operand_obj
*addr_handler
; /* Handler for system notifies */
227 ACPI_NAMESPACE_NODE
*node
; /* containing object */
228 union acpi_operand_obj
*next
;
230 } ACPI_OBJECT_REGION
;
233 typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
235 ACPI_OBJECT_COMMON_HEADER
240 union acpi_operand_obj
*sys_handler
; /* Handler for system notifies */
241 union acpi_operand_obj
*drv_handler
; /* Handler for driver notifies */
243 } ACPI_OBJECT_POWER_RESOURCE
;
246 typedef struct /* PROCESSOR - has Handle and notification handler/context*/
248 ACPI_OBJECT_COMMON_HEADER
252 ACPI_IO_ADDRESS address
;
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 */
258 } ACPI_OBJECT_PROCESSOR
;
261 typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
263 ACPI_OBJECT_COMMON_HEADER
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 */
269 } ACPI_OBJECT_THERMAL_ZONE
;
277 typedef struct /* FIELD */
279 ACPI_OBJECT_COMMON_HEADER
281 ACPI_COMMON_FIELD_INFO
283 union acpi_operand_obj
*container
; /* Containing object */
288 typedef struct /* BANK FIELD */
290 ACPI_OBJECT_COMMON_HEADER
292 ACPI_COMMON_FIELD_INFO
293 u32 value
; /* Value to store into Bank_select */
295 ACPI_HANDLE bank_select
; /* Bank select register */
296 union acpi_operand_obj
*container
; /* Containing object */
298 } ACPI_OBJECT_BANK_FIELD
;
301 typedef struct /* INDEX FIELD */
304 * No container pointer needed since the index and data register definitions
305 * will define how to access the respective registers
307 ACPI_OBJECT_COMMON_HEADER
309 ACPI_COMMON_FIELD_INFO
310 u32 value
; /* Value to store into Index register */
312 ACPI_HANDLE index
; /* Index register */
313 ACPI_HANDLE data
; /* Data register */
315 } ACPI_OBJECT_INDEX_FIELD
;
318 typedef struct /* NOTIFY HANDLER */
320 ACPI_OBJECT_COMMON_HEADER
322 ACPI_NAMESPACE_NODE
*node
; /* Parent device */
323 NOTIFY_HANDLER handler
;
326 } ACPI_OBJECT_NOTIFY_HANDLER
;
329 /* Flags for address handler */
331 #define ADDR_HANDLER_DEFAULT_INSTALLED 0x1
334 typedef struct /* ADDRESS HANDLER */
336 ACPI_OBJECT_COMMON_HEADER
340 ADDRESS_SPACE_HANDLER handler
;
342 ACPI_NAMESPACE_NODE
*node
; /* Parent device */
344 ADDRESS_SPACE_SETUP setup
;
345 union acpi_operand_obj
*region_list
; /* regions using this handler */
346 union acpi_operand_obj
*next
;
348 } ACPI_OBJECT_ADDR_HANDLER
;
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
356 typedef struct /* Reference - Local object type */
358 ACPI_OBJECT_COMMON_HEADER
360 u8 target_type
; /* Used for Index_op */
362 u32 offset
; /* Used for Arg_op, Local_op, and Index_op */
364 void *object
; /* Name_op=>HANDLE to obj, Index_op=>ACPI_OPERAND_OBJECT */
365 ACPI_NAMESPACE_NODE
*node
;
366 union acpi_operand_obj
**where
;
368 } ACPI_OBJECT_REFERENCE
;
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.
376 * Currently: Region and Field_unit types
379 typedef struct /* EXTRA */
381 ACPI_OBJECT_COMMON_HEADER
386 ACPI_NAMESPACE_NODE
*method_REG
; /* _REG method for this region (if any) */
387 void *region_context
; /* Region-specific data */
392 /******************************************************************************
394 * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
396 *****************************************************************************/
398 typedef union acpi_operand_obj
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
;
423 } ACPI_OPERAND_OBJECT
;
425 #endif /* _ACOBJECT_H */