1e2f7a777SLen Brown /****************************************************************************** 2e2f7a777SLen Brown * 3e2f7a777SLen Brown * Name: aclocal.h - Internal data types used across the ACPI subsystem 4e2f7a777SLen Brown * 5e2f7a777SLen Brown *****************************************************************************/ 6e2f7a777SLen Brown 7e2f7a777SLen Brown /* 8b4e104eaSBob Moore * Copyright (C) 2000 - 2011, Intel Corp. 9e2f7a777SLen Brown * All rights reserved. 10e2f7a777SLen Brown * 11e2f7a777SLen Brown * Redistribution and use in source and binary forms, with or without 12e2f7a777SLen Brown * modification, are permitted provided that the following conditions 13e2f7a777SLen Brown * are met: 14e2f7a777SLen Brown * 1. Redistributions of source code must retain the above copyright 15e2f7a777SLen Brown * notice, this list of conditions, and the following disclaimer, 16e2f7a777SLen Brown * without modification. 17e2f7a777SLen Brown * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18e2f7a777SLen Brown * substantially similar to the "NO WARRANTY" disclaimer below 19e2f7a777SLen Brown * ("Disclaimer") and any redistribution must be conditioned upon 20e2f7a777SLen Brown * including a substantially similar Disclaimer requirement for further 21e2f7a777SLen Brown * binary redistribution. 22e2f7a777SLen Brown * 3. Neither the names of the above-listed copyright holders nor the names 23e2f7a777SLen Brown * of any contributors may be used to endorse or promote products derived 24e2f7a777SLen Brown * from this software without specific prior written permission. 25e2f7a777SLen Brown * 26e2f7a777SLen Brown * Alternatively, this software may be distributed under the terms of the 27e2f7a777SLen Brown * GNU General Public License ("GPL") version 2 as published by the Free 28e2f7a777SLen Brown * Software Foundation. 29e2f7a777SLen Brown * 30e2f7a777SLen Brown * NO WARRANTY 31e2f7a777SLen Brown * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32e2f7a777SLen Brown * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33e2f7a777SLen Brown * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34e2f7a777SLen Brown * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35e2f7a777SLen Brown * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36e2f7a777SLen Brown * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37e2f7a777SLen Brown * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38e2f7a777SLen Brown * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39e2f7a777SLen Brown * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40e2f7a777SLen Brown * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41e2f7a777SLen Brown * POSSIBILITY OF SUCH DAMAGES. 42e2f7a777SLen Brown */ 43e2f7a777SLen Brown 44e2f7a777SLen Brown #ifndef __ACLOCAL_H__ 45e2f7a777SLen Brown #define __ACLOCAL_H__ 46e2f7a777SLen Brown 47e2f7a777SLen Brown /* acpisrc:struct_defs -- for acpisrc conversion */ 48e2f7a777SLen Brown 49e2f7a777SLen Brown #define ACPI_SERIALIZED 0xFF 50e2f7a777SLen Brown 51e2f7a777SLen Brown typedef u32 acpi_mutex_handle; 52e2f7a777SLen Brown #define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1) 53e2f7a777SLen Brown 54e2f7a777SLen Brown /* Total number of aml opcodes defined */ 55e2f7a777SLen Brown 56e2f7a777SLen Brown #define AML_NUM_OPCODES 0x7F 57e2f7a777SLen Brown 58e2f7a777SLen Brown /* Forward declarations */ 59e2f7a777SLen Brown 60e2f7a777SLen Brown struct acpi_walk_state; 61e2f7a777SLen Brown struct acpi_obj_mutex; 62e2f7a777SLen Brown union acpi_parse_object; 63e2f7a777SLen Brown 64e2f7a777SLen Brown /***************************************************************************** 65e2f7a777SLen Brown * 66e2f7a777SLen Brown * Mutex typedefs and structs 67e2f7a777SLen Brown * 68e2f7a777SLen Brown ****************************************************************************/ 69e2f7a777SLen Brown 70e2f7a777SLen Brown /* 71e2f7a777SLen Brown * Predefined handles for the mutex objects used within the subsystem 72e2f7a777SLen Brown * All mutex objects are automatically created by acpi_ut_mutex_initialize. 73e2f7a777SLen Brown * 74e2f7a777SLen Brown * The acquire/release ordering protocol is implied via this list. Mutexes 75e2f7a777SLen Brown * with a lower value must be acquired before mutexes with a higher value. 76e2f7a777SLen Brown * 77e2f7a777SLen Brown * NOTE: any changes here must be reflected in the acpi_gbl_mutex_names 78e2f7a777SLen Brown * table below also! 79e2f7a777SLen Brown */ 80e2f7a777SLen Brown #define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */ 81e2f7a777SLen Brown #define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */ 82e2f7a777SLen Brown #define ACPI_MTX_TABLES 2 /* Data for ACPI tables */ 83e2f7a777SLen Brown #define ACPI_MTX_EVENTS 3 /* Data for ACPI events */ 84e2f7a777SLen Brown #define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */ 85e2f7a777SLen Brown #define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */ 86e2f7a777SLen Brown #define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */ 87e2f7a777SLen Brown #define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */ 88e2f7a777SLen Brown 89e2f7a777SLen Brown #define ACPI_MAX_MUTEX 7 90e2f7a777SLen Brown #define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1 91e2f7a777SLen Brown 928a335a23SBob Moore /* Lock structure for reader/writer interfaces */ 938a335a23SBob Moore 948a335a23SBob Moore struct acpi_rw_lock { 958a335a23SBob Moore acpi_mutex writer_mutex; 968a335a23SBob Moore acpi_mutex reader_mutex; 978a335a23SBob Moore u32 num_readers; 988a335a23SBob Moore }; 998a335a23SBob Moore 100e2f7a777SLen Brown /* 101e2f7a777SLen Brown * Predefined handles for spinlocks used within the subsystem. 102e2f7a777SLen Brown * These spinlocks are created by acpi_ut_mutex_initialize 103e2f7a777SLen Brown */ 104e2f7a777SLen Brown #define ACPI_LOCK_GPES 0 105e2f7a777SLen Brown #define ACPI_LOCK_HARDWARE 1 106e2f7a777SLen Brown 107e2f7a777SLen Brown #define ACPI_MAX_LOCK 1 108e2f7a777SLen Brown #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 109e2f7a777SLen Brown 110e2f7a777SLen Brown /* This Thread ID means that the mutex is not in use (unlocked) */ 111e2f7a777SLen Brown 112e2f7a777SLen Brown #define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0 113e2f7a777SLen Brown 114e2f7a777SLen Brown /* Table for the global mutexes */ 115e2f7a777SLen Brown 116e2f7a777SLen Brown struct acpi_mutex_info { 117e2f7a777SLen Brown acpi_mutex mutex; 118e2f7a777SLen Brown u32 use_count; 119e2f7a777SLen Brown acpi_thread_id thread_id; 120e2f7a777SLen Brown }; 121e2f7a777SLen Brown 122e2f7a777SLen Brown /* Lock flag parameter for various interfaces */ 123e2f7a777SLen Brown 124e2f7a777SLen Brown #define ACPI_MTX_DO_NOT_LOCK 0 125e2f7a777SLen Brown #define ACPI_MTX_LOCK 1 126e2f7a777SLen Brown 127e2f7a777SLen Brown /* Field access granularities */ 128e2f7a777SLen Brown 129e2f7a777SLen Brown #define ACPI_FIELD_BYTE_GRANULARITY 1 130e2f7a777SLen Brown #define ACPI_FIELD_WORD_GRANULARITY 2 131e2f7a777SLen Brown #define ACPI_FIELD_DWORD_GRANULARITY 4 132e2f7a777SLen Brown #define ACPI_FIELD_QWORD_GRANULARITY 8 133e2f7a777SLen Brown 134e2f7a777SLen Brown #define ACPI_ENTRY_NOT_FOUND NULL 135e2f7a777SLen Brown 136e2f7a777SLen Brown /***************************************************************************** 137e2f7a777SLen Brown * 138e2f7a777SLen Brown * Namespace typedefs and structs 139e2f7a777SLen Brown * 140e2f7a777SLen Brown ****************************************************************************/ 141e2f7a777SLen Brown 142e2f7a777SLen Brown /* Operational modes of the AML interpreter/scanner */ 143e2f7a777SLen Brown 144e2f7a777SLen Brown typedef enum { 145e2f7a777SLen Brown ACPI_IMODE_LOAD_PASS1 = 0x01, 146e2f7a777SLen Brown ACPI_IMODE_LOAD_PASS2 = 0x02, 147e2f7a777SLen Brown ACPI_IMODE_EXECUTE = 0x03 148e2f7a777SLen Brown } acpi_interpreter_mode; 149e2f7a777SLen Brown 150e2f7a777SLen Brown /* 151e2f7a777SLen Brown * The Namespace Node describes a named object that appears in the AML. 152e2f7a777SLen Brown * descriptor_type is used to differentiate between internal descriptors. 153e2f7a777SLen Brown * 154e2f7a777SLen Brown * The node is optimized for both 32-bit and 64-bit platforms: 155e2f7a777SLen Brown * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. 156e2f7a777SLen Brown * 157e2f7a777SLen Brown * Note: The descriptor_type and Type fields must appear in the identical 158e2f7a777SLen Brown * position in both the struct acpi_namespace_node and union acpi_operand_object 159e2f7a777SLen Brown * structures. 160e2f7a777SLen Brown */ 161e2f7a777SLen Brown struct acpi_namespace_node { 162e2f7a777SLen Brown union acpi_operand_object *object; /* Interpreter object */ 163e2f7a777SLen Brown u8 descriptor_type; /* Differentiate object descriptor types */ 164e2f7a777SLen Brown u8 type; /* ACPI Type associated with this name */ 165e2f7a777SLen Brown u8 flags; /* Miscellaneous flags */ 166e2f7a777SLen Brown acpi_owner_id owner_id; /* Node creator */ 167e2f7a777SLen Brown union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 168c45b5c09SAlexey Starikovskiy struct acpi_namespace_node *parent; /* Parent node */ 169e2f7a777SLen Brown struct acpi_namespace_node *child; /* First child */ 170c45b5c09SAlexey Starikovskiy struct acpi_namespace_node *peer; /* First peer */ 171e2f7a777SLen Brown 172e2f7a777SLen Brown /* 173e2f7a777SLen Brown * The following fields are used by the ASL compiler and disassembler only 174e2f7a777SLen Brown */ 175e2f7a777SLen Brown #ifdef ACPI_LARGE_NAMESPACE_NODE 176e2f7a777SLen Brown union acpi_parse_object *op; 177e2f7a777SLen Brown u32 value; 178e2f7a777SLen Brown u32 length; 179e2f7a777SLen Brown #endif 180e2f7a777SLen Brown }; 181e2f7a777SLen Brown 182e2f7a777SLen Brown /* Namespace Node flags */ 183e2f7a777SLen Brown 184c45b5c09SAlexey Starikovskiy #define ANOBJ_RESERVED 0x01 /* Available for use */ 185e2f7a777SLen Brown #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ 186e2f7a777SLen Brown #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 187e2f7a777SLen Brown #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 188e2f7a777SLen Brown #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ 189e2f7a777SLen Brown #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ 190b2f7ddcfSLin Ming #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */ 191e2f7a777SLen Brown 192e2f7a777SLen Brown #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ 193e2f7a777SLen Brown #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ 194e2f7a777SLen Brown #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ 195e2f7a777SLen Brown #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ 196e2f7a777SLen Brown #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ 197e2f7a777SLen Brown 198b9ee2043SBob Moore /* Internal ACPI table management - master table list */ 199e2f7a777SLen Brown 200b9ee2043SBob Moore struct acpi_table_list { 201b9ee2043SBob Moore struct acpi_table_desc *tables; /* Table descriptor array */ 202b9ee2043SBob Moore u32 current_table_count; /* Tables currently in the array */ 203b9ee2043SBob Moore u32 max_table_count; /* Max tables array will hold */ 204e2f7a777SLen Brown u8 flags; 205e2f7a777SLen Brown }; 206e2f7a777SLen Brown 207e2f7a777SLen Brown /* Flags for above */ 208e2f7a777SLen Brown 209e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */ 210e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_ALLOCATED (1) 211e2f7a777SLen Brown #define ACPI_ROOT_ALLOW_RESIZE (2) 212e2f7a777SLen Brown 213e2f7a777SLen Brown /* Predefined (fixed) table indexes */ 214e2f7a777SLen Brown 215e2f7a777SLen Brown #define ACPI_TABLE_INDEX_DSDT (0) 216e2f7a777SLen Brown #define ACPI_TABLE_INDEX_FACS (1) 217e2f7a777SLen Brown 218e2f7a777SLen Brown struct acpi_find_context { 219e2f7a777SLen Brown char *search_for; 220e2f7a777SLen Brown acpi_handle *list; 221e2f7a777SLen Brown u32 *count; 222e2f7a777SLen Brown }; 223e2f7a777SLen Brown 224e2f7a777SLen Brown struct acpi_ns_search_data { 225e2f7a777SLen Brown struct acpi_namespace_node *node; 226e2f7a777SLen Brown }; 227e2f7a777SLen Brown 228e2f7a777SLen Brown /* Object types used during package copies */ 229e2f7a777SLen Brown 230e2f7a777SLen Brown #define ACPI_COPY_TYPE_SIMPLE 0 231e2f7a777SLen Brown #define ACPI_COPY_TYPE_PACKAGE 1 232e2f7a777SLen Brown 233e2f7a777SLen Brown /* Info structure used to convert external<->internal namestrings */ 234e2f7a777SLen Brown 235e2f7a777SLen Brown struct acpi_namestring_info { 236e2f7a777SLen Brown const char *external_name; 237e2f7a777SLen Brown const char *next_external_char; 238e2f7a777SLen Brown char *internal_name; 239e2f7a777SLen Brown u32 length; 240e2f7a777SLen Brown u32 num_segments; 241e2f7a777SLen Brown u32 num_carats; 242e2f7a777SLen Brown u8 fully_qualified; 243e2f7a777SLen Brown }; 244e2f7a777SLen Brown 245e2f7a777SLen Brown /* Field creation info */ 246e2f7a777SLen Brown 247e2f7a777SLen Brown struct acpi_create_field_info { 248e2f7a777SLen Brown struct acpi_namespace_node *region_node; 249e2f7a777SLen Brown struct acpi_namespace_node *field_node; 250e2f7a777SLen Brown struct acpi_namespace_node *register_node; 251e2f7a777SLen Brown struct acpi_namespace_node *data_register_node; 252e2f7a777SLen Brown u32 bank_value; 253e2f7a777SLen Brown u32 field_bit_position; 254e2f7a777SLen Brown u32 field_bit_length; 255e2f7a777SLen Brown u8 field_flags; 256e2f7a777SLen Brown u8 attribute; 257e2f7a777SLen Brown u8 field_type; 258e2f7a777SLen Brown }; 259e2f7a777SLen Brown 260e2f7a777SLen Brown typedef 261e2f7a777SLen Brown acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); 262e2f7a777SLen Brown 263e2f7a777SLen Brown /* 264e2f7a777SLen Brown * Bitmapped ACPI types. Used internally only 265e2f7a777SLen Brown */ 266e2f7a777SLen Brown #define ACPI_BTYPE_ANY 0x00000000 267e2f7a777SLen Brown #define ACPI_BTYPE_INTEGER 0x00000001 268e2f7a777SLen Brown #define ACPI_BTYPE_STRING 0x00000002 269e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER 0x00000004 270e2f7a777SLen Brown #define ACPI_BTYPE_PACKAGE 0x00000008 271e2f7a777SLen Brown #define ACPI_BTYPE_FIELD_UNIT 0x00000010 272e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE 0x00000020 273e2f7a777SLen Brown #define ACPI_BTYPE_EVENT 0x00000040 274e2f7a777SLen Brown #define ACPI_BTYPE_METHOD 0x00000080 275e2f7a777SLen Brown #define ACPI_BTYPE_MUTEX 0x00000100 276e2f7a777SLen Brown #define ACPI_BTYPE_REGION 0x00000200 277e2f7a777SLen Brown #define ACPI_BTYPE_POWER 0x00000400 278e2f7a777SLen Brown #define ACPI_BTYPE_PROCESSOR 0x00000800 279e2f7a777SLen Brown #define ACPI_BTYPE_THERMAL 0x00001000 280e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 281e2f7a777SLen Brown #define ACPI_BTYPE_DDB_HANDLE 0x00004000 282e2f7a777SLen Brown #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 283e2f7a777SLen Brown #define ACPI_BTYPE_REFERENCE 0x00010000 284e2f7a777SLen Brown #define ACPI_BTYPE_RESOURCE 0x00020000 285e2f7a777SLen Brown 286e2f7a777SLen Brown #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) 287e2f7a777SLen Brown 288e2f7a777SLen Brown #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 289e2f7a777SLen Brown #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 290e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 291e2f7a777SLen Brown #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 292e2f7a777SLen Brown #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 293e2f7a777SLen Brown 294e2f7a777SLen Brown /* 295e2f7a777SLen Brown * Information structure for ACPI predefined names. 296e2f7a777SLen Brown * Each entry in the table contains the following items: 297e2f7a777SLen Brown * 298e2f7a777SLen Brown * Name - The ACPI reserved name 299e2f7a777SLen Brown * param_count - Number of arguments to the method 300e2f7a777SLen Brown * expected_return_btypes - Allowed type(s) for the return value 301e2f7a777SLen Brown */ 302e2f7a777SLen Brown struct acpi_name_info { 303e2f7a777SLen Brown char name[ACPI_NAME_SIZE]; 304e2f7a777SLen Brown u8 param_count; 305e2f7a777SLen Brown u8 expected_btypes; 306e2f7a777SLen Brown }; 307e2f7a777SLen Brown 308e2f7a777SLen Brown /* 309e2f7a777SLen Brown * Secondary information structures for ACPI predefined objects that return 310e2f7a777SLen Brown * package objects. This structure appears as the next entry in the table 311e2f7a777SLen Brown * after the NAME_INFO structure above. 312e2f7a777SLen Brown * 313e2f7a777SLen Brown * The reason for this is to minimize the size of the predefined name table. 314e2f7a777SLen Brown */ 315e2f7a777SLen Brown 316e2f7a777SLen Brown /* 317e2f7a777SLen Brown * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, 318e2f7a777SLen Brown * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT 319e2f7a777SLen Brown */ 320e2f7a777SLen Brown struct acpi_package_info { 321e2f7a777SLen Brown u8 type; 322e2f7a777SLen Brown u8 object_type1; 323e2f7a777SLen Brown u8 count1; 324e2f7a777SLen Brown u8 object_type2; 325e2f7a777SLen Brown u8 count2; 326e2f7a777SLen Brown u8 reserved; 327e2f7a777SLen Brown }; 328e2f7a777SLen Brown 329e2f7a777SLen Brown /* Used for ACPI_PTYPE2_FIXED */ 330e2f7a777SLen Brown 331e2f7a777SLen Brown struct acpi_package_info2 { 332e2f7a777SLen Brown u8 type; 333e2f7a777SLen Brown u8 count; 334e2f7a777SLen Brown u8 object_type[4]; 335e2f7a777SLen Brown }; 336e2f7a777SLen Brown 337e2f7a777SLen Brown /* Used for ACPI_PTYPE1_OPTION */ 338e2f7a777SLen Brown 339e2f7a777SLen Brown struct acpi_package_info3 { 340e2f7a777SLen Brown u8 type; 341e2f7a777SLen Brown u8 count; 342e2f7a777SLen Brown u8 object_type[2]; 343e2f7a777SLen Brown u8 tail_object_type; 344e2f7a777SLen Brown u8 reserved; 345e2f7a777SLen Brown }; 346e2f7a777SLen Brown 347e2f7a777SLen Brown union acpi_predefined_info { 348e2f7a777SLen Brown struct acpi_name_info info; 349e2f7a777SLen Brown struct acpi_package_info ret_info; 350e2f7a777SLen Brown struct acpi_package_info2 ret_info2; 351e2f7a777SLen Brown struct acpi_package_info3 ret_info3; 352e2f7a777SLen Brown }; 353e2f7a777SLen Brown 3540444e8f6SBob Moore /* Data block used during object validation */ 3550444e8f6SBob Moore 3560444e8f6SBob Moore struct acpi_predefined_data { 3570444e8f6SBob Moore char *pathname; 3580444e8f6SBob Moore const union acpi_predefined_info *predefined; 359091f4d71SBob Moore union acpi_operand_object *parent_package; 360*8f9c9127SFenghua Yu struct acpi_namespace_node *node; 3610444e8f6SBob Moore u32 flags; 3620444e8f6SBob Moore u8 node_flags; 3630444e8f6SBob Moore }; 3640444e8f6SBob Moore 3650444e8f6SBob Moore /* Defines for Flags field above */ 3660444e8f6SBob Moore 3670444e8f6SBob Moore #define ACPI_OBJECT_REPAIRED 1 3680444e8f6SBob Moore 369e2f7a777SLen Brown /* 370e2f7a777SLen Brown * Bitmapped return value types 371e2f7a777SLen Brown * Note: the actual data types must be contiguous, a loop in nspredef.c 372e2f7a777SLen Brown * depends on this. 373e2f7a777SLen Brown */ 374e2f7a777SLen Brown #define ACPI_RTYPE_ANY 0x00 375e2f7a777SLen Brown #define ACPI_RTYPE_NONE 0x01 376e2f7a777SLen Brown #define ACPI_RTYPE_INTEGER 0x02 377e2f7a777SLen Brown #define ACPI_RTYPE_STRING 0x04 378e2f7a777SLen Brown #define ACPI_RTYPE_BUFFER 0x08 379e2f7a777SLen Brown #define ACPI_RTYPE_PACKAGE 0x10 380e2f7a777SLen Brown #define ACPI_RTYPE_REFERENCE 0x20 381e2f7a777SLen Brown #define ACPI_RTYPE_ALL 0x3F 382e2f7a777SLen Brown 383e2f7a777SLen Brown #define ACPI_NUM_RTYPES 5 /* Number of actual object types */ 384e2f7a777SLen Brown 385e2f7a777SLen Brown /***************************************************************************** 386e2f7a777SLen Brown * 387e2f7a777SLen Brown * Event typedefs and structs 388e2f7a777SLen Brown * 389e2f7a777SLen Brown ****************************************************************************/ 390e2f7a777SLen Brown 391e2f7a777SLen Brown /* Dispatch info for each GPE -- either a method or handler, cannot be both */ 392e2f7a777SLen Brown 3938b6cd8adSLin Ming struct acpi_gpe_handler_info { 3948b6cd8adSLin Ming acpi_gpe_handler address; /* Address of handler, if any */ 395e2f7a777SLen Brown void *context; /* Context to be passed to handler */ 396e2f7a777SLen Brown struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ 3973a37898dSLin Ming u8 original_flags; /* Original (pre-handler) GPE info */ 3983a37898dSLin Ming u8 originally_enabled; /* True if GPE was originally enabled */ 399e2f7a777SLen Brown }; 400e2f7a777SLen Brown 401981858bdSRafael J. Wysocki struct acpi_gpe_notify_object { 402981858bdSRafael J. Wysocki struct acpi_namespace_node *node; 403981858bdSRafael J. Wysocki struct acpi_gpe_notify_object *next; 404981858bdSRafael J. Wysocki }; 405981858bdSRafael J. Wysocki 406e2f7a777SLen Brown union acpi_gpe_dispatch_info { 407e2f7a777SLen Brown struct acpi_namespace_node *method_node; /* Method node for this GPE level */ 4088b6cd8adSLin Ming struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ 409981858bdSRafael J. Wysocki struct acpi_gpe_notify_object device; /* List of _PRW devices for implicit notify */ 410e2f7a777SLen Brown }; 411e2f7a777SLen Brown 412e2f7a777SLen Brown /* 413e2f7a777SLen Brown * Information about a GPE, one per each GPE in an array. 414e2f7a777SLen Brown * NOTE: Important to keep this struct as small as possible. 415e2f7a777SLen Brown */ 416e2f7a777SLen Brown struct acpi_gpe_event_info { 417e2f7a777SLen Brown union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ 418e2f7a777SLen Brown struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 419e2f7a777SLen Brown u8 flags; /* Misc info about this GPE */ 420e2f7a777SLen Brown u8 gpe_number; /* This GPE */ 4210f849d2cSLin Ming u8 runtime_count; /* References to a run GPE */ 422e2f7a777SLen Brown }; 423e2f7a777SLen Brown 424e2f7a777SLen Brown /* Information about a GPE register pair, one per each status/enable pair in an array */ 425e2f7a777SLen Brown 426e2f7a777SLen Brown struct acpi_gpe_register_info { 427e2f7a777SLen Brown struct acpi_generic_address status_address; /* Address of status reg */ 428e2f7a777SLen Brown struct acpi_generic_address enable_address; /* Address of enable reg */ 429e2f7a777SLen Brown u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ 430e2f7a777SLen Brown u8 enable_for_run; /* GPEs to keep enabled when running */ 431e2f7a777SLen Brown u8 base_gpe_number; /* Base GPE number for this register */ 432e2f7a777SLen Brown }; 433e2f7a777SLen Brown 434e2f7a777SLen Brown /* 435e2f7a777SLen Brown * Information about a GPE register block, one per each installed block -- 436e2f7a777SLen Brown * GPE0, GPE1, and one per each installed GPE Block Device. 437e2f7a777SLen Brown */ 438e2f7a777SLen Brown struct acpi_gpe_block_info { 439e2f7a777SLen Brown struct acpi_namespace_node *node; 440e2f7a777SLen Brown struct acpi_gpe_block_info *previous; 441e2f7a777SLen Brown struct acpi_gpe_block_info *next; 442e2f7a777SLen Brown struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ 443e2f7a777SLen Brown struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ 444e2f7a777SLen Brown struct acpi_gpe_event_info *event_info; /* One for each GPE */ 445e2f7a777SLen Brown struct acpi_generic_address block_address; /* Base address of the block */ 446e2f7a777SLen Brown u32 register_count; /* Number of register pairs in block */ 4470f849d2cSLin Ming u16 gpe_count; /* Number of individual GPEs in block */ 448e2f7a777SLen Brown u8 block_base_number; /* Base GPE number for this block */ 4493a37898dSLin Ming u8 initialized; /* TRUE if this block is initialized */ 450e2f7a777SLen Brown }; 451e2f7a777SLen Brown 452e2f7a777SLen Brown /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ 453e2f7a777SLen Brown 454e2f7a777SLen Brown struct acpi_gpe_xrupt_info { 455e2f7a777SLen Brown struct acpi_gpe_xrupt_info *previous; 456e2f7a777SLen Brown struct acpi_gpe_xrupt_info *next; 457e2f7a777SLen Brown struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ 458e2f7a777SLen Brown u32 interrupt_number; /* System interrupt number */ 459e2f7a777SLen Brown }; 460e2f7a777SLen Brown 461e2f7a777SLen Brown struct acpi_gpe_walk_info { 462e2f7a777SLen Brown struct acpi_namespace_node *gpe_device; 463e2f7a777SLen Brown struct acpi_gpe_block_info *gpe_block; 464186c307fSBob Moore u16 count; 465186c307fSBob Moore acpi_owner_id owner_id; 466186c307fSBob Moore u8 execute_by_owner_id; 467e2f7a777SLen Brown }; 468e2f7a777SLen Brown 469e2f7a777SLen Brown struct acpi_gpe_device_info { 470e2f7a777SLen Brown u32 index; 471e2f7a777SLen Brown u32 next_block_base_index; 472e2f7a777SLen Brown acpi_status status; 473e2f7a777SLen Brown struct acpi_namespace_node *gpe_device; 474e2f7a777SLen Brown }; 475e2f7a777SLen Brown 476e2f7a777SLen Brown typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info, 477e2f7a777SLen Brown struct acpi_gpe_block_info *gpe_block, void *context); 478e2f7a777SLen Brown 479e2f7a777SLen Brown /* Information about each particular fixed event */ 480e2f7a777SLen Brown 481e2f7a777SLen Brown struct acpi_fixed_event_handler { 482e2f7a777SLen Brown acpi_event_handler handler; /* Address of handler. */ 483e2f7a777SLen Brown void *context; /* Context to be passed to handler */ 484e2f7a777SLen Brown }; 485e2f7a777SLen Brown 486e2f7a777SLen Brown struct acpi_fixed_event_info { 487e2f7a777SLen Brown u8 status_register_id; 488e2f7a777SLen Brown u8 enable_register_id; 489e2f7a777SLen Brown u16 status_bit_mask; 490e2f7a777SLen Brown u16 enable_bit_mask; 491e2f7a777SLen Brown }; 492e2f7a777SLen Brown 493e2f7a777SLen Brown /* Information used during field processing */ 494e2f7a777SLen Brown 495e2f7a777SLen Brown struct acpi_field_info { 496e2f7a777SLen Brown u8 skip_field; 497e2f7a777SLen Brown u8 field_flag; 498e2f7a777SLen Brown u32 pkg_length; 499e2f7a777SLen Brown }; 500e2f7a777SLen Brown 501e2f7a777SLen Brown /***************************************************************************** 502e2f7a777SLen Brown * 503e2f7a777SLen Brown * Generic "state" object for stacks 504e2f7a777SLen Brown * 505e2f7a777SLen Brown ****************************************************************************/ 506e2f7a777SLen Brown 507e2f7a777SLen Brown #define ACPI_CONTROL_NORMAL 0xC0 508e2f7a777SLen Brown #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 509e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 510e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 511e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 512e2f7a777SLen Brown 513e2f7a777SLen Brown #define ACPI_STATE_COMMON \ 514e2f7a777SLen Brown void *next; \ 515e2f7a777SLen Brown u8 descriptor_type; /* To differentiate various internal objs */\ 516e2f7a777SLen Brown u8 flags; \ 517e2f7a777SLen Brown u16 value; \ 518e2f7a777SLen Brown u16 state; 519e2f7a777SLen Brown 520e2f7a777SLen Brown /* There are 2 bytes available here until the next natural alignment boundary */ 521e2f7a777SLen Brown 522e2f7a777SLen Brown struct acpi_common_state { 523e2f7a777SLen Brown ACPI_STATE_COMMON}; 524e2f7a777SLen Brown 525e2f7a777SLen Brown /* 526e2f7a777SLen Brown * Update state - used to traverse complex objects such as packages 527e2f7a777SLen Brown */ 528e2f7a777SLen Brown struct acpi_update_state { 529e2f7a777SLen Brown ACPI_STATE_COMMON union acpi_operand_object *object; 530e2f7a777SLen Brown }; 531e2f7a777SLen Brown 532e2f7a777SLen Brown /* 533e2f7a777SLen Brown * Pkg state - used to traverse nested package structures 534e2f7a777SLen Brown */ 535e2f7a777SLen Brown struct acpi_pkg_state { 536e2f7a777SLen Brown ACPI_STATE_COMMON u16 index; 537e2f7a777SLen Brown union acpi_operand_object *source_object; 538e2f7a777SLen Brown union acpi_operand_object *dest_object; 539e2f7a777SLen Brown struct acpi_walk_state *walk_state; 540e2f7a777SLen Brown void *this_target_obj; 541e2f7a777SLen Brown u32 num_packages; 542e2f7a777SLen Brown }; 543e2f7a777SLen Brown 544e2f7a777SLen Brown /* 545e2f7a777SLen Brown * Control state - one per if/else and while constructs. 546e2f7a777SLen Brown * Allows nesting of these constructs 547e2f7a777SLen Brown */ 548e2f7a777SLen Brown struct acpi_control_state { 549e2f7a777SLen Brown ACPI_STATE_COMMON u16 opcode; 550e2f7a777SLen Brown union acpi_parse_object *predicate_op; 551e2f7a777SLen Brown u8 *aml_predicate_start; /* Start of if/while predicate */ 552e2f7a777SLen Brown u8 *package_end; /* End of if/while block */ 553e2f7a777SLen Brown u32 loop_count; /* While() loop counter */ 554e2f7a777SLen Brown }; 555e2f7a777SLen Brown 556e2f7a777SLen Brown /* 557e2f7a777SLen Brown * Scope state - current scope during namespace lookups 558e2f7a777SLen Brown */ 559e2f7a777SLen Brown struct acpi_scope_state { 560e2f7a777SLen Brown ACPI_STATE_COMMON struct acpi_namespace_node *node; 561e2f7a777SLen Brown }; 562e2f7a777SLen Brown 563e2f7a777SLen Brown struct acpi_pscope_state { 564e2f7a777SLen Brown ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */ 565e2f7a777SLen Brown union acpi_parse_object *op; /* Current op being parsed */ 566e2f7a777SLen Brown u8 *arg_end; /* Current argument end */ 567e2f7a777SLen Brown u8 *pkg_end; /* Current package end */ 568e2f7a777SLen Brown u32 arg_list; /* Next argument to parse */ 569e2f7a777SLen Brown }; 570e2f7a777SLen Brown 571e2f7a777SLen Brown /* 572e2f7a777SLen Brown * Thread state - one per thread across multiple walk states. Multiple walk 573e2f7a777SLen Brown * states are created when there are nested control methods executing. 574e2f7a777SLen Brown */ 575e2f7a777SLen Brown struct acpi_thread_state { 576e2f7a777SLen Brown ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ 577e2f7a777SLen Brown struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ 578e2f7a777SLen Brown union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ 579e2f7a777SLen Brown acpi_thread_id thread_id; /* Running thread ID */ 580e2f7a777SLen Brown }; 581e2f7a777SLen Brown 582e2f7a777SLen Brown /* 583e2f7a777SLen Brown * Result values - used to accumulate the results of nested 584e2f7a777SLen Brown * AML arguments 585e2f7a777SLen Brown */ 586e2f7a777SLen Brown struct acpi_result_values { 587e2f7a777SLen Brown ACPI_STATE_COMMON 588e2f7a777SLen Brown union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM]; 589e2f7a777SLen Brown }; 590e2f7a777SLen Brown 591e2f7a777SLen Brown typedef 592e2f7a777SLen Brown acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state, 593e2f7a777SLen Brown union acpi_parse_object ** out_op); 594e2f7a777SLen Brown 595e2f7a777SLen Brown typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); 596e2f7a777SLen Brown 597e2f7a777SLen Brown /* 598e2f7a777SLen Brown * Notify info - used to pass info to the deferred notify 599e2f7a777SLen Brown * handler/dispatcher. 600e2f7a777SLen Brown */ 601e2f7a777SLen Brown struct acpi_notify_info { 602e2f7a777SLen Brown ACPI_STATE_COMMON struct acpi_namespace_node *node; 603e2f7a777SLen Brown union acpi_operand_object *handler_obj; 604e2f7a777SLen Brown }; 605e2f7a777SLen Brown 606e2f7a777SLen Brown /* Generic state is union of structs above */ 607e2f7a777SLen Brown 608e2f7a777SLen Brown union acpi_generic_state { 609e2f7a777SLen Brown struct acpi_common_state common; 610e2f7a777SLen Brown struct acpi_control_state control; 611e2f7a777SLen Brown struct acpi_update_state update; 612e2f7a777SLen Brown struct acpi_scope_state scope; 613e2f7a777SLen Brown struct acpi_pscope_state parse_scope; 614e2f7a777SLen Brown struct acpi_pkg_state pkg; 615e2f7a777SLen Brown struct acpi_thread_state thread; 616e2f7a777SLen Brown struct acpi_result_values results; 617e2f7a777SLen Brown struct acpi_notify_info notify; 618e2f7a777SLen Brown }; 619e2f7a777SLen Brown 620e2f7a777SLen Brown /***************************************************************************** 621e2f7a777SLen Brown * 622e2f7a777SLen Brown * Interpreter typedefs and structs 623e2f7a777SLen Brown * 624e2f7a777SLen Brown ****************************************************************************/ 625e2f7a777SLen Brown 626e2f7a777SLen Brown typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); 627e2f7a777SLen Brown 628e2f7a777SLen Brown /***************************************************************************** 629e2f7a777SLen Brown * 630e2f7a777SLen Brown * Parser typedefs and structs 631e2f7a777SLen Brown * 632e2f7a777SLen Brown ****************************************************************************/ 633e2f7a777SLen Brown 634e2f7a777SLen Brown /* 635e2f7a777SLen Brown * AML opcode, name, and argument layout 636e2f7a777SLen Brown */ 637e2f7a777SLen Brown struct acpi_opcode_info { 638e2f7a777SLen Brown #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) 639e2f7a777SLen Brown char *name; /* Opcode name (disassembler/debug only) */ 640e2f7a777SLen Brown #endif 641e2f7a777SLen Brown u32 parse_args; /* Grammar/Parse time arguments */ 642e2f7a777SLen Brown u32 runtime_args; /* Interpret time arguments */ 643e2f7a777SLen Brown u16 flags; /* Misc flags */ 644e2f7a777SLen Brown u8 object_type; /* Corresponding internal object type */ 645e2f7a777SLen Brown u8 class; /* Opcode class */ 646e2f7a777SLen Brown u8 type; /* Opcode type */ 647e2f7a777SLen Brown }; 648e2f7a777SLen Brown 649e2f7a777SLen Brown union acpi_parse_value { 6505df7e6cbSBob Moore u64 integer; /* Integer constant (Up to 64 bits) */ 651e2f7a777SLen Brown u32 size; /* bytelist or field size */ 652e2f7a777SLen Brown char *string; /* NULL terminated string */ 653e2f7a777SLen Brown u8 *buffer; /* buffer or string */ 654e2f7a777SLen Brown char *name; /* NULL terminated string */ 655e2f7a777SLen Brown union acpi_parse_object *arg; /* arguments and contained ops */ 656e2f7a777SLen Brown }; 657e2f7a777SLen Brown 658e2f7a777SLen Brown #ifdef ACPI_DISASSEMBLER 659e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a) a; 660e2f7a777SLen Brown #else 661e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a) 662e2f7a777SLen Brown #endif 663e2f7a777SLen Brown 664e2f7a777SLen Brown #define ACPI_PARSE_COMMON \ 665e2f7a777SLen Brown union acpi_parse_object *parent; /* Parent op */\ 666e2f7a777SLen Brown u8 descriptor_type; /* To differentiate various internal objs */\ 667e2f7a777SLen Brown u8 flags; /* Type of Op */\ 668e2f7a777SLen Brown u16 aml_opcode; /* AML opcode */\ 669e2f7a777SLen Brown u32 aml_offset; /* Offset of declaration in AML */\ 670e2f7a777SLen Brown union acpi_parse_object *next; /* Next op */\ 671e2f7a777SLen Brown struct acpi_namespace_node *node; /* For use by interpreter */\ 672e2f7a777SLen Brown union acpi_parse_value value; /* Value or args associated with the opcode */\ 673e2f7a777SLen Brown u8 arg_list_length; /* Number of elements in the arg list */\ 674e2f7a777SLen Brown ACPI_DISASM_ONLY_MEMBERS (\ 675e2f7a777SLen Brown u8 disasm_flags; /* Used during AML disassembly */\ 676e2f7a777SLen Brown u8 disasm_opcode; /* Subtype used for disassembly */\ 677e2f7a777SLen Brown char aml_op_name[16]) /* Op name (debug only) */ 678e2f7a777SLen Brown 679e2f7a777SLen Brown #define ACPI_DASM_BUFFER 0x00 680e2f7a777SLen Brown #define ACPI_DASM_RESOURCE 0x01 681e2f7a777SLen Brown #define ACPI_DASM_STRING 0x02 682e2f7a777SLen Brown #define ACPI_DASM_UNICODE 0x03 683e2f7a777SLen Brown #define ACPI_DASM_EISAID 0x04 684e2f7a777SLen Brown #define ACPI_DASM_MATCHOP 0x05 685e2f7a777SLen Brown #define ACPI_DASM_LNOT_PREFIX 0x06 686e2f7a777SLen Brown #define ACPI_DASM_LNOT_SUFFIX 0x07 687e2f7a777SLen Brown #define ACPI_DASM_IGNORE 0x08 688e2f7a777SLen Brown 689e2f7a777SLen Brown /* 690e2f7a777SLen Brown * Generic operation (for example: If, While, Store) 691e2f7a777SLen Brown */ 692e2f7a777SLen Brown struct acpi_parse_obj_common { 693e2f7a777SLen Brown ACPI_PARSE_COMMON}; 694e2f7a777SLen Brown 695e2f7a777SLen Brown /* 696e2f7a777SLen Brown * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), 697e2f7a777SLen Brown * and bytelists. 698e2f7a777SLen Brown */ 699e2f7a777SLen Brown struct acpi_parse_obj_named { 700e2f7a777SLen Brown ACPI_PARSE_COMMON u8 *path; 701e2f7a777SLen Brown u8 *data; /* AML body or bytelist data */ 702e2f7a777SLen Brown u32 length; /* AML length */ 703e2f7a777SLen Brown u32 name; /* 4-byte name or zero if no name */ 704e2f7a777SLen Brown }; 705e2f7a777SLen Brown 706e2f7a777SLen Brown /* This version is used by the i_aSL compiler only */ 707e2f7a777SLen Brown 708e2f7a777SLen Brown #define ACPI_MAX_PARSEOP_NAME 20 709e2f7a777SLen Brown 710e2f7a777SLen Brown struct acpi_parse_obj_asl { 711e2f7a777SLen Brown ACPI_PARSE_COMMON union acpi_parse_object *child; 712e2f7a777SLen Brown union acpi_parse_object *parent_method; 713e2f7a777SLen Brown char *filename; 714e2f7a777SLen Brown char *external_name; 715e2f7a777SLen Brown char *namepath; 716e2f7a777SLen Brown char name_seg[4]; 717e2f7a777SLen Brown u32 extra_value; 718e2f7a777SLen Brown u32 column; 719e2f7a777SLen Brown u32 line_number; 720e2f7a777SLen Brown u32 logical_line_number; 721e2f7a777SLen Brown u32 logical_byte_offset; 722e2f7a777SLen Brown u32 end_line; 723e2f7a777SLen Brown u32 end_logical_line; 724e2f7a777SLen Brown u32 acpi_btype; 725e2f7a777SLen Brown u32 aml_length; 726e2f7a777SLen Brown u32 aml_subtree_length; 727e2f7a777SLen Brown u32 final_aml_length; 728e2f7a777SLen Brown u32 final_aml_offset; 729e2f7a777SLen Brown u32 compile_flags; 730e2f7a777SLen Brown u16 parse_opcode; 731e2f7a777SLen Brown u8 aml_opcode_length; 732e2f7a777SLen Brown u8 aml_pkg_len_bytes; 733e2f7a777SLen Brown u8 extra; 734e2f7a777SLen Brown char parse_op_name[ACPI_MAX_PARSEOP_NAME]; 735e2f7a777SLen Brown }; 736e2f7a777SLen Brown 737e2f7a777SLen Brown union acpi_parse_object { 738e2f7a777SLen Brown struct acpi_parse_obj_common common; 739e2f7a777SLen Brown struct acpi_parse_obj_named named; 740e2f7a777SLen Brown struct acpi_parse_obj_asl asl; 741e2f7a777SLen Brown }; 742e2f7a777SLen Brown 743e2f7a777SLen Brown /* 744e2f7a777SLen Brown * Parse state - one state per parser invocation and each control 745e2f7a777SLen Brown * method. 746e2f7a777SLen Brown */ 747e2f7a777SLen Brown struct acpi_parse_state { 748e2f7a777SLen Brown u8 *aml_start; /* First AML byte */ 749e2f7a777SLen Brown u8 *aml; /* Next AML byte */ 750e2f7a777SLen Brown u8 *aml_end; /* (last + 1) AML byte */ 751e2f7a777SLen Brown u8 *pkg_start; /* Current package begin */ 752e2f7a777SLen Brown u8 *pkg_end; /* Current package end */ 753e2f7a777SLen Brown union acpi_parse_object *start_op; /* Root of parse tree */ 754e2f7a777SLen Brown struct acpi_namespace_node *start_node; 755e2f7a777SLen Brown union acpi_generic_state *scope; /* Current scope */ 756e2f7a777SLen Brown union acpi_parse_object *start_scope; 757e2f7a777SLen Brown u32 aml_size; 758e2f7a777SLen Brown }; 759e2f7a777SLen Brown 760e2f7a777SLen Brown /* Parse object flags */ 761e2f7a777SLen Brown 762e2f7a777SLen Brown #define ACPI_PARSEOP_GENERIC 0x01 763e2f7a777SLen Brown #define ACPI_PARSEOP_NAMED 0x02 764e2f7a777SLen Brown #define ACPI_PARSEOP_DEFERRED 0x04 765e2f7a777SLen Brown #define ACPI_PARSEOP_BYTELIST 0x08 766e2f7a777SLen Brown #define ACPI_PARSEOP_IN_STACK 0x10 767e2f7a777SLen Brown #define ACPI_PARSEOP_TARGET 0x20 768e2f7a777SLen Brown #define ACPI_PARSEOP_IN_CACHE 0x80 769e2f7a777SLen Brown 770e2f7a777SLen Brown /* Parse object disasm_flags */ 771e2f7a777SLen Brown 772e2f7a777SLen Brown #define ACPI_PARSEOP_IGNORE 0x01 773e2f7a777SLen Brown #define ACPI_PARSEOP_PARAMLIST 0x02 774e2f7a777SLen Brown #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 775e2f7a777SLen Brown #define ACPI_PARSEOP_SPECIAL 0x10 776e2f7a777SLen Brown 777e2f7a777SLen Brown /***************************************************************************** 778e2f7a777SLen Brown * 779e2f7a777SLen Brown * Hardware (ACPI registers) and PNP 780e2f7a777SLen Brown * 781e2f7a777SLen Brown ****************************************************************************/ 782e2f7a777SLen Brown 783e2f7a777SLen Brown struct acpi_bit_register_info { 784e2f7a777SLen Brown u8 parent_register; 785e2f7a777SLen Brown u8 bit_position; 786e2f7a777SLen Brown u16 access_bit_mask; 787e2f7a777SLen Brown }; 788e2f7a777SLen Brown 789e2f7a777SLen Brown /* 790e2f7a777SLen Brown * Some ACPI registers have bits that must be ignored -- meaning that they 791e2f7a777SLen Brown * must be preserved. 792e2f7a777SLen Brown */ 793e2f7a777SLen Brown #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ 79420869dcfSBob Moore 795c3dd25f4SLin Ming /* Write-only bits must be zeroed by software */ 796c3dd25f4SLin Ming 797c3dd25f4SLin Ming #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */ 798c3dd25f4SLin Ming 79920869dcfSBob Moore /* For control registers, both ignored and reserved bits must be preserved */ 80020869dcfSBob Moore 801975b3c47SLin Ming /* 802b1cd843bSBob Moore * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the 803b1cd843bSBob Moore * ACPI specification to be a "preserved" bit - "OSPM always preserves this 804b1cd843bSBob Moore * bit position", section 4.7.3.2.1. However, on some machines the OS must 805b1cd843bSBob Moore * write a one to this bit after resume for the machine to work properly. 806b1cd843bSBob Moore * To enable this, we no longer attempt to preserve this bit. No machines 807b1cd843bSBob Moore * are known to fail if the bit is not preserved. (May 2009) 808975b3c47SLin Ming */ 809b1cd843bSBob Moore #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */ 81020869dcfSBob Moore #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ 81120869dcfSBob Moore #define ACPI_PM1_CONTROL_PRESERVED_BITS \ 81220869dcfSBob Moore (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) 81320869dcfSBob Moore 81420869dcfSBob Moore #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */ 815e2f7a777SLen Brown 816e2f7a777SLen Brown /* 817e2f7a777SLen Brown * Register IDs 818e2f7a777SLen Brown * These are the full ACPI registers 819e2f7a777SLen Brown */ 820e2f7a777SLen Brown #define ACPI_REGISTER_PM1_STATUS 0x01 821e2f7a777SLen Brown #define ACPI_REGISTER_PM1_ENABLE 0x02 822e2f7a777SLen Brown #define ACPI_REGISTER_PM1_CONTROL 0x03 82332c9ef99SBob Moore #define ACPI_REGISTER_PM2_CONTROL 0x04 82432c9ef99SBob Moore #define ACPI_REGISTER_PM_TIMER 0x05 82532c9ef99SBob Moore #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06 82632c9ef99SBob Moore #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07 827e2f7a777SLen Brown 828e2f7a777SLen Brown /* Masks used to access the bit_registers */ 829e2f7a777SLen Brown 830e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_STATUS 0x0001 831e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 832e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 833e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 834e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 835e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 836e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 837e2f7a777SLen Brown #define ACPI_BITMASK_WAKE_STATUS 0x8000 838e2f7a777SLen Brown 839e2f7a777SLen Brown #define ACPI_BITMASK_ALL_FIXED_STATUS (\ 840e2f7a777SLen Brown ACPI_BITMASK_TIMER_STATUS | \ 841e2f7a777SLen Brown ACPI_BITMASK_BUS_MASTER_STATUS | \ 842e2f7a777SLen Brown ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ 843e2f7a777SLen Brown ACPI_BITMASK_POWER_BUTTON_STATUS | \ 844e2f7a777SLen Brown ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ 845e2f7a777SLen Brown ACPI_BITMASK_RT_CLOCK_STATUS | \ 84649b3c1e0SColin Ian King ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ 847e2f7a777SLen Brown ACPI_BITMASK_WAKE_STATUS) 848e2f7a777SLen Brown 849e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_ENABLE 0x0001 850e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 851e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 852e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 853e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 854e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ 855e2f7a777SLen Brown 856e2f7a777SLen Brown #define ACPI_BITMASK_SCI_ENABLE 0x0001 857e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 858e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 85982d79b86SBob Moore #define ACPI_BITMASK_SLEEP_TYPE 0x1C00 860e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 861e2f7a777SLen Brown 862e2f7a777SLen Brown #define ACPI_BITMASK_ARB_DISABLE 0x0001 863e2f7a777SLen Brown 864e2f7a777SLen Brown /* Raw bit position of each bit_register */ 865e2f7a777SLen Brown 866e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_STATUS 0x00 867e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 868e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 869e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 870e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 871e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A 872e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ 873e2f7a777SLen Brown #define ACPI_BITPOSITION_WAKE_STATUS 0x0F 874e2f7a777SLen Brown 875e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 876e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 877e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 878e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 879e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A 880e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ 881e2f7a777SLen Brown 882e2f7a777SLen Brown #define ACPI_BITPOSITION_SCI_ENABLE 0x00 883e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 884e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 88582d79b86SBob Moore #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A 886e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D 887e2f7a777SLen Brown 888e2f7a777SLen Brown #define ACPI_BITPOSITION_ARB_DISABLE 0x00 889e2f7a777SLen Brown 8907f071903SBob Moore /* Structs and definitions for _OSI support and I/O port validation */ 8917f071903SBob Moore 8927f071903SBob Moore #define ACPI_OSI_WIN_2000 0x01 8937f071903SBob Moore #define ACPI_OSI_WIN_XP 0x02 8947f071903SBob Moore #define ACPI_OSI_WIN_XP_SP1 0x03 8957f071903SBob Moore #define ACPI_OSI_WINSRV_2003 0x04 8967f071903SBob Moore #define ACPI_OSI_WIN_XP_SP2 0x05 8977f071903SBob Moore #define ACPI_OSI_WINSRV_2003_SP1 0x06 8987f071903SBob Moore #define ACPI_OSI_WIN_VISTA 0x07 899eb752552SBob Moore #define ACPI_OSI_WINSRV_2008 0x08 900eb752552SBob Moore #define ACPI_OSI_WIN_VISTA_SP1 0x09 90123ebbf07SBob Moore #define ACPI_OSI_WIN_VISTA_SP2 0x0A 90223ebbf07SBob Moore #define ACPI_OSI_WIN_7 0x0B 9037f071903SBob Moore 9047f071903SBob Moore #define ACPI_ALWAYS_ILLEGAL 0x00 9057f071903SBob Moore 9067f071903SBob Moore struct acpi_interface_info { 9077f071903SBob Moore char *name; 908b0ed7a91SLin Ming struct acpi_interface_info *next; 909b0ed7a91SLin Ming u8 flags; 9107f071903SBob Moore u8 value; 9117f071903SBob Moore }; 9127f071903SBob Moore 913b0ed7a91SLin Ming #define ACPI_OSI_INVALID 0x01 914b0ed7a91SLin Ming #define ACPI_OSI_DYNAMIC 0x02 915b0ed7a91SLin Ming 9167f071903SBob Moore struct acpi_port_info { 9177f071903SBob Moore char *name; 9187f071903SBob Moore u16 start; 9197f071903SBob Moore u16 end; 9207f071903SBob Moore u8 osi_dependency; 9217f071903SBob Moore }; 9227f071903SBob Moore 923e2f7a777SLen Brown /***************************************************************************** 924e2f7a777SLen Brown * 925e2f7a777SLen Brown * Resource descriptors 926e2f7a777SLen Brown * 927e2f7a777SLen Brown ****************************************************************************/ 928e2f7a777SLen Brown 929e2f7a777SLen Brown /* resource_type values */ 930e2f7a777SLen Brown 931e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 932e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_IO_RANGE 1 933e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 934e2f7a777SLen Brown 935e2f7a777SLen Brown /* Resource descriptor types and masks */ 936e2f7a777SLen Brown 937e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE 0x80 938e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL 0x00 939e2f7a777SLen Brown 940e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ 941e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ 942e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ 943e2f7a777SLen Brown 944e2f7a777SLen Brown /* 945e2f7a777SLen Brown * Small resource descriptor "names" as defined by the ACPI specification. 946e2f7a777SLen Brown * Note: Bits 2:0 are used for the descriptor length 947e2f7a777SLen Brown */ 948e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IRQ 0x20 949e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_DMA 0x28 950e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 951e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 952e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IO 0x40 953e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 954e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 955e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 956e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 957e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 958e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 959e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_TAG 0x78 960e2f7a777SLen Brown 961e2f7a777SLen Brown /* 962e2f7a777SLen Brown * Large resource descriptor "names" as defined by the ACPI specification. 963e2f7a777SLen Brown * Note: includes the Large Descriptor bit in bit[7] 964e2f7a777SLen Brown */ 965e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY24 0x81 966e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 967e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 968e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 969e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY32 0x85 970e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 971e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS32 0x87 972e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS16 0x88 973e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 974e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A 975e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B 976e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B 977e2f7a777SLen Brown 978e2f7a777SLen Brown /***************************************************************************** 979e2f7a777SLen Brown * 980e2f7a777SLen Brown * Miscellaneous 981e2f7a777SLen Brown * 982e2f7a777SLen Brown ****************************************************************************/ 983e2f7a777SLen Brown 984e2f7a777SLen Brown #define ACPI_ASCII_ZERO 0x30 985e2f7a777SLen Brown 986e2f7a777SLen Brown /***************************************************************************** 987e2f7a777SLen Brown * 988e2f7a777SLen Brown * Debugger 989e2f7a777SLen Brown * 990e2f7a777SLen Brown ****************************************************************************/ 991e2f7a777SLen Brown 992e2f7a777SLen Brown struct acpi_db_method_info { 993e2f7a777SLen Brown acpi_handle main_thread_gate; 994e2f7a777SLen Brown acpi_handle thread_complete_gate; 99528eb3fcfSLin Ming acpi_thread_id *threads; 996e2f7a777SLen Brown u32 num_threads; 997e2f7a777SLen Brown u32 num_created; 998e2f7a777SLen Brown u32 num_completed; 999e2f7a777SLen Brown 1000e2f7a777SLen Brown char *name; 1001e2f7a777SLen Brown u32 flags; 1002e2f7a777SLen Brown u32 num_loops; 1003e2f7a777SLen Brown char pathname[128]; 1004e2f7a777SLen Brown char **args; 1005e2f7a777SLen Brown 1006e2f7a777SLen Brown /* 1007e2f7a777SLen Brown * Arguments to be passed to method for the command 1008e2f7a777SLen Brown * Threads - 1009e2f7a777SLen Brown * the Number of threads, ID of current thread and 1010e2f7a777SLen Brown * Index of current thread inside all them created. 1011e2f7a777SLen Brown */ 1012e2f7a777SLen Brown char init_args; 1013e2f7a777SLen Brown char *arguments[4]; 1014e2f7a777SLen Brown char num_threads_str[11]; 1015e2f7a777SLen Brown char id_of_thread_str[11]; 1016e2f7a777SLen Brown char index_of_thread_str[11]; 1017e2f7a777SLen Brown }; 1018e2f7a777SLen Brown 1019e2f7a777SLen Brown struct acpi_integrity_info { 1020e2f7a777SLen Brown u32 nodes; 1021e2f7a777SLen Brown u32 objects; 1022e2f7a777SLen Brown }; 1023e2f7a777SLen Brown 1024e2f7a777SLen Brown #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 1025e2f7a777SLen Brown #define ACPI_DB_CONSOLE_OUTPUT 0x02 1026e2f7a777SLen Brown #define ACPI_DB_DUPLICATE_OUTPUT 0x03 1027e2f7a777SLen Brown 1028e2f7a777SLen Brown /***************************************************************************** 1029e2f7a777SLen Brown * 1030e2f7a777SLen Brown * Debug 1031e2f7a777SLen Brown * 1032e2f7a777SLen Brown ****************************************************************************/ 1033e2f7a777SLen Brown 1034e2f7a777SLen Brown /* Entry for a memory allocation (debug only) */ 1035e2f7a777SLen Brown 1036e2f7a777SLen Brown #define ACPI_MEM_MALLOC 0 1037e2f7a777SLen Brown #define ACPI_MEM_CALLOC 1 1038e2f7a777SLen Brown #define ACPI_MAX_MODULE_NAME 16 1039e2f7a777SLen Brown 1040e2f7a777SLen Brown #define ACPI_COMMON_DEBUG_MEM_HEADER \ 1041e2f7a777SLen Brown struct acpi_debug_mem_block *previous; \ 1042e2f7a777SLen Brown struct acpi_debug_mem_block *next; \ 1043e2f7a777SLen Brown u32 size; \ 1044e2f7a777SLen Brown u32 component; \ 1045e2f7a777SLen Brown u32 line; \ 1046e2f7a777SLen Brown char module[ACPI_MAX_MODULE_NAME]; \ 1047e2f7a777SLen Brown u8 alloc_type; 1048e2f7a777SLen Brown 1049e2f7a777SLen Brown struct acpi_debug_mem_header { 1050e2f7a777SLen Brown ACPI_COMMON_DEBUG_MEM_HEADER}; 1051e2f7a777SLen Brown 1052e2f7a777SLen Brown struct acpi_debug_mem_block { 1053e2f7a777SLen Brown ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space; 1054e2f7a777SLen Brown }; 1055e2f7a777SLen Brown 1056e2f7a777SLen Brown #define ACPI_MEM_LIST_GLOBAL 0 1057e2f7a777SLen Brown #define ACPI_MEM_LIST_NSNODE 1 1058e2f7a777SLen Brown #define ACPI_MEM_LIST_MAX 1 1059e2f7a777SLen Brown #define ACPI_NUM_MEM_LISTS 2 1060e2f7a777SLen Brown 1061e2f7a777SLen Brown #endif /* __ACLOCAL_H__ */ 1062