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