Print this page
update to acpica-unix2-20140114
update to acpica-unix2-20131218
update to acpica-unix2-20130927
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, 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.


  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                 0x7F
  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  *


 196     UINT32                          Value;
 197     UINT32                          Length;
 198 #endif
 199 
 200 } ACPI_NAMESPACE_NODE;
 201 
 202 
 203 /* Namespace Node flags */
 204 
 205 #define ANOBJ_RESERVED                  0x01    /* Available for use */
 206 #define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
 207 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
 208 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
 209 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
 210 #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
 211 #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
 212 
 213 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
 214 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
 215 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */
 216 #define ANOBJ_IS_BIT_OFFSET             0x40    /* iASL only: Reference is a bit offset */
 217 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
 218 
 219 
 220 /* Internal ACPI table management - master table list */
 221 
 222 typedef struct acpi_table_list
 223 {
 224     ACPI_TABLE_DESC                 *Tables;            /* Table descriptor array */
 225     UINT32                          CurrentTableCount;  /* Tables currently in the array */
 226     UINT32                          MaxTableCount;      /* Max tables array will hold */
 227     UINT8                           Flags;
 228 
 229 } ACPI_TABLE_LIST;
 230 
 231 /* Flags for above */
 232 
 233 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
 234 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
 235 #define ACPI_ROOT_ALLOW_RESIZE          (2)
 236 


 269 {
 270     const char                      *ExternalName;
 271     const char                      *NextExternalChar;
 272     char                            *InternalName;
 273     UINT32                          Length;
 274     UINT32                          NumSegments;
 275     UINT32                          NumCarats;
 276     BOOLEAN                         FullyQualified;
 277 
 278 } ACPI_NAMESTRING_INFO;
 279 
 280 
 281 /* Field creation info */
 282 
 283 typedef struct acpi_create_field_info
 284 {
 285     ACPI_NAMESPACE_NODE             *RegionNode;
 286     ACPI_NAMESPACE_NODE             *FieldNode;
 287     ACPI_NAMESPACE_NODE             *RegisterNode;
 288     ACPI_NAMESPACE_NODE             *DataRegisterNode;


 289     UINT32                          BankValue;
 290     UINT32                          FieldBitPosition;
 291     UINT32                          FieldBitLength;

 292     UINT8                           FieldFlags;
 293     UINT8                           Attribute;
 294     UINT8                           FieldType;

 295 
 296 } ACPI_CREATE_FIELD_INFO;
 297 
 298 
 299 typedef
 300 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
 301     struct acpi_walk_state          *WalkState);
 302 
 303 
 304 /*
 305  * Bitmapped ACPI types.  Used internally only
 306  */
 307 #define ACPI_BTYPE_ANY                  0x00000000
 308 #define ACPI_BTYPE_INTEGER              0x00000001
 309 #define ACPI_BTYPE_STRING               0x00000002
 310 #define ACPI_BTYPE_BUFFER               0x00000004
 311 #define ACPI_BTYPE_PACKAGE              0x00000008
 312 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
 313 #define ACPI_BTYPE_DEVICE               0x00000020
 314 #define ACPI_BTYPE_EVENT                0x00000040
 315 #define ACPI_BTYPE_METHOD               0x00000080
 316 #define ACPI_BTYPE_MUTEX                0x00000100
 317 #define ACPI_BTYPE_REGION               0x00000200
 318 #define ACPI_BTYPE_POWER                0x00000400
 319 #define ACPI_BTYPE_PROCESSOR            0x00000800
 320 #define ACPI_BTYPE_THERMAL              0x00001000
 321 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
 322 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
 323 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
 324 #define ACPI_BTYPE_REFERENCE            0x00010000
 325 #define ACPI_BTYPE_RESOURCE             0x00020000
 326 
 327 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
 328 
 329 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
 330 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
 331 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
 332 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
 333 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
 334 

 335 
 336 /*
 337  * Information structure for ACPI predefined names.
 338  * Each entry in the table contains the following items:
 339  *
 340  * Name                 - The ACPI reserved name
 341  * ParamCount           - Number of arguments to the method
 342  * ExpectedReturnBtypes - Allowed type(s) for the return value
 343  */
 344 typedef struct acpi_name_info
 345 {
 346     char                        Name[ACPI_NAME_SIZE];
 347     UINT8                       ParamCount;
 348     UINT8                       ExpectedBtypes;
 349 
 350 } ACPI_NAME_INFO;
 351 
 352 /*
 353  * Secondary information structures for ACPI predefined objects that return
 354  * package objects. This structure appears as the next entry in the table
 355  * after the NAME_INFO structure above.
 356  *
 357  * The reason for this is to minimize the size of the predefined name table.
 358  */
 359 
 360 /*
 361  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
 362  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT

 363  */
 364 typedef struct acpi_package_info
 365 {
 366     UINT8                       Type;
 367     UINT8                       ObjectType1;
 368     UINT8                       Count1;
 369     UINT8                       ObjectType2;
 370     UINT8                       Count2;
 371     UINT8                       Reserved;
 372 
 373 } ACPI_PACKAGE_INFO;
 374 
 375 /* Used for ACPI_PTYPE2_FIXED */
 376 
 377 typedef struct acpi_package_info2
 378 {
 379     UINT8                       Type;
 380     UINT8                       Count;
 381     UINT8                       ObjectType[4];

 382 
 383 } ACPI_PACKAGE_INFO2;
 384 
 385 /* Used for ACPI_PTYPE1_OPTION */
 386 
 387 typedef struct acpi_package_info3
 388 {
 389     UINT8                       Type;
 390     UINT8                       Count;
 391     UINT8                       ObjectType[2];
 392     UINT8                       TailObjectType;
 393     UINT8                       Reserved;
 394 
 395 } ACPI_PACKAGE_INFO3;
 396 
 397 typedef union acpi_predefined_info
 398 {
 399     ACPI_NAME_INFO              Info;
 400     ACPI_PACKAGE_INFO           RetInfo;
 401     ACPI_PACKAGE_INFO2          RetInfo2;
 402     ACPI_PACKAGE_INFO3          RetInfo3;
 403 
 404 } ACPI_PREDEFINED_INFO;
 405 

 406 
 407 /* Data block used during object validation */
 408 
 409 typedef struct acpi_predefined_data
 410 {
 411     char                        *Pathname;
 412     const ACPI_PREDEFINED_INFO  *Predefined;
 413     union acpi_operand_object   *ParentPackage;
 414     UINT32                      Flags;
 415     UINT8                       NodeFlags;
 416 
 417 } ACPI_PREDEFINED_DATA;
 418 
 419 /* Defines for Flags field above */


 420 
 421 #define ACPI_OBJECT_REPAIRED    1





 422 

 423 

 424 /*
 425  * Bitmapped return value types
 426  * Note: the actual data types must be contiguous, a loop in nspredef.c
 427  * depends on this.
 428  */
 429 #define ACPI_RTYPE_ANY                  0x00
 430 #define ACPI_RTYPE_NONE                 0x01
 431 #define ACPI_RTYPE_INTEGER              0x02
 432 #define ACPI_RTYPE_STRING               0x04
 433 #define ACPI_RTYPE_BUFFER               0x08
 434 #define ACPI_RTYPE_PACKAGE              0x10
 435 #define ACPI_RTYPE_REFERENCE            0x20
 436 #define ACPI_RTYPE_ALL                  0x3F
 437 
 438 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
 439 
 440 
 441 /*****************************************************************************
 442  *
 443  * Event typedefs and structs
 444  *
 445  ****************************************************************************/
 446 










 447 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
 448 
 449 typedef struct acpi_gpe_handler_info
 450 {
 451     ACPI_GPE_HANDLER                Address;        /* Address of handler, if any */
 452     void                            *Context;       /* Context to be passed to handler */
 453     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
 454     UINT8                           OriginalFlags;  /* Original (pre-handler) GPE info */
 455     BOOLEAN                         OriginallyEnabled; /* True if GPE was originally enabled */
 456 
 457 } ACPI_GPE_HANDLER_INFO;
 458 









 459 /*
 460  * GPE dispatch info. At any time, the GPE can have at most one type
 461  * of dispatch - Method, Handler, or Implicit Notify.
 462  */
 463 typedef union acpi_gpe_dispatch_info
 464 {
 465     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
 466     struct acpi_gpe_handler_info    *Handler;       /* Installed GPE handler */
 467     ACPI_NAMESPACE_NODE             *DeviceNode;    /* Parent _PRW device for implicit notify */
 468 
 469 } ACPI_GPE_DISPATCH_INFO;
 470 
 471 /*
 472  * Information about a GPE, one per each GPE in an array.
 473  * NOTE: Important to keep this struct as small as possible.
 474  */
 475 typedef struct acpi_gpe_event_info
 476 {
 477     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method or Handler */
 478     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
 479     UINT8                           Flags;          /* Misc info about this GPE */
 480     UINT8                           GpeNumber;      /* This GPE */
 481     UINT8                           RuntimeCount;   /* References to a run GPE */
 482 
 483 } ACPI_GPE_EVENT_INFO;
 484 
 485 /* Information about a GPE register pair, one per each status/enable pair in an array */
 486 
 487 typedef struct acpi_gpe_register_info
 488 {
 489     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
 490     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
 491     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
 492     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
 493     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
 494 
 495 } ACPI_GPE_REGISTER_INFO;
 496 
 497 /*


 693  * AML arguments
 694  */
 695 typedef struct acpi_result_values
 696 {
 697     ACPI_STATE_COMMON
 698     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
 699 
 700 } ACPI_RESULT_VALUES;
 701 
 702 
 703 typedef
 704 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
 705     struct acpi_walk_state          *WalkState,
 706     union acpi_parse_object         **OutOp);
 707 
 708 typedef
 709 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
 710     struct acpi_walk_state          *WalkState);
 711 
 712 









 713 /*
 714  * Notify info - used to pass info to the deferred notify
 715  * handler/dispatcher.
 716  */
 717 typedef struct acpi_notify_info
 718 {
 719     ACPI_STATE_COMMON

 720     ACPI_NAMESPACE_NODE             *Node;
 721     union acpi_operand_object       *HandlerObj;

 722 
 723 } ACPI_NOTIFY_INFO;
 724 
 725 
 726 /* Generic state is union of structs above */
 727 
 728 typedef union acpi_generic_state
 729 {
 730     ACPI_COMMON_STATE               Common;
 731     ACPI_CONTROL_STATE              Control;
 732     ACPI_UPDATE_STATE               Update;
 733     ACPI_SCOPE_STATE                Scope;
 734     ACPI_PSCOPE_STATE               ParseScope;
 735     ACPI_PKG_STATE                  Pkg;
 736     ACPI_THREAD_STATE               Thread;
 737     ACPI_RESULT_VALUES              Results;
 738     ACPI_NOTIFY_INFO                Notify;
 739 
 740 } ACPI_GENERIC_STATE;
 741 
 742 
 743 /*****************************************************************************
 744  *
 745  * Interpreter typedefs and structs
 746  *
 747  ****************************************************************************/
 748 
 749 typedef
 750 ACPI_STATUS (*ACPI_EXECUTE_OP) (
 751     struct acpi_walk_state          *WalkState);
 752 

 753 










 754 /*****************************************************************************
 755  *
 756  * Parser typedefs and structs
 757  *
 758  ****************************************************************************/
 759 
 760 /*
 761  * AML opcode, name, and argument layout
 762  */
 763 typedef struct acpi_opcode_info
 764 {
 765 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
 766     char                            *Name;          /* Opcode name (disassembler/debug only) */
 767 #endif
 768     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
 769     UINT32                          RuntimeArgs;    /* Interpret time arguments */
 770     UINT16                          Flags;          /* Misc flags */
 771     UINT8                           ObjectType;     /* Corresponding internal object type */
 772     UINT8                           Class;          /* Opcode class */
 773     UINT8                           Type;           /* Opcode type */
 774 
 775 } ACPI_OPCODE_INFO;
 776 











 777 typedef union acpi_parse_value
 778 {
 779     UINT64                          Integer;        /* Integer constant (Up to 64 bits) */
 780     UINT32                          Size;           /* bytelist or field size */
 781     char                            *String;        /* NULL terminated string */
 782     UINT8                           *Buffer;        /* buffer or string */
 783     char                            *Name;          /* NULL terminated string */
 784     union acpi_parse_object         *Arg;           /* arguments and contained ops */

 785 
 786 } ACPI_PARSE_VALUE;
 787 
 788 
 789 #ifdef ACPI_DISASSEMBLER
 790 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
 791 #else
 792 #define ACPI_DISASM_ONLY_MEMBERS(a)
 793 #endif
 794 
 795 #define ACPI_PARSE_COMMON \
 796     union acpi_parse_object         *Parent;        /* Parent op */\
 797     UINT8                           DescriptorType; /* To differentiate various internal objs */\
 798     UINT8                           Flags;          /* Type of Op */\
 799     UINT16                          AmlOpcode;      /* AML opcode */\
 800     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
 801     union acpi_parse_object         *Next;          /* Next op */\
 802     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
 803     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
 804     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
 805     ACPI_DISASM_ONLY_MEMBERS (\
 806     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
 807     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
 808     char                            AmlOpName[16])  /* Op name (debug only) */
 809 
 810 
 811 #define ACPI_DASM_BUFFER                0x00
 812 #define ACPI_DASM_RESOURCE              0x01
 813 #define ACPI_DASM_STRING                0x02
 814 #define ACPI_DASM_UNICODE               0x03
 815 #define ACPI_DASM_EISAID                0x04
 816 #define ACPI_DASM_MATCHOP               0x05
 817 #define ACPI_DASM_LNOT_PREFIX           0x06
 818 #define ACPI_DASM_LNOT_SUFFIX           0x07
 819 #define ACPI_DASM_IGNORE                0x08
 820 











 821 /*
 822  * Generic operation (for example:  If, While, Store)
 823  */
 824 typedef struct acpi_parse_obj_common
 825 {
 826     ACPI_PARSE_COMMON
 827 } ACPI_PARSE_OBJ_COMMON;
 828 
 829 
 830 /*
 831  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
 832  * and bytelists.
 833  */
 834 typedef struct acpi_parse_obj_named
 835 {
 836     ACPI_PARSE_COMMON
 837     UINT8                           *Path;
 838     UINT8                           *Data;          /* AML body or bytelist data */
 839     UINT32                          Length;         /* AML length */
 840     UINT32                          Name;           /* 4-byte name or zero if no name */


 903     UINT32                          AmlSize;
 904 
 905 } ACPI_PARSE_STATE;
 906 
 907 
 908 /* Parse object flags */
 909 
 910 #define ACPI_PARSEOP_GENERIC            0x01
 911 #define ACPI_PARSEOP_NAMED              0x02
 912 #define ACPI_PARSEOP_DEFERRED           0x04
 913 #define ACPI_PARSEOP_BYTELIST           0x08
 914 #define ACPI_PARSEOP_IN_STACK           0x10
 915 #define ACPI_PARSEOP_TARGET             0x20
 916 #define ACPI_PARSEOP_IN_CACHE           0x80
 917 
 918 /* Parse object DisasmFlags */
 919 
 920 #define ACPI_PARSEOP_IGNORE             0x01
 921 #define ACPI_PARSEOP_PARAMLIST          0x02
 922 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04

 923 #define ACPI_PARSEOP_SPECIAL            0x10
 924 
 925 
 926 /*****************************************************************************
 927  *
 928  * Hardware (ACPI registers) and PNP
 929  *
 930  ****************************************************************************/
 931 
 932 typedef struct acpi_bit_register_info
 933 {
 934     UINT8                           ParentRegister;
 935     UINT8                           BitPosition;
 936     UINT16                          AccessBitMask;
 937 
 938 } ACPI_BIT_REGISTER_INFO;
 939 
 940 
 941 /*
 942  * Some ACPI registers have bits that must be ignored -- meaning that they


1027 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
1028 
1029 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
1030 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
1031 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
1032 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
1033 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
1034 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
1035 
1036 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
1037 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
1038 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
1039 #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
1040 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
1041 
1042 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
1043 
1044 
1045 /* Structs and definitions for _OSI support and I/O port validation */
1046 
1047 #define ACPI_OSI_WIN_2000               0x01
1048 #define ACPI_OSI_WIN_XP                 0x02
1049 #define ACPI_OSI_WIN_XP_SP1             0x03
1050 #define ACPI_OSI_WINSRV_2003            0x04
1051 #define ACPI_OSI_WIN_XP_SP2             0x05
1052 #define ACPI_OSI_WINSRV_2003_SP1        0x06
1053 #define ACPI_OSI_WIN_VISTA              0x07
1054 #define ACPI_OSI_WINSRV_2008            0x08
1055 #define ACPI_OSI_WIN_VISTA_SP1          0x09
1056 #define ACPI_OSI_WIN_VISTA_SP2          0x0A
1057 #define ACPI_OSI_WIN_7                  0x0B
1058 
1059 #define ACPI_ALWAYS_ILLEGAL             0x00
1060 
1061 typedef struct acpi_interface_info
1062 {
1063     char                        *Name;
1064     struct acpi_interface_info  *Next;
1065     UINT8                       Flags;
1066     UINT8                       Value;
1067 
1068 } ACPI_INTERFACE_INFO;
1069 
1070 #define ACPI_OSI_INVALID                0x01
1071 #define ACPI_OSI_DYNAMIC                0x02



