Debian Codegraph @

source/include/aclocal.h

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