/******************************************************************************1*2* Name: acglobal.h - Declarations for global variables3*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 __ACGLOBAL_H__44#define __ACGLOBAL_H__4546/*47* Ensure that the globals are actually defined and initialized only once.48*49* The use of these macros allows a single list of globals (here) in order50* to simplify maintenance of the code.51*/52#ifdef DEFINE_ACPI_GLOBALS53#define ACPI_EXTERN54#define ACPI_INIT_GLOBAL(a,b) a=b55#else56#define ACPI_EXTERN extern57#define ACPI_INIT_GLOBAL(a,b) a58#endif5960#ifdef DEFINE_ACPI_GLOBALS6162/* Public globals, available from outside ACPICA subsystem */6364/*****************************************************************************65*66* Runtime configuration (static defaults that can be overriden at runtime)67*68****************************************************************************/6970/*71* Enable "slack" in the AML interpreter? Default is FALSE, and the72* interpreter strictly follows the ACPI specification. Setting to TRUE73* allows the interpreter to ignore certain errors and/or bad AML constructs.74*75* Currently, these features are enabled by this flag:76*77* 1) Allow "implicit return" of last value in a control method78* 2) Allow access beyond the end of an operation region79* 3) Allow access to uninitialized locals/args (auto-init to integer 0)80* 4) Allow ANY object type to be a source operand for the Store() operator81* 5) Allow unresolved references (invalid target name) in package objects82* 6) Enable warning messages for behavior that is not ACPI spec compliant83*/84u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_interpreter_slack, FALSE);8586/*87* Automatically serialize ALL control methods? Default is FALSE, meaning88* to use the Serialized/not_serialized method flags on a per method basis.89* Only change this if the ASL code is poorly written and cannot handle90* reentrancy even though methods are marked "NotSerialized".91*/92u8 ACPI_INIT_GLOBAL(acpi_gbl_all_methods_serialized, FALSE);9394/*95* Create the predefined _OSI method in the namespace? Default is TRUE96* because ACPI CA is fully compatible with other ACPI implementations.97* Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior.98*/99u8 ACPI_INIT_GLOBAL(acpi_gbl_create_osi_method, TRUE);100101/*102* Optionally use default values for the ACPI register widths. Set this to103* TRUE to use the defaults, if an FADT contains incorrect widths/lengths.104*/105u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);106107/*108* Optionally enable output from the AML Debug Object.109*/110u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);111112/*113* Optionally copy the entire DSDT to local memory (instead of simply114* mapping it.) There are some BIOSs that corrupt or replace the original115* DSDT, creating the need for this option. Default is FALSE, do not copy116* the DSDT.117*/118u8 ACPI_INIT_GLOBAL(acpi_gbl_copy_dsdt_locally, FALSE);119120/*121* Optionally truncate I/O addresses to 16 bits. Provides compatibility122* with other ACPI implementations. NOTE: During ACPICA initialization,123* this value is set to TRUE if any Windows OSI strings have been124* requested by the BIOS.125*/126u8 ACPI_INIT_GLOBAL(acpi_gbl_truncate_io_addresses, FALSE);127128/* acpi_gbl_FADT is a local copy of the FADT, converted to a common format. */129130struct acpi_table_fadt acpi_gbl_FADT;131u32 acpi_current_gpe_count;132u32 acpi_gbl_trace_flags;133acpi_name acpi_gbl_trace_method_name;134u8 acpi_gbl_system_awake_and_running;135136#endif137138/*****************************************************************************139*140* Debug support141*142****************************************************************************/143144/* Procedure nesting level for debug output */145146extern u32 acpi_gbl_nesting_level;147148ACPI_EXTERN u32 acpi_gpe_count;149ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS];150151/* Support for dynamic control method tracing mechanism */152153ACPI_EXTERN u32 acpi_gbl_original_dbg_level;154ACPI_EXTERN u32 acpi_gbl_original_dbg_layer;155ACPI_EXTERN u32 acpi_gbl_trace_dbg_level;156ACPI_EXTERN u32 acpi_gbl_trace_dbg_layer;157158/*****************************************************************************159*160* ACPI Table globals161*162****************************************************************************/163164/*165* acpi_gbl_root_table_list is the master list of ACPI tables that were166* found in the RSDT/XSDT.167*/168ACPI_EXTERN struct acpi_table_list acpi_gbl_root_table_list;169ACPI_EXTERN struct acpi_table_facs *acpi_gbl_FACS;170171/* These addresses are calculated from the FADT Event Block addresses */172173ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_status;174ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable;175176ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_status;177ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable;178179/* DSDT information. Used to check for DSDT corruption */180181ACPI_EXTERN struct acpi_table_header *acpi_gbl_DSDT;182ACPI_EXTERN struct acpi_table_header acpi_gbl_original_dsdt_header;183184/*185* Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is186* determined by the revision of the DSDT: If the DSDT revision is less than187* 2, use only the lower 32 bits of the internal 64-bit Integer.188*/189ACPI_EXTERN u8 acpi_gbl_integer_bit_width;190ACPI_EXTERN u8 acpi_gbl_integer_byte_width;191ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;192193/* Mutex for _OSI support */194195ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex;196197/* Reader/Writer lock is used for namespace walk and dynamic table unload */198199ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;200201/*****************************************************************************202*203* Mutual exlusion within ACPICA subsystem204*205****************************************************************************/206207/*208* Predefined mutex objects. This array contains the209* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.210* (The table maps local handles to the real OS handles)211*/212ACPI_EXTERN struct acpi_mutex_info acpi_gbl_mutex_info[ACPI_NUM_MUTEX];213214/*215* Global lock mutex is an actual AML mutex object216* Global lock semaphore works in conjunction with the actual global lock217* Global lock spinlock is used for "pending" handshake218*/219ACPI_EXTERN union acpi_operand_object *acpi_gbl_global_lock_mutex;220ACPI_EXTERN acpi_semaphore acpi_gbl_global_lock_semaphore;221ACPI_EXTERN acpi_spinlock acpi_gbl_global_lock_pending_lock;222ACPI_EXTERN u16 acpi_gbl_global_lock_handle;223ACPI_EXTERN u8 acpi_gbl_global_lock_acquired;224ACPI_EXTERN u8 acpi_gbl_global_lock_present;225ACPI_EXTERN u8 acpi_gbl_global_lock_pending;226227/*228* Spinlocks are used for interfaces that can be possibly called at229* interrupt level230*/231ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock; /* For GPE data structs and registers */232ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock; /* For ACPI H/W except GPE registers */233234/*****************************************************************************235*236* Miscellaneous globals237*238****************************************************************************/239240#ifdef ACPI_DBG_TRACK_ALLOCATIONS241242/* Lists for tracking memory allocations */243244ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;245ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;246ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;247#endif248249/* Object caches */250251ACPI_EXTERN acpi_cache_t *acpi_gbl_namespace_cache;252ACPI_EXTERN acpi_cache_t *acpi_gbl_state_cache;253ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_cache;254ACPI_EXTERN acpi_cache_t *acpi_gbl_ps_node_ext_cache;255ACPI_EXTERN acpi_cache_t *acpi_gbl_operand_cache;256257/* Global handlers */258259ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_device_notify;260ACPI_EXTERN struct acpi_object_notify_handler acpi_gbl_system_notify;261ACPI_EXTERN acpi_exception_handler acpi_gbl_exception_handler;262ACPI_EXTERN acpi_init_handler acpi_gbl_init_handler;263ACPI_EXTERN acpi_tbl_handler acpi_gbl_table_handler;264ACPI_EXTERN void *acpi_gbl_table_handler_context;265ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk;266ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler;267268/* Owner ID support */269270ACPI_EXTERN u32 acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS];271ACPI_EXTERN u8 acpi_gbl_last_owner_id_index;272ACPI_EXTERN u8 acpi_gbl_next_owner_id_offset;273274/* Initialization sequencing */275276ACPI_EXTERN u8 acpi_gbl_reg_methods_executed;277278/* Misc */279280ACPI_EXTERN u32 acpi_gbl_original_mode;281ACPI_EXTERN u32 acpi_gbl_rsdp_original_location;282ACPI_EXTERN u32 acpi_gbl_ns_lookup_count;283ACPI_EXTERN u32 acpi_gbl_ps_find_count;284ACPI_EXTERN u16 acpi_gbl_pm1_enable_register_save;285ACPI_EXTERN u8 acpi_gbl_debugger_configuration;286ACPI_EXTERN u8 acpi_gbl_step_to_next_call;287ACPI_EXTERN u8 acpi_gbl_acpi_hardware_present;288ACPI_EXTERN u8 acpi_gbl_events_initialized;289ACPI_EXTERN u8 acpi_gbl_osi_data;290ACPI_EXTERN struct acpi_interface_info *acpi_gbl_supported_interfaces;291292#ifndef DEFINE_ACPI_GLOBALS293294/* Other miscellaneous */295296extern u8 acpi_gbl_shutdown;297extern u32 acpi_gbl_startup_flags;298extern const char *acpi_gbl_sleep_state_names[ACPI_S_STATE_COUNT];299extern const char *acpi_gbl_lowest_dstate_names[ACPI_NUM_sx_w_METHODS];300extern const char *acpi_gbl_highest_dstate_names[ACPI_NUM_sx_d_METHODS];301extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];302extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];303304#endif305306/* Exception codes */307308extern char const *acpi_gbl_exception_names_env[];309extern char const *acpi_gbl_exception_names_pgm[];310extern char const *acpi_gbl_exception_names_tbl[];311extern char const *acpi_gbl_exception_names_aml[];312extern char const *acpi_gbl_exception_names_ctrl[];313314/*****************************************************************************315*316* Namespace globals317*318****************************************************************************/319320#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)321#define NUM_PREDEFINED_NAMES 10322#else323#define NUM_PREDEFINED_NAMES 9324#endif325326ACPI_EXTERN struct acpi_namespace_node acpi_gbl_root_node_struct;327ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_root_node;328ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_fadt_gpe_device;329ACPI_EXTERN union acpi_operand_object *acpi_gbl_module_code_list;330331extern const u8 acpi_gbl_ns_properties[ACPI_NUM_NS_TYPES];332extern const struct acpi_predefined_names333acpi_gbl_pre_defined_names[NUM_PREDEFINED_NAMES];334335#ifdef ACPI_DEBUG_OUTPUT336ACPI_EXTERN u32 acpi_gbl_current_node_count;337ACPI_EXTERN u32 acpi_gbl_current_node_size;338ACPI_EXTERN u32 acpi_gbl_max_concurrent_node_count;339ACPI_EXTERN acpi_size *acpi_gbl_entry_stack_pointer;340ACPI_EXTERN acpi_size *acpi_gbl_lowest_stack_pointer;341ACPI_EXTERN u32 acpi_gbl_deepest_nesting;342#endif343344/*****************************************************************************345*346* Interpreter globals347*348****************************************************************************/349350ACPI_EXTERN struct acpi_thread_state *acpi_gbl_current_walk_list;351352/* Control method single step flag */353354ACPI_EXTERN u8 acpi_gbl_cm_single_step;355356/*****************************************************************************357*358* Hardware globals359*360****************************************************************************/361362extern struct acpi_bit_register_info363acpi_gbl_bit_register_info[ACPI_NUM_BITREG];364ACPI_EXTERN u8 acpi_gbl_sleep_type_a;365ACPI_EXTERN u8 acpi_gbl_sleep_type_b;366367/*****************************************************************************368*369* Event and GPE globals370*371****************************************************************************/372373extern struct acpi_fixed_event_info374acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];375ACPI_EXTERN struct acpi_fixed_event_handler376acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];377ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;378ACPI_EXTERN struct acpi_gpe_block_info379*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];380ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized;381ACPI_EXTERN ACPI_GBL_EVENT_HANDLER acpi_gbl_global_event_handler;382ACPI_EXTERN void *acpi_gbl_global_event_handler_context;383384/*****************************************************************************385*386* Debugger globals387*388****************************************************************************/389390ACPI_EXTERN u8 acpi_gbl_db_output_flags;391392#ifdef ACPI_DISASSEMBLER393394ACPI_EXTERN u8 acpi_gbl_db_opt_disasm;395ACPI_EXTERN u8 acpi_gbl_db_opt_verbose;396#endif397398#ifdef ACPI_DEBUGGER399400extern u8 acpi_gbl_method_executing;401extern u8 acpi_gbl_abort_method;402extern u8 acpi_gbl_db_terminate_threads;403404ACPI_EXTERN u8 acpi_gbl_db_opt_tables;405ACPI_EXTERN u8 acpi_gbl_db_opt_stats;406ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;407408ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];409ACPI_EXTERN char acpi_gbl_db_line_buf[80];410ACPI_EXTERN char acpi_gbl_db_parsed_buf[80];411ACPI_EXTERN char acpi_gbl_db_scope_buf[40];412ACPI_EXTERN char acpi_gbl_db_debug_filename[40];413ACPI_EXTERN u8 acpi_gbl_db_output_to_file;414ACPI_EXTERN char *acpi_gbl_db_buffer;415ACPI_EXTERN char *acpi_gbl_db_filename;416ACPI_EXTERN u32 acpi_gbl_db_debug_level;417ACPI_EXTERN u32 acpi_gbl_db_console_debug_level;418ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node;419420/*421* Statistic globals422*/423ACPI_EXTERN u16 acpi_gbl_obj_type_count[ACPI_TYPE_NS_NODE_MAX + 1];424ACPI_EXTERN u16 acpi_gbl_node_type_count[ACPI_TYPE_NS_NODE_MAX + 1];425ACPI_EXTERN u16 acpi_gbl_obj_type_count_misc;426ACPI_EXTERN u16 acpi_gbl_node_type_count_misc;427ACPI_EXTERN u32 acpi_gbl_num_nodes;428ACPI_EXTERN u32 acpi_gbl_num_objects;429430ACPI_EXTERN u32 acpi_gbl_size_of_parse_tree;431ACPI_EXTERN u32 acpi_gbl_size_of_method_trees;432ACPI_EXTERN u32 acpi_gbl_size_of_node_entries;433ACPI_EXTERN u32 acpi_gbl_size_of_acpi_objects;434435#endif /* ACPI_DEBUGGER */436437#endif /* __ACGLOBAL_H__ */438439440