1072 
1073 typedef struct acpi_port_info
1074 {
1075     char                    *Name;
1076     UINT16                  Start;
1077     UINT16                  End;
1078     UINT8                   OsiDependency;
1079 
1080 } ACPI_PORT_INFO;
1081 
1082 
1083 /*****************************************************************************
1084  *
1085  * Resource descriptors
1086  *
1087  ****************************************************************************/
1088 
1089 /* ResourceType values */
1090 
1091 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0


1095 /* Resource descriptor types and masks */
1096 
1097 #define ACPI_RESOURCE_NAME_LARGE                0x80
1098 #define ACPI_RESOURCE_NAME_SMALL                0x00
1099 
1100 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1101 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1102 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
1103 
1104 
1105 /*
1106  * Small resource descriptor "names" as defined by the ACPI specification.
1107  * Note: Bits 2:0 are used for the descriptor length
1108  */
1109 #define ACPI_RESOURCE_NAME_IRQ                  0x20
1110 #define ACPI_RESOURCE_NAME_DMA                  0x28
1111 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1112 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1113 #define ACPI_RESOURCE_NAME_IO                   0x40
1114 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1115 #define ACPI_RESOURCE_NAME_RESERVED_S1          0x50
1116 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1117 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1118 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1119 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1120 #define ACPI_RESOURCE_NAME_END_TAG              0x78
1121 
1122 /*
1123  * Large resource descriptor "names" as defined by the ACPI specification.
1124  * Note: includes the Large Descriptor bit in bit[7]
1125  */
1126 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1127 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1128 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1129 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1130 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1131 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1132 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1133 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1134 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1135 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1136 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1137 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8B


