xref: /freebsd/sys/contrib/dev/acpica/include/acobject.h (revision a88e22b7ad0a8400875be9c3d02d09d0a8010b9c)
1a9f12690SJung-uk Kim 
2a9f12690SJung-uk Kim /******************************************************************************
3a9f12690SJung-uk Kim  *
4a9f12690SJung-uk Kim  * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
5a9f12690SJung-uk Kim  *
6a9f12690SJung-uk Kim  *****************************************************************************/
7a9f12690SJung-uk Kim 
8a9f12690SJung-uk Kim /******************************************************************************
9a9f12690SJung-uk Kim  *
10a9f12690SJung-uk Kim  * 1. Copyright Notice
11a9f12690SJung-uk Kim  *
129a179dd8SJung-uk Kim  * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
13a9f12690SJung-uk Kim  * All rights reserved.
14a9f12690SJung-uk Kim  *
15a9f12690SJung-uk Kim  * 2. License
16a9f12690SJung-uk Kim  *
17a9f12690SJung-uk Kim  * 2.1. This is your license from Intel Corp. under its intellectual property
18a9f12690SJung-uk Kim  * rights.  You may have additional license terms from the party that provided
19a9f12690SJung-uk Kim  * you this software, covering your right to use that party's intellectual
20a9f12690SJung-uk Kim  * property rights.
21a9f12690SJung-uk Kim  *
22a9f12690SJung-uk Kim  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
23a9f12690SJung-uk Kim  * copy of the source code appearing in this file ("Covered Code") an
24a9f12690SJung-uk Kim  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
25a9f12690SJung-uk Kim  * base code distributed originally by Intel ("Original Intel Code") to copy,
26a9f12690SJung-uk Kim  * make derivatives, distribute, use and display any portion of the Covered
27a9f12690SJung-uk Kim  * Code in any form, with the right to sublicense such rights; and
28a9f12690SJung-uk Kim  *
29a9f12690SJung-uk Kim  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
30a9f12690SJung-uk Kim  * license (with the right to sublicense), under only those claims of Intel
31a9f12690SJung-uk Kim  * patents that are infringed by the Original Intel Code, to make, use, sell,
32a9f12690SJung-uk Kim  * offer to sell, and import the Covered Code and derivative works thereof
33a9f12690SJung-uk Kim  * solely to the minimum extent necessary to exercise the above copyright
34a9f12690SJung-uk Kim  * license, and in no event shall the patent license extend to any additions
35a9f12690SJung-uk Kim  * to or modifications of the Original Intel Code.  No other license or right
36a9f12690SJung-uk Kim  * is granted directly or by implication, estoppel or otherwise;
37a9f12690SJung-uk Kim  *
38a9f12690SJung-uk Kim  * The above copyright and patent license is granted only if the following
39a9f12690SJung-uk Kim  * conditions are met:
40a9f12690SJung-uk Kim  *
41a9f12690SJung-uk Kim  * 3. Conditions
42a9f12690SJung-uk Kim  *
43a9f12690SJung-uk Kim  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
44a9f12690SJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
45a9f12690SJung-uk Kim  * Code or modification with rights to further distribute source must include
46a9f12690SJung-uk Kim  * the above Copyright Notice, the above License, this list of Conditions,
47a9f12690SJung-uk Kim  * and the following Disclaimer and Export Compliance provision.  In addition,
48a9f12690SJung-uk Kim  * Licensee must cause all Covered Code to which Licensee contributes to
49a9f12690SJung-uk Kim  * contain a file documenting the changes Licensee made to create that Covered
50a9f12690SJung-uk Kim  * Code and the date of any change.  Licensee must include in that file the
51a9f12690SJung-uk Kim  * documentation of any changes made by any predecessor Licensee.  Licensee
52a9f12690SJung-uk Kim  * must include a prominent statement that the modification is derived,
53a9f12690SJung-uk Kim  * directly or indirectly, from Original Intel Code.
54a9f12690SJung-uk Kim  *
55a9f12690SJung-uk Kim  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
56a9f12690SJung-uk Kim  * Redistribution of source code of any substantial portion of the Covered
57a9f12690SJung-uk Kim  * Code or modification without rights to further distribute source must
58a9f12690SJung-uk Kim  * include the following Disclaimer and Export Compliance provision in the
59a9f12690SJung-uk Kim  * documentation and/or other materials provided with distribution.  In
60a9f12690SJung-uk Kim  * addition, Licensee may not authorize further sublicense of source of any
61a9f12690SJung-uk Kim  * portion of the Covered Code, and must include terms to the effect that the
62a9f12690SJung-uk Kim  * license from Licensee to its licensee is limited to the intellectual
63a9f12690SJung-uk Kim  * property embodied in the software Licensee provides to its licensee, and
64a9f12690SJung-uk Kim  * not to intellectual property embodied in modifications its licensee may
65a9f12690SJung-uk Kim  * make.
66a9f12690SJung-uk Kim  *
67a9f12690SJung-uk Kim  * 3.3. Redistribution of Executable. Redistribution in executable form of any
68a9f12690SJung-uk Kim  * substantial portion of the Covered Code or modification must reproduce the
69a9f12690SJung-uk Kim  * above Copyright Notice, and the following Disclaimer and Export Compliance
70a9f12690SJung-uk Kim  * provision in the documentation and/or other materials provided with the
71a9f12690SJung-uk Kim  * distribution.
72a9f12690SJung-uk Kim  *
73a9f12690SJung-uk Kim  * 3.4. Intel retains all right, title, and interest in and to the Original
74a9f12690SJung-uk Kim  * Intel Code.
75a9f12690SJung-uk Kim  *
76a9f12690SJung-uk Kim  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
77a9f12690SJung-uk Kim  * Intel shall be used in advertising or otherwise to promote the sale, use or
78a9f12690SJung-uk Kim  * other dealings in products derived from or relating to the Covered Code
79a9f12690SJung-uk Kim  * without prior written authorization from Intel.
80a9f12690SJung-uk Kim  *
81a9f12690SJung-uk Kim  * 4. Disclaimer and Export Compliance
82a9f12690SJung-uk Kim  *
83a9f12690SJung-uk Kim  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
84a9f12690SJung-uk Kim  * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
85a9f12690SJung-uk Kim  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
86a9f12690SJung-uk Kim  * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
87a9f12690SJung-uk Kim  * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
88a9f12690SJung-uk Kim  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89a9f12690SJung-uk Kim  * PARTICULAR PURPOSE.
90a9f12690SJung-uk Kim  *
91a9f12690SJung-uk Kim  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92a9f12690SJung-uk Kim  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93a9f12690SJung-uk Kim  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94a9f12690SJung-uk Kim  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95a9f12690SJung-uk Kim  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96a9f12690SJung-uk Kim  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
97a9f12690SJung-uk Kim  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98a9f12690SJung-uk Kim  * LIMITED REMEDY.
99a9f12690SJung-uk Kim  *
100a9f12690SJung-uk Kim  * 4.3. Licensee shall not export, either directly or indirectly, any of this
101a9f12690SJung-uk Kim  * software or system incorporating such software without first obtaining any
102a9f12690SJung-uk Kim  * required license or other approval from the U. S. Department of Commerce or
103a9f12690SJung-uk Kim  * any other agency or department of the United States Government.  In the
104a9f12690SJung-uk Kim  * event Licensee exports any such software from the United States or
105a9f12690SJung-uk Kim  * re-exports any such software from a foreign destination, Licensee shall
106a9f12690SJung-uk Kim  * ensure that the distribution and export/re-export of the software is in
107a9f12690SJung-uk Kim  * compliance with all laws, regulations, orders, or other restrictions of the
108a9f12690SJung-uk Kim  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109a9f12690SJung-uk Kim  * any of its subsidiaries will export/re-export any technical data, process,
110a9f12690SJung-uk Kim  * software, or service, directly or indirectly, to any country for which the
111a9f12690SJung-uk Kim  * United States government or any agency thereof requires an export license,
112a9f12690SJung-uk Kim  * other governmental approval, or letter of assurance, without first obtaining
113a9f12690SJung-uk Kim  * such license, approval or letter.
114a9f12690SJung-uk Kim  *
115a9f12690SJung-uk Kim  *****************************************************************************/
116a9f12690SJung-uk Kim 
117a9f12690SJung-uk Kim #ifndef _ACOBJECT_H
118a9f12690SJung-uk Kim #define _ACOBJECT_H
119a9f12690SJung-uk Kim 
120a9f12690SJung-uk Kim /* acpisrc:StructDefs -- for acpisrc conversion */
121a9f12690SJung-uk Kim 
122a9f12690SJung-uk Kim 
123a9f12690SJung-uk Kim /*
124a9f12690SJung-uk Kim  * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
125a9f12690SJung-uk Kim  * to the interpreter, and to keep track of the various handlers such as
126a9f12690SJung-uk Kim  * address space handlers and notify handlers. The object is a constant
127a9f12690SJung-uk Kim  * size in order to allow it to be cached and reused.
128a9f12690SJung-uk Kim  *
129a9f12690SJung-uk Kim  * Note: The object is optimized to be aligned and will not work if it is
130a9f12690SJung-uk Kim  * byte-packed.
131a9f12690SJung-uk Kim  */
132a9f12690SJung-uk Kim #if ACPI_MACHINE_WIDTH == 64
133a9f12690SJung-uk Kim #pragma pack(8)
134a9f12690SJung-uk Kim #else
135a9f12690SJung-uk Kim #pragma pack(4)
136a9f12690SJung-uk Kim #endif
137a9f12690SJung-uk Kim 
138a9f12690SJung-uk Kim /*******************************************************************************
139a9f12690SJung-uk Kim  *
140a9f12690SJung-uk Kim  * Common Descriptors
141a9f12690SJung-uk Kim  *
142a9f12690SJung-uk Kim  ******************************************************************************/
143a9f12690SJung-uk Kim 
144a9f12690SJung-uk Kim /*
145a9f12690SJung-uk Kim  * Common area for all objects.
146a9f12690SJung-uk Kim  *
147a9f12690SJung-uk Kim  * DescriptorType is used to differentiate between internal descriptors, and
148a9f12690SJung-uk Kim  * must be in the same place across all descriptors
149a9f12690SJung-uk Kim  *
150a9f12690SJung-uk Kim  * Note: The DescriptorType and Type fields must appear in the identical
151a9f12690SJung-uk Kim  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
152a9f12690SJung-uk Kim  * structures.
153a9f12690SJung-uk Kim  */
154a9f12690SJung-uk Kim #define ACPI_OBJECT_COMMON_HEADER \
155a9f12690SJung-uk Kim     union acpi_operand_object       *NextObject;        /* Objects linked to parent NS node */\
156a9f12690SJung-uk Kim     UINT8                           DescriptorType;     /* To differentiate various internal objs */\
157a9f12690SJung-uk Kim     UINT8                           Type;               /* ACPI_OBJECT_TYPE */\
158a9f12690SJung-uk Kim     UINT16                          ReferenceCount;     /* For object deletion management */\
159a9f12690SJung-uk Kim     UINT8                           Flags;
160a9f12690SJung-uk Kim     /*
161a9f12690SJung-uk Kim      * Note: There are 3 bytes available here before the
162a9f12690SJung-uk Kim      * next natural alignment boundary (for both 32/64 cases)
163a9f12690SJung-uk Kim      */
164a9f12690SJung-uk Kim 
165a9f12690SJung-uk Kim /* Values for Flag byte above */
166a9f12690SJung-uk Kim 
167*a88e22b7SJung-uk Kim #define AOPOBJ_AML_CONSTANT         0x01    /* Integer is an AML constant */
168*a88e22b7SJung-uk Kim #define AOPOBJ_STATIC_POINTER       0x02    /* Data is part of an ACPI table, don't delete */
169*a88e22b7SJung-uk Kim #define AOPOBJ_DATA_VALID           0x04    /* Object is intialized and data is valid */
170*a88e22b7SJung-uk Kim #define AOPOBJ_OBJECT_INITIALIZED   0x08    /* Region is initialized, _REG was run */
171*a88e22b7SJung-uk Kim #define AOPOBJ_SETUP_COMPLETE       0x10    /* Region setup is complete */
172*a88e22b7SJung-uk Kim #define AOPOBJ_INVALID              0x20    /* Host OS won't allow a Region address */
173*a88e22b7SJung-uk Kim #define AOPOBJ_MODULE_LEVEL         0x40    /* Method is actually module-level code */
174*a88e22b7SJung-uk Kim #define AOPOBJ_MODIFIED_NAMESPACE   0x80    /* Method modified the namespace */
175a9f12690SJung-uk Kim 
176a9f12690SJung-uk Kim 
177a9f12690SJung-uk Kim /******************************************************************************
178a9f12690SJung-uk Kim  *
179a9f12690SJung-uk Kim  * Basic data types
180a9f12690SJung-uk Kim  *
181a9f12690SJung-uk Kim  *****************************************************************************/
182a9f12690SJung-uk Kim 
183a9f12690SJung-uk Kim typedef struct acpi_object_common
184a9f12690SJung-uk Kim {
185a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
186a9f12690SJung-uk Kim 
187a9f12690SJung-uk Kim } ACPI_OBJECT_COMMON;
188a9f12690SJung-uk Kim 
189a9f12690SJung-uk Kim 
190a9f12690SJung-uk Kim typedef struct acpi_object_integer
191a9f12690SJung-uk Kim {
192a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
193a9f12690SJung-uk Kim     UINT8                           Fill[3];            /* Prevent warning on some compilers */
1949a179dd8SJung-uk Kim     UINT64                          Value;
195a9f12690SJung-uk Kim 
196a9f12690SJung-uk Kim } ACPI_OBJECT_INTEGER;
197a9f12690SJung-uk Kim 
198a9f12690SJung-uk Kim 
199a9f12690SJung-uk Kim /*
200a9f12690SJung-uk Kim  * Note: The String and Buffer object must be identical through the Pointer
201a9f12690SJung-uk Kim  * and length elements.  There is code that depends on this.
202a9f12690SJung-uk Kim  *
203a9f12690SJung-uk Kim  * Fields common to both Strings and Buffers
204a9f12690SJung-uk Kim  */
205a9f12690SJung-uk Kim #define ACPI_COMMON_BUFFER_INFO(_Type) \
206a9f12690SJung-uk Kim     _Type                           *Pointer; \
207a9f12690SJung-uk Kim     UINT32                          Length;
208a9f12690SJung-uk Kim 
209a9f12690SJung-uk Kim 
210a9f12690SJung-uk Kim typedef struct acpi_object_string   /* Null terminated, ASCII characters only */
211a9f12690SJung-uk Kim {
212a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
213a9f12690SJung-uk Kim     ACPI_COMMON_BUFFER_INFO         (char)              /* String in AML stream or allocated string */
214a9f12690SJung-uk Kim 
215a9f12690SJung-uk Kim } ACPI_OBJECT_STRING;
216a9f12690SJung-uk Kim 
217a9f12690SJung-uk Kim 
218a9f12690SJung-uk Kim typedef struct acpi_object_buffer
219a9f12690SJung-uk Kim {
220a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
221a9f12690SJung-uk Kim     ACPI_COMMON_BUFFER_INFO         (UINT8)             /* Buffer in AML stream or allocated buffer */
222a9f12690SJung-uk Kim     UINT32                          AmlLength;
223a9f12690SJung-uk Kim     UINT8                           *AmlStart;
224a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Link back to parent node */
225a9f12690SJung-uk Kim 
226a9f12690SJung-uk Kim } ACPI_OBJECT_BUFFER;
227a9f12690SJung-uk Kim 
228a9f12690SJung-uk Kim 
229a9f12690SJung-uk Kim typedef struct acpi_object_package
230a9f12690SJung-uk Kim {
231a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
232a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Link back to parent node */
233a9f12690SJung-uk Kim     union acpi_operand_object       **Elements;         /* Array of pointers to AcpiObjects */
234a9f12690SJung-uk Kim     UINT8                           *AmlStart;
235a9f12690SJung-uk Kim     UINT32                          AmlLength;
236a9f12690SJung-uk Kim     UINT32                          Count;              /* # of elements in package */
237a9f12690SJung-uk Kim 
238a9f12690SJung-uk Kim } ACPI_OBJECT_PACKAGE;
239a9f12690SJung-uk Kim 
240a9f12690SJung-uk Kim 
241a9f12690SJung-uk Kim /******************************************************************************
242a9f12690SJung-uk Kim  *
243a9f12690SJung-uk Kim  * Complex data types
244a9f12690SJung-uk Kim  *
245a9f12690SJung-uk Kim  *****************************************************************************/
246a9f12690SJung-uk Kim 
247a9f12690SJung-uk Kim typedef struct acpi_object_event
248a9f12690SJung-uk Kim {
249a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
250a9f12690SJung-uk Kim     ACPI_SEMAPHORE                  OsSemaphore;        /* Actual OS synchronization object */
251a9f12690SJung-uk Kim 
252a9f12690SJung-uk Kim } ACPI_OBJECT_EVENT;
253a9f12690SJung-uk Kim 
254a9f12690SJung-uk Kim 
255a9f12690SJung-uk Kim typedef struct acpi_object_mutex
256a9f12690SJung-uk Kim {
257a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
258a9f12690SJung-uk Kim     UINT8                           SyncLevel;          /* 0-15, specified in Mutex() call */
259a9f12690SJung-uk Kim     UINT16                          AcquisitionDepth;   /* Allow multiple Acquires, same thread */
260a9f12690SJung-uk Kim     ACPI_MUTEX                      OsMutex;            /* Actual OS synchronization object */
261a9f12690SJung-uk Kim     ACPI_THREAD_ID                  ThreadId;           /* Current owner of the mutex */
262a9f12690SJung-uk Kim     struct acpi_thread_state        *OwnerThread;       /* Current owner of the mutex */
263a9f12690SJung-uk Kim     union acpi_operand_object       *Prev;              /* Link for list of acquired mutexes */
264a9f12690SJung-uk Kim     union acpi_operand_object       *Next;              /* Link for list of acquired mutexes */
265a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Containing namespace node */
266a9f12690SJung-uk Kim     UINT8                           OriginalSyncLevel;  /* Owner's original sync level (0-15) */
267a9f12690SJung-uk Kim 
268a9f12690SJung-uk Kim } ACPI_OBJECT_MUTEX;
269a9f12690SJung-uk Kim 
270a9f12690SJung-uk Kim 
271a9f12690SJung-uk Kim typedef struct acpi_object_region
272a9f12690SJung-uk Kim {
273a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
274a9f12690SJung-uk Kim     UINT8                           SpaceId;
275a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Containing namespace node */
276a9f12690SJung-uk Kim     union acpi_operand_object       *Handler;           /* Handler for region access */
277a9f12690SJung-uk Kim     union acpi_operand_object       *Next;
278a9f12690SJung-uk Kim     ACPI_PHYSICAL_ADDRESS           Address;
279a9f12690SJung-uk Kim     UINT32                          Length;
280a9f12690SJung-uk Kim 
281a9f12690SJung-uk Kim } ACPI_OBJECT_REGION;
282a9f12690SJung-uk Kim 
283a9f12690SJung-uk Kim 
284a9f12690SJung-uk Kim typedef struct acpi_object_method
285a9f12690SJung-uk Kim {
286a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
287a9f12690SJung-uk Kim     UINT8                           MethodFlags;
288a9f12690SJung-uk Kim     UINT8                           ParamCount;
289a9f12690SJung-uk Kim     UINT8                           SyncLevel;
290a9f12690SJung-uk Kim     union acpi_operand_object       *Mutex;
291a9f12690SJung-uk Kim     UINT8                           *AmlStart;
292572c8255SJung-uk Kim     union
293572c8255SJung-uk Kim     {
294a9f12690SJung-uk Kim         ACPI_INTERNAL_METHOD            Implementation;
295572c8255SJung-uk Kim         union acpi_operand_object       *Handler;
296572c8255SJung-uk Kim     } Extra;
297572c8255SJung-uk Kim 
298a9f12690SJung-uk Kim     UINT32                          AmlLength;
299a9f12690SJung-uk Kim     UINT8                           ThreadCount;
300a9f12690SJung-uk Kim     ACPI_OWNER_ID                   OwnerId;
301a9f12690SJung-uk Kim 
302a9f12690SJung-uk Kim } ACPI_OBJECT_METHOD;
303a9f12690SJung-uk Kim 
304a9f12690SJung-uk Kim 
305a9f12690SJung-uk Kim /******************************************************************************
306a9f12690SJung-uk Kim  *
307a9f12690SJung-uk Kim  * Objects that can be notified.  All share a common NotifyInfo area.
308a9f12690SJung-uk Kim  *
309a9f12690SJung-uk Kim  *****************************************************************************/
310a9f12690SJung-uk Kim 
311a9f12690SJung-uk Kim /*
312a9f12690SJung-uk Kim  * Common fields for objects that support ASL notifications
313a9f12690SJung-uk Kim  */
314a9f12690SJung-uk Kim #define ACPI_COMMON_NOTIFY_INFO \
315a9f12690SJung-uk Kim     union acpi_operand_object       *SystemNotify;      /* Handler for system notifies */\
316a9f12690SJung-uk Kim     union acpi_operand_object       *DeviceNotify;      /* Handler for driver notifies */\
317a9f12690SJung-uk Kim     union acpi_operand_object       *Handler;           /* Handler for Address space */
318a9f12690SJung-uk Kim 
319a9f12690SJung-uk Kim 
320a9f12690SJung-uk Kim typedef struct acpi_object_notify_common    /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
321a9f12690SJung-uk Kim {
322a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
323a9f12690SJung-uk Kim     ACPI_COMMON_NOTIFY_INFO
324a9f12690SJung-uk Kim 
325a9f12690SJung-uk Kim } ACPI_OBJECT_NOTIFY_COMMON;
326a9f12690SJung-uk Kim 
327a9f12690SJung-uk Kim 
328a9f12690SJung-uk Kim typedef struct acpi_object_device
329a9f12690SJung-uk Kim {
330a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
331a9f12690SJung-uk Kim     ACPI_COMMON_NOTIFY_INFO
332a9f12690SJung-uk Kim     ACPI_GPE_BLOCK_INFO             *GpeBlock;
333a9f12690SJung-uk Kim 
334a9f12690SJung-uk Kim } ACPI_OBJECT_DEVICE;
335a9f12690SJung-uk Kim 
336a9f12690SJung-uk Kim 
337a9f12690SJung-uk Kim typedef struct acpi_object_power_resource
338a9f12690SJung-uk Kim {
339a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
340a9f12690SJung-uk Kim     ACPI_COMMON_NOTIFY_INFO
341a9f12690SJung-uk Kim     UINT32                          SystemLevel;
342a9f12690SJung-uk Kim     UINT32                          ResourceOrder;
343a9f12690SJung-uk Kim 
344a9f12690SJung-uk Kim } ACPI_OBJECT_POWER_RESOURCE;
345a9f12690SJung-uk Kim 
346a9f12690SJung-uk Kim 
347a9f12690SJung-uk Kim typedef struct acpi_object_processor
348a9f12690SJung-uk Kim {
349a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
350a9f12690SJung-uk Kim 
351a9f12690SJung-uk Kim     /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
352a9f12690SJung-uk Kim 
353a9f12690SJung-uk Kim     UINT8                           ProcId;
354a9f12690SJung-uk Kim     UINT8                           Length;
355a9f12690SJung-uk Kim     ACPI_COMMON_NOTIFY_INFO
356a9f12690SJung-uk Kim     ACPI_IO_ADDRESS                 Address;
357a9f12690SJung-uk Kim 
358a9f12690SJung-uk Kim } ACPI_OBJECT_PROCESSOR;
359a9f12690SJung-uk Kim 
360a9f12690SJung-uk Kim 
361a9f12690SJung-uk Kim typedef struct acpi_object_thermal_zone
362a9f12690SJung-uk Kim {
363a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
364a9f12690SJung-uk Kim     ACPI_COMMON_NOTIFY_INFO
365a9f12690SJung-uk Kim 
366a9f12690SJung-uk Kim } ACPI_OBJECT_THERMAL_ZONE;
367a9f12690SJung-uk Kim 
368a9f12690SJung-uk Kim 
369a9f12690SJung-uk Kim /******************************************************************************
370a9f12690SJung-uk Kim  *
371a9f12690SJung-uk Kim  * Fields.  All share a common header/info field.
372a9f12690SJung-uk Kim  *
373a9f12690SJung-uk Kim  *****************************************************************************/
374a9f12690SJung-uk Kim 
375a9f12690SJung-uk Kim /*
376a9f12690SJung-uk Kim  * Common bitfield for the field objects
377a9f12690SJung-uk Kim  * "Field Datum"  -- a datum from the actual field object
378a9f12690SJung-uk Kim  * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
379a9f12690SJung-uk Kim  */
380a9f12690SJung-uk Kim #define ACPI_COMMON_FIELD_INFO \
381a9f12690SJung-uk Kim     UINT8                           FieldFlags;         /* Access, update, and lock bits */\
382a9f12690SJung-uk Kim     UINT8                           Attribute;          /* From AccessAs keyword */\
383a9f12690SJung-uk Kim     UINT8                           AccessByteWidth;    /* Read/Write size in bytes */\
384a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Link back to parent node */\
385a9f12690SJung-uk Kim     UINT32                          BitLength;          /* Length of field in bits */\
386a9f12690SJung-uk Kim     UINT32                          BaseByteOffset;     /* Byte offset within containing object */\
387a9f12690SJung-uk Kim     UINT32                          Value;              /* Value to store into the Bank or Index register */\
388a9f12690SJung-uk Kim     UINT8                           StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
389a9f12690SJung-uk Kim     UINT8                           AccessBitWidth;     /* Read/Write size in bits (8-64) */
390a9f12690SJung-uk Kim 
391a9f12690SJung-uk Kim 
392a9f12690SJung-uk Kim typedef struct acpi_object_field_common                 /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
393a9f12690SJung-uk Kim {
394a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
395a9f12690SJung-uk Kim     ACPI_COMMON_FIELD_INFO
396a9f12690SJung-uk Kim     union acpi_operand_object       *RegionObj;         /* Parent Operation Region object (REGION/BANK fields only) */
397a9f12690SJung-uk Kim 
398a9f12690SJung-uk Kim } ACPI_OBJECT_FIELD_COMMON;
399a9f12690SJung-uk Kim 
400a9f12690SJung-uk Kim 
401a9f12690SJung-uk Kim typedef struct acpi_object_region_field
402a9f12690SJung-uk Kim {
403a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
404a9f12690SJung-uk Kim     ACPI_COMMON_FIELD_INFO
405a9f12690SJung-uk Kim     union acpi_operand_object       *RegionObj;         /* Containing OpRegion object */
406a9f12690SJung-uk Kim 
407a9f12690SJung-uk Kim } ACPI_OBJECT_REGION_FIELD;
408a9f12690SJung-uk Kim 
409a9f12690SJung-uk Kim 
410a9f12690SJung-uk Kim typedef struct acpi_object_bank_field
411a9f12690SJung-uk Kim {
412a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
413a9f12690SJung-uk Kim     ACPI_COMMON_FIELD_INFO
414a9f12690SJung-uk Kim     union acpi_operand_object       *RegionObj;         /* Containing OpRegion object */
415a9f12690SJung-uk Kim     union acpi_operand_object       *BankObj;           /* BankSelect Register object */
416a9f12690SJung-uk Kim 
417a9f12690SJung-uk Kim } ACPI_OBJECT_BANK_FIELD;
418a9f12690SJung-uk Kim 
419a9f12690SJung-uk Kim 
420a9f12690SJung-uk Kim typedef struct acpi_object_index_field
421a9f12690SJung-uk Kim {
422a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
423a9f12690SJung-uk Kim     ACPI_COMMON_FIELD_INFO
424a9f12690SJung-uk Kim 
425a9f12690SJung-uk Kim     /*
426a9f12690SJung-uk Kim      * No "RegionObj" pointer needed since the Index and Data registers
427a9f12690SJung-uk Kim      * are each field definitions unto themselves.
428a9f12690SJung-uk Kim      */
429a9f12690SJung-uk Kim     union acpi_operand_object       *IndexObj;          /* Index register */
430a9f12690SJung-uk Kim     union acpi_operand_object       *DataObj;           /* Data register */
431a9f12690SJung-uk Kim 
432a9f12690SJung-uk Kim } ACPI_OBJECT_INDEX_FIELD;
433a9f12690SJung-uk Kim 
434a9f12690SJung-uk Kim 
435a9f12690SJung-uk Kim /* The BufferField is different in that it is part of a Buffer, not an OpRegion */
436a9f12690SJung-uk Kim 
437a9f12690SJung-uk Kim typedef struct acpi_object_buffer_field
438a9f12690SJung-uk Kim {
439a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
440a9f12690SJung-uk Kim     ACPI_COMMON_FIELD_INFO
441a9f12690SJung-uk Kim     union acpi_operand_object       *BufferObj;         /* Containing Buffer object */
442a9f12690SJung-uk Kim 
443a9f12690SJung-uk Kim } ACPI_OBJECT_BUFFER_FIELD;
444a9f12690SJung-uk Kim 
445a9f12690SJung-uk Kim 
446a9f12690SJung-uk Kim /******************************************************************************
447a9f12690SJung-uk Kim  *
448a9f12690SJung-uk Kim  * Objects for handlers
449a9f12690SJung-uk Kim  *
450a9f12690SJung-uk Kim  *****************************************************************************/
451a9f12690SJung-uk Kim 
452a9f12690SJung-uk Kim typedef struct acpi_object_notify_handler
453a9f12690SJung-uk Kim {
454a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
455a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Parent device */
456a9f12690SJung-uk Kim     ACPI_NOTIFY_HANDLER             Handler;
457a9f12690SJung-uk Kim     void                            *Context;
458a9f12690SJung-uk Kim 
459a9f12690SJung-uk Kim } ACPI_OBJECT_NOTIFY_HANDLER;
460a9f12690SJung-uk Kim 
461a9f12690SJung-uk Kim 
462a9f12690SJung-uk Kim typedef struct acpi_object_addr_handler
463a9f12690SJung-uk Kim {
464a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
465a9f12690SJung-uk Kim     UINT8                           SpaceId;
466a9f12690SJung-uk Kim     UINT8                           HandlerFlags;
467a9f12690SJung-uk Kim     ACPI_ADR_SPACE_HANDLER          Handler;
468a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Node;              /* Parent device */
469a9f12690SJung-uk Kim     void                            *Context;
470a9f12690SJung-uk Kim     ACPI_ADR_SPACE_SETUP            Setup;
471a9f12690SJung-uk Kim     union acpi_operand_object       *RegionList;        /* regions using this handler */
472a9f12690SJung-uk Kim     union acpi_operand_object       *Next;
473a9f12690SJung-uk Kim 
474a9f12690SJung-uk Kim } ACPI_OBJECT_ADDR_HANDLER;
475a9f12690SJung-uk Kim 
476a9f12690SJung-uk Kim /* Flags for address handler (HandlerFlags) */
477a9f12690SJung-uk Kim 
478a9f12690SJung-uk Kim #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x01
479a9f12690SJung-uk Kim 
480a9f12690SJung-uk Kim 
481a9f12690SJung-uk Kim /******************************************************************************
482a9f12690SJung-uk Kim  *
483a9f12690SJung-uk Kim  * Special internal objects
484a9f12690SJung-uk Kim  *
485a9f12690SJung-uk Kim  *****************************************************************************/
486a9f12690SJung-uk Kim 
487a9f12690SJung-uk Kim /*
488a9f12690SJung-uk Kim  * The Reference object is used for these opcodes:
489a9f12690SJung-uk Kim  * Arg[0-6], Local[0-7], IndexOp, NameOp, RefOfOp, LoadOp, LoadTableOp, DebugOp
490a9f12690SJung-uk Kim  * The Reference.Class differentiates these types.
491a9f12690SJung-uk Kim  */
492a9f12690SJung-uk Kim typedef struct acpi_object_reference
493a9f12690SJung-uk Kim {
494a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
495a9f12690SJung-uk Kim      UINT8                           Class;              /* Reference Class */
496a9f12690SJung-uk Kim      UINT8                           TargetType;         /* Used for Index Op */
497a9f12690SJung-uk Kim      UINT8                           Reserved;
498a9f12690SJung-uk Kim      void                            *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
499a9f12690SJung-uk Kim      ACPI_NAMESPACE_NODE             *Node;              /* RefOf or Namepath */
500a9f12690SJung-uk Kim      union acpi_operand_object       **Where;            /* Target of Index */
501a9f12690SJung-uk Kim      UINT32                          Value;              /* Used for Local/Arg/Index/DdbHandle */
502a9f12690SJung-uk Kim 
503a9f12690SJung-uk Kim } ACPI_OBJECT_REFERENCE;
504a9f12690SJung-uk Kim 
505a9f12690SJung-uk Kim /* Values for Reference.Class above */
506a9f12690SJung-uk Kim 
507a9f12690SJung-uk Kim typedef enum
508a9f12690SJung-uk Kim {
509a9f12690SJung-uk Kim     ACPI_REFCLASS_LOCAL             = 0,        /* Method local */
510a9f12690SJung-uk Kim     ACPI_REFCLASS_ARG               = 1,        /* Method argument */
511a9f12690SJung-uk Kim     ACPI_REFCLASS_REFOF             = 2,        /* Result of RefOf() TBD: Split to Ref/Node and Ref/OperandObj? */
512a9f12690SJung-uk Kim     ACPI_REFCLASS_INDEX             = 3,        /* Result of Index() */
513a9f12690SJung-uk Kim     ACPI_REFCLASS_TABLE             = 4,        /* DdbHandle - Load(), LoadTable() */
514a9f12690SJung-uk Kim     ACPI_REFCLASS_NAME              = 5,        /* Reference to a named object */
515a9f12690SJung-uk Kim     ACPI_REFCLASS_DEBUG             = 6,        /* Debug object */
516a9f12690SJung-uk Kim 
517a9f12690SJung-uk Kim     ACPI_REFCLASS_MAX               = 6
518a9f12690SJung-uk Kim 
519a9f12690SJung-uk Kim } ACPI_REFERENCE_CLASSES;
520a9f12690SJung-uk Kim 
521a9f12690SJung-uk Kim 
522a9f12690SJung-uk Kim /*
523a9f12690SJung-uk Kim  * Extra object is used as additional storage for types that
524a9f12690SJung-uk Kim  * have AML code in their declarations (TermArgs) that must be
525a9f12690SJung-uk Kim  * evaluated at run time.
526a9f12690SJung-uk Kim  *
527a9f12690SJung-uk Kim  * Currently: Region and FieldUnit types
528a9f12690SJung-uk Kim  */
529a9f12690SJung-uk Kim typedef struct acpi_object_extra
530a9f12690SJung-uk Kim {
531a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
532a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             *Method_REG;        /* _REG method for this region (if any) */
533a9f12690SJung-uk Kim     void                            *RegionContext;     /* Region-specific data */
534a9f12690SJung-uk Kim     UINT8                           *AmlStart;
535a9f12690SJung-uk Kim     UINT32                          AmlLength;
536a9f12690SJung-uk Kim 
537a9f12690SJung-uk Kim } ACPI_OBJECT_EXTRA;
538a9f12690SJung-uk Kim 
539a9f12690SJung-uk Kim 
540a9f12690SJung-uk Kim /* Additional data that can be attached to namespace nodes */
541a9f12690SJung-uk Kim 
542a9f12690SJung-uk Kim typedef struct acpi_object_data
543a9f12690SJung-uk Kim {
544a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
545a9f12690SJung-uk Kim     ACPI_OBJECT_HANDLER             Handler;
546a9f12690SJung-uk Kim     void                            *Pointer;
547a9f12690SJung-uk Kim 
548a9f12690SJung-uk Kim } ACPI_OBJECT_DATA;
549a9f12690SJung-uk Kim 
550a9f12690SJung-uk Kim 
551a9f12690SJung-uk Kim /* Structure used when objects are cached for reuse */
552a9f12690SJung-uk Kim 
553a9f12690SJung-uk Kim typedef struct acpi_object_cache_list
554a9f12690SJung-uk Kim {
555a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON_HEADER
556a9f12690SJung-uk Kim     union acpi_operand_object       *Next;              /* Link for object cache and internal lists*/
557a9f12690SJung-uk Kim 
558a9f12690SJung-uk Kim } ACPI_OBJECT_CACHE_LIST;
559a9f12690SJung-uk Kim 
560a9f12690SJung-uk Kim 
561a9f12690SJung-uk Kim /******************************************************************************
562a9f12690SJung-uk Kim  *
563a9f12690SJung-uk Kim  * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
564a9f12690SJung-uk Kim  *
565a9f12690SJung-uk Kim  *****************************************************************************/
566a9f12690SJung-uk Kim 
567a9f12690SJung-uk Kim typedef union acpi_operand_object
568a9f12690SJung-uk Kim {
569a9f12690SJung-uk Kim     ACPI_OBJECT_COMMON                  Common;
570a9f12690SJung-uk Kim     ACPI_OBJECT_INTEGER                 Integer;
571a9f12690SJung-uk Kim     ACPI_OBJECT_STRING                  String;
572a9f12690SJung-uk Kim     ACPI_OBJECT_BUFFER                  Buffer;
573a9f12690SJung-uk Kim     ACPI_OBJECT_PACKAGE                 Package;
574a9f12690SJung-uk Kim     ACPI_OBJECT_EVENT                   Event;
575a9f12690SJung-uk Kim     ACPI_OBJECT_METHOD                  Method;
576a9f12690SJung-uk Kim     ACPI_OBJECT_MUTEX                   Mutex;
577a9f12690SJung-uk Kim     ACPI_OBJECT_REGION                  Region;
578a9f12690SJung-uk Kim     ACPI_OBJECT_NOTIFY_COMMON           CommonNotify;
579a9f12690SJung-uk Kim     ACPI_OBJECT_DEVICE                  Device;
580a9f12690SJung-uk Kim     ACPI_OBJECT_POWER_RESOURCE          PowerResource;
581a9f12690SJung-uk Kim     ACPI_OBJECT_PROCESSOR               Processor;
582a9f12690SJung-uk Kim     ACPI_OBJECT_THERMAL_ZONE            ThermalZone;
583a9f12690SJung-uk Kim     ACPI_OBJECT_FIELD_COMMON            CommonField;
584a9f12690SJung-uk Kim     ACPI_OBJECT_REGION_FIELD            Field;
585a9f12690SJung-uk Kim     ACPI_OBJECT_BUFFER_FIELD            BufferField;
586a9f12690SJung-uk Kim     ACPI_OBJECT_BANK_FIELD              BankField;
587a9f12690SJung-uk Kim     ACPI_OBJECT_INDEX_FIELD             IndexField;
588a9f12690SJung-uk Kim     ACPI_OBJECT_NOTIFY_HANDLER          Notify;
589a9f12690SJung-uk Kim     ACPI_OBJECT_ADDR_HANDLER            AddressSpace;
590a9f12690SJung-uk Kim     ACPI_OBJECT_REFERENCE               Reference;
591a9f12690SJung-uk Kim     ACPI_OBJECT_EXTRA                   Extra;
592a9f12690SJung-uk Kim     ACPI_OBJECT_DATA                    Data;
593a9f12690SJung-uk Kim     ACPI_OBJECT_CACHE_LIST              Cache;
594a9f12690SJung-uk Kim 
595a9f12690SJung-uk Kim     /*
596a9f12690SJung-uk Kim      * Add namespace node to union in order to simplify code that accepts both
597a9f12690SJung-uk Kim      * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
598a9f12690SJung-uk Kim      * a common DescriptorType field in order to differentiate them.
599a9f12690SJung-uk Kim      */
600a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE                 Node;
601a9f12690SJung-uk Kim 
602a9f12690SJung-uk Kim } ACPI_OPERAND_OBJECT;
603a9f12690SJung-uk Kim 
604a9f12690SJung-uk Kim 
605a9f12690SJung-uk Kim /******************************************************************************
606a9f12690SJung-uk Kim  *
607a9f12690SJung-uk Kim  * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
608a9f12690SJung-uk Kim  *
609a9f12690SJung-uk Kim  *****************************************************************************/
610a9f12690SJung-uk Kim 
611a9f12690SJung-uk Kim /* Object descriptor types */
612a9f12690SJung-uk Kim 
613a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_CACHED           0x01        /* Used only when object is cached */
614a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE            0x02
615a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_UPDATE     0x03
616a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_PACKAGE    0x04
617a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_CONTROL    0x05
618a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_RPSCOPE    0x06
619a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_PSCOPE     0x07
620a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_WSCOPE     0x08
621a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_RESULT     0x09
622a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_NOTIFY     0x0A
623a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_STATE_THREAD     0x0B
624a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_WALK             0x0C
625a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_PARSER           0x0D
626a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_OPERAND          0x0E
627a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_NAMED            0x0F
628a9f12690SJung-uk Kim #define ACPI_DESC_TYPE_MAX              0x0F
629a9f12690SJung-uk Kim 
630a9f12690SJung-uk Kim 
631a9f12690SJung-uk Kim typedef struct acpi_common_descriptor
632a9f12690SJung-uk Kim {
633a9f12690SJung-uk Kim     void                            *CommonPointer;
634a9f12690SJung-uk Kim     UINT8                           DescriptorType; /* To differentiate various internal objs */
635a9f12690SJung-uk Kim 
636a9f12690SJung-uk Kim } ACPI_COMMON_DESCRIPTOR;
637a9f12690SJung-uk Kim 
638a9f12690SJung-uk Kim typedef union acpi_descriptor
639a9f12690SJung-uk Kim {
640a9f12690SJung-uk Kim     ACPI_COMMON_DESCRIPTOR          Common;
641a9f12690SJung-uk Kim     ACPI_OPERAND_OBJECT             Object;
642a9f12690SJung-uk Kim     ACPI_NAMESPACE_NODE             Node;
643a9f12690SJung-uk Kim     ACPI_PARSE_OBJECT               Op;
644a9f12690SJung-uk Kim 
645a9f12690SJung-uk Kim } ACPI_DESCRIPTOR;
646a9f12690SJung-uk Kim 
647a9f12690SJung-uk Kim #pragma pack()
648a9f12690SJung-uk Kim 
649a9f12690SJung-uk Kim #endif /* _ACOBJECT_H */
650