Skip to content

Commit

Permalink
Merge branch 'acpica'
Browse files Browse the repository at this point in the history
* acpica:
  ACPICA: Utilities: Add new decode function for parser values
  ACPICA: Tables: Add an error message complaining driver bugs
  ACPICA: Tables: Add acpi_tb_unload_table()
  ACPICA: Tables: Cleanup acpi_tb_install_and_load_table()
  ACPICA: Events: Fix acpi_ev_initialize_region() return value
  ACPICA: Back port of "ACPICA: Dispatcher: Tune interpreter lock around AcpiEvInitializeRegion()"
  ACPICA: Namespace: Add acpi_ns_handle_to_name()
  ACPICA: Update version to 20160930
  ACPICA: Move acpi_gbl_max_loop_iterations to the public globals file
  ACPICA: Disassembler: Fix for Divide() support, new support for test suite
  ACPICA: Increase loop limit for AE_AML_INFINITE_LOOP exception
  ACPICA: MacOSX: Fix wrong sem_destroy definition
  ACPICA: MacOSX: Fix anonymous semaphore implementation
  ACPICA: Update an info message during table load phase
  • Loading branch information
Rafael J. Wysocki committed Dec 12, 2016
2 parents 69973b8 + 5a6e7ec commit 496c9a9
Showing 21 changed files with 250 additions and 211 deletions.
4 changes: 1 addition & 3 deletions drivers/acpi/acpica/acevents.h
Original file line number Diff line number Diff line change
@@ -243,9 +243,7 @@ acpi_ev_default_region_setup(acpi_handle handle,
u32 function,
void *handler_context, void **region_context);

acpi_status
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
u8 acpi_ns_locked);
acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj);

/*
* evsci - SCI (System Control Interrupt) handling/dispatch
5 changes: 1 addition & 4 deletions drivers/acpi/acpica/acglobal.h
Original file line number Diff line number Diff line change
@@ -240,10 +240,6 @@ ACPI_INIT_GLOBAL(u32, acpi_gbl_nesting_level, 0);

ACPI_GLOBAL(struct acpi_thread_state *, acpi_gbl_current_walk_list);

/* Maximum number of While() loop iterations before forced abort */

ACPI_GLOBAL(u16, acpi_gbl_max_loop_iterations);

/* Control method single step flag */

ACPI_GLOBAL(u8, acpi_gbl_cm_single_step);
@@ -318,6 +314,7 @@ ACPI_INIT_GLOBAL(u8, acpi_gbl_cstyle_disassembly, TRUE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_force_aml_disassembly, FALSE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_opt_verbose, TRUE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_dm_emit_external_opcodes, FALSE);
ACPI_INIT_GLOBAL(u8, acpi_gbl_do_disassembler_optimizations, TRUE);

