xref: /titanic_44/usr/src/uts/intel/sys/acpi/aclocal.h (revision bd670b35a010421b6e1a5536c34453a827007c81)
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 - 2009, 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                 0x7F
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 #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
169 #ifdef DEFINE_ACPI_GLOBALS
170 
171 /* Debug names for the mutexes above */
172 
173 static char                 *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
174 {
175     "ACPI_MTX_Interpreter",
176     "ACPI_MTX_Namespace",
177     "ACPI_MTX_Tables",
178     "ACPI_MTX_Events",
179     "ACPI_MTX_Caches",
180     "ACPI_MTX_Memory",
181     "ACPI_MTX_CommandComplete",
182     "ACPI_MTX_CommandReady"
183 };
184 
185 #endif
186 #endif
187 
188 /* Lock structure for reader/writer interfaces */
189 
190 typedef struct acpi_rw_lock
191 {
192     ACPI_MUTEX              WriterMutex;
193     ACPI_MUTEX              ReaderMutex;
194     UINT32                  NumReaders;
195 
196 } ACPI_RW_LOCK;
197 
198 
199 /*
200  * Predefined handles for spinlocks used within the subsystem.
201  * These spinlocks are created by AcpiUtMutexInitialize
202  */
203 #define ACPI_LOCK_GPES                  0
204 #define ACPI_LOCK_HARDWARE              1
205 
206 #define ACPI_MAX_LOCK                   1
207 #define ACPI_NUM_LOCK                   ACPI_MAX_LOCK+1
208 
209 
210 /* This Thread ID means that the mutex is not in use (unlocked) */
211 
212 #define ACPI_MUTEX_NOT_ACQUIRED         (ACPI_THREAD_ID) -1
213 
214 /* Table for the global mutexes */
215 
216 typedef struct acpi_mutex_info
217 {
218     ACPI_MUTEX                      Mutex;
219     UINT32                          UseCount;
220     ACPI_THREAD_ID                  ThreadId;
221 
222 } ACPI_MUTEX_INFO;
223 
224 
225 /* Lock flag parameter for various interfaces */
226 
227 #define ACPI_MTX_DO_NOT_LOCK            0
228 #define ACPI_MTX_LOCK                   1
229 
230 
231 /* Field access granularities */
232 
233 #define ACPI_FIELD_BYTE_GRANULARITY     1
234 #define ACPI_FIELD_WORD_GRANULARITY     2
235 #define ACPI_FIELD_DWORD_GRANULARITY    4
236 #define ACPI_FIELD_QWORD_GRANULARITY    8
237 
238 
239 #define ACPI_ENTRY_NOT_FOUND            NULL
240 
241 
242 /*****************************************************************************
243  *
244  * Namespace typedefs and structs
245  *
246  ****************************************************************************/
247 
248 /* Operational modes of the AML interpreter/scanner */
249 
250 typedef enum
251 {
252     ACPI_IMODE_LOAD_PASS1           = 0x01,
253     ACPI_IMODE_LOAD_PASS2           = 0x02,
254     ACPI_IMODE_EXECUTE              = 0x03
255 
256 } ACPI_INTERPRETER_MODE;
257 
258 
259 /*
260  * The Namespace Node describes a named object that appears in the AML.
261  * DescriptorType is used to differentiate between internal descriptors.
262  *
263  * The node is optimized for both 32-bit and 64-bit platforms:
264  * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
265  *
266  * Note: The DescriptorType and Type fields must appear in the identical
267  * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
268  * structures.
269  */
270 typedef struct acpi_namespace_node
271 {
272     union acpi_operand_object       *Object;        /* Interpreter object */
273     UINT8                           DescriptorType; /* Differentiate object descriptor types */
274     UINT8                           Type;           /* ACPI Type associated with this name */
275     UINT8                           Flags;          /* Miscellaneous flags */
276     ACPI_OWNER_ID                   OwnerId;        /* Node creator */
277     ACPI_NAME_UNION                 Name;           /* ACPI Name, always 4 chars per ACPI spec */
278     struct acpi_namespace_node      *Child;         /* First child */
279     struct acpi_namespace_node      *Peer;          /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
280 
281     /*
282      * The following fields are used by the ASL compiler and disassembler only
283      */
284 #ifdef ACPI_LARGE_NAMESPACE_NODE
285     union acpi_parse_object         *Op;
286     UINT32                          Value;
287     UINT32                          Length;
288 #endif
289 
290 } ACPI_NAMESPACE_NODE;
291 
292 
293 /* Namespace Node flags */
294 
295 #define ANOBJ_END_OF_PEER_LIST          0x01    /* End-of-list, Peer field points to parent */
296 #define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
297 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
298 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
299 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
300 #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
301 #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
302 
303 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
304 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
305 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
306 #define ANOBJ_IS_BIT_OFFSET             0x40    /* iASL only: Reference is a bit offset */
307 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
308 
309 
310 /* One internal RSDT for table management */
311 
312 typedef struct acpi_internal_rsdt
313 {
314     ACPI_TABLE_DESC                 *Tables;
315     UINT32                          Count;
316     UINT32                          Size;
317     UINT8                           Flags;
318 
319 } ACPI_INTERNAL_RSDT;
320 
321 /* Flags for above */
322 
323 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
324 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
325 #define ACPI_ROOT_ALLOW_RESIZE          (2)
326 
327 
328 /* Predefined (fixed) table indexes */
329 
330 #define ACPI_TABLE_INDEX_DSDT           (0)
331 #define ACPI_TABLE_INDEX_FACS           (1)
332 
333 
334 typedef struct acpi_find_context
335 {
336     char                            *SearchFor;
337     ACPI_HANDLE                     *List;
338     UINT32                          *Count;
339 
340 } ACPI_FIND_CONTEXT;
341 
342 
343 typedef struct acpi_ns_search_data
344 {
345     ACPI_NAMESPACE_NODE             *Node;
346 
347 } ACPI_NS_SEARCH_DATA;
348 
349 
350 /* Object types used during package copies */
351 
352 #define ACPI_COPY_TYPE_SIMPLE           0
353 #define ACPI_COPY_TYPE_PACKAGE          1
354 
355 
356 /* Info structure used to convert external<->internal namestrings */
357 
358 typedef struct acpi_namestring_info
359 {
360     const char                      *ExternalName;
361     const char                      *NextExternalChar;
362     char                            *InternalName;
363     UINT32                          Length;
364     UINT32                          NumSegments;
365     UINT32                          NumCarats;
366     BOOLEAN                         FullyQualified;
367 
368 } ACPI_NAMESTRING_INFO;
369 
370 
371 /* Field creation info */
372 
373 typedef struct acpi_create_field_info
374 {
375     ACPI_NAMESPACE_NODE             *RegionNode;
376     ACPI_NAMESPACE_NODE             *FieldNode;
377     ACPI_NAMESPACE_NODE             *RegisterNode;
378     ACPI_NAMESPACE_NODE             *DataRegisterNode;
379     UINT32                          BankValue;
380     UINT32                          FieldBitPosition;
381     UINT32                          FieldBitLength;
382     UINT8                           FieldFlags;
383     UINT8                           Attribute;
384     UINT8                           FieldType;
385 
386 } ACPI_CREATE_FIELD_INFO;
387 
388 
389 typedef
390 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
391     struct acpi_walk_state          *WalkState);
392 
393 
394 /*
395  * Bitmapped ACPI types.  Used internally only
396  */
397 #define ACPI_BTYPE_ANY                  0x00000000
398 #define ACPI_BTYPE_INTEGER              0x00000001
399 #define ACPI_BTYPE_STRING               0x00000002
400 #define ACPI_BTYPE_BUFFER               0x00000004
401 #define ACPI_BTYPE_PACKAGE              0x00000008
402 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
403 #define ACPI_BTYPE_DEVICE               0x00000020
404 #define ACPI_BTYPE_EVENT                0x00000040
405 #define ACPI_BTYPE_METHOD               0x00000080
406 #define ACPI_BTYPE_MUTEX                0x00000100
407 #define ACPI_BTYPE_REGION               0x00000200
408 #define ACPI_BTYPE_POWER                0x00000400
409 #define ACPI_BTYPE_PROCESSOR            0x00000800
410 #define ACPI_BTYPE_THERMAL              0x00001000
411 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
412 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
413 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
414 #define ACPI_BTYPE_REFERENCE            0x00010000
415 #define ACPI_BTYPE_RESOURCE             0x00020000
416 
417 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
418 
419 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
420 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
421 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
422 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
423 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
424 
425 
426 /*
427  * Information structure for ACPI predefined names.
428  * Each entry in the table contains the following items:
429  *
430  * Name                 - The ACPI reserved name
431  * ParamCount           - Number of arguments to the method
432  * ExpectedReturnBtypes - Allowed type(s) for the return value
433  */
434 typedef struct acpi_name_info
435 {
436     char                        Name[ACPI_NAME_SIZE];
437     UINT8                       ParamCount;
438     UINT8                       ExpectedBtypes;
439 
440 } ACPI_NAME_INFO;
441 
442 /*
443  * Secondary information structures for ACPI predefined objects that return
444  * package objects. This structure appears as the next entry in the table
445  * after the NAME_INFO structure above.
446  *
447  * The reason for this is to minimize the size of the predefined name table.
448  */
449 
450 /*
451  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
452  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT
453  */
454 typedef struct acpi_package_info
455 {
456     UINT8                       Type;
457     UINT8                       ObjectType1;
458     UINT8                       Count1;
459     UINT8                       ObjectType2;
460     UINT8                       Count2;
461     UINT8                       Reserved;
462 
463 } ACPI_PACKAGE_INFO;
464 
465 /* Used for ACPI_PTYPE2_FIXED */
466 
467 typedef struct acpi_package_info2
468 {
469     UINT8                       Type;
470     UINT8                       Count;
471     UINT8                       ObjectType[4];
472 
473 } ACPI_PACKAGE_INFO2;
474 
475 /* Used for ACPI_PTYPE1_OPTION */
476 
477 typedef struct acpi_package_info3
478 {
479     UINT8                       Type;
480     UINT8                       Count;
481     UINT8                       ObjectType[2];
482     UINT8                       TailObjectType;
483     UINT8                       Reserved;
484 
485 } ACPI_PACKAGE_INFO3;
486 
487 typedef union acpi_predefined_info
488 {
489     ACPI_NAME_INFO              Info;
490     ACPI_PACKAGE_INFO           RetInfo;
491     ACPI_PACKAGE_INFO2          RetInfo2;
492     ACPI_PACKAGE_INFO3          RetInfo3;
493 
494 } ACPI_PREDEFINED_INFO;
495 
496 /*
497  * Bitmapped return value types
498  * Note: the actual data types must be contiguous, a loop in nspredef.c
499  * depends on this.
500  */
501 #define ACPI_RTYPE_ANY                  0x00
502 #define ACPI_RTYPE_NONE                 0x01
503 #define ACPI_RTYPE_INTEGER              0x02
504 #define ACPI_RTYPE_STRING               0x04
505 #define ACPI_RTYPE_BUFFER               0x08
506 #define ACPI_RTYPE_PACKAGE              0x10
507 #define ACPI_RTYPE_REFERENCE            0x20
508 #define ACPI_RTYPE_ALL                  0x3F
509 
510 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
511 
512 
513 /*****************************************************************************
514  *
515  * Event typedefs and structs
516  *
517  ****************************************************************************/
518 
519 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
520 
521 typedef struct acpi_handler_info
522 {
523     ACPI_EVENT_HANDLER              Address;        /* Address of handler, if any */
524     void                            *Context;       /* Context to be passed to handler */
525     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
526 
527 } ACPI_HANDLER_INFO;
528 
529 typedef union acpi_gpe_dispatch_info
530 {
531     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
532     struct acpi_handler_info        *Handler;
533 
534 } ACPI_GPE_DISPATCH_INFO;
535 
536 /*
537  * Information about a GPE, one per each GPE in an array.
538  * NOTE: Important to keep this struct as small as possible.
539  */
540 typedef struct acpi_gpe_event_info
541 {
542     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method or Handler */
543     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
544     UINT8                           Flags;          /* Misc info about this GPE */
545     UINT8                           GpeNumber;      /* This GPE */
546 
547 } ACPI_GPE_EVENT_INFO;
548 
549 /* Information about a GPE register pair, one per each status/enable pair in an array */
550 
551 typedef struct acpi_gpe_register_info
552 {
553     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
554     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
555     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
556     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
557     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
558 
559 } ACPI_GPE_REGISTER_INFO;
560 
561 /*
562  * Information about a GPE register block, one per each installed block --
563  * GPE0, GPE1, and one per each installed GPE Block Device.
564  */
565 typedef struct acpi_gpe_block_info
566 {
567     ACPI_NAMESPACE_NODE             *Node;
568     struct acpi_gpe_block_info      *Previous;
569     struct acpi_gpe_block_info      *Next;
570     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
571     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
572     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
573     ACPI_GENERIC_ADDRESS            BlockAddress;   /* Base address of the block */
574     UINT32                          RegisterCount;  /* Number of register pairs in block */
575     UINT8                           BlockBaseNumber;/* Base GPE number for this block */
576 
577 } ACPI_GPE_BLOCK_INFO;
578 
579 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
580 
581 typedef struct acpi_gpe_xrupt_info
582 {
583     struct acpi_gpe_xrupt_info      *Previous;
584     struct acpi_gpe_xrupt_info      *Next;
585     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
586     UINT32                          InterruptNumber;    /* System interrupt number */
587 
588 } ACPI_GPE_XRUPT_INFO;
589 
590 typedef struct acpi_gpe_walk_info
591 {
592     ACPI_NAMESPACE_NODE             *GpeDevice;
593     ACPI_GPE_BLOCK_INFO             *GpeBlock;
594 
595 } ACPI_GPE_WALK_INFO;
596 
597 typedef struct acpi_gpe_device_info
598 {
599     UINT32                          Index;
600     UINT32                          NextBlockBaseIndex;
601     ACPI_STATUS                     Status;
602     ACPI_NAMESPACE_NODE             *GpeDevice;
603 
604 } ACPI_GPE_DEVICE_INFO;
605 
606 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
607     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
608     ACPI_GPE_BLOCK_INFO             *GpeBlock,
609     void                            *Context);
610 
611 
612 /* Information about each particular fixed event */
613 
614 typedef struct acpi_fixed_event_handler
615 {
616     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
617     void                            *Context;       /* Context to be passed to handler */
618 
619 } ACPI_FIXED_EVENT_HANDLER;
620 
621 typedef struct acpi_fixed_event_info
622 {
623     UINT8                           StatusRegisterId;
624     UINT8                           EnableRegisterId;
625     UINT16                          StatusBitMask;
626     UINT16                          EnableBitMask;
627 
628 } ACPI_FIXED_EVENT_INFO;
629 
630 /* Information used during field processing */
631 
632 typedef struct acpi_field_info
633 {
634     UINT8                           SkipField;
635     UINT8                           FieldFlag;
636     UINT32                          PkgLength;
637 
638 } ACPI_FIELD_INFO;
639 
640 
641 /*****************************************************************************
642  *
643  * Generic "state" object for stacks
644  *
645  ****************************************************************************/
646 
647 #define ACPI_CONTROL_NORMAL                  0xC0
648 #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
649 #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
650 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
651 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
652 
653 
654 #define ACPI_STATE_COMMON \
655     void                            *Next; \
656     UINT8                           DescriptorType; /* To differentiate various internal objs */\
657     UINT8                           Flags; \
658     UINT16                          Value; \
659     UINT16                          State;
660 
661     /* There are 2 bytes available here until the next natural alignment boundary */
662 
663 typedef struct acpi_common_state
664 {
665     ACPI_STATE_COMMON
666 } ACPI_COMMON_STATE;
667 
668 
669 /*
670  * Update state - used to traverse complex objects such as packages
671  */
672 typedef struct acpi_update_state
673 {
674     ACPI_STATE_COMMON
675     union acpi_operand_object       *Object;
676 
677 } ACPI_UPDATE_STATE;
678 
679 
680 /*
681  * Pkg state - used to traverse nested package structures
682  */
683 typedef struct acpi_pkg_state
684 {
685     ACPI_STATE_COMMON
686     UINT16                          Index;
687     union acpi_operand_object       *SourceObject;
688     union acpi_operand_object       *DestObject;
689     struct acpi_walk_state          *WalkState;
690     void                            *ThisTargetObj;
691     UINT32                          NumPackages;
692 
693 } ACPI_PKG_STATE;
694 
695 
696 /*
697  * Control state - one per if/else and while constructs.
698  * Allows nesting of these constructs
699  */
700 typedef struct acpi_control_state
701 {
702     ACPI_STATE_COMMON
703     UINT16                          Opcode;
704     union acpi_parse_object         *PredicateOp;
705     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
706     UINT8                           *PackageEnd;            /* End of if/while block */
707     UINT32                          LoopCount;              /* While() loop counter */
708 
709 } ACPI_CONTROL_STATE;
710 
711 
712 /*
713  * Scope state - current scope during namespace lookups
714  */
715 typedef struct acpi_scope_state
716 {
717     ACPI_STATE_COMMON
718     ACPI_NAMESPACE_NODE             *Node;
719 
720 } ACPI_SCOPE_STATE;
721 
722 
723 typedef struct acpi_pscope_state
724 {
725     ACPI_STATE_COMMON
726     UINT32                          ArgCount;               /* Number of fixed arguments */
727     union acpi_parse_object         *Op;                    /* Current op being parsed */
728     UINT8                           *ArgEnd;                /* Current argument end */
729     UINT8                           *PkgEnd;                /* Current package end */
730     UINT32                          ArgList;                /* Next argument to parse */
731 
732 } ACPI_PSCOPE_STATE;
733 
734 
735 /*
736  * Thread state - one per thread across multiple walk states.  Multiple walk
737  * states are created when there are nested control methods executing.
738  */
739 typedef struct acpi_thread_state
740 {
741     ACPI_STATE_COMMON
742     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
743     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
744     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
745     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
746 
747 } ACPI_THREAD_STATE;
748 
749 
750 /*
751  * Result values - used to accumulate the results of nested
752  * AML arguments
753  */
754 typedef struct acpi_result_values
755 {
756     ACPI_STATE_COMMON
757     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
758 
759 } ACPI_RESULT_VALUES;
760 
761 
762 typedef
763 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
764     struct acpi_walk_state          *WalkState,
765     union acpi_parse_object         **OutOp);
766 
767 typedef
768 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
769     struct acpi_walk_state          *WalkState);
770 
771 
772 /*
773  * Notify info - used to pass info to the deferred notify
774  * handler/dispatcher.
775  */
776 typedef struct acpi_notify_info
777 {
778     ACPI_STATE_COMMON
779     ACPI_NAMESPACE_NODE             *Node;
780     union acpi_operand_object       *HandlerObj;
781 
782 } ACPI_NOTIFY_INFO;
783 
784 
785 /* Generic state is union of structs above */
786 
787 typedef union acpi_generic_state
788 {
789     ACPI_COMMON_STATE               Common;
790     ACPI_CONTROL_STATE              Control;
791     ACPI_UPDATE_STATE               Update;
792     ACPI_SCOPE_STATE                Scope;
793     ACPI_PSCOPE_STATE               ParseScope;
794     ACPI_PKG_STATE                  Pkg;
795     ACPI_THREAD_STATE               Thread;
796     ACPI_RESULT_VALUES              Results;
797     ACPI_NOTIFY_INFO                Notify;
798 
799 } ACPI_GENERIC_STATE;
800 
801 
802 /*****************************************************************************
803  *
804  * Interpreter typedefs and structs
805  *
806  ****************************************************************************/
807 
808 typedef
809 ACPI_STATUS (*ACPI_EXECUTE_OP) (
810     struct acpi_walk_state          *WalkState);
811 
812 
813 /*****************************************************************************
814  *
815  * Parser typedefs and structs
816  *
817  ****************************************************************************/
818 
819 /*
820  * AML opcode, name, and argument layout
821  */
822 typedef struct acpi_opcode_info
823 {
824 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
825     char                            *Name;          /* Opcode name (disassembler/debug only) */
826 #endif
827     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
828     UINT32                          RuntimeArgs;    /* Interpret time arguments */
829     UINT16                          Flags;          /* Misc flags */
830     UINT8                           ObjectType;     /* Corresponding internal object type */
831     UINT8                           Class;          /* Opcode class */
832     UINT8                           Type;           /* Opcode type */
833 
834 } ACPI_OPCODE_INFO;
835 
836 typedef union acpi_parse_value
837 {
838     ACPI_INTEGER                    Integer;        /* Integer constant (Up to 64 bits) */
839     UINT64_STRUCT                   Integer64;      /* Structure overlay for 2 32-bit Dwords */
840     UINT32                          Size;           /* bytelist or field size */
841     char                            *String;        /* NULL terminated string */
842     UINT8                           *Buffer;        /* buffer or string */
843     char                            *Name;          /* NULL terminated string */
844     union acpi_parse_object         *Arg;           /* arguments and contained ops */
845 
846 } ACPI_PARSE_VALUE;
847 
848 
849 #ifdef ACPI_DISASSEMBLER
850 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
851 #else
852 #define ACPI_DISASM_ONLY_MEMBERS(a)
853 #endif
854 
855 #define ACPI_PARSE_COMMON \
856     union acpi_parse_object         *Parent;        /* Parent op */\
857     UINT8                           DescriptorType; /* To differentiate various internal objs */\
858     UINT8                           Flags;          /* Type of Op */\
859     UINT16                          AmlOpcode;      /* AML opcode */\
860     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
861     union acpi_parse_object         *Next;          /* Next op */\
862     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
863     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
864     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
865     ACPI_DISASM_ONLY_MEMBERS (\
866     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
867     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
868     char                            AmlOpName[16])  /* Op name (debug only) */
869 
870 
871 #define ACPI_DASM_BUFFER                0x00
872 #define ACPI_DASM_RESOURCE              0x01
873 #define ACPI_DASM_STRING                0x02
874 #define ACPI_DASM_UNICODE               0x03
875 #define ACPI_DASM_EISAID                0x04
876 #define ACPI_DASM_MATCHOP               0x05
877 #define ACPI_DASM_LNOT_PREFIX           0x06
878 #define ACPI_DASM_LNOT_SUFFIX           0x07
879 #define ACPI_DASM_IGNORE                0x08
880 
881 /*
882  * Generic operation (for example:  If, While, Store)
883  */
884 typedef struct acpi_parse_obj_common
885 {
886     ACPI_PARSE_COMMON
887 } ACPI_PARSE_OBJ_COMMON;
888 
889 
890 /*
891  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
892  * and bytelists.
893  */
894 typedef struct acpi_parse_obj_named
895 {
896     ACPI_PARSE_COMMON
897     UINT8                           *Path;
898     UINT8                           *Data;          /* AML body or bytelist data */
899     UINT32                          Length;         /* AML length */
900     UINT32                          Name;           /* 4-byte name or zero if no name */
901 
902 } ACPI_PARSE_OBJ_NAMED;
903 
904 
905 /* This version is used by the iASL compiler only */
906 
907 #define ACPI_MAX_PARSEOP_NAME   20
908 
909 typedef struct acpi_parse_obj_asl
910 {
911     ACPI_PARSE_COMMON
912     union acpi_parse_object         *Child;
913     union acpi_parse_object         *ParentMethod;
914     char                            *Filename;
915     char                            *ExternalName;
916     char                            *Namepath;
917     char                            NameSeg[4];
918     UINT32                          ExtraValue;
919     UINT32                          Column;
920     UINT32                          LineNumber;
921     UINT32                          LogicalLineNumber;
922     UINT32                          LogicalByteOffset;
923     UINT32                          EndLine;
924     UINT32                          EndLogicalLine;
925     UINT32                          AcpiBtype;
926     UINT32                          AmlLength;
927     UINT32                          AmlSubtreeLength;
928     UINT32                          FinalAmlLength;
929     UINT32                          FinalAmlOffset;
930     UINT32                          CompileFlags;
931     UINT16                          ParseOpcode;
932     UINT8                           AmlOpcodeLength;
933     UINT8                           AmlPkgLenBytes;
934     UINT8                           Extra;
935     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
936 
937 } ACPI_PARSE_OBJ_ASL;
938 
939 typedef union acpi_parse_object
940 {
941     ACPI_PARSE_OBJ_COMMON           Common;
942     ACPI_PARSE_OBJ_NAMED            Named;
943     ACPI_PARSE_OBJ_ASL              Asl;
944 
945 } ACPI_PARSE_OBJECT;
946 
947 
948 /*
949  * Parse state - one state per parser invocation and each control
950  * method.
951  */
952 typedef struct acpi_parse_state
953 {
954     UINT8                           *AmlStart;      /* First AML byte */
955     UINT8                           *Aml;           /* Next AML byte */
956     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
957     UINT8                           *PkgStart;      /* Current package begin */
958     UINT8                           *PkgEnd;        /* Current package end */
959     union acpi_parse_object         *StartOp;       /* Root of parse tree */
960     struct acpi_namespace_node      *StartNode;
961     union acpi_generic_state        *Scope;         /* Current scope */
962     union acpi_parse_object         *StartScope;
963     UINT32                          AmlSize;
964 
965 } ACPI_PARSE_STATE;
966 
967 
968 /* Parse object flags */
969 
970 #define ACPI_PARSEOP_GENERIC            0x01
971 #define ACPI_PARSEOP_NAMED              0x02
972 #define ACPI_PARSEOP_DEFERRED           0x04
973 #define ACPI_PARSEOP_BYTELIST           0x08
974 #define ACPI_PARSEOP_IN_STACK           0x10
975 #define ACPI_PARSEOP_TARGET             0x20
976 #define ACPI_PARSEOP_IN_CACHE           0x80
977 
978 /* Parse object DisasmFlags */
979 
980 #define ACPI_PARSEOP_IGNORE             0x01
981 #define ACPI_PARSEOP_PARAMLIST          0x02
982 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
983 #define ACPI_PARSEOP_SPECIAL            0x10
984 
985 
986 /*****************************************************************************
987  *
988  * Hardware (ACPI registers) and PNP
989  *
990  ****************************************************************************/
991 
992 typedef struct acpi_bit_register_info
993 {
994     UINT8                           ParentRegister;
995     UINT8                           BitPosition;
996     UINT16                          AccessBitMask;
997 
998 } ACPI_BIT_REGISTER_INFO;
999 
1000 
1001 /*
1002  * Some ACPI registers have bits that must be ignored -- meaning that they
1003  * must be preserved.
1004  */
1005 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
1006 
1007 /* Write-only bits must be zeroed by software */
1008 
1009 #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
1010 
1011 /* For control registers, both ignored and reserved bits must be preserved */
1012 
1013 /*
1014  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
1015  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
1016  * bit position", section 4.7.3.2.1. However, on some machines the OS must
1017  * write a one to this bit after resume for the machine to work properly.
1018  * To enable this, we no longer attempt to preserve this bit. No machines
1019  * are known to fail if the bit is not preserved. (May 2009)
1020  */
1021 #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
1022 #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
1023 #define ACPI_PM1_CONTROL_PRESERVED_BITS \
1024          (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
1025 
1026 #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
1027 
1028 /*
1029  * Register IDs
1030  * These are the full ACPI registers
1031  */
1032 #define ACPI_REGISTER_PM1_STATUS                0x01
1033 #define ACPI_REGISTER_PM1_ENABLE                0x02
1034 #define ACPI_REGISTER_PM1_CONTROL               0x03
1035 #define ACPI_REGISTER_PM2_CONTROL               0x04
1036 #define ACPI_REGISTER_PM_TIMER                  0x05
1037 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
1038 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
1039 
1040 
1041 /* Masks used to access the BitRegisters */
1042 
1043 #define ACPI_BITMASK_TIMER_STATUS               0x0001
1044 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
1045 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
1046 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
1047 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
1048 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
1049 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
1050 #define ACPI_BITMASK_WAKE_STATUS                0x8000
1051 
1052 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
1053     ACPI_BITMASK_TIMER_STATUS          | \
1054     ACPI_BITMASK_BUS_MASTER_STATUS     | \
1055     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
1056     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
1057     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
1058     ACPI_BITMASK_RT_CLOCK_STATUS       | \
1059     ACPI_BITMASK_WAKE_STATUS)
1060 
1061 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
1062 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
1063 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
1064 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
1065 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
1066 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
1067 
1068 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
1069 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
1070 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
1071 #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
1072 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
1073 
1074 #define ACPI_BITMASK_ARB_DISABLE                0x0001
1075 
1076 
1077 /* Raw bit position of each BitRegister */
1078 
1079 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
1080 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
1081 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
1082 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
1083 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
1084 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
1085 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
1086 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
1087 
1088 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
1089 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
1090 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
1091 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
1092 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
1093 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
1094 
1095 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
1096 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
1097 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
1098 #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
1099 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
1100 
1101 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
1102 
1103 
1104 /* Structs and definitions for _OSI support and I/O port validation */
1105 
1106 #define ACPI_OSI_WIN_2000               0x01
1107 #define ACPI_OSI_WIN_XP                 0x02
1108 #define ACPI_OSI_WIN_XP_SP1             0x03
1109 #define ACPI_OSI_WINSRV_2003            0x04
1110 #define ACPI_OSI_WIN_XP_SP2             0x05
1111 #define ACPI_OSI_WINSRV_2003_SP1        0x06
1112 #define ACPI_OSI_WIN_VISTA              0x07
1113 
1114 #define ACPI_ALWAYS_ILLEGAL             0x00
1115 
1116 typedef struct acpi_interface_info
1117 {
1118     char                    *Name;
1119     UINT8                   Value;
1120 
1121 } ACPI_INTERFACE_INFO;
1122 
1123 typedef struct acpi_port_info
1124 {
1125     char                    *Name;
1126     UINT16                  Start;
1127     UINT16                  End;
1128     UINT8                   OsiDependency;
1129 
1130 } ACPI_PORT_INFO;
1131 
1132 
1133 /*****************************************************************************
1134  *
1135  * Resource descriptors
1136  *
1137  ****************************************************************************/
1138 
1139 /* ResourceType values */
1140 
1141 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1142 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
1143 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
1144 
1145 /* Resource descriptor types and masks */
1146 
1147 #define ACPI_RESOURCE_NAME_LARGE                0x80
1148 #define ACPI_RESOURCE_NAME_SMALL                0x00
1149 
1150 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1151 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1152 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
1153 
1154 
1155 /*
1156  * Small resource descriptor "names" as defined by the ACPI specification.
1157  * Note: Bits 2:0 are used for the descriptor length
1158  */
1159 #define ACPI_RESOURCE_NAME_IRQ                  0x20
1160 #define ACPI_RESOURCE_NAME_DMA                  0x28
1161 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1162 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1163 #define ACPI_RESOURCE_NAME_IO                   0x40
1164 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1165 #define ACPI_RESOURCE_NAME_RESERVED_S1          0x50
1166 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1167 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1168 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1169 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1170 #define ACPI_RESOURCE_NAME_END_TAG              0x78
1171 
1172 /*
1173  * Large resource descriptor "names" as defined by the ACPI specification.
1174  * Note: includes the Large Descriptor bit in bit[7]
1175  */
1176 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1177 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1178 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1179 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1180 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1181 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1182 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1183 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1184 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1185 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1186 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1187 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8B
1188 
1189 
1190 /*****************************************************************************
1191  *
1192  * Miscellaneous
1193  *
1194  ****************************************************************************/
1195 
1196 #define ACPI_ASCII_ZERO                 0x30
1197 
1198 
1199 /*****************************************************************************
1200  *
1201  * Debugger
1202  *
1203  ****************************************************************************/
1204 
1205 typedef struct acpi_db_method_info
1206 {
1207     ACPI_HANDLE                     MainThreadGate;
1208     ACPI_HANDLE                     ThreadCompleteGate;
1209     ACPI_HANDLE                     InfoGate;
1210     UINT32                          *Threads;
1211     UINT32                          NumThreads;
1212     UINT32                          NumCreated;
1213     UINT32                          NumCompleted;
1214 
1215     char                            *Name;
1216     UINT32                          Flags;
1217     UINT32                          NumLoops;
1218     char                            Pathname[128];
1219     char                            **Args;
1220 
1221     /*
1222      * Arguments to be passed to method for the command
1223      * Threads -
1224      *   the Number of threads, ID of current thread and
1225      *   Index of current thread inside all them created.
1226      */
1227     char                            InitArgs;
1228     char                            *Arguments[4];
1229     char                            NumThreadsStr[11];
1230     char                            IdOfThreadStr[11];
1231     char                            IndexOfThreadStr[11];
1232 
1233 } ACPI_DB_METHOD_INFO;
1234 
1235 typedef struct acpi_integrity_info
1236 {
1237     UINT32                          Nodes;
1238     UINT32                          Objects;
1239 
1240 } ACPI_INTEGRITY_INFO;
1241 
1242 
1243 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1244 #define ACPI_DB_CONSOLE_OUTPUT          0x02
1245 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1246 
1247 
1248 /*****************************************************************************
1249  *
1250  * Debug
1251  *
1252  ****************************************************************************/
1253 
1254 /* Entry for a memory allocation (debug only) */
1255 
1256 #define ACPI_MEM_MALLOC                 0
1257 #define ACPI_MEM_CALLOC                 1
1258 #define ACPI_MAX_MODULE_NAME            16
1259 
1260 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1261     struct acpi_debug_mem_block     *Previous; \
1262     struct acpi_debug_mem_block     *Next; \
1263     UINT32                          Size; \
1264     UINT32                          Component; \
1265     UINT32                          Line; \
1266     char                            Module[ACPI_MAX_MODULE_NAME]; \
1267     UINT8                           AllocType;
1268 
1269 typedef struct acpi_debug_mem_header
1270 {
1271     ACPI_COMMON_DEBUG_MEM_HEADER
1272 
1273 } ACPI_DEBUG_MEM_HEADER;
1274 
1275 typedef struct acpi_debug_mem_block
1276 {
1277     ACPI_COMMON_DEBUG_MEM_HEADER
1278     UINT64                          UserSpace;
1279 
1280 } ACPI_DEBUG_MEM_BLOCK;
1281 
1282 
1283 #define ACPI_MEM_LIST_GLOBAL            0
1284 #define ACPI_MEM_LIST_NSNODE            1
1285 #define ACPI_MEM_LIST_MAX               1
1286 #define ACPI_NUM_MEM_LISTS              2
1287 
1288 
1289 #endif /* __ACLOCAL_H__ */
1290