1138 
1139 
1140 /*****************************************************************************
1141  *
1142  * Miscellaneous
1143  *
1144  ****************************************************************************/
1145 
1146 #define ACPI_ASCII_ZERO                 0x30
1147 
1148 
1149 /*****************************************************************************
1150  *
1151  * Disassembler
1152  *
1153  ****************************************************************************/
1154 
1155 typedef struct acpi_external_list
1156 {
1157     char                        *Path;
1158     char                        *InternalPath;
1159     struct acpi_external_list   *Next;
1160     UINT32                      Value;
1161     UINT16                      Length;

1162     UINT8                       Type;
1163     UINT8                       Flags;
1164 
1165 } ACPI_EXTERNAL_LIST;
1166 
1167 /* Values for Flags field above */
1168 
1169 #define ACPI_IPATH_ALLOCATED    0x01



1170 
1171 
1172 typedef struct acpi_external_file
1173 {
1174     char                        *Path;
1175     struct acpi_external_file   *Next;
1176 
1177 } ACPI_EXTERNAL_FILE;
1178 
1179 
1180 /*****************************************************************************
1181  *
1182  * Debugger
1183  *
1184  ****************************************************************************/
1185 
1186 typedef struct acpi_db_method_info
1187 {

1188     ACPI_HANDLE                     MainThreadGate;
1189     ACPI_HANDLE                     ThreadCompleteGate;
1190     ACPI_HANDLE                     InfoGate;
1191     ACPI_THREAD_ID                  *Threads;
1192     UINT32                          NumThreads;
1193     UINT32                          NumCreated;
1194     UINT32                          NumCompleted;
1195 
1196     char                            *Name;
1197     UINT32                          Flags;
1198     UINT32                          NumLoops;
1199     char                            Pathname[128];
1200     char                            **Args;
1201     ACPI_OBJECT_TYPE                *Types;
1202 
1203     /*
1204      * Arguments to be passed to method for the command
1205      * Threads -
1206      *   the Number of threads, ID of current thread and
1207      *   Index of current thread inside all them created.
1208      */
1209     char                            InitArgs;
1210     ACPI_OBJECT_TYPE                ArgTypes[4];
1211     char                            *Arguments[4];
1212     char                            NumThreadsStr[11];
1213     char                            IdOfThreadStr[11];
1214     char                            IndexOfThreadStr[11];
1215 
1216 } ACPI_DB_METHOD_INFO;
1217 
1218 typedef struct acpi_integrity_info
1219 {
1220     UINT32                          Nodes;
1221     UINT32                          Objects;
1222 
1223 } ACPI_INTEGRITY_INFO;
1224 
1225 

