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