ACPI_GLOBAL(u8, acpi_gbl_dm_opt_disasm);
ACPI_GLOBAL(u8, acpi_gbl_dm_opt_listing);
19 changes: 10 additions & 9 deletions drivers/acpi/acpica/aclocal.h
Original file line number Diff line number Diff line change
@@ -765,7 +765,7 @@ union acpi_parse_value {
union acpi_parse_value value; /* Value or args associated with the opcode */\
u8 arg_list_length; /* Number of elements in the arg list */\
ACPI_DISASM_ONLY_MEMBERS (\
u8 disasm_flags; /* Used during AML disassembly */\
u16 disasm_flags; /* Used during AML disassembly */\
u8 disasm_opcode; /* Subtype used for disassembly */\
char *operator_symbol;/* Used for C-style operator name strings */\
char aml_op_name[16]) /* Op name (debug only) */
@@ -868,14 +868,15 @@ struct acpi_parse_state {

/* Parse object disasm_flags */

#define ACPI_PARSEOP_IGNORE 0x01
#define ACPI_PARSEOP_PARAMETER_LIST 0x02
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x08
#define ACPI_PARSEOP_CLOSING_PAREN 0x10
#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x20
#define ACPI_PARSEOP_ASSIGNMENT 0x40
#define ACPI_PARSEOP_ELSEIF 0x80
#define ACPI_PARSEOP_IGNORE 0x0001
#define ACPI_PARSEOP_PARAMETER_LIST 0x0002
#define ACPI_PARSEOP_EMPTY_TERMLIST 0x0004
#define ACPI_PARSEOP_PREDEFINED_CHECKED 0x0008
#define ACPI_PARSEOP_CLOSING_PAREN 0x0010
#define ACPI_PARSEOP_COMPOUND_ASSIGNMENT 0x0020
#define ACPI_PARSEOP_ASSIGNMENT 0x0040
#define ACPI_PARSEOP_ELSEIF 0x0080
#define ACPI_PARSEOP_LEGACY_ASL_ONLY 0x0100

/*****************************************************************************
*
3 changes: 3 additions & 0 deletions drivers/acpi/acpica/acnamesp.h
Original file line number Diff line number Diff line change
@@ -291,6 +291,9 @@ char *acpi_ns_get_normalized_pathname(struct acpi_namespace_node *node,

char *acpi_ns_name_of_current_scope(struct acpi_walk_state *walk_state);

acpi_status
acpi_ns_handle_to_name(acpi_handle target_handle, struct acpi_buffer *buffer);

acpi_status
acpi_ns_handle_to_pathname(acpi_handle target_handle,
struct acpi_buffer *buffer, u8 no_trailing);
5 changes: 3 additions & 2 deletions drivers/acpi/acpica/actables.h
Original file line number Diff line number Diff line change
@@ -127,10 +127,11 @@ acpi_status
acpi_tb_load_table(u32 table_index, struct acpi_namespace_node *parent_node);

acpi_status
acpi_tb_install_and_load_table(struct acpi_table_header *table,
acpi_physical_address address,
acpi_tb_install_and_load_table(acpi_physical_address address,
u8 flags, u8 override, u32 *table_index);

acpi_status acpi_tb_unload_table(u32 table_index);

void acpi_tb_terminate(void);

acpi_status acpi_tb_delete_namespace_by_owner(u32 table_index);
2 changes: 2 additions & 0 deletions drivers/acpi/acpica/acutils.h
Original file line number Diff line number Diff line change
@@ -232,6 +232,8 @@ const char *acpi_ut_get_region_name(u8 space_id);

const char *acpi_ut_get_event_name(u32 event_id);

const char *acpi_ut_get_argument_type_name(u32 arg_type);

char acpi_ut_hex_to_ascii_char(u64 integer, u32 position);

acpi_status acpi_ut_ascii_to_hex_byte(char *two_ascii_chars, u8 *return_byte);
1 change: 1 addition & 0 deletions drivers/acpi/acpica/amlcode.h
Original file line number Diff line number Diff line change
@@ -240,6 +240,7 @@
#define ARGP_QWORDDATA 0x11
#define ARGP_SIMPLENAME 0x12 /* name_string | local_term | arg_term */
#define ARGP_NAME_OR_REF 0x13 /* For object_type only */
#define ARGP_MAX 0x13

/*
* Resolved argument types for the AML Interpreter
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/dsinit.c
Original file line number Diff line number Diff line change
@@ -221,8 +221,8 @@ acpi_ds_initialize_objects(u32 table_index,
*/
status =
acpi_ns_walk_namespace(ACPI_TYPE_ANY, start_node, ACPI_UINT32_MAX,
0, acpi_ds_init_one_object, NULL, &info,
NULL);
ACPI_NS_WALK_NO_UNLOCK,
acpi_ds_init_one_object, NULL, &info, NULL);
if (ACPI_FAILURE(status)) {
ACPI_EXCEPTION((AE_INFO, status, "During WalkNamespace"));
}
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dsopcode.c
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ acpi_status acpi_ds_initialize_region(acpi_handle obj_handle)

/* Namespace is NOT locked */

status = acpi_ev_initialize_region(obj_desc, FALSE);
status = acpi_ev_initialize_region(obj_desc);
return (status);
}

