xref: /haiku/src/add-ons/kernel/bus_managers/acpi/acpica/include/aclocal.h (revision 22440f4105cafc95cc1d49f9bc65bb395c527d86)
1 /******************************************************************************
2  *
3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4  *
5  *****************************************************************************/
6 
7 /******************************************************************************
8  *
9  * 1. Copyright Notice
10  *
11  * Some or all of this work - Copyright (c) 1999 - 2014, Intel Corp.
12  * All rights reserved.
13  *
14  * 2. License
15  *
16  * 2.1. This is your license from Intel Corp. under its intellectual property
17  * rights. You may have additional license terms from the party that provided
18  * you this software, covering your right to use that party's intellectual
19  * property rights.
20  *
21  * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
22  * copy of the source code appearing in this file ("Covered Code") an
23  * irrevocable, perpetual, worldwide license under Intel's copyrights in the
24  * base code distributed originally by Intel ("Original Intel Code") to copy,
25  * make derivatives, distribute, use and display any portion of the Covered
26  * Code in any form, with the right to sublicense such rights; and
27  *
28  * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
29  * license (with the right to sublicense), under only those claims of Intel
30  * patents that are infringed by the Original Intel Code, to make, use, sell,
31  * offer to sell, and import the Covered Code and derivative works thereof
32  * solely to the minimum extent necessary to exercise the above copyright
33  * license, and in no event shall the patent license extend to any additions
34  * to or modifications of the Original Intel Code. No other license or right
35  * is granted directly or by implication, estoppel or otherwise;
36  *
37  * The above copyright and patent license is granted only if the following
38  * conditions are met:
39  *
40  * 3. Conditions
41  *
42  * 3.1. Redistribution of Source with Rights to Further Distribute Source.
43  * Redistribution of source code of any substantial portion of the Covered
44  * Code or modification with rights to further distribute source must include
45  * the above Copyright Notice, the above License, this list of Conditions,
46  * and the following Disclaimer and Export Compliance provision. In addition,
47  * Licensee must cause all Covered Code to which Licensee contributes to
48  * contain a file documenting the changes Licensee made to create that Covered
49  * Code and the date of any change. Licensee must include in that file the
50  * documentation of any changes made by any predecessor Licensee. Licensee
51  * must include a prominent statement that the modification is derived,
52  * directly or indirectly, from Original Intel Code.
53  *
54  * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
55  * Redistribution of source code of any substantial portion of the Covered
56  * Code or modification without rights to further distribute source must
57  * include the following Disclaimer and Export Compliance provision in the
58  * documentation and/or other materials provided with distribution. In
59  * addition, Licensee may not authorize further sublicense of source of any
60  * portion of the Covered Code, and must include terms to the effect that the
61  * license from Licensee to its licensee is limited to the intellectual
62  * property embodied in the software Licensee provides to its licensee, and
63  * not to intellectual property embodied in modifications its licensee may
64  * make.
65  *
66  * 3.3. Redistribution of Executable. Redistribution in executable form of any
67  * substantial portion of the Covered Code or modification must reproduce the
68  * above Copyright Notice, and the following Disclaimer and Export Compliance
69  * provision in the documentation and/or other materials provided with the
70  * distribution.
71  *
72  * 3.4. Intel retains all right, title, and interest in and to the Original
73  * Intel Code.
74  *
75  * 3.5. Neither the name Intel nor any other trademark owned or controlled by
76  * Intel shall be used in advertising or otherwise to promote the sale, use or
77  * other dealings in products derived from or relating to the Covered Code
78  * without prior written authorization from Intel.
79  *
80  * 4. Disclaimer and Export Compliance
81  *
82  * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
83  * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
84  * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
85  * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
86  * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
87  * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
88  * PARTICULAR PURPOSE.
89  *
90  * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
91  * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
92  * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
93  * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
94  * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
95  * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
96  * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
97  * LIMITED REMEDY.
98  *
99  * 4.3. Licensee shall not export, either directly or indirectly, any of this
100  * software or system incorporating such software without first obtaining any
101  * required license or other approval from the U. S. Department of Commerce or
102  * any other agency or department of the United States Government. In the
103  * event Licensee exports any such software from the United States or
104  * re-exports any such software from a foreign destination, Licensee shall
105  * ensure that the distribution and export/re-export of the software is in
106  * compliance with all laws, regulations, orders, or other restrictions of the
107  * U.S. Export Administration Regulations. Licensee agrees that neither it nor
108  * any of its subsidiaries will export/re-export any technical data, process,
109  * software, or service, directly or indirectly, to any country for which the
110  * United States government or any agency thereof requires an export license,
111  * other governmental approval, or letter of assurance, without first obtaining
112  * such license, approval or letter.
113  *
114  *****************************************************************************/
115 
116 #ifndef __ACLOCAL_H__
117 #define __ACLOCAL_H__
118 
119 
120 /* acpisrc:StructDefs -- for acpisrc conversion */
121 
122 #define ACPI_SERIALIZED                 0xFF
123 
124 typedef UINT32                          ACPI_MUTEX_HANDLE;
125 #define ACPI_GLOBAL_LOCK                (ACPI_SEMAPHORE) (-1)
126 
127 /* Total number of aml opcodes defined */
128 
129 #define AML_NUM_OPCODES                 0x81
130 
131 
132 /* Forward declarations */
133 
134 struct acpi_walk_state;
135 struct acpi_obj_mutex;
136 union acpi_parse_object;
137 
138 
139 /*****************************************************************************
140  *
141  * Mutex typedefs and structs
142  *
143  ****************************************************************************/
144 
145 
146 /*
147  * Predefined handles for the mutex objects used within the subsystem
148  * All mutex objects are automatically created by AcpiUtMutexInitialize.
149  *
150  * The acquire/release ordering protocol is implied via this list. Mutexes
151  * with a lower value must be acquired before mutexes with a higher value.
152  *
153  * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
154  * table below also!
155  */
156 #define ACPI_MTX_INTERPRETER            0   /* AML Interpreter, main lock */
157 #define ACPI_MTX_NAMESPACE              1   /* ACPI Namespace */
158 #define ACPI_MTX_TABLES                 2   /* Data for ACPI tables */
159 #define ACPI_MTX_EVENTS                 3   /* Data for ACPI events */
160 #define ACPI_MTX_CACHES                 4   /* Internal caches, general purposes */
161 #define ACPI_MTX_MEMORY                 5   /* Debug memory tracking lists */
162 #define ACPI_MTX_DEBUG_CMD_COMPLETE     6   /* AML debugger */
163 #define ACPI_MTX_DEBUG_CMD_READY        7   /* AML debugger */
164 
165 #define ACPI_MAX_MUTEX                  7
166 #define ACPI_NUM_MUTEX                  ACPI_MAX_MUTEX+1
167 
168 
169 /* Lock structure for reader/writer interfaces */
170 
171 typedef struct acpi_rw_lock
172 {
173     ACPI_MUTEX              WriterMutex;
174     ACPI_MUTEX              ReaderMutex;
175     UINT32                  NumReaders;
176 
177 } ACPI_RW_LOCK;
178 
179 
180 /*
181  * Predefined handles for spinlocks used within the subsystem.
182  * These spinlocks are created by AcpiUtMutexInitialize
183  */
184 #define ACPI_LOCK_GPES                  0
185 #define ACPI_LOCK_HARDWARE              1
186 
187 #define ACPI_MAX_LOCK                   1
188 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
189 
190 
191 /* This Thread ID means that the mutex is not in use (unlocked) */
192 
193 #define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
194 
195 /* Table for the global mutexes */
196 
197 typedef struct acpi_mutex_info
198 {
199     ACPI_MUTEX                      Mutex;
200     UINT32                          UseCount;
201     ACPI_THREAD_ID                  ThreadId;
202 
203 } ACPI_MUTEX_INFO;
204 
205 
206 /* Lock flag parameter for various interfaces */
207 
208 #define ACPI_MTX_DO_NOT_LOCK            0
209 #define ACPI_MTX_LOCK                   1
210 
211 
212 /* Field access granularities */
213 
214 #define ACPI_FIELD_BYTE_GRANULARITY     1
215 #define ACPI_FIELD_WORD_GRANULARITY     2
216 #define ACPI_FIELD_DWORD_GRANULARITY    4
217 #define ACPI_FIELD_QWORD_GRANULARITY    8
218 
219 
220 #define ACPI_ENTRY_NOT_FOUND            NULL
221 
222 
223 /*****************************************************************************
224  *
225  * Namespace typedefs and structs
226  *
227  ****************************************************************************/
228 
229 /* Operational modes of the AML interpreter/scanner */
230 
231 typedef enum
232 {
233     ACPI_IMODE_LOAD_PASS1           = 0x01,
234     ACPI_IMODE_LOAD_PASS2           = 0x02,
235     ACPI_IMODE_EXECUTE              = 0x03
236 
237 } ACPI_INTERPRETER_MODE;
238 
239 
240 /*
241  * The Namespace Node describes a named object that appears in the AML.
242  * DescriptorType is used to differentiate between internal descriptors.
243  *
244  * The node is optimized for both 32-bit and 64-bit platforms:
245  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
246  *
247  * Note: The DescriptorType and Type fields must appear in the identical
248  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
249  * structures.
250  */
251 typedef struct acpi_namespace_node
252 {
253     union acpi_operand_object       *Object;        /* Interpreter object */
254     UINT8                           DescriptorType; /* Differentiate object descriptor types */
255     UINT8                           Type;           /* ACPI Type associated with this name */
256     UINT8                           Flags;          /* Miscellaneous flags */
257     ACPI_OWNER_ID                   OwnerId;        /* Node creator */
258     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
259     struct acpi_namespace_node      *Parent;        /* Parent node */
260     struct acpi_namespace_node      *Child;         /* First child */
261     struct acpi_namespace_node      *Peer;          /* First peer */
262 
263     /*
264      * The following fields are used by the ASL compiler and disassembler only
265      */
266 #ifdef ACPI_LARGE_NAMESPACE_NODE
267     union acpi_parse_object         *Op;
268     UINT32                          Value;
269     UINT32                          Length;
270 #endif
271 
272 } ACPI_NAMESPACE_NODE;
273 
274 
275 /* Namespace Node flags */
276 
277 #define ANOBJ_RESERVED                  0x01    /* Available for use */
278 #define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
279 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
280 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
281 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
282 #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
283 #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
284 
285 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
286 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
287 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
288 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
289 
290 
291 /* Internal ACPI table management - master table list */
292 
293 typedef struct acpi_table_list
294 {
295     ACPI_TABLE_DESC                 *Tables;            /* Table descriptor array */
296     UINT32                          CurrentTableCount;  /* Tables currently in the array */
297     UINT32                          MaxTableCount;      /* Max tables array will hold */
298     UINT8                           Flags;
299 
300 } ACPI_TABLE_LIST;
301 
302 /* Flags for above */
303 
304 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
305 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
306 #define ACPI_ROOT_ALLOW_RESIZE          (2)
307 
308 
309 /* Predefined (fixed) table indexes */
310 
311 #define ACPI_TABLE_INDEX_DSDT           (0)
312 #define ACPI_TABLE_INDEX_FACS           (1)
313 
314 
315 typedef struct acpi_find_context
316 {
317     char                            *SearchFor;
318     ACPI_HANDLE                     *List;
319     UINT32                          *Count;
320 
321 } ACPI_FIND_CONTEXT;
322 
323 
324 typedef struct acpi_ns_search_data
325 {
326     ACPI_NAMESPACE_NODE             *Node;
327 
328 } ACPI_NS_SEARCH_DATA;
329 
330 
331 /* Object types used during package copies */
332 
333 #define ACPI_COPY_TYPE_SIMPLE           0
334 #define ACPI_COPY_TYPE_PACKAGE          1
335 
336 
337 /* Info structure used to convert external<->internal namestrings */
338 
339 typedef struct acpi_namestring_info
340 {
341     const char                      *ExternalName;
342     const char                      *NextExternalChar;
343     char                            *InternalName;
344     UINT32                          Length;
345     UINT32                          NumSegments;
346     UINT32                          NumCarats;
347     BOOLEAN                         FullyQualified;
348 
349 } ACPI_NAMESTRING_INFO;
350 
351 
352 /* Field creation info */
353 
354 typedef struct acpi_create_field_info
355 {
356     ACPI_NAMESPACE_NODE             *RegionNode;
357     ACPI_NAMESPACE_NODE             *FieldNode;
358     ACPI_NAMESPACE_NODE             *RegisterNode;
359     ACPI_NAMESPACE_NODE             *DataRegisterNode;
360     ACPI_NAMESPACE_NODE             *ConnectionNode;
361     UINT8                           *ResourceBuffer;
362     UINT32                          BankValue;
363     UINT32                          FieldBitPosition;
364     UINT32                          FieldBitLength;
365     UINT16                          ResourceLength;
366     UINT8                           FieldFlags;
367     UINT8                           Attribute;
368     UINT8                           FieldType;
369     UINT8                           AccessLength;
370 
371 } ACPI_CREATE_FIELD_INFO;
372 
373 
374 typedef
375 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
376     struct acpi_walk_state          *WalkState);
377 
378 
379 /*
380  * Bitmapped ACPI types. Used internally only
381  */
382 #define ACPI_BTYPE_ANY                  0x00000000
383 #define ACPI_BTYPE_INTEGER              0x00000001
384 #define ACPI_BTYPE_STRING               0x00000002
385 #define ACPI_BTYPE_BUFFER               0x00000004
386 #define ACPI_BTYPE_PACKAGE              0x00000008
387 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
388 #define ACPI_BTYPE_DEVICE               0x00000020
389 #define ACPI_BTYPE_EVENT                0x00000040
390 #define ACPI_BTYPE_METHOD               0x00000080
391 #define ACPI_BTYPE_MUTEX                0x00000100
392 #define ACPI_BTYPE_REGION               0x00000200
393 #define ACPI_BTYPE_POWER                0x00000400
394 #define ACPI_BTYPE_PROCESSOR            0x00000800
395 #define ACPI_BTYPE_THERMAL              0x00001000
396 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
397 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
398 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
399 #define ACPI_BTYPE_REFERENCE            0x00010000
400 #define ACPI_BTYPE_RESOURCE             0x00020000
401 
402 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
403 
404 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
405 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
406 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
407 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
408 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
409 
410 #pragma pack(1)
411 
412 /*
413  * Information structure for ACPI predefined names.
414  * Each entry in the table contains the following items:
415  *
416  * Name                 - The ACPI reserved name
417  * ParamCount           - Number of arguments to the method
418  * ExpectedReturnBtypes - Allowed type(s) for the return value
419  */
420 typedef struct acpi_name_info
421 {
422     char                        Name[ACPI_NAME_SIZE];
423     UINT16                      ArgumentList;
424     UINT8                       ExpectedBtypes;
425 
426 } ACPI_NAME_INFO;
427 
428 /*
429  * Secondary information structures for ACPI predefined objects that return
430  * package objects. This structure appears as the next entry in the table
431  * after the NAME_INFO structure above.
432  *
433  * The reason for this is to minimize the size of the predefined name table.
434  */
435 
436 /*
437  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
438  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
439  * ACPI_PTYPE2_FIX_VAR
440  */
441 typedef struct acpi_package_info
442 {
443     UINT8                       Type;
444     UINT8                       ObjectType1;
445     UINT8                       Count1;
446     UINT8                       ObjectType2;
447     UINT8                       Count2;
448     UINT16                      Reserved;
449 
450 } ACPI_PACKAGE_INFO;
451 
452 /* Used for ACPI_PTYPE2_FIXED */
453 
454 typedef struct acpi_package_info2
455 {
456     UINT8                       Type;
457     UINT8                       Count;
458     UINT8                       ObjectType[4];
459     UINT8                       Reserved;
460 
461 } ACPI_PACKAGE_INFO2;
462 
463 /* Used for ACPI_PTYPE1_OPTION */
464 
465 typedef struct acpi_package_info3
466 {
467     UINT8                       Type;
468     UINT8                       Count;
469     UINT8                       ObjectType[2];
470     UINT8                       TailObjectType;
471     UINT16                      Reserved;
472 
473 } ACPI_PACKAGE_INFO3;
474 
475 typedef union acpi_predefined_info
476 {
477     ACPI_NAME_INFO              Info;
478     ACPI_PACKAGE_INFO           RetInfo;
479     ACPI_PACKAGE_INFO2          RetInfo2;
480     ACPI_PACKAGE_INFO3          RetInfo3;
481 
482 } ACPI_PREDEFINED_INFO;
483 
484 /* Reset to default packing */
485 
486 #pragma pack()
487 
488 
489 /* Return object auto-repair info */
490 
491 typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
492     union acpi_operand_object   *OriginalObject,
493     union acpi_operand_object   **ConvertedObject);
494 
495 typedef struct acpi_simple_repair_info
496 {
497     char                        Name[ACPI_NAME_SIZE];
498     UINT32                      UnexpectedBtypes;
499     UINT32                      PackageIndex;
500     ACPI_OBJECT_CONVERTER       ObjectConverter;
501 
502 } ACPI_SIMPLE_REPAIR_INFO;
503 
504 
505 /*
506  * Bitmapped return value types
507  * Note: the actual data types must be contiguous, a loop in nspredef.c
508  * depends on this.
509  */
510 #define ACPI_RTYPE_ANY                  0x00
511 #define ACPI_RTYPE_NONE                 0x01
512 #define ACPI_RTYPE_INTEGER              0x02
513 #define ACPI_RTYPE_STRING               0x04
514 #define ACPI_RTYPE_BUFFER               0x08
515 #define ACPI_RTYPE_PACKAGE              0x10
516 #define ACPI_RTYPE_REFERENCE            0x20
517 #define ACPI_RTYPE_ALL                  0x3F
518 
519 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
520 
521 
522 /*****************************************************************************
523  *
524  * Event typedefs and structs
525  *
526  ****************************************************************************/
527 
528 /* Dispatch info for each host-installed SCI handler */
529 
530 typedef struct acpi_sci_handler_info
531 {
532     struct acpi_sci_handler_info    *Next;
533     ACPI_SCI_HANDLER                Address;        /* Address of handler */
534     void                            *Context;       /* Context to be passed to handler */
535 
536 } ACPI_SCI_HANDLER_INFO;
537 
538 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
539 
540 typedef struct acpi_gpe_handler_info
541 {
542     ACPI_GPE_HANDLER                Address;        /* Address of handler, if any */
543     void                            *Context;       /* Context to be passed to handler */
544     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
545     UINT8                           OriginalFlags;  /* Original (pre-handler) GPE info */
546     BOOLEAN                         OriginallyEnabled; /* True if GPE was originally enabled */
547 
548 } ACPI_GPE_HANDLER_INFO;
549 
550 /* Notify info for implicit notify, multiple device objects */
551 
552 typedef struct acpi_gpe_notify_info
553 {
554     ACPI_NAMESPACE_NODE             *DeviceNode;    /* Device to be notified */
555     struct acpi_gpe_notify_info     *Next;
556 
557 } ACPI_GPE_NOTIFY_INFO;
558 
559 /*
560  * GPE dispatch info. At any time, the GPE can have at most one type
561  * of dispatch - Method, Handler, or Implicit Notify.
562  */
563 typedef union acpi_gpe_dispatch_info
564 {
565     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
566     ACPI_GPE_HANDLER_INFO           *Handler;       /* Installed GPE handler */
567     ACPI_GPE_NOTIFY_INFO            *NotifyList;    /* List of _PRW devices for implicit notifies */
568 
569 } ACPI_GPE_DISPATCH_INFO;
570 
571 /*
572  * Information about a GPE, one per each GPE in an array.
573  * NOTE: Important to keep this struct as small as possible.
574  */
575 typedef struct acpi_gpe_event_info
576 {
577     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method, Handler, or NotifyList */
578     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
579     UINT8                           Flags;          /* Misc info about this GPE */
580     UINT8                           GpeNumber;      /* This GPE */
581     UINT8                           RuntimeCount;   /* References to a run GPE */
582 
583 } ACPI_GPE_EVENT_INFO;
584 
585 /* Information about a GPE register pair, one per each status/enable pair in an array */
586 
587 typedef struct acpi_gpe_register_info
588 {
589     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
590     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
591     UINT16                          BaseGpeNumber;  /* Base GPE number for this register */
592     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
593     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
594 
595 } ACPI_GPE_REGISTER_INFO;
596 
597 /*
598  * Information about a GPE register block, one per each installed block --
599  * GPE0, GPE1, and one per each installed GPE Block Device.
600  */
601 typedef struct acpi_gpe_block_info
602 {
603     ACPI_NAMESPACE_NODE             *Node;
604     struct acpi_gpe_block_info      *Previous;
605     struct acpi_gpe_block_info      *Next;
606     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
607     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
608     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
609     UINT64                          Address;        /* Base address of the block */
610     UINT32                          RegisterCount;  /* Number of register pairs in block */
611     UINT16                          GpeCount;       /* Number of individual GPEs in block */
612     UINT16                          BlockBaseNumber;/* Base GPE number for this block */
613     UINT8                           SpaceId;
614     BOOLEAN                         Initialized;    /* TRUE if this block is initialized */
615 
616 } ACPI_GPE_BLOCK_INFO;
617 
618 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
619 
620 typedef struct acpi_gpe_xrupt_info
621 {
622     struct acpi_gpe_xrupt_info      *Previous;
623     struct acpi_gpe_xrupt_info      *Next;
624     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
625     UINT32                          InterruptNumber;    /* System interrupt number */
626 
627 } ACPI_GPE_XRUPT_INFO;
628 
629 typedef struct acpi_gpe_walk_info
630 {
631     ACPI_NAMESPACE_NODE             *GpeDevice;
632     ACPI_GPE_BLOCK_INFO             *GpeBlock;
633     UINT16                          Count;
634     ACPI_OWNER_ID                   OwnerId;
635     BOOLEAN                         ExecuteByOwnerId;
636 
637 } ACPI_GPE_WALK_INFO;
638 
639 typedef struct acpi_gpe_device_info
640 {
641     UINT32                          Index;
642     UINT32                          NextBlockBaseIndex;
643     ACPI_STATUS                     Status;
644     ACPI_NAMESPACE_NODE             *GpeDevice;
645 
646 } ACPI_GPE_DEVICE_INFO;
647 
648 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
649     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
650     ACPI_GPE_BLOCK_INFO             *GpeBlock,
651     void                            *Context);
652 
653 
654 /* Information about each particular fixed event */
655 
656 typedef struct acpi_fixed_event_handler
657 {
658     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
659     void                            *Context;       /* Context to be passed to handler */
660 
661 } ACPI_FIXED_EVENT_HANDLER;
662 
663 typedef struct acpi_fixed_event_info
664 {
665     UINT8                           StatusRegisterId;
666     UINT8                           EnableRegisterId;
667     UINT16                          StatusBitMask;
668     UINT16                          EnableBitMask;
669 
670 } ACPI_FIXED_EVENT_INFO;
671 
672 /* Information used during field processing */
673 
674 typedef struct acpi_field_info
675 {
676     UINT8                           SkipField;
677     UINT8                           FieldFlag;
678     UINT32                          PkgLength;
679 
680 } ACPI_FIELD_INFO;
681 
682 
683 /*****************************************************************************
684  *
685  * Generic "state" object for stacks
686  *
687  ****************************************************************************/
688 
689 #define ACPI_CONTROL_NORMAL                  0xC0
690 #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
691 #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
692 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
693 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
694 
695 
696 #define ACPI_STATE_COMMON \
697     void                            *Next; \
698     UINT8                           DescriptorType; /* To differentiate various internal objs */\
699     UINT8                           Flags; \
700     UINT16                          Value; \
701     UINT16                          State;
702 
703     /* There are 2 bytes available here until the next natural alignment boundary */
704 
705 typedef struct acpi_common_state
706 {
707     ACPI_STATE_COMMON
708 } ACPI_COMMON_STATE;
709 
710 
711 /*
712  * Update state - used to traverse complex objects such as packages
713  */
714 typedef struct acpi_update_state
715 {
716     ACPI_STATE_COMMON
717     union acpi_operand_object       *Object;
718 
719 } ACPI_UPDATE_STATE;
720 
721 
722 /*
723  * Pkg state - used to traverse nested package structures
724  */
725 typedef struct acpi_pkg_state
726 {
727     ACPI_STATE_COMMON
728     UINT16                          Index;
729     union acpi_operand_object       *SourceObject;
730     union acpi_operand_object       *DestObject;
731     struct acpi_walk_state          *WalkState;
732     void                            *ThisTargetObj;
733     UINT32                          NumPackages;
734 
735 } ACPI_PKG_STATE;
736 
737 
738 /*
739  * Control state - one per if/else and while constructs.
740  * Allows nesting of these constructs
741  */
742 typedef struct acpi_control_state
743 {
744     ACPI_STATE_COMMON
745     UINT16                          Opcode;
746     union acpi_parse_object         *PredicateOp;
747     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
748     UINT8                           *PackageEnd;            /* End of if/while block */
749     UINT32                          LoopCount;              /* While() loop counter */
750 
751 } ACPI_CONTROL_STATE;
752 
753 
754 /*
755  * Scope state - current scope during namespace lookups
756  */
757 typedef struct acpi_scope_state
758 {
759     ACPI_STATE_COMMON
760     ACPI_NAMESPACE_NODE             *Node;
761 
762 } ACPI_SCOPE_STATE;
763 
764 
765 typedef struct acpi_pscope_state
766 {
767     ACPI_STATE_COMMON
768     UINT32                          ArgCount;               /* Number of fixed arguments */
769     union acpi_parse_object         *Op;                    /* Current op being parsed */
770     UINT8                           *ArgEnd;                /* Current argument end */
771     UINT8                           *PkgEnd;                /* Current package end */
772     UINT32                          ArgList;                /* Next argument to parse */
773 
774 } ACPI_PSCOPE_STATE;
775 
776 
777 /*
778  * Thread state - one per thread across multiple walk states. Multiple walk
779  * states are created when there are nested control methods executing.
780  */
781 typedef struct acpi_thread_state
782 {
783     ACPI_STATE_COMMON
784     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
785     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
786     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
787     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
788 
789 } ACPI_THREAD_STATE;
790 
791 
792 /*
793  * Result values - used to accumulate the results of nested
794  * AML arguments
795  */
796 typedef struct acpi_result_values
797 {
798     ACPI_STATE_COMMON
799     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
800 
801 } ACPI_RESULT_VALUES;
802 
803 
804 typedef
805 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
806     struct acpi_walk_state          *WalkState,
807     union acpi_parse_object         **OutOp);
808 
809 typedef
810 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
811     struct acpi_walk_state          *WalkState);
812 
813 
814 /* Global handlers for AML Notifies */
815 
816 typedef struct acpi_global_notify_handler
817 {
818     ACPI_NOTIFY_HANDLER             Handler;
819     void                            *Context;
820 
821 } ACPI_GLOBAL_NOTIFY_HANDLER;
822 
823 /*
824  * Notify info - used to pass info to the deferred notify
825  * handler/dispatcher.
826  */
827 typedef struct acpi_notify_info
828 {
829     ACPI_STATE_COMMON
830     UINT8                           HandlerListId;
831     ACPI_NAMESPACE_NODE             *Node;
832     union acpi_operand_object       *HandlerListHead;
833     ACPI_GLOBAL_NOTIFY_HANDLER      *Global;
834 
835 } ACPI_NOTIFY_INFO;
836 
837 
838 /* Generic state is union of structs above */
839 
840 typedef union acpi_generic_state
841 {
842     ACPI_COMMON_STATE               Common;
843     ACPI_CONTROL_STATE              Control;
844     ACPI_UPDATE_STATE               Update;
845     ACPI_SCOPE_STATE                Scope;
846     ACPI_PSCOPE_STATE               ParseScope;
847     ACPI_PKG_STATE                  Pkg;
848     ACPI_THREAD_STATE               Thread;
849     ACPI_RESULT_VALUES              Results;
850     ACPI_NOTIFY_INFO                Notify;
851 
852 } ACPI_GENERIC_STATE;
853 
854 
855 /*****************************************************************************
856  *
857  * Interpreter typedefs and structs
858  *
859  ****************************************************************************/
860 
861 typedef
862 ACPI_STATUS (*ACPI_EXECUTE_OP) (
863     struct acpi_walk_state          *WalkState);
864 
865 /* Address Range info block */
866 
867 typedef struct acpi_address_range
868 {
869     struct acpi_address_range   *Next;
870     ACPI_NAMESPACE_NODE         *RegionNode;
871     ACPI_PHYSICAL_ADDRESS       StartAddress;
872     ACPI_PHYSICAL_ADDRESS       EndAddress;
873 
874 } ACPI_ADDRESS_RANGE;
875 
876 
877 /*****************************************************************************
878  *
879  * Parser typedefs and structs
880  *
881  ****************************************************************************/
882 
883 /*
884  * AML opcode, name, and argument layout
885  */
886 typedef struct acpi_opcode_info
887 {
888 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
889     char                            *Name;          /* Opcode name (disassembler/debug only) */
890 #endif
891     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
892     UINT32                          RuntimeArgs;    /* Interpret time arguments */
893     UINT16                          Flags;          /* Misc flags */
894     UINT8                           ObjectType;     /* Corresponding internal object type */
895     UINT8                           Class;          /* Opcode class */
896     UINT8                           Type;           /* Opcode type */
897 
898 } ACPI_OPCODE_INFO;
899 
900 /* Structure for Resource Tag information */
901 
902 typedef struct acpi_tag_info
903 {
904     UINT32                          BitOffset;
905     UINT32                          BitLength;
906 
907 } ACPI_TAG_INFO;
908 
909 /* Value associated with the parse object */
910 
911 typedef union acpi_parse_value
912 {
913     UINT64                          Integer;        /* Integer constant (Up to 64 bits) */
914     UINT32                          Size;           /* bytelist or field size */
915     char                            *String;        /* NULL terminated string */
916     UINT8                           *Buffer;        /* buffer or string */
917     char                            *Name;          /* NULL terminated string */
918     union acpi_parse_object         *Arg;           /* arguments and contained ops */
919     ACPI_TAG_INFO                   Tag;            /* Resource descriptor tag info  */
920 
921 } ACPI_PARSE_VALUE;
922 
923 
924 #ifdef ACPI_DISASSEMBLER
925 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
926 #else
927 #define ACPI_DISASM_ONLY_MEMBERS(a)
928 #endif
929 
930 #define ACPI_PARSE_COMMON \
931     union acpi_parse_object         *Parent;        /* Parent op */\
932     UINT8                           DescriptorType; /* To differentiate various internal objs */\
933     UINT8                           Flags;          /* Type of Op */\
934     UINT16                          AmlOpcode;      /* AML opcode */\
935     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
936     union acpi_parse_object         *Next;          /* Next op */\
937     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
938     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
939     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
940     ACPI_DISASM_ONLY_MEMBERS (\
941     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
942     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
943     char                            AmlOpName[16])  /* Op name (debug only) */
944 
945 
946 /* Flags for DisasmFlags field  above */
947 
948 #define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */
949 #define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */
950 #define ACPI_DASM_STRING                0x02        /* Buffer is a ASCII string */
951 #define ACPI_DASM_UNICODE               0x03        /* Buffer is a Unicode string */
952 #define ACPI_DASM_PLD_METHOD            0x04        /* Buffer is a _PLD method bit-packed buffer */
953 #define ACPI_DASM_UUID                  0x05        /* Buffer is a UUID/GUID */
954 #define ACPI_DASM_EISAID                0x06        /* Integer is an EISAID */
955 #define ACPI_DASM_MATCHOP               0x07        /* Parent opcode is a Match() operator */
956 #define ACPI_DASM_LNOT_PREFIX           0x08        /* Start of a LNotEqual (etc.) pair of opcodes */
957 #define ACPI_DASM_LNOT_SUFFIX           0x09        /* End  of a LNotEqual (etc.) pair of opcodes */
958 #define ACPI_DASM_HID_STRING            0x0A        /* String is a _HID or _CID */
959 #define ACPI_DASM_IGNORE                0x0B        /* Not used at this time */
960 
961 /*
962  * Generic operation (for example:  If, While, Store)
963  */
964 typedef struct acpi_parse_obj_common
965 {
966     ACPI_PARSE_COMMON
967 } ACPI_PARSE_OBJ_COMMON;
968 
969 
970 /*
971  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
972  * and bytelists.
973  */
974 typedef struct acpi_parse_obj_named
975 {
976     ACPI_PARSE_COMMON
977     UINT8                           *Path;
978     UINT8                           *Data;          /* AML body or bytelist data */
979     UINT32                          Length;         /* AML length */
980     UINT32                          Name;           /* 4-byte name or zero if no name */
981 
982 } ACPI_PARSE_OBJ_NAMED;
983 
984 
985 /* This version is used by the iASL compiler only */
986 
987 #define ACPI_MAX_PARSEOP_NAME   20
988 
989 typedef struct acpi_parse_obj_asl
990 {
991     ACPI_PARSE_COMMON
992     union acpi_parse_object         *Child;
993     union acpi_parse_object         *ParentMethod;
994     char                            *Filename;
995     char                            *ExternalName;
996     char                            *Namepath;
997     char                            NameSeg[4];
998     UINT32                          ExtraValue;
999     UINT32                          Column;
1000     UINT32                          LineNumber;
1001     UINT32                          LogicalLineNumber;
1002     UINT32                          LogicalByteOffset;
1003     UINT32                          EndLine;
1004     UINT32                          EndLogicalLine;
1005     UINT32                          AcpiBtype;
1006     UINT32                          AmlLength;
1007     UINT32                          AmlSubtreeLength;
1008     UINT32                          FinalAmlLength;
1009     UINT32                          FinalAmlOffset;
1010     UINT32                          CompileFlags;
1011     UINT16                          ParseOpcode;
1012     UINT8                           AmlOpcodeLength;
1013     UINT8                           AmlPkgLenBytes;
1014     UINT8                           Extra;
1015     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
1016 
1017 } ACPI_PARSE_OBJ_ASL;
1018 
1019 typedef union acpi_parse_object
1020 {
1021     ACPI_PARSE_OBJ_COMMON           Common;
1022     ACPI_PARSE_OBJ_NAMED            Named;
1023     ACPI_PARSE_OBJ_ASL              Asl;
1024 
1025 } ACPI_PARSE_OBJECT;
1026 
1027 
1028 /*
1029  * Parse state - one state per parser invocation and each control
1030  * method.
1031  */
1032 typedef struct acpi_parse_state
1033 {
1034     UINT8                           *AmlStart;      /* First AML byte */
1035     UINT8                           *Aml;           /* Next AML byte */
1036     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
1037     UINT8                           *PkgStart;      /* Current package begin */
1038     UINT8                           *PkgEnd;        /* Current package end */
1039     union acpi_parse_object         *StartOp;       /* Root of parse tree */
1040     struct acpi_namespace_node      *StartNode;
1041     union acpi_generic_state        *Scope;         /* Current scope */
1042     union acpi_parse_object         *StartScope;
1043     UINT32                          AmlSize;
1044 
1045 } ACPI_PARSE_STATE;
1046 
1047 
1048 /* Parse object flags */
1049 
1050 #define ACPI_PARSEOP_GENERIC            0x01
1051 #define ACPI_PARSEOP_NAMED              0x02
1052 #define ACPI_PARSEOP_DEFERRED           0x04
1053 #define ACPI_PARSEOP_BYTELIST           0x08
1054 #define ACPI_PARSEOP_IN_STACK           0x10
1055 #define ACPI_PARSEOP_TARGET             0x20
1056 #define ACPI_PARSEOP_IN_CACHE           0x80
1057 
1058 /* Parse object DisasmFlags */
1059 
1060 #define ACPI_PARSEOP_IGNORE             0x01
1061 #define ACPI_PARSEOP_PARAMLIST          0x02
1062 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
1063 #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
1064 #define ACPI_PARSEOP_SPECIAL            0x10
1065 
1066 
1067 /*****************************************************************************
1068  *
1069  * Hardware (ACPI registers) and PNP
1070  *
1071  ****************************************************************************/
1072 
1073 typedef struct acpi_bit_register_info
1074 {
1075     UINT8                           ParentRegister;
1076     UINT8                           BitPosition;
1077     UINT16                          AccessBitMask;
1078 
1079 } ACPI_BIT_REGISTER_INFO;
1080 
1081 
1082 /*
1083  * Some ACPI registers have bits that must be ignored -- meaning that they
1084  * must be preserved.
1085  */
1086 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
1087 
1088 /* Write-only bits must be zeroed by software */
1089 
1090 #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
1091 
1092 /* For control registers, both ignored and reserved bits must be preserved */
1093 
1094 /*
1095  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
1096  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
1097  * bit position", section 4.7.3.2.1. However, on some machines the OS must
1098  * write a one to this bit after resume for the machine to work properly.
1099  * To enable this, we no longer attempt to preserve this bit. No machines
1100  * are known to fail if the bit is not preserved. (May 2009)
1101  */
1102 #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
1103 #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
1104 #define ACPI_PM1_CONTROL_PRESERVED_BITS \
1105          (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
1106 
1107 #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
1108 
1109 /*
1110  * Register IDs
1111  * These are the full ACPI registers
1112  */
1113 #define ACPI_REGISTER_PM1_STATUS                0x01
1114 #define ACPI_REGISTER_PM1_ENABLE                0x02
1115 #define ACPI_REGISTER_PM1_CONTROL               0x03
1116 #define ACPI_REGISTER_PM2_CONTROL               0x04
1117 #define ACPI_REGISTER_PM_TIMER                  0x05
1118 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
1119 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
1120 
1121 
1122 /* Masks used to access the BitRegisters */
1123 
1124 #define ACPI_BITMASK_TIMER_STATUS               0x0001
1125 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
1126 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
1127 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
1128 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
1129 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
1130 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
1131 #define ACPI_BITMASK_WAKE_STATUS                0x8000
1132 
1133 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
1134     ACPI_BITMASK_TIMER_STATUS          | \
1135     ACPI_BITMASK_BUS_MASTER_STATUS     | \
1136     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
1137     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
1138     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
1139     ACPI_BITMASK_RT_CLOCK_STATUS       | \
1140     ACPI_BITMASK_PCIEXP_WAKE_STATUS    | \
1141     ACPI_BITMASK_WAKE_STATUS)
1142 
1143 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
1144 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
1145 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
1146 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
1147 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
1148 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
1149 
1150 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
1151 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
1152 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
1153 #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
1154 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
1155 
1156 #define ACPI_BITMASK_ARB_DISABLE                0x0001
1157 
1158 
1159 /* Raw bit position of each BitRegister */
1160 
1161 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
1162 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
1163 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
1164 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
1165 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
1166 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
1167 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
1168 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
1169 
1170 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
1171 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
1172 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
1173 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
1174 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
1175 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
1176 
1177 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
1178 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
1179 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
1180 #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
1181 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
1182 
1183 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
1184 
1185 
1186 /* Structs and definitions for _OSI support and I/O port validation */
1187 
1188 #define ACPI_ALWAYS_ILLEGAL             0x00
1189 
1190 typedef struct acpi_interface_info
1191 {
1192     char                        *Name;
1193     struct acpi_interface_info  *Next;
1194     UINT8                       Flags;
1195     UINT8                       Value;
1196 
1197 } ACPI_INTERFACE_INFO;
1198 
1199 #define ACPI_OSI_INVALID                0x01
1200 #define ACPI_OSI_DYNAMIC                0x02
1201 #define ACPI_OSI_FEATURE                0x04
1202 #define ACPI_OSI_DEFAULT_INVALID        0x08
1203 #define ACPI_OSI_OPTIONAL_FEATURE       (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
1204 
1205 typedef struct acpi_port_info
1206 {
1207     char                    *Name;
1208     UINT16                  Start;
1209     UINT16                  End;
1210     UINT8                   OsiDependency;
1211 
1212 } ACPI_PORT_INFO;
1213 
1214 
1215 /*****************************************************************************
1216  *
1217  * Resource descriptors
1218  *
1219  ****************************************************************************/
1220 
1221 /* ResourceType values */
1222 
1223 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1224 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
1225 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
1226 
1227 /* Resource descriptor types and masks */
1228 
1229 #define ACPI_RESOURCE_NAME_LARGE                0x80
1230 #define ACPI_RESOURCE_NAME_SMALL                0x00
1231 
1232 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1233 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1234 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
1235 
1236 
1237 /*
1238  * Small resource descriptor "names" as defined by the ACPI specification.
1239  * Note: Bits 2:0 are used for the descriptor length
1240  */
1241 #define ACPI_RESOURCE_NAME_IRQ                  0x20
1242 #define ACPI_RESOURCE_NAME_DMA                  0x28
1243 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1244 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1245 #define ACPI_RESOURCE_NAME_IO                   0x40
1246 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1247 #define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
1248 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1249 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1250 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1251 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1252 #define ACPI_RESOURCE_NAME_END_TAG              0x78
1253 
1254 /*
1255  * Large resource descriptor "names" as defined by the ACPI specification.
1256  * Note: includes the Large Descriptor bit in bit[7]
1257  */
1258 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1259 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1260 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1261 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1262 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1263 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1264 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1265 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1266 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1267 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1268 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1269 #define ACPI_RESOURCE_NAME_GPIO                 0x8C
1270 #define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
1271 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
1272 
1273 
1274 /*****************************************************************************
1275  *
1276  * Miscellaneous
1277  *
1278  ****************************************************************************/
1279 
1280 #define ACPI_ASCII_ZERO                 0x30
1281 
1282 
1283 /*****************************************************************************
1284  *
1285  * Disassembler
1286  *
1287  ****************************************************************************/
1288 
1289 typedef struct acpi_external_list
1290 {
1291     char                        *Path;
1292     char                        *InternalPath;
1293     struct acpi_external_list   *Next;
1294     UINT32                      Value;
1295     UINT16                      Length;
1296     UINT16                      Flags;
1297     UINT8                       Type;
1298 
1299 } ACPI_EXTERNAL_LIST;
1300 
1301 /* Values for Flags field above */
1302 
1303 #define ACPI_EXT_RESOLVED_REFERENCE         0x01    /* Object was resolved during cross ref */
1304 #define ACPI_EXT_ORIGIN_FROM_FILE           0x02    /* External came from a file */
1305 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04    /* Deallocate internal path on completion */
1306 #define ACPI_EXT_EXTERNAL_EMITTED           0x08    /* External() statement has been emitted */
1307 
1308 
1309 typedef struct acpi_external_file
1310 {
1311     char                        *Path;
1312     struct acpi_external_file   *Next;
1313 
1314 } ACPI_EXTERNAL_FILE;
1315 
1316 
1317 /*****************************************************************************
1318  *
1319  * Debugger
1320  *
1321  ****************************************************************************/
1322 
1323 typedef struct acpi_db_method_info
1324 {
1325     ACPI_HANDLE                     Method;
1326     ACPI_HANDLE                     MainThreadGate;
1327     ACPI_HANDLE                     ThreadCompleteGate;
1328     ACPI_HANDLE                     InfoGate;
1329     ACPI_THREAD_ID                  *Threads;
1330     UINT32                          NumThreads;
1331     UINT32                          NumCreated;
1332     UINT32                          NumCompleted;
1333 
1334     char                            *Name;
1335     UINT32                          Flags;
1336     UINT32                          NumLoops;
1337     char                            Pathname[ACPI_DB_LINE_BUFFER_SIZE];
1338     char                            **Args;
1339     ACPI_OBJECT_TYPE                *Types;
1340 
1341     /*
1342      * Arguments to be passed to method for the command
1343      * Threads -
1344      *   the Number of threads, ID of current thread and
1345      *   Index of current thread inside all them created.
1346      */
1347     char                            InitArgs;
1348     ACPI_OBJECT_TYPE                ArgTypes[4];
1349     char                            *Arguments[4];
1350     char                            NumThreadsStr[11];
1351     char                            IdOfThreadStr[11];
1352     char                            IndexOfThreadStr[11];
1353 
1354 } ACPI_DB_METHOD_INFO;
1355 
1356 typedef struct acpi_integrity_info
1357 {
1358     UINT32                          Nodes;
1359     UINT32                          Objects;
1360 
1361 } ACPI_INTEGRITY_INFO;
1362 
1363 
1364 #define ACPI_DB_DISABLE_OUTPUT          0x00
1365 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1366 #define ACPI_DB_CONSOLE_OUTPUT          0x02
1367 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1368 
1369 
1370 /*****************************************************************************
1371  *
1372  * Debug
1373  *
1374  ****************************************************************************/
1375 
1376 /* Entry for a memory allocation (debug only) */
1377 
1378 #define ACPI_MEM_MALLOC                 0
1379 #define ACPI_MEM_CALLOC                 1
1380 #define ACPI_MAX_MODULE_NAME            16
1381 
1382 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1383     struct acpi_debug_mem_block     *Previous; \
1384     struct acpi_debug_mem_block     *Next; \
1385     UINT32                          Size; \
1386     UINT32                          Component; \
1387     UINT32                          Line; \
1388     char                            Module[ACPI_MAX_MODULE_NAME]; \
1389     UINT8                           AllocType;
1390 
1391 typedef struct acpi_debug_mem_header
1392 {
1393     ACPI_COMMON_DEBUG_MEM_HEADER
1394 
1395 } ACPI_DEBUG_MEM_HEADER;
1396 
1397 typedef struct acpi_debug_mem_block
1398 {
1399     ACPI_COMMON_DEBUG_MEM_HEADER
1400     UINT64                          UserSpace;
1401 
1402 } ACPI_DEBUG_MEM_BLOCK;
1403 
1404 
1405 #define ACPI_MEM_LIST_GLOBAL            0
1406 #define ACPI_MEM_LIST_NSNODE            1
1407 #define ACPI_MEM_LIST_MAX               1
1408 #define ACPI_NUM_MEM_LISTS              2
1409 
1410 
1411 /*****************************************************************************
1412  *
1413  * Info/help support
1414  *
1415  ****************************************************************************/
1416 
1417 typedef struct ah_predefined_name
1418 {
1419     char            *Name;
1420     char            *Description;
1421 #ifndef ACPI_ASL_COMPILER
1422     char            *Action;
1423 #endif
1424 
1425 } AH_PREDEFINED_NAME;
1426 
1427 typedef struct ah_device_id
1428 {
1429     char            *Name;
1430     char            *Description;
1431 
1432 } AH_DEVICE_ID;
1433 
1434 typedef struct ah_uuid
1435 {
1436     char            *Description;
1437     char            *String;
1438 
1439 } AH_UUID;
1440 
1441 #endif /* __ACLOCAL_H__ */
1442