1226 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1227 #define ACPI_DB_CONSOLE_OUTPUT          0x02
1228 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1229 
1230 
1231 /*****************************************************************************
1232  *
1233  * Debug
1234  *
1235  ****************************************************************************/
1236 
1237 /* Entry for a memory allocation (debug only) */
1238 
1239 #define ACPI_MEM_MALLOC                 0
1240 #define ACPI_MEM_CALLOC                 1
1241 #define ACPI_MAX_MODULE_NAME            16
1242 
1243 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1244     struct acpi_debug_mem_block     *Previous; \
1245     struct acpi_debug_mem_block     *Next; \


1252 typedef struct acpi_debug_mem_header
1253 {
1254     ACPI_COMMON_DEBUG_MEM_HEADER
1255 
1256 } ACPI_DEBUG_MEM_HEADER;
1257 
1258 typedef struct acpi_debug_mem_block
1259 {
1260     ACPI_COMMON_DEBUG_MEM_HEADER
1261     UINT64                          UserSpace;
1262 
1263 } ACPI_DEBUG_MEM_BLOCK;
1264 
1265 
1266 #define ACPI_MEM_LIST_GLOBAL            0
1267 #define ACPI_MEM_LIST_NSNODE            1
1268 #define ACPI_MEM_LIST_MAX               1
1269 #define ACPI_NUM_MEM_LISTS              2
1270 
1271 
















