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 /* 8a8357b0cSBob Moore * Copyright (C) 2000 - 2010, 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 92e2f7a777SLen Brown #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) 93e2f7a777SLen Brown #ifdef DEFINE_ACPI_GLOBALS 94e2f7a777SLen Brown 95e2f7a777SLen Brown /* Debug names for the mutexes above */ 96e2f7a777SLen Brown 97e2f7a777SLen Brown static char *acpi_gbl_mutex_names[ACPI_NUM_MUTEX] = { 98e2f7a777SLen Brown "ACPI_MTX_Interpreter", 99e2f7a777SLen Brown "ACPI_MTX_Namespace", 100e2f7a777SLen Brown "ACPI_MTX_Tables", 101e2f7a777SLen Brown "ACPI_MTX_Events", 102e2f7a777SLen Brown "ACPI_MTX_Caches", 103e2f7a777SLen Brown "ACPI_MTX_Memory", 104e2f7a777SLen Brown "ACPI_MTX_CommandComplete", 105e2f7a777SLen Brown "ACPI_MTX_CommandReady" 106e2f7a777SLen Brown }; 107e2f7a777SLen Brown 108e2f7a777SLen Brown #endif 109e2f7a777SLen Brown #endif 110e2f7a777SLen Brown 1118a335a23SBob Moore /* Lock structure for reader/writer interfaces */ 1128a335a23SBob Moore 1138a335a23SBob Moore struct acpi_rw_lock { 1148a335a23SBob Moore acpi_mutex writer_mutex; 1158a335a23SBob Moore acpi_mutex reader_mutex; 1168a335a23SBob Moore u32 num_readers; 1178a335a23SBob Moore }; 1188a335a23SBob Moore 119e2f7a777SLen Brown /* 120e2f7a777SLen Brown * Predefined handles for spinlocks used within the subsystem. 121e2f7a777SLen Brown * These spinlocks are created by acpi_ut_mutex_initialize 122e2f7a777SLen Brown */ 123e2f7a777SLen Brown #define ACPI_LOCK_GPES 0 124e2f7a777SLen Brown #define ACPI_LOCK_HARDWARE 1 125e2f7a777SLen Brown 126e2f7a777SLen Brown #define ACPI_MAX_LOCK 1 127e2f7a777SLen Brown #define ACPI_NUM_LOCK ACPI_MAX_LOCK+1 128e2f7a777SLen Brown 129e2f7a777SLen Brown /* This Thread ID means that the mutex is not in use (unlocked) */ 130e2f7a777SLen Brown 131e2f7a777SLen Brown #define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0 132e2f7a777SLen Brown 133e2f7a777SLen Brown /* Table for the global mutexes */ 134e2f7a777SLen Brown 135e2f7a777SLen Brown struct acpi_mutex_info { 136e2f7a777SLen Brown acpi_mutex mutex; 137e2f7a777SLen Brown u32 use_count; 138e2f7a777SLen Brown acpi_thread_id thread_id; 139e2f7a777SLen Brown }; 140e2f7a777SLen Brown 141e2f7a777SLen Brown /* Lock flag parameter for various interfaces */ 142e2f7a777SLen Brown 143e2f7a777SLen Brown #define ACPI_MTX_DO_NOT_LOCK 0 144e2f7a777SLen Brown #define ACPI_MTX_LOCK 1 145e2f7a777SLen Brown 146e2f7a777SLen Brown /* Field access granularities */ 147e2f7a777SLen Brown 148e2f7a777SLen Brown #define ACPI_FIELD_BYTE_GRANULARITY 1 149e2f7a777SLen Brown #define ACPI_FIELD_WORD_GRANULARITY 2 150e2f7a777SLen Brown #define ACPI_FIELD_DWORD_GRANULARITY 4 151e2f7a777SLen Brown #define ACPI_FIELD_QWORD_GRANULARITY 8 152e2f7a777SLen Brown 153e2f7a777SLen Brown #define ACPI_ENTRY_NOT_FOUND NULL 154e2f7a777SLen Brown 155e2f7a777SLen Brown /***************************************************************************** 156e2f7a777SLen Brown * 157e2f7a777SLen Brown * Namespace typedefs and structs 158e2f7a777SLen Brown * 159e2f7a777SLen Brown ****************************************************************************/ 160e2f7a777SLen Brown 161e2f7a777SLen Brown /* Operational modes of the AML interpreter/scanner */ 162e2f7a777SLen Brown 163e2f7a777SLen Brown typedef enum { 164e2f7a777SLen Brown ACPI_IMODE_LOAD_PASS1 = 0x01, 165e2f7a777SLen Brown ACPI_IMODE_LOAD_PASS2 = 0x02, 166e2f7a777SLen Brown ACPI_IMODE_EXECUTE = 0x03 167e2f7a777SLen Brown } acpi_interpreter_mode; 168e2f7a777SLen Brown 169e2f7a777SLen Brown /* 170e2f7a777SLen Brown * The Namespace Node describes a named object that appears in the AML. 171e2f7a777SLen Brown * descriptor_type is used to differentiate between internal descriptors. 172e2f7a777SLen Brown * 173e2f7a777SLen Brown * The node is optimized for both 32-bit and 64-bit platforms: 174e2f7a777SLen Brown * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case. 175e2f7a777SLen Brown * 176e2f7a777SLen Brown * Note: The descriptor_type and Type fields must appear in the identical 177e2f7a777SLen Brown * position in both the struct acpi_namespace_node and union acpi_operand_object 178e2f7a777SLen Brown * structures. 179e2f7a777SLen Brown */ 180e2f7a777SLen Brown struct acpi_namespace_node { 181e2f7a777SLen Brown union acpi_operand_object *object; /* Interpreter object */ 182e2f7a777SLen Brown u8 descriptor_type; /* Differentiate object descriptor types */ 183e2f7a777SLen Brown u8 type; /* ACPI Type associated with this name */ 184e2f7a777SLen Brown u8 flags; /* Miscellaneous flags */ 185e2f7a777SLen Brown acpi_owner_id owner_id; /* Node creator */ 186e2f7a777SLen Brown union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */ 187c45b5c09SAlexey Starikovskiy struct acpi_namespace_node *parent; /* Parent node */ 188e2f7a777SLen Brown struct acpi_namespace_node *child; /* First child */ 189c45b5c09SAlexey Starikovskiy struct acpi_namespace_node *peer; /* First peer */ 190e2f7a777SLen Brown 191e2f7a777SLen Brown /* 192e2f7a777SLen Brown * The following fields are used by the ASL compiler and disassembler only 193e2f7a777SLen Brown */ 194e2f7a777SLen Brown #ifdef ACPI_LARGE_NAMESPACE_NODE 195e2f7a777SLen Brown union acpi_parse_object *op; 196e2f7a777SLen Brown u32 value; 197e2f7a777SLen Brown u32 length; 198e2f7a777SLen Brown #endif 199e2f7a777SLen Brown }; 200e2f7a777SLen Brown 201e2f7a777SLen Brown /* Namespace Node flags */ 202e2f7a777SLen Brown 203c45b5c09SAlexey Starikovskiy #define ANOBJ_RESERVED 0x01 /* Available for use */ 204e2f7a777SLen Brown #define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */ 205e2f7a777SLen Brown #define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */ 206e2f7a777SLen Brown #define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */ 207e2f7a777SLen Brown #define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */ 208e2f7a777SLen Brown #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */ 209b2f7ddcfSLin Ming #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */ 210e2f7a777SLen Brown 211e2f7a777SLen Brown #define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */ 212e2f7a777SLen Brown #define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */ 213e2f7a777SLen Brown #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */ 214e2f7a777SLen Brown #define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */ 215e2f7a777SLen Brown #define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */ 216e2f7a777SLen Brown 217b9ee2043SBob Moore /* Internal ACPI table management - master table list */ 218e2f7a777SLen Brown 219b9ee2043SBob Moore struct acpi_table_list { 220b9ee2043SBob Moore struct acpi_table_desc *tables; /* Table descriptor array */ 221b9ee2043SBob Moore u32 current_table_count; /* Tables currently in the array */ 222b9ee2043SBob Moore u32 max_table_count; /* Max tables array will hold */ 223e2f7a777SLen Brown u8 flags; 224e2f7a777SLen Brown }; 225e2f7a777SLen Brown 226e2f7a777SLen Brown /* Flags for above */ 227e2f7a777SLen Brown 228e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */ 229e2f7a777SLen Brown #define ACPI_ROOT_ORIGIN_ALLOCATED (1) 230e2f7a777SLen Brown #define ACPI_ROOT_ALLOW_RESIZE (2) 231e2f7a777SLen Brown 232e2f7a777SLen Brown /* Predefined (fixed) table indexes */ 233e2f7a777SLen Brown 234e2f7a777SLen Brown #define ACPI_TABLE_INDEX_DSDT (0) 235e2f7a777SLen Brown #define ACPI_TABLE_INDEX_FACS (1) 236e2f7a777SLen Brown 237e2f7a777SLen Brown struct acpi_find_context { 238e2f7a777SLen Brown char *search_for; 239e2f7a777SLen Brown acpi_handle *list; 240e2f7a777SLen Brown u32 *count; 241e2f7a777SLen Brown }; 242e2f7a777SLen Brown 243e2f7a777SLen Brown struct acpi_ns_search_data { 244e2f7a777SLen Brown struct acpi_namespace_node *node; 245e2f7a777SLen Brown }; 246e2f7a777SLen Brown 247e2f7a777SLen Brown /* Object types used during package copies */ 248e2f7a777SLen Brown 249e2f7a777SLen Brown #define ACPI_COPY_TYPE_SIMPLE 0 250e2f7a777SLen Brown #define ACPI_COPY_TYPE_PACKAGE 1 251e2f7a777SLen Brown 252e2f7a777SLen Brown /* Info structure used to convert external<->internal namestrings */ 253e2f7a777SLen Brown 254e2f7a777SLen Brown struct acpi_namestring_info { 255e2f7a777SLen Brown const char *external_name; 256e2f7a777SLen Brown const char *next_external_char; 257e2f7a777SLen Brown char *internal_name; 258e2f7a777SLen Brown u32 length; 259e2f7a777SLen Brown u32 num_segments; 260e2f7a777SLen Brown u32 num_carats; 261e2f7a777SLen Brown u8 fully_qualified; 262e2f7a777SLen Brown }; 263e2f7a777SLen Brown 264e2f7a777SLen Brown /* Field creation info */ 265e2f7a777SLen Brown 266e2f7a777SLen Brown struct acpi_create_field_info { 267e2f7a777SLen Brown struct acpi_namespace_node *region_node; 268e2f7a777SLen Brown struct acpi_namespace_node *field_node; 269e2f7a777SLen Brown struct acpi_namespace_node *register_node; 270e2f7a777SLen Brown struct acpi_namespace_node *data_register_node; 271e2f7a777SLen Brown u32 bank_value; 272e2f7a777SLen Brown u32 field_bit_position; 273e2f7a777SLen Brown u32 field_bit_length; 274e2f7a777SLen Brown u8 field_flags; 275e2f7a777SLen Brown u8 attribute; 276e2f7a777SLen Brown u8 field_type; 277e2f7a777SLen Brown }; 278e2f7a777SLen Brown 279e2f7a777SLen Brown typedef 280e2f7a777SLen Brown acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state); 281e2f7a777SLen Brown 282e2f7a777SLen Brown /* 283e2f7a777SLen Brown * Bitmapped ACPI types. Used internally only 284e2f7a777SLen Brown */ 285e2f7a777SLen Brown #define ACPI_BTYPE_ANY 0x00000000 286e2f7a777SLen Brown #define ACPI_BTYPE_INTEGER 0x00000001 287e2f7a777SLen Brown #define ACPI_BTYPE_STRING 0x00000002 288e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER 0x00000004 289e2f7a777SLen Brown #define ACPI_BTYPE_PACKAGE 0x00000008 290e2f7a777SLen Brown #define ACPI_BTYPE_FIELD_UNIT 0x00000010 291e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE 0x00000020 292e2f7a777SLen Brown #define ACPI_BTYPE_EVENT 0x00000040 293e2f7a777SLen Brown #define ACPI_BTYPE_METHOD 0x00000080 294e2f7a777SLen Brown #define ACPI_BTYPE_MUTEX 0x00000100 295e2f7a777SLen Brown #define ACPI_BTYPE_REGION 0x00000200 296e2f7a777SLen Brown #define ACPI_BTYPE_POWER 0x00000400 297e2f7a777SLen Brown #define ACPI_BTYPE_PROCESSOR 0x00000800 298e2f7a777SLen Brown #define ACPI_BTYPE_THERMAL 0x00001000 299e2f7a777SLen Brown #define ACPI_BTYPE_BUFFER_FIELD 0x00002000 300e2f7a777SLen Brown #define ACPI_BTYPE_DDB_HANDLE 0x00004000 301e2f7a777SLen Brown #define ACPI_BTYPE_DEBUG_OBJECT 0x00008000 302e2f7a777SLen Brown #define ACPI_BTYPE_REFERENCE 0x00010000 303e2f7a777SLen Brown #define ACPI_BTYPE_RESOURCE 0x00020000 304e2f7a777SLen Brown 305e2f7a777SLen Brown #define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER) 306e2f7a777SLen Brown 307e2f7a777SLen Brown #define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE) 308e2f7a777SLen Brown #define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE) 309e2f7a777SLen Brown #define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR) 310e2f7a777SLen Brown #define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */ 311e2f7a777SLen Brown #define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF 312e2f7a777SLen Brown 313e2f7a777SLen Brown /* 314e2f7a777SLen Brown * Information structure for ACPI predefined names. 315e2f7a777SLen Brown * Each entry in the table contains the following items: 316e2f7a777SLen Brown * 317e2f7a777SLen Brown * Name - The ACPI reserved name 318e2f7a777SLen Brown * param_count - Number of arguments to the method 319e2f7a777SLen Brown * expected_return_btypes - Allowed type(s) for the return value 320e2f7a777SLen Brown */ 321e2f7a777SLen Brown struct acpi_name_info { 322e2f7a777SLen Brown char name[ACPI_NAME_SIZE]; 323e2f7a777SLen Brown u8 param_count; 324e2f7a777SLen Brown u8 expected_btypes; 325e2f7a777SLen Brown }; 326e2f7a777SLen Brown 327e2f7a777SLen Brown /* 328e2f7a777SLen Brown * Secondary information structures for ACPI predefined objects that return 329e2f7a777SLen Brown * package objects. This structure appears as the next entry in the table 330e2f7a777SLen Brown * after the NAME_INFO structure above. 331e2f7a777SLen Brown * 332e2f7a777SLen Brown * The reason for this is to minimize the size of the predefined name table. 333e2f7a777SLen Brown */ 334e2f7a777SLen Brown 335e2f7a777SLen Brown /* 336e2f7a777SLen Brown * Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2, 337e2f7a777SLen Brown * ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT 338e2f7a777SLen Brown */ 339e2f7a777SLen Brown struct acpi_package_info { 340e2f7a777SLen Brown u8 type; 341e2f7a777SLen Brown u8 object_type1; 342e2f7a777SLen Brown u8 count1; 343e2f7a777SLen Brown u8 object_type2; 344e2f7a777SLen Brown u8 count2; 345e2f7a777SLen Brown u8 reserved; 346e2f7a777SLen Brown }; 347e2f7a777SLen Brown 348e2f7a777SLen Brown /* Used for ACPI_PTYPE2_FIXED */ 349e2f7a777SLen Brown 350e2f7a777SLen Brown struct acpi_package_info2 { 351e2f7a777SLen Brown u8 type; 352e2f7a777SLen Brown u8 count; 353e2f7a777SLen Brown u8 object_type[4]; 354e2f7a777SLen Brown }; 355e2f7a777SLen Brown 356e2f7a777SLen Brown /* Used for ACPI_PTYPE1_OPTION */ 357e2f7a777SLen Brown 358e2f7a777SLen Brown struct acpi_package_info3 { 359e2f7a777SLen Brown u8 type; 360e2f7a777SLen Brown u8 count; 361e2f7a777SLen Brown u8 object_type[2]; 362e2f7a777SLen Brown u8 tail_object_type; 363e2f7a777SLen Brown u8 reserved; 364e2f7a777SLen Brown }; 365e2f7a777SLen Brown 366e2f7a777SLen Brown union acpi_predefined_info { 367e2f7a777SLen Brown struct acpi_name_info info; 368e2f7a777SLen Brown struct acpi_package_info ret_info; 369e2f7a777SLen Brown struct acpi_package_info2 ret_info2; 370e2f7a777SLen Brown struct acpi_package_info3 ret_info3; 371e2f7a777SLen Brown }; 372e2f7a777SLen Brown 3730444e8f6SBob Moore /* Data block used during object validation */ 3740444e8f6SBob Moore 3750444e8f6SBob Moore struct acpi_predefined_data { 3760444e8f6SBob Moore char *pathname; 3770444e8f6SBob Moore const union acpi_predefined_info *predefined; 378091f4d71SBob Moore union acpi_operand_object *parent_package; 3790444e8f6SBob Moore u32 flags; 3800444e8f6SBob Moore u8 node_flags; 3810444e8f6SBob Moore }; 3820444e8f6SBob Moore 3830444e8f6SBob Moore /* Defines for Flags field above */ 3840444e8f6SBob Moore 3850444e8f6SBob Moore #define ACPI_OBJECT_REPAIRED 1 3860444e8f6SBob Moore 387e2f7a777SLen Brown /* 388e2f7a777SLen Brown * Bitmapped return value types 389e2f7a777SLen Brown * Note: the actual data types must be contiguous, a loop in nspredef.c 390e2f7a777SLen Brown * depends on this. 391e2f7a777SLen Brown */ 392e2f7a777SLen Brown #define ACPI_RTYPE_ANY 0x00 393e2f7a777SLen Brown #define ACPI_RTYPE_NONE 0x01 394e2f7a777SLen Brown #define ACPI_RTYPE_INTEGER 0x02 395e2f7a777SLen Brown #define ACPI_RTYPE_STRING 0x04 396e2f7a777SLen Brown #define ACPI_RTYPE_BUFFER 0x08 397e2f7a777SLen Brown #define ACPI_RTYPE_PACKAGE 0x10 398e2f7a777SLen Brown #define ACPI_RTYPE_REFERENCE 0x20 399e2f7a777SLen Brown #define ACPI_RTYPE_ALL 0x3F 400e2f7a777SLen Brown 401e2f7a777SLen Brown #define ACPI_NUM_RTYPES 5 /* Number of actual object types */ 402e2f7a777SLen Brown 403e2f7a777SLen Brown /***************************************************************************** 404e2f7a777SLen Brown * 405e2f7a777SLen Brown * Event typedefs and structs 406e2f7a777SLen Brown * 407e2f7a777SLen Brown ****************************************************************************/ 408e2f7a777SLen Brown 409e2f7a777SLen Brown /* Dispatch info for each GPE -- either a method or handler, cannot be both */ 410e2f7a777SLen Brown 411e2f7a777SLen Brown struct acpi_handler_info { 412e2f7a777SLen Brown acpi_event_handler address; /* Address of handler, if any */ 413e2f7a777SLen Brown void *context; /* Context to be passed to handler */ 414e2f7a777SLen Brown struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */ 41528f4f8a9SRafael J. Wysocki u8 orig_flags; /* Original misc info about this GPE */ 416e2f7a777SLen Brown }; 417e2f7a777SLen Brown 418e2f7a777SLen Brown union acpi_gpe_dispatch_info { 419e2f7a777SLen Brown struct acpi_namespace_node *method_node; /* Method node for this GPE level */ 420e2f7a777SLen Brown struct acpi_handler_info *handler; 421e2f7a777SLen Brown }; 422e2f7a777SLen Brown 423e2f7a777SLen Brown /* 424e2f7a777SLen Brown * Information about a GPE, one per each GPE in an array. 425e2f7a777SLen Brown * NOTE: Important to keep this struct as small as possible. 426e2f7a777SLen Brown */ 427e2f7a777SLen Brown struct acpi_gpe_event_info { 428e2f7a777SLen Brown union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */ 429e2f7a777SLen Brown struct acpi_gpe_register_info *register_info; /* Backpointer to register info */ 430e2f7a777SLen Brown u8 flags; /* Misc info about this GPE */ 431e2f7a777SLen Brown u8 gpe_number; /* This GPE */ 4320f849d2cSLin Ming u8 runtime_count; /* References to a run GPE */ 433e2f7a777SLen Brown }; 434e2f7a777SLen Brown 435e2f7a777SLen Brown /* Information about a GPE register pair, one per each status/enable pair in an array */ 436e2f7a777SLen Brown 437e2f7a777SLen Brown struct acpi_gpe_register_info { 438e2f7a777SLen Brown struct acpi_generic_address status_address; /* Address of status reg */ 439e2f7a777SLen Brown struct acpi_generic_address enable_address; /* Address of enable reg */ 440e2f7a777SLen Brown u8 enable_for_wake; /* GPEs to keep enabled when sleeping */ 441e2f7a777SLen Brown u8 enable_for_run; /* GPEs to keep enabled when running */ 442e2f7a777SLen Brown u8 base_gpe_number; /* Base GPE number for this register */ 443e2f7a777SLen Brown }; 444e2f7a777SLen Brown 445e2f7a777SLen Brown /* 446e2f7a777SLen Brown * Information about a GPE register block, one per each installed block -- 447e2f7a777SLen Brown * GPE0, GPE1, and one per each installed GPE Block Device. 448e2f7a777SLen Brown */ 449e2f7a777SLen Brown struct acpi_gpe_block_info { 450e2f7a777SLen Brown struct acpi_namespace_node *node; 451e2f7a777SLen Brown struct acpi_gpe_block_info *previous; 452e2f7a777SLen Brown struct acpi_gpe_block_info *next; 453e2f7a777SLen Brown struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */ 454e2f7a777SLen Brown struct acpi_gpe_register_info *register_info; /* One per GPE register pair */ 455e2f7a777SLen Brown struct acpi_gpe_event_info *event_info; /* One for each GPE */ 456e2f7a777SLen Brown struct acpi_generic_address block_address; /* Base address of the block */ 457e2f7a777SLen Brown u32 register_count; /* Number of register pairs in block */ 4580f849d2cSLin Ming u16 gpe_count; /* Number of individual GPEs in block */ 459e2f7a777SLen Brown u8 block_base_number; /* Base GPE number for this block */ 460e2f7a777SLen Brown }; 461e2f7a777SLen Brown 462e2f7a777SLen Brown /* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */ 463e2f7a777SLen Brown 464e2f7a777SLen Brown struct acpi_gpe_xrupt_info { 465e2f7a777SLen Brown struct acpi_gpe_xrupt_info *previous; 466e2f7a777SLen Brown struct acpi_gpe_xrupt_info *next; 467e2f7a777SLen Brown struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */ 468e2f7a777SLen Brown u32 interrupt_number; /* System interrupt number */ 469e2f7a777SLen Brown }; 470e2f7a777SLen Brown 471e2f7a777SLen Brown struct acpi_gpe_walk_info { 472e2f7a777SLen Brown struct acpi_namespace_node *gpe_device; 473e2f7a777SLen Brown struct acpi_gpe_block_info *gpe_block; 474186c307fSBob Moore u16 count; 475186c307fSBob Moore acpi_owner_id owner_id; 476186c307fSBob Moore u8 enable_this_gpe; 477186c307fSBob Moore u8 execute_by_owner_id; 478e2f7a777SLen Brown }; 479e2f7a777SLen Brown 480e2f7a777SLen Brown struct acpi_gpe_device_info { 481e2f7a777SLen Brown u32 index; 482e2f7a777SLen Brown u32 next_block_base_index; 483e2f7a777SLen Brown acpi_status status; 484e2f7a777SLen Brown struct acpi_namespace_node *gpe_device; 485e2f7a777SLen Brown }; 486e2f7a777SLen Brown 487e2f7a777SLen Brown typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info, 488e2f7a777SLen Brown struct acpi_gpe_block_info *gpe_block, void *context); 489e2f7a777SLen Brown 490e2f7a777SLen Brown /* Information about each particular fixed event */ 491e2f7a777SLen Brown 492e2f7a777SLen Brown struct acpi_fixed_event_handler { 493e2f7a777SLen Brown acpi_event_handler handler; /* Address of handler. */ 494e2f7a777SLen Brown void *context; /* Context to be passed to handler */ 495e2f7a777SLen Brown }; 496e2f7a777SLen Brown 497e2f7a777SLen Brown struct acpi_fixed_event_info { 498e2f7a777SLen Brown u8 status_register_id; 499e2f7a777SLen Brown u8 enable_register_id; 500e2f7a777SLen Brown u16 status_bit_mask; 501e2f7a777SLen Brown u16 enable_bit_mask; 502e2f7a777SLen Brown }; 503e2f7a777SLen Brown 504e2f7a777SLen Brown /* Information used during field processing */ 505e2f7a777SLen Brown 506e2f7a777SLen Brown struct acpi_field_info { 507e2f7a777SLen Brown u8 skip_field; 508e2f7a777SLen Brown u8 field_flag; 509e2f7a777SLen Brown u32 pkg_length; 510e2f7a777SLen Brown }; 511e2f7a777SLen Brown 512e2f7a777SLen Brown /***************************************************************************** 513e2f7a777SLen Brown * 514e2f7a777SLen Brown * Generic "state" object for stacks 515e2f7a777SLen Brown * 516e2f7a777SLen Brown ****************************************************************************/ 517e2f7a777SLen Brown 518e2f7a777SLen Brown #define ACPI_CONTROL_NORMAL 0xC0 519e2f7a777SLen Brown #define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1 520e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2 521e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_FALSE 0xC3 522e2f7a777SLen Brown #define ACPI_CONTROL_PREDICATE_TRUE 0xC4 523e2f7a777SLen Brown 524e2f7a777SLen Brown #define ACPI_STATE_COMMON \ 525e2f7a777SLen Brown void *next; \ 526e2f7a777SLen Brown u8 descriptor_type; /* To differentiate various internal objs */\ 527e2f7a777SLen Brown u8 flags; \ 528e2f7a777SLen Brown u16 value; \ 529e2f7a777SLen Brown u16 state; 530e2f7a777SLen Brown 531e2f7a777SLen Brown /* There are 2 bytes available here until the next natural alignment boundary */ 532e2f7a777SLen Brown 533e2f7a777SLen Brown struct acpi_common_state { 534e2f7a777SLen Brown ACPI_STATE_COMMON}; 535e2f7a777SLen Brown 536e2f7a777SLen Brown /* 537e2f7a777SLen Brown * Update state - used to traverse complex objects such as packages 538e2f7a777SLen Brown */ 539e2f7a777SLen Brown struct acpi_update_state { 540e2f7a777SLen Brown ACPI_STATE_COMMON union acpi_operand_object *object; 541e2f7a777SLen Brown }; 542e2f7a777SLen Brown 543e2f7a777SLen Brown /* 544e2f7a777SLen Brown * Pkg state - used to traverse nested package structures 545e2f7a777SLen Brown */ 546e2f7a777SLen Brown struct acpi_pkg_state { 547e2f7a777SLen Brown ACPI_STATE_COMMON u16 index; 548e2f7a777SLen Brown union acpi_operand_object *source_object; 549e2f7a777SLen Brown union acpi_operand_object *dest_object; 550e2f7a777SLen Brown struct acpi_walk_state *walk_state; 551e2f7a777SLen Brown void *this_target_obj; 552e2f7a777SLen Brown u32 num_packages; 553e2f7a777SLen Brown }; 554e2f7a777SLen Brown 555e2f7a777SLen Brown /* 556e2f7a777SLen Brown * Control state - one per if/else and while constructs. 557e2f7a777SLen Brown * Allows nesting of these constructs 558e2f7a777SLen Brown */ 559e2f7a777SLen Brown struct acpi_control_state { 560e2f7a777SLen Brown ACPI_STATE_COMMON u16 opcode; 561e2f7a777SLen Brown union acpi_parse_object *predicate_op; 562e2f7a777SLen Brown u8 *aml_predicate_start; /* Start of if/while predicate */ 563e2f7a777SLen Brown u8 *package_end; /* End of if/while block */ 564e2f7a777SLen Brown u32 loop_count; /* While() loop counter */ 565e2f7a777SLen Brown }; 566e2f7a777SLen Brown 567e2f7a777SLen Brown /* 568e2f7a777SLen Brown * Scope state - current scope during namespace lookups 569e2f7a777SLen Brown */ 570e2f7a777SLen Brown struct acpi_scope_state { 571e2f7a777SLen Brown ACPI_STATE_COMMON struct acpi_namespace_node *node; 572e2f7a777SLen Brown }; 573e2f7a777SLen Brown 574e2f7a777SLen Brown struct acpi_pscope_state { 575e2f7a777SLen Brown ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */ 576e2f7a777SLen Brown union acpi_parse_object *op; /* Current op being parsed */ 577e2f7a777SLen Brown u8 *arg_end; /* Current argument end */ 578e2f7a777SLen Brown u8 *pkg_end; /* Current package end */ 579e2f7a777SLen Brown u32 arg_list; /* Next argument to parse */ 580e2f7a777SLen Brown }; 581e2f7a777SLen Brown 582e2f7a777SLen Brown /* 583e2f7a777SLen Brown * Thread state - one per thread across multiple walk states. Multiple walk 584e2f7a777SLen Brown * states are created when there are nested control methods executing. 585e2f7a777SLen Brown */ 586e2f7a777SLen Brown struct acpi_thread_state { 587e2f7a777SLen Brown ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */ 588e2f7a777SLen Brown struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */ 589e2f7a777SLen Brown union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */ 590e2f7a777SLen Brown acpi_thread_id thread_id; /* Running thread ID */ 591e2f7a777SLen Brown }; 592e2f7a777SLen Brown 593e2f7a777SLen Brown /* 594e2f7a777SLen Brown * Result values - used to accumulate the results of nested 595e2f7a777SLen Brown * AML arguments 596e2f7a777SLen Brown */ 597e2f7a777SLen Brown struct acpi_result_values { 598e2f7a777SLen Brown ACPI_STATE_COMMON 599e2f7a777SLen Brown union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM]; 600e2f7a777SLen Brown }; 601e2f7a777SLen Brown 602e2f7a777SLen Brown typedef 603e2f7a777SLen Brown acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state, 604e2f7a777SLen Brown union acpi_parse_object ** out_op); 605e2f7a777SLen Brown 606e2f7a777SLen Brown typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state); 607e2f7a777SLen Brown 608e2f7a777SLen Brown /* 609e2f7a777SLen Brown * Notify info - used to pass info to the deferred notify 610e2f7a777SLen Brown * handler/dispatcher. 611e2f7a777SLen Brown */ 612e2f7a777SLen Brown struct acpi_notify_info { 613e2f7a777SLen Brown ACPI_STATE_COMMON struct acpi_namespace_node *node; 614e2f7a777SLen Brown union acpi_operand_object *handler_obj; 615e2f7a777SLen Brown }; 616e2f7a777SLen Brown 617e2f7a777SLen Brown /* Generic state is union of structs above */ 618e2f7a777SLen Brown 619e2f7a777SLen Brown union acpi_generic_state { 620e2f7a777SLen Brown struct acpi_common_state common; 621e2f7a777SLen Brown struct acpi_control_state control; 622e2f7a777SLen Brown struct acpi_update_state update; 623e2f7a777SLen Brown struct acpi_scope_state scope; 624e2f7a777SLen Brown struct acpi_pscope_state parse_scope; 625e2f7a777SLen Brown struct acpi_pkg_state pkg; 626e2f7a777SLen Brown struct acpi_thread_state thread; 627e2f7a777SLen Brown struct acpi_result_values results; 628e2f7a777SLen Brown struct acpi_notify_info notify; 629e2f7a777SLen Brown }; 630e2f7a777SLen Brown 631e2f7a777SLen Brown /***************************************************************************** 632e2f7a777SLen Brown * 633e2f7a777SLen Brown * Interpreter typedefs and structs 634e2f7a777SLen Brown * 635e2f7a777SLen Brown ****************************************************************************/ 636e2f7a777SLen Brown 637e2f7a777SLen Brown typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state); 638e2f7a777SLen Brown 639e2f7a777SLen Brown /***************************************************************************** 640e2f7a777SLen Brown * 641e2f7a777SLen Brown * Parser typedefs and structs 642e2f7a777SLen Brown * 643e2f7a777SLen Brown ****************************************************************************/ 644e2f7a777SLen Brown 645e2f7a777SLen Brown /* 646e2f7a777SLen Brown * AML opcode, name, and argument layout 647e2f7a777SLen Brown */ 648e2f7a777SLen Brown struct acpi_opcode_info { 649e2f7a777SLen Brown #if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT) 650e2f7a777SLen Brown char *name; /* Opcode name (disassembler/debug only) */ 651e2f7a777SLen Brown #endif 652e2f7a777SLen Brown u32 parse_args; /* Grammar/Parse time arguments */ 653e2f7a777SLen Brown u32 runtime_args; /* Interpret time arguments */ 654e2f7a777SLen Brown u16 flags; /* Misc flags */ 655e2f7a777SLen Brown u8 object_type; /* Corresponding internal object type */ 656e2f7a777SLen Brown u8 class; /* Opcode class */ 657e2f7a777SLen Brown u8 type; /* Opcode type */ 658e2f7a777SLen Brown }; 659e2f7a777SLen Brown 660e2f7a777SLen Brown union acpi_parse_value { 6615df7e6cbSBob Moore u64 integer; /* Integer constant (Up to 64 bits) */ 662e2f7a777SLen Brown u32 size; /* bytelist or field size */ 663e2f7a777SLen Brown char *string; /* NULL terminated string */ 664e2f7a777SLen Brown u8 *buffer; /* buffer or string */ 665e2f7a777SLen Brown char *name; /* NULL terminated string */ 666e2f7a777SLen Brown union acpi_parse_object *arg; /* arguments and contained ops */ 667e2f7a777SLen Brown }; 668e2f7a777SLen Brown 669e2f7a777SLen Brown #ifdef ACPI_DISASSEMBLER 670e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a) a; 671e2f7a777SLen Brown #else 672e2f7a777SLen Brown #define ACPI_DISASM_ONLY_MEMBERS(a) 673e2f7a777SLen Brown #endif 674e2f7a777SLen Brown 675e2f7a777SLen Brown #define ACPI_PARSE_COMMON \ 676e2f7a777SLen Brown union acpi_parse_object *parent; /* Parent op */\ 677e2f7a777SLen Brown u8 descriptor_type; /* To differentiate various internal objs */\ 678e2f7a777SLen Brown u8 flags; /* Type of Op */\ 679e2f7a777SLen Brown u16 aml_opcode; /* AML opcode */\ 680e2f7a777SLen Brown u32 aml_offset; /* Offset of declaration in AML */\ 681e2f7a777SLen Brown union acpi_parse_object *next; /* Next op */\ 682e2f7a777SLen Brown struct acpi_namespace_node *node; /* For use by interpreter */\ 683e2f7a777SLen Brown union acpi_parse_value value; /* Value or args associated with the opcode */\ 684e2f7a777SLen Brown u8 arg_list_length; /* Number of elements in the arg list */\ 685e2f7a777SLen Brown ACPI_DISASM_ONLY_MEMBERS (\ 686e2f7a777SLen Brown u8 disasm_flags; /* Used during AML disassembly */\ 687e2f7a777SLen Brown u8 disasm_opcode; /* Subtype used for disassembly */\ 688e2f7a777SLen Brown char aml_op_name[16]) /* Op name (debug only) */ 689e2f7a777SLen Brown 690e2f7a777SLen Brown #define ACPI_DASM_BUFFER 0x00 691e2f7a777SLen Brown #define ACPI_DASM_RESOURCE 0x01 692e2f7a777SLen Brown #define ACPI_DASM_STRING 0x02 693e2f7a777SLen Brown #define ACPI_DASM_UNICODE 0x03 694e2f7a777SLen Brown #define ACPI_DASM_EISAID 0x04 695e2f7a777SLen Brown #define ACPI_DASM_MATCHOP 0x05 696e2f7a777SLen Brown #define ACPI_DASM_LNOT_PREFIX 0x06 697e2f7a777SLen Brown #define ACPI_DASM_LNOT_SUFFIX 0x07 698e2f7a777SLen Brown #define ACPI_DASM_IGNORE 0x08 699e2f7a777SLen Brown 700e2f7a777SLen Brown /* 701e2f7a777SLen Brown * Generic operation (for example: If, While, Store) 702e2f7a777SLen Brown */ 703e2f7a777SLen Brown struct acpi_parse_obj_common { 704e2f7a777SLen Brown ACPI_PARSE_COMMON}; 705e2f7a777SLen Brown 706e2f7a777SLen Brown /* 707e2f7a777SLen Brown * Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions), 708e2f7a777SLen Brown * and bytelists. 709e2f7a777SLen Brown */ 710e2f7a777SLen Brown struct acpi_parse_obj_named { 711e2f7a777SLen Brown ACPI_PARSE_COMMON u8 *path; 712e2f7a777SLen Brown u8 *data; /* AML body or bytelist data */ 713e2f7a777SLen Brown u32 length; /* AML length */ 714e2f7a777SLen Brown u32 name; /* 4-byte name or zero if no name */ 715e2f7a777SLen Brown }; 716e2f7a777SLen Brown 717e2f7a777SLen Brown /* This version is used by the i_aSL compiler only */ 718e2f7a777SLen Brown 719e2f7a777SLen Brown #define ACPI_MAX_PARSEOP_NAME 20 720e2f7a777SLen Brown 721e2f7a777SLen Brown struct acpi_parse_obj_asl { 722e2f7a777SLen Brown ACPI_PARSE_COMMON union acpi_parse_object *child; 723e2f7a777SLen Brown union acpi_parse_object *parent_method; 724e2f7a777SLen Brown char *filename; 725e2f7a777SLen Brown char *external_name; 726e2f7a777SLen Brown char *namepath; 727e2f7a777SLen Brown char name_seg[4]; 728e2f7a777SLen Brown u32 extra_value; 729e2f7a777SLen Brown u32 column; 730e2f7a777SLen Brown u32 line_number; 731e2f7a777SLen Brown u32 logical_line_number; 732e2f7a777SLen Brown u32 logical_byte_offset; 733e2f7a777SLen Brown u32 end_line; 734e2f7a777SLen Brown u32 end_logical_line; 735e2f7a777SLen Brown u32 acpi_btype; 736e2f7a777SLen Brown u32 aml_length; 737e2f7a777SLen Brown u32 aml_subtree_length; 738e2f7a777SLen Brown u32 final_aml_length; 739e2f7a777SLen Brown u32 final_aml_offset; 740e2f7a777SLen Brown u32 compile_flags; 741e2f7a777SLen Brown u16 parse_opcode; 742e2f7a777SLen Brown u8 aml_opcode_length; 743e2f7a777SLen Brown u8 aml_pkg_len_bytes; 744e2f7a777SLen Brown u8 extra; 745e2f7a777SLen Brown char parse_op_name[ACPI_MAX_PARSEOP_NAME]; 746e2f7a777SLen Brown }; 747e2f7a777SLen Brown 748e2f7a777SLen Brown union acpi_parse_object { 749e2f7a777SLen Brown struct acpi_parse_obj_common common; 750e2f7a777SLen Brown struct acpi_parse_obj_named named; 751e2f7a777SLen Brown struct acpi_parse_obj_asl asl; 752e2f7a777SLen Brown }; 753e2f7a777SLen Brown 754e2f7a777SLen Brown /* 755e2f7a777SLen Brown * Parse state - one state per parser invocation and each control 756e2f7a777SLen Brown * method. 757e2f7a777SLen Brown */ 758e2f7a777SLen Brown struct acpi_parse_state { 759e2f7a777SLen Brown u8 *aml_start; /* First AML byte */ 760e2f7a777SLen Brown u8 *aml; /* Next AML byte */ 761e2f7a777SLen Brown u8 *aml_end; /* (last + 1) AML byte */ 762e2f7a777SLen Brown u8 *pkg_start; /* Current package begin */ 763e2f7a777SLen Brown u8 *pkg_end; /* Current package end */ 764e2f7a777SLen Brown union acpi_parse_object *start_op; /* Root of parse tree */ 765e2f7a777SLen Brown struct acpi_namespace_node *start_node; 766e2f7a777SLen Brown union acpi_generic_state *scope; /* Current scope */ 767e2f7a777SLen Brown union acpi_parse_object *start_scope; 768e2f7a777SLen Brown u32 aml_size; 769e2f7a777SLen Brown }; 770e2f7a777SLen Brown 771e2f7a777SLen Brown /* Parse object flags */ 772e2f7a777SLen Brown 773e2f7a777SLen Brown #define ACPI_PARSEOP_GENERIC 0x01 774e2f7a777SLen Brown #define ACPI_PARSEOP_NAMED 0x02 775e2f7a777SLen Brown #define ACPI_PARSEOP_DEFERRED 0x04 776e2f7a777SLen Brown #define ACPI_PARSEOP_BYTELIST 0x08 777e2f7a777SLen Brown #define ACPI_PARSEOP_IN_STACK 0x10 778e2f7a777SLen Brown #define ACPI_PARSEOP_TARGET 0x20 779e2f7a777SLen Brown #define ACPI_PARSEOP_IN_CACHE 0x80 780e2f7a777SLen Brown 781e2f7a777SLen Brown /* Parse object disasm_flags */ 782e2f7a777SLen Brown 783e2f7a777SLen Brown #define ACPI_PARSEOP_IGNORE 0x01 784e2f7a777SLen Brown #define ACPI_PARSEOP_PARAMLIST 0x02 785e2f7a777SLen Brown #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 786e2f7a777SLen Brown #define ACPI_PARSEOP_SPECIAL 0x10 787e2f7a777SLen Brown 788e2f7a777SLen Brown /***************************************************************************** 789e2f7a777SLen Brown * 790e2f7a777SLen Brown * Hardware (ACPI registers) and PNP 791e2f7a777SLen Brown * 792e2f7a777SLen Brown ****************************************************************************/ 793e2f7a777SLen Brown 794e2f7a777SLen Brown struct acpi_bit_register_info { 795e2f7a777SLen Brown u8 parent_register; 796e2f7a777SLen Brown u8 bit_position; 797e2f7a777SLen Brown u16 access_bit_mask; 798e2f7a777SLen Brown }; 799e2f7a777SLen Brown 800e2f7a777SLen Brown /* 801e2f7a777SLen Brown * Some ACPI registers have bits that must be ignored -- meaning that they 802e2f7a777SLen Brown * must be preserved. 803e2f7a777SLen Brown */ 804e2f7a777SLen Brown #define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */ 80520869dcfSBob Moore 806c3dd25f4SLin Ming /* Write-only bits must be zeroed by software */ 807c3dd25f4SLin Ming 808c3dd25f4SLin Ming #define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */ 809c3dd25f4SLin Ming 81020869dcfSBob Moore /* For control registers, both ignored and reserved bits must be preserved */ 81120869dcfSBob Moore 812975b3c47SLin Ming /* 813b1cd843bSBob Moore * For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the 814b1cd843bSBob Moore * ACPI specification to be a "preserved" bit - "OSPM always preserves this 815b1cd843bSBob Moore * bit position", section 4.7.3.2.1. However, on some machines the OS must 816b1cd843bSBob Moore * write a one to this bit after resume for the machine to work properly. 817b1cd843bSBob Moore * To enable this, we no longer attempt to preserve this bit. No machines 818b1cd843bSBob Moore * are known to fail if the bit is not preserved. (May 2009) 819975b3c47SLin Ming */ 820b1cd843bSBob Moore #define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */ 82120869dcfSBob Moore #define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */ 82220869dcfSBob Moore #define ACPI_PM1_CONTROL_PRESERVED_BITS \ 82320869dcfSBob Moore (ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS) 82420869dcfSBob Moore 82520869dcfSBob Moore #define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */ 826e2f7a777SLen Brown 827e2f7a777SLen Brown /* 828e2f7a777SLen Brown * Register IDs 829e2f7a777SLen Brown * These are the full ACPI registers 830e2f7a777SLen Brown */ 831e2f7a777SLen Brown #define ACPI_REGISTER_PM1_STATUS 0x01 832e2f7a777SLen Brown #define ACPI_REGISTER_PM1_ENABLE 0x02 833e2f7a777SLen Brown #define ACPI_REGISTER_PM1_CONTROL 0x03 83432c9ef99SBob Moore #define ACPI_REGISTER_PM2_CONTROL 0x04 83532c9ef99SBob Moore #define ACPI_REGISTER_PM_TIMER 0x05 83632c9ef99SBob Moore #define ACPI_REGISTER_PROCESSOR_BLOCK 0x06 83732c9ef99SBob Moore #define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07 838e2f7a777SLen Brown 839e2f7a777SLen Brown /* Masks used to access the bit_registers */ 840e2f7a777SLen Brown 841e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_STATUS 0x0001 842e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010 843e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020 844e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100 845e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200 846e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400 847e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */ 848e2f7a777SLen Brown #define ACPI_BITMASK_WAKE_STATUS 0x8000 849e2f7a777SLen Brown 850e2f7a777SLen Brown #define ACPI_BITMASK_ALL_FIXED_STATUS (\ 851e2f7a777SLen Brown ACPI_BITMASK_TIMER_STATUS | \ 852e2f7a777SLen Brown ACPI_BITMASK_BUS_MASTER_STATUS | \ 853e2f7a777SLen Brown ACPI_BITMASK_GLOBAL_LOCK_STATUS | \ 854e2f7a777SLen Brown ACPI_BITMASK_POWER_BUTTON_STATUS | \ 855e2f7a777SLen Brown ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ 856e2f7a777SLen Brown ACPI_BITMASK_RT_CLOCK_STATUS | \ 857*49b3c1e0SColin Ian King ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ 858e2f7a777SLen Brown ACPI_BITMASK_WAKE_STATUS) 859e2f7a777SLen Brown 860e2f7a777SLen Brown #define ACPI_BITMASK_TIMER_ENABLE 0x0001 861e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020 862e2f7a777SLen Brown #define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100 863e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200 864e2f7a777SLen Brown #define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400 865e2f7a777SLen Brown #define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */ 866e2f7a777SLen Brown 867e2f7a777SLen Brown #define ACPI_BITMASK_SCI_ENABLE 0x0001 868e2f7a777SLen Brown #define ACPI_BITMASK_BUS_MASTER_RLD 0x0002 869e2f7a777SLen Brown #define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004 87082d79b86SBob Moore #define ACPI_BITMASK_SLEEP_TYPE 0x1C00 871e2f7a777SLen Brown #define ACPI_BITMASK_SLEEP_ENABLE 0x2000 872e2f7a777SLen Brown 873e2f7a777SLen Brown #define ACPI_BITMASK_ARB_DISABLE 0x0001 874e2f7a777SLen Brown 875e2f7a777SLen Brown /* Raw bit position of each bit_register */ 876e2f7a777SLen Brown 877e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_STATUS 0x00 878e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04 879e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05 880e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08 881e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09 882e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A 883e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */ 884e2f7a777SLen Brown #define ACPI_BITPOSITION_WAKE_STATUS 0x0F 885e2f7a777SLen Brown 886e2f7a777SLen Brown #define ACPI_BITPOSITION_TIMER_ENABLE 0x00 887e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05 888e2f7a777SLen Brown #define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08 889e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09 890e2f7a777SLen Brown #define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A 891e2f7a777SLen Brown #define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */ 892e2f7a777SLen Brown 893e2f7a777SLen Brown #define ACPI_BITPOSITION_SCI_ENABLE 0x00 894e2f7a777SLen Brown #define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01 895e2f7a777SLen Brown #define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02 89682d79b86SBob Moore #define ACPI_BITPOSITION_SLEEP_TYPE 0x0A 897e2f7a777SLen Brown #define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D 898e2f7a777SLen Brown 899e2f7a777SLen Brown #define ACPI_BITPOSITION_ARB_DISABLE 0x00 900e2f7a777SLen Brown 9017f071903SBob Moore /* Structs and definitions for _OSI support and I/O port validation */ 9027f071903SBob Moore 9037f071903SBob Moore #define ACPI_OSI_WIN_2000 0x01 9047f071903SBob Moore #define ACPI_OSI_WIN_XP 0x02 9057f071903SBob Moore #define ACPI_OSI_WIN_XP_SP1 0x03 9067f071903SBob Moore #define ACPI_OSI_WINSRV_2003 0x04 9077f071903SBob Moore #define ACPI_OSI_WIN_XP_SP2 0x05 9087f071903SBob Moore #define ACPI_OSI_WINSRV_2003_SP1 0x06 9097f071903SBob Moore #define ACPI_OSI_WIN_VISTA 0x07 910eb752552SBob Moore #define ACPI_OSI_WINSRV_2008 0x08 911eb752552SBob Moore #define ACPI_OSI_WIN_VISTA_SP1 0x09 91223ebbf07SBob Moore #define ACPI_OSI_WIN_VISTA_SP2 0x0A 91323ebbf07SBob Moore #define ACPI_OSI_WIN_7 0x0B 9147f071903SBob Moore 9157f071903SBob Moore #define ACPI_ALWAYS_ILLEGAL 0x00 9167f071903SBob Moore 9177f071903SBob Moore struct acpi_interface_info { 9187f071903SBob Moore char *name; 919b0ed7a91SLin Ming struct acpi_interface_info *next; 920b0ed7a91SLin Ming u8 flags; 9217f071903SBob Moore u8 value; 9227f071903SBob Moore }; 9237f071903SBob Moore 924b0ed7a91SLin Ming #define ACPI_OSI_INVALID 0x01 925b0ed7a91SLin Ming #define ACPI_OSI_DYNAMIC 0x02 926b0ed7a91SLin Ming 9277f071903SBob Moore struct acpi_port_info { 9287f071903SBob Moore char *name; 9297f071903SBob Moore u16 start; 9307f071903SBob Moore u16 end; 9317f071903SBob Moore u8 osi_dependency; 9327f071903SBob Moore }; 9337f071903SBob Moore 934e2f7a777SLen Brown /***************************************************************************** 935e2f7a777SLen Brown * 936e2f7a777SLen Brown * Resource descriptors 937e2f7a777SLen Brown * 938e2f7a777SLen Brown ****************************************************************************/ 939e2f7a777SLen Brown 940e2f7a777SLen Brown /* resource_type values */ 941e2f7a777SLen Brown 942e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0 943e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_IO_RANGE 1 944e2f7a777SLen Brown #define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2 945e2f7a777SLen Brown 946e2f7a777SLen Brown /* Resource descriptor types and masks */ 947e2f7a777SLen Brown 948e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE 0x80 949e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL 0x00 950e2f7a777SLen Brown 951e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */ 952e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */ 953e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */ 954e2f7a777SLen Brown 955e2f7a777SLen Brown /* 956e2f7a777SLen Brown * Small resource descriptor "names" as defined by the ACPI specification. 957e2f7a777SLen Brown * Note: Bits 2:0 are used for the descriptor length 958e2f7a777SLen Brown */ 959e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IRQ 0x20 960e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_DMA 0x28 961e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30 962e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38 963e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_IO 0x40 964e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_IO 0x48 965e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S1 0x50 966e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S2 0x58 967e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S3 0x60 968e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_S4 0x68 969e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70 970e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_END_TAG 0x78 971e2f7a777SLen Brown 972e2f7a777SLen Brown /* 973e2f7a777SLen Brown * Large resource descriptor "names" as defined by the ACPI specification. 974e2f7a777SLen Brown * Note: includes the Large Descriptor bit in bit[7] 975e2f7a777SLen Brown */ 976e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY24 0x81 977e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82 978e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_RESERVED_L1 0x83 979e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84 980e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_MEMORY32 0x85 981e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86 982e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS32 0x87 983e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS16 0x88 984e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89 985e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A 986e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B 987e2f7a777SLen Brown #define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B 988e2f7a777SLen Brown 989e2f7a777SLen Brown /***************************************************************************** 990e2f7a777SLen Brown * 991e2f7a777SLen Brown * Miscellaneous 992e2f7a777SLen Brown * 993e2f7a777SLen Brown ****************************************************************************/ 994e2f7a777SLen Brown 995e2f7a777SLen Brown #define ACPI_ASCII_ZERO 0x30 996e2f7a777SLen Brown 997e2f7a777SLen Brown /***************************************************************************** 998e2f7a777SLen Brown * 999e2f7a777SLen Brown * Debugger 1000e2f7a777SLen Brown * 1001e2f7a777SLen Brown ****************************************************************************/ 1002e2f7a777SLen Brown 1003e2f7a777SLen Brown struct acpi_db_method_info { 1004e2f7a777SLen Brown acpi_handle main_thread_gate; 1005e2f7a777SLen Brown acpi_handle thread_complete_gate; 100628eb3fcfSLin Ming acpi_thread_id *threads; 1007e2f7a777SLen Brown u32 num_threads; 1008e2f7a777SLen Brown u32 num_created; 1009e2f7a777SLen Brown u32 num_completed; 1010e2f7a777SLen Brown 1011e2f7a777SLen Brown char *name; 1012e2f7a777SLen Brown u32 flags; 1013e2f7a777SLen Brown u32 num_loops; 1014e2f7a777SLen Brown char pathname[128]; 1015e2f7a777SLen Brown char **args; 1016e2f7a777SLen Brown 1017e2f7a777SLen Brown /* 1018e2f7a777SLen Brown * Arguments to be passed to method for the command 1019e2f7a777SLen Brown * Threads - 1020e2f7a777SLen Brown * the Number of threads, ID of current thread and 1021e2f7a777SLen Brown * Index of current thread inside all them created. 1022e2f7a777SLen Brown */ 1023e2f7a777SLen Brown char init_args; 1024e2f7a777SLen Brown char *arguments[4]; 1025e2f7a777SLen Brown char num_threads_str[11]; 1026e2f7a777SLen Brown char id_of_thread_str[11]; 1027e2f7a777SLen Brown char index_of_thread_str[11]; 1028e2f7a777SLen Brown }; 1029e2f7a777SLen Brown 1030e2f7a777SLen Brown struct acpi_integrity_info { 1031e2f7a777SLen Brown u32 nodes; 1032e2f7a777SLen Brown u32 objects; 1033e2f7a777SLen Brown }; 1034e2f7a777SLen Brown 1035e2f7a777SLen Brown #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 1036e2f7a777SLen Brown #define ACPI_DB_CONSOLE_OUTPUT 0x02 1037e2f7a777SLen Brown #define ACPI_DB_DUPLICATE_OUTPUT 0x03 1038e2f7a777SLen Brown 1039e2f7a777SLen Brown /***************************************************************************** 1040e2f7a777SLen Brown * 1041e2f7a777SLen Brown * Debug 1042e2f7a777SLen Brown * 1043e2f7a777SLen Brown ****************************************************************************/ 1044e2f7a777SLen Brown 1045e2f7a777SLen Brown /* Entry for a memory allocation (debug only) */ 1046e2f7a777SLen Brown 1047e2f7a777SLen Brown #define ACPI_MEM_MALLOC 0 1048e2f7a777SLen Brown #define ACPI_MEM_CALLOC 1 1049e2f7a777SLen Brown #define ACPI_MAX_MODULE_NAME 16 1050e2f7a777SLen Brown 1051e2f7a777SLen Brown #define ACPI_COMMON_DEBUG_MEM_HEADER \ 1052e2f7a777SLen Brown struct acpi_debug_mem_block *previous; \ 1053e2f7a777SLen Brown struct acpi_debug_mem_block *next; \ 1054e2f7a777SLen Brown u32 size; \ 1055e2f7a777SLen Brown u32 component; \ 1056e2f7a777SLen Brown u32 line; \ 1057e2f7a777SLen Brown char module[ACPI_MAX_MODULE_NAME]; \ 1058e2f7a777SLen Brown u8 alloc_type; 1059e2f7a777SLen Brown 1060e2f7a777SLen Brown struct acpi_debug_mem_header { 1061e2f7a777SLen Brown ACPI_COMMON_DEBUG_MEM_HEADER}; 1062e2f7a777SLen Brown 1063e2f7a777SLen Brown struct acpi_debug_mem_block { 1064e2f7a777SLen Brown ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space; 1065e2f7a777SLen Brown }; 1066e2f7a777SLen Brown 1067e2f7a777SLen Brown #define ACPI_MEM_LIST_GLOBAL 0 1068e2f7a777SLen Brown #define ACPI_MEM_LIST_NSNODE 1 1069e2f7a777SLen Brown #define ACPI_MEM_LIST_MAX 1 1070e2f7a777SLen Brown #define ACPI_NUM_MEM_LISTS 2 1071e2f7a777SLen Brown 1072e2f7a777SLen Brown #endif /* __ACLOCAL_H__ */ 1073