Sync ACPICA with Intel's version 20150619.
[dragonfly.git] / sys / contrib / dev / acpica / source / include / aclocal.h
1 /******************************************************************************
2  *
3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
4  *
5  *****************************************************************************/
6
7 /*
8  * Copyright (C) 2000 - 2015, 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                 0x82
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 #define ACPI_TABLE_INDEX_X_FACS         (2)
242
243
244 typedef struct acpi_find_context
245 {
246     char                            *SearchFor;
247     ACPI_HANDLE                     *List;
248     UINT32                          *Count;
249
250 } ACPI_FIND_CONTEXT;
251
252
253 typedef struct acpi_ns_search_data
254 {
255     ACPI_NAMESPACE_NODE             *Node;
256
257 } ACPI_NS_SEARCH_DATA;
258
259
260 /* Object types used during package copies */
261
262 #define ACPI_COPY_TYPE_SIMPLE           0
263 #define ACPI_COPY_TYPE_PACKAGE          1
264
265
266 /* Info structure used to convert external<->internal namestrings */
267
268 typedef struct acpi_namestring_info
269 {
270     const char                      *ExternalName;
271     const char                      *NextExternalChar;
272     char                            *InternalName;
273     UINT32                          Length;
274     UINT32                          NumSegments;
275     UINT32                          NumCarats;
276     BOOLEAN                         FullyQualified;
277
278 } ACPI_NAMESTRING_INFO;
279
280
281 /* Field creation info */
282
283 typedef struct acpi_create_field_info
284 {
285     ACPI_NAMESPACE_NODE             *RegionNode;
286     ACPI_NAMESPACE_NODE             *FieldNode;
287     ACPI_NAMESPACE_NODE             *RegisterNode;
288     ACPI_NAMESPACE_NODE             *DataRegisterNode;
289     ACPI_NAMESPACE_NODE             *ConnectionNode;
290     UINT8                           *ResourceBuffer;
291     UINT32                          BankValue;
292     UINT32                          FieldBitPosition;
293     UINT32                          FieldBitLength;
294     UINT16                          ResourceLength;
295     UINT16                          PinNumberIndex;
296     UINT8                           FieldFlags;
297     UINT8                           Attribute;
298     UINT8                           FieldType;
299     UINT8                           AccessLength;
300
301 } ACPI_CREATE_FIELD_INFO;
302
303
304 typedef
305 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
306     struct acpi_walk_state          *WalkState);
307
308
309 /*
310  * Bitmapped ACPI types. Used internally only
311  */
312 #define ACPI_BTYPE_ANY                  0x00000000
313 #define ACPI_BTYPE_INTEGER              0x00000001
314 #define ACPI_BTYPE_STRING               0x00000002
315 #define ACPI_BTYPE_BUFFER               0x00000004
316 #define ACPI_BTYPE_PACKAGE              0x00000008
317 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
318 #define ACPI_BTYPE_DEVICE               0x00000020
319 #define ACPI_BTYPE_EVENT                0x00000040
320 #define ACPI_BTYPE_METHOD               0x00000080
321 #define ACPI_BTYPE_MUTEX                0x00000100
322 #define ACPI_BTYPE_REGION               0x00000200
323 #define ACPI_BTYPE_POWER                0x00000400
324 #define ACPI_BTYPE_PROCESSOR            0x00000800
325 #define ACPI_BTYPE_THERMAL              0x00001000
326 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
327 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
328 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
329 #define ACPI_BTYPE_REFERENCE            0x00010000
330 #define ACPI_BTYPE_RESOURCE             0x00020000
331
332 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
333
334 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
335 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
336 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
337 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
338 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
339
340 #pragma pack(1)
341
342 /*
343  * Information structure for ACPI predefined names.
344  * Each entry in the table contains the following items:
345  *
346  * Name                 - The ACPI reserved name
347  * ParamCount           - Number of arguments to the method
348  * ExpectedReturnBtypes - Allowed type(s) for the return value
349  */
350 typedef struct acpi_name_info
351 {
352     char                        Name[ACPI_NAME_SIZE];
353     UINT16                      ArgumentList;
354     UINT8                       ExpectedBtypes;
355
356 } ACPI_NAME_INFO;
357
358 /*
359  * Secondary information structures for ACPI predefined objects that return
360  * package objects. This structure appears as the next entry in the table
361  * after the NAME_INFO structure above.
362  *
363  * The reason for this is to minimize the size of the predefined name table.
364  */
365
366 /*
367  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
368  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
369  * ACPI_PTYPE2_FIX_VAR
370  */
371 typedef struct acpi_package_info
372 {
373     UINT8                       Type;
374     UINT8                       ObjectType1;
375     UINT8                       Count1;
376     UINT8                       ObjectType2;
377     UINT8                       Count2;
378     UINT16                      Reserved;
379
380 } ACPI_PACKAGE_INFO;
381
382 /* Used for ACPI_PTYPE2_FIXED */
383
384 typedef struct acpi_package_info2
385 {
386     UINT8                       Type;
387     UINT8                       Count;
388     UINT8                       ObjectType[4];
389     UINT8                       Reserved;
390
391 } ACPI_PACKAGE_INFO2;
392
393 /* Used for ACPI_PTYPE1_OPTION */
394
395 typedef struct acpi_package_info3
396 {
397     UINT8                       Type;
398     UINT8                       Count;
399     UINT8                       ObjectType[2];
400     UINT8                       TailObjectType;
401     UINT16                      Reserved;
402
403 } ACPI_PACKAGE_INFO3;
404
405 typedef struct acpi_package_info4
406 {
407     UINT8                       Type;
408     UINT8                       ObjectType1;
409     UINT8                       Count1;
410     UINT8                       SubObjectTypes;
411     UINT8                       PkgCount;
412     UINT16                      Reserved;
413
414 } ACPI_PACKAGE_INFO4;
415
416 typedef union acpi_predefined_info
417 {
418     ACPI_NAME_INFO              Info;
419     ACPI_PACKAGE_INFO           RetInfo;
420     ACPI_PACKAGE_INFO2          RetInfo2;
421     ACPI_PACKAGE_INFO3          RetInfo3;
422     ACPI_PACKAGE_INFO4          RetInfo4;
423
424 } ACPI_PREDEFINED_INFO;
425
426 /* Reset to default packing */
427
428 #pragma pack()
429
430
431 /* Return object auto-repair info */
432
433 typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
434     union acpi_operand_object   *OriginalObject,
435     union acpi_operand_object   **ConvertedObject);
436
437 typedef struct acpi_simple_repair_info
438 {
439     char                        Name[ACPI_NAME_SIZE];
440     UINT32                      UnexpectedBtypes;
441     UINT32                      PackageIndex;
442     ACPI_OBJECT_CONVERTER       ObjectConverter;
443
444 } ACPI_SIMPLE_REPAIR_INFO;
445
446
447 /*
448  * Bitmapped return value types
449  * Note: the actual data types must be contiguous, a loop in nspredef.c
450  * depends on this.
451  */
452 #define ACPI_RTYPE_ANY                  0x00
453 #define ACPI_RTYPE_NONE                 0x01
454 #define ACPI_RTYPE_INTEGER              0x02
455 #define ACPI_RTYPE_STRING               0x04
456 #define ACPI_RTYPE_BUFFER               0x08
457 #define ACPI_RTYPE_PACKAGE              0x10
458 #define ACPI_RTYPE_REFERENCE            0x20
459 #define ACPI_RTYPE_ALL                  0x3F
460
461 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
462
463
464 /*****************************************************************************
465  *
466  * Event typedefs and structs
467  *
468  ****************************************************************************/
469
470 /* Dispatch info for each host-installed SCI handler */
471
472 typedef struct acpi_sci_handler_info
473 {
474     struct acpi_sci_handler_info    *Next;
475     ACPI_SCI_HANDLER                Address;        /* Address of handler */
476     void                            *Context;       /* Context to be passed to handler */
477
478 } ACPI_SCI_HANDLER_INFO;
479
480 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
481
482 typedef struct acpi_gpe_handler_info
483 {
484     ACPI_GPE_HANDLER                Address;        /* Address of handler, if any */
485     void                            *Context;       /* Context to be passed to handler */
486     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
487     UINT8                           OriginalFlags;  /* Original (pre-handler) GPE info */
488     BOOLEAN                         OriginallyEnabled; /* True if GPE was originally enabled */
489
490 } ACPI_GPE_HANDLER_INFO;
491
492 /* Notify info for implicit notify, multiple device objects */
493
494 typedef struct acpi_gpe_notify_info
495 {
496     ACPI_NAMESPACE_NODE             *DeviceNode;    /* Device to be notified */
497     struct acpi_gpe_notify_info     *Next;
498
499 } ACPI_GPE_NOTIFY_INFO;
500
501 /*
502  * GPE dispatch info. At any time, the GPE can have at most one type
503  * of dispatch - Method, Handler, or Implicit Notify.
504  */
505 typedef union acpi_gpe_dispatch_info
506 {
507     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
508     ACPI_GPE_HANDLER_INFO           *Handler;       /* Installed GPE handler */
509     ACPI_GPE_NOTIFY_INFO            *NotifyList;    /* List of _PRW devices for implicit notifies */
510
511 } ACPI_GPE_DISPATCH_INFO;
512
513 /*
514  * Information about a GPE, one per each GPE in an array.
515  * NOTE: Important to keep this struct as small as possible.
516  */
517 typedef struct acpi_gpe_event_info
518 {
519     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method, Handler, or NotifyList */
520     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
521     UINT8                           Flags;          /* Misc info about this GPE */
522     UINT8                           GpeNumber;      /* This GPE */
523     UINT8                           RuntimeCount;   /* References to a run GPE */
524
525 } ACPI_GPE_EVENT_INFO;
526
527 /* Information about a GPE register pair, one per each status/enable pair in an array */
528
529 typedef struct acpi_gpe_register_info
530 {
531     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
532     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
533     UINT16                          BaseGpeNumber;  /* Base GPE number for this register */
534     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
535     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
536     UINT8                           EnableMask;     /* Current mask of enabled GPEs */
537
538 } ACPI_GPE_REGISTER_INFO;
539
540 /*
541  * Information about a GPE register block, one per each installed block --
542  * GPE0, GPE1, and one per each installed GPE Block Device.
543  */
544 typedef struct acpi_gpe_block_info
545 {
546     ACPI_NAMESPACE_NODE             *Node;
547     struct acpi_gpe_block_info      *Previous;
548     struct acpi_gpe_block_info      *Next;
549     struct acpi_gpe_xrupt_info      *XruptBlock;    /* Backpointer to interrupt block */
550     ACPI_GPE_REGISTER_INFO          *RegisterInfo;  /* One per GPE register pair */
551     ACPI_GPE_EVENT_INFO             *EventInfo;     /* One for each GPE */
552     UINT64                          Address;        /* Base address of the block */
553     UINT32                          RegisterCount;  /* Number of register pairs in block */
554     UINT16                          GpeCount;       /* Number of individual GPEs in block */
555     UINT16                          BlockBaseNumber;/* Base GPE number for this block */
556     UINT8                           SpaceId;
557     BOOLEAN                         Initialized;    /* TRUE if this block is initialized */
558
559 } ACPI_GPE_BLOCK_INFO;
560
561 /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */
562
563 typedef struct acpi_gpe_xrupt_info
564 {
565     struct acpi_gpe_xrupt_info      *Previous;
566     struct acpi_gpe_xrupt_info      *Next;
567     ACPI_GPE_BLOCK_INFO             *GpeBlockListHead;  /* List of GPE blocks for this xrupt */
568     UINT32                          InterruptNumber;    /* System interrupt number */
569
570 } ACPI_GPE_XRUPT_INFO;
571
572 typedef struct acpi_gpe_walk_info
573 {
574     ACPI_NAMESPACE_NODE             *GpeDevice;
575     ACPI_GPE_BLOCK_INFO             *GpeBlock;
576     UINT16                          Count;
577     ACPI_OWNER_ID                   OwnerId;
578     BOOLEAN                         ExecuteByOwnerId;
579
580 } ACPI_GPE_WALK_INFO;
581
582 typedef struct acpi_gpe_device_info
583 {
584     UINT32                          Index;
585     UINT32                          NextBlockBaseIndex;
586     ACPI_STATUS                     Status;
587     ACPI_NAMESPACE_NODE             *GpeDevice;
588
589 } ACPI_GPE_DEVICE_INFO;
590
591 typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
592     ACPI_GPE_XRUPT_INFO             *GpeXruptInfo,
593     ACPI_GPE_BLOCK_INFO             *GpeBlock,
594     void                            *Context);
595
596
597 /* Information about each particular fixed event */
598
599 typedef struct acpi_fixed_event_handler
600 {
601     ACPI_EVENT_HANDLER              Handler;        /* Address of handler. */
602     void                            *Context;       /* Context to be passed to handler */
603
604 } ACPI_FIXED_EVENT_HANDLER;
605
606 typedef struct acpi_fixed_event_info
607 {
608     UINT8                           StatusRegisterId;
609     UINT8                           EnableRegisterId;
610     UINT16                          StatusBitMask;
611     UINT16                          EnableBitMask;
612
613 } ACPI_FIXED_EVENT_INFO;
614
615 /* Information used during field processing */
616
617 typedef struct acpi_field_info
618 {
619     UINT8                           SkipField;
620     UINT8                           FieldFlag;
621     UINT32                          PkgLength;
622
623 } ACPI_FIELD_INFO;
624
625
626 /*****************************************************************************
627  *
628  * Generic "state" object for stacks
629  *
630  ****************************************************************************/
631
632 #define ACPI_CONTROL_NORMAL                  0xC0
633 #define ACPI_CONTROL_CONDITIONAL_EXECUTING   0xC1
634 #define ACPI_CONTROL_PREDICATE_EXECUTING     0xC2
635 #define ACPI_CONTROL_PREDICATE_FALSE         0xC3
636 #define ACPI_CONTROL_PREDICATE_TRUE          0xC4
637
638
639 #define ACPI_STATE_COMMON \
640     void                            *Next; \
641     UINT8                           DescriptorType; /* To differentiate various internal objs */\
642     UINT8                           Flags; \
643     UINT16                          Value; \
644     UINT16                          State;
645
646     /* There are 2 bytes available here until the next natural alignment boundary */
647
648 typedef struct acpi_common_state
649 {
650     ACPI_STATE_COMMON
651 } ACPI_COMMON_STATE;
652
653
654 /*
655  * Update state - used to traverse complex objects such as packages
656  */
657 typedef struct acpi_update_state
658 {
659     ACPI_STATE_COMMON
660     union acpi_operand_object       *Object;
661
662 } ACPI_UPDATE_STATE;
663
664
665 /*
666  * Pkg state - used to traverse nested package structures
667  */
668 typedef struct acpi_pkg_state
669 {
670     ACPI_STATE_COMMON
671     UINT16                          Index;
672     union acpi_operand_object       *SourceObject;
673     union acpi_operand_object       *DestObject;
674     struct acpi_walk_state          *WalkState;
675     void                            *ThisTargetObj;
676     UINT32                          NumPackages;
677
678 } ACPI_PKG_STATE;
679
680
681 /*
682  * Control state - one per if/else and while constructs.
683  * Allows nesting of these constructs
684  */
685 typedef struct acpi_control_state
686 {
687     ACPI_STATE_COMMON
688     UINT16                          Opcode;
689     union acpi_parse_object         *PredicateOp;
690     UINT8                           *AmlPredicateStart;     /* Start of if/while predicate */
691     UINT8                           *PackageEnd;            /* End of if/while block */
692     UINT32                          LoopCount;              /* While() loop counter */
693
694 } ACPI_CONTROL_STATE;
695
696
697 /*
698  * Scope state - current scope during namespace lookups
699  */
700 typedef struct acpi_scope_state
701 {
702     ACPI_STATE_COMMON
703     ACPI_NAMESPACE_NODE             *Node;
704
705 } ACPI_SCOPE_STATE;
706
707
708 typedef struct acpi_pscope_state
709 {
710     ACPI_STATE_COMMON
711     UINT32                          ArgCount;               /* Number of fixed arguments */
712     union acpi_parse_object         *Op;                    /* Current op being parsed */
713     UINT8                           *ArgEnd;                /* Current argument end */
714     UINT8                           *PkgEnd;                /* Current package end */
715     UINT32                          ArgList;                /* Next argument to parse */
716
717 } ACPI_PSCOPE_STATE;
718
719
720 /*
721  * Thread state - one per thread across multiple walk states. Multiple walk
722  * states are created when there are nested control methods executing.
723  */
724 typedef struct acpi_thread_state
725 {
726     ACPI_STATE_COMMON
727     UINT8                           CurrentSyncLevel;       /* Mutex Sync (nested acquire) level */
728     struct acpi_walk_state          *WalkStateList;         /* Head of list of WalkStates for this thread */
729     union acpi_operand_object       *AcquiredMutexList;     /* List of all currently acquired mutexes */
730     ACPI_THREAD_ID                  ThreadId;               /* Running thread ID */
731
732 } ACPI_THREAD_STATE;
733
734
735 /*
736  * Result values - used to accumulate the results of nested
737  * AML arguments
738  */
739 typedef struct acpi_result_values
740 {
741     ACPI_STATE_COMMON
742     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
743
744 } ACPI_RESULT_VALUES;
745
746
747 typedef
748 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
749     struct acpi_walk_state          *WalkState,
750     union acpi_parse_object         **OutOp);
751
752 typedef
753 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
754     struct acpi_walk_state          *WalkState);
755
756
757 /* Global handlers for AML Notifies */
758
759 typedef struct acpi_global_notify_handler
760 {
761     ACPI_NOTIFY_HANDLER             Handler;
762     void                            *Context;
763
764 } ACPI_GLOBAL_NOTIFY_HANDLER;
765
766 /*
767  * Notify info - used to pass info to the deferred notify
768  * handler/dispatcher.
769  */
770 typedef struct acpi_notify_info
771 {
772     ACPI_STATE_COMMON
773     UINT8                           HandlerListId;
774     ACPI_NAMESPACE_NODE             *Node;
775     union acpi_operand_object       *HandlerListHead;
776     ACPI_GLOBAL_NOTIFY_HANDLER      *Global;
777
778 } ACPI_NOTIFY_INFO;
779
780
781 /* Generic state is union of structs above */
782
783 typedef union acpi_generic_state
784 {
785     ACPI_COMMON_STATE               Common;
786     ACPI_CONTROL_STATE              Control;
787     ACPI_UPDATE_STATE               Update;
788     ACPI_SCOPE_STATE                Scope;
789     ACPI_PSCOPE_STATE               ParseScope;
790     ACPI_PKG_STATE                  Pkg;
791     ACPI_THREAD_STATE               Thread;
792     ACPI_RESULT_VALUES              Results;
793     ACPI_NOTIFY_INFO                Notify;
794
795 } ACPI_GENERIC_STATE;
796
797
798 /*****************************************************************************
799  *
800  * Interpreter typedefs and structs
801  *
802  ****************************************************************************/
803
804 typedef
805 ACPI_STATUS (*ACPI_EXECUTE_OP) (
806     struct acpi_walk_state          *WalkState);
807
808 /* Address Range info block */
809
810 typedef struct acpi_address_range
811 {
812     struct acpi_address_range   *Next;
813     ACPI_NAMESPACE_NODE         *RegionNode;
814     ACPI_PHYSICAL_ADDRESS       StartAddress;
815     ACPI_PHYSICAL_ADDRESS       EndAddress;
816
817 } ACPI_ADDRESS_RANGE;
818
819
820 /*****************************************************************************
821  *
822  * Parser typedefs and structs
823  *
824  ****************************************************************************/
825
826 /*
827  * AML opcode, name, and argument layout
828  */
829 typedef struct acpi_opcode_info
830 {
831 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
832     char                            *Name;          /* Opcode name (disassembler/debug only) */
833 #endif
834     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
835     UINT32                          RuntimeArgs;    /* Interpret time arguments */
836     UINT16                          Flags;          /* Misc flags */
837     UINT8                           ObjectType;     /* Corresponding internal object type */
838     UINT8                           Class;          /* Opcode class */
839     UINT8                           Type;           /* Opcode type */
840
841 } ACPI_OPCODE_INFO;
842
843 /* Structure for Resource Tag information */
844
845 typedef struct acpi_tag_info
846 {
847     UINT32                          BitOffset;
848     UINT32                          BitLength;
849
850 } ACPI_TAG_INFO;
851
852 /* Value associated with the parse object */
853
854 typedef union acpi_parse_value
855 {
856     UINT64                          Integer;        /* Integer constant (Up to 64 bits) */
857     UINT32                          Size;           /* bytelist or field size */
858     char                            *String;        /* NULL terminated string */
859     UINT8                           *Buffer;        /* buffer or string */
860     char                            *Name;          /* NULL terminated string */
861     union acpi_parse_object         *Arg;           /* arguments and contained ops */
862     ACPI_TAG_INFO                   Tag;            /* Resource descriptor tag info  */
863
864 } ACPI_PARSE_VALUE;
865
866
867 #ifdef ACPI_DISASSEMBLER
868 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
869 #else
870 #define ACPI_DISASM_ONLY_MEMBERS(a)
871 #endif
872
873 #define ACPI_PARSE_COMMON \
874     union acpi_parse_object         *Parent;        /* Parent op */\
875     UINT8                           DescriptorType; /* To differentiate various internal objs */\
876     UINT8                           Flags;          /* Type of Op */\
877     UINT16                          AmlOpcode;      /* AML opcode */\
878     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
879     union acpi_parse_object         *Next;          /* Next op */\
880     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
881     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
882     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
883     ACPI_DISASM_ONLY_MEMBERS (\
884     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
885     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
886     char                            *OperatorSymbol;/* Used for C-style operator name strings */\
887     char                            AmlOpName[16])  /* Op name (debug only) */
888
889
890 /* Flags for DisasmFlags field  above */
891
892 #define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */
893 #define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */
894 #define ACPI_DASM_STRING                0x02        /* Buffer is a ASCII string */
895 #define ACPI_DASM_UNICODE               0x03        /* Buffer is a Unicode string */
896 #define ACPI_DASM_PLD_METHOD            0x04        /* Buffer is a _PLD method bit-packed buffer */
897 #define ACPI_DASM_UUID                  0x05        /* Buffer is a UUID/GUID */
898 #define ACPI_DASM_EISAID                0x06        /* Integer is an EISAID */
899 #define ACPI_DASM_MATCHOP               0x07        /* Parent opcode is a Match() operator */
900 #define ACPI_DASM_LNOT_PREFIX           0x08        /* Start of a LNotEqual (etc.) pair of opcodes */
901 #define ACPI_DASM_LNOT_SUFFIX           0x09        /* End  of a LNotEqual (etc.) pair of opcodes */
902 #define ACPI_DASM_HID_STRING            0x0A        /* String is a _HID or _CID */
903 #define ACPI_DASM_IGNORE                0x0B        /* Not used at this time */
904
905 /*
906  * Generic operation (for example:  If, While, Store)
907  */
908 typedef struct acpi_parse_obj_common
909 {
910     ACPI_PARSE_COMMON
911 } ACPI_PARSE_OBJ_COMMON;
912
913
914 /*
915  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
916  * and bytelists.
917  */
918 typedef struct acpi_parse_obj_named
919 {
920     ACPI_PARSE_COMMON
921     UINT8                           *Path;
922     UINT8                           *Data;          /* AML body or bytelist data */
923     UINT32                          Length;         /* AML length */
924     UINT32                          Name;           /* 4-byte name or zero if no name */
925
926 } ACPI_PARSE_OBJ_NAMED;
927
928
929 /* This version is used by the iASL compiler only */
930
931 #define ACPI_MAX_PARSEOP_NAME   20
932
933 typedef struct acpi_parse_obj_asl
934 {
935     ACPI_PARSE_COMMON
936     union acpi_parse_object         *Child;
937     union acpi_parse_object         *ParentMethod;
938     char                            *Filename;
939     char                            *ExternalName;
940     char                            *Namepath;
941     char                            NameSeg[4];
942     UINT32                          ExtraValue;
943     UINT32                          Column;
944     UINT32                          LineNumber;
945     UINT32                          LogicalLineNumber;
946     UINT32                          LogicalByteOffset;
947     UINT32                          EndLine;
948     UINT32                          EndLogicalLine;
949     UINT32                          AcpiBtype;
950     UINT32                          AmlLength;
951     UINT32                          AmlSubtreeLength;
952     UINT32                          FinalAmlLength;
953     UINT32                          FinalAmlOffset;
954     UINT32                          CompileFlags;
955     UINT16                          ParseOpcode;
956     UINT8                           AmlOpcodeLength;
957     UINT8                           AmlPkgLenBytes;
958     UINT8                           Extra;
959     char                            ParseOpName[ACPI_MAX_PARSEOP_NAME];
960
961 } ACPI_PARSE_OBJ_ASL;
962
963 typedef union acpi_parse_object
964 {
965     ACPI_PARSE_OBJ_COMMON           Common;
966     ACPI_PARSE_OBJ_NAMED            Named;
967     ACPI_PARSE_OBJ_ASL              Asl;
968
969 } ACPI_PARSE_OBJECT;
970
971
972 /*
973  * Parse state - one state per parser invocation and each control
974  * method.
975  */
976 typedef struct acpi_parse_state
977 {
978     UINT8                           *AmlStart;      /* First AML byte */
979     UINT8                           *Aml;           /* Next AML byte */
980     UINT8                           *AmlEnd;        /* (last + 1) AML byte */
981     UINT8                           *PkgStart;      /* Current package begin */
982     UINT8                           *PkgEnd;        /* Current package end */
983     union acpi_parse_object         *StartOp;       /* Root of parse tree */
984     struct acpi_namespace_node      *StartNode;
985     union acpi_generic_state        *Scope;         /* Current scope */
986     union acpi_parse_object         *StartScope;
987     UINT32                          AmlSize;
988
989 } ACPI_PARSE_STATE;
990
991
992 /* Parse object flags */
993
994 #define ACPI_PARSEOP_GENERIC            0x01
995 #define ACPI_PARSEOP_NAMED              0x02
996 #define ACPI_PARSEOP_DEFERRED           0x04
997 #define ACPI_PARSEOP_BYTELIST           0x08
998 #define ACPI_PARSEOP_IN_STACK           0x10
999 #define ACPI_PARSEOP_TARGET             0x20
1000 #define ACPI_PARSEOP_IN_CACHE           0x80
1001
1002 /* Parse object DisasmFlags */
1003
1004 #define ACPI_PARSEOP_IGNORE             0x01
1005 #define ACPI_PARSEOP_PARAMLIST          0x02
1006 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
1007 #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
1008 #define ACPI_PARSEOP_SPECIAL            0x10
1009 #define ACPI_PARSEOP_COMPOUND           0x20
1010 #define ACPI_PARSEOP_ASSIGNMENT         0x40
1011
1012
1013 /*****************************************************************************
1014  *
1015  * Hardware (ACPI registers) and PNP
1016  *
1017  ****************************************************************************/
1018
1019 typedef struct acpi_bit_register_info
1020 {
1021     UINT8                           ParentRegister;
1022     UINT8                           BitPosition;
1023     UINT16                          AccessBitMask;
1024
1025 } ACPI_BIT_REGISTER_INFO;
1026
1027
1028 /*
1029  * Some ACPI registers have bits that must be ignored -- meaning that they
1030  * must be preserved.
1031  */
1032 #define ACPI_PM1_STATUS_PRESERVED_BITS          0x0800  /* Bit 11 */
1033
1034 /* Write-only bits must be zeroed by software */
1035
1036 #define ACPI_PM1_CONTROL_WRITEONLY_BITS         0x2004  /* Bits 13, 2 */
1037
1038 /* For control registers, both ignored and reserved bits must be preserved */
1039
1040 /*
1041  * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the
1042  * ACPI specification to be a "preserved" bit - "OSPM always preserves this
1043  * bit position", section 4.7.3.2.1. However, on some machines the OS must
1044  * write a one to this bit after resume for the machine to work properly.
1045  * To enable this, we no longer attempt to preserve this bit. No machines
1046  * are known to fail if the bit is not preserved. (May 2009)
1047  */
1048 #define ACPI_PM1_CONTROL_IGNORED_BITS           0x0200  /* Bit 9 */
1049 #define ACPI_PM1_CONTROL_RESERVED_BITS          0xC1F8  /* Bits 14-15, 3-8 */
1050 #define ACPI_PM1_CONTROL_PRESERVED_BITS \
1051          (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)
1052
1053 #define ACPI_PM2_CONTROL_PRESERVED_BITS         0xFFFFFFFE /* All except bit 0 */
1054
1055 /*
1056  * Register IDs
1057  * These are the full ACPI registers
1058  */
1059 #define ACPI_REGISTER_PM1_STATUS                0x01
1060 #define ACPI_REGISTER_PM1_ENABLE                0x02
1061 #define ACPI_REGISTER_PM1_CONTROL               0x03
1062 #define ACPI_REGISTER_PM2_CONTROL               0x04
1063 #define ACPI_REGISTER_PM_TIMER                  0x05
1064 #define ACPI_REGISTER_PROCESSOR_BLOCK           0x06
1065 #define ACPI_REGISTER_SMI_COMMAND_BLOCK         0x07
1066
1067
1068 /* Masks used to access the BitRegisters */
1069
1070 #define ACPI_BITMASK_TIMER_STATUS               0x0001
1071 #define ACPI_BITMASK_BUS_MASTER_STATUS          0x0010
1072 #define ACPI_BITMASK_GLOBAL_LOCK_STATUS         0x0020
1073 #define ACPI_BITMASK_POWER_BUTTON_STATUS        0x0100
1074 #define ACPI_BITMASK_SLEEP_BUTTON_STATUS        0x0200
1075 #define ACPI_BITMASK_RT_CLOCK_STATUS            0x0400
1076 #define ACPI_BITMASK_PCIEXP_WAKE_STATUS         0x4000    /* ACPI 3.0 */
1077 #define ACPI_BITMASK_WAKE_STATUS                0x8000
1078
1079 #define ACPI_BITMASK_ALL_FIXED_STATUS           (\
1080     ACPI_BITMASK_TIMER_STATUS          | \
1081     ACPI_BITMASK_BUS_MASTER_STATUS     | \
1082     ACPI_BITMASK_GLOBAL_LOCK_STATUS    | \
1083     ACPI_BITMASK_POWER_BUTTON_STATUS   | \
1084     ACPI_BITMASK_SLEEP_BUTTON_STATUS   | \
1085     ACPI_BITMASK_RT_CLOCK_STATUS       | \
1086     ACPI_BITMASK_PCIEXP_WAKE_STATUS    | \
1087     ACPI_BITMASK_WAKE_STATUS)
1088
1089 #define ACPI_BITMASK_TIMER_ENABLE               0x0001
1090 #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE         0x0020
1091 #define ACPI_BITMASK_POWER_BUTTON_ENABLE        0x0100
1092 #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE        0x0200
1093 #define ACPI_BITMASK_RT_CLOCK_ENABLE            0x0400
1094 #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE        0x4000    /* ACPI 3.0 */
1095
1096 #define ACPI_BITMASK_SCI_ENABLE                 0x0001
1097 #define ACPI_BITMASK_BUS_MASTER_RLD             0x0002
1098 #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE        0x0004
1099 #define ACPI_BITMASK_SLEEP_TYPE                 0x1C00
1100 #define ACPI_BITMASK_SLEEP_ENABLE               0x2000
1101
1102 #define ACPI_BITMASK_ARB_DISABLE                0x0001
1103
1104
1105 /* Raw bit position of each BitRegister */
1106
1107 #define ACPI_BITPOSITION_TIMER_STATUS           0x00
1108 #define ACPI_BITPOSITION_BUS_MASTER_STATUS      0x04
1109 #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS     0x05
1110 #define ACPI_BITPOSITION_POWER_BUTTON_STATUS    0x08
1111 #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS    0x09
1112 #define ACPI_BITPOSITION_RT_CLOCK_STATUS        0x0A
1113 #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS     0x0E    /* ACPI 3.0 */
1114 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
1115
1116 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
1117 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
1118 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
1119 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
1120 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
1121 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
1122
1123 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
1124 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
1125 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
1126 #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
1127 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
1128
1129 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
1130
1131
1132 /* Structs and definitions for _OSI support and I/O port validation */
1133
1134 #define ACPI_ALWAYS_ILLEGAL             0x00
1135
1136 typedef struct acpi_interface_info
1137 {
1138     char                        *Name;
1139     struct acpi_interface_info  *Next;
1140     UINT8                       Flags;
1141     UINT8                       Value;
1142
1143 } ACPI_INTERFACE_INFO;
1144
1145 #define ACPI_OSI_INVALID                0x01
1146 #define ACPI_OSI_DYNAMIC                0x02
1147 #define ACPI_OSI_FEATURE                0x04
1148 #define ACPI_OSI_DEFAULT_INVALID        0x08
1149 #define ACPI_OSI_OPTIONAL_FEATURE       (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
1150
1151 typedef struct acpi_port_info
1152 {
1153     char                    *Name;
1154     UINT16                  Start;
1155     UINT16                  End;
1156     UINT8                   OsiDependency;
1157
1158 } ACPI_PORT_INFO;
1159
1160
1161 /*****************************************************************************
1162  *
1163  * Resource descriptors
1164  *
1165  ****************************************************************************/
1166
1167 /* ResourceType values */
1168
1169 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0
1170 #define ACPI_ADDRESS_TYPE_IO_RANGE              1
1171 #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE      2
1172
1173 /* Resource descriptor types and masks */
1174
1175 #define ACPI_RESOURCE_NAME_LARGE                0x80
1176 #define ACPI_RESOURCE_NAME_SMALL                0x00
1177
1178 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1179 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1180 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
1181
1182
1183 /*
1184  * Small resource descriptor "names" as defined by the ACPI specification.
1185  * Note: Bits 2:0 are used for the descriptor length
1186  */
1187 #define ACPI_RESOURCE_NAME_IRQ                  0x20
1188 #define ACPI_RESOURCE_NAME_DMA                  0x28
1189 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1190 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1191 #define ACPI_RESOURCE_NAME_IO                   0x40
1192 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1193 #define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
1194 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1195 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1196 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1197 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1198 #define ACPI_RESOURCE_NAME_END_TAG              0x78
1199
1200 /*
1201  * Large resource descriptor "names" as defined by the ACPI specification.
1202  * Note: includes the Large Descriptor bit in bit[7]
1203  */
1204 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1205 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1206 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1207 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1208 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1209 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1210 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1211 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1212 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1213 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1214 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1215 #define ACPI_RESOURCE_NAME_GPIO                 0x8C
1216 #define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
1217 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
1218
1219
1220 /*****************************************************************************
1221  *
1222  * Miscellaneous
1223  *
1224  ****************************************************************************/
1225
1226 #define ACPI_ASCII_ZERO                 0x30
1227
1228
1229 /*****************************************************************************
1230  *
1231  * Disassembler
1232  *
1233  ****************************************************************************/
1234
1235 typedef struct acpi_external_list
1236 {
1237     char                        *Path;
1238     char                        *InternalPath;
1239     struct acpi_external_list   *Next;
1240     UINT32                      Value;
1241     UINT16                      Length;
1242     UINT16                      Flags;
1243     UINT8                       Type;
1244
1245 } ACPI_EXTERNAL_LIST;
1246
1247 /* Values for Flags field above */
1248
1249 #define ACPI_EXT_RESOLVED_REFERENCE         0x01    /* Object was resolved during cross ref */
1250 #define ACPI_EXT_ORIGIN_FROM_FILE           0x02    /* External came from a file */
1251 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04    /* Deallocate internal path on completion */
1252 #define ACPI_EXT_EXTERNAL_EMITTED           0x08    /* External() statement has been emitted */
1253
1254
1255 typedef struct acpi_external_file
1256 {
1257     char                        *Path;
1258     struct acpi_external_file   *Next;
1259
1260 } ACPI_EXTERNAL_FILE;
1261
1262
1263 /*****************************************************************************
1264  *
1265  * Debugger
1266  *
1267  ****************************************************************************/
1268
1269 typedef struct acpi_db_method_info
1270 {
1271     ACPI_HANDLE                     Method;
1272     ACPI_HANDLE                     MainThreadGate;
1273     ACPI_HANDLE                     ThreadCompleteGate;
1274     ACPI_HANDLE                     InfoGate;
1275     ACPI_THREAD_ID                  *Threads;
1276     UINT32                          NumThreads;
1277     UINT32                          NumCreated;
1278     UINT32                          NumCompleted;
1279
1280     char                            *Name;
1281     UINT32                          Flags;
1282     UINT32                          NumLoops;
1283     char                            Pathname[ACPI_DB_LINE_BUFFER_SIZE];
1284     char                            **Args;
1285     ACPI_OBJECT_TYPE                *Types;
1286
1287     /*
1288      * Arguments to be passed to method for the command
1289      * Threads -
1290      *   the Number of threads, ID of current thread and
1291      *   Index of current thread inside all them created.
1292      */
1293     char                            InitArgs;
1294     ACPI_OBJECT_TYPE                ArgTypes[4];
1295     char                            *Arguments[4];
1296     char                            NumThreadsStr[11];
1297     char                            IdOfThreadStr[11];
1298     char                            IndexOfThreadStr[11];
1299
1300 } ACPI_DB_METHOD_INFO;
1301
1302 typedef struct acpi_integrity_info
1303 {
1304     UINT32                          Nodes;
1305     UINT32                          Objects;
1306
1307 } ACPI_INTEGRITY_INFO;
1308
1309
1310 #define ACPI_DB_DISABLE_OUTPUT          0x00
1311 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1312 #define ACPI_DB_CONSOLE_OUTPUT          0x02
1313 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1314
1315
1316 /*****************************************************************************
1317  *
1318  * Debug
1319  *
1320  ****************************************************************************/
1321
1322 /* Entry for a memory allocation (debug only) */
1323
1324 #define ACPI_MEM_MALLOC                 0
1325 #define ACPI_MEM_CALLOC                 1
1326 #define ACPI_MAX_MODULE_NAME            16
1327
1328 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1329     struct acpi_debug_mem_block     *Previous; \
1330     struct acpi_debug_mem_block     *Next; \
1331     UINT32                          Size; \
1332     UINT32                          Component; \
1333     UINT32                          Line; \
1334     char                            Module[ACPI_MAX_MODULE_NAME]; \
1335     UINT8                           AllocType;
1336
1337 typedef struct acpi_debug_mem_header
1338 {
1339     ACPI_COMMON_DEBUG_MEM_HEADER
1340
1341 } ACPI_DEBUG_MEM_HEADER;
1342
1343 typedef struct acpi_debug_mem_block
1344 {
1345     ACPI_COMMON_DEBUG_MEM_HEADER
1346     UINT64                          UserSpace;
1347
1348 } ACPI_DEBUG_MEM_BLOCK;
1349
1350
1351 #define ACPI_MEM_LIST_GLOBAL            0
1352 #define ACPI_MEM_LIST_NSNODE            1
1353 #define ACPI_MEM_LIST_MAX               1
1354 #define ACPI_NUM_MEM_LISTS              2
1355
1356
1357 /*****************************************************************************
1358  *
1359  * Info/help support
1360  *
1361  ****************************************************************************/
1362
1363 typedef struct ah_predefined_name
1364 {
1365     char            *Name;
1366     char            *Description;
1367 #ifndef ACPI_ASL_COMPILER
1368     char            *Action;
1369 #endif
1370
1371 } AH_PREDEFINED_NAME;
1372
1373 typedef struct ah_device_id
1374 {
1375     char            *Name;
1376     char            *Description;
1377
1378 } AH_DEVICE_ID;
1379
1380 typedef struct ah_uuid
1381 {
1382     char            *Description;
1383     char            *String;
1384
1385 } AH_UUID;
1386
1387 typedef struct ah_table
1388 {
1389     char                    *Signature;
1390     char                    *Description;
1391
1392 } AH_TABLE;
1393
1394 #endif /* __ACLOCAL_H__ */