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