xref: /minix3/minix/drivers/power/acpi/include/acobject.h (revision 29492bb71c7148a089a5afafa0c99409161218df)
1433d6423SLionel Sambuc /******************************************************************************
2433d6423SLionel Sambuc  *
3433d6423SLionel Sambuc  * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
4433d6423SLionel Sambuc  *
5433d6423SLionel Sambuc  *****************************************************************************/
6433d6423SLionel Sambuc 
7*29492bb7SDavid van Moolenbroek /*
8*29492bb7SDavid van Moolenbroek  * Copyright (C) 2000 - 2014, Intel Corp.
9433d6423SLionel Sambuc  * All rights reserved.
10433d6423SLionel Sambuc  *
11*29492bb7SDavid van Moolenbroek  * Redistribution and use in source and binary forms, with or without
12*29492bb7SDavid van Moolenbroek  * modification, are permitted provided that the following conditions
13*29492bb7SDavid van Moolenbroek  * are met:
14*29492bb7SDavid van Moolenbroek  * 1. Redistributions of source code must retain the above copyright
15*29492bb7SDavid van Moolenbroek  *    notice, this list of conditions, and the following disclaimer,
16*29492bb7SDavid van Moolenbroek  *    without modification.
17*29492bb7SDavid van Moolenbroek  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
18*29492bb7SDavid van Moolenbroek  *    substantially similar to the "NO WARRANTY" disclaimer below
19*29492bb7SDavid van Moolenbroek  *    ("Disclaimer") and any redistribution must be conditioned upon
20*29492bb7SDavid van Moolenbroek  *    including a substantially similar Disclaimer requirement for further
21*29492bb7SDavid van Moolenbroek  *    binary redistribution.
22*29492bb7SDavid van Moolenbroek  * 3. Neither the names of the above-listed copyright holders nor the names
23*29492bb7SDavid van Moolenbroek  *    of any contributors may be used to endorse or promote products derived
24*29492bb7SDavid van Moolenbroek  *    from this software without specific prior written permission.
25433d6423SLionel Sambuc  *
26*29492bb7SDavid van Moolenbroek  * Alternatively, this software may be distributed under the terms of the
27*29492bb7SDavid van Moolenbroek  * GNU General Public License ("GPL") version 2 as published by the Free
28*29492bb7SDavid van Moolenbroek  * Software Foundation.
29433d6423SLionel Sambuc  *
30*29492bb7SDavid van Moolenbroek  * NO WARRANTY
31*29492bb7SDavid van Moolenbroek  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32*29492bb7SDavid van Moolenbroek  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33*29492bb7SDavid van Moolenbroek  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34*29492bb7SDavid van Moolenbroek  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35*29492bb7SDavid van Moolenbroek  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
36*29492bb7SDavid van Moolenbroek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37*29492bb7SDavid van Moolenbroek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38*29492bb7SDavid van Moolenbroek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39*29492bb7SDavid van Moolenbroek  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
40*29492bb7SDavid van Moolenbroek  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41*29492bb7SDavid van Moolenbroek  * POSSIBILITY OF SUCH DAMAGES.
42*29492bb7SDavid van Moolenbroek  */
43433d6423SLionel Sambuc 
44433d6423SLionel Sambuc #ifndef _ACOBJECT_H
45433d6423SLionel Sambuc #define _ACOBJECT_H
46433d6423SLionel Sambuc 
47433d6423SLionel Sambuc /* acpisrc:StructDefs -- for acpisrc conversion */
48433d6423SLionel Sambuc 
49433d6423SLionel Sambuc 
50433d6423SLionel Sambuc /*
51433d6423SLionel Sambuc  * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
52433d6423SLionel Sambuc  * to the interpreter, and to keep track of the various handlers such as
53433d6423SLionel Sambuc  * address space handlers and notify handlers. The object is a constant
54433d6423SLionel Sambuc  * size in order to allow it to be cached and reused.
55433d6423SLionel Sambuc  *
56433d6423SLionel Sambuc  * Note: The object is optimized to be aligned and will not work if it is
57433d6423SLionel Sambuc  * byte-packed.
58433d6423SLionel Sambuc  */
59433d6423SLionel Sambuc #if ACPI_MACHINE_WIDTH == 64
60433d6423SLionel Sambuc #pragma pack(8)
61433d6423SLionel Sambuc #else
62433d6423SLionel Sambuc #pragma pack(4)
63433d6423SLionel Sambuc #endif
64433d6423SLionel Sambuc 
65433d6423SLionel Sambuc /*******************************************************************************
66433d6423SLionel Sambuc  *
67433d6423SLionel Sambuc  * Common Descriptors
68433d6423SLionel Sambuc  *
69433d6423SLionel Sambuc  ******************************************************************************/
70433d6423SLionel Sambuc 
71433d6423SLionel Sambuc /*
72433d6423SLionel Sambuc  * Common area for all objects.
73433d6423SLionel Sambuc  *
74433d6423SLionel Sambuc  * DescriptorType is used to differentiate between internal descriptors, and
75433d6423SLionel Sambuc  * must be in the same place across all descriptors
76433d6423SLionel Sambuc  *
77433d6423SLionel Sambuc  * Note: The DescriptorType and Type fields must appear in the identical
78433d6423SLionel Sambuc  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
79433d6423SLionel Sambuc  * structures.
80433d6423SLionel Sambuc  */
81433d6423SLionel Sambuc #define ACPI_OBJECT_COMMON_HEADER \
82433d6423SLionel Sambuc     union acpi_operand_object       *NextObject;        /* Objects linked to parent NS node */\
83433d6423SLionel Sambuc     UINT8                           DescriptorType;     /* To differentiate various internal objs */\
84433d6423SLionel Sambuc     UINT8                           Type;               /* ACPI_OBJECT_TYPE */\
85433d6423SLionel Sambuc     UINT16                          ReferenceCount;     /* For object deletion management */\
86433d6423SLionel Sambuc     UINT8                           Flags;
87433d6423SLionel Sambuc     /*
88433d6423SLionel Sambuc      * Note: There are 3 bytes available here before the
89433d6423SLionel Sambuc      * next natural alignment boundary (for both 32/64 cases)
90433d6423SLionel Sambuc      */
91433d6423SLionel Sambuc 
92433d6423SLionel Sambuc /* Values for Flag byte above */
93433d6423SLionel Sambuc 
94433d6423SLionel Sambuc #define AOPOBJ_AML_CONSTANT         0x01    /* Integer is an AML constant */
95433d6423SLionel Sambuc #define AOPOBJ_STATIC_POINTER       0x02    /* Data is part of an ACPI table, don't delete */
96*29492bb7SDavid van Moolenbroek #define AOPOBJ_DATA_VALID           0x04    /* Object is initialized and data is valid */
97433d6423SLionel Sambuc #define AOPOBJ_OBJECT_INITIALIZED   0x08    /* Region is initialized, _REG was run */
98433d6423SLionel Sambuc #define AOPOBJ_SETUP_COMPLETE       0x10    /* Region setup is complete */
99433d6423SLionel Sambuc #define AOPOBJ_INVALID              0x20    /* Host OS won't allow a Region address */
100433d6423SLionel Sambuc 
101433d6423SLionel Sambuc 
102433d6423SLionel Sambuc /******************************************************************************
103433d6423SLionel Sambuc  *
104433d6423SLionel Sambuc  * Basic data types
105433d6423SLionel Sambuc  *
106433d6423SLionel Sambuc  *****************************************************************************/
107433d6423SLionel Sambuc 
108433d6423SLionel Sambuc typedef struct acpi_object_common
109433d6423SLionel Sambuc {
110433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
111433d6423SLionel Sambuc 
112433d6423SLionel Sambuc } ACPI_OBJECT_COMMON;
113433d6423SLionel Sambuc 
114433d6423SLionel Sambuc 
115433d6423SLionel Sambuc typedef struct acpi_object_integer
116433d6423SLionel Sambuc {
117433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
118433d6423SLionel Sambuc     UINT8                           Fill[3];            /* Prevent warning on some compilers */
119433d6423SLionel Sambuc     UINT64                          Value;
120433d6423SLionel Sambuc 
121433d6423SLionel Sambuc } ACPI_OBJECT_INTEGER;
122433d6423SLionel Sambuc 
123433d6423SLionel Sambuc 
124433d6423SLionel Sambuc /*
125*29492bb7SDavid van Moolenbroek  * Note: The String and Buffer object must be identical through the
126*29492bb7SDavid van Moolenbroek  * pointer and length elements. There is code that depends on this.
127433d6423SLionel Sambuc  *
128433d6423SLionel Sambuc  * Fields common to both Strings and Buffers
129433d6423SLionel Sambuc  */
130433d6423SLionel Sambuc #define ACPI_COMMON_BUFFER_INFO(_Type) \
131433d6423SLionel Sambuc     _Type                           *Pointer; \
132433d6423SLionel Sambuc     UINT32                          Length;
133433d6423SLionel Sambuc 
134433d6423SLionel Sambuc 
135433d6423SLionel Sambuc typedef struct acpi_object_string   /* Null terminated, ASCII characters only */
136433d6423SLionel Sambuc {
137433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
138433d6423SLionel Sambuc     ACPI_COMMON_BUFFER_INFO         (char)              /* String in AML stream or allocated string */
139433d6423SLionel Sambuc 
140433d6423SLionel Sambuc } ACPI_OBJECT_STRING;
141433d6423SLionel Sambuc 
142433d6423SLionel Sambuc 
143433d6423SLionel Sambuc typedef struct acpi_object_buffer
144433d6423SLionel Sambuc {
145433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
146433d6423SLionel Sambuc     ACPI_COMMON_BUFFER_INFO         (UINT8)             /* Buffer in AML stream or allocated buffer */
147433d6423SLionel Sambuc     UINT32                          AmlLength;
148433d6423SLionel Sambuc     UINT8                           *AmlStart;
149433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Link back to parent node */
150433d6423SLionel Sambuc 
151433d6423SLionel Sambuc } ACPI_OBJECT_BUFFER;
152433d6423SLionel Sambuc 
153433d6423SLionel Sambuc 
154433d6423SLionel Sambuc typedef struct acpi_object_package
155433d6423SLionel Sambuc {
156433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
157433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Link back to parent node */
158433d6423SLionel Sambuc     union acpi_operand_object       **Elements;         /* Array of pointers to AcpiObjects */
159433d6423SLionel Sambuc     UINT8                           *AmlStart;
160433d6423SLionel Sambuc     UINT32                          AmlLength;
161433d6423SLionel Sambuc     UINT32                          Count;              /* # of elements in package */
162433d6423SLionel Sambuc 
163433d6423SLionel Sambuc } ACPI_OBJECT_PACKAGE;
164433d6423SLionel Sambuc 
165433d6423SLionel Sambuc 
166433d6423SLionel Sambuc /******************************************************************************
167433d6423SLionel Sambuc  *
168433d6423SLionel Sambuc  * Complex data types
169433d6423SLionel Sambuc  *
170433d6423SLionel Sambuc  *****************************************************************************/
171433d6423SLionel Sambuc 
172433d6423SLionel Sambuc typedef struct acpi_object_event
173433d6423SLionel Sambuc {
174433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
175433d6423SLionel Sambuc     ACPI_SEMAPHORE                  OsSemaphore;        /* Actual OS synchronization object */
176433d6423SLionel Sambuc 
177433d6423SLionel Sambuc } ACPI_OBJECT_EVENT;
178433d6423SLionel Sambuc 
179433d6423SLionel Sambuc 
180433d6423SLionel Sambuc typedef struct acpi_object_mutex
181433d6423SLionel Sambuc {
182433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
183433d6423SLionel Sambuc     UINT8                           SyncLevel;          /* 0-15, specified in Mutex() call */
184433d6423SLionel Sambuc     UINT16                          AcquisitionDepth;   /* Allow multiple Acquires, same thread */
185433d6423SLionel Sambuc     ACPI_MUTEX                      OsMutex;            /* Actual OS synchronization object */
186433d6423SLionel Sambuc     ACPI_THREAD_ID                  ThreadId;           /* Current owner of the mutex */
187433d6423SLionel Sambuc     struct acpi_thread_state        *OwnerThread;       /* Current owner of the mutex */
188433d6423SLionel Sambuc     union acpi_operand_object       *Prev;              /* Link for list of acquired mutexes */
189433d6423SLionel Sambuc     union acpi_operand_object       *Next;              /* Link for list of acquired mutexes */
190433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Containing namespace node */
191433d6423SLionel Sambuc     UINT8                           OriginalSyncLevel;  /* Owner's original sync level (0-15) */
192433d6423SLionel Sambuc 
193433d6423SLionel Sambuc } ACPI_OBJECT_MUTEX;
194433d6423SLionel Sambuc 
195433d6423SLionel Sambuc 
196433d6423SLionel Sambuc typedef struct acpi_object_region
197433d6423SLionel Sambuc {
198433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
199433d6423SLionel Sambuc     UINT8                           SpaceId;
200433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Containing namespace node */
201433d6423SLionel Sambuc     union acpi_operand_object       *Handler;           /* Handler for region access */
202433d6423SLionel Sambuc     union acpi_operand_object       *Next;
203433d6423SLionel Sambuc     ACPI_PHYSICAL_ADDRESS           Address;
204433d6423SLionel Sambuc     UINT32                          Length;
205433d6423SLionel Sambuc 
206433d6423SLionel Sambuc } ACPI_OBJECT_REGION;
207433d6423SLionel Sambuc 
208433d6423SLionel Sambuc 
209433d6423SLionel Sambuc typedef struct acpi_object_method
210433d6423SLionel Sambuc {
211433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
212*29492bb7SDavid van Moolenbroek     UINT8                           InfoFlags;
213433d6423SLionel Sambuc     UINT8                           ParamCount;
214433d6423SLionel Sambuc     UINT8                           SyncLevel;
215433d6423SLionel Sambuc     union acpi_operand_object       *Mutex;
216433d6423SLionel Sambuc     UINT8                           *AmlStart;
217433d6423SLionel Sambuc     union
218433d6423SLionel Sambuc     {
219433d6423SLionel Sambuc         ACPI_INTERNAL_METHOD            Implementation;
220433d6423SLionel Sambuc         union acpi_operand_object       *Handler;
221*29492bb7SDavid van Moolenbroek     } Dispatch;
222433d6423SLionel Sambuc 
223433d6423SLionel Sambuc     UINT32                          AmlLength;
224433d6423SLionel Sambuc     UINT8                           ThreadCount;
225433d6423SLionel Sambuc     ACPI_OWNER_ID                   OwnerId;
226433d6423SLionel Sambuc 
227433d6423SLionel Sambuc } ACPI_OBJECT_METHOD;
228433d6423SLionel Sambuc 
229*29492bb7SDavid van Moolenbroek /* Flags for InfoFlags field above */
230*29492bb7SDavid van Moolenbroek 
231*29492bb7SDavid van Moolenbroek #define ACPI_METHOD_MODULE_LEVEL        0x01    /* Method is actually module-level code */
232*29492bb7SDavid van Moolenbroek #define ACPI_METHOD_INTERNAL_ONLY       0x02    /* Method is implemented internally (_OSI) */
233*29492bb7SDavid van Moolenbroek #define ACPI_METHOD_SERIALIZED          0x04    /* Method is serialized */
234*29492bb7SDavid van Moolenbroek #define ACPI_METHOD_SERIALIZED_PENDING  0x08    /* Method is to be marked serialized */
235*29492bb7SDavid van Moolenbroek #define ACPI_METHOD_IGNORE_SYNC_LEVEL   0x10    /* Method was auto-serialized at table load time */
236*29492bb7SDavid van Moolenbroek #define ACPI_METHOD_MODIFIED_NAMESPACE  0x20    /* Method modified the namespace */
237*29492bb7SDavid van Moolenbroek 
238433d6423SLionel Sambuc 
239433d6423SLionel Sambuc /******************************************************************************
240433d6423SLionel Sambuc  *
241433d6423SLionel Sambuc  * Objects that can be notified. All share a common NotifyInfo area.
242433d6423SLionel Sambuc  *
243433d6423SLionel Sambuc  *****************************************************************************/
244433d6423SLionel Sambuc 
245433d6423SLionel Sambuc /*
246433d6423SLionel Sambuc  * Common fields for objects that support ASL notifications
247433d6423SLionel Sambuc  */
248433d6423SLionel Sambuc #define ACPI_COMMON_NOTIFY_INFO \
249*29492bb7SDavid van Moolenbroek     union acpi_operand_object       *NotifyList[2];     /* Handlers for system/device notifies */\
250433d6423SLionel Sambuc     union acpi_operand_object       *Handler;           /* Handler for Address space */
251433d6423SLionel Sambuc 
252433d6423SLionel Sambuc 
253433d6423SLionel Sambuc typedef struct acpi_object_notify_common    /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
254433d6423SLionel Sambuc {
255433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
256433d6423SLionel Sambuc     ACPI_COMMON_NOTIFY_INFO
257433d6423SLionel Sambuc 
258433d6423SLionel Sambuc } ACPI_OBJECT_NOTIFY_COMMON;
259433d6423SLionel Sambuc 
260433d6423SLionel Sambuc 
261433d6423SLionel Sambuc typedef struct acpi_object_device
262433d6423SLionel Sambuc {
263433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
264433d6423SLionel Sambuc     ACPI_COMMON_NOTIFY_INFO
265433d6423SLionel Sambuc     ACPI_GPE_BLOCK_INFO             *GpeBlock;
266433d6423SLionel Sambuc 
267433d6423SLionel Sambuc } ACPI_OBJECT_DEVICE;
268433d6423SLionel Sambuc 
269433d6423SLionel Sambuc 
270433d6423SLionel Sambuc typedef struct acpi_object_power_resource
271433d6423SLionel Sambuc {
272433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
273433d6423SLionel Sambuc     ACPI_COMMON_NOTIFY_INFO
274433d6423SLionel Sambuc     UINT32                          SystemLevel;
275433d6423SLionel Sambuc     UINT32                          ResourceOrder;
276433d6423SLionel Sambuc 
277433d6423SLionel Sambuc } ACPI_OBJECT_POWER_RESOURCE;
278433d6423SLionel Sambuc 
279433d6423SLionel Sambuc 
280433d6423SLionel Sambuc typedef struct acpi_object_processor
281433d6423SLionel Sambuc {
282433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
283433d6423SLionel Sambuc 
284433d6423SLionel Sambuc     /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
285433d6423SLionel Sambuc 
286433d6423SLionel Sambuc     UINT8                           ProcId;
287433d6423SLionel Sambuc     UINT8                           Length;
288433d6423SLionel Sambuc     ACPI_COMMON_NOTIFY_INFO
289433d6423SLionel Sambuc     ACPI_IO_ADDRESS                 Address;
290433d6423SLionel Sambuc 
291433d6423SLionel Sambuc } ACPI_OBJECT_PROCESSOR;
292433d6423SLionel Sambuc 
293433d6423SLionel Sambuc 
294433d6423SLionel Sambuc typedef struct acpi_object_thermal_zone
295433d6423SLionel Sambuc {
296433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
297433d6423SLionel Sambuc     ACPI_COMMON_NOTIFY_INFO
298433d6423SLionel Sambuc 
299433d6423SLionel Sambuc } ACPI_OBJECT_THERMAL_ZONE;
300433d6423SLionel Sambuc 
301433d6423SLionel Sambuc 
302433d6423SLionel Sambuc /******************************************************************************
303433d6423SLionel Sambuc  *
304433d6423SLionel Sambuc  * Fields. All share a common header/info field.
305433d6423SLionel Sambuc  *
306433d6423SLionel Sambuc  *****************************************************************************/
307433d6423SLionel Sambuc 
308433d6423SLionel Sambuc /*
309433d6423SLionel Sambuc  * Common bitfield for the field objects
310433d6423SLionel Sambuc  * "Field Datum"  -- a datum from the actual field object
311433d6423SLionel Sambuc  * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
312433d6423SLionel Sambuc  */
313433d6423SLionel Sambuc #define ACPI_COMMON_FIELD_INFO \
314433d6423SLionel Sambuc     UINT8                           FieldFlags;         /* Access, update, and lock bits */\
315433d6423SLionel Sambuc     UINT8                           Attribute;          /* From AccessAs keyword */\
316433d6423SLionel Sambuc     UINT8                           AccessByteWidth;    /* Read/Write size in bytes */\
317433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Link back to parent node */\
318433d6423SLionel Sambuc     UINT32                          BitLength;          /* Length of field in bits */\
319433d6423SLionel Sambuc     UINT32                          BaseByteOffset;     /* Byte offset within containing object */\
320433d6423SLionel Sambuc     UINT32                          Value;              /* Value to store into the Bank or Index register */\
321433d6423SLionel Sambuc     UINT8                           StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
322*29492bb7SDavid van Moolenbroek     UINT8                           AccessLength;       /* For serial regions/fields */
323433d6423SLionel Sambuc 
324433d6423SLionel Sambuc 
325433d6423SLionel Sambuc typedef struct acpi_object_field_common                 /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
326433d6423SLionel Sambuc {
327433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
328433d6423SLionel Sambuc     ACPI_COMMON_FIELD_INFO
329433d6423SLionel Sambuc     union acpi_operand_object       *RegionObj;         /* Parent Operation Region object (REGION/BANK fields only) */
330433d6423SLionel Sambuc 
331433d6423SLionel Sambuc } ACPI_OBJECT_FIELD_COMMON;
332433d6423SLionel Sambuc 
333433d6423SLionel Sambuc 
334433d6423SLionel Sambuc typedef struct acpi_object_region_field
335433d6423SLionel Sambuc {
336433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
337433d6423SLionel Sambuc     ACPI_COMMON_FIELD_INFO
338*29492bb7SDavid van Moolenbroek     UINT16                          ResourceLength;
339433d6423SLionel Sambuc     union acpi_operand_object       *RegionObj;         /* Containing OpRegion object */
340*29492bb7SDavid van Moolenbroek     UINT8                           *ResourceBuffer;    /* ResourceTemplate for serial regions/fields */
341*29492bb7SDavid van Moolenbroek     UINT16                          PinNumberIndex;     /* Index relative to previous Connection/Template */
342433d6423SLionel Sambuc 
343433d6423SLionel Sambuc } ACPI_OBJECT_REGION_FIELD;
344433d6423SLionel Sambuc 
345433d6423SLionel Sambuc 
346433d6423SLionel Sambuc typedef struct acpi_object_bank_field
347433d6423SLionel Sambuc {
348433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
349433d6423SLionel Sambuc     ACPI_COMMON_FIELD_INFO
350433d6423SLionel Sambuc     union acpi_operand_object       *RegionObj;         /* Containing OpRegion object */
351433d6423SLionel Sambuc     union acpi_operand_object       *BankObj;           /* BankSelect Register object */
352433d6423SLionel Sambuc 
353433d6423SLionel Sambuc } ACPI_OBJECT_BANK_FIELD;
354433d6423SLionel Sambuc 
355433d6423SLionel Sambuc 
356433d6423SLionel Sambuc typedef struct acpi_object_index_field
357433d6423SLionel Sambuc {
358433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
359433d6423SLionel Sambuc     ACPI_COMMON_FIELD_INFO
360433d6423SLionel Sambuc 
361433d6423SLionel Sambuc     /*
362433d6423SLionel Sambuc      * No "RegionObj" pointer needed since the Index and Data registers
363433d6423SLionel Sambuc      * are each field definitions unto themselves.
364433d6423SLionel Sambuc      */
365433d6423SLionel Sambuc     union acpi_operand_object       *IndexObj;          /* Index register */
366433d6423SLionel Sambuc     union acpi_operand_object       *DataObj;           /* Data register */
367433d6423SLionel Sambuc 
368433d6423SLionel Sambuc } ACPI_OBJECT_INDEX_FIELD;
369433d6423SLionel Sambuc 
370433d6423SLionel Sambuc 
371433d6423SLionel Sambuc /* The BufferField is different in that it is part of a Buffer, not an OpRegion */
372433d6423SLionel Sambuc 
373433d6423SLionel Sambuc typedef struct acpi_object_buffer_field
374433d6423SLionel Sambuc {
375433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
376433d6423SLionel Sambuc     ACPI_COMMON_FIELD_INFO
377433d6423SLionel Sambuc     union acpi_operand_object       *BufferObj;         /* Containing Buffer object */
378433d6423SLionel Sambuc 
379433d6423SLionel Sambuc } ACPI_OBJECT_BUFFER_FIELD;
380433d6423SLionel Sambuc 
381433d6423SLionel Sambuc 
382433d6423SLionel Sambuc /******************************************************************************
383433d6423SLionel Sambuc  *
384433d6423SLionel Sambuc  * Objects for handlers
385433d6423SLionel Sambuc  *
386433d6423SLionel Sambuc  *****************************************************************************/
387433d6423SLionel Sambuc 
388433d6423SLionel Sambuc typedef struct acpi_object_notify_handler
389433d6423SLionel Sambuc {
390433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
391433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Parent device */
392*29492bb7SDavid van Moolenbroek     UINT32                          HandlerType;        /* Type: Device/System/Both */
393*29492bb7SDavid van Moolenbroek     ACPI_NOTIFY_HANDLER             Handler;            /* Handler address */
394433d6423SLionel Sambuc     void                            *Context;
395*29492bb7SDavid van Moolenbroek     union acpi_operand_object       *Next[2];           /* Device and System handler lists */
396433d6423SLionel Sambuc 
397433d6423SLionel Sambuc } ACPI_OBJECT_NOTIFY_HANDLER;
398433d6423SLionel Sambuc 
399433d6423SLionel Sambuc 
400433d6423SLionel Sambuc typedef struct acpi_object_addr_handler
401433d6423SLionel Sambuc {
402433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
403433d6423SLionel Sambuc     UINT8                           SpaceId;
404433d6423SLionel Sambuc     UINT8                           HandlerFlags;
405433d6423SLionel Sambuc     ACPI_ADR_SPACE_HANDLER          Handler;
406433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Node;              /* Parent device */
407433d6423SLionel Sambuc     void                            *Context;
408433d6423SLionel Sambuc     ACPI_ADR_SPACE_SETUP            Setup;
409*29492bb7SDavid van Moolenbroek     union acpi_operand_object       *RegionList;        /* Regions using this handler */
410433d6423SLionel Sambuc     union acpi_operand_object       *Next;
411433d6423SLionel Sambuc 
412433d6423SLionel Sambuc } ACPI_OBJECT_ADDR_HANDLER;
413433d6423SLionel Sambuc 
414433d6423SLionel Sambuc /* Flags for address handler (HandlerFlags) */
415433d6423SLionel Sambuc 
416433d6423SLionel Sambuc #define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x01
417433d6423SLionel Sambuc 
418433d6423SLionel Sambuc 
419433d6423SLionel Sambuc /******************************************************************************
420433d6423SLionel Sambuc  *
421433d6423SLionel Sambuc  * Special internal objects
422433d6423SLionel Sambuc  *
423433d6423SLionel Sambuc  *****************************************************************************/
424433d6423SLionel Sambuc 
425433d6423SLionel Sambuc /*
426433d6423SLionel Sambuc  * The Reference object is used for these opcodes:
427433d6423SLionel Sambuc  * Arg[0-6], Local[0-7], IndexOp, NameOp, RefOfOp, LoadOp, LoadTableOp, DebugOp
428433d6423SLionel Sambuc  * The Reference.Class differentiates these types.
429433d6423SLionel Sambuc  */
430433d6423SLionel Sambuc typedef struct acpi_object_reference
431433d6423SLionel Sambuc {
432433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
433433d6423SLionel Sambuc      UINT8                           Class;              /* Reference Class */
434433d6423SLionel Sambuc      UINT8                           TargetType;         /* Used for Index Op */
435433d6423SLionel Sambuc      UINT8                           Reserved;
436433d6423SLionel Sambuc      void                            *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
437433d6423SLionel Sambuc      ACPI_NAMESPACE_NODE             *Node;              /* RefOf or Namepath */
438433d6423SLionel Sambuc      union acpi_operand_object       **Where;            /* Target of Index */
439433d6423SLionel Sambuc      UINT32                          Value;              /* Used for Local/Arg/Index/DdbHandle */
440433d6423SLionel Sambuc 
441433d6423SLionel Sambuc } ACPI_OBJECT_REFERENCE;
442433d6423SLionel Sambuc 
443433d6423SLionel Sambuc /* Values for Reference.Class above */
444433d6423SLionel Sambuc 
445433d6423SLionel Sambuc typedef enum
446433d6423SLionel Sambuc {
447433d6423SLionel Sambuc     ACPI_REFCLASS_LOCAL             = 0,        /* Method local */
448433d6423SLionel Sambuc     ACPI_REFCLASS_ARG               = 1,        /* Method argument */
449433d6423SLionel Sambuc     ACPI_REFCLASS_REFOF             = 2,        /* Result of RefOf() TBD: Split to Ref/Node and Ref/OperandObj? */
450433d6423SLionel Sambuc     ACPI_REFCLASS_INDEX             = 3,        /* Result of Index() */
451433d6423SLionel Sambuc     ACPI_REFCLASS_TABLE             = 4,        /* DdbHandle - Load(), LoadTable() */
452433d6423SLionel Sambuc     ACPI_REFCLASS_NAME              = 5,        /* Reference to a named object */
453433d6423SLionel Sambuc     ACPI_REFCLASS_DEBUG             = 6,        /* Debug object */
454433d6423SLionel Sambuc 
455433d6423SLionel Sambuc     ACPI_REFCLASS_MAX               = 6
456433d6423SLionel Sambuc 
457433d6423SLionel Sambuc } ACPI_REFERENCE_CLASSES;
458433d6423SLionel Sambuc 
459433d6423SLionel Sambuc 
460433d6423SLionel Sambuc /*
461433d6423SLionel Sambuc  * Extra object is used as additional storage for types that
462433d6423SLionel Sambuc  * have AML code in their declarations (TermArgs) that must be
463433d6423SLionel Sambuc  * evaluated at run time.
464433d6423SLionel Sambuc  *
465433d6423SLionel Sambuc  * Currently: Region and FieldUnit types
466433d6423SLionel Sambuc  */
467433d6423SLionel Sambuc typedef struct acpi_object_extra
468433d6423SLionel Sambuc {
469433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
470433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             *Method_REG;        /* _REG method for this region (if any) */
471*29492bb7SDavid van Moolenbroek     ACPI_NAMESPACE_NODE             *ScopeNode;
472433d6423SLionel Sambuc     void                            *RegionContext;     /* Region-specific data */
473433d6423SLionel Sambuc     UINT8                           *AmlStart;
474433d6423SLionel Sambuc     UINT32                          AmlLength;
475433d6423SLionel Sambuc 
476433d6423SLionel Sambuc } ACPI_OBJECT_EXTRA;
477433d6423SLionel Sambuc 
478433d6423SLionel Sambuc 
479433d6423SLionel Sambuc /* Additional data that can be attached to namespace nodes */
480433d6423SLionel Sambuc 
481433d6423SLionel Sambuc typedef struct acpi_object_data
482433d6423SLionel Sambuc {
483433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
484433d6423SLionel Sambuc     ACPI_OBJECT_HANDLER             Handler;
485433d6423SLionel Sambuc     void                            *Pointer;
486433d6423SLionel Sambuc 
487433d6423SLionel Sambuc } ACPI_OBJECT_DATA;
488433d6423SLionel Sambuc 
489433d6423SLionel Sambuc 
490433d6423SLionel Sambuc /* Structure used when objects are cached for reuse */
491433d6423SLionel Sambuc 
492433d6423SLionel Sambuc typedef struct acpi_object_cache_list
493433d6423SLionel Sambuc {
494433d6423SLionel Sambuc     ACPI_OBJECT_COMMON_HEADER
495433d6423SLionel Sambuc     union acpi_operand_object       *Next;              /* Link for object cache and internal lists*/
496433d6423SLionel Sambuc 
497433d6423SLionel Sambuc } ACPI_OBJECT_CACHE_LIST;
498433d6423SLionel Sambuc 
499433d6423SLionel Sambuc 
500433d6423SLionel Sambuc /******************************************************************************
501433d6423SLionel Sambuc  *
502433d6423SLionel Sambuc  * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
503433d6423SLionel Sambuc  *
504433d6423SLionel Sambuc  *****************************************************************************/
505433d6423SLionel Sambuc 
506433d6423SLionel Sambuc typedef union acpi_operand_object
507433d6423SLionel Sambuc {
508433d6423SLionel Sambuc     ACPI_OBJECT_COMMON                  Common;
509433d6423SLionel Sambuc     ACPI_OBJECT_INTEGER                 Integer;
510433d6423SLionel Sambuc     ACPI_OBJECT_STRING                  String;
511433d6423SLionel Sambuc     ACPI_OBJECT_BUFFER                  Buffer;
512433d6423SLionel Sambuc     ACPI_OBJECT_PACKAGE                 Package;
513433d6423SLionel Sambuc     ACPI_OBJECT_EVENT                   Event;
514433d6423SLionel Sambuc     ACPI_OBJECT_METHOD                  Method;
515433d6423SLionel Sambuc     ACPI_OBJECT_MUTEX                   Mutex;
516433d6423SLionel Sambuc     ACPI_OBJECT_REGION                  Region;
517433d6423SLionel Sambuc     ACPI_OBJECT_NOTIFY_COMMON           CommonNotify;
518433d6423SLionel Sambuc     ACPI_OBJECT_DEVICE                  Device;
519433d6423SLionel Sambuc     ACPI_OBJECT_POWER_RESOURCE          PowerResource;
520433d6423SLionel Sambuc     ACPI_OBJECT_PROCESSOR               Processor;
521433d6423SLionel Sambuc     ACPI_OBJECT_THERMAL_ZONE            ThermalZone;
522433d6423SLionel Sambuc     ACPI_OBJECT_FIELD_COMMON            CommonField;
523433d6423SLionel Sambuc     ACPI_OBJECT_REGION_FIELD            Field;
524433d6423SLionel Sambuc     ACPI_OBJECT_BUFFER_FIELD            BufferField;
525433d6423SLionel Sambuc     ACPI_OBJECT_BANK_FIELD              BankField;
526433d6423SLionel Sambuc     ACPI_OBJECT_INDEX_FIELD             IndexField;
527433d6423SLionel Sambuc     ACPI_OBJECT_NOTIFY_HANDLER          Notify;
528433d6423SLionel Sambuc     ACPI_OBJECT_ADDR_HANDLER            AddressSpace;
529433d6423SLionel Sambuc     ACPI_OBJECT_REFERENCE               Reference;
530433d6423SLionel Sambuc     ACPI_OBJECT_EXTRA                   Extra;
531433d6423SLionel Sambuc     ACPI_OBJECT_DATA                    Data;
532433d6423SLionel Sambuc     ACPI_OBJECT_CACHE_LIST              Cache;
533433d6423SLionel Sambuc 
534433d6423SLionel Sambuc     /*
535433d6423SLionel Sambuc      * Add namespace node to union in order to simplify code that accepts both
536433d6423SLionel Sambuc      * ACPI_OPERAND_OBJECTs and ACPI_NAMESPACE_NODEs. The structures share
537433d6423SLionel Sambuc      * a common DescriptorType field in order to differentiate them.
538433d6423SLionel Sambuc      */
539433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE                 Node;
540433d6423SLionel Sambuc 
541433d6423SLionel Sambuc } ACPI_OPERAND_OBJECT;
542433d6423SLionel Sambuc 
543433d6423SLionel Sambuc 
544433d6423SLionel Sambuc /******************************************************************************
545433d6423SLionel Sambuc  *
546433d6423SLionel Sambuc  * ACPI_DESCRIPTOR - objects that share a common descriptor identifier
547433d6423SLionel Sambuc  *
548433d6423SLionel Sambuc  *****************************************************************************/
549433d6423SLionel Sambuc 
550433d6423SLionel Sambuc /* Object descriptor types */
551433d6423SLionel Sambuc 
552433d6423SLionel Sambuc #define ACPI_DESC_TYPE_CACHED           0x01        /* Used only when object is cached */
553433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE            0x02
554433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_UPDATE     0x03
555433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_PACKAGE    0x04
556433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_CONTROL    0x05
557433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_RPSCOPE    0x06
558433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_PSCOPE     0x07
559433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_WSCOPE     0x08
560433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_RESULT     0x09
561433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_NOTIFY     0x0A
562433d6423SLionel Sambuc #define ACPI_DESC_TYPE_STATE_THREAD     0x0B
563433d6423SLionel Sambuc #define ACPI_DESC_TYPE_WALK             0x0C
564433d6423SLionel Sambuc #define ACPI_DESC_TYPE_PARSER           0x0D
565433d6423SLionel Sambuc #define ACPI_DESC_TYPE_OPERAND          0x0E
566433d6423SLionel Sambuc #define ACPI_DESC_TYPE_NAMED            0x0F
567433d6423SLionel Sambuc #define ACPI_DESC_TYPE_MAX              0x0F
568433d6423SLionel Sambuc 
569433d6423SLionel Sambuc 
570433d6423SLionel Sambuc typedef struct acpi_common_descriptor
571433d6423SLionel Sambuc {
572433d6423SLionel Sambuc     void                            *CommonPointer;
573433d6423SLionel Sambuc     UINT8                           DescriptorType; /* To differentiate various internal objs */
574433d6423SLionel Sambuc 
575433d6423SLionel Sambuc } ACPI_COMMON_DESCRIPTOR;
576433d6423SLionel Sambuc 
577433d6423SLionel Sambuc typedef union acpi_descriptor
578433d6423SLionel Sambuc {
579433d6423SLionel Sambuc     ACPI_COMMON_DESCRIPTOR          Common;
580433d6423SLionel Sambuc     ACPI_OPERAND_OBJECT             Object;
581433d6423SLionel Sambuc     ACPI_NAMESPACE_NODE             Node;
582433d6423SLionel Sambuc     ACPI_PARSE_OBJECT               Op;
583433d6423SLionel Sambuc 
584433d6423SLionel Sambuc } ACPI_DESCRIPTOR;
585433d6423SLionel Sambuc 
586433d6423SLionel Sambuc #pragma pack()
587433d6423SLionel Sambuc 
588433d6423SLionel Sambuc #endif /* _ACOBJECT_H */
589