13 changes: 1 addition & 12 deletions drivers/acpi/acpica/dswload2.c
Original file line number Diff line number Diff line change
@@ -609,18 +609,7 @@ acpi_status acpi_ds_load2_end_op(struct acpi_walk_state *walk_state)

status =
acpi_ev_initialize_region
(acpi_ns_get_attached_object(node), FALSE);

if (ACPI_FAILURE(status)) {
/*
* If AE_NOT_EXIST is returned, it is not fatal
* because many regions get created before a handler
* is installed for said region.
*/
if (AE_NOT_EXIST == status) {
status = AE_OK;
}
}
(acpi_ns_get_attached_object(node));
break;

case AML_NAME_OP:
59 changes: 24 additions & 35 deletions drivers/acpi/acpica/evrgnini.c
Original file line number Diff line number Diff line change
@@ -479,7 +479,6 @@ acpi_ev_default_region_setup(acpi_handle handle,
* FUNCTION: acpi_ev_initialize_region
*
* PARAMETERS: region_obj - Region we are initializing
* acpi_ns_locked - Is namespace locked?
*
* RETURN: Status
*
@@ -497,19 +496,28 @@ acpi_ev_default_region_setup(acpi_handle handle,
* MUTEX: Interpreter should be unlocked, because we may run the _REG
* method for this region.
*
* NOTE: Possible incompliance:
* There is a behavior conflict in automatic _REG execution:
* 1. When the interpreter is evaluating a method, we can only
* automatically run _REG for the following case:
* operation_region (OPR1, 0x80, 0x1000010, 0x4)
* 2. When the interpreter is loading a table, we can also
* automatically run _REG for the following case:
* operation_region (OPR1, 0x80, 0x1000010, 0x4)
* Though this may not be compliant to the de-facto standard, the
* logic is kept in order not to trigger regressions. And keeping
* this logic should be taken care by the caller of this function.
*
******************************************************************************/

acpi_status
acpi_ev_initialize_region(union acpi_operand_object *region_obj,
u8 acpi_ns_locked)
acpi_status acpi_ev_initialize_region(union acpi_operand_object *region_obj)
{
union acpi_operand_object *handler_obj;
union acpi_operand_object *obj_desc;
acpi_adr_space_type space_id;
struct acpi_namespace_node *node;
acpi_status status;

ACPI_FUNCTION_TRACE_U32(ev_initialize_region, acpi_ns_locked);
ACPI_FUNCTION_TRACE(ev_initialize_region);

if (!region_obj) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
@@ -580,39 +588,17 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
handler_obj, region_obj,
obj_desc));

status =
acpi_ev_attach_region(handler_obj,
region_obj,
acpi_ns_locked);
(void)acpi_ev_attach_region(handler_obj,
region_obj, FALSE);

/*
* Tell all users that this region is usable by
* running the _REG method
*/
if (acpi_ns_locked) {
status =
acpi_ut_release_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}

acpi_ex_exit_interpreter();
status =
acpi_ev_execute_reg_method(region_obj,
ACPI_REG_CONNECT);
(void)acpi_ev_execute_reg_method(region_obj,
ACPI_REG_CONNECT);
acpi_ex_enter_interpreter();

if (acpi_ns_locked) {
status =
acpi_ut_acquire_mutex
(ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}
}

return_ACPI_STATUS(AE_OK);
}
}
@@ -622,12 +608,15 @@ acpi_ev_initialize_region(union acpi_operand_object *region_obj,
node = node->parent;
}

/* If we get here, there is no handler for this region */

/*
* If we get here, there is no handler for this region. This is not
* fatal because many regions get created before a handler is installed
* for said region.
*/
ACPI_DEBUG_PRINT((ACPI_DB_OPREGION,
"No handler for RegionType %s(%X) (RegionObj %p)\n",
acpi_ut_get_region_name(space_id), space_id,
region_obj));

