Skip to content

Commit

Permalink
ACPICA: Add new ACPI 6.4 semantics to the Load() operator
Browse files Browse the repository at this point in the history
ACPICA commit 84bf573ab7222c4e1c22167b22d29c4da1552b20

DDB_HANDLE is gone, now Load() returns a pass/fail integer, as well as
storing it in an optional 2nd argument.

Link: acpica/acpica@84bf573a
Signed-off-by: Bob Moore <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
acpibob authored and rafaeljw committed Apr 13, 2022
1 parent 8bd2483 commit 39ea1bb
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 19 deletions.
2 changes: 1 addition & 1 deletion drivers/acpi/acpica/dswexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
acpi_ex_opcode_0A_0T_1R,
acpi_ex_opcode_1A_0T_0R,
acpi_ex_opcode_1A_0T_1R,
acpi_ex_opcode_1A_1T_0R,
NULL, /* Was: acpi_ex_opcode_1A_0T_0R (Was for Load operator) */
acpi_ex_opcode_1A_1T_1R,
acpi_ex_opcode_2A_0T_0R,
acpi_ex_opcode_2A_0T_1R,
Expand Down
35 changes: 19 additions & 16 deletions drivers/acpi/acpica/exconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
*
* PARAMETERS: obj_desc - Region or Buffer/Field where the table will be
* obtained
* target - Where a handle to the table will be stored
* target - Where the status of the load will be stored
* walk_state - Current state
*
* RETURN: Status
Expand Down Expand Up @@ -278,6 +278,20 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,

ACPI_FUNCTION_TRACE(ex_load_op);

if (target->common.descriptor_type == ACPI_DESC_TYPE_NAMED) {
target =
acpi_ns_get_attached_object(ACPI_CAST_PTR
(struct acpi_namespace_node,
target));
}
if (target->common.type != ACPI_TYPE_INTEGER) {
ACPI_EXCEPTION((AE_INFO, AE_TYPE,
"Type not integer: %X\n", target->common.type));
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
}

target->integer.value = 0;

/* Source Object can be either an op_region or a Buffer/Field */

switch (obj_desc->common.type) {
Expand Down Expand Up @@ -430,9 +444,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
*/
status = acpi_ex_add_table(table_index, &ddb_handle);
if (ACPI_FAILURE(status)) {

/* On error, table_ptr was deallocated above */

return_ACPI_STATUS(status);
}

Expand All @@ -442,21 +453,13 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
acpi_ns_initialize_objects();
acpi_ex_enter_interpreter();

/* Store the ddb_handle into the Target operand */
/* Remove the reference to ddb_handle created by acpi_ex_add_table above */

status = acpi_ex_store(ddb_handle, target, walk_state);
if (ACPI_FAILURE(status)) {
(void)acpi_ex_unload_table(ddb_handle);

/* table_ptr was deallocated above */

acpi_ut_remove_reference(ddb_handle);
return_ACPI_STATUS(status);
}
acpi_ut_remove_reference(ddb_handle);

/* Remove the reference by added by acpi_ex_store above */
/* Return -1 (non-zero) indicates success */

acpi_ut_remove_reference(ddb_handle);
target->integer.value = 0xFFFFFFFFFFFFFFFF;
return_ACPI_STATUS(status);
}

Expand Down
21 changes: 21 additions & 0 deletions drivers/acpi/acpica/exoparg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
return_ACPI_STATUS(status);
}

#ifdef _OBSOLETE_CODE /* Was originally used for Load() operator */
/*******************************************************************************
*
* FUNCTION: acpi_ex_opcode_1A_1T_0R
Expand All @@ -187,10 +188,12 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
/* Examine the AML opcode */

switch (walk_state->opcode) {
#ifdef _OBSOLETE_CODE
case AML_LOAD_OP:

status = acpi_ex_load_op(operand[0], operand[1], walk_state);
break;
#endif

default: /* Unknown opcode */

Expand All @@ -204,6 +207,7 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)

return_ACPI_STATUS(status);
}
#endif

/*******************************************************************************
*
Expand All @@ -215,6 +219,8 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
*
* DESCRIPTION: Execute opcode with one argument, one target, and a
* return value.
* January 2022: Added Load operator, with new ACPI 6.4
* semantics.
*
******************************************************************************/

Expand All @@ -239,6 +245,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
case AML_FIND_SET_LEFT_BIT_OP:
case AML_FIND_SET_RIGHT_BIT_OP:
case AML_FROM_BCD_OP:
case AML_LOAD_OP:
case AML_TO_BCD_OP:
case AML_CONDITIONAL_REF_OF_OP:

Expand Down Expand Up @@ -338,6 +345,20 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
}
break;

case AML_LOAD_OP: /* Result1 = Load (Operand[0], Result1) */

return_desc->integer.value = 0;
status =
acpi_ex_load_op(operand[0], return_desc,
walk_state);
if (ACPI_SUCCESS(status)) {

/* Return -1 (non-zero) indicates success */

return_desc->integer.value = 0xFFFFFFFFFFFFFFFF;
}
break;

case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */

return_desc->integer.value = 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/acpi/acpica/psopcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
AML_DEFER | AML_FIELD | AML_CREATE),
/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R,
AML_FLAGS_EXEC_1A_1T_0R),
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
AML_FLAGS_EXEC_1A_1T_1R),
/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY,
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
AML_FLAGS_EXEC_1A_0T_0R),
Expand Down

0 comments on commit 39ea1bb

Please sign in to comment.