acobject.h revision 77424
1
2/******************************************************************************
3 *
4 * Name: acobject.h - Definition of ACPI_OPERAND_OBJECT  (Internal object only)
5 *       $Revision: 89 $
6 *
7 *****************************************************************************/
8
9/******************************************************************************
10 *
11 * 1. Copyright Notice
12 *
13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp.
14 * All rights reserved.
15 *
16 * 2. License
17 *
18 * 2.1. This is your license from Intel Corp. under its intellectual property
19 * rights.  You may have additional license terms from the party that provided
20 * you this software, covering your right to use that party's intellectual
21 * property rights.
22 *
23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
24 * copy of the source code appearing in this file ("Covered Code") an
25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the
26 * base code distributed originally by Intel ("Original Intel Code") to copy,
27 * make derivatives, distribute, use and display any portion of the Covered
28 * Code in any form, with the right to sublicense such rights; and
29 *
30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
31 * license (with the right to sublicense), under only those claims of Intel
32 * patents that are infringed by the Original Intel Code, to make, use, sell,
33 * offer to sell, and import the Covered Code and derivative works thereof
34 * solely to the minimum extent necessary to exercise the above copyright
35 * license, and in no event shall the patent license extend to any additions
36 * to or modifications of the Original Intel Code.  No other license or right
37 * is granted directly or by implication, estoppel or otherwise;
38 *
39 * The above copyright and patent license is granted only if the following
40 * conditions are met:
41 *
42 * 3. Conditions
43 *
44 * 3.1. Redistribution of Source with Rights to Further Distribute Source.
45 * Redistribution of source code of any substantial portion of the Covered
46 * Code or modification with rights to further distribute source must include
47 * the above Copyright Notice, the above License, this list of Conditions,
48 * and the following Disclaimer and Export Compliance provision.  In addition,
49 * Licensee must cause all Covered Code to which Licensee contributes to
50 * contain a file documenting the changes Licensee made to create that Covered
51 * Code and the date of any change.  Licensee must include in that file the
52 * documentation of any changes made by any predecessor Licensee.  Licensee
53 * must include a prominent statement that the modification is derived,
54 * directly or indirectly, from Original Intel Code.
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 them to be cached and reused.
127 *
128 * All variants of the ACPI_OPERAND_OBJECT  are defined with the same
129 * sequence of field types, with fields that are not used in a particular
130 * variant being named "Reserved".  This is not strictly necessary, but
131 * may in some circumstances simplify understanding if these structures
132 * need to be displayed in a debugger having limited (or no) support for
133 * union types.  It also simplifies some debug code in DumpTable() which
134 * dumps multi-level values: fetching Buffer.Pointer suffices to pick up
135 * the value or next level for any of several types.
136 */
137
138/******************************************************************************
139 *
140 * Common Descriptors
141 *
142 *****************************************************************************/
143
144/*
145 * Common area for all objects.
146 *
147 * DataType is used to differentiate between internal descriptors, and MUST
148 * be the first byte in this structure.
149 */
150
151
152#define ACPI_OBJECT_COMMON_HEADER           /* SIZE/ALIGNMENT: 32-bits plus trailing 8-bit flag */\
153    UINT8                       DataType;           /* To differentiate various internal objs */\
154    UINT8                       Type;               /* ACPI_OBJECT_TYPE */\
155    UINT16                      ReferenceCount;     /* For object deletion management */\
156    UINT8                       Flags; \
157
158/* Defines for flag byte above */
159
160#define AOPOBJ_STATIC_ALLOCATION    0x1
161#define AOPOBJ_DATA_VALID           0x2
162#define AOPOBJ_INITIALIZED          0x4
163
164
165/*
166 * Common bitfield for the field objects
167 * "Field Datum"    -- a datum from the actual field object
168 * "Buffer Datum"   -- a datum from a user buffer, read from or to be written to the field
169 */
170#define ACPI_COMMON_FIELD_INFO              /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
171    UINT8                       AccessFlags;\
172    UINT16                      BitLength;          /* Length of field in bits */\
173    UINT32                      BaseByteOffset;     /* Byte offset within containing object */\
174    UINT8                       AccessBitWidth;     /* Read/Write size in bits (from ASL AccessType)*/\
175    UINT8                       AccessByteWidth;    /* Read/Write size in bytes */\
176    UINT8                       UpdateRule;         /* How neighboring field bits are handled */\
177    UINT8                       LockRule;           /* Global Lock: 1 = "Must Lock" */\
178    UINT8                       StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
179    UINT8                       DatumValidBits;     /* Valid bit in first "Field datum" */\
180    UINT8                       EndFieldValidBits;  /* Valid bits in the last "field datum" */\
181    UINT8                       EndBufferValidBits; /* Valid bits in the last "buffer datum" */\
182    UINT32                      Value;              /* Value to store into the Bank or Index register */
183
184
185/* Access flag bits */
186
187#define AFIELD_SINGLE_DATUM         0x1
188
189
190/******************************************************************************
191 *
192 * Individual Object Descriptors
193 *
194 *****************************************************************************/
195
196
197typedef struct /* COMMON */
198{
199    ACPI_OBJECT_COMMON_HEADER
200
201} ACPI_OBJECT_COMMON;
202
203
204typedef struct /* CACHE_LIST */
205{
206    ACPI_OBJECT_COMMON_HEADER
207    union acpi_operand_obj      *Next;              /* Link for object cache and internal lists*/
208
209} ACPI_OBJECT_CACHE_LIST;
210
211
212typedef struct /* NUMBER - has value */
213{
214    ACPI_OBJECT_COMMON_HEADER
215
216    ACPI_INTEGER                Value;
217
218} ACPI_OBJECT_INTEGER;
219
220
221typedef struct /* STRING - has length and pointer - Null terminated, ASCII characters only */
222{
223    ACPI_OBJECT_COMMON_HEADER
224
225    UINT32                      Length;
226    NATIVE_CHAR                 *Pointer;           /* String value in AML stream or in allocated space */
227
228} ACPI_OBJECT_STRING;
229
230
231typedef struct /* BUFFER - has length and pointer - not null terminated */
232{
233    ACPI_OBJECT_COMMON_HEADER
234
235    UINT32                      Length;
236    UINT8                       *Pointer;           /* points to the buffer in allocated space */
237
238} ACPI_OBJECT_BUFFER;
239
240
241typedef struct /* PACKAGE - has count, elements, next element */
242{
243    ACPI_OBJECT_COMMON_HEADER
244
245    UINT32                      Count;              /* # of elements in package */
246
247    union acpi_operand_obj      **Elements;         /* Array of pointers to AcpiObjects */
248    union acpi_operand_obj      **NextElement;      /* used only while initializing */
249
250} ACPI_OBJECT_PACKAGE;
251
252
253typedef struct /* DEVICE - has handle and notification handler/context */
254{
255    ACPI_OBJECT_COMMON_HEADER
256
257    union acpi_operand_obj      *SysHandler;         /* Handler for system notifies */
258    union acpi_operand_obj      *DrvHandler;         /* Handler for driver notifies */
259    union acpi_operand_obj      *AddrHandler;        /* Handler for Address space */
260
261} ACPI_OBJECT_DEVICE;
262
263
264typedef struct /* EVENT */
265{
266    ACPI_OBJECT_COMMON_HEADER
267    void                        *Semaphore;
268
269} ACPI_OBJECT_EVENT;
270
271
272#define INFINITE_CONCURRENCY        0xFF
273
274typedef struct /* METHOD */
275{
276    ACPI_OBJECT_COMMON_HEADER
277    UINT8                       MethodFlags;
278    UINT8                       ParamCount;
279
280    UINT32                      PcodeLength;
281
282    void                        *Semaphore;
283    UINT8                       *Pcode;
284
285    UINT8                       Concurrency;
286    UINT8                       ThreadCount;
287    ACPI_OWNER_ID               OwningId;
288
289} ACPI_OBJECT_METHOD;
290
291
292typedef struct acpi_obj_mutex /* MUTEX */
293{
294    ACPI_OBJECT_COMMON_HEADER
295    UINT16                      SyncLevel;
296    UINT16                      AcquisitionDepth;
297
298    void                        *Semaphore;
299    void                        *Owner;
300    union acpi_operand_obj      *Prev;              /* Link for list of acquired mutexes */
301    union acpi_operand_obj      *Next;              /* Link for list of acquired mutexes */
302
303} ACPI_OBJECT_MUTEX;
304
305
306typedef struct /* REGION */
307{
308    ACPI_OBJECT_COMMON_HEADER
309
310    UINT8                       SpaceId;
311    UINT32                      Length;
312    ACPI_PHYSICAL_ADDRESS       Address;
313    union acpi_operand_obj      *Extra;             /* Pointer to executable AML (in region definition) */
314
315    union acpi_operand_obj      *AddrHandler;       /* Handler for system notifies */
316    ACPI_NAMESPACE_NODE         *Node;              /* containing object */
317    union acpi_operand_obj      *Next;
318
319} ACPI_OBJECT_REGION;
320
321
322typedef struct /* POWER RESOURCE - has Handle and notification handler/context*/
323{
324    ACPI_OBJECT_COMMON_HEADER
325
326    UINT32                      SystemLevel;
327    UINT32                      ResourceOrder;
328
329    union acpi_operand_obj      *SysHandler;        /* Handler for system notifies */
330    union acpi_operand_obj      *DrvHandler;        /* Handler for driver notifies */
331
332} ACPI_OBJECT_POWER_RESOURCE;
333
334
335typedef struct /* PROCESSOR - has Handle and notification handler/context*/
336{
337    ACPI_OBJECT_COMMON_HEADER
338
339    UINT32                      ProcId;
340    UINT32                      Length;
341    ACPI_IO_ADDRESS             Address;
342
343    union acpi_operand_obj      *SysHandler;        /* Handler for system notifies */
344    union acpi_operand_obj      *DrvHandler;        /* Handler for driver notifies */
345    union acpi_operand_obj      *AddrHandler;       /* Handler for Address space */
346
347} ACPI_OBJECT_PROCESSOR;
348
349
350typedef struct /* THERMAL ZONE - has Handle and Handler/Context */
351{
352    ACPI_OBJECT_COMMON_HEADER
353
354    union acpi_operand_obj      *SysHandler;        /* Handler for system notifies */
355    union acpi_operand_obj      *DrvHandler;        /* Handler for driver notifies */
356    union acpi_operand_obj      *AddrHandler;       /* Handler for Address space */
357
358} ACPI_OBJECT_THERMAL_ZONE;
359
360
361/*
362 * Fields.  All share a common header/info field.
363 */
364
365typedef struct /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
366{
367    ACPI_OBJECT_COMMON_HEADER
368    ACPI_COMMON_FIELD_INFO
369    union acpi_operand_obj      *RegionObj;         /* Containing Operation Region object */
370                                                    /* (REGION/BANK fields only) */
371} ACPI_OBJECT_FIELD_COMMON;
372
373
374typedef struct /* REGION FIELD */
375{
376    ACPI_OBJECT_COMMON_HEADER
377    ACPI_COMMON_FIELD_INFO
378    union acpi_operand_obj      *RegionObj;         /* Containing OpRegion object */
379
380} ACPI_OBJECT_REGION_FIELD;
381
382
383typedef struct /* BANK FIELD */
384{
385    ACPI_OBJECT_COMMON_HEADER
386    ACPI_COMMON_FIELD_INFO
387
388    union acpi_operand_obj      *RegionObj;         /* Containing OpRegion object */
389    union acpi_operand_obj      *BankRegisterObj;   /* BankSelect Register object */
390
391} ACPI_OBJECT_BANK_FIELD;
392
393
394typedef struct /* INDEX FIELD */
395{
396    ACPI_OBJECT_COMMON_HEADER
397    ACPI_COMMON_FIELD_INFO
398
399    /*
400     * No "RegionObj" pointer needed since the Index and Data registers
401     * are each field definitions unto themselves.
402     */
403    union acpi_operand_obj      *IndexObj;          /* Index register */
404    union acpi_operand_obj      *DataObj;           /* Data register */
405
406
407} ACPI_OBJECT_INDEX_FIELD;
408
409
410/* The BufferField is different in that it is part of a Buffer, not an OpRegion */
411
412typedef struct /* BUFFER FIELD */
413{
414    ACPI_OBJECT_COMMON_HEADER
415    ACPI_COMMON_FIELD_INFO
416
417    union acpi_operand_obj      *Extra;             /* Pointer to executable AML (in field definition) */
418    ACPI_NAMESPACE_NODE         *Node;              /* Parent (containing) object node */
419    union acpi_operand_obj      *BufferObj;         /* Containing Buffer object */
420
421} ACPI_OBJECT_BUFFER_FIELD;
422
423
424/*
425 * Handlers
426 */
427
428typedef struct /* NOTIFY HANDLER */
429{
430    ACPI_OBJECT_COMMON_HEADER
431
432    ACPI_NAMESPACE_NODE         *Node;               /* Parent device */
433    ACPI_NOTIFY_HANDLER         Handler;
434    void                        *Context;
435
436} ACPI_OBJECT_NOTIFY_HANDLER;
437
438
439/* Flags for address handler */
440
441#define ADDR_HANDLER_DEFAULT_INSTALLED  0x1
442
443
444typedef struct /* ADDRESS HANDLER */
445{
446    ACPI_OBJECT_COMMON_HEADER
447
448    UINT8                       SpaceId;
449    UINT16                      Hflags;
450    ACPI_ADR_SPACE_HANDLER      Handler;
451
452    ACPI_NAMESPACE_NODE         *Node;              /* Parent device */
453    void                        *Context;
454    ACPI_ADR_SPACE_SETUP        Setup;
455    union acpi_operand_obj      *RegionList;        /* regions using this handler */
456    union acpi_operand_obj      *Next;
457
458} ACPI_OBJECT_ADDR_HANDLER;
459
460
461/*
462 * The Reference object type is used for these opcodes:
463 * Arg[0-6], Local[0-7], IndexOp, NameOp, ZeroOp, OneOp, OnesOp, DebugOp
464 */
465
466typedef struct /* Reference - Local object type */
467{
468    ACPI_OBJECT_COMMON_HEADER
469
470    UINT8                       TargetType;         /* Used for IndexOp */
471    UINT16                      Opcode;
472    UINT32                      Offset;             /* Used for ArgOp, LocalOp, and IndexOp */
473
474    void                        *Object;            /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT  */
475    ACPI_NAMESPACE_NODE         *Node;
476    union acpi_operand_obj      **Where;
477
478} ACPI_OBJECT_REFERENCE;
479
480
481/*
482 * Extra object is used as additional storage for types that
483 * have AML code in their declarations (TermArgs) that must be
484 * evaluated at run time.
485 *
486 * Currently: Region and FieldUnit types
487 */
488
489typedef struct /* EXTRA */
490{
491    ACPI_OBJECT_COMMON_HEADER
492    UINT8                       ByteFill1;
493    UINT16                      WordFill1;
494    UINT32                      PcodeLength;
495    UINT8                       *Pcode;
496    ACPI_NAMESPACE_NODE         *Method_REG;        /* _REG method for this region (if any) */
497    void                        *RegionContext;     /* Region-specific data */
498
499} ACPI_OBJECT_EXTRA;
500
501
502/******************************************************************************
503 *
504 * ACPI_OPERAND_OBJECT  Descriptor - a giant union of all of the above
505 *
506 *****************************************************************************/
507
508typedef union acpi_operand_obj
509{
510    ACPI_OBJECT_COMMON          Common;
511    ACPI_OBJECT_CACHE_LIST      Cache;
512    ACPI_OBJECT_INTEGER         Integer;
513    ACPI_OBJECT_STRING          String;
514    ACPI_OBJECT_BUFFER          Buffer;
515    ACPI_OBJECT_PACKAGE         Package;
516    ACPI_OBJECT_BUFFER_FIELD    BufferField;
517    ACPI_OBJECT_DEVICE          Device;
518    ACPI_OBJECT_EVENT           Event;
519    ACPI_OBJECT_METHOD          Method;
520    ACPI_OBJECT_MUTEX           Mutex;
521    ACPI_OBJECT_REGION          Region;
522    ACPI_OBJECT_POWER_RESOURCE  PowerResource;
523    ACPI_OBJECT_PROCESSOR       Processor;
524    ACPI_OBJECT_THERMAL_ZONE    ThermalZone;
525    ACPI_OBJECT_FIELD_COMMON    CommonField;
526    ACPI_OBJECT_REGION_FIELD    Field;
527    ACPI_OBJECT_BANK_FIELD      BankField;
528    ACPI_OBJECT_INDEX_FIELD     IndexField;
529    ACPI_OBJECT_REFERENCE       Reference;
530    ACPI_OBJECT_NOTIFY_HANDLER  NotifyHandler;
531    ACPI_OBJECT_ADDR_HANDLER    AddrHandler;
532    ACPI_OBJECT_EXTRA           Extra;
533
534} ACPI_OPERAND_OBJECT;
535
536#endif /* _ACOBJECT_H */
537