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