2 /******************************************************************************
4 * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
7 *****************************************************************************/
9 /******************************************************************************
13 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
14 * All rights reserved.
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights. You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code. No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
39 * The above copyright and patent license is granted only if the following
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision. In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change. Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee. Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
57 * Redistribution of source code of any substantial portion of the Covered
58 * Code or modification without rights to further distribute source must
59 * include the following Disclaimer and Export Compliance provision in the
60 * documentation and/or other materials provided with distribution. In
61 * addition, Licensee may not authorize further sublicense of source of any
62 * portion of the Covered Code, and must include terms to the effect that the
63 * license from Licensee to its licensee is limited to the intellectual
64 * property embodied in the software Licensee provides to its licensee, and
65 * not to intellectual property embodied in modifications its licensee may
68 * 3.3. Redistribution of Executable. Redistribution in executable form of any
69 * substantial portion of the Covered Code or modification must reproduce the
70 * above Copyright Notice, and the following Disclaimer and Export Compliance
71 * provision in the documentation and/or other materials provided with the
74 * 3.4. Intel retains all right, title, and interest in and to the Original
77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78 * Intel shall be used in advertising or otherwise to promote the sale, use or
79 * other dealings in products derived from or relating to the Covered Code
80 * without prior written authorization from Intel.
82 * 4. Disclaimer and Export Compliance
84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
101 * 4.3. Licensee shall not export, either directly or indirectly, any of this
102 * software or system incorporating such software without first obtaining any
103 * required license or other approval from the U. S. Department of Commerce or
104 * any other agency or department of the United States Government. In the
105 * event Licensee exports any such software from the United States or
106 * re-exports any such software from a foreign destination, Licensee shall
107 * ensure that the distribution and export/re-export of the software is in
108 * compliance with all laws, regulations, orders, or other restrictions of the
109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110 * any of its subsidiaries will export/re-export any technical data, process,
111 * software, or service, directly or indirectly, to any country for which the
112 * United States government or any agency thereof requires an export license,
113 * other governmental approval, or letter of assurance, without first obtaining
114 * such license, approval or letter.
116 *****************************************************************************/
123 * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
124 * to the interpreter, and to keep track of the various handlers such as
125 * address space handlers and notify handlers. The object is a constant
126 * size in order to allow it to be cached and reused.
129 /*******************************************************************************
133 ******************************************************************************/
136 * Common area for all objects.
138 * DataType is used to differentiate between internal descriptors, and MUST
139 * be the first byte in this structure.
141 #define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
142 UINT8 Descriptor; /* To differentiate various internal objs */\
143 UINT8 Type; /* ACPI_OBJECT_TYPE */\
144 UINT16 ReferenceCount; /* For object deletion management */\
145 union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
148 /* Values for flag byte above */
150 #define AOPOBJ_AML_CONSTANT 0x01
151 #define AOPOBJ_STATIC_POINTER 0x02
152 #define AOPOBJ_DATA_VALID 0x04
153 #define AOPOBJ_OBJECT_INITIALIZED 0x08
154 #define AOPOBJ_SETUP_COMPLETE 0x10
155 #define AOPOBJ_SINGLE_DATUM 0x20
159 * Common bitfield for the field objects
160 * "Field Datum" -- a datum from the actual field object
161 * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
163 #define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
164 UINT8 FieldFlags; /* Access, update, and lock bits */\
165 UINT8 Attribute; /* From AccessAs keyword */\
166 UINT8 AccessByteWidth; /* Read/Write size in bytes */\
167 UINT32 BitLength; /* Length of field in bits */\
168 UINT32 BaseByteOffset; /* Byte offset within containing object */\
169 UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
170 UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */\
171 UINT32 Value; /* Value to store into the Bank or Index register */\
172 ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
176 * Fields common to both Strings and Buffers
178 #define ACPI_COMMON_BUFFER_INFO \
183 * Common fields for objects that support ASL notifications
185 #define ACPI_COMMON_NOTIFY_INFO \
186 union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
187 union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
188 union acpi_operand_object *Handler; /* Handler for Address space */
191 /******************************************************************************
195 *****************************************************************************/
197 typedef struct acpi_object_common
199 ACPI_OBJECT_COMMON_HEADER
201 } ACPI_OBJECT_COMMON;
204 typedef struct acpi_object_integer
206 ACPI_OBJECT_COMMON_HEADER
209 } ACPI_OBJECT_INTEGER;
212 * Note: The String and Buffer object must be identical through the Pointer
213 * element. There is code that depends on this.
215 typedef struct acpi_object_string /* Null terminated, ASCII characters only */
217 ACPI_OBJECT_COMMON_HEADER
218 ACPI_COMMON_BUFFER_INFO
219 char *Pointer; /* String in AML stream or allocated string */
221 } ACPI_OBJECT_STRING;
224 typedef struct acpi_object_buffer
226 ACPI_OBJECT_COMMON_HEADER
227 ACPI_COMMON_BUFFER_INFO
228 UINT8 *Pointer; /* Buffer in AML stream or allocated buffer */
229 ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
233 } ACPI_OBJECT_BUFFER;
236 typedef struct acpi_object_package
238 ACPI_OBJECT_COMMON_HEADER
240 UINT32 Count; /* # of elements in package */
243 ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
244 union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */
246 } ACPI_OBJECT_PACKAGE;
249 /******************************************************************************
253 *****************************************************************************/
255 typedef struct acpi_object_event
257 ACPI_OBJECT_COMMON_HEADER
263 #define ACPI_INFINITE_CONCURRENCY 0xFF
266 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
267 struct acpi_walk_state *WalkState);
269 typedef struct acpi_object_method
271 ACPI_OBJECT_COMMON_HEADER
277 ACPI_INTERNAL_METHOD Implementation;
280 ACPI_OWNER_ID OwningId;
282 } ACPI_OBJECT_METHOD;
285 typedef struct acpi_object_mutex
287 ACPI_OBJECT_COMMON_HEADER
288 UINT8 SyncLevel; /* 0-15, specified in Mutex() call */
289 UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */
290 struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */
291 void *Semaphore; /* Actual OS synchronization object */
292 union acpi_operand_object *Prev; /* Link for list of acquired mutexes */
293 union acpi_operand_object *Next; /* Link for list of acquired mutexes */
294 ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
295 UINT8 OriginalSyncLevel; /* Owner's original sync level (0-15) */
300 typedef struct acpi_object_region
302 ACPI_OBJECT_COMMON_HEADER
305 union acpi_operand_object *Handler; /* Handler for region access */
306 ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
307 union acpi_operand_object *Next;
309 ACPI_PHYSICAL_ADDRESS Address;
311 } ACPI_OBJECT_REGION;
314 /******************************************************************************
316 * Objects that can be notified. All share a common NotifyInfo area.
318 *****************************************************************************/
320 typedef struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
322 ACPI_OBJECT_COMMON_HEADER
323 ACPI_COMMON_NOTIFY_INFO
325 } ACPI_OBJECT_NOTIFY_COMMON;
328 typedef struct acpi_object_device
330 ACPI_OBJECT_COMMON_HEADER
331 ACPI_COMMON_NOTIFY_INFO
332 ACPI_GPE_BLOCK_INFO *GpeBlock;
334 } ACPI_OBJECT_DEVICE;
337 typedef struct acpi_object_power_resource
339 ACPI_OBJECT_COMMON_HEADER
340 ACPI_COMMON_NOTIFY_INFO
342 UINT32 ResourceOrder;
344 } ACPI_OBJECT_POWER_RESOURCE;
347 typedef struct acpi_object_processor
349 ACPI_OBJECT_COMMON_HEADER
350 ACPI_COMMON_NOTIFY_INFO
353 ACPI_IO_ADDRESS Address;
355 } ACPI_OBJECT_PROCESSOR;
358 typedef struct acpi_object_thermal_zone
360 ACPI_OBJECT_COMMON_HEADER
361 ACPI_COMMON_NOTIFY_INFO
363 } ACPI_OBJECT_THERMAL_ZONE;
366 /******************************************************************************
368 * Fields. All share a common header/info field.
370 *****************************************************************************/
372 typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
374 ACPI_OBJECT_COMMON_HEADER
375 ACPI_COMMON_FIELD_INFO
376 union acpi_operand_object *RegionObj; /* Containing Operation Region object */
377 /* (REGION/BANK fields only) */
378 } ACPI_OBJECT_FIELD_COMMON;
381 typedef struct acpi_object_region_field
383 ACPI_OBJECT_COMMON_HEADER
384 ACPI_COMMON_FIELD_INFO
385 union acpi_operand_object *RegionObj; /* Containing OpRegion object */
387 } ACPI_OBJECT_REGION_FIELD;
390 typedef struct acpi_object_bank_field
392 ACPI_OBJECT_COMMON_HEADER
393 ACPI_COMMON_FIELD_INFO
394 union acpi_operand_object *RegionObj; /* Containing OpRegion object */
395 union acpi_operand_object *BankObj; /* BankSelect Register object */
397 } ACPI_OBJECT_BANK_FIELD;
400 typedef struct acpi_object_index_field
402 ACPI_OBJECT_COMMON_HEADER
403 ACPI_COMMON_FIELD_INFO
406 * No "RegionObj" pointer needed since the Index and Data registers
407 * are each field definitions unto themselves.
409 union acpi_operand_object *IndexObj; /* Index register */
410 union acpi_operand_object *DataObj; /* Data register */
412 } ACPI_OBJECT_INDEX_FIELD;
415 /* The BufferField is different in that it is part of a Buffer, not an OpRegion */
417 typedef struct acpi_object_buffer_field
419 ACPI_OBJECT_COMMON_HEADER
420 ACPI_COMMON_FIELD_INFO
421 union acpi_operand_object *BufferObj; /* Containing Buffer object */
423 } ACPI_OBJECT_BUFFER_FIELD;
426 /******************************************************************************
428 * Objects for handlers
430 *****************************************************************************/
432 typedef struct acpi_object_notify_handler
434 ACPI_OBJECT_COMMON_HEADER
435 ACPI_NAMESPACE_NODE *Node; /* Parent device */
436 ACPI_NOTIFY_HANDLER Handler;
439 } ACPI_OBJECT_NOTIFY_HANDLER;
442 /* Flags for address handler */
444 #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
447 typedef struct acpi_object_addr_handler
449 ACPI_OBJECT_COMMON_HEADER
452 ACPI_ADR_SPACE_HANDLER Handler;
453 ACPI_NAMESPACE_NODE *Node; /* Parent device */
455 ACPI_ADR_SPACE_SETUP Setup;
456 union acpi_operand_object *RegionList; /* regions using this handler */
457 union acpi_operand_object *Next;
459 } ACPI_OBJECT_ADDR_HANDLER;
462 /******************************************************************************
464 * Special internal objects
466 *****************************************************************************/
469 * The Reference object type is used for these opcodes:
470 * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp
472 typedef struct acpi_object_reference
474 ACPI_OBJECT_COMMON_HEADER
475 UINT8 TargetType; /* Used for IndexOp */
477 UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */
478 void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
479 ACPI_NAMESPACE_NODE *Node;
480 union acpi_operand_object **Where;
482 } ACPI_OBJECT_REFERENCE;
486 * Extra object is used as additional storage for types that
487 * have AML code in their declarations (TermArgs) that must be
488 * evaluated at run time.
490 * Currently: Region and FieldUnit types
492 typedef struct acpi_object_extra
494 ACPI_OBJECT_COMMON_HEADER
499 ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */
500 void *RegionContext; /* Region-specific data */
505 /* Additional data that can be attached to namespace nodes */
507 typedef struct acpi_object_data
509 ACPI_OBJECT_COMMON_HEADER
510 ACPI_OBJECT_HANDLER Handler;
516 /* Structure used when objects are cached for reuse */
518 typedef struct acpi_object_cache_list
520 ACPI_OBJECT_COMMON_HEADER
521 union acpi_operand_object *Next; /* Link for object cache and internal lists*/
523 } ACPI_OBJECT_CACHE_LIST;
526 /******************************************************************************
528 * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
530 *****************************************************************************/
532 typedef union acpi_operand_object
534 ACPI_OBJECT_COMMON Common;
535 ACPI_OBJECT_INTEGER Integer;
536 ACPI_OBJECT_STRING String;
537 ACPI_OBJECT_BUFFER Buffer;
538 ACPI_OBJECT_PACKAGE Package;
539 ACPI_OBJECT_EVENT Event;
540 ACPI_OBJECT_METHOD Method;
541 ACPI_OBJECT_MUTEX Mutex;
542 ACPI_OBJECT_REGION Region;
543 ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
544 ACPI_OBJECT_DEVICE Device;
545 ACPI_OBJECT_POWER_RESOURCE PowerResource;
546 ACPI_OBJECT_PROCESSOR Processor;
547 ACPI_OBJECT_THERMAL_ZONE ThermalZone;
548 ACPI_OBJECT_FIELD_COMMON CommonField;
549 ACPI_OBJECT_REGION_FIELD Field;
550 ACPI_OBJECT_BUFFER_FIELD BufferField;
551 ACPI_OBJECT_BANK_FIELD BankField;
552 ACPI_OBJECT_INDEX_FIELD IndexField;
553 ACPI_OBJECT_NOTIFY_HANDLER Notify;
554 ACPI_OBJECT_ADDR_HANDLER AddressSpace;
555 ACPI_OBJECT_REFERENCE Reference;
556 ACPI_OBJECT_EXTRA Extra;
557 ACPI_OBJECT_DATA Data;
558 ACPI_OBJECT_CACHE_LIST Cache;
560 } ACPI_OPERAND_OBJECT;
563 /******************************************************************************
565 * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
567 *****************************************************************************/
570 /* Object descriptor types */
572 #define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
573 #define ACPI_DESC_TYPE_STATE 0x02
574 #define ACPI_DESC_TYPE_STATE_UPDATE 0x03
575 #define ACPI_DESC_TYPE_STATE_PACKAGE 0x04
576 #define ACPI_DESC_TYPE_STATE_CONTROL 0x05
577 #define ACPI_DESC_TYPE_STATE_RPSCOPE 0x06
578 #define ACPI_DESC_TYPE_STATE_PSCOPE 0x07
579 #define ACPI_DESC_TYPE_STATE_WSCOPE 0x08
580 #define ACPI_DESC_TYPE_STATE_RESULT 0x09
581 #define ACPI_DESC_TYPE_STATE_NOTIFY 0x0A
582 #define ACPI_DESC_TYPE_STATE_THREAD 0x0B
583 #define ACPI_DESC_TYPE_WALK 0x0C
584 #define ACPI_DESC_TYPE_PARSER 0x0D
585 #define ACPI_DESC_TYPE_OPERAND 0x0E
586 #define ACPI_DESC_TYPE_NAMED 0x0F
587 #define ACPI_DESC_TYPE_MAX 0x0F
590 typedef union acpi_descriptor
592 UINT8 DescriptorId; /* To differentiate various internal objs */\
593 ACPI_OPERAND_OBJECT Object;
594 ACPI_NAMESPACE_NODE Node;
595 ACPI_PARSE_OBJECT Op;
600 #endif /* _ACOBJECT_H */