diff options
author | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-04-07 23:49:35 (GMT) |
commit | 62b8c978ee6b8d135d9e7953221de58000dba986 (patch) | |
tree | 683b04b2e627f6710c22c151b23c8cc9a165315e /drivers/acpi/acpica | |
parent | 78fd82238d0e5716578c326404184a27ba67fd6e (diff) | |
download | linux-fsl-qoriq-62b8c978ee6b8d135d9e7953221de58000dba986.tar.xz |
Rewind v3.13-rc3+ (78fd82238d0e5716) to v3.12
Diffstat (limited to 'drivers/acpi/acpica')
93 files changed, 407 insertions, 927 deletions
diff --git a/drivers/acpi/acpica/acdebug.h b/drivers/acpi/acpica/acdebug.h index a9fd0b8..9feba08 100644 --- a/drivers/acpi/acpica/acdebug.h +++ b/drivers/acpi/acpica/acdebug.h @@ -114,12 +114,10 @@ ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_gpe(char *gpe_arg, char *block_arg)) -ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_db_generate_sci(void)) - /* * dbconvert - miscellaneous conversion routines */ -acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value); + acpi_status acpi_db_hex_char_to_value(int hex_char, u8 *return_value); acpi_status acpi_db_convert_to_package(char *string, union acpi_object *object); @@ -156,8 +154,6 @@ void acpi_db_set_scope(char *name); void acpi_db_dump_namespace(char *start_arg, char *depth_arg); -void acpi_db_dump_namespace_paths(void); - void acpi_db_dump_namespace_by_owner(char *owner_arg, char *depth_arg); acpi_status acpi_db_find_name_in_namespace(char *name_arg); @@ -244,8 +240,6 @@ void acpi_db_display_history(void); char *acpi_db_get_from_history(char *command_num_arg); -char *acpi_db_get_history_by_index(u32 commandd_num); - /* * dbinput - user front-end to the AML debugger */ diff --git a/drivers/acpi/acpica/acevents.h b/drivers/acpi/acpica/acevents.h index 41abe55..ab0e977 100644 --- a/drivers/acpi/acpica/acevents.h +++ b/drivers/acpi/acpica/acevents.h @@ -71,8 +71,7 @@ acpi_status acpi_ev_init_global_lock_handler(void); ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_acquire_global_lock(u16 timeout)) - -ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void)) + ACPI_HW_DEPENDENT_RETURN_OK(acpi_status acpi_ev_release_global_lock(void)) acpi_status acpi_ev_remove_global_lock_handler(void); /* @@ -243,11 +242,11 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj, */ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context); -u32 acpi_ev_sci_dispatch(void); - u32 acpi_ev_install_sci_handler(void); -acpi_status acpi_ev_remove_all_sci_handlers(void); +acpi_status acpi_ev_remove_sci_handler(void); + +u32 acpi_ev_initialize_SCI(u32 program_SCI); ACPI_HW_DEPENDENT_RETURN_VOID(void acpi_ev_terminate(void)) #endif /* __ACEVENTS_H__ */ diff --git a/drivers/acpi/acpica/acglobal.h b/drivers/acpi/acpica/acglobal.h index e9f1fc7..90e846f 100644 --- a/drivers/acpi/acpica/acglobal.h +++ b/drivers/acpi/acpica/acglobal.h @@ -269,7 +269,6 @@ ACPI_EXTERN acpi_table_handler acpi_gbl_table_handler; ACPI_EXTERN void *acpi_gbl_table_handler_context; ACPI_EXTERN struct acpi_walk_state *acpi_gbl_breakpoint_walk; ACPI_EXTERN acpi_interface_handler acpi_gbl_interface_handler; -ACPI_EXTERN struct acpi_sci_handler_info *acpi_gbl_sci_handler_list; /* Owner ID support */ @@ -406,9 +405,7 @@ extern u32 acpi_gbl_nesting_level; /* Event counters */ -ACPI_EXTERN u32 acpi_method_count; ACPI_EXTERN u32 acpi_gpe_count; -ACPI_EXTERN u32 acpi_sci_count; ACPI_EXTERN u32 acpi_fixed_event_count[ACPI_NUM_FIXED_EVENTS]; /* Support for dynamic control method tracing mechanism */ @@ -448,6 +445,13 @@ ACPI_EXTERN u8 acpi_gbl_db_opt_tables; ACPI_EXTERN u8 acpi_gbl_db_opt_stats; ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods; ACPI_EXTERN u8 acpi_gbl_db_opt_no_region_support; + +ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_EXTERN char acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_EXTERN char acpi_gbl_db_scope_buf[80]; +ACPI_EXTERN char acpi_gbl_db_debug_filename[80]; ACPI_EXTERN u8 acpi_gbl_db_output_to_file; ACPI_EXTERN char *acpi_gbl_db_buffer; ACPI_EXTERN char *acpi_gbl_db_filename; @@ -455,16 +459,6 @@ ACPI_EXTERN u32 acpi_gbl_db_debug_level; ACPI_EXTERN u32 acpi_gbl_db_console_debug_level; ACPI_EXTERN struct acpi_namespace_node *acpi_gbl_db_scope_node; -ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS]; - -/* These buffers should all be the same size */ - -ACPI_EXTERN char acpi_gbl_db_line_buf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char acpi_gbl_db_parsed_buf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char acpi_gbl_db_scope_buf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char acpi_gbl_db_debug_filename[ACPI_DB_LINE_BUFFER_SIZE]; - /* * Statistic globals */ diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 53ed1a8..0ed0066 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h @@ -398,14 +398,6 @@ struct acpi_simple_repair_info { * ****************************************************************************/ -/* Dispatch info for each host-installed SCI handler */ - -struct acpi_sci_handler_info { - struct acpi_sci_handler_info *next; - acpi_sci_handler address; /* Address of handler */ - void *context; /* Context to be passed to handler */ -}; - /* Dispatch info for each GPE -- either a method or handler, cannot be both */ struct acpi_gpe_handler_info { @@ -1072,7 +1064,7 @@ struct acpi_db_method_info { char *name; u32 flags; u32 num_loops; - char pathname[ACPI_DB_LINE_BUFFER_SIZE]; + char pathname[128]; char **args; acpi_object_type *types; @@ -1094,7 +1086,6 @@ struct acpi_integrity_info { u32 objects; }; -#define ACPI_DB_DISABLE_OUTPUT 0x00 #define ACPI_DB_REDIRECTABLE_OUTPUT 0x01 #define ACPI_DB_CONSOLE_OUTPUT 0x02 #define ACPI_DB_DUPLICATE_OUTPUT 0x03 diff --git a/drivers/acpi/acpica/acmacros.h b/drivers/acpi/acpica/acmacros.h index 2a86c65..530a2f8 100644 --- a/drivers/acpi/acpica/acmacros.h +++ b/drivers/acpi/acpica/acmacros.h @@ -410,6 +410,37 @@ #endif /* + * Memory allocation tracking (DEBUG ONLY) + */ +#define ACPI_MEM_PARAMETERS _COMPONENT, _acpi_module_name, __LINE__ + +#ifndef ACPI_DBG_TRACK_ALLOCATIONS + +/* Memory allocation */ + +#ifndef ACPI_ALLOCATE +#define ACPI_ALLOCATE(a) acpi_ut_allocate((acpi_size) (a), ACPI_MEM_PARAMETERS) +#endif +#ifndef ACPI_ALLOCATE_ZEROED +#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed((acpi_size) (a), ACPI_MEM_PARAMETERS) +#endif +#ifndef ACPI_FREE +#define ACPI_FREE(a) acpi_os_free(a) +#endif +#define ACPI_MEM_TRACKING(a) + +#else + +/* Memory allocation */ + +#define ACPI_ALLOCATE(a) acpi_ut_allocate_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS) +#define ACPI_ALLOCATE_ZEROED(a) acpi_ut_allocate_zeroed_and_track((acpi_size) (a), ACPI_MEM_PARAMETERS) +#define ACPI_FREE(a) acpi_ut_free_and_track(a, ACPI_MEM_PARAMETERS) +#define ACPI_MEM_TRACKING(a) a + +#endif /* ACPI_DBG_TRACK_ALLOCATIONS */ + +/* * Macros used for ACPICA utilities only */ diff --git a/drivers/acpi/acpica/acnamesp.h b/drivers/acpi/acpica/acnamesp.h index e6138ac..40b04bd 100644 --- a/drivers/acpi/acpica/acnamesp.h +++ b/drivers/acpi/acpica/acnamesp.h @@ -213,12 +213,6 @@ acpi_ns_dump_objects(acpi_object_type type, u8 display_type, u32 max_depth, acpi_owner_id owner_id, acpi_handle start_handle); - -void -acpi_ns_dump_object_paths(acpi_object_type type, - u8 display_type, - u32 max_depth, - acpi_owner_id owner_id, acpi_handle start_handle); #endif /* ACPI_FUTURE_USAGE */ /* diff --git a/drivers/acpi/acpica/acresrc.h b/drivers/acpi/acpica/acresrc.h index ff97430..f691d0e 100644 --- a/drivers/acpi/acpica/acresrc.h +++ b/drivers/acpi/acpica/acresrc.h @@ -184,7 +184,7 @@ acpi_rs_create_resource_list(union acpi_operand_object *aml_buffer, struct acpi_buffer *output_buffer); acpi_status -acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, struct acpi_buffer *output_buffer); acpi_status @@ -227,8 +227,8 @@ acpi_rs_get_list_length(u8 * aml_buffer, u32 aml_buffer_length, acpi_size * size_needed); acpi_status -acpi_rs_get_aml_length(struct acpi_resource *resource_list, - acpi_size resource_list_size, acpi_size * size_needed); +acpi_rs_get_aml_length(struct acpi_resource *linked_list_buffer, + acpi_size * size_needed); acpi_status acpi_rs_get_pci_routing_table_length(union acpi_operand_object *package_object, diff --git a/drivers/acpi/acpica/acutils.h b/drivers/acpi/acpica/acutils.h index be8180c..d5a62a6 100644 --- a/drivers/acpi/acpica/acutils.h +++ b/drivers/acpi/acpica/acutils.h @@ -628,17 +628,6 @@ u8 acpi_ut_valid_acpi_char(char character, u32 position); void acpi_ut_repair_name(char *name); -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) -u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source); - -u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source); - -u8 -acpi_ut_safe_strncat(char *dest, - acpi_size dest_size, - char *source, acpi_size max_transfer_length); -#endif - /* * utmutex - mutex support */ @@ -663,6 +652,12 @@ acpi_status acpi_ut_initialize_buffer(struct acpi_buffer *buffer, acpi_size required_length); +void *acpi_ut_allocate(acpi_size size, + u32 component, const char *module, u32 line); + +void *acpi_ut_allocate_zeroed(acpi_size size, + u32 component, const char *module, u32 line); + #ifdef ACPI_DBG_TRACK_ALLOCATIONS void *acpi_ut_allocate_and_track(acpi_size size, u32 component, const char *module, u32 line); diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c index afdc6df..fb09b08 100644 --- a/drivers/acpi/acpica/dsargs.c +++ b/drivers/acpi/acpica/dsargs.c @@ -158,7 +158,7 @@ acpi_ds_execute_arguments(struct acpi_namespace_node *node, walk_state->deferred_node = node; status = acpi_ps_parse_aml(walk_state); -cleanup: + cleanup: acpi_ps_delete_parse_tree(op); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/dsfield.c b/drivers/acpi/acpica/dsfield.c index 2d4c073..d4bfe7b 100644 --- a/drivers/acpi/acpica/dsfield.c +++ b/drivers/acpi/acpica/dsfield.c @@ -259,7 +259,7 @@ acpi_ds_create_buffer_field(union acpi_parse_object *op, goto cleanup; } -cleanup: + cleanup: /* Remove local reference to the object */ diff --git a/drivers/acpi/acpica/dsmethod.c b/drivers/acpi/acpica/dsmethod.c index 81a78ba..a9ffd44 100644 --- a/drivers/acpi/acpica/dsmethod.c +++ b/drivers/acpi/acpica/dsmethod.c @@ -292,10 +292,9 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, * reentered one more time (even if it is the same thread) */ obj_desc->method.thread_count++; - acpi_method_count++; return_ACPI_STATUS(status); -cleanup: + cleanup: /* On error, must release the method mutex (if present) */ if (obj_desc->method.mutex) { @@ -425,7 +424,7 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread, return_ACPI_STATUS(status); -cleanup: + cleanup: /* On error, we must terminate the method properly */ diff --git a/drivers/acpi/acpica/dsobject.c b/drivers/acpi/acpica/dsobject.c index b1746a6..63f0d22 100644 --- a/drivers/acpi/acpica/dsobject.c +++ b/drivers/acpi/acpica/dsobject.c @@ -240,7 +240,7 @@ acpi_ds_build_internal_object(struct acpi_walk_state *walk_state, return_ACPI_STATUS(status); } -exit: + exit: *obj_desc_ptr = obj_desc; return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 5205edc..1fc1ff1 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c @@ -257,7 +257,7 @@ acpi_ds_init_buffer_field(u16 aml_opcode, (buffer_desc->common.reference_count + obj_desc->common.reference_count); -cleanup: + cleanup: /* Always delete the operands */ diff --git a/drivers/acpi/acpica/dsutils.c b/drivers/acpi/acpica/dsutils.c index ade44e4..c666fc0 100644 --- a/drivers/acpi/acpica/dsutils.c +++ b/drivers/acpi/acpica/dsutils.c @@ -299,7 +299,7 @@ acpi_ds_is_result_used(union acpi_parse_object * op, goto result_used; } -result_used: + result_used: ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n", acpi_ps_get_opcode_name(op->common.aml_opcode), @@ -308,7 +308,7 @@ result_used: return_UINT8(TRUE); -result_not_used: + result_not_used: ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n", acpi_ps_get_opcode_name(op->common.aml_opcode), @@ -752,7 +752,7 @@ acpi_ds_create_operands(struct acpi_walk_state *walk_state, return_ACPI_STATUS(status); -cleanup: + cleanup: /* * We must undo everything done above; meaning that we must * pop everything off of the operand stack and delete those @@ -851,7 +851,7 @@ acpi_status acpi_ds_evaluate_name_path(struct acpi_walk_state *walk_state) goto exit; } -push_result: + push_result: walk_state->result_obj = new_obj_desc; @@ -863,7 +863,7 @@ push_result: op->common.flags |= ACPI_PARSEOP_IN_STACK; } -exit: + exit: return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c index 1bbb22f..151d924 100644 --- a/drivers/acpi/acpica/dswexec.c +++ b/drivers/acpi/acpica/dswexec.c @@ -170,7 +170,7 @@ acpi_ds_get_predicate_value(struct acpi_walk_state *walk_state, (void)acpi_ds_do_implicit_return(local_obj_desc, walk_state, TRUE); -cleanup: + cleanup: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Completed a predicate eval=%X Op=%p\n", walk_state->control_state->common.value, @@ -335,7 +335,7 @@ acpi_ds_exec_begin_op(struct acpi_walk_state *walk_state, return_ACPI_STATUS(status); -error_exit: + error_exit: status = acpi_ds_method_error(status, walk_state); return_ACPI_STATUS(status); } @@ -722,7 +722,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state) walk_state->result_obj = NULL; } -cleanup: + cleanup: if (walk_state->result_obj) { diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c index 7f569d5..b1f8f47 100644 --- a/drivers/acpi/acpica/dswload2.c +++ b/drivers/acpi/acpica/dswload2.c @@ -728,7 +728,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state) break; } -cleanup: + cleanup: /* Remove the Node pushed at the very beginning */ diff --git a/drivers/acpi/acpica/evglock.c b/drivers/acpi/acpica/evglock.c index 4c67193..fdb0a76 100644 --- a/drivers/acpi/acpica/evglock.c +++ b/drivers/acpi/acpica/evglock.c @@ -173,7 +173,7 @@ static u32 acpi_ev_global_lock_handler(void *context) acpi_gbl_global_lock_pending = FALSE; -cleanup_and_exit: + cleanup_and_exit: acpi_os_release_lock(acpi_gbl_global_lock_pending_lock, flags); return (ACPI_INTERRUPT_HANDLED); diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index a9cb4a1..c8a1f7d 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c @@ -458,7 +458,7 @@ u32 acpi_ev_gpe_detect(struct acpi_gpe_xrupt_info * gpe_xrupt_list) gpe_block = gpe_block->next; } -unlock_and_exit: + unlock_and_exit: acpi_os_release_lock(acpi_gbl_gpe_lock, flags); return (int_status); @@ -522,7 +522,6 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); if (ACPI_FAILURE(status)) { - ACPI_FREE(local_gpe_event_info); return_VOID; } diff --git a/drivers/acpi/acpica/evgpeblk.c b/drivers/acpi/acpica/evgpeblk.c index a9e76bc..c1aa1ed 100644 --- a/drivers/acpi/acpica/evgpeblk.c +++ b/drivers/acpi/acpica/evgpeblk.c @@ -111,7 +111,7 @@ acpi_ev_install_gpe_block(struct acpi_gpe_block_info *gpe_block, gpe_block->xrupt_block = gpe_xrupt_block; acpi_os_release_lock(acpi_gbl_gpe_lock, flags); -unlock_and_exit: + unlock_and_exit: status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } @@ -178,7 +178,7 @@ acpi_status acpi_ev_delete_gpe_block(struct acpi_gpe_block_info *gpe_block) ACPI_FREE(gpe_block->event_info); ACPI_FREE(gpe_block); -unlock_and_exit: + unlock_and_exit: status = acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } @@ -302,7 +302,7 @@ acpi_ev_create_gpe_info_blocks(struct acpi_gpe_block_info *gpe_block) return_ACPI_STATUS(AE_OK); -error_exit: + error_exit: if (gpe_register_info) { ACPI_FREE(gpe_register_info); } diff --git a/drivers/acpi/acpica/evgpeinit.c b/drivers/acpi/acpica/evgpeinit.c index a3e2f38..7842700 100644 --- a/drivers/acpi/acpica/evgpeinit.c +++ b/drivers/acpi/acpica/evgpeinit.c @@ -203,7 +203,7 @@ acpi_status acpi_ev_gpe_initialize(void) goto cleanup; } -cleanup: + cleanup: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/acpica/evgpeutil.c b/drivers/acpi/acpica/evgpeutil.c index d3f5e1e..b24dbb8 100644 --- a/drivers/acpi/acpica/evgpeutil.c +++ b/drivers/acpi/acpica/evgpeutil.c @@ -101,7 +101,7 @@ acpi_ev_walk_gpe_list(acpi_gpe_callback gpe_walk_callback, void *context) gpe_xrupt_info = gpe_xrupt_info->next; } -unlock_and_exit: + unlock_and_exit: acpi_os_release_lock(acpi_gbl_gpe_lock, flags); return_ACPI_STATUS(status); } @@ -196,7 +196,7 @@ acpi_ev_get_gpe_device(struct acpi_gpe_xrupt_info *gpe_xrupt_info, * * FUNCTION: acpi_ev_get_gpe_xrupt_block * - * PARAMETERS: interrupt_number - Interrupt for a GPE block + * PARAMETERS: interrupt_number - Interrupt for a GPE block * * RETURN: A GPE interrupt block * diff --git a/drivers/acpi/acpica/evhandler.c b/drivers/acpi/acpica/evhandler.c index e315731..068af96 100644 --- a/drivers/acpi/acpica/evhandler.c +++ b/drivers/acpi/acpica/evhandler.c @@ -129,7 +129,7 @@ acpi_status acpi_ev_install_region_handlers(void) } } -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(status); } @@ -531,6 +531,6 @@ acpi_ev_install_space_handler(struct acpi_namespace_node * node, acpi_ev_install_handler, NULL, handler_obj, NULL); -unlock_and_exit: + unlock_and_exit: return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/evmisc.c b/drivers/acpi/acpica/evmisc.c index a568754..1b111ef 100644 --- a/drivers/acpi/acpica/evmisc.c +++ b/drivers/acpi/acpica/evmisc.c @@ -264,6 +264,13 @@ void acpi_ev_terminate(void) status = acpi_ev_walk_gpe_list(acpi_hw_disable_gpe_block, NULL); + /* Remove SCI handler */ + + status = acpi_ev_remove_sci_handler(); + if (ACPI_FAILURE(status)) { + ACPI_ERROR((AE_INFO, "Could not remove SCI handler")); + } + status = acpi_ev_remove_global_lock_handler(); if (ACPI_FAILURE(status)) { ACPI_ERROR((AE_INFO, @@ -273,13 +280,6 @@ void acpi_ev_terminate(void) acpi_gbl_events_initialized = FALSE; } - /* Remove SCI handlers */ - - status = acpi_ev_remove_all_sci_handlers(); - if (ACPI_FAILURE(status)) { - ACPI_ERROR((AE_INFO, "Could not remove SCI handler")); - } - /* Deallocate all handler objects installed within GPE info structs */ status = acpi_ev_walk_gpe_list(acpi_ev_delete_gpe_handlers, NULL); diff --git a/drivers/acpi/acpica/evregion.c b/drivers/acpi/acpica/evregion.c index 144cbb9..cea14d6 100644 --- a/drivers/acpi/acpica/evregion.c +++ b/drivers/acpi/acpica/evregion.c @@ -217,11 +217,16 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj, if (!(region_obj->region.flags & AOPOBJ_SETUP_COMPLETE)) { region_obj->region.flags |= AOPOBJ_SETUP_COMPLETE; - /* - * Save the returned context for use in all accesses to - * the handler for this particular region - */ - if (!(region_obj2->extra.region_context)) { + if (region_obj2->extra.region_context) { + + /* The handler for this region was already installed */ + + ACPI_FREE(region_context); + } else { + /* + * Save the returned context for use in all accesses to + * this particular region + */ region_obj2->extra.region_context = region_context; } @@ -397,14 +402,6 @@ acpi_ev_detach_region(union acpi_operand_object *region_obj, handler_obj->address_space. context, region_context); - /* - * region_context should have been released by the deactivate - * operation. We don't need access to it anymore here. - */ - if (region_context) { - *region_context = NULL; - } - /* Init routine may fail, Just ignore errors */ if (ACPI_FAILURE(status)) { @@ -573,10 +570,10 @@ acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function) status = acpi_ns_evaluate(info); acpi_ut_remove_reference(args[1]); -cleanup2: + cleanup2: acpi_ut_remove_reference(args[0]); -cleanup1: + cleanup1: ACPI_FREE(info); return_ACPI_STATUS(status); } @@ -761,7 +758,7 @@ acpi_ev_orphan_ec_reg_method(struct acpi_namespace_node *ec_device_node) status = acpi_evaluate_object(reg_method, NULL, &args, NULL); -exit: + exit: /* We ignore all errors from above, don't care */ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); diff --git a/drivers/acpi/acpica/evsci.c b/drivers/acpi/acpica/evsci.c index 9e9e345..b905acf 100644 --- a/drivers/acpi/acpica/evsci.c +++ b/drivers/acpi/acpica/evsci.c @@ -54,50 +54,6 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context); /******************************************************************************* * - * FUNCTION: acpi_ev_sci_dispatch - * - * PARAMETERS: None - * - * RETURN: Status code indicates whether interrupt was handled. - * - * DESCRIPTION: Dispatch the SCI to all host-installed SCI handlers. - * - ******************************************************************************/ - -u32 acpi_ev_sci_dispatch(void) -{ - struct acpi_sci_handler_info *sci_handler; - acpi_cpu_flags flags; - u32 int_status = ACPI_INTERRUPT_NOT_HANDLED; - - ACPI_FUNCTION_NAME(ev_sci_dispatch); - - /* Are there any host-installed SCI handlers? */ - - if (!acpi_gbl_sci_handler_list) { - return (int_status); - } - - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); - - /* Invoke all host-installed SCI handlers */ - - sci_handler = acpi_gbl_sci_handler_list; - while (sci_handler) { - - /* Invoke the installed handler (at interrupt level) */ - - int_status |= sci_handler->address(sci_handler->context); - - sci_handler = sci_handler->next; - } - - acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - return (int_status); -} - -/******************************************************************************* - * * FUNCTION: acpi_ev_sci_xrupt_handler * * PARAMETERS: context - Calling Context @@ -133,11 +89,6 @@ static u32 ACPI_SYSTEM_XFACE acpi_ev_sci_xrupt_handler(void *context) */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); - /* Invoke all host-installed SCI handlers */ - - interrupt_handled |= acpi_ev_sci_dispatch(); - - acpi_sci_count++; return_UINT32(interrupt_handled); } @@ -161,13 +112,14 @@ u32 ACPI_SYSTEM_XFACE acpi_ev_gpe_xrupt_handler(void *context) ACPI_FUNCTION_TRACE(ev_gpe_xrupt_handler); /* - * We are guaranteed by the ACPICA initialization/shutdown code that + * We are guaranteed by the ACPI CA initialization/shutdown code that * if this interrupt handler is installed, ACPI is enabled. */ /* GPEs: Check for and dispatch any GPEs that have occurred */ interrupt_handled |= acpi_ev_gpe_detect(gpe_xrupt_list); + return_UINT32(interrupt_handled); } @@ -198,15 +150,15 @@ u32 acpi_ev_install_sci_handler(void) /****************************************************************************** * - * FUNCTION: acpi_ev_remove_all_sci_handlers + * FUNCTION: acpi_ev_remove_sci_handler * * PARAMETERS: none * - * RETURN: AE_OK if handler uninstalled, AE_ERROR if handler was not + * RETURN: E_OK if handler uninstalled OK, E_ERROR if handler was not * installed to begin with * * DESCRIPTION: Remove the SCI interrupt handler. No further SCIs will be - * taken. Remove all host-installed SCI handlers. + * taken. * * Note: It doesn't seem important to disable all events or set the event * enable registers to their original values. The OS should disable @@ -215,13 +167,11 @@ u32 acpi_ev_install_sci_handler(void) * ******************************************************************************/ -acpi_status acpi_ev_remove_all_sci_handlers(void) +acpi_status acpi_ev_remove_sci_handler(void) { - struct acpi_sci_handler_info *sci_handler; - acpi_cpu_flags flags; acpi_status status; - ACPI_FUNCTION_TRACE(ev_remove_all_sci_handlers); + ACPI_FUNCTION_TRACE(ev_remove_sci_handler); /* Just let the OS remove the handler and disable the level */ @@ -229,21 +179,6 @@ acpi_status acpi_ev_remove_all_sci_handlers(void) acpi_os_remove_interrupt_handler((u32) acpi_gbl_FADT.sci_interrupt, acpi_ev_sci_xrupt_handler); - if (!acpi_gbl_sci_handler_list) { - return (status); - } - - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); - - /* Free all host-installed SCI handlers */ - - while (acpi_gbl_sci_handler_list) { - sci_handler = acpi_gbl_sci_handler_list; - acpi_gbl_sci_handler_list = sci_handler->next; - ACPI_FREE(sci_handler); - } - - acpi_os_release_lock(acpi_gbl_gpe_lock, flags); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/evxface.c b/drivers/acpi/acpica/evxface.c index 23a7fad..ca5fba9 100644 --- a/drivers/acpi/acpica/evxface.c +++ b/drivers/acpi/acpica/evxface.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -375,7 +374,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler) acpi_gbl_exception_handler = handler; -cleanup: + cleanup: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } @@ -386,144 +385,6 @@ ACPI_EXPORT_SYMBOL(acpi_install_exception_handler) #if (!ACPI_REDUCED_HARDWARE) /******************************************************************************* * - * FUNCTION: acpi_install_sci_handler - * - * PARAMETERS: address - Address of the handler - * context - Value passed to the handler on each SCI - * - * RETURN: Status - * - * DESCRIPTION: Install a handler for a System Control Interrupt. - * - ******************************************************************************/ -acpi_status acpi_install_sci_handler(acpi_sci_handler address, void *context) -{ - struct acpi_sci_handler_info *new_sci_handler; - struct acpi_sci_handler_info *sci_handler; - acpi_cpu_flags flags; - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_install_sci_handler); - - if (!address) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - /* Allocate and init a handler object */ - - new_sci_handler = ACPI_ALLOCATE(sizeof(struct acpi_sci_handler_info)); - if (!new_sci_handler) { - return_ACPI_STATUS(AE_NO_MEMORY); - } - - new_sci_handler->address = address; - new_sci_handler->context = context; - - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); - if (ACPI_FAILURE(status)) { - goto exit; - } - - /* Lock list during installation */ - - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); - sci_handler = acpi_gbl_sci_handler_list; - - /* Ensure handler does not already exist */ - - while (sci_handler) { - if (address == sci_handler->address) { - status = AE_ALREADY_EXISTS; - goto unlock_and_exit; - } - - sci_handler = sci_handler->next; - } - - /* Install the new handler into the global list (at head) */ - - new_sci_handler->next = acpi_gbl_sci_handler_list; - acpi_gbl_sci_handler_list = new_sci_handler; - -unlock_and_exit: - - acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); - -exit: - if (ACPI_FAILURE(status)) { - ACPI_FREE(new_sci_handler); - } - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * - * FUNCTION: acpi_remove_sci_handler - * - * PARAMETERS: address - Address of the handler - * - * RETURN: Status - * - * DESCRIPTION: Remove a handler for a System Control Interrupt. - * - ******************************************************************************/ - -acpi_status acpi_remove_sci_handler(acpi_sci_handler address) -{ - struct acpi_sci_handler_info *prev_sci_handler; - struct acpi_sci_handler_info *next_sci_handler; - acpi_cpu_flags flags; - acpi_status status; - - ACPI_FUNCTION_TRACE(acpi_remove_sci_handler); - - if (!address) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS); - if (ACPI_FAILURE(status)) { - return_ACPI_STATUS(status); - } - - /* Remove the SCI handler with lock */ - - flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock); - - prev_sci_handler = NULL; - next_sci_handler = acpi_gbl_sci_handler_list; - while (next_sci_handler) { - if (next_sci_handler->address == address) { - - /* Unlink and free the SCI handler info block */ - - if (prev_sci_handler) { - prev_sci_handler->next = next_sci_handler->next; - } else { - acpi_gbl_sci_handler_list = - next_sci_handler->next; - } - - acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - ACPI_FREE(next_sci_handler); - goto unlock_and_exit; - } - - prev_sci_handler = next_sci_handler; - next_sci_handler = next_sci_handler->next; - } - - acpi_os_release_lock(acpi_gbl_gpe_lock, flags); - status = AE_NOT_EXIST; - -unlock_and_exit: - (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); - return_ACPI_STATUS(status); -} - -/******************************************************************************* - * * FUNCTION: acpi_install_global_event_handler * * PARAMETERS: handler - Pointer to the global event handler function @@ -537,7 +398,6 @@ unlock_and_exit: * Can be used to update event counters, etc. * ******************************************************************************/ - acpi_status acpi_install_global_event_handler(acpi_gbl_event_handler handler, void *context) { @@ -566,7 +426,7 @@ acpi_install_global_event_handler(acpi_gbl_event_handler handler, void *context) acpi_gbl_global_event_handler = handler; acpi_gbl_global_event_handler_context = context; -cleanup: + cleanup: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } @@ -638,7 +498,7 @@ acpi_install_fixed_event_handler(u32 event, handler)); } -cleanup: + cleanup: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/evxfevnt.c b/drivers/acpi/acpica/evxfevnt.c index 39d06af..7039606 100644 --- a/drivers/acpi/acpica/evxfevnt.c +++ b/drivers/acpi/acpica/evxfevnt.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "actables.h" diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 5713da7..7662f1a 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acevents.h" @@ -472,7 +471,7 @@ acpi_get_gpe_status(acpi_handle gpe_device, if (gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) *event_status |= ACPI_EVENT_FLAG_HANDLE; -unlock_and_exit: + unlock_and_exit: acpi_os_release_lock(acpi_gbl_gpe_lock, flags); return_ACPI_STATUS(status); } @@ -625,7 +624,7 @@ acpi_install_gpe_block(acpi_handle gpe_device, obj_desc->device.gpe_block = gpe_block; -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(status); } @@ -680,7 +679,7 @@ acpi_status acpi_remove_gpe_block(acpi_handle gpe_device) obj_desc->device.gpe_block = NULL; } -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/evxfregn.c b/drivers/acpi/acpica/evxfregn.c index 02ed75a..80cecf8 100644 --- a/drivers/acpi/acpica/evxfregn.c +++ b/drivers/acpi/acpica/evxfregn.c @@ -42,8 +42,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -148,7 +147,7 @@ acpi_install_address_space_handler(acpi_handle device, status = acpi_ev_execute_reg_methods(node, space_id); -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(status); } @@ -287,7 +286,7 @@ acpi_remove_address_space_handler(acpi_handle device, status = AE_NOT_EXIST; -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/excreate.c b/drivers/acpi/acpica/excreate.c index 3c2e6dc..269e81d 100644 --- a/drivers/acpi/acpica/excreate.c +++ b/drivers/acpi/acpica/excreate.c @@ -193,7 +193,7 @@ acpi_status acpi_ex_create_event(struct acpi_walk_state *walk_state) acpi_ns_attach_object((struct acpi_namespace_node *)walk_state-> operands[0], obj_desc, ACPI_TYPE_EVENT); -cleanup: + cleanup: /* * Remove local reference to the object (on error, will cause deletion * of both object and semaphore if present.) @@ -248,7 +248,7 @@ acpi_status acpi_ex_create_mutex(struct acpi_walk_state *walk_state) acpi_ns_attach_object(obj_desc->mutex.node, obj_desc, ACPI_TYPE_MUTEX); -cleanup: + cleanup: /* * Remove local reference to the object (on error, will cause deletion * of both object and semaphore if present.) @@ -347,7 +347,7 @@ acpi_ex_create_region(u8 * aml_start, status = acpi_ns_attach_object(node, obj_desc, ACPI_TYPE_REGION); -cleanup: + cleanup: /* Remove local reference to the object */ @@ -520,7 +520,7 @@ acpi_ex_create_method(u8 * aml_start, acpi_ut_remove_reference(obj_desc); -exit: + exit: /* Remove a reference to the operand */ acpi_ut_remove_reference(operand[1]); diff --git a/drivers/acpi/acpica/exfield.c b/drivers/acpi/acpica/exfield.c index cfd8752..c2a65aa 100644 --- a/drivers/acpi/acpica/exfield.c +++ b/drivers/acpi/acpica/exfield.c @@ -197,7 +197,7 @@ acpi_ex_read_data_from_field(struct acpi_walk_state *walk_state, status = acpi_ex_extract_from_field(obj_desc, buffer, (u32) length); acpi_ex_release_global_lock(obj_desc->common_field.field_flags); -exit: + exit: if (ACPI_FAILURE(status)) { acpi_ut_remove_reference(buffer_desc); } else { diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index 49fb742..7e0afe7 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c @@ -123,6 +123,12 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, } } + /* Exit if Address/Length have been disallowed by the host OS */ + + if (rgn_desc->common.flags & AOPOBJ_INVALID) { + return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); + } + /* * Exit now for SMBus, GSBus or IPMI address space, it has a non-linear * address space and the request cannot be directly validated @@ -996,7 +1002,7 @@ acpi_ex_insert_into_field(union acpi_operand_object *obj_desc, mask, merged_datum, field_offset); -exit: + exit: /* Free temporary buffer if we used one */ if (new_buffer) { diff --git a/drivers/acpi/acpica/exmisc.c b/drivers/acpi/acpica/exmisc.c index 65d9360..00bf298 100644 --- a/drivers/acpi/acpica/exmisc.c +++ b/drivers/acpi/acpica/exmisc.c @@ -388,7 +388,7 @@ acpi_ex_do_concatenate(union acpi_operand_object *operand0, *actual_return_desc = return_desc; -cleanup: + cleanup: if (local_operand1 != operand1) { acpi_ut_remove_reference(local_operand1); } @@ -718,7 +718,7 @@ acpi_ex_do_logical_op(u16 opcode, } } -cleanup: + cleanup: /* New object was created if implicit conversion performed - delete */ diff --git a/drivers/acpi/acpica/exoparg1.c b/drivers/acpi/acpica/exoparg1.c index d74cea4..2cdd41d 100644 --- a/drivers/acpi/acpica/exoparg1.c +++ b/drivers/acpi/acpica/exoparg1.c @@ -115,7 +115,7 @@ acpi_status acpi_ex_opcode_0A_0T_1R(struct acpi_walk_state *walk_state) break; } -cleanup: + cleanup: /* Delete return object on error */ @@ -234,7 +234,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state) goto cleanup; } -cleanup: + cleanup: return_ACPI_STATUS(status); } @@ -551,7 +551,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_store(return_desc, operand[1], walk_state); } -cleanup: + cleanup: /* Delete return object on error */ @@ -1054,7 +1054,7 @@ acpi_status acpi_ex_opcode_1A_0T_1R(struct acpi_walk_state *walk_state) goto cleanup; } -cleanup: + cleanup: /* Delete return object on error */ diff --git a/drivers/acpi/acpica/exoparg2.c b/drivers/acpi/acpica/exoparg2.c index d6fa0fc..d5088f7 100644 --- a/drivers/acpi/acpica/exoparg2.c +++ b/drivers/acpi/acpica/exoparg2.c @@ -215,7 +215,7 @@ acpi_status acpi_ex_opcode_2A_2T_1R(struct acpi_walk_state *walk_state) goto cleanup; } -cleanup: + cleanup: /* * Since the remainder is not returned indirectly, remove a reference to * it. Only the quotient is returned indirectly. @@ -445,7 +445,7 @@ acpi_status acpi_ex_opcode_2A_1T_1R(struct acpi_walk_state *walk_state) break; } -store_result_to_target: + store_result_to_target: if (ACPI_SUCCESS(status)) { /* @@ -462,7 +462,7 @@ store_result_to_target: } } -cleanup: + cleanup: /* Delete return object on error */ @@ -553,7 +553,7 @@ acpi_status acpi_ex_opcode_2A_0T_1R(struct acpi_walk_state *walk_state) goto cleanup; } -store_logical_result: + store_logical_result: /* * Set return value to according to logical_result. logical TRUE (all ones) * Default is FALSE (zero) @@ -562,7 +562,7 @@ store_logical_result: return_desc->integer.value = ACPI_UINT64_MAX; } -cleanup: + cleanup: /* Delete return object on error */ diff --git a/drivers/acpi/acpica/exoparg3.c b/drivers/acpi/acpica/exoparg3.c index bc042ad..37656f1 100644 --- a/drivers/acpi/acpica/exoparg3.c +++ b/drivers/acpi/acpica/exoparg3.c @@ -124,7 +124,7 @@ acpi_status acpi_ex_opcode_3A_0T_0R(struct acpi_walk_state *walk_state) goto cleanup; } -cleanup: + cleanup: return_ACPI_STATUS(status); } @@ -252,7 +252,7 @@ acpi_status acpi_ex_opcode_3A_1T_1R(struct acpi_walk_state *walk_state) status = acpi_ex_store(return_desc, operand[3], walk_state); -cleanup: + cleanup: /* Delete return object on error */ diff --git a/drivers/acpi/acpica/exoparg6.c b/drivers/acpi/acpica/exoparg6.c index 4459e32..879b6cd 100644 --- a/drivers/acpi/acpica/exoparg6.c +++ b/drivers/acpi/acpica/exoparg6.c @@ -314,7 +314,7 @@ acpi_status acpi_ex_opcode_6A_0T_1R(struct acpi_walk_state * walk_state) goto cleanup; } -cleanup: + cleanup: /* Delete return object on error */ diff --git a/drivers/acpi/acpica/exregion.c b/drivers/acpi/acpica/exregion.c index 9d28867e..303429bb 100644 --- a/drivers/acpi/acpica/exregion.c +++ b/drivers/acpi/acpica/exregion.c @@ -400,7 +400,6 @@ acpi_ex_pci_config_space_handler(u32 function, switch (function) { case ACPI_READ: - *value = 0; status = acpi_os_read_pci_configuration(pci_id, pci_register, value, bit_width); break; diff --git a/drivers/acpi/acpica/exresolv.c b/drivers/acpi/acpica/exresolv.c index 1606524..ac04278 100644 --- a/drivers/acpi/acpica/exresolv.c +++ b/drivers/acpi/acpica/exresolv.c @@ -521,7 +521,7 @@ acpi_ex_resolve_multiple(struct acpi_walk_state *walk_state, */ type = obj_desc->common.type; -exit: + exit: /* Convert internal types to external types */ switch (type) { diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c index be3f669..00e5af7 100644 --- a/drivers/acpi/acpica/exresop.c +++ b/drivers/acpi/acpica/exresop.c @@ -683,7 +683,7 @@ acpi_ex_resolve_operands(u16 opcode, return_ACPI_STATUS(status); } -next_operand: + next_operand: /* * If more operands needed, decrement stack_ptr to point * to next operand on stack diff --git a/drivers/acpi/acpica/hwregs.c b/drivers/acpi/acpica/hwregs.c index 12e6cff..8d2e866 100644 --- a/drivers/acpi/acpica/hwregs.c +++ b/drivers/acpi/acpica/hwregs.c @@ -560,7 +560,7 @@ acpi_status acpi_hw_register_write(u32 register_id, u32 value) break; } -exit: + exit: return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/hwtimer.c b/drivers/acpi/acpica/hwtimer.c index 3c498dc..2d7d22e 100644 --- a/drivers/acpi/acpica/hwtimer.c +++ b/drivers/acpi/acpica/hwtimer.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c index b4b47db..5ee7a81 100644 --- a/drivers/acpi/acpica/hwxface.c +++ b/drivers/acpi/acpica/hwxface.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -84,17 +83,11 @@ acpi_status acpi_reset(void) * For I/O space, write directly to the OSL. This bypasses the port * validation mechanism, which may block a valid write to the reset * register. - * - * NOTE: - * The ACPI spec requires the reset register width to be 8, so we - * hardcode it here and ignore the FADT value. This maintains - * compatibility with other ACPI implementations that have allowed - * BIOS code with bad register width values to go unnoticed. + * Spec section 4.7.3.6 requires register width to be 8. */ status = acpi_os_write_port((acpi_io_address) reset_reg->address, - acpi_gbl_FADT.reset_value, - ACPI_RESET_REGISTER_WIDTH); + acpi_gbl_FADT.reset_value, 8); } else { /* Write the reset value to the reset register */ @@ -126,8 +119,7 @@ ACPI_EXPORT_SYMBOL(acpi_reset) ******************************************************************************/ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg) { - u32 value_lo; - u32 value_hi; + u32 value; u32 width; u64 address; acpi_status status; @@ -145,8 +137,13 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg) return (status); } + /* Initialize entire 64-bit return value to zero */ + + *return_value = 0; + value = 0; + /* - * Two address spaces supported: Memory or I/O. PCI_Config is + * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient */ if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) { @@ -158,35 +155,29 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg) } } else { /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ - value_lo = 0; - value_hi = 0; - width = reg->bit_width; if (width == 64) { width = 32; /* Break into two 32-bit transfers */ } status = acpi_hw_read_port((acpi_io_address) - address, &value_lo, width); + address, &value, width); if (ACPI_FAILURE(status)) { return (status); } + *return_value = value; if (reg->bit_width == 64) { /* Read the top 32 bits */ status = acpi_hw_read_port((acpi_io_address) - (address + 4), &value_hi, - 32); + (address + 4), &value, 32); if (ACPI_FAILURE(status)) { return (status); } + *return_value |= ((u64)value << 32); } - - /* Set the return value only if status is AE_OK */ - - *return_value = (value_lo | ((u64)value_hi << 32)); } ACPI_DEBUG_PRINT((ACPI_DB_IO, @@ -195,7 +186,7 @@ acpi_status acpi_read(u64 *return_value, struct acpi_generic_address *reg) ACPI_FORMAT_UINT64(address), acpi_ut_get_region_name(reg->space_id))); - return (AE_OK); + return (status); } ACPI_EXPORT_SYMBOL(acpi_read) @@ -570,10 +561,10 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b) break; } -cleanup1: + cleanup1: acpi_ut_remove_reference(info->return_object); -cleanup: + cleanup: if (ACPI_FAILURE(status)) { ACPI_EXCEPTION((AE_INFO, status, "While evaluating Sleep State [%s]", diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c index 15dddc1..f2e669d 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" @@ -167,7 +166,7 @@ ACPI_EXPORT_SYMBOL(acpi_set_firmware_waking_vector64) * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ -acpi_status acpi_enter_sleep_state_s4bios(void) +acpi_status asmlinkage acpi_enter_sleep_state_s4bios(void) { u32 in_value; acpi_status status; @@ -361,7 +360,7 @@ ACPI_EXPORT_SYMBOL(acpi_enter_sleep_state_prep) * THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED * ******************************************************************************/ -acpi_status acpi_enter_sleep_state(u8 sleep_state) +acpi_status asmlinkage acpi_enter_sleep_state(u8 sleep_state) { acpi_status status; diff --git a/drivers/acpi/acpica/nsaccess.c b/drivers/acpi/acpica/nsaccess.c index 14f65f6..c5316e5 100644 --- a/drivers/acpi/acpica/nsaccess.c +++ b/drivers/acpi/acpica/nsaccess.c @@ -240,7 +240,7 @@ acpi_status acpi_ns_root_initialize(void) } } -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); /* Save a handle to "_GPE", it is always present */ @@ -424,9 +424,8 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, /* Current scope has no parent scope */ ACPI_ERROR((AE_INFO, - "%s: Path has too many parent prefixes (^) " - "- reached beyond root node", - pathname)); + "ACPI path has too many parent prefixes (^) " + "- reached beyond root node")); return_ACPI_STATUS(AE_NOT_FOUND); } } diff --git a/drivers/acpi/acpica/nsalloc.c b/drivers/acpi/acpica/nsalloc.c index fd1ff54..2437373 100644 --- a/drivers/acpi/acpica/nsalloc.c +++ b/drivers/acpi/acpica/nsalloc.c @@ -106,7 +106,6 @@ struct acpi_namespace_node *acpi_ns_create_node(u32 name) void acpi_ns_delete_node(struct acpi_namespace_node *node) { union acpi_operand_object *obj_desc; - union acpi_operand_object *next_desc; ACPI_FUNCTION_NAME(ns_delete_node); @@ -115,13 +114,12 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) acpi_ns_detach_object(node); /* - * Delete an attached data object list if present (objects that were - * attached via acpi_attach_data). Note: After any normal object is - * detached above, the only possible remaining object(s) are data - * objects, in a linked list. + * Delete an attached data object if present (an object that was created + * and attached via acpi_attach_data). Note: After any normal object is + * detached above, the only possible remaining object is a data object. */ obj_desc = node->object; - while (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) { + if (obj_desc && (obj_desc->common.type == ACPI_TYPE_LOCAL_DATA)) { /* Invoke the attached data deletion handler if present */ @@ -129,15 +127,7 @@ void acpi_ns_delete_node(struct acpi_namespace_node *node) obj_desc->data.handler(node, obj_desc->data.pointer); } - next_desc = obj_desc->common.next_object; acpi_ut_remove_reference(obj_desc); - obj_desc = next_desc; - } - - /* Special case for the statically allocated root node */ - - if (node == acpi_gbl_root_node) { - return; } /* Now we can delete the node */ diff --git a/drivers/acpi/acpica/nsdump.c b/drivers/acpi/acpica/nsdump.c index 48b9c6f..7418c77 100644 --- a/drivers/acpi/acpica/nsdump.c +++ b/drivers/acpi/acpica/nsdump.c @@ -59,17 +59,6 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, #endif #if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - -#ifdef ACPI_FUTURE_USAGE -static acpi_status -acpi_ns_dump_one_object_path(acpi_handle obj_handle, - u32 level, void *context, void **return_value); - -static acpi_status -acpi_ns_get_max_depth(acpi_handle obj_handle, - u32 level, void *context, void **return_value); -#endif /* ACPI_FUTURE_USAGE */ - /******************************************************************************* * * FUNCTION: acpi_ns_print_pathname @@ -620,7 +609,7 @@ acpi_ns_dump_one_object(acpi_handle obj_handle, obj_type = ACPI_TYPE_INVALID; /* Terminate loop after next pass */ } -cleanup: + cleanup: acpi_os_printf("\n"); return (AE_OK); } @@ -682,136 +671,6 @@ acpi_ns_dump_objects(acpi_object_type type, } #endif /* ACPI_FUTURE_USAGE */ -#ifdef ACPI_FUTURE_USAGE -/******************************************************************************* - * - * FUNCTION: acpi_ns_dump_one_object_path, acpi_ns_get_max_depth - * - * PARAMETERS: obj_handle - Node to be dumped - * level - Nesting level of the handle - * context - Passed into walk_namespace - * return_value - Not used - * - * RETURN: Status - * - * DESCRIPTION: Dump the full pathname to a namespace object. acp_ns_get_max_depth - * computes the maximum nesting depth in the namespace tree, in - * order to simplify formatting in acpi_ns_dump_one_object_path. - * These procedures are user_functions called by acpi_ns_walk_namespace. - * - ******************************************************************************/ - -static acpi_status -acpi_ns_dump_one_object_path(acpi_handle obj_handle, - u32 level, void *context, void **return_value) -{ - u32 max_level = *((u32 *)context); - char *pathname; - struct acpi_namespace_node *node; - int path_indent; - - if (!obj_handle) { - return (AE_OK); - } - - node = acpi_ns_validate_handle(obj_handle); - if (!node) { - - /* Ignore bad node during namespace walk */ - - return (AE_OK); - } - - pathname = acpi_ns_get_external_pathname(node); - - path_indent = 1; - if (level <= max_level) { - path_indent = max_level - level + 1; - } - - acpi_os_printf("%2d%*s%-12s%*s", - level, level, " ", acpi_ut_get_type_name(node->type), - path_indent, " "); - - acpi_os_printf("%s\n", &pathname[1]); - ACPI_FREE(pathname); - return (AE_OK); -} - -static acpi_status -acpi_ns_get_max_depth(acpi_handle obj_handle, - u32 level, void *context, void **return_value) -{ - u32 *max_level = (u32 *)context; - - if (level > *max_level) { - *max_level = level; - } - return (AE_OK); -} - -/******************************************************************************* - * - * FUNCTION: acpi_ns_dump_object_paths - * - * PARAMETERS: type - Object type to be dumped - * display_type - 0 or ACPI_DISPLAY_SUMMARY - * max_depth - Maximum depth of dump. Use ACPI_UINT32_MAX - * for an effectively unlimited depth. - * owner_id - Dump only objects owned by this ID. Use - * ACPI_UINT32_MAX to match all owners. - * start_handle - Where in namespace to start/end search - * - * RETURN: None - * - * DESCRIPTION: Dump full object pathnames within the loaded namespace. Uses - * acpi_ns_walk_namespace in conjunction with acpi_ns_dump_one_object_path. - * - ******************************************************************************/ - -void -acpi_ns_dump_object_paths(acpi_object_type type, - u8 display_type, - u32 max_depth, - acpi_owner_id owner_id, acpi_handle start_handle) -{ - acpi_status status; - u32 max_level = 0; - - ACPI_FUNCTION_ENTRY(); - - /* - * Just lock the entire namespace for the duration of the dump. - * We don't want any changes to the namespace during this time, - * especially the temporary nodes since we are going to display - * them also. - */ - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - acpi_os_printf("Could not acquire namespace mutex\n"); - return; - } - - /* Get the max depth of the namespace tree, for formatting later */ - - (void)acpi_ns_walk_namespace(type, start_handle, max_depth, - ACPI_NS_WALK_NO_UNLOCK | - ACPI_NS_WALK_TEMP_NODES, - acpi_ns_get_max_depth, NULL, - (void *)&max_level, NULL); - - /* Now dump the entire namespace */ - - (void)acpi_ns_walk_namespace(type, start_handle, max_depth, - ACPI_NS_WALK_NO_UNLOCK | - ACPI_NS_WALK_TEMP_NODES, - acpi_ns_dump_one_object_path, NULL, - (void *)&max_level, NULL); - - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); -} -#endif /* ACPI_FUTURE_USAGE */ - /******************************************************************************* * * FUNCTION: acpi_ns_dump_entry diff --git a/drivers/acpi/acpica/nsdumpdv.c b/drivers/acpi/acpica/nsdumpdv.c index 2837625..409ae80 100644 --- a/drivers/acpi/acpica/nsdumpdv.c +++ b/drivers/acpi/acpica/nsdumpdv.c @@ -69,7 +69,6 @@ static acpi_status acpi_ns_dump_one_device(acpi_handle obj_handle, u32 level, void *context, void **return_value) { - struct acpi_buffer buffer; struct acpi_device_info *info; acpi_status status; u32 i; @@ -79,17 +78,15 @@ acpi_ns_dump_one_device(acpi_handle obj_handle, status = acpi_ns_dump_one_object(obj_handle, level, context, return_value); - buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_get_object_info(obj_handle, &buffer); + status = acpi_get_object_info(obj_handle, &info); if (ACPI_SUCCESS(status)) { - info = buffer.pointer; for (i = 0; i < level; i++) { ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " ")); } ACPI_DEBUG_PRINT_RAW((ACPI_DB_TABLES, " HID: %s, ADR: %8.8X%8.8X, Status: %X\n", - info->hardware_id.value, + info->hardware_id.string, ACPI_FORMAT_UINT64(info->address), info->current_status)); ACPI_FREE(info); diff --git a/drivers/acpi/acpica/nseval.c b/drivers/acpi/acpica/nseval.c index 963ceef..18108bc 100644 --- a/drivers/acpi/acpica/nseval.c +++ b/drivers/acpi/acpica/nseval.c @@ -314,7 +314,7 @@ acpi_status acpi_ns_evaluate(struct acpi_evaluate_info *info) "*** Completed evaluation of object %s ***\n", info->relative_pathname)); -cleanup: + cleanup: /* * Namespace was unlocked by the handling acpi_ns* function, so we * just free the pathname and return @@ -486,7 +486,7 @@ acpi_ns_exec_module_code(union acpi_operand_object *method_obj, parent_node->type = (u8)type; } -exit: + exit: if (parent_obj) { acpi_ut_remove_reference(parent_obj); } diff --git a/drivers/acpi/acpica/nsinit.c b/drivers/acpi/acpica/nsinit.c index 3a0423a..dd2ceae 100644 --- a/drivers/acpi/acpica/nsinit.c +++ b/drivers/acpi/acpica/nsinit.c @@ -213,7 +213,7 @@ acpi_status acpi_ns_initialize_devices(void) return_ACPI_STATUS(status); -error_exit: + error_exit: ACPI_EXCEPTION((AE_INFO, status, "During device initialization")); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/nsload.c b/drivers/acpi/acpica/nsload.c index 89ec645..0a7badc 100644 --- a/drivers/acpi/acpica/nsload.c +++ b/drivers/acpi/acpica/nsload.c @@ -114,7 +114,7 @@ acpi_ns_load_table(u32 table_index, struct acpi_namespace_node *node) (void)acpi_tb_release_owner_id(table_index); } -unlock: + unlock: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); if (ACPI_FAILURE(status)) { diff --git a/drivers/acpi/acpica/nsparse.c b/drivers/acpi/acpica/nsparse.c index 1778573..35dde81 100644 --- a/drivers/acpi/acpica/nsparse.c +++ b/drivers/acpi/acpica/nsparse.c @@ -140,7 +140,7 @@ acpi_ns_one_complete_parse(u32 pass_number, pass_number)); status = acpi_ps_parse_aml(walk_state); -cleanup: + cleanup: acpi_ps_delete_parse_tree(parse_root); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/nspredef.c b/drivers/acpi/acpica/nspredef.c index d2855d9..098e766 100644 --- a/drivers/acpi/acpica/nspredef.c +++ b/drivers/acpi/acpica/nspredef.c @@ -271,7 +271,7 @@ acpi_ns_check_object_type(struct acpi_evaluate_info *info, return (AE_OK); /* Successful repair */ } -type_error_exit: + type_error_exit: /* Create a string with all expected types for this predefined object */ diff --git a/drivers/acpi/acpica/nsprepkg.c b/drivers/acpi/acpica/nsprepkg.c index 3d5391f..6d55cef 100644 --- a/drivers/acpi/acpica/nsprepkg.c +++ b/drivers/acpi/acpica/nsprepkg.c @@ -330,7 +330,7 @@ acpi_ns_check_package(struct acpi_evaluate_info *info, return (status); -package_too_small: + package_too_small: /* Error exit for the case with an incorrect package count */ @@ -555,7 +555,7 @@ acpi_ns_check_package_list(struct acpi_evaluate_info *info, return (AE_OK); -package_too_small: + package_too_small: /* The sub-package count was smaller than required */ diff --git a/drivers/acpi/acpica/nsrepair.c b/drivers/acpi/acpica/nsrepair.c index a05afff..f8e71ea 100644 --- a/drivers/acpi/acpica/nsrepair.c +++ b/drivers/acpi/acpica/nsrepair.c @@ -263,7 +263,7 @@ acpi_ns_simple_repair(struct acpi_evaluate_info *info, return (AE_AML_OPERAND_TYPE); -object_repaired: + object_repaired: /* Object was successfully repaired */ diff --git a/drivers/acpi/acpica/nsrepair2.c b/drivers/acpi/acpica/nsrepair2.c index 6a25d32..c84603e 100644 --- a/drivers/acpi/acpica/nsrepair2.c +++ b/drivers/acpi/acpica/nsrepair2.c @@ -478,7 +478,7 @@ acpi_ns_repair_CST(struct acpi_evaluate_info *info, removing = TRUE; } -remove_element: + remove_element: if (removing) { acpi_ns_remove_element(return_object, i + 1); outer_element_count--; diff --git a/drivers/acpi/acpica/nssearch.c b/drivers/acpi/acpica/nssearch.c index 47420fa..5d43efc 100644 --- a/drivers/acpi/acpica/nssearch.c +++ b/drivers/acpi/acpica/nssearch.c @@ -381,8 +381,7 @@ acpi_ns_search_and_enter(u32 target_name, /* Node is an object defined by an External() statement */ - if (flags & ACPI_NS_EXTERNAL || - (walk_state && walk_state->opcode == AML_SCOPE_OP)) { + if (flags & ACPI_NS_EXTERNAL) { new_node->flags |= ANOBJ_IS_EXTERNAL; } #endif diff --git a/drivers/acpi/acpica/nsutils.c b/drivers/acpi/acpica/nsutils.c index 4a0665b..08c0b5b 100644 --- a/drivers/acpi/acpica/nsutils.c +++ b/drivers/acpi/acpica/nsutils.c @@ -593,26 +593,24 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle) void acpi_ns_terminate(void) { - acpi_status status; + union acpi_operand_object *obj_desc; ACPI_FUNCTION_TRACE(ns_terminate); /* - * Free the entire namespace -- all nodes and all objects - * attached to the nodes + * 1) Free the entire namespace -- all nodes and objects + * + * Delete all object descriptors attached to namepsace nodes */ acpi_ns_delete_namespace_subtree(acpi_gbl_root_node); - /* Delete any objects attached to the root node */ + /* Detach any objects attached to the root */ - status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); - if (ACPI_FAILURE(status)) { - return_VOID; + obj_desc = acpi_ns_get_attached_object(acpi_gbl_root_node); + if (obj_desc) { + acpi_ns_detach_object(acpi_gbl_root_node); } - acpi_ns_delete_node(acpi_gbl_root_node); - (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Namespace freed\n")); return_VOID; } @@ -724,7 +722,7 @@ acpi_ns_get_node(struct acpi_namespace_node *prefix_node, (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); -cleanup: + cleanup: ACPI_FREE(internal_path); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c index e973e31..b38b4b0 100644 --- a/drivers/acpi/acpica/nsxfeval.c +++ b/drivers/acpi/acpica/nsxfeval.c @@ -42,8 +42,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -139,7 +138,7 @@ acpi_evaluate_object_typed(acpi_handle handle, /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ - ACPI_FREE_BUFFER(*return_buffer); + ACPI_FREE(return_buffer->pointer); return_buffer->pointer = NULL; } @@ -442,7 +441,7 @@ acpi_evaluate_object(acpi_handle handle, acpi_ex_exit_interpreter(); } -cleanup: + cleanup: /* Free the input parameter list (if we created one) */ @@ -606,22 +605,14 @@ acpi_walk_namespace(acpi_object_type type, goto unlock_and_exit; } - /* Now we can validate the starting node */ - - if (!acpi_ns_validate_handle(start_object)) { - status = AE_BAD_PARAMETER; - goto unlock_and_exit2; - } - status = acpi_ns_walk_namespace(type, start_object, max_depth, ACPI_NS_WALK_UNLOCK, descending_callback, ascending_callback, context, return_value); -unlock_and_exit2: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_read_lock(&acpi_gbl_namespace_rw_lock); return_ACPI_STATUS(status); } @@ -865,7 +856,7 @@ acpi_attach_data(acpi_handle obj_handle, status = acpi_ns_attach_data(node, handler, data); -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } @@ -911,7 +902,7 @@ acpi_detach_data(acpi_handle obj_handle, acpi_object_handler handler) status = acpi_ns_detach_data(node, handler); -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } @@ -958,7 +949,7 @@ acpi_get_data(acpi_handle obj_handle, acpi_object_handler handler, void **data) status = acpi_ns_get_attached_data(node, handler, data); -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); } diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c index 3a4bd3f..83c1644 100644 --- a/drivers/acpi/acpica/nsxfname.c +++ b/drivers/acpi/acpica/nsxfname.c @@ -42,8 +42,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -209,7 +208,7 @@ acpi_get_name(acpi_handle handle, u32 name_type, struct acpi_buffer * buffer) ((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0; status = AE_OK; -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); @@ -497,7 +496,7 @@ acpi_get_object_info(acpi_handle handle, *return_buffer = info; status = AE_OK; -cleanup: + cleanup: if (hid) { ACPI_FREE(hid); } diff --git a/drivers/acpi/acpica/nsxfobj.c b/drivers/acpi/acpica/nsxfobj.c index 0e6d79e..c0853ef 100644 --- a/drivers/acpi/acpica/nsxfobj.c +++ b/drivers/acpi/acpica/nsxfobj.c @@ -42,8 +42,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -201,7 +200,7 @@ acpi_status acpi_get_parent(acpi_handle handle, acpi_handle * ret_handle) status = AE_NULL_ENTRY; } -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); @@ -281,7 +280,7 @@ acpi_get_next_object(acpi_object_type type, *ret_handle = ACPI_CAST_PTR(acpi_handle, node); } -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); return (status); diff --git a/drivers/acpi/acpica/psparse.c b/drivers/acpi/acpica/psparse.c index 79d9a28..86198a9 100644 --- a/drivers/acpi/acpica/psparse.c +++ b/drivers/acpi/acpica/psparse.c @@ -297,7 +297,7 @@ acpi_ps_complete_this_op(struct acpi_walk_state * walk_state, } } -cleanup: + cleanup: /* Now we can actually delete the subtree rooted at Op */ diff --git a/drivers/acpi/acpica/psxface.c b/drivers/acpi/acpica/psxface.c index fcb7a84..11b99ab 100644 --- a/drivers/acpi/acpica/psxface.c +++ b/drivers/acpi/acpica/psxface.c @@ -142,7 +142,7 @@ static void acpi_ps_start_trace(struct acpi_evaluate_info *info) acpi_dbg_layer = acpi_gbl_trace_dbg_layer; } -exit: + exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); } @@ -185,7 +185,7 @@ static void acpi_ps_stop_trace(struct acpi_evaluate_info *info) acpi_dbg_level = acpi_gbl_original_dbg_level; acpi_dbg_layer = acpi_gbl_original_dbg_layer; -exit: + exit: (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); } @@ -323,7 +323,7 @@ acpi_status acpi_ps_execute_method(struct acpi_evaluate_info *info) /* walk_state was deleted by parse_aml */ -cleanup: + cleanup: acpi_ps_delete_parse_tree(op); /* End optional tracing */ diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c index b60c9cf..b62a0f4 100644 --- a/drivers/acpi/acpica/rscalc.c +++ b/drivers/acpi/acpica/rscalc.c @@ -174,7 +174,6 @@ acpi_rs_stream_option_length(u32 resource_length, * FUNCTION: acpi_rs_get_aml_length * * PARAMETERS: resource - Pointer to the resource linked list - * resource_list_size - Size of the resource linked list * size_needed - Where the required size is returned * * RETURN: Status @@ -186,20 +185,16 @@ acpi_rs_stream_option_length(u32 resource_length, ******************************************************************************/ acpi_status -acpi_rs_get_aml_length(struct acpi_resource *resource, - acpi_size resource_list_size, acpi_size * size_needed) +acpi_rs_get_aml_length(struct acpi_resource * resource, acpi_size * size_needed) { acpi_size aml_size_needed = 0; - struct acpi_resource *resource_end; acpi_rs_length total_size; ACPI_FUNCTION_TRACE(rs_get_aml_length); /* Traverse entire list of internal resource descriptors */ - resource_end = - ACPI_ADD_PTR(struct acpi_resource, resource, resource_list_size); - while (resource < resource_end) { + while (resource) { /* Validate the descriptor type */ diff --git a/drivers/acpi/acpica/rscreate.c b/drivers/acpi/acpica/rscreate.c index 3a2ace9..65f3e1c 100644 --- a/drivers/acpi/acpica/rscreate.c +++ b/drivers/acpi/acpica/rscreate.c @@ -418,21 +418,22 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object, * * FUNCTION: acpi_rs_create_aml_resources * - * PARAMETERS: resource_list - Pointer to the resource list buffer - * output_buffer - Where the AML buffer is returned + * PARAMETERS: linked_list_buffer - Pointer to the resource linked list + * output_buffer - Pointer to the user's buffer * * RETURN: Status AE_OK if okay, else a valid acpi_status code. * If the output_buffer is too small, the error will be * AE_BUFFER_OVERFLOW and output_buffer->Length will point * to the size buffer needed. * - * DESCRIPTION: Converts a list of device resources to an AML bytestream - * to be used as input for the _SRS control method. + * DESCRIPTION: Takes the linked list of device resources and + * creates a bytestream to be used as input for the + * _SRS control method. * ******************************************************************************/ acpi_status -acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, +acpi_rs_create_aml_resources(struct acpi_resource *linked_list_buffer, struct acpi_buffer *output_buffer) { acpi_status status; @@ -440,16 +441,16 @@ acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, ACPI_FUNCTION_TRACE(rs_create_aml_resources); - /* Params already validated, no need to re-validate here */ - - ACPI_DEBUG_PRINT((ACPI_DB_INFO, "ResourceList Buffer = %p\n", - resource_list->pointer)); - - /* Get the buffer size needed for the AML byte stream */ + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "LinkedListBuffer = %p\n", + linked_list_buffer)); - status = acpi_rs_get_aml_length(resource_list->pointer, - resource_list->length, - &aml_size_needed); + /* + * Params already validated, so we don't re-validate here + * + * Pass the linked_list_buffer into a module that calculates + * the buffer size needed for the byte stream. + */ + status = acpi_rs_get_aml_length(linked_list_buffer, &aml_size_needed); ACPI_DEBUG_PRINT((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", (u32)aml_size_needed, acpi_format_exception(status))); @@ -466,9 +467,10 @@ acpi_rs_create_aml_resources(struct acpi_buffer *resource_list, /* Do the conversion */ - status = acpi_rs_convert_resources_to_aml(resource_list->pointer, - aml_size_needed, - output_buffer->pointer); + status = + acpi_rs_convert_resources_to_aml(linked_list_buffer, + aml_size_needed, + output_buffer->pointer); if (ACPI_FAILURE(status)) { return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/rsmisc.c b/drivers/acpi/acpica/rsmisc.c index c99cec9..80d1299 100644 --- a/drivers/acpi/acpica/rsmisc.c +++ b/drivers/acpi/acpica/rsmisc.c @@ -440,7 +440,7 @@ acpi_rs_convert_aml_to_resource(struct acpi_resource *resource, info++; } -exit: + exit: if (!flags_mode) { /* Round the resource struct length up to the next boundary (32 or 64) */ @@ -783,7 +783,7 @@ acpi_rs_convert_resource_to_aml(struct acpi_resource *resource, info++; } -exit: + exit: return_ACPI_STATUS(AE_OK); } diff --git a/drivers/acpi/acpica/rsutils.c b/drivers/acpi/acpica/rsutils.c index 14a7982..480b6b4 100644 --- a/drivers/acpi/acpica/rsutils.c +++ b/drivers/acpi/acpica/rsutils.c @@ -753,7 +753,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, * Convert the linked list into a byte stream */ buffer.length = ACPI_ALLOCATE_LOCAL_BUFFER; - status = acpi_rs_create_aml_resources(in_buffer, &buffer); + status = acpi_rs_create_aml_resources(in_buffer->pointer, &buffer); if (ACPI_FAILURE(status)) { goto cleanup; } @@ -784,7 +784,7 @@ acpi_rs_set_srs_method_data(struct acpi_namespace_node *node, acpi_ut_remove_reference(args[0]); -cleanup: + cleanup: ACPI_FREE(info); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/rsxface.c b/drivers/acpi/acpica/rsxface.c index 01e4769..94e3517 100644 --- a/drivers/acpi/acpica/rsxface.c +++ b/drivers/acpi/acpica/rsxface.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acresrc.h" diff --git a/drivers/acpi/acpica/tbinstal.c b/drivers/acpi/acpica/tbinstal.c index 634357d..42a13c0 100644 --- a/drivers/acpi/acpica/tbinstal.c +++ b/drivers/acpi/acpica/tbinstal.c @@ -80,10 +80,16 @@ acpi_status acpi_tb_verify_table(struct acpi_table_desc *table_desc) } } - /* Always calculate checksum, ignore bad checksum if requested */ + /* FACS is the odd table, has no standard ACPI header and no checksum */ - status = - acpi_tb_verify_checksum(table_desc->pointer, table_desc->length); + if (!ACPI_COMPARE_NAME(&table_desc->signature, ACPI_SIG_FACS)) { + + /* Always calculate checksum, ignore bad checksum if requested */ + + status = + acpi_tb_verify_checksum(table_desc->pointer, + table_desc->length); + } return_ACPI_STATUS(status); } @@ -231,10 +237,10 @@ acpi_tb_add_table(struct acpi_table_desc *table_desc, u32 *table_index) goto release; } -print_header: + print_header: acpi_tb_print_table_header(table_desc->address, table_desc->pointer); -release: + release: (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); return_ACPI_STATUS(status); } @@ -306,7 +312,7 @@ struct acpi_table_header *acpi_tb_table_override(struct acpi_table_header return (NULL); /* There was no override */ -finish_override: + finish_override: ACPI_INFO((AE_INFO, "%4.4s %p %s table override, new table: %p", diff --git a/drivers/acpi/acpica/tbprint.c b/drivers/acpi/acpica/tbprint.c index 6866e76..dc963f8 100644 --- a/drivers/acpi/acpica/tbprint.c +++ b/drivers/acpi/acpica/tbprint.c @@ -135,10 +135,10 @@ acpi_tb_print_table_header(acpi_physical_address address, /* FACS only has signature and length fields */ - ACPI_INFO((AE_INFO, "%4.4s %p %06X", + ACPI_INFO((AE_INFO, "%4.4s %p %05X", header->signature, ACPI_CAST_PTR(void, address), header->length)); - } else if (ACPI_VALIDATE_RSDP_SIG(header->signature)) { + } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) { /* RSDP has no common fields */ @@ -147,7 +147,7 @@ acpi_tb_print_table_header(acpi_physical_address address, header)->oem_id, ACPI_OEM_ID_SIZE); acpi_tb_fix_string(local_header.oem_id, ACPI_OEM_ID_SIZE); - ACPI_INFO((AE_INFO, "RSDP %p %06X (v%.2d %6.6s)", + ACPI_INFO((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)", ACPI_CAST_PTR(void, address), (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> revision > @@ -162,7 +162,7 @@ acpi_tb_print_table_header(acpi_physical_address address, acpi_tb_cleanup_table_header(&local_header, header); ACPI_INFO((AE_INFO, - "%4.4s %p %06X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", + "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)", local_header.signature, ACPI_CAST_PTR(void, address), local_header.length, local_header.revision, local_header.oem_id, local_header.oem_table_id, @@ -190,16 +190,6 @@ acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) { u8 checksum; - /* - * FACS/S3PT: - * They are the odd tables, have no standard ACPI header and no checksum - */ - - if (ACPI_COMPARE_NAME(table->signature, ACPI_SIG_S3PT) || - ACPI_COMPARE_NAME(table->signature, ACPI_SIG_FACS)) { - return (AE_OK); - } - /* Compute the checksum on the table */ checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length); diff --git a/drivers/acpi/acpica/tbutils.c b/drivers/acpi/acpica/tbutils.c index 3d6bb83..bffdfc7 100644 --- a/drivers/acpi/acpica/tbutils.c +++ b/drivers/acpi/acpica/tbutils.c @@ -350,7 +350,7 @@ acpi_tb_install_table(acpi_physical_address address, acpi_tb_delete_table(table_desc); } -unmap_and_exit: + unmap_and_exit: /* Always unmap the table header that we mapped above */ @@ -430,7 +430,8 @@ acpi_tb_get_root_table_entry(u8 *table_entry, u32 table_entry_size) * ******************************************************************************/ -acpi_status __init acpi_tb_parse_root_table(acpi_physical_address rsdp_address) +acpi_status __init +acpi_tb_parse_root_table(acpi_physical_address rsdp_address) { struct acpi_table_rsdp *rsdp; u32 table_entry_size; diff --git a/drivers/acpi/acpica/tbxface.c b/drivers/acpi/acpica/tbxface.c index db826ea..ad11162 100644 --- a/drivers/acpi/acpica/tbxface.c +++ b/drivers/acpi/acpica/tbxface.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "actables.h" @@ -148,8 +147,6 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array, return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_tables) - /******************************************************************************* * * FUNCTION: acpi_reallocate_root_table @@ -164,7 +161,7 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_tables) * kernel. * ******************************************************************************/ -acpi_status __init acpi_reallocate_root_table(void) +acpi_status acpi_reallocate_root_table(void) { acpi_status status; @@ -184,8 +181,6 @@ acpi_status __init acpi_reallocate_root_table(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL_INIT(acpi_reallocate_root_table) - /******************************************************************************* * * FUNCTION: acpi_get_table_header @@ -361,7 +356,6 @@ acpi_get_table_with_size(char *signature, return (AE_NOT_FOUND); } - ACPI_EXPORT_SYMBOL(acpi_get_table_with_size) acpi_status @@ -373,7 +367,6 @@ acpi_get_table(char *signature, return acpi_get_table_with_size(signature, instance, out_table, &tbl_size); } - ACPI_EXPORT_SYMBOL(acpi_get_table) /******************************************************************************* @@ -431,6 +424,7 @@ acpi_get_table_by_index(u32 table_index, struct acpi_table_header **table) ACPI_EXPORT_SYMBOL(acpi_get_table_by_index) + /******************************************************************************* * * FUNCTION: acpi_install_table_handler @@ -471,7 +465,7 @@ acpi_install_table_handler(acpi_table_handler handler, void *context) acpi_gbl_table_handler = handler; acpi_gbl_table_handler_context = context; -cleanup: + cleanup: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } @@ -512,7 +506,7 @@ acpi_status acpi_remove_table_handler(acpi_table_handler handler) acpi_gbl_table_handler = NULL; -cleanup: + cleanup: (void)acpi_ut_release_mutex(ACPI_MTX_EVENTS); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/tbxfload.c b/drivers/acpi/acpica/tbxfload.c index 60b5a87..0ba9e32 100644 --- a/drivers/acpi/acpica/tbxfload.c +++ b/drivers/acpi/acpica/tbxfload.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" @@ -66,7 +65,7 @@ static acpi_status acpi_tb_load_namespace(void); * ******************************************************************************/ -acpi_status __init acpi_load_tables(void) +acpi_status acpi_load_tables(void) { acpi_status status; @@ -83,7 +82,7 @@ acpi_status __init acpi_load_tables(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL_INIT(acpi_load_tables) +ACPI_EXPORT_SYMBOL(acpi_load_tables) /******************************************************************************* * @@ -201,7 +200,7 @@ static acpi_status acpi_tb_load_namespace(void) ACPI_INFO((AE_INFO, "All ACPI Tables successfully acquired")); -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_TABLES); return_ACPI_STATUS(status); } @@ -269,7 +268,7 @@ acpi_status acpi_load_table(struct acpi_table_header *table) acpi_gbl_table_handler_context); } -unlock_and_exit: + unlock_and_exit: (void)acpi_ut_release_mutex(ACPI_MTX_INTERPRETER); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/tbxfroot.c b/drivers/acpi/acpica/tbxfroot.c index e4e1468..948c95e 100644 --- a/drivers/acpi/acpica/tbxfroot.c +++ b/drivers/acpi/acpica/tbxfroot.c @@ -68,7 +68,8 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) * Note: Sometimes there exists more than one RSDP in memory; the valid * RSDP has a valid checksum, all others have an invalid checksum. */ - if (!ACPI_VALIDATE_RSDP_SIG(rsdp->signature)) { + if (ACPI_STRNCMP((char *)rsdp->signature, ACPI_SIG_RSDP, + sizeof(ACPI_SIG_RSDP) - 1) != 0) { /* Nope, BAD Signature */ @@ -111,7 +112,7 @@ acpi_status acpi_tb_validate_rsdp(struct acpi_table_rsdp *rsdp) * ******************************************************************************/ -acpi_status __init acpi_find_root_pointer(acpi_size *table_address) +acpi_status acpi_find_root_pointer(acpi_size *table_address) { u8 *table_ptr; u8 *mem_rover; diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c index 814267f..e0ffb58 100644 --- a/drivers/acpi/acpica/utalloc.c +++ b/drivers/acpi/acpica/utalloc.c @@ -48,39 +48,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME("utalloc") -#if !defined (USE_NATIVE_ALLOCATE_ZEROED) -/******************************************************************************* - * - * FUNCTION: acpi_os_allocate_zeroed - * - * PARAMETERS: size - Size of the allocation - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. - * This is the default implementation. Can be overridden via the - * USE_NATIVE_ALLOCATE_ZEROED flag. - * - ******************************************************************************/ -void *acpi_os_allocate_zeroed(acpi_size size) -{ - void *allocation; - - ACPI_FUNCTION_ENTRY(); - - allocation = acpi_os_allocate(size); - if (allocation) { - - /* Clear the memory block */ - - ACPI_MEMSET(allocation, 0, size); - } - - return (allocation); -} - -#endif /* !USE_NATIVE_ALLOCATE_ZEROED */ - /******************************************************************************* * * FUNCTION: acpi_ut_create_caches @@ -92,7 +59,6 @@ void *acpi_os_allocate_zeroed(acpi_size size) * DESCRIPTION: Create all local caches * ******************************************************************************/ - acpi_status acpi_ut_create_caches(void) { acpi_status status; @@ -209,10 +175,10 @@ acpi_status acpi_ut_delete_caches(void) /* Free memory lists */ - acpi_os_free(acpi_gbl_global_list); + ACPI_FREE(acpi_gbl_global_list); acpi_gbl_global_list = NULL; - acpi_os_free(acpi_gbl_ns_node_list); + ACPI_FREE(acpi_gbl_ns_node_list); acpi_gbl_ns_node_list = NULL; #endif @@ -336,3 +302,82 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer, ACPI_MEMSET(buffer->pointer, 0, required_length); return (AE_OK); } + +#ifdef NOT_USED_BY_LINUX +/******************************************************************************* + * + * FUNCTION: acpi_ut_allocate + * + * PARAMETERS: size - Size of the allocation + * component - Component type of caller + * module - Source file name of caller + * line - Line number of caller + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: Subsystem equivalent of malloc. + * + ******************************************************************************/ + +void *acpi_ut_allocate(acpi_size size, + u32 component, const char *module, u32 line) +{ + void *allocation; + + ACPI_FUNCTION_TRACE_U32(ut_allocate, size); + + /* Check for an inadvertent size of zero bytes */ + + if (!size) { + ACPI_WARNING((module, line, + "Attempt to allocate zero bytes, allocating 1 byte")); + size = 1; + } + + allocation = acpi_os_allocate(size); + if (!allocation) { + + /* Report allocation error */ + + ACPI_WARNING((module, line, + "Could not allocate size %u", (u32) size)); + + return_PTR(NULL); + } + + return_PTR(allocation); +} + +/******************************************************************************* + * + * FUNCTION: acpi_ut_allocate_zeroed + * + * PARAMETERS: size - Size of the allocation + * component - Component type of caller + * module - Source file name of caller + * line - Line number of caller + * + * RETURN: Address of the allocated memory on success, NULL on failure. + * + * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory. + * + ******************************************************************************/ + +void *acpi_ut_allocate_zeroed(acpi_size size, + u32 component, const char *module, u32 line) +{ + void *allocation; + + ACPI_FUNCTION_ENTRY(); + + allocation = acpi_ut_allocate(size, component, module, line); + if (allocation) { + + /* Clear the memory block */ + + ACPI_MEMSET(allocation, 0, size); + } + + return (allocation); +} +#endif diff --git a/drivers/acpi/acpica/utcache.c b/drivers/acpi/acpica/utcache.c index 366bfec..a877a96 100644 --- a/drivers/acpi/acpica/utcache.c +++ b/drivers/acpi/acpica/utcache.c @@ -65,7 +65,7 @@ ACPI_MODULE_NAME("utcache") acpi_status acpi_os_create_cache(char *cache_name, u16 object_size, - u16 max_depth, struct acpi_memory_list **return_cache) + u16 max_depth, struct acpi_memory_list ** return_cache) { struct acpi_memory_list *cache; diff --git a/drivers/acpi/acpica/utcopy.c b/drivers/acpi/acpica/utcopy.c index edff4e6..1731c27 100644 --- a/drivers/acpi/acpica/utcopy.c +++ b/drivers/acpi/acpica/utcopy.c @@ -552,7 +552,7 @@ acpi_ut_copy_esimple_to_isimple(union acpi_object *external_object, *ret_internal_object = internal_object; return_ACPI_STATUS(AE_OK); -error_exit: + error_exit: acpi_ut_remove_reference(internal_object); return_ACPI_STATUS(AE_NO_MEMORY); } @@ -899,7 +899,7 @@ acpi_ut_copy_ielement_to_ielement(u8 object_type, return (status); -error_exit: + error_exit: acpi_ut_remove_reference(target_object); return (status); } diff --git a/drivers/acpi/acpica/utdebug.c b/drivers/acpi/acpica/utdebug.c index 03ae8af..5796e11 100644 --- a/drivers/acpi/acpica/utdebug.c +++ b/drivers/acpi/acpica/utdebug.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" @@ -185,30 +184,21 @@ acpi_debug_print(u32 requested_debug_level, } acpi_gbl_prev_thread_id = thread_id; - acpi_gbl_nesting_level = 0; } /* * Display the module name, current line number, thread ID (if requested), * current procedure nesting level, and the current procedure name */ - acpi_os_printf("%9s-%04ld ", module_name, line_number); + acpi_os_printf("%8s-%04ld ", module_name, line_number); -#ifdef ACPI_EXEC_APP - /* - * For acpi_exec only, emit the thread ID and nesting level. - * Note: nesting level is really only useful during a single-thread - * execution. Otherwise, multiple threads will keep resetting the - * level. - */ if (ACPI_LV_THREADS & acpi_dbg_level) { acpi_os_printf("[%u] ", (u32)thread_id); } - acpi_os_printf("[%02ld] ", acpi_gbl_nesting_level); -#endif - - acpi_os_printf("%-22.22s: ", acpi_ut_trim_function_name(function_name)); + acpi_os_printf("[%02ld] %-22.22s: ", + acpi_gbl_nesting_level, + acpi_ut_trim_function_name(function_name)); va_start(args, format); acpi_os_vprintf(format, args); @@ -429,9 +419,7 @@ acpi_ut_exit(u32 line_number, component_id, "%s\n", acpi_gbl_fn_exit_str); } - if (acpi_gbl_nesting_level) { - acpi_gbl_nesting_level--; - } + acpi_gbl_nesting_level--; } ACPI_EXPORT_SYMBOL(acpi_ut_exit) @@ -478,9 +466,7 @@ acpi_ut_status_exit(u32 line_number, } } - if (acpi_gbl_nesting_level) { - acpi_gbl_nesting_level--; - } + acpi_gbl_nesting_level--; } ACPI_EXPORT_SYMBOL(acpi_ut_status_exit) @@ -517,9 +503,7 @@ acpi_ut_value_exit(u32 line_number, ACPI_FORMAT_UINT64(value)); } - if (acpi_gbl_nesting_level) { - acpi_gbl_nesting_level--; - } + acpi_gbl_nesting_level--; } ACPI_EXPORT_SYMBOL(acpi_ut_value_exit) @@ -555,9 +539,7 @@ acpi_ut_ptr_exit(u32 line_number, ptr); } - if (acpi_gbl_nesting_level) { - acpi_gbl_nesting_level--; - } + acpi_gbl_nesting_level--; } #endif diff --git a/drivers/acpi/acpica/utdecode.c b/drivers/acpi/acpica/utdecode.c index b3f31dd..11e2e02 100644 --- a/drivers/acpi/acpica/utdecode.c +++ b/drivers/acpi/acpica/utdecode.c @@ -41,6 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acnamesp.h" diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c index c07d222..d6b33f2 100644 --- a/drivers/acpi/acpica/utdelete.c +++ b/drivers/acpi/acpica/utdelete.c @@ -649,7 +649,7 @@ acpi_ut_update_object_reference(union acpi_operand_object *object, u16 action) return (AE_OK); -error_exit: + error_exit: ACPI_EXCEPTION((AE_INFO, status, "Could not update object reference count")); diff --git a/drivers/acpi/acpica/uteval.c b/drivers/acpi/acpica/uteval.c index 16fb905..4fd6897 100644 --- a/drivers/acpi/acpica/uteval.c +++ b/drivers/acpi/acpica/uteval.c @@ -181,7 +181,7 @@ acpi_ut_evaluate_object(struct acpi_namespace_node *prefix_node, *return_desc = info->return_object; -cleanup: + cleanup: ACPI_FREE(info); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/utexcep.c b/drivers/acpi/acpica/utexcep.c index 3cf7b59..ff6d9e8 100644 --- a/drivers/acpi/acpica/utexcep.c +++ b/drivers/acpi/acpica/utexcep.c @@ -41,9 +41,8 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - #define ACPI_DEFINE_EXCEPTION_TABLE +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" diff --git a/drivers/acpi/acpica/utglobal.c b/drivers/acpi/acpica/utglobal.c index 81f9a95..d6f26bf 100644 --- a/drivers/acpi/acpica/utglobal.c +++ b/drivers/acpi/acpica/utglobal.c @@ -41,9 +41,9 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES #define DEFINE_ACPI_GLOBALS +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" @@ -289,19 +289,9 @@ acpi_status acpi_ut_init_globals(void) acpi_gbl_owner_id_mask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; - /* Event counters */ - - acpi_method_count = 0; - acpi_sci_count = 0; - acpi_gpe_count = 0; - - for (i = 0; i < ACPI_NUM_FIXED_EVENTS; i++) { - acpi_fixed_event_count[i] = 0; - } - #if (!ACPI_REDUCED_HARDWARE) - /* GPE/SCI support */ + /* GPE support */ acpi_gbl_all_gpes_initialized = FALSE; acpi_gbl_gpe_xrupt_list_head = NULL; @@ -310,7 +300,6 @@ acpi_status acpi_ut_init_globals(void) acpi_current_gpe_count = 0; acpi_gbl_global_event_handler = NULL; - acpi_gbl_sci_handler_list = NULL; #endif /* !ACPI_REDUCED_HARDWARE */ @@ -388,11 +377,6 @@ acpi_status acpi_ut_init_globals(void) /* Public globals */ ACPI_EXPORT_SYMBOL(acpi_gbl_FADT) - ACPI_EXPORT_SYMBOL(acpi_dbg_level) - ACPI_EXPORT_SYMBOL(acpi_dbg_layer) - -ACPI_EXPORT_SYMBOL(acpi_gpe_count) - ACPI_EXPORT_SYMBOL(acpi_current_gpe_count) diff --git a/drivers/acpi/acpica/utids.c b/drivers/acpi/acpica/utids.c index bfca7b4..fa69071 100644 --- a/drivers/acpi/acpica/utids.c +++ b/drivers/acpi/acpica/utids.c @@ -184,7 +184,7 @@ acpi_ut_execute_SUB(struct acpi_namespace_node *device_node, sub->length = length; *return_id = sub; -cleanup: + cleanup: /* On exit, we must delete the return object */ diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c index 517af70..aa61f66 100644 --- a/drivers/acpi/acpica/utobject.c +++ b/drivers/acpi/acpica/utobject.c @@ -180,7 +180,7 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count) package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size) count + 1) * sizeof(void *)); if (!package_elements) { - ACPI_FREE(package_desc); + acpi_ut_remove_reference(package_desc); return_PTR(NULL); } @@ -356,7 +356,7 @@ u8 acpi_ut_valid_internal_object(void *object) default: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, - "%p is not an ACPI operand obj [%s]\n", + "%p is not not an ACPI operand obj [%s]\n", object, acpi_ut_get_descriptor_name(object))); break; } @@ -396,6 +396,7 @@ void *acpi_ut_allocate_object_desc_dbg(const char *module_name, /* Mark the descriptor type */ + memset(object, 0, sizeof(union acpi_operand_object)); ACPI_SET_DESCRIPTOR_TYPE(object, ACPI_DESC_TYPE_OPERAND); ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "%p Size %X\n", @@ -460,28 +461,25 @@ acpi_ut_get_simple_object_size(union acpi_operand_object *internal_object, ACPI_FUNCTION_TRACE_PTR(ut_get_simple_object_size, internal_object); - /* Start with the length of the (external) Acpi object */ - - length = sizeof(union acpi_object); - - /* A NULL object is allowed, can be a legal uninitialized package element */ - - if (!internal_object) { /* - * Object is NULL, just return the length of union acpi_object - * (A NULL union acpi_object is an object of all zeroes.) + * Handle a null object (Could be a uninitialized package + * element -- which is legal) */ - *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); + if (!internal_object) { + *obj_length = sizeof(union acpi_object); return_ACPI_STATUS(AE_OK); } - /* A Namespace Node should never appear here */ + /* Start with the length of the Acpi object */ + + length = sizeof(union acpi_object); if (ACPI_GET_DESCRIPTOR_TYPE(internal_object) == ACPI_DESC_TYPE_NAMED) { - /* A namespace node should never get here */ + /* Object is a named object (reference), just return the length */ - return_ACPI_STATUS(AE_AML_INTERNAL); + *obj_length = ACPI_ROUND_UP_TO_NATIVE_WORD(length); + return_ACPI_STATUS(status); } /* diff --git a/drivers/acpi/acpica/utownerid.c b/drivers/acpi/acpica/utownerid.c index eb3aca7..835340b 100644 --- a/drivers/acpi/acpica/utownerid.c +++ b/drivers/acpi/acpica/utownerid.c @@ -148,7 +148,7 @@ acpi_status acpi_ut_allocate_owner_id(acpi_owner_id * owner_id) ACPI_ERROR((AE_INFO, "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT")); -exit: + exit: (void)acpi_ut_release_mutex(ACPI_MTX_CACHES); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/utresrc.c b/drivers/acpi/acpica/utresrc.c index 2c2accb..cb7fa49 100644 --- a/drivers/acpi/acpica/utresrc.c +++ b/drivers/acpi/acpica/utresrc.c @@ -643,7 +643,7 @@ acpi_ut_validate_resource(struct acpi_walk_state *walk_state, return (AE_OK); -invalid_resource: + invalid_resource: if (walk_state) { ACPI_ERROR((AE_INFO, @@ -652,7 +652,7 @@ invalid_resource: } return (AE_AML_INVALID_RESOURCE_TYPE); -bad_resource_length: + bad_resource_length: if (walk_state) { ACPI_ERROR((AE_INFO, diff --git a/drivers/acpi/acpica/utstate.c b/drivers/acpi/acpica/utstate.c index 03c4c2f..a6b729d 100644 --- a/drivers/acpi/acpica/utstate.c +++ b/drivers/acpi/acpica/utstate.c @@ -161,6 +161,7 @@ union acpi_generic_state *acpi_ut_create_generic_state(void) if (state) { /* Initialize */ + memset(state, 0, sizeof(union acpi_generic_state)); state->common.descriptor_type = ACPI_DESC_TYPE_STATE; } diff --git a/drivers/acpi/acpica/utstring.c b/drivers/acpi/acpica/utstring.c index 45c0eb2..cb1e9cc 100644 --- a/drivers/acpi/acpica/utstring.c +++ b/drivers/acpi/acpica/utstring.c @@ -310,7 +310,7 @@ acpi_status acpi_ut_strtoul64(char *string, u32 base, u64 *ret_integer) /* All done, normal exit */ -all_done: + all_done: ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n", ACPI_FORMAT_UINT64(return_value))); @@ -318,7 +318,7 @@ all_done: *ret_integer = return_value; return_ACPI_STATUS(AE_OK); -error_exit: + error_exit: /* Base was set/validated above */ if (base == 10) { @@ -584,65 +584,3 @@ void ut_convert_backslashes(char *pathname) } } #endif - -#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION) -/******************************************************************************* - * - * FUNCTION: acpi_ut_safe_strcpy, acpi_ut_safe_strcat, acpi_ut_safe_strncat - * - * PARAMETERS: Adds a "DestSize" parameter to each of the standard string - * functions. This is the size of the Destination buffer. - * - * RETURN: TRUE if the operation would overflow the destination buffer. - * - * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that - * the result of the operation will not overflow the output string - * buffer. - * - * NOTE: These functions are typically only helpful for processing - * user input and command lines. For most ACPICA code, the - * required buffer length is precisely calculated before buffer - * allocation, so the use of these functions is unnecessary. - * - ******************************************************************************/ - -u8 acpi_ut_safe_strcpy(char *dest, acpi_size dest_size, char *source) -{ - - if (ACPI_STRLEN(source) >= dest_size) { - return (TRUE); - } - - ACPI_STRCPY(dest, source); - return (FALSE); -} - -u8 acpi_ut_safe_strcat(char *dest, acpi_size dest_size, char *source) -{ - - if ((ACPI_STRLEN(dest) + ACPI_STRLEN(source)) >= dest_size) { - return (TRUE); - } - - ACPI_STRCAT(dest, source); - return (FALSE); -} - -u8 -acpi_ut_safe_strncat(char *dest, - acpi_size dest_size, - char *source, acpi_size max_transfer_length) -{ - acpi_size actual_transfer_length; - - actual_transfer_length = - ACPI_MIN(max_transfer_length, ACPI_STRLEN(source)); - - if ((ACPI_STRLEN(dest) + actual_transfer_length) >= dest_size) { - return (TRUE); - } - - ACPI_STRNCAT(dest, source, max_transfer_length); - return (FALSE); -} -#endif diff --git a/drivers/acpi/acpica/uttrack.c b/drivers/acpi/acpica/uttrack.c index c002777..160f13f 100644 --- a/drivers/acpi/acpica/uttrack.c +++ b/drivers/acpi/acpica/uttrack.c @@ -130,23 +130,10 @@ void *acpi_ut_allocate_and_track(acpi_size size, struct acpi_debug_mem_block *allocation; acpi_status status; - /* Check for an inadvertent size of zero bytes */ - - if (!size) { - ACPI_WARNING((module, line, - "Attempt to allocate zero bytes, allocating 1 byte")); - size = 1; - } - allocation = - acpi_os_allocate(size + sizeof(struct acpi_debug_mem_header)); + acpi_ut_allocate(size + sizeof(struct acpi_debug_mem_header), + component, module, line); if (!allocation) { - - /* Report allocation error */ - - ACPI_WARNING((module, line, - "Could not allocate size %u", (u32)size)); - return (NULL); } @@ -192,17 +179,9 @@ void *acpi_ut_allocate_zeroed_and_track(acpi_size size, struct acpi_debug_mem_block *allocation; acpi_status status; - /* Check for an inadvertent size of zero bytes */ - - if (!size) { - ACPI_WARNING((module, line, - "Attempt to allocate zero bytes, allocating 1 byte")); - size = 1; - } - allocation = - acpi_os_allocate_zeroed(size + - sizeof(struct acpi_debug_mem_header)); + acpi_ut_allocate_zeroed(size + sizeof(struct acpi_debug_mem_header), + component, module, line); if (!allocation) { /* Report allocation error */ @@ -430,7 +409,7 @@ acpi_ut_track_allocation(struct acpi_debug_mem_block *allocation, element->next = allocation; } -unlock_and_exit: + unlock_and_exit: status = acpi_ut_release_mutex(ACPI_MTX_MEMORY); return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/utxface.c b/drivers/acpi/acpica/utxface.c index be322c8..03a211e 100644 --- a/drivers/acpi/acpica/utxface.c +++ b/drivers/acpi/acpica/utxface.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acdebug.h" @@ -61,7 +60,7 @@ ACPI_MODULE_NAME("utxface") * DESCRIPTION: Shutdown the ACPICA subsystem and release all resources. * ******************************************************************************/ -acpi_status __init acpi_terminate(void) +acpi_status acpi_terminate(void) { acpi_status status; @@ -105,7 +104,7 @@ acpi_status __init acpi_terminate(void) return_ACPI_STATUS(status); } -ACPI_EXPORT_SYMBOL_INIT(acpi_terminate) +ACPI_EXPORT_SYMBOL(acpi_terminate) #ifndef ACPI_ASL_COMPILER #ifdef ACPI_FUTURE_USAGE @@ -208,44 +207,6 @@ acpi_status acpi_get_system_info(struct acpi_buffer * out_buffer) ACPI_EXPORT_SYMBOL(acpi_get_system_info) -/******************************************************************************* - * - * FUNCTION: acpi_get_statistics - * - * PARAMETERS: stats - Where the statistics are returned - * - * RETURN: status - the status of the call - * - * DESCRIPTION: Get the contents of the various system counters - * - ******************************************************************************/ -acpi_status acpi_get_statistics(struct acpi_statistics *stats) -{ - ACPI_FUNCTION_TRACE(acpi_get_statistics); - - /* Parameter validation */ - - if (!stats) { - return_ACPI_STATUS(AE_BAD_PARAMETER); - } - - /* Various interrupt-based event counters */ - - stats->sci_count = acpi_sci_count; - stats->gpe_count = acpi_gpe_count; - - ACPI_MEMCPY(stats->fixed_event_count, acpi_fixed_event_count, - sizeof(acpi_fixed_event_count)); - - /* Other counters */ - - stats->method_count = acpi_method_count; - - return_ACPI_STATUS(AE_OK); -} - -ACPI_EXPORT_SYMBOL(acpi_get_statistics) - /***************************************************************************** * * FUNCTION: acpi_install_initialization_handler diff --git a/drivers/acpi/acpica/utxferror.c b/drivers/acpi/acpica/utxferror.c index f7edb88..e966a2e 100644 --- a/drivers/acpi/acpica/utxferror.c +++ b/drivers/acpi/acpica/utxferror.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" diff --git a/drivers/acpi/acpica/utxfinit.c b/drivers/acpi/acpica/utxfinit.c index 75efea0..41ebaaf 100644 --- a/drivers/acpi/acpica/utxfinit.c +++ b/drivers/acpi/acpica/utxfinit.c @@ -41,8 +41,7 @@ * POSSIBILITY OF SUCH DAMAGES. */ -#define EXPORT_ACPI_INTERFACES - +#include <linux/export.h> #include <acpi/acpi.h> #include "accommon.h" #include "acevents.h" @@ -65,7 +64,7 @@ ACPI_MODULE_NAME("utxfinit") * called, so any early initialization belongs here. * ******************************************************************************/ -acpi_status __init acpi_initialize_subsystem(void) +acpi_status acpi_initialize_subsystem(void) { acpi_status status; @@ -125,8 +124,7 @@ acpi_status __init acpi_initialize_subsystem(void) ACPI_DEBUGGER_EXEC(status = acpi_db_initialize()); return_ACPI_STATUS(status); } - -ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_subsystem) +ACPI_EXPORT_SYMBOL(acpi_initialize_subsystem) /******************************************************************************* * @@ -140,7 +138,7 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_subsystem) * Puts system into ACPI mode if it isn't already. * ******************************************************************************/ -acpi_status __init acpi_enable_subsystem(u32 flags) +acpi_status acpi_enable_subsystem(u32 flags) { acpi_status status = AE_OK; @@ -230,8 +228,7 @@ acpi_status __init acpi_enable_subsystem(u32 flags) return_ACPI_STATUS(status); } - -ACPI_EXPORT_SYMBOL_INIT(acpi_enable_subsystem) +ACPI_EXPORT_SYMBOL(acpi_enable_subsystem) /******************************************************************************* * @@ -245,7 +242,7 @@ ACPI_EXPORT_SYMBOL_INIT(acpi_enable_subsystem) * objects and executing AML code for Regions, buffers, etc. * ******************************************************************************/ -acpi_status __init acpi_initialize_objects(u32 flags) +acpi_status acpi_initialize_objects(u32 flags) { acpi_status status = AE_OK; @@ -317,5 +314,4 @@ acpi_status __init acpi_initialize_objects(u32 flags) acpi_gbl_startup_flags |= ACPI_INITIALIZED_OK; return_ACPI_STATUS(status); } - -ACPI_EXPORT_SYMBOL_INIT(acpi_initialize_objects) +ACPI_EXPORT_SYMBOL(acpi_initialize_objects) |