acobject.h revision 99146
1105401Stmm
2105401Stmm/******************************************************************************
3105401Stmm *
4105401Stmm * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
5105401Stmm *       $Revision: 110 $
6105401Stmm *
7105401Stmm *****************************************************************************/
8105401Stmm
9105401Stmm/******************************************************************************
10105401Stmm *
11105401Stmm * 1. Copyright Notice
12105401Stmm *
13105401Stmm * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
14105401Stmm * All rights reserved.
15105401Stmm *
16105401Stmm * 2. License
17105401Stmm *
18105401Stmm * 2.1. This is your license from Intel Corp. under its intellectual property
19105401Stmm * rights.  You may have additional license terms from the party that provided
20105401Stmm * you this software, covering your right to use that party's intellectual
21105401Stmm * property rights.
22105401Stmm *
23105401Stmm * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24105401Stmm * copy of the source code appearing in this file ("Covered Code") an
25105401Stmm * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26105401Stmm * base code distributed originally by Intel ("Original Intel Code") to copy,
27105401Stmm * make derivatives, distribute, use and display any portion of the Covered
28105401Stmm * Code in any form, with the right to sublicense such rights; and
29105401Stmm *
30105401Stmm * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31105401Stmm * license (with the right to sublicense), under only those claims of Intel
32105401Stmm * patents that are infringed by the Original Intel Code, to make, use, sell,
33129589Smarius * offer to sell, and import the Covered Code and derivative works thereof
34105401Stmm * solely to the minimum extent necessary to exercise the above copyright
35105401Stmm * license, and in no event shall the patent license extend to any additions
36105401Stmm * to or modifications of the Original Intel Code.  No other license or right
37129589Smarius * is granted directly or by implication, estoppel or otherwise;
38105401Stmm *
39105401Stmm * The above copyright and patent license is granted only if the following
40129589Smarius * conditions are met:
41105401Stmm *
42105401Stmm * 3. Conditions
43129589Smarius *
44105401Stmm * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45129589Smarius * Redistribution of source code of any substantial portion of the Covered
46116212Stmm * Code or modification with rights to further distribute source must include
47116212Stmm * the above Copyright Notice, the above License, this list of Conditions,
48116212Stmm * and the following Disclaimer and Export Compliance provision.  In addition,
49105401Stmm * Licensee must cause all Covered Code to which Licensee contributes to
50105401Stmm * 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.
55 *
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
66 * make.
67 *
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
72 * distribution.
73 *
74 * 3.4. Intel retains all right, title, and interest in and to the Original
75 * Intel Code.
76 *
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.
81 *
82 * 4. Disclaimer and Export Compliance
83 *
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
90 * PARTICULAR PURPOSE.
91 *
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
99 * LIMITED REMEDY.
100 *
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.
115 *
116 *****************************************************************************/
117
118#ifndef _ACOBJECT_H
119#define _ACOBJECT_H
120
121
122/*
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.
127 */
128
129/*******************************************************************************
130 *
131 * Common Descriptors
132 *
133 ******************************************************************************/
134
135/*
136 * Common area for all objects.
137 *
138 * DataType is used to differentiate between internal descriptors, and MUST
139 * be the first byte in this structure.
140 */
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_obj      *NextObject;        /* Objects linked to parent NS node */\
146    UINT8                       Flags; \
147
148/* Values for flag byte above */
149
150#define AOPOBJ_RESERVED             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
156
157
158/*
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
162 */
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                       DatumValidBits;     /* Valid bit in first "Field datum" */\
171    UINT8                       EndFieldValidBits;  /* Valid bits in the last "field datum" */\
172    UINT8                       EndBufferValidBits; /* Valid bits in the last "buffer datum" */\
173    UINT32                      Value;              /* Value to store into the Bank or Index register */\
174    ACPI_NAMESPACE_NODE         *Node;              /* Link back to parent node */
175
176
177/*
178 * Fields common to both Strings and Buffers
179 */
180#define ACPI_COMMON_BUFFER_INFO \
181    UINT32                      Length;
182
183
184/*
185 * Common fields for objects that support ASL notifications
186 */
187#define ACPI_COMMON_NOTIFY_INFO \
188    union acpi_operand_obj      *SysHandler;         /* Handler for system notifies */\
189    union acpi_operand_obj      *DrvHandler;         /* Handler for driver notifies */\
190    union acpi_operand_obj      *AddrHandler;        /* Handler for Address space */
191
192
193
194/******************************************************************************
195 *
196 * Basic data types
197 *
198 *****************************************************************************/
199
200typedef struct AcpiObjectCommon
201{
202    ACPI_OBJECT_COMMON_HEADER
203
204} ACPI_OBJECT_COMMON;
205
206
207typedef struct AcpiObjectInteger
208{
209    ACPI_OBJECT_COMMON_HEADER
210
211    ACPI_INTEGER                Value;
212
213} ACPI_OBJECT_INTEGER;
214
215
216typedef struct AcpiObjectString                     /* Null terminated, ASCII characters only */
217{
218    ACPI_OBJECT_COMMON_HEADER
219    ACPI_COMMON_BUFFER_INFO
220    NATIVE_CHAR                 *Pointer;           /* String in AML stream or allocated string */
221
222} ACPI_OBJECT_STRING;
223
224
225typedef struct AcpiObjectBuffer
226{
227    ACPI_OBJECT_COMMON_HEADER
228    ACPI_COMMON_BUFFER_INFO
229    UINT8                       *Pointer;           /* Buffer in AML stream or allocated buffer */
230    ACPI_NAMESPACE_NODE         *Node;              /* Link back to parent node */
231    UINT8                       *AmlStart;
232    UINT32                      AmlLength;
233
234} ACPI_OBJECT_BUFFER;
235
236
237typedef struct AcpiObjectPackage
238{
239    ACPI_OBJECT_COMMON_HEADER
240
241    UINT32                      Count;              /* # of elements in package */
242    UINT32                      AmlLength;
243    UINT8                       *AmlStart;
244    ACPI_NAMESPACE_NODE         *Node;              /* Link back to parent node */
245    union acpi_operand_obj      **Elements;         /* Array of pointers to AcpiObjects */
246
247} ACPI_OBJECT_PACKAGE;
248
249
250
251/******************************************************************************
252 *
253 * Complex data types
254 *
255 *****************************************************************************/
256
257typedef struct AcpiObjectEvent
258{
259    ACPI_OBJECT_COMMON_HEADER
260    void                        *Semaphore;
261
262} ACPI_OBJECT_EVENT;
263
264
265#define INFINITE_CONCURRENCY        0xFF
266
267typedef struct AcpiObjectMethod
268{
269    ACPI_OBJECT_COMMON_HEADER
270    UINT8                       MethodFlags;
271    UINT8                       ParamCount;
272
273    UINT32                      AmlLength;
274
275    void                        *Semaphore;
276    UINT8                       *AmlStart;
277
278    UINT8                       Concurrency;
279    UINT8                       ThreadCount;
280    ACPI_OWNER_ID               OwningId;
281
282} ACPI_OBJECT_METHOD;
283
284
285typedef struct AcpiObjectMutex
286{
287    ACPI_OBJECT_COMMON_HEADER
288    UINT16                      SyncLevel;
289    UINT16                      AcquisitionDepth;
290
291    struct acpi_thread_state    *OwnerThread;
292    void                        *Semaphore;
293    union acpi_operand_obj      *Prev;              /* Link for list of acquired mutexes */
294    union acpi_operand_obj      *Next;              /* Link for list of acquired mutexes */
295
296} ACPI_OBJECT_MUTEX;
297
298
299typedef struct AcpiObjectRegion
300{
301    ACPI_OBJECT_COMMON_HEADER
302
303    UINT8                       SpaceId;
304
305    union acpi_operand_obj      *AddrHandler;       /* Handler for system notifies */
306    ACPI_NAMESPACE_NODE         *Node;              /* containing object */
307    union acpi_operand_obj      *Next;
308    UINT32                      Length;
309    ACPI_PHYSICAL_ADDRESS       Address;
310
311} ACPI_OBJECT_REGION;
312
313
314
315/******************************************************************************
316 *
317 * Objects that can be notified.  All share a common NotifyInfo area.
318 *
319 *****************************************************************************/
320
321typedef struct AcpiObjectNotifyCommon               /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
322{
323    ACPI_OBJECT_COMMON_HEADER
324    ACPI_COMMON_NOTIFY_INFO
325
326} ACPI_OBJECT_NOTIFY_COMMON;
327
328
329typedef struct AcpiObjectDevice
330{
331    ACPI_OBJECT_COMMON_HEADER
332    ACPI_COMMON_NOTIFY_INFO
333
334} ACPI_OBJECT_DEVICE;
335
336
337typedef struct AcpiObjectPowerResource
338{
339    ACPI_OBJECT_COMMON_HEADER
340    ACPI_COMMON_NOTIFY_INFO
341
342    UINT32                      SystemLevel;
343    UINT32                      ResourceOrder;
344
345} ACPI_OBJECT_POWER_RESOURCE;
346
347
348typedef struct AcpiObjectProcessor
349{
350    ACPI_OBJECT_COMMON_HEADER
351    ACPI_COMMON_NOTIFY_INFO
352
353    UINT32                      ProcId;
354    UINT32                      Length;
355    ACPI_IO_ADDRESS             Address;
356
357} ACPI_OBJECT_PROCESSOR;
358
359
360typedef struct AcpiObjectThermalZone
361{
362    ACPI_OBJECT_COMMON_HEADER
363    ACPI_COMMON_NOTIFY_INFO
364
365
366} ACPI_OBJECT_THERMAL_ZONE;
367
368
369
370/******************************************************************************
371 *
372 * Fields.  All share a common header/info field.
373 *
374 *****************************************************************************/
375
376typedef struct AcpiObjectFieldCommon                /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
377{
378    ACPI_OBJECT_COMMON_HEADER
379    ACPI_COMMON_FIELD_INFO
380    union acpi_operand_obj      *RegionObj;         /* Containing Operation Region object */
381                                                    /* (REGION/BANK fields only) */
382} ACPI_OBJECT_FIELD_COMMON;
383
384
385typedef struct AcpiObjectRegionField
386{
387    ACPI_OBJECT_COMMON_HEADER
388    ACPI_COMMON_FIELD_INFO
389    union acpi_operand_obj      *RegionObj;         /* Containing OpRegion object */
390
391} ACPI_OBJECT_REGION_FIELD;
392
393
394typedef struct AcpiObjectBankField
395{
396    ACPI_OBJECT_COMMON_HEADER
397    ACPI_COMMON_FIELD_INFO
398
399    union acpi_operand_obj      *RegionObj;         /* Containing OpRegion object */
400    union acpi_operand_obj      *BankObj;           /* BankSelect Register object */
401
402} ACPI_OBJECT_BANK_FIELD;
403
404
405typedef struct AcpiObjectIndexField
406{
407    ACPI_OBJECT_COMMON_HEADER
408    ACPI_COMMON_FIELD_INFO
409
410    /*
411     * No "RegionObj" pointer needed since the Index and Data registers
412     * are each field definitions unto themselves.
413     */
414    union acpi_operand_obj      *IndexObj;          /* Index register */
415    union acpi_operand_obj      *DataObj;           /* Data register */
416
417
418} ACPI_OBJECT_INDEX_FIELD;
419
420
421/* The BufferField is different in that it is part of a Buffer, not an OpRegion */
422
423typedef struct AcpiObjectBufferField
424{
425    ACPI_OBJECT_COMMON_HEADER
426    ACPI_COMMON_FIELD_INFO
427
428    union acpi_operand_obj      *BufferObj;         /* Containing Buffer object */
429
430} ACPI_OBJECT_BUFFER_FIELD;
431
432
433
434/******************************************************************************
435 *
436 * Objects for handlers
437 *
438 *****************************************************************************/
439
440typedef struct AcpiObjectNotifyHandler
441{
442    ACPI_OBJECT_COMMON_HEADER
443
444    ACPI_NAMESPACE_NODE         *Node;               /* Parent device */
445    ACPI_NOTIFY_HANDLER         Handler;
446    void                        *Context;
447
448} ACPI_OBJECT_NOTIFY_HANDLER;
449
450
451/* Flags for address handler */
452
453#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED  0x1
454
455
456typedef struct AcpiObjectAddrHandler
457{
458    ACPI_OBJECT_COMMON_HEADER
459
460    UINT8                       SpaceId;
461    UINT16                      Hflags;
462    ACPI_ADR_SPACE_HANDLER      Handler;
463
464    ACPI_NAMESPACE_NODE         *Node;              /* Parent device */
465    void                        *Context;
466    ACPI_ADR_SPACE_SETUP        Setup;
467    union acpi_operand_obj      *RegionList;        /* regions using this handler */
468    union acpi_operand_obj      *Next;
469
470} ACPI_OBJECT_ADDR_HANDLER;
471
472
473
474/******************************************************************************
475 *
476 * Special internal objects
477 *
478 *****************************************************************************/
479
480/*
481 * The Reference object type is used for these opcodes:
482 * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp
483 */
484typedef struct AcpiObjectReference
485{
486    ACPI_OBJECT_COMMON_HEADER
487
488    UINT8                       TargetType;         /* Used for IndexOp */
489    UINT16                      Opcode;
490    UINT32                      Offset;             /* Used for ArgOp, LocalOp, and IndexOp */
491
492    void                        *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT  */
493    ACPI_NAMESPACE_NODE         *Node;
494    union acpi_operand_obj      **Where;
495
496} ACPI_OBJECT_REFERENCE;
497
498
499/*
500 * Extra object is used as additional storage for types that
501 * have AML code in their declarations (TermArgs) that must be
502 * evaluated at run time.
503 *
504 * Currently: Region and FieldUnit types
505 */
506typedef struct AcpiObjectExtra
507{
508    ACPI_OBJECT_COMMON_HEADER
509    UINT8                       ByteFill1;
510    UINT16                      WordFill1;
511    UINT32                      AmlLength;
512    UINT8                       *AmlStart;
513    ACPI_NAMESPACE_NODE         *Method_REG;        /* _REG method for this region (if any) */
514    void                        *RegionContext;     /* Region-specific data */
515
516} ACPI_OBJECT_EXTRA;
517
518
519/* Additional data that can be attached to namespace nodes */
520
521typedef struct AcpiObjectData
522{
523    ACPI_OBJECT_COMMON_HEADER
524    ACPI_OBJECT_HANDLER         Handler;
525    void                        *Pointer;
526
527} ACPI_OBJECT_DATA;
528
529
530/* Structure used when objects are cached for reuse */
531
532typedef struct AcpiObjectCacheList
533{
534    ACPI_OBJECT_COMMON_HEADER
535    union acpi_operand_obj      *Next;              /* Link for object cache and internal lists*/
536
537} ACPI_OBJECT_CACHE_LIST;
538
539
540
541/******************************************************************************
542 *
543 * ACPI_OPERAND_OBJECT Descriptor - a giant union of all of the above
544 *
545 *****************************************************************************/
546
547typedef union acpi_operand_obj
548{
549    ACPI_OBJECT_COMMON          Common;
550
551    ACPI_OBJECT_INTEGER         Integer;
552    ACPI_OBJECT_STRING          String;
553    ACPI_OBJECT_BUFFER          Buffer;
554    ACPI_OBJECT_PACKAGE         Package;
555
556    ACPI_OBJECT_EVENT           Event;
557    ACPI_OBJECT_METHOD          Method;
558    ACPI_OBJECT_MUTEX           Mutex;
559    ACPI_OBJECT_REGION          Region;
560
561    ACPI_OBJECT_NOTIFY_COMMON   CommonNotify;
562    ACPI_OBJECT_DEVICE          Device;
563    ACPI_OBJECT_POWER_RESOURCE  PowerResource;
564    ACPI_OBJECT_PROCESSOR       Processor;
565    ACPI_OBJECT_THERMAL_ZONE    ThermalZone;
566
567    ACPI_OBJECT_FIELD_COMMON    CommonField;
568    ACPI_OBJECT_REGION_FIELD    Field;
569    ACPI_OBJECT_BUFFER_FIELD    BufferField;
570    ACPI_OBJECT_BANK_FIELD      BankField;
571    ACPI_OBJECT_INDEX_FIELD     IndexField;
572
573    ACPI_OBJECT_NOTIFY_HANDLER  NotifyHandler;
574    ACPI_OBJECT_ADDR_HANDLER    AddrHandler;
575
576    ACPI_OBJECT_REFERENCE       Reference;
577    ACPI_OBJECT_EXTRA           Extra;
578    ACPI_OBJECT_DATA            Data;
579    ACPI_OBJECT_CACHE_LIST      Cache;
580
581} ACPI_OPERAND_OBJECT;
582
583#endif /* _ACOBJECT_H */
584