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