1272 #endif /* __ACLOCAL_H__ */
   1 /******************************************************************************
   2  *
   3  * Name: aclocal.h - Internal data types used across the ACPI subsystem
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2014, 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.


  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                 0x81
  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  *


 196     UINT32                          Value;
 197     UINT32                          Length;
 198 #endif
 199 
 200 } ACPI_NAMESPACE_NODE;
 201 
 202 
 203 /* Namespace Node flags */
 204 
 205 #define ANOBJ_RESERVED                  0x01    /* Available for use */
 206 #define ANOBJ_TEMPORARY                 0x02    /* Node is create by a method and is temporary */
 207 #define ANOBJ_METHOD_ARG                0x04    /* Node is a method argument */
 208 #define ANOBJ_METHOD_LOCAL              0x08    /* Node is a method local */
 209 #define ANOBJ_SUBTREE_HAS_INI           0x10    /* Used to optimize device initialization */
 210 #define ANOBJ_EVALUATED                 0x20    /* Set on first evaluation of node */
 211 #define ANOBJ_ALLOCATED_BUFFER          0x40    /* Method AML buffer is dynamic (InstallMethod) */
 212 
 213 #define ANOBJ_IS_EXTERNAL               0x08    /* iASL only: This object created via External() */
 214 #define ANOBJ_METHOD_NO_RETVAL          0x10    /* iASL only: Method has no return value */
 215 #define ANOBJ_METHOD_SOME_NO_RETVAL     0x20    /* iASL only: Method has at least one return value */

 216 #define ANOBJ_IS_REFERENCED             0x80    /* iASL only: Object was referenced */
 217 
 218 
 219 /* Internal ACPI table management - master table list */
 220 
 221 typedef struct acpi_table_list
 222 {
 223     ACPI_TABLE_DESC                 *Tables;            /* Table descriptor array */
 224     UINT32                          CurrentTableCount;  /* Tables currently in the array */
 225     UINT32                          MaxTableCount;      /* Max tables array will hold */
 226     UINT8                           Flags;
 227 
 228 } ACPI_TABLE_LIST;
 229 
 230 /* Flags for above */
 231 
 232 #define ACPI_ROOT_ORIGIN_UNKNOWN        (0)     /* ~ORIGIN_ALLOCATED */
 233 #define ACPI_ROOT_ORIGIN_ALLOCATED      (1)
 234 #define ACPI_ROOT_ALLOW_RESIZE          (2)
 235 


 268 {
 269     const char                      *ExternalName;
 270     const char                      *NextExternalChar;
 271     char                            *InternalName;
 272     UINT32                          Length;
 273     UINT32                          NumSegments;
 274     UINT32                          NumCarats;
 275     BOOLEAN                         FullyQualified;
 276 
 277 } ACPI_NAMESTRING_INFO;
 278 
 279 
 280 /* Field creation info */
 281 
 282 typedef struct acpi_create_field_info
 283 {
 284     ACPI_NAMESPACE_NODE             *RegionNode;
 285     ACPI_NAMESPACE_NODE             *FieldNode;
 286     ACPI_NAMESPACE_NODE             *RegisterNode;
 287     ACPI_NAMESPACE_NODE             *DataRegisterNode;
 288     ACPI_NAMESPACE_NODE             *ConnectionNode;
 289     UINT8                           *ResourceBuffer;
 290     UINT32                          BankValue;
 291     UINT32                          FieldBitPosition;
 292     UINT32                          FieldBitLength;
 293     UINT16                          ResourceLength;
 294     UINT8                           FieldFlags;
 295     UINT8                           Attribute;
 296     UINT8                           FieldType;
 297     UINT8                           AccessLength;
 298 
 299 } ACPI_CREATE_FIELD_INFO;
 300 
 301 
 302 typedef
 303 ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
 304     struct acpi_walk_state          *WalkState);
 305 
 306 
 307 /*
 308  * Bitmapped ACPI types. Used internally only
 309  */
 310 #define ACPI_BTYPE_ANY                  0x00000000
 311 #define ACPI_BTYPE_INTEGER              0x00000001
 312 #define ACPI_BTYPE_STRING               0x00000002
 313 #define ACPI_BTYPE_BUFFER               0x00000004
 314 #define ACPI_BTYPE_PACKAGE              0x00000008
 315 #define ACPI_BTYPE_FIELD_UNIT           0x00000010
 316 #define ACPI_BTYPE_DEVICE               0x00000020
 317 #define ACPI_BTYPE_EVENT                0x00000040
 318 #define ACPI_BTYPE_METHOD               0x00000080
 319 #define ACPI_BTYPE_MUTEX                0x00000100
 320 #define ACPI_BTYPE_REGION               0x00000200
 321 #define ACPI_BTYPE_POWER                0x00000400
 322 #define ACPI_BTYPE_PROCESSOR            0x00000800
 323 #define ACPI_BTYPE_THERMAL              0x00001000
 324 #define ACPI_BTYPE_BUFFER_FIELD         0x00002000
 325 #define ACPI_BTYPE_DDB_HANDLE           0x00004000
 326 #define ACPI_BTYPE_DEBUG_OBJECT         0x00008000
 327 #define ACPI_BTYPE_REFERENCE            0x00010000
 328 #define ACPI_BTYPE_RESOURCE             0x00020000
 329 
 330 #define ACPI_BTYPE_COMPUTE_DATA         (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
 331 
 332 #define ACPI_BTYPE_DATA                 (ACPI_BTYPE_COMPUTE_DATA  | ACPI_BTYPE_PACKAGE)
 333 #define ACPI_BTYPE_DATA_REFERENCE       (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
 334 #define ACPI_BTYPE_DEVICE_OBJECTS       (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
 335 #define ACPI_BTYPE_OBJECTS_AND_REFS     0x0001FFFF  /* ARG or LOCAL */
 336 #define ACPI_BTYPE_ALL_OBJECTS          0x0000FFFF
 337 
 338 #pragma pack(1)
 339 
 340 /*
 341  * Information structure for ACPI predefined names.
 342  * Each entry in the table contains the following items:
 343  *
 344  * Name                 - The ACPI reserved name
 345  * ParamCount           - Number of arguments to the method
 346  * ExpectedReturnBtypes - Allowed type(s) for the return value
 347  */
 348 typedef struct acpi_name_info
 349 {
 350     char                        Name[ACPI_NAME_SIZE];
 351     UINT16                      ArgumentList;
 352     UINT8                       ExpectedBtypes;
 353 
 354 } ACPI_NAME_INFO;
 355 
 356 /*
 357  * Secondary information structures for ACPI predefined objects that return
 358  * package objects. This structure appears as the next entry in the table
 359  * after the NAME_INFO structure above.
 360  *
 361  * The reason for this is to minimize the size of the predefined name table.
 362  */
 363 
 364 /*
 365  * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,
 366  * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT,
 367  * ACPI_PTYPE2_FIX_VAR
 368  */
 369 typedef struct acpi_package_info
 370 {
 371     UINT8                       Type;
 372     UINT8                       ObjectType1;
 373     UINT8                       Count1;
 374     UINT8                       ObjectType2;
 375     UINT8                       Count2;
 376     UINT16                      Reserved;
 377 
 378 } ACPI_PACKAGE_INFO;
 379 
 380 /* Used for ACPI_PTYPE2_FIXED */
 381 
 382 typedef struct acpi_package_info2
 383 {
 384     UINT8                       Type;
 385     UINT8                       Count;
 386     UINT8                       ObjectType[4];
 387     UINT8                       Reserved;
 388 
 389 } ACPI_PACKAGE_INFO2;
 390 
 391 /* Used for ACPI_PTYPE1_OPTION */
 392 
 393 typedef struct acpi_package_info3
 394 {
 395     UINT8                       Type;
 396     UINT8                       Count;
 397     UINT8                       ObjectType[2];
 398     UINT8                       TailObjectType;
 399     UINT16                      Reserved;
 400 
 401 } ACPI_PACKAGE_INFO3;
 402 
 403 typedef union acpi_predefined_info
 404 {
 405     ACPI_NAME_INFO              Info;
 406     ACPI_PACKAGE_INFO           RetInfo;
 407     ACPI_PACKAGE_INFO2          RetInfo2;
 408     ACPI_PACKAGE_INFO3          RetInfo3;
 409 
 410 } ACPI_PREDEFINED_INFO;
 411 
 412 /* Reset to default packing */
 413 
 414 #pragma pack()
 415 







 416 
 417 /* Return object auto-repair info */
 418 
 419 typedef ACPI_STATUS (*ACPI_OBJECT_CONVERTER) (
 420     union acpi_operand_object   *OriginalObject,
 421     union acpi_operand_object   **ConvertedObject);
 422 
 423 typedef struct acpi_simple_repair_info
 424 {
 425     char                        Name[ACPI_NAME_SIZE];
 426     UINT32                      UnexpectedBtypes;
 427     UINT32                      PackageIndex;
 428     ACPI_OBJECT_CONVERTER       ObjectConverter;
 429 
 430 } ACPI_SIMPLE_REPAIR_INFO;
 431 
 432 
 433 /*
 434  * Bitmapped return value types
 435  * Note: the actual data types must be contiguous, a loop in nspredef.c
 436  * depends on this.
 437  */
 438 #define ACPI_RTYPE_ANY                  0x00
 439 #define ACPI_RTYPE_NONE                 0x01
 440 #define ACPI_RTYPE_INTEGER              0x02
 441 #define ACPI_RTYPE_STRING               0x04
 442 #define ACPI_RTYPE_BUFFER               0x08
 443 #define ACPI_RTYPE_PACKAGE              0x10
 444 #define ACPI_RTYPE_REFERENCE            0x20
 445 #define ACPI_RTYPE_ALL                  0x3F
 446 
 447 #define ACPI_NUM_RTYPES                 5   /* Number of actual object types */
 448 
 449 
 450 /*****************************************************************************
 451  *
 452  * Event typedefs and structs
 453  *
 454  ****************************************************************************/
 455 
 456 /* Dispatch info for each host-installed SCI handler */
 457 
 458 typedef struct acpi_sci_handler_info
 459 {
 460     struct acpi_sci_handler_info    *Next;
 461     ACPI_SCI_HANDLER                Address;        /* Address of handler */
 462     void                            *Context;       /* Context to be passed to handler */
 463 
 464 } ACPI_SCI_HANDLER_INFO;
 465 
 466 /* Dispatch info for each GPE -- either a method or handler, cannot be both */
 467 
 468 typedef struct acpi_gpe_handler_info
 469 {
 470     ACPI_GPE_HANDLER                Address;        /* Address of handler, if any */
 471     void                            *Context;       /* Context to be passed to handler */
 472     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level (saved) */
 473     UINT8                           OriginalFlags;  /* Original (pre-handler) GPE info */
 474     BOOLEAN                         OriginallyEnabled; /* True if GPE was originally enabled */
 475 
 476 } ACPI_GPE_HANDLER_INFO;
 477 
 478 /* Notify info for implicit notify, multiple device objects */
 479 
 480 typedef struct acpi_gpe_notify_info
 481 {
 482     ACPI_NAMESPACE_NODE             *DeviceNode;    /* Device to be notified */
 483     struct acpi_gpe_notify_info     *Next;
 484 
 485 } ACPI_GPE_NOTIFY_INFO;
 486 
 487 /*
 488  * GPE dispatch info. At any time, the GPE can have at most one type
 489  * of dispatch - Method, Handler, or Implicit Notify.
 490  */
 491 typedef union acpi_gpe_dispatch_info
 492 {
 493     ACPI_NAMESPACE_NODE             *MethodNode;    /* Method node for this GPE level */
 494     ACPI_GPE_HANDLER_INFO           *Handler;       /* Installed GPE handler */
 495     ACPI_GPE_NOTIFY_INFO            *NotifyList;    /* List of _PRW devices for implicit notifies */
 496 
 497 } ACPI_GPE_DISPATCH_INFO;
 498 
 499 /*
 500  * Information about a GPE, one per each GPE in an array.
 501  * NOTE: Important to keep this struct as small as possible.
 502  */
 503 typedef struct acpi_gpe_event_info
 504 {
 505     union acpi_gpe_dispatch_info    Dispatch;       /* Either Method, Handler, or NotifyList */
 506     struct acpi_gpe_register_info   *RegisterInfo;  /* Backpointer to register info */
 507     UINT8                           Flags;          /* Misc info about this GPE */
 508     UINT8                           GpeNumber;      /* This GPE */
 509     UINT8                           RuntimeCount;   /* References to a run GPE */
 510 
 511 } ACPI_GPE_EVENT_INFO;
 512 
 513 /* Information about a GPE register pair, one per each status/enable pair in an array */
 514 
 515 typedef struct acpi_gpe_register_info
 516 {
 517     ACPI_GENERIC_ADDRESS            StatusAddress;  /* Address of status reg */
 518     ACPI_GENERIC_ADDRESS            EnableAddress;  /* Address of enable reg */
 519     UINT8                           EnableForWake;  /* GPEs to keep enabled when sleeping */
 520     UINT8                           EnableForRun;   /* GPEs to keep enabled when running */
 521     UINT8                           BaseGpeNumber;  /* Base GPE number for this register */
 522 
 523 } ACPI_GPE_REGISTER_INFO;
 524 
 525 /*


 721  * AML arguments
 722  */
 723 typedef struct acpi_result_values
 724 {
 725     ACPI_STATE_COMMON
 726     union acpi_operand_object       *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
 727 
 728 } ACPI_RESULT_VALUES;
 729 
 730 
 731 typedef
 732 ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
 733     struct acpi_walk_state          *WalkState,
 734     union acpi_parse_object         **OutOp);
 735 
 736 typedef
 737 ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
 738     struct acpi_walk_state          *WalkState);
 739 
 740 
 741 /* Global handlers for AML Notifies */
 742 
 743 typedef struct acpi_global_notify_handler
 744 {
 745     ACPI_NOTIFY_HANDLER             Handler;
 746     void                            *Context;
 747 
 748 } ACPI_GLOBAL_NOTIFY_HANDLER;
 749 
 750 /*
 751  * Notify info - used to pass info to the deferred notify
 752  * handler/dispatcher.
 753  */
 754 typedef struct acpi_notify_info
 755 {
 756     ACPI_STATE_COMMON
 757     UINT8                           HandlerListId;
 758     ACPI_NAMESPACE_NODE             *Node;
 759     union acpi_operand_object       *HandlerListHead;
 760     ACPI_GLOBAL_NOTIFY_HANDLER      *Global;
 761 
 762 } ACPI_NOTIFY_INFO;
 763 
 764 
 765 /* Generic state is union of structs above */
 766 
 767 typedef union acpi_generic_state
 768 {
 769     ACPI_COMMON_STATE               Common;
 770     ACPI_CONTROL_STATE              Control;
 771     ACPI_UPDATE_STATE               Update;
 772     ACPI_SCOPE_STATE                Scope;
 773     ACPI_PSCOPE_STATE               ParseScope;
 774     ACPI_PKG_STATE                  Pkg;
 775     ACPI_THREAD_STATE               Thread;
 776     ACPI_RESULT_VALUES              Results;
 777     ACPI_NOTIFY_INFO                Notify;
 778 
 779 } ACPI_GENERIC_STATE;
 780 
 781 
 782 /*****************************************************************************
 783  *
 784  * Interpreter typedefs and structs
 785  *
 786  ****************************************************************************/
 787 
 788 typedef
 789 ACPI_STATUS (*ACPI_EXECUTE_OP) (
 790     struct acpi_walk_state          *WalkState);
 791 
 792 /* Address Range info block */
 793 
 794 typedef struct acpi_address_range
 795 {
 796     struct acpi_address_range   *Next;
 797     ACPI_NAMESPACE_NODE         *RegionNode;
 798     ACPI_PHYSICAL_ADDRESS       StartAddress;
 799     ACPI_PHYSICAL_ADDRESS       EndAddress;
 800 
 801 } ACPI_ADDRESS_RANGE;
 802 
 803 
 804 /*****************************************************************************
 805  *
 806  * Parser typedefs and structs
 807  *
 808  ****************************************************************************/
 809 
 810 /*
 811  * AML opcode, name, and argument layout
 812  */
 813 typedef struct acpi_opcode_info
 814 {
 815 #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
 816     char                            *Name;          /* Opcode name (disassembler/debug only) */
 817 #endif
 818     UINT32                          ParseArgs;      /* Grammar/Parse time arguments */
 819     UINT32                          RuntimeArgs;    /* Interpret time arguments */
 820     UINT16                          Flags;          /* Misc flags */
 821     UINT8                           ObjectType;     /* Corresponding internal object type */
 822     UINT8                           Class;          /* Opcode class */
 823     UINT8                           Type;           /* Opcode type */
 824 
 825 } ACPI_OPCODE_INFO;
 826 
 827 /* Structure for Resource Tag information */
 828 
 829 typedef struct acpi_tag_info
 830 {
 831     UINT32                          BitOffset;
 832     UINT32                          BitLength;
 833 
 834 } ACPI_TAG_INFO;
 835 
 836 /* Value associated with the parse object */
 837 
 838 typedef union acpi_parse_value
 839 {
 840     UINT64                          Integer;        /* Integer constant (Up to 64 bits) */
 841     UINT32                          Size;           /* bytelist or field size */
 842     char                            *String;        /* NULL terminated string */
 843     UINT8                           *Buffer;        /* buffer or string */
 844     char                            *Name;          /* NULL terminated string */
 845     union acpi_parse_object         *Arg;           /* arguments and contained ops */
 846     ACPI_TAG_INFO                   Tag;            /* Resource descriptor tag info  */
 847 
 848 } ACPI_PARSE_VALUE;
 849 
 850 
 851 #ifdef ACPI_DISASSEMBLER
 852 #define ACPI_DISASM_ONLY_MEMBERS(a)     a;
 853 #else
 854 #define ACPI_DISASM_ONLY_MEMBERS(a)
 855 #endif
 856 
 857 #define ACPI_PARSE_COMMON \
 858     union acpi_parse_object         *Parent;        /* Parent op */\
 859     UINT8                           DescriptorType; /* To differentiate various internal objs */\
 860     UINT8                           Flags;          /* Type of Op */\
 861     UINT16                          AmlOpcode;      /* AML opcode */\
 862     UINT32                          AmlOffset;      /* Offset of declaration in AML */\
 863     union acpi_parse_object         *Next;          /* Next op */\
 864     ACPI_NAMESPACE_NODE             *Node;          /* For use by interpreter */\
 865     ACPI_PARSE_VALUE                Value;          /* Value or args associated with the opcode */\
 866     UINT8                           ArgListLength;  /* Number of elements in the arg list */\
 867     ACPI_DISASM_ONLY_MEMBERS (\
 868     UINT8                           DisasmFlags;    /* Used during AML disassembly */\
 869     UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\
 870     char                            AmlOpName[16])  /* Op name (debug only) */
 871 
 872 
 873 /* Flags for DisasmFlags field  above */








 874 
 875 #define ACPI_DASM_BUFFER                0x00        /* Buffer is a simple data buffer */
 876 #define ACPI_DASM_RESOURCE              0x01        /* Buffer is a Resource Descriptor */
 877 #define ACPI_DASM_STRING                0x02        /* Buffer is a ASCII string */
 878 #define ACPI_DASM_UNICODE               0x03        /* Buffer is a Unicode string */
 879 #define ACPI_DASM_PLD_METHOD            0x04        /* Buffer is a _PLD method bit-packed buffer */
 880 #define ACPI_DASM_EISAID                0x05        /* Integer is an EISAID */
 881 #define ACPI_DASM_MATCHOP               0x06        /* Parent opcode is a Match() operator */
 882 #define ACPI_DASM_LNOT_PREFIX           0x07        /* Start of a LNotEqual (etc.) pair of opcodes */
 883 #define ACPI_DASM_LNOT_SUFFIX           0x08        /* End  of a LNotEqual (etc.) pair of opcodes */
 884 #define ACPI_DASM_IGNORE                0x09        /* Not used at this time */
 885 
 886 /*
 887  * Generic operation (for example:  If, While, Store)
 888  */
 889 typedef struct acpi_parse_obj_common
 890 {
 891     ACPI_PARSE_COMMON
 892 } ACPI_PARSE_OBJ_COMMON;
 893 
 894 
 895 /*
 896  * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and OpRegions),
 897  * and bytelists.
 898  */
 899 typedef struct acpi_parse_obj_named
 900 {
 901     ACPI_PARSE_COMMON
 902     UINT8                           *Path;
 903     UINT8                           *Data;          /* AML body or bytelist data */
 904     UINT32                          Length;         /* AML length */
 905     UINT32                          Name;           /* 4-byte name or zero if no name */


 968     UINT32                          AmlSize;
 969 
 970 } ACPI_PARSE_STATE;
 971 
 972 
 973 /* Parse object flags */
 974 
 975 #define ACPI_PARSEOP_GENERIC            0x01
 976 #define ACPI_PARSEOP_NAMED              0x02
 977 #define ACPI_PARSEOP_DEFERRED           0x04
 978 #define ACPI_PARSEOP_BYTELIST           0x08
 979 #define ACPI_PARSEOP_IN_STACK           0x10
 980 #define ACPI_PARSEOP_TARGET             0x20
 981 #define ACPI_PARSEOP_IN_CACHE           0x80
 982 
 983 /* Parse object DisasmFlags */
 984 
 985 #define ACPI_PARSEOP_IGNORE             0x01
 986 #define ACPI_PARSEOP_PARAMLIST          0x02
 987 #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04
 988 #define ACPI_PARSEOP_PREDEF_CHECKED     0x08
 989 #define ACPI_PARSEOP_SPECIAL            0x10
 990 
 991 
 992 /*****************************************************************************
 993  *
 994  * Hardware (ACPI registers) and PNP
 995  *
 996  ****************************************************************************/
 997 
 998 typedef struct acpi_bit_register_info
 999 {
1000     UINT8                           ParentRegister;
1001     UINT8                           BitPosition;
1002     UINT16                          AccessBitMask;
1003 
1004 } ACPI_BIT_REGISTER_INFO;
1005 
1006 
1007 /*
1008  * Some ACPI registers have bits that must be ignored -- meaning that they


1093 #define ACPI_BITPOSITION_WAKE_STATUS            0x0F
1094 
1095 #define ACPI_BITPOSITION_TIMER_ENABLE           0x00
1096 #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE     0x05
1097 #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE    0x08
1098 #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE    0x09
1099 #define ACPI_BITPOSITION_RT_CLOCK_ENABLE        0x0A
1100 #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE    0x0E    /* ACPI 3.0 */
1101 
1102 #define ACPI_BITPOSITION_SCI_ENABLE             0x00
1103 #define ACPI_BITPOSITION_BUS_MASTER_RLD         0x01
1104 #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE    0x02
1105 #define ACPI_BITPOSITION_SLEEP_TYPE             0x0A
1106 #define ACPI_BITPOSITION_SLEEP_ENABLE           0x0D
1107 
1108 #define ACPI_BITPOSITION_ARB_DISABLE            0x00
1109 
1110 
1111 /* Structs and definitions for _OSI support and I/O port validation */
1112 