return_ACPI_STATUS(AE_NOT_EXIST);
return_ACPI_STATUS(AE_OK);
}
42 changes: 4 additions & 38 deletions drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
@@ -437,10 +437,9 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,

ACPI_INFO(("Dynamic OEM Table Load:"));
acpi_ex_exit_interpreter();
status =
acpi_tb_install_and_load_table(table, ACPI_PTR_TO_PHYSADDR(table),
ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
TRUE, &table_index);
status = acpi_tb_install_and_load_table(ACPI_PTR_TO_PHYSADDR(table),
ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL,
TRUE, &table_index);
acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status)) {

@@ -500,7 +499,6 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
acpi_status status = AE_OK;
union acpi_operand_object *table_desc = ddb_handle;
u32 table_index;
struct acpi_table_header *table;

ACPI_FUNCTION_TRACE(ex_unload_table);

@@ -537,39 +535,7 @@ acpi_status acpi_ex_unload_table(union acpi_operand_object *ddb_handle)
* strict order requirement against it.
*/
acpi_ex_exit_interpreter();

/* Ensure the table is still loaded */

if (!acpi_tb_is_table_loaded(table_index)) {
status = AE_NOT_EXIST;
goto lock_and_exit;
}

/* Invoke table handler if present */

if (acpi_gbl_table_handler) {
status = acpi_get_table_by_index(table_index, &table);
if (ACPI_SUCCESS(status)) {
(void)acpi_gbl_table_handler(ACPI_TABLE_EVENT_UNLOAD,
table,
acpi_gbl_table_handler_context);
}
}

/* Delete the portion of the namespace owned by this table */

status = acpi_tb_delete_namespace_by_owner(table_index);
if (ACPI_FAILURE(status)) {
goto lock_and_exit;
}

(void)acpi_tb_release_owner_id(table_index);
acpi_tb_set_table_loaded_flag(table_index, FALSE);

lock_and_exit:

/* Re-acquire the interpreter lock */

status = acpi_tb_unload_table(table_index);
acpi_ex_enter_interpreter();

/*
45 changes: 45 additions & 0 deletions drivers/acpi/acpica/nsnames.c
Original file line number Diff line number Diff line change
@@ -95,6 +95,51 @@ acpi_size acpi_ns_get_pathname_length(struct acpi_namespace_node *node)
return (size);
}

/*******************************************************************************
*
* FUNCTION: acpi_ns_handle_to_name
*
* PARAMETERS: target_handle - Handle of named object whose name is
* to be found
* buffer - Where the name is returned
*
* RETURN: Status, Buffer is filled with name if status is AE_OK
*
* DESCRIPTION: Build and return a full namespace name
*
******************************************************************************/

acpi_status
acpi_ns_handle_to_name(acpi_handle target_handle, struct acpi_buffer *buffer)
{
acpi_status status;
struct acpi_namespace_node *node;
const char *node_name;

ACPI_FUNCTION_TRACE_PTR(ns_handle_to_name, target_handle);

node = acpi_ns_validate_handle(target_handle);
if (!node) {
return_ACPI_STATUS(AE_BAD_PARAMETER);
}

/* Validate/Allocate/Clear caller buffer */

status = acpi_ut_initialize_buffer(buffer, ACPI_PATH_SEGMENT_LENGTH);
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
}

/* Just copy the ACPI name from the Node and zero terminate it */

node_name = acpi_ut_get_node_name(node);
ACPI_MOVE_NAME(buffer->pointer, node_name);
((char *)buffer->pointer)[ACPI_NAME_SIZE] = 0;

ACPI_DEBUG_PRINT((ACPI_DB_EXEC, "%4.4s\n", (char *)buffer->pointer));
return_ACPI_STATUS(AE_OK);
}

/*******************************************************************************
*
* FUNCTION: acpi_ns_handle_to_pathname
Loading

0 comments on commit 496c9a9

Please sign in to comment.