acobject.h revision 69450
11573Srgrimes
21573Srgrimes/******************************************************************************
31573Srgrimes *
41573Srgrimes * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
51573Srgrimes *       $Revision: 75 $
61573Srgrimes *
71573Srgrimes *****************************************************************************/
81573Srgrimes
91573Srgrimes/******************************************************************************
101573Srgrimes *
111573Srgrimes * 1. Copyright Notice
121573Srgrimes *
131573Srgrimes * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
141573Srgrimes * reserved.
151573Srgrimes *
161573Srgrimes * 2. License
171573Srgrimes *
181573Srgrimes * 2.1. This is your license from Intel Corp. under its intellectual property
191573Srgrimes * rights.  You may have additional license terms from the party that provided
201573Srgrimes * you this software, covering your right to use that party's intellectual
211573Srgrimes * property rights.
221573Srgrimes *
231573Srgrimes * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
241573Srgrimes * copy of the source code appearing in this file ("Covered Code") an
251573Srgrimes * irrevocable, perpetual, worldwide license under Intel's copyrights in the
261573Srgrimes * base code distributed originally by Intel ("Original Intel Code") to copy,
271573Srgrimes * make derivatives, distribute, use and display any portion of the Covered
281573Srgrimes * Code in any form, with the right to sublicense such rights; and
2950476Speter *
301573Srgrimes * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31286948Scem * license (with the right to sublicense), under only those claims of Intel
321573Srgrimes * patents that are infringed by the Original Intel Code, to make, use, sell,
3379531Sru * offer to sell, and import the Covered Code and derivative works thereof
341573Srgrimes * solely to the minimum extent necessary to exercise the above copyright
351573Srgrimes * license, and in no event shall the patent license extend to any additions
361573Srgrimes * to or modifications of the Original Intel Code.  No other license or right
371573Srgrimes * is granted directly or by implication, estoppel or otherwise;
3859460Sphantom *
3959460Sphantom * The above copyright and patent license is granted only if the following
401573Srgrimes * conditions are met:
4184306Sru *
4284306Sru * 3. Conditions
4384306Sru *
441573Srgrimes * 3.1. Redistribution of Source with Rights to Further Distribute Source.
451573Srgrimes * Redistribution of source code of any substantial portion of the Covered
461573Srgrimes * Code or modification with rights to further distribute source must include
4724822Sbde * the above Copyright Notice, the above License, this list of Conditions,
481573Srgrimes * and the following Disclaimer and Export Compliance provision.  In addition,
491573Srgrimes * Licensee must cause all Covered Code to which Licensee contributes to
501573Srgrimes * contain a file documenting the changes Licensee made to create that Covered
511573Srgrimes * Code and the date of any change.  Licensee must include in that file the
52108028Sru * documentation of any changes made by any predecessor Licensee.  Licensee
531573Srgrimes * must include a prominent statement that the modification is derived,
54108028Sru * directly or indirectly, from Original Intel Code.
551573Srgrimes *
561573Srgrimes * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
571573Srgrimes * Redistribution of source code of any substantial portion of the Covered
58108087Sru * Code or modification without rights to further distribute source must
591573Srgrimes * include the following Disclaimer and Export Compliance provision in the
60130445Sdas * documentation and/or other materials provided with distribution.  In
61130437Sdas * addition, Licensee may not authorize further sublicense of source of any
62130437Sdas * portion of the Covered Code, and must include terms to the effect that the
63130445Sdas * license from Licensee to its licensee is limited to the intellectual
641573Srgrimes * property embodied in the software Licensee provides to its licensee, and
6514855Smpp * not to intellectual property embodied in modifications its licensee may
661573Srgrimes * make.
67130445Sdas *
681573Srgrimes * 3.3. Redistribution of Executable. Redistribution in executable form of any
691573Srgrimes * substantial portion of the Covered Code or modification must reproduce the
70130445Sdas * above Copyright Notice, and the following Disclaimer and Export Compliance
711573Srgrimes * provision in the documentation and/or other materials provided with the
721573Srgrimes * distribution.
731573Srgrimes *
74108028Sru * 3.4. Intel retains all right, title, and interest in and to the Original
75130445Sdas * Intel Code.
761573Srgrimes *
77286948Scem * 3.5. Neither the name Intel nor any other trademark owned or controlled by
78286948Scem * Intel shall be used in advertising or otherwise to promote the sale, use or
79130445Sdas * other dealings in products derived from or relating to the Covered Code
801573Srgrimes * without prior written authorization from Intel.
811573Srgrimes *
821573Srgrimes * 4. Disclaimer and Export Compliance
83108028Sru *
84130445Sdas * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
851573Srgrimes * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
86130445Sdas * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
871573Srgrimes * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
88286948Scem * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
89286948Scem * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
90130445Sdas * PARTICULAR PURPOSE.
91286948Scem *
92286948Scem * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
93286948Scem * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
94286948Scem * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
95286948Scem * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
96286948Scem * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
97286948Scem * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
98286948Scem * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
99286948Scem * LIMITED REMEDY.
100286948Scem *
101286948Scem * 4.3. Licensee shall not export, either directly or indirectly, any of this
102286948Scem * software or system incorporating such software without first obtaining any
103286948Scem * required license or other approval from the U. S. Department of Commerce or
104286948Scem * any other agency or department of the United States Government.  In the
105286948Scem * event Licensee exports any such software from the United States or
106286948Scem * re-exports any such software from a foreign destination, Licensee shall
107130445Sdas * ensure that the distribution and export/re-export of the software is in
108130437Sdas * compliance with all laws, regulations, orders, or other restrictions of the
109130437Sdas * U.S. Export Administration Regulations. Licensee agrees that neither it nor
110130437Sdas * any of its subsidiaries will export/re-export any technical data, process,
111130445Sdas * software, or service, directly or indirectly, to any country for which the
1121573Srgrimes * United States government or any agency thereof requires an export license,
1131573Srgrimes * other governmental approval, or letter of assurance, without first obtaining
1141573Srgrimes * such license, approval or letter.
115194767Skib *
116194767Skib *****************************************************************************/
117194767Skib
118194767Skib#ifndef _ACOBJECT_H
119194767Skib#define _ACOBJECT_H
120194767Skib
121194767Skib
122194767Skib/*
123194767Skib * The ACPI_OPERAND_OBJECT  is used to pass AML operands from the dispatcher
124286948Scem * to the interpreter, and to keep track of the various handlers such as
125286948Scem * address space handlers and notify handlers.  The object is a constant
126286948Scem * size in order to allow them to be cached and reused.
1271573Srgrimes *
1281573Srgrimes * All variants of the ACPI_OPERAND_OBJECT  are defined with the same
129131504Sru * sequence of field types, with fields that are not used in a particular
130286948Scem * variant being named "Reserved".  This is not strictly necessary, but
131286948Scem * may in some circumstances simplify understanding if these structures
132286948Scem * need to be displayed in a debugger having limited (or no) support for
133286948Scem * union types.  It also simplifies some debug code in DumpTable() which
134286948Scem * dumps multi-level values: fetching Buffer.Pointer suffices to pick up
135286948Scem * the value or next level for any of several types.
136286948Scem */
137286948Scem
138131504Sru/******************************************************************************
139108040Sru *
1401573Srgrimes * Common Descriptors
1411573Srgrimes *
1421573Srgrimes *****************************************************************************/
14322132Smpp
14422132Smpp/*
1451573Srgrimes * Common area for all objects.
1461573Srgrimes *
1471573Srgrimes * DataType is used to differentiate between internal descriptors, and MUST
148131504Sru * be the first byte in this structure.
149131504Sru */
15079754Sdd
1511573Srgrimes
15279754Sdd#define ACPI_OBJECT_COMMON_HEADER           /* 32-bits plus 8-bit flag */\
1531573Srgrimes    UINT8                       DataType;           /* To differentiate various internal objs */\
1541573Srgrimes    UINT8                       Type;               /* ACPI_OBJECT_TYPE */\
1551573Srgrimes    UINT16                      ReferenceCount;     /* For object deletion management */\
1561573Srgrimes    UINT8                       Flags; \
1571573Srgrimes
1581573Srgrimes/* Defines for flag byte above */
1591573Srgrimes
1601573Srgrimes#define AOPOBJ_STATIC_ALLOCATION    0x1
1611573Srgrimes#define AOPOBJ_DATA_VALID           0x2
1621573Srgrimes#define AOPOBJ_INITIALIZED          0x4
1631573Srgrimes
1641573Srgrimes
1651573Srgrimes/*
1661573Srgrimes * Common bitfield for the field objects
1671573Srgrimes */
1681573Srgrimes#define ACPI_COMMON_FIELD_INFO              /* Three 32-bit values plus 8*/\
1691573Srgrimes    UINT8                       Granularity;\
1701573Srgrimes    UINT16                      Length; \
17132450Salex    UINT32                      Offset;             /* Byte offset within containing object */\
172108028Sru    UINT8                       BitOffset;          /* Bit offset within min read/write data unit */\
1731573Srgrimes    UINT8                       Access;             /* AccessType */\
1741573Srgrimes    UINT8                       LockRule;\
1751573Srgrimes    UINT8                       UpdateRule;\
1761573Srgrimes    UINT8                       AccessAttribute;
1771573Srgrimes
1781573Srgrimes
1791573Srgrimes/******************************************************************************
1801573Srgrimes *
1811573Srgrimes * Individual Object Descriptors
1821573Srgrimes *
1831573Srgrimes *****************************************************************************/
184131504Sru
185131504Sru
1861573Srgrimestypedef struct /* COMMON */
1871573Srgrimes{
1881573Srgrimes    ACPI_OBJECT_COMMON_HEADER
1891573Srgrimes
190286948Scem} ACPI_OBJECT_COMMON;
191286948Scem
192286948Scem
193286948Scemtypedef struct /* CACHE_LIST */
194286948Scem{
195286948Scem    ACPI_OBJECT_COMMON_HEADER
196286948Scem    union acpi_operand_obj      *Next;              /* Link for object cache and internal lists*/
197286948Scem
198286948Scem} ACPI_OBJECT_CACHE_LIST;
199286948Scem
200286948Scem
201286948Scemtypedef struct /* NUMBER - has value */
202286948Scem{
203286948Scem    ACPI_OBJECT_COMMON_HEADER
2041573Srgrimes
20582642Sru    ACPI_INTEGER                Value;
2061573Srgrimes
207108028Sru} ACPI_OBJECT_NUMBER;
208108028Sru
2091573Srgrimes
2101573Srgrimestypedef struct /* STRING - has length and pointer */
211108028Sru{
2121573Srgrimes    ACPI_OBJECT_COMMON_HEADER
2131573Srgrimes
2141573Srgrimes    UINT32                      Length;
2151573Srgrimes    NATIVE_CHAR                 *Pointer;       /* String value in AML stream or in allocated space */
2161573Srgrimes
2171573Srgrimes} ACPI_OBJECT_STRING;
2181573Srgrimes
2191573Srgrimes
2201573Srgrimestypedef struct /* BUFFER - has length, sequence, and pointer */
2211573Srgrimes{
2221573Srgrimes    ACPI_OBJECT_COMMON_HEADER
2231573Srgrimes
2241573Srgrimes    UINT32                      Length;
2251573Srgrimes    UINT32                      Sequence;       /* Sequential count of buffers created */
22614038Smpp
22714038Smpp    UINT8                       *Pointer;       /* points to the buffer in allocated space */
228276006Sbrueffer
2291573Srgrimes} ACPI_OBJECT_BUFFER;
230101579Sru
231101579Sru
2321573Srgrimestypedef struct /* PACKAGE - has count, elements, next element */
2331573Srgrimes{
23417782Smpp    ACPI_OBJECT_COMMON_HEADER
235108028Sru
2361573Srgrimes    UINT32                      Count;          /* # of elements in package */
237
238    union acpi_operand_obj      **Elements;     /* Array of pointers to AcpiObjects */
239    union acpi_operand_obj      **NextElement;  /* used only while initializing */
240
241} ACPI_OBJECT_PACKAGE;
242
243
244typedef struct /* FIELD UNIT */
245{
246    ACPI_OBJECT_COMMON_HEADER
247
248    ACPI_COMMON_FIELD_INFO
249
250    union acpi_operand_obj      *Extra;             /* Pointer to executable AML (in field definition) */
251    ACPI_NAMESPACE_NODE         *Node;              /* containing object */
252    union acpi_operand_obj      *Container;         /* Containing object (Buffer) */
253
254} ACPI_OBJECT_FIELD_UNIT;
255
256
257typedef struct /* DEVICE - has handle and notification handler/context */
258{
259    ACPI_OBJECT_COMMON_HEADER
260
261    union acpi_operand_obj      *SysHandler;         /* Handler for system notifies */
262    union acpi_operand_obj      *DrvHandler;         /* Handler for driver notifies */
263    union acpi_operand_obj      *AddrHandler;        /* Handler for Address space */
264
265} ACPI_OBJECT_DEVICE;
266
267
268typedef struct /* EVENT */
269{
270    ACPI_OBJECT_COMMON_HEADER
271
272    void                        *Semaphore;
273
274} ACPI_OBJECT_EVENT;
275
276
277#define INFINITE_CONCURRENCY        0xFF
278
279typedef struct /* METHOD */
280{
281    ACPI_OBJECT_COMMON_HEADER
282    UINT8                       MethodFlags;
283    UINT8                       ParamCount;
284
285    UINT32                      PcodeLength;
286
287    void                        *Semaphore;
288    UINT8                       *Pcode;
289
290    UINT8                       Concurrency;
291    UINT8                       ThreadCount;
292    ACPI_OWNER_ID               OwningId;
293
294} ACPI_OBJECT_METHOD;
295
296
297typedef struct /* MUTEX */
298{
299    ACPI_OBJECT_COMMON_HEADER
300    UINT16                      SyncLevel;
301
302    void                        *Semaphore;
303
304} ACPI_OBJECT_MUTEX;
305
306
307typedef struct /* REGION */
308{
309    ACPI_OBJECT_COMMON_HEADER
310
311    UINT8                       SpaceId;
312    UINT32                      Length;
313    ACPI_PHYSICAL_ADDRESS       Address;
314    union acpi_operand_obj      *Extra;             /* Pointer to executable AML (in region definition) */
315
316    union acpi_operand_obj      *AddrHandler;       /* Handler for system notifies */
317    ACPI_NAMESPACE_NODE         *Node;              /* containing object */
318    union acpi_operand_obj      *Next;
319
320} ACPI_OBJECT_REGION;
321
322
323typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
324{
325    ACPI_OBJECT_COMMON_HEADER
326
327    UINT32                      SystemLevel;
328    UINT32                      ResourceOrder;
329
330    union acpi_operand_obj      *SysHandler;        /* Handler for system notifies */
331    union acpi_operand_obj      *DrvHandler;        /* Handler for driver notifies */
332
333} ACPI_OBJECT_POWER_RESOURCE;
334
335
336typedef struct /* PROCESSOR - has Handle and notification handler/context*/
337{
338    ACPI_OBJECT_COMMON_HEADER
339
340    UINT32                      ProcId;
341    UINT32                      Length;
342    ACPI_IO_ADDRESS             Address;
343
344    union acpi_operand_obj      *SysHandler;        /* Handler for system notifies */
345    union acpi_operand_obj      *DrvHandler;        /* Handler for driver notifies */
346    union acpi_operand_obj      *AddrHandler;       /* Handler for Address space */
347
348} ACPI_OBJECT_PROCESSOR;
349
350
351typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
352{
353    ACPI_OBJECT_COMMON_HEADER
354
355    union acpi_operand_obj      *SysHandler;        /* Handler for system notifies */
356    union acpi_operand_obj      *DrvHandler;        /* Handler for driver notifies */
357    union acpi_operand_obj      *AddrHandler;       /* Handler for Address space */
358
359} ACPI_OBJECT_THERMAL_ZONE;
360
361
362/*
363 * Internal types
364 */
365
366
367typedef struct /* FIELD */
368{
369    ACPI_OBJECT_COMMON_HEADER
370
371    ACPI_COMMON_FIELD_INFO
372
373    union acpi_operand_obj      *Container;         /* Containing object */
374
375} ACPI_OBJECT_FIELD;
376
377
378typedef struct /* BANK FIELD */
379{
380    ACPI_OBJECT_COMMON_HEADER
381
382    ACPI_COMMON_FIELD_INFO
383    UINT32                      Value;              /* Value to store into BankSelect */
384
385    ACPI_HANDLE                 BankSelect;         /* Bank select register */
386    union acpi_operand_obj      *Container;         /* Containing object */
387
388} ACPI_OBJECT_BANK_FIELD;
389
390
391typedef struct /* INDEX FIELD */
392{
393    /*
394     * No container pointer needed since the index and data register definitions
395     * will define how to access the respective registers
396     */
397    ACPI_OBJECT_COMMON_HEADER
398
399    ACPI_COMMON_FIELD_INFO
400    UINT32                      Value;              /* Value to store into Index register */
401
402    ACPI_HANDLE                 Index;              /* Index register */
403    ACPI_HANDLE                 Data;               /* Data register */
404
405} ACPI_OBJECT_INDEX_FIELD;
406
407
408typedef struct /* NOTIFY HANDLER */
409{
410    ACPI_OBJECT_COMMON_HEADER
411
412    ACPI_NAMESPACE_NODE         *Node;               /* Parent device */
413    NOTIFY_HANDLER              Handler;
414    void                        *Context;
415
416} ACPI_OBJECT_NOTIFY_HANDLER;
417
418
419/* Flags for address handler */
420
421#define ADDR_HANDLER_DEFAULT_INSTALLED  0x1
422
423
424typedef struct /* ADDRESS HANDLER */
425{
426    ACPI_OBJECT_COMMON_HEADER
427
428    UINT8                       SpaceId;
429    UINT16                      Hflags;
430    ADDRESS_SPACE_HANDLER       Handler;
431
432    ACPI_NAMESPACE_NODE         *Node;              /* Parent device */
433    void                        *Context;
434    ADDRESS_SPACE_SETUP         Setup;
435    union acpi_operand_obj      *RegionList;        /* regions using this handler */
436    union acpi_operand_obj      *Next;
437
438} ACPI_OBJECT_ADDR_HANDLER;
439
440
441/*
442 * The Reference object type is used for these opcodes:
443 * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp
444 */
445
446typedef struct /* Reference - Local object type */
447{
448    ACPI_OBJECT_COMMON_HEADER
449
450    UINT8                       TargetType;         /* Used for IndexOp */
451    UINT16                      OpCode;
452    UINT32                      Offset;             /* Used for ArgOp, LocalOp, and IndexOp */
453
454    void                        *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT  */
455    ACPI_NAMESPACE_NODE         *Node;
456    union acpi_operand_obj      **Where;
457
458} ACPI_OBJECT_REFERENCE;
459
460
461/*
462 * Extra object is used as additional storage for types that
463 * have AML code in their declarations (TermArgs) that must be
464 * evaluated at run time.
465 *
466 * Currently: Region and FieldUnit types
467 */
468
469typedef struct /* EXTRA */
470{
471    ACPI_OBJECT_COMMON_HEADER
472    UINT8                       ByteFill1;
473    UINT16                      WordFill1;
474    UINT32                      PcodeLength;
475    UINT8                       *Pcode;
476    ACPI_NAMESPACE_NODE         *Method_REG;        /* _REG method for this region (if any) */
477    void                        *RegionContext;     /* Region-specific data */
478
479} ACPI_OBJECT_EXTRA;
480
481
482/******************************************************************************
483 *
484 * ACPI_OPERAND_OBJECT  Descriptor - a giant union of all of the above
485 *
486 *****************************************************************************/
487
488typedef union acpi_operand_obj
489{
490    ACPI_OBJECT_COMMON          Common;
491    ACPI_OBJECT_CACHE_LIST      Cache;
492    ACPI_OBJECT_NUMBER          Number;
493    ACPI_OBJECT_STRING          String;
494    ACPI_OBJECT_BUFFER          Buffer;
495    ACPI_OBJECT_PACKAGE         Package;
496    ACPI_OBJECT_FIELD_UNIT      FieldUnit;
497    ACPI_OBJECT_DEVICE          Device;
498    ACPI_OBJECT_EVENT           Event;
499    ACPI_OBJECT_METHOD          Method;
500    ACPI_OBJECT_MUTEX           Mutex;
501    ACPI_OBJECT_REGION          Region;
502    ACPI_OBJECT_POWER_RESOURCE  PowerResource;
503    ACPI_OBJECT_PROCESSOR       Processor;
504    ACPI_OBJECT_THERMAL_ZONE    ThermalZone;
505    ACPI_OBJECT_FIELD           Field;
506    ACPI_OBJECT_BANK_FIELD      BankField;
507    ACPI_OBJECT_INDEX_FIELD     IndexField;
508    ACPI_OBJECT_REFERENCE       Reference;
509    ACPI_OBJECT_NOTIFY_HANDLER  NotifyHandler;
510    ACPI_OBJECT_ADDR_HANDLER    AddrHandler;
511    ACPI_OBJECT_EXTRA           Extra;
512
513} ACPI_OPERAND_OBJECT;
514
515#endif /* _ACOBJECT_H */
516