1113 #define ACPI_ALWAYS_ILLEGAL             0x00
1114 
1115 typedef struct acpi_interface_info
1116 {
1117     char                        *Name;
1118     struct acpi_interface_info  *Next;
1119     UINT8                       Flags;
1120     UINT8                       Value;
1121 
1122 } ACPI_INTERFACE_INFO;
1123 
1124 #define ACPI_OSI_INVALID                0x01
1125 #define ACPI_OSI_DYNAMIC                0x02
1126 #define ACPI_OSI_FEATURE                0x04
1127 #define ACPI_OSI_DEFAULT_INVALID        0x08
1128 #define ACPI_OSI_OPTIONAL_FEATURE       (ACPI_OSI_FEATURE | ACPI_OSI_DEFAULT_INVALID | ACPI_OSI_INVALID)
1129 
1130 typedef struct acpi_port_info
1131 {
1132     char                    *Name;
1133     UINT16                  Start;
1134     UINT16                  End;
1135     UINT8                   OsiDependency;
1136 
1137 } ACPI_PORT_INFO;
1138 
1139 
1140 /*****************************************************************************
1141  *
1142  * Resource descriptors
1143  *
1144  ****************************************************************************/
1145 
1146 /* ResourceType values */
1147 
1148 #define ACPI_ADDRESS_TYPE_MEMORY_RANGE          0


