From: Rafael J. Wysocki Date: Tue, 27 May 2014 16:11:38 +0000 (+0200) Subject: Merge back earlier ACPICA material. X-Git-Tag: v3.16-rc1~30^2~5^2~6^2~9 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=c9b77a4070a60762aee048e3c353d72fb990f940;p=linux.git Merge back earlier ACPICA material. Conflicts: drivers/acpi/acpica/acglobal.h --- c9b77a4070a60762aee048e3c353d72fb990f940 diff --cc include/acpi/acpixf.h index 44f5e9749601,4e3044ca4855..b5f7132f431f --- a/include/acpi/acpixf.h +++ b/include/acpi/acpixf.h @@@ -55,222 -55,458 +55,458 @@@ extern u8 acpi_gbl_permanent_mmap; + /***************************************************************************** + * + * Macros used for ACPICA globals and configuration + * + ****************************************************************************/ + /* - * Globals that are publically available + * Ensure that global variables are defined and initialized only once. + * + * The use of these macros allows for a single list of globals (here) + * in order to simplify maintenance of the code. */ - extern u32 acpi_current_gpe_count; - extern struct acpi_table_fadt acpi_gbl_FADT; - extern u8 acpi_gbl_system_awake_and_running; - extern u8 acpi_gbl_reduced_hardware; /* ACPI 5.0 */ - extern u8 acpi_gbl_osi_data; + #ifdef DEFINE_ACPI_GLOBALS + #define ACPI_GLOBAL(type,name) \ + extern type name; \ + type name - /* Runtime configuration of debug print levels */ + #define ACPI_INIT_GLOBAL(type,name,value) \ + type name=value - extern u32 acpi_dbg_level; - extern u32 acpi_dbg_layer; - - /* ACPICA runtime options */ + #else + #ifndef ACPI_GLOBAL + #define ACPI_GLOBAL(type,name) \ + extern type name + #endif - extern u8 acpi_gbl_auto_serialize_methods; - extern u8 acpi_gbl_copy_dsdt_locally; - extern u8 acpi_gbl_create_osi_method; - extern u8 acpi_gbl_disable_auto_repair; - extern u8 acpi_gbl_disable_ssdt_table_load; - extern u8 acpi_gbl_do_not_use_xsdt; - extern u8 acpi_gbl_enable_aml_debug_object; - extern u8 acpi_gbl_enable_interpreter_slack; - extern u32 acpi_gbl_trace_flags; - extern acpi_name acpi_gbl_trace_method_name; - extern u8 acpi_gbl_truncate_io_addresses; - extern u8 acpi_gbl_use32_bit_fadt_addresses; - extern u8 acpi_gbl_use_default_register_widths; + #ifndef ACPI_INIT_GLOBAL + #define ACPI_INIT_GLOBAL(type,name,value) \ + extern type name + #endif + #endif /* - * Hardware-reduced prototypes. All interfaces that use these macros will - * be configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag - * is set to TRUE. + * These macros configure the various ACPICA interfaces. They are + * useful for generating stub inline functions for features that are + * configured out of the current kernel or ACPICA application. */ - #if (!ACPI_REDUCED_HARDWARE) - #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ + #ifndef ACPI_EXTERNAL_RETURN_STATUS + #define ACPI_EXTERNAL_RETURN_STATUS(prototype) \ prototype; + #endif - #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ + #ifndef ACPI_EXTERNAL_RETURN_OK + #define ACPI_EXTERNAL_RETURN_OK(prototype) \ prototype; + #endif - #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ + #ifndef ACPI_EXTERNAL_RETURN_VOID + #define ACPI_EXTERNAL_RETURN_VOID(prototype) \ prototype; + #endif - #else - #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ - static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} - - #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ - static ACPI_INLINE prototype {return(AE_OK);} + #ifndef ACPI_EXTERNAL_RETURN_UINT32 + #define ACPI_EXTERNAL_RETURN_UINT32(prototype) \ + prototype; + #endif - #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ - static ACPI_INLINE prototype {return;} + #ifndef ACPI_EXTERNAL_RETURN_PTR + #define ACPI_EXTERNAL_RETURN_PTR(prototype) \ + prototype; + #endif - #endif /* !ACPI_REDUCED_HARDWARE */ + /***************************************************************************** + * + * Public globals and runtime configuration options + * + ****************************************************************************/ /* - * Initialization + * Enable "slack mode" of the AML interpreter? Default is FALSE, and the + * interpreter strictly follows the ACPI specification. Setting to TRUE + * allows the interpreter to ignore certain errors and/or bad AML constructs. + * + * Currently, these features are enabled by this flag: + * + * 1) Allow "implicit return" of last value in a control method + * 2) Allow access beyond the end of an operation region + * 3) Allow access to uninitialized locals/args (auto-init to integer 0) + * 4) Allow ANY object type to be a source operand for the Store() operator + * 5) Allow unresolved references (invalid target name) in package objects + * 6) Enable warning messages for behavior that is not ACPI spec compliant */ - acpi_status __init - acpi_initialize_tables(struct acpi_table_desc *initial_storage, - u32 initial_table_count, u8 allow_resize); - - acpi_status __init acpi_initialize_subsystem(void); - - acpi_status __init acpi_enable_subsystem(u32 flags); + ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_interpreter_slack, FALSE); - acpi_status __init acpi_initialize_objects(u32 flags); - - acpi_status __init acpi_terminate(void); + /* + * Automatically serialize all methods that create named objects? Default + * is TRUE, meaning that all non_serialized methods are scanned once at + * table load time to determine those that create named objects. Methods + * that create named objects are marked Serialized in order to prevent + * possible run-time problems if they are entered by more than one thread. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_auto_serialize_methods, TRUE); /* - * Miscellaneous global interfaces + * Create the predefined _OSI method in the namespace? Default is TRUE + * because ACPICA is fully compatible with other ACPI implementations. + * Changing this will revert ACPICA (and machine ASL) to pre-OSI behavior. */ - ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) - ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) - #ifdef ACPI_FUTURE_USAGE - acpi_status acpi_subsystem_status(void); - #endif + ACPI_INIT_GLOBAL(u8, acpi_gbl_create_osi_method, TRUE); - #ifdef ACPI_FUTURE_USAGE - acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer); - #endif + /* + * Optionally use default values for the ACPI register widths. Set this to + * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_use_default_register_widths, TRUE); - acpi_status acpi_get_statistics(struct acpi_statistics *stats); + /* + * Optionally enable output from the AML Debug Object. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_enable_aml_debug_object, FALSE); - const char *acpi_format_exception(acpi_status exception); + /* + * Optionally copy the entire DSDT to local memory (instead of simply + * mapping it.) There are some BIOSs that corrupt or replace the original + * DSDT, creating the need for this option. Default is FALSE, do not copy + * the DSDT. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_copy_dsdt_locally, FALSE); - acpi_status acpi_purge_cached_objects(void); + /* + * Optionally ignore an XSDT if present and use the RSDT instead. + * Although the ACPI specification requires that an XSDT be used instead + * of the RSDT, the XSDT has been found to be corrupt or ill-formed on + * some machines. Default behavior is to use the XSDT if present. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_do_not_use_xsdt, FALSE); - acpi_status acpi_install_interface(acpi_string interface_name); + /* + * Optionally use 32-bit FADT addresses if and when there is a conflict + * (address mismatch) between the 32-bit and 64-bit versions of the + * address. Although ACPICA adheres to the ACPI specification which + * requires the use of the corresponding 64-bit address if it is non-zero, + * some machines have been found to have a corrupted non-zero 64-bit - * address. Default is FALSE, do not favor the 32-bit addresses. ++ * address. Default is TRUE, favor the 32-bit addresses. + */ -ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, FALSE); ++ACPI_INIT_GLOBAL(u8, acpi_gbl_use32_bit_fadt_addresses, TRUE); - acpi_status acpi_remove_interface(acpi_string interface_name); + /* + * Optionally truncate I/O addresses to 16 bits. Provides compatibility + * with other ACPI implementations. NOTE: During ACPICA initialization, + * this value is set to TRUE if any Windows OSI strings have been + * requested by the BIOS. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_truncate_io_addresses, FALSE); - acpi_status acpi_update_interfaces(u8 action); + /* + * Disable runtime checking and repair of values returned by control methods. + * Use only if the repair is causing a problem on a particular machine. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_auto_repair, FALSE); - u32 - acpi_check_address_range(acpi_adr_space_type space_id, - acpi_physical_address address, - acpi_size length, u8 warn); + /* + * Optionally do not install any SSDTs from the RSDT/XSDT during initialization. + * This can be useful for debugging ACPI problems on some machines. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_disable_ssdt_table_install, FALSE); - acpi_status - acpi_decode_pld_buffer(u8 *in_buffer, - acpi_size length, struct acpi_pld_info **return_buffer); + /* + * We keep track of the latest version of Windows that has been requested by + * the BIOS. ACPI 5.0. + */ + ACPI_INIT_GLOBAL(u8, acpi_gbl_osi_data, 0); /* - * ACPI table load/unload interfaces + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. */ - acpi_status acpi_load_table(struct acpi_table_header *table); + ACPI_INIT_GLOBAL(u8, acpi_gbl_reduced_hardware, FALSE); - acpi_status acpi_unload_parent_table(acpi_handle object); + /* + * This mechanism is used to trace a specified AML method. The method is + * traced each time it is executed. + */ + ACPI_INIT_GLOBAL(u32, acpi_gbl_trace_flags, 0); + ACPI_INIT_GLOBAL(acpi_name, acpi_gbl_trace_method_name, 0); - acpi_status __init acpi_load_tables(void); + /* + * Runtime configuration of debug output control masks. We want the debug + * switches statically initialized so they are already set when the debugger + * is entered. + */ + ACPI_INIT_GLOBAL(u32, acpi_dbg_level, ACPI_DEBUG_DEFAULT); + ACPI_INIT_GLOBAL(u32, acpi_dbg_layer, 0); /* - * ACPI table manipulation interfaces + * Other miscellaneous globals */ - acpi_status __init acpi_reallocate_root_table(void); + ACPI_GLOBAL(struct acpi_table_fadt, acpi_gbl_FADT); + ACPI_GLOBAL(u32, acpi_current_gpe_count); + ACPI_GLOBAL(u8, acpi_gbl_system_awake_and_running); - acpi_status __init acpi_find_root_pointer(acpi_size *rsdp_address); + /***************************************************************************** + * + * ACPICA public interface configuration. + * + * Interfaces that are configured out of the ACPICA build are replaced + * by inlined stubs by default. + * + ****************************************************************************/ - acpi_status acpi_unload_table_id(acpi_owner_id id); + /* + * Hardware-reduced prototypes (default: Not hardware reduced). + * + * All ACPICA hardware-related interfaces that use these macros will be + * configured out of the ACPICA build if the ACPI_REDUCED_HARDWARE flag + * is set to TRUE. + * + * Note: This static build option for reduced hardware is intended to + * reduce ACPICA code size if desired or necessary. However, even if this + * option is not specified, the runtime behavior of ACPICA is dependent + * on the actual FADT reduced hardware flag (HW_REDUCED_ACPI). If set, + * the flag will enable similar behavior -- ACPICA will not attempt + * to access any ACPI-relate hardware (SCI, GPEs, Fixed Events, etc.) + */ + #if (!ACPI_REDUCED_HARDWARE) + #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ + ACPI_EXTERNAL_RETURN_STATUS(prototype) - acpi_status - acpi_get_table_header(acpi_string signature, - u32 instance, struct acpi_table_header *out_table_header); + #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ + ACPI_EXTERNAL_RETURN_OK(prototype) - acpi_status - acpi_get_table_with_size(acpi_string signature, - u32 instance, struct acpi_table_header **out_table, - acpi_size *tbl_size); + #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ + ACPI_EXTERNAL_RETURN_VOID(prototype) - acpi_status - acpi_get_table(acpi_string signature, - u32 instance, struct acpi_table_header **out_table); + #else + #define ACPI_HW_DEPENDENT_RETURN_STATUS(prototype) \ + static ACPI_INLINE prototype {return(AE_NOT_CONFIGURED);} - acpi_status - acpi_get_table_by_index(u32 table_index, struct acpi_table_header **out_table); + #define ACPI_HW_DEPENDENT_RETURN_OK(prototype) \ + static ACPI_INLINE prototype {return(AE_OK);} - acpi_status - acpi_install_table_handler(acpi_table_handler handler, void *context); + #define ACPI_HW_DEPENDENT_RETURN_VOID(prototype) \ + static ACPI_INLINE prototype {return;} - acpi_status acpi_remove_table_handler(acpi_table_handler handler); + #endif /* !ACPI_REDUCED_HARDWARE */ /* - * Namespace and name interfaces + * Error message prototypes (default: error messages enabled). + * + * All interfaces related to error and warning messages + * will be configured out of the ACPICA build if the + * ACPI_NO_ERROR_MESSAGE flag is defined. */ - acpi_status - acpi_walk_namespace(acpi_object_type type, - acpi_handle start_object, - u32 max_depth, - acpi_walk_callback descending_callback, - acpi_walk_callback ascending_callback, - void *context, void **return_value); + #ifndef ACPI_NO_ERROR_MESSAGES + #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ + prototype; - acpi_status - acpi_get_devices(const char *HID, - acpi_walk_callback user_function, - void *context, void **return_value); + #else + #define ACPI_MSG_DEPENDENT_RETURN_VOID(prototype) \ + static ACPI_INLINE prototype {return;} - acpi_status - acpi_get_name(acpi_handle object, - u32 name_type, struct acpi_buffer *ret_path_ptr); + #endif /* ACPI_NO_ERROR_MESSAGES */ - acpi_status - acpi_get_handle(acpi_handle parent, - acpi_string pathname, acpi_handle * ret_handle); + /* + * Debugging output prototypes (default: no debug output). + * + * All interfaces related to debug output messages + * will be configured out of the ACPICA build unless the + * ACPI_DEBUG_OUTPUT flag is defined. + */ + #ifdef ACPI_DEBUG_OUTPUT + #define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ + prototype; - acpi_status - acpi_attach_data(acpi_handle object, acpi_object_handler handler, void *data); + #else + #define ACPI_DBG_DEPENDENT_RETURN_VOID(prototype) \ + static ACPI_INLINE prototype {return;} - acpi_status acpi_detach_data(acpi_handle object, acpi_object_handler handler); + #endif /* ACPI_DEBUG_OUTPUT */ - acpi_status - acpi_get_data_full(acpi_handle object, acpi_object_handler handler, void **data, - void (*callback)(void *)); + /***************************************************************************** + * + * ACPICA public interface prototypes + * + ****************************************************************************/ - acpi_status - acpi_get_data(acpi_handle object, acpi_object_handler handler, void **data); + /* + * Initialization + */ + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init + acpi_initialize_tables(struct acpi_table_desc + *initial_storage, + u32 initial_table_count, + u8 allow_resize)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_initialize_subsystem(void)) - acpi_status - acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags); + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_enable_subsystem(u32 flags)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init + acpi_initialize_objects(u32 flags)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_terminate(void)) /* - * Object manipulation and enumeration + * Miscellaneous global interfaces */ - acpi_status - acpi_evaluate_object(acpi_handle object, - acpi_string pathname, - struct acpi_object_list *parameter_objects, - struct acpi_buffer *return_object_buffer); + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void)) + #ifdef ACPI_FUTURE_USAGE + ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_subsystem_status(void)) + #endif - acpi_status - acpi_evaluate_object_typed(acpi_handle object, - acpi_string pathname, - struct acpi_object_list *external_params, - struct acpi_buffer *return_buffer, - acpi_object_type return_type); + #ifdef ACPI_FUTURE_USAGE + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_system_info(struct acpi_buffer + *ret_buffer)) + #endif + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_statistics(struct acpi_statistics *stats)) + ACPI_EXTERNAL_RETURN_PTR(const char + *acpi_format_exception(acpi_status exception)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_purge_cached_objects(void)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_install_interface(acpi_string interface_name)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_remove_interface(acpi_string interface_name)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_update_interfaces(u8 action)) + + ACPI_EXTERNAL_RETURN_UINT32(u32 + acpi_check_address_range(acpi_adr_space_type + space_id, + acpi_physical_address + address, acpi_size length, + u8 warn)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_decode_pld_buffer(u8 *in_buffer, + acpi_size length, + struct acpi_pld_info + **return_buffer)) - acpi_status - acpi_get_object_info(acpi_handle object, - struct acpi_device_info **return_buffer); + /* + * ACPI table load/unload interfaces + */ + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init + acpi_install_table(acpi_physical_address address, + u8 physical)) - acpi_status acpi_install_method(u8 *buffer); + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_load_table(struct acpi_table_header *table)) - acpi_status - acpi_get_next_object(acpi_object_type type, - acpi_handle parent, - acpi_handle child, acpi_handle * out_handle); + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_unload_parent_table(acpi_handle object)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_load_tables(void)) - acpi_status acpi_get_type(acpi_handle object, acpi_object_type * out_type); + /* + * ACPI table manipulation interfaces + */ + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init acpi_reallocate_root_table(void)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status __init + acpi_find_root_pointer(acpi_size * rsdp_address)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_table_header(acpi_string signature, + u32 instance, + struct acpi_table_header + *out_table_header)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_table(acpi_string signature, u32 instance, + struct acpi_table_header + **out_table)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_table_by_index(u32 table_index, + struct acpi_table_header + **out_table)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_install_table_handler(acpi_table_handler + handler, void *context)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_remove_table_handler(acpi_table_handler + handler)) - acpi_status acpi_get_id(acpi_handle object, acpi_owner_id * out_type); + /* + * Namespace and name interfaces + */ + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_walk_namespace(acpi_object_type type, + acpi_handle start_object, + u32 max_depth, + acpi_walk_callback + descending_callback, + acpi_walk_callback + ascending_callback, + void *context, + void **return_value)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_devices(const char *HID, + acpi_walk_callback user_function, + void *context, + void **return_value)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_name(acpi_handle object, u32 name_type, + struct acpi_buffer *ret_path_ptr)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_handle(acpi_handle parent, + acpi_string pathname, + acpi_handle * ret_handle)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_attach_data(acpi_handle object, + acpi_object_handler handler, + void *data)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_detach_data(acpi_handle object, + acpi_object_handler handler)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_data(acpi_handle object, + acpi_object_handler handler, + void **data)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_debug_trace(char *name, u32 debug_level, + u32 debug_layer, u32 flags)) - acpi_status acpi_get_parent(acpi_handle object, acpi_handle * out_handle); + /* + * Object manipulation and enumeration + */ + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_evaluate_object(acpi_handle object, + acpi_string pathname, + struct acpi_object_list + *parameter_objects, + struct acpi_buffer + *return_object_buffer)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_evaluate_object_typed(acpi_handle object, + acpi_string pathname, + struct acpi_object_list + *external_params, + struct acpi_buffer + *return_buffer, + acpi_object_type + return_type)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_object_info(acpi_handle object, + struct acpi_device_info + **return_buffer)) + ACPI_EXTERNAL_RETURN_STATUS(acpi_status acpi_install_method(u8 *buffer)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_next_object(acpi_object_type type, + acpi_handle parent, + acpi_handle child, + acpi_handle * out_handle)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_type(acpi_handle object, + acpi_object_type * out_type)) + + ACPI_EXTERNAL_RETURN_STATUS(acpi_status + acpi_get_parent(acpi_handle object, + acpi_handle * out_handle)) /* * Handler interfaces