/******************************************************************************1*2* Name: aclocal.h - Internal data types used across the ACPI subsystem3*4*****************************************************************************/56/*7* Copyright (C) 2000 - 2011, Intel Corp.8* All rights reserved.9*10* Redistribution and use in source and binary forms, with or without11* modification, are permitted provided that the following conditions12* are met:13* 1. Redistributions of source code must retain the above copyright14* notice, this list of conditions, and the following disclaimer,15* without modification.16* 2. Redistributions in binary form must reproduce at minimum a disclaimer17* substantially similar to the "NO WARRANTY" disclaimer below18* ("Disclaimer") and any redistribution must be conditioned upon19* including a substantially similar Disclaimer requirement for further20* binary redistribution.21* 3. Neither the names of the above-listed copyright holders nor the names22* of any contributors may be used to endorse or promote products derived23* from this software without specific prior written permission.24*25* Alternatively, this software may be distributed under the terms of the26* GNU General Public License ("GPL") version 2 as published by the Free27* Software Foundation.28*29* NO WARRANTY30* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS31* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT32* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR33* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT34* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL35* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS36* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)37* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,38* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING39* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE40* POSSIBILITY OF SUCH DAMAGES.41*/4243#ifndef __ACLOCAL_H__44#define __ACLOCAL_H__4546/* acpisrc:struct_defs -- for acpisrc conversion */4748#define ACPI_SERIALIZED 0xFF4950typedef u32 acpi_mutex_handle;51#define ACPI_GLOBAL_LOCK (acpi_semaphore) (-1)5253/* Total number of aml opcodes defined */5455#define AML_NUM_OPCODES 0x7F5657/* Forward declarations */5859struct acpi_walk_state;60struct acpi_obj_mutex;61union acpi_parse_object;6263/*****************************************************************************64*65* Mutex typedefs and structs66*67****************************************************************************/6869/*70* Predefined handles for the mutex objects used within the subsystem71* All mutex objects are automatically created by acpi_ut_mutex_initialize.72*73* The acquire/release ordering protocol is implied via this list. Mutexes74* with a lower value must be acquired before mutexes with a higher value.75*76* NOTE: any changes here must be reflected in the acpi_gbl_mutex_names77* table below also!78*/79#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */80#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */81#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */82#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */83#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */84#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */85#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */86#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */8788#define ACPI_MAX_MUTEX 789#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+19091/* Lock structure for reader/writer interfaces */9293struct acpi_rw_lock {94acpi_mutex writer_mutex;95acpi_mutex reader_mutex;96u32 num_readers;97};9899/*100* Predefined handles for spinlocks used within the subsystem.101* These spinlocks are created by acpi_ut_mutex_initialize102*/103#define ACPI_LOCK_GPES 0104#define ACPI_LOCK_HARDWARE 1105106#define ACPI_MAX_LOCK 1107#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1108109/* This Thread ID means that the mutex is not in use (unlocked) */110111#define ACPI_MUTEX_NOT_ACQUIRED (acpi_thread_id) 0112113/* Table for the global mutexes */114115struct acpi_mutex_info {116acpi_mutex mutex;117u32 use_count;118acpi_thread_id thread_id;119};120121/* Lock flag parameter for various interfaces */122123#define ACPI_MTX_DO_NOT_LOCK 0124#define ACPI_MTX_LOCK 1125126/* Field access granularities */127128#define ACPI_FIELD_BYTE_GRANULARITY 1129#define ACPI_FIELD_WORD_GRANULARITY 2130#define ACPI_FIELD_DWORD_GRANULARITY 4131#define ACPI_FIELD_QWORD_GRANULARITY 8132133#define ACPI_ENTRY_NOT_FOUND NULL134135/*****************************************************************************136*137* Namespace typedefs and structs138*139****************************************************************************/140141/* Operational modes of the AML interpreter/scanner */142143typedef enum {144ACPI_IMODE_LOAD_PASS1 = 0x01,145ACPI_IMODE_LOAD_PASS2 = 0x02,146ACPI_IMODE_EXECUTE = 0x03147} acpi_interpreter_mode;148149/*150* The Namespace Node describes a named object that appears in the AML.151* descriptor_type is used to differentiate between internal descriptors.152*153* The node is optimized for both 32-bit and 64-bit platforms:154* 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.155*156* Note: The descriptor_type and Type fields must appear in the identical157* position in both the struct acpi_namespace_node and union acpi_operand_object158* structures.159*/160struct acpi_namespace_node {161union acpi_operand_object *object; /* Interpreter object */162u8 descriptor_type; /* Differentiate object descriptor types */163u8 type; /* ACPI Type associated with this name */164u8 flags; /* Miscellaneous flags */165acpi_owner_id owner_id; /* Node creator */166union acpi_name_union name; /* ACPI Name, always 4 chars per ACPI spec */167struct acpi_namespace_node *parent; /* Parent node */168struct acpi_namespace_node *child; /* First child */169struct acpi_namespace_node *peer; /* First peer */170171/*172* The following fields are used by the ASL compiler and disassembler only173*/174#ifdef ACPI_LARGE_NAMESPACE_NODE175union acpi_parse_object *op;176u32 value;177u32 length;178#endif179};180181/* Namespace Node flags */182183#define ANOBJ_RESERVED 0x01 /* Available for use */184#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */185#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */186#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */187#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */188#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */189#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */190191#define ANOBJ_IS_EXTERNAL 0x08 /* i_aSL only: This object created via External() */192#define ANOBJ_METHOD_NO_RETVAL 0x10 /* i_aSL only: Method has no return value */193#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* i_aSL only: Method has at least one return value */194#define ANOBJ_IS_BIT_OFFSET 0x40 /* i_aSL only: Reference is a bit offset */195#define ANOBJ_IS_REFERENCED 0x80 /* i_aSL only: Object was referenced */196197/* Internal ACPI table management - master table list */198199struct acpi_table_list {200struct acpi_table_desc *tables; /* Table descriptor array */201u32 current_table_count; /* Tables currently in the array */202u32 max_table_count; /* Max tables array will hold */203u8 flags;204};205206/* Flags for above */207208#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */209#define ACPI_ROOT_ORIGIN_ALLOCATED (1)210#define ACPI_ROOT_ALLOW_RESIZE (2)211212/* Predefined (fixed) table indexes */213214#define ACPI_TABLE_INDEX_DSDT (0)215#define ACPI_TABLE_INDEX_FACS (1)216217struct acpi_find_context {218char *search_for;219acpi_handle *list;220u32 *count;221};222223struct acpi_ns_search_data {224struct acpi_namespace_node *node;225};226227/* Object types used during package copies */228229#define ACPI_COPY_TYPE_SIMPLE 0230#define ACPI_COPY_TYPE_PACKAGE 1231232/* Info structure used to convert external<->internal namestrings */233234struct acpi_namestring_info {235const char *external_name;236const char *next_external_char;237char *internal_name;238u32 length;239u32 num_segments;240u32 num_carats;241u8 fully_qualified;242};243244/* Field creation info */245246struct acpi_create_field_info {247struct acpi_namespace_node *region_node;248struct acpi_namespace_node *field_node;249struct acpi_namespace_node *register_node;250struct acpi_namespace_node *data_register_node;251u32 bank_value;252u32 field_bit_position;253u32 field_bit_length;254u8 field_flags;255u8 attribute;256u8 field_type;257};258259typedef260acpi_status(*ACPI_INTERNAL_METHOD) (struct acpi_walk_state * walk_state);261262/*263* Bitmapped ACPI types. Used internally only264*/265#define ACPI_BTYPE_ANY 0x00000000266#define ACPI_BTYPE_INTEGER 0x00000001267#define ACPI_BTYPE_STRING 0x00000002268#define ACPI_BTYPE_BUFFER 0x00000004269#define ACPI_BTYPE_PACKAGE 0x00000008270#define ACPI_BTYPE_FIELD_UNIT 0x00000010271#define ACPI_BTYPE_DEVICE 0x00000020272#define ACPI_BTYPE_EVENT 0x00000040273#define ACPI_BTYPE_METHOD 0x00000080274#define ACPI_BTYPE_MUTEX 0x00000100275#define ACPI_BTYPE_REGION 0x00000200276#define ACPI_BTYPE_POWER 0x00000400277#define ACPI_BTYPE_PROCESSOR 0x00000800278#define ACPI_BTYPE_THERMAL 0x00001000279#define ACPI_BTYPE_BUFFER_FIELD 0x00002000280#define ACPI_BTYPE_DDB_HANDLE 0x00004000281#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000282#define ACPI_BTYPE_REFERENCE 0x00010000283#define ACPI_BTYPE_RESOURCE 0x00020000284285#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)286287#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)288#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)289#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)290#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */291#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF292293/*294* Information structure for ACPI predefined names.295* Each entry in the table contains the following items:296*297* Name - The ACPI reserved name298* param_count - Number of arguments to the method299* expected_return_btypes - Allowed type(s) for the return value300*/301struct acpi_name_info {302char name[ACPI_NAME_SIZE];303u8 param_count;304u8 expected_btypes;305};306307/*308* Secondary information structures for ACPI predefined objects that return309* package objects. This structure appears as the next entry in the table310* after the NAME_INFO structure above.311*312* The reason for this is to minimize the size of the predefined name table.313*/314315/*316* Used for ACPI_PTYPE1_FIXED, ACPI_PTYPE1_VAR, ACPI_PTYPE2,317* ACPI_PTYPE2_MIN, ACPI_PTYPE2_PKG_COUNT, ACPI_PTYPE2_COUNT318*/319struct acpi_package_info {320u8 type;321u8 object_type1;322u8 count1;323u8 object_type2;324u8 count2;325u8 reserved;326};327328/* Used for ACPI_PTYPE2_FIXED */329330struct acpi_package_info2 {331u8 type;332u8 count;333u8 object_type[4];334};335336/* Used for ACPI_PTYPE1_OPTION */337338struct acpi_package_info3 {339u8 type;340u8 count;341u8 object_type[2];342u8 tail_object_type;343u8 reserved;344};345346union acpi_predefined_info {347struct acpi_name_info info;348struct acpi_package_info ret_info;349struct acpi_package_info2 ret_info2;350struct acpi_package_info3 ret_info3;351};352353/* Data block used during object validation */354355struct acpi_predefined_data {356char *pathname;357const union acpi_predefined_info *predefined;358union acpi_operand_object *parent_package;359u32 flags;360u8 node_flags;361};362363/* Defines for Flags field above */364365#define ACPI_OBJECT_REPAIRED 1366367/*368* Bitmapped return value types369* Note: the actual data types must be contiguous, a loop in nspredef.c370* depends on this.371*/372#define ACPI_RTYPE_ANY 0x00373#define ACPI_RTYPE_NONE 0x01374#define ACPI_RTYPE_INTEGER 0x02375#define ACPI_RTYPE_STRING 0x04376#define ACPI_RTYPE_BUFFER 0x08377#define ACPI_RTYPE_PACKAGE 0x10378#define ACPI_RTYPE_REFERENCE 0x20379#define ACPI_RTYPE_ALL 0x3F380381#define ACPI_NUM_RTYPES 5 /* Number of actual object types */382383/*****************************************************************************384*385* Event typedefs and structs386*387****************************************************************************/388389/* Dispatch info for each GPE -- either a method or handler, cannot be both */390391struct acpi_gpe_handler_info {392acpi_gpe_handler address; /* Address of handler, if any */393void *context; /* Context to be passed to handler */394struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */395u8 original_flags; /* Original (pre-handler) GPE info */396u8 originally_enabled; /* True if GPE was originally enabled */397};398399struct acpi_gpe_notify_object {400struct acpi_namespace_node *node;401struct acpi_gpe_notify_object *next;402};403404union acpi_gpe_dispatch_info {405struct acpi_namespace_node *method_node; /* Method node for this GPE level */406struct acpi_gpe_handler_info *handler; /* Installed GPE handler */407struct acpi_gpe_notify_object device; /* List of _PRW devices for implicit notify */408};409410/*411* Information about a GPE, one per each GPE in an array.412* NOTE: Important to keep this struct as small as possible.413*/414struct acpi_gpe_event_info {415union acpi_gpe_dispatch_info dispatch; /* Either Method or Handler */416struct acpi_gpe_register_info *register_info; /* Backpointer to register info */417u8 flags; /* Misc info about this GPE */418u8 gpe_number; /* This GPE */419u8 runtime_count; /* References to a run GPE */420};421422/* Information about a GPE register pair, one per each status/enable pair in an array */423424struct acpi_gpe_register_info {425struct acpi_generic_address status_address; /* Address of status reg */426struct acpi_generic_address enable_address; /* Address of enable reg */427u8 enable_for_wake; /* GPEs to keep enabled when sleeping */428u8 enable_for_run; /* GPEs to keep enabled when running */429u8 base_gpe_number; /* Base GPE number for this register */430};431432/*433* Information about a GPE register block, one per each installed block --434* GPE0, GPE1, and one per each installed GPE Block Device.435*/436struct acpi_gpe_block_info {437struct acpi_namespace_node *node;438struct acpi_gpe_block_info *previous;439struct acpi_gpe_block_info *next;440struct acpi_gpe_xrupt_info *xrupt_block; /* Backpointer to interrupt block */441struct acpi_gpe_register_info *register_info; /* One per GPE register pair */442struct acpi_gpe_event_info *event_info; /* One for each GPE */443struct acpi_generic_address block_address; /* Base address of the block */444u32 register_count; /* Number of register pairs in block */445u16 gpe_count; /* Number of individual GPEs in block */446u8 block_base_number; /* Base GPE number for this block */447u8 initialized; /* TRUE if this block is initialized */448};449450/* Information about GPE interrupt handlers, one per each interrupt level used for GPEs */451452struct acpi_gpe_xrupt_info {453struct acpi_gpe_xrupt_info *previous;454struct acpi_gpe_xrupt_info *next;455struct acpi_gpe_block_info *gpe_block_list_head; /* List of GPE blocks for this xrupt */456u32 interrupt_number; /* System interrupt number */457};458459struct acpi_gpe_walk_info {460struct acpi_namespace_node *gpe_device;461struct acpi_gpe_block_info *gpe_block;462u16 count;463acpi_owner_id owner_id;464u8 execute_by_owner_id;465};466467struct acpi_gpe_device_info {468u32 index;469u32 next_block_base_index;470acpi_status status;471struct acpi_namespace_node *gpe_device;472};473474typedef acpi_status(*acpi_gpe_callback) (struct acpi_gpe_xrupt_info *gpe_xrupt_info,475struct acpi_gpe_block_info *gpe_block, void *context);476477/* Information about each particular fixed event */478479struct acpi_fixed_event_handler {480acpi_event_handler handler; /* Address of handler. */481void *context; /* Context to be passed to handler */482};483484struct acpi_fixed_event_info {485u8 status_register_id;486u8 enable_register_id;487u16 status_bit_mask;488u16 enable_bit_mask;489};490491/* Information used during field processing */492493struct acpi_field_info {494u8 skip_field;495u8 field_flag;496u32 pkg_length;497};498499/*****************************************************************************500*501* Generic "state" object for stacks502*503****************************************************************************/504505#define ACPI_CONTROL_NORMAL 0xC0506#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1507#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2508#define ACPI_CONTROL_PREDICATE_FALSE 0xC3509#define ACPI_CONTROL_PREDICATE_TRUE 0xC4510511#define ACPI_STATE_COMMON \512void *next; \513u8 descriptor_type; /* To differentiate various internal objs */\514u8 flags; \515u16 value; \516u16 state;517518/* There are 2 bytes available here until the next natural alignment boundary */519520struct acpi_common_state {521ACPI_STATE_COMMON};522523/*524* Update state - used to traverse complex objects such as packages525*/526struct acpi_update_state {527ACPI_STATE_COMMON union acpi_operand_object *object;528};529530/*531* Pkg state - used to traverse nested package structures532*/533struct acpi_pkg_state {534ACPI_STATE_COMMON u16 index;535union acpi_operand_object *source_object;536union acpi_operand_object *dest_object;537struct acpi_walk_state *walk_state;538void *this_target_obj;539u32 num_packages;540};541542/*543* Control state - one per if/else and while constructs.544* Allows nesting of these constructs545*/546struct acpi_control_state {547ACPI_STATE_COMMON u16 opcode;548union acpi_parse_object *predicate_op;549u8 *aml_predicate_start; /* Start of if/while predicate */550u8 *package_end; /* End of if/while block */551u32 loop_count; /* While() loop counter */552};553554/*555* Scope state - current scope during namespace lookups556*/557struct acpi_scope_state {558ACPI_STATE_COMMON struct acpi_namespace_node *node;559};560561struct acpi_pscope_state {562ACPI_STATE_COMMON u32 arg_count; /* Number of fixed arguments */563union acpi_parse_object *op; /* Current op being parsed */564u8 *arg_end; /* Current argument end */565u8 *pkg_end; /* Current package end */566u32 arg_list; /* Next argument to parse */567};568569/*570* Thread state - one per thread across multiple walk states. Multiple walk571* states are created when there are nested control methods executing.572*/573struct acpi_thread_state {574ACPI_STATE_COMMON u8 current_sync_level; /* Mutex Sync (nested acquire) level */575struct acpi_walk_state *walk_state_list; /* Head of list of walk_states for this thread */576union acpi_operand_object *acquired_mutex_list; /* List of all currently acquired mutexes */577acpi_thread_id thread_id; /* Running thread ID */578};579580/*581* Result values - used to accumulate the results of nested582* AML arguments583*/584struct acpi_result_values {585ACPI_STATE_COMMON586union acpi_operand_object *obj_desc[ACPI_RESULTS_FRAME_OBJ_NUM];587};588589typedef590acpi_status(*acpi_parse_downwards) (struct acpi_walk_state * walk_state,591union acpi_parse_object ** out_op);592593typedef acpi_status(*acpi_parse_upwards) (struct acpi_walk_state * walk_state);594595/*596* Notify info - used to pass info to the deferred notify597* handler/dispatcher.598*/599struct acpi_notify_info {600ACPI_STATE_COMMON struct acpi_namespace_node *node;601union acpi_operand_object *handler_obj;602};603604/* Generic state is union of structs above */605606union acpi_generic_state {607struct acpi_common_state common;608struct acpi_control_state control;609struct acpi_update_state update;610struct acpi_scope_state scope;611struct acpi_pscope_state parse_scope;612struct acpi_pkg_state pkg;613struct acpi_thread_state thread;614struct acpi_result_values results;615struct acpi_notify_info notify;616};617618/*****************************************************************************619*620* Interpreter typedefs and structs621*622****************************************************************************/623624typedef acpi_status(*ACPI_EXECUTE_OP) (struct acpi_walk_state * walk_state);625626/*****************************************************************************627*628* Parser typedefs and structs629*630****************************************************************************/631632/*633* AML opcode, name, and argument layout634*/635struct acpi_opcode_info {636#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)637char *name; /* Opcode name (disassembler/debug only) */638#endif639u32 parse_args; /* Grammar/Parse time arguments */640u32 runtime_args; /* Interpret time arguments */641u16 flags; /* Misc flags */642u8 object_type; /* Corresponding internal object type */643u8 class; /* Opcode class */644u8 type; /* Opcode type */645};646647union acpi_parse_value {648u64 integer; /* Integer constant (Up to 64 bits) */649u32 size; /* bytelist or field size */650char *string; /* NULL terminated string */651u8 *buffer; /* buffer or string */652char *name; /* NULL terminated string */653union acpi_parse_object *arg; /* arguments and contained ops */654};655656#ifdef ACPI_DISASSEMBLER657#define ACPI_DISASM_ONLY_MEMBERS(a) a;658#else659#define ACPI_DISASM_ONLY_MEMBERS(a)660#endif661662#define ACPI_PARSE_COMMON \663union acpi_parse_object *parent; /* Parent op */\664u8 descriptor_type; /* To differentiate various internal objs */\665u8 flags; /* Type of Op */\666u16 aml_opcode; /* AML opcode */\667u32 aml_offset; /* Offset of declaration in AML */\668union acpi_parse_object *next; /* Next op */\669struct acpi_namespace_node *node; /* For use by interpreter */\670union acpi_parse_value value; /* Value or args associated with the opcode */\671u8 arg_list_length; /* Number of elements in the arg list */\672ACPI_DISASM_ONLY_MEMBERS (\673u8 disasm_flags; /* Used during AML disassembly */\674u8 disasm_opcode; /* Subtype used for disassembly */\675char aml_op_name[16]) /* Op name (debug only) */676677#define ACPI_DASM_BUFFER 0x00678#define ACPI_DASM_RESOURCE 0x01679#define ACPI_DASM_STRING 0x02680#define ACPI_DASM_UNICODE 0x03681#define ACPI_DASM_EISAID 0x04682#define ACPI_DASM_MATCHOP 0x05683#define ACPI_DASM_LNOT_PREFIX 0x06684#define ACPI_DASM_LNOT_SUFFIX 0x07685#define ACPI_DASM_IGNORE 0x08686687/*688* Generic operation (for example: If, While, Store)689*/690struct acpi_parse_obj_common {691ACPI_PARSE_COMMON};692693/*694* Extended Op for named ops (Scope, Method, etc.), deferred ops (Methods and op_regions),695* and bytelists.696*/697struct acpi_parse_obj_named {698ACPI_PARSE_COMMON u8 *path;699u8 *data; /* AML body or bytelist data */700u32 length; /* AML length */701u32 name; /* 4-byte name or zero if no name */702};703704/* This version is used by the i_aSL compiler only */705706#define ACPI_MAX_PARSEOP_NAME 20707708struct acpi_parse_obj_asl {709ACPI_PARSE_COMMON union acpi_parse_object *child;710union acpi_parse_object *parent_method;711char *filename;712char *external_name;713char *namepath;714char name_seg[4];715u32 extra_value;716u32 column;717u32 line_number;718u32 logical_line_number;719u32 logical_byte_offset;720u32 end_line;721u32 end_logical_line;722u32 acpi_btype;723u32 aml_length;724u32 aml_subtree_length;725u32 final_aml_length;726u32 final_aml_offset;727u32 compile_flags;728u16 parse_opcode;729u8 aml_opcode_length;730u8 aml_pkg_len_bytes;731u8 extra;732char parse_op_name[ACPI_MAX_PARSEOP_NAME];733};734735union acpi_parse_object {736struct acpi_parse_obj_common common;737struct acpi_parse_obj_named named;738struct acpi_parse_obj_asl asl;739};740741/*742* Parse state - one state per parser invocation and each control743* method.744*/745struct acpi_parse_state {746u8 *aml_start; /* First AML byte */747u8 *aml; /* Next AML byte */748u8 *aml_end; /* (last + 1) AML byte */749u8 *pkg_start; /* Current package begin */750u8 *pkg_end; /* Current package end */751union acpi_parse_object *start_op; /* Root of parse tree */752struct acpi_namespace_node *start_node;753union acpi_generic_state *scope; /* Current scope */754union acpi_parse_object *start_scope;755u32 aml_size;756};757758/* Parse object flags */759760#define ACPI_PARSEOP_GENERIC 0x01761#define ACPI_PARSEOP_NAMED 0x02762#define ACPI_PARSEOP_DEFERRED 0x04763#define ACPI_PARSEOP_BYTELIST 0x08764#define ACPI_PARSEOP_IN_STACK 0x10765#define ACPI_PARSEOP_TARGET 0x20766#define ACPI_PARSEOP_IN_CACHE 0x80767768/* Parse object disasm_flags */769770#define ACPI_PARSEOP_IGNORE 0x01771#define ACPI_PARSEOP_PARAMLIST 0x02772#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04773#define ACPI_PARSEOP_SPECIAL 0x10774775/*****************************************************************************776*777* Hardware (ACPI registers) and PNP778*779****************************************************************************/780781struct acpi_bit_register_info {782u8 parent_register;783u8 bit_position;784u16 access_bit_mask;785};786787/*788* Some ACPI registers have bits that must be ignored -- meaning that they789* must be preserved.790*/791#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */792793/* Write-only bits must be zeroed by software */794795#define ACPI_PM1_CONTROL_WRITEONLY_BITS 0x2004 /* Bits 13, 2 */796797/* For control registers, both ignored and reserved bits must be preserved */798799/*800* For PM1 control, the SCI enable bit (bit 0, SCI_EN) is defined by the801* ACPI specification to be a "preserved" bit - "OSPM always preserves this802* bit position", section 4.7.3.2.1. However, on some machines the OS must803* write a one to this bit after resume for the machine to work properly.804* To enable this, we no longer attempt to preserve this bit. No machines805* are known to fail if the bit is not preserved. (May 2009)806*/807#define ACPI_PM1_CONTROL_IGNORED_BITS 0x0200 /* Bit 9 */808#define ACPI_PM1_CONTROL_RESERVED_BITS 0xC1F8 /* Bits 14-15, 3-8 */809#define ACPI_PM1_CONTROL_PRESERVED_BITS \810(ACPI_PM1_CONTROL_IGNORED_BITS | ACPI_PM1_CONTROL_RESERVED_BITS)811812#define ACPI_PM2_CONTROL_PRESERVED_BITS 0xFFFFFFFE /* All except bit 0 */813814/*815* Register IDs816* These are the full ACPI registers817*/818#define ACPI_REGISTER_PM1_STATUS 0x01819#define ACPI_REGISTER_PM1_ENABLE 0x02820#define ACPI_REGISTER_PM1_CONTROL 0x03821#define ACPI_REGISTER_PM2_CONTROL 0x04822#define ACPI_REGISTER_PM_TIMER 0x05823#define ACPI_REGISTER_PROCESSOR_BLOCK 0x06824#define ACPI_REGISTER_SMI_COMMAND_BLOCK 0x07825826/* Masks used to access the bit_registers */827828#define ACPI_BITMASK_TIMER_STATUS 0x0001829#define ACPI_BITMASK_BUS_MASTER_STATUS 0x0010830#define ACPI_BITMASK_GLOBAL_LOCK_STATUS 0x0020831#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100832#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200833#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400834#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */835#define ACPI_BITMASK_WAKE_STATUS 0x8000836837#define ACPI_BITMASK_ALL_FIXED_STATUS (\838ACPI_BITMASK_TIMER_STATUS | \839ACPI_BITMASK_BUS_MASTER_STATUS | \840ACPI_BITMASK_GLOBAL_LOCK_STATUS | \841ACPI_BITMASK_POWER_BUTTON_STATUS | \842ACPI_BITMASK_SLEEP_BUTTON_STATUS | \843ACPI_BITMASK_RT_CLOCK_STATUS | \844ACPI_BITMASK_PCIEXP_WAKE_STATUS | \845ACPI_BITMASK_WAKE_STATUS)846847#define ACPI_BITMASK_TIMER_ENABLE 0x0001848#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020849#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100850#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200851#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400852#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */853854#define ACPI_BITMASK_SCI_ENABLE 0x0001855#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002856#define ACPI_BITMASK_GLOBAL_LOCK_RELEASE 0x0004857#define ACPI_BITMASK_SLEEP_TYPE 0x1C00858#define ACPI_BITMASK_SLEEP_ENABLE 0x2000859860#define ACPI_BITMASK_ARB_DISABLE 0x0001861862/* Raw bit position of each bit_register */863864#define ACPI_BITPOSITION_TIMER_STATUS 0x00865#define ACPI_BITPOSITION_BUS_MASTER_STATUS 0x04866#define ACPI_BITPOSITION_GLOBAL_LOCK_STATUS 0x05867#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08868#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09869#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A870#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */871#define ACPI_BITPOSITION_WAKE_STATUS 0x0F872873#define ACPI_BITPOSITION_TIMER_ENABLE 0x00874#define ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE 0x05875#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08876#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09877#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A878#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */879880#define ACPI_BITPOSITION_SCI_ENABLE 0x00881#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01882#define ACPI_BITPOSITION_GLOBAL_LOCK_RELEASE 0x02883#define ACPI_BITPOSITION_SLEEP_TYPE 0x0A884#define ACPI_BITPOSITION_SLEEP_ENABLE 0x0D885886#define ACPI_BITPOSITION_ARB_DISABLE 0x00887888/* Structs and definitions for _OSI support and I/O port validation */889890#define ACPI_OSI_WIN_2000 0x01891#define ACPI_OSI_WIN_XP 0x02892#define ACPI_OSI_WIN_XP_SP1 0x03893#define ACPI_OSI_WINSRV_2003 0x04894#define ACPI_OSI_WIN_XP_SP2 0x05895#define ACPI_OSI_WINSRV_2003_SP1 0x06896#define ACPI_OSI_WIN_VISTA 0x07897#define ACPI_OSI_WINSRV_2008 0x08898#define ACPI_OSI_WIN_VISTA_SP1 0x09899#define ACPI_OSI_WIN_VISTA_SP2 0x0A900#define ACPI_OSI_WIN_7 0x0B901902#define ACPI_ALWAYS_ILLEGAL 0x00903904struct acpi_interface_info {905char *name;906struct acpi_interface_info *next;907u8 flags;908u8 value;909};910911#define ACPI_OSI_INVALID 0x01912#define ACPI_OSI_DYNAMIC 0x02913914struct acpi_port_info {915char *name;916u16 start;917u16 end;918u8 osi_dependency;919};920921/*****************************************************************************922*923* Resource descriptors924*925****************************************************************************/926927/* resource_type values */928929#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0930#define ACPI_ADDRESS_TYPE_IO_RANGE 1931#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2932933/* Resource descriptor types and masks */934935#define ACPI_RESOURCE_NAME_LARGE 0x80936#define ACPI_RESOURCE_NAME_SMALL 0x00937938#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */939#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */940#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */941942/*943* Small resource descriptor "names" as defined by the ACPI specification.944* Note: Bits 2:0 are used for the descriptor length945*/946#define ACPI_RESOURCE_NAME_IRQ 0x20947#define ACPI_RESOURCE_NAME_DMA 0x28948#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30949#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38950#define ACPI_RESOURCE_NAME_IO 0x40951#define ACPI_RESOURCE_NAME_FIXED_IO 0x48952#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50953#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58954#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60955#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68956#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70957#define ACPI_RESOURCE_NAME_END_TAG 0x78958959/*960* Large resource descriptor "names" as defined by the ACPI specification.961* Note: includes the Large Descriptor bit in bit[7]962*/963#define ACPI_RESOURCE_NAME_MEMORY24 0x81964#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82965#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83966#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84967#define ACPI_RESOURCE_NAME_MEMORY32 0x85968#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86969#define ACPI_RESOURCE_NAME_ADDRESS32 0x87970#define ACPI_RESOURCE_NAME_ADDRESS16 0x88971#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89972#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A973#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B974#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B975976/*****************************************************************************977*978* Miscellaneous979*980****************************************************************************/981982#define ACPI_ASCII_ZERO 0x30983984/*****************************************************************************985*986* Debugger987*988****************************************************************************/989990struct acpi_db_method_info {991acpi_handle main_thread_gate;992acpi_handle thread_complete_gate;993acpi_thread_id *threads;994u32 num_threads;995u32 num_created;996u32 num_completed;997998char *name;999u32 flags;1000u32 num_loops;1001char pathname[128];1002char **args;10031004/*1005* Arguments to be passed to method for the command1006* Threads -1007* the Number of threads, ID of current thread and1008* Index of current thread inside all them created.1009*/1010char init_args;1011char *arguments[4];1012char num_threads_str[11];1013char id_of_thread_str[11];1014char index_of_thread_str[11];1015};10161017struct acpi_integrity_info {1018u32 nodes;1019u32 objects;1020};10211022#define ACPI_DB_REDIRECTABLE_OUTPUT 0x011023#define ACPI_DB_CONSOLE_OUTPUT 0x021024#define ACPI_DB_DUPLICATE_OUTPUT 0x0310251026/*****************************************************************************1027*1028* Debug1029*1030****************************************************************************/10311032/* Entry for a memory allocation (debug only) */10331034#define ACPI_MEM_MALLOC 01035#define ACPI_MEM_CALLOC 11036#define ACPI_MAX_MODULE_NAME 1610371038#define ACPI_COMMON_DEBUG_MEM_HEADER \1039struct acpi_debug_mem_block *previous; \1040struct acpi_debug_mem_block *next; \1041u32 size; \1042u32 component; \1043u32 line; \1044char module[ACPI_MAX_MODULE_NAME]; \1045u8 alloc_type;10461047struct acpi_debug_mem_header {1048ACPI_COMMON_DEBUG_MEM_HEADER};10491050struct acpi_debug_mem_block {1051ACPI_COMMON_DEBUG_MEM_HEADER u64 user_space;1052};10531054#define ACPI_MEM_LIST_GLOBAL 01055#define ACPI_MEM_LIST_NSNODE 11056#define ACPI_MEM_LIST_MAX 11057#define ACPI_NUM_MEM_LISTS 210581059#endif /* __ACLOCAL_H__ */106010611062