1152 /* Resource descriptor types and masks */
1153 
1154 #define ACPI_RESOURCE_NAME_LARGE                0x80
1155 #define ACPI_RESOURCE_NAME_SMALL                0x00
1156 
1157 #define ACPI_RESOURCE_NAME_SMALL_MASK           0x78 /* Bits 6:3 contain the type */
1158 #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK    0x07 /* Bits 2:0 contain the length */
1159 #define ACPI_RESOURCE_NAME_LARGE_MASK           0x7F /* Bits 6:0 contain the type */
1160 
1161 
1162 /*
1163  * Small resource descriptor "names" as defined by the ACPI specification.
1164  * Note: Bits 2:0 are used for the descriptor length
1165  */
1166 #define ACPI_RESOURCE_NAME_IRQ                  0x20
1167 #define ACPI_RESOURCE_NAME_DMA                  0x28
1168 #define ACPI_RESOURCE_NAME_START_DEPENDENT      0x30
1169 #define ACPI_RESOURCE_NAME_END_DEPENDENT        0x38
1170 #define ACPI_RESOURCE_NAME_IO                   0x40
1171 #define ACPI_RESOURCE_NAME_FIXED_IO             0x48
1172 #define ACPI_RESOURCE_NAME_FIXED_DMA            0x50
1173 #define ACPI_RESOURCE_NAME_RESERVED_S2          0x58
1174 #define ACPI_RESOURCE_NAME_RESERVED_S3          0x60
1175 #define ACPI_RESOURCE_NAME_RESERVED_S4          0x68
1176 #define ACPI_RESOURCE_NAME_VENDOR_SMALL         0x70
1177 #define ACPI_RESOURCE_NAME_END_TAG              0x78
1178 
1179 /*
1180  * Large resource descriptor "names" as defined by the ACPI specification.
1181  * Note: includes the Large Descriptor bit in bit[7]
1182  */
1183 #define ACPI_RESOURCE_NAME_MEMORY24             0x81
1184 #define ACPI_RESOURCE_NAME_GENERIC_REGISTER     0x82
1185 #define ACPI_RESOURCE_NAME_RESERVED_L1          0x83
1186 #define ACPI_RESOURCE_NAME_VENDOR_LARGE         0x84
1187 #define ACPI_RESOURCE_NAME_MEMORY32             0x85
1188 #define ACPI_RESOURCE_NAME_FIXED_MEMORY32       0x86
1189 #define ACPI_RESOURCE_NAME_ADDRESS32            0x87
1190 #define ACPI_RESOURCE_NAME_ADDRESS16            0x88
1191 #define ACPI_RESOURCE_NAME_EXTENDED_IRQ         0x89
1192 #define ACPI_RESOURCE_NAME_ADDRESS64            0x8A
1193 #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64   0x8B
1194 #define ACPI_RESOURCE_NAME_GPIO                 0x8C
1195 #define ACPI_RESOURCE_NAME_SERIAL_BUS           0x8E
1196 #define ACPI_RESOURCE_NAME_LARGE_MAX            0x8E
1197 
1198 
1199 /*****************************************************************************
1200  *
1201  * Miscellaneous
1202  *
1203  ****************************************************************************/
1204 
1205 #define ACPI_ASCII_ZERO                 0x30
1206 
1207 
1208 /*****************************************************************************
1209  *
1210  * Disassembler
1211  *
1212  ****************************************************************************/
1213 
1214 typedef struct acpi_external_list
1215 {
1216     char                        *Path;
1217     char                        *InternalPath;
1218     struct acpi_external_list   *Next;
1219     UINT32                      Value;
1220     UINT16                      Length;
1221     UINT16                      Flags;
1222     UINT8                       Type;

1223 
1224 } ACPI_EXTERNAL_LIST;
1225 
1226 /* Values for Flags field above */
1227 
1228 #define ACPI_EXT_RESOLVED_REFERENCE         0x01    /* Object was resolved during cross ref */
1229 #define ACPI_EXT_ORIGIN_FROM_FILE           0x02    /* External came from a file */
1230 #define ACPI_EXT_INTERNAL_PATH_ALLOCATED    0x04    /* Deallocate internal path on completion */
1231 #define ACPI_EXT_EXTERNAL_EMITTED           0x08    /* External() statement has been emitted */
1232 
1233 
1234 typedef struct acpi_external_file
1235 {
1236     char                        *Path;
1237     struct acpi_external_file   *Next;
1238 
1239 } ACPI_EXTERNAL_FILE;
1240 
1241 
1242 /*****************************************************************************
1243  *
1244  * Debugger
1245  *
1246  ****************************************************************************/
1247 
1248 typedef struct acpi_db_method_info
1249 {
1250     ACPI_HANDLE                     Method;
1251     ACPI_HANDLE                     MainThreadGate;
1252     ACPI_HANDLE                     ThreadCompleteGate;
1253     ACPI_HANDLE                     InfoGate;
1254     ACPI_THREAD_ID                  *Threads;
1255     UINT32                          NumThreads;
1256     UINT32                          NumCreated;
1257     UINT32                          NumCompleted;
1258 
1259     char                            *Name;
1260     UINT32                          Flags;
1261     UINT32                          NumLoops;
1262     char                            Pathname[ACPI_DB_LINE_BUFFER_SIZE];
1263     char                            **Args;
1264     ACPI_OBJECT_TYPE                *Types;
1265 
1266     /*
1267      * Arguments to be passed to method for the command
1268      * Threads -
1269      *   the Number of threads, ID of current thread and
1270      *   Index of current thread inside all them created.
1271      */
1272     char                            InitArgs;
1273     ACPI_OBJECT_TYPE                ArgTypes[4];
1274     char                            *Arguments[4];
1275     char                            NumThreadsStr[11];
1276     char                            IdOfThreadStr[11];
1277     char                            IndexOfThreadStr[11];
1278 
1279 } ACPI_DB_METHOD_INFO;
1280 
1281 typedef struct acpi_integrity_info
1282 {
1283     UINT32                          Nodes;
1284     UINT32                          Objects;
1285 
1286 } ACPI_INTEGRITY_INFO;
1287 
1288 
1289 #define ACPI_DB_DISABLE_OUTPUT          0x00
1290 #define ACPI_DB_REDIRECTABLE_OUTPUT     0x01
1291 #define ACPI_DB_CONSOLE_OUTPUT          0x02
1292 #define ACPI_DB_DUPLICATE_OUTPUT        0x03
1293 
1294 
1295 /*****************************************************************************
1296  *
1297  * Debug
1298  *
1299  ****************************************************************************/
1300 
1301 /* Entry for a memory allocation (debug only) */
1302 
1303 #define ACPI_MEM_MALLOC                 0
1304 #define ACPI_MEM_CALLOC                 1
1305 #define ACPI_MAX_MODULE_NAME            16
1306 
1307 #define ACPI_COMMON_DEBUG_MEM_HEADER \
1308     struct acpi_debug_mem_block     *Previous; \
1309     struct acpi_debug_mem_block     *Next; \


1316 typedef struct acpi_debug_mem_header
1317 {
1318     ACPI_COMMON_DEBUG_MEM_HEADER
1319 
1320 } ACPI_DEBUG_MEM_HEADER;
1321 
1322 typedef struct acpi_debug_mem_block
1323 {
1324     ACPI_COMMON_DEBUG_MEM_HEADER
1325     UINT64                          UserSpace;
1326 
1327 } ACPI_DEBUG_MEM_BLOCK;
1328 
1329 
1330 #define ACPI_MEM_LIST_GLOBAL            0
1331 #define ACPI_MEM_LIST_NSNODE            1
1332 #define ACPI_MEM_LIST_MAX               1
1333 #define ACPI_NUM_MEM_LISTS              2
1334 
1335 
1336 /*****************************************************************************
1337  *
1338  * Info/help support
1339  *
1340  ****************************************************************************/
1341 
1342 typedef struct ah_predefined_name
1343 {
1344     char            *Name;
1345     char            *Description;
1346 #ifndef ACPI_ASL_COMPILER
1347     char            *Action;
1348 #endif
1349 
1350 } AH_PREDEFINED_NAME;
1351 
1352 #endif /* __ACLOCAL_H__ */