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