Skip to content

Commit 39ea1bb

Browse files
acpibobrafaeljw
authored andcommitted
ACPICA: Add new ACPI 6.4 semantics to the Load() operator
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 <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8bd2483 commit 39ea1bb

4 files changed

Lines changed: 43 additions & 19 deletions

File tree

drivers/acpi/acpica/dswexec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static acpi_execute_op acpi_gbl_op_type_dispatch[] = {
3030
acpi_ex_opcode_0A_0T_1R,
3131
acpi_ex_opcode_1A_0T_0R,
3232
acpi_ex_opcode_1A_0T_1R,
33-
acpi_ex_opcode_1A_1T_0R,
33+
NULL, /* Was: acpi_ex_opcode_1A_0T_0R (Was for Load operator) */
3434
acpi_ex_opcode_1A_1T_1R,
3535
acpi_ex_opcode_2A_0T_0R,
3636
acpi_ex_opcode_2A_0T_1R,

drivers/acpi/acpica/exconfig.c

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ acpi_ex_region_read(union acpi_operand_object *obj_desc, u32 length, u8 *buffer)
249249
*
250250
* PARAMETERS: obj_desc - Region or Buffer/Field where the table will be
251251
* obtained
252-
* target - Where a handle to the table will be stored
252+
* target - Where the status of the load will be stored
253253
* walk_state - Current state
254254
*
255255
* RETURN: Status
@@ -278,6 +278,20 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
278278

279279
ACPI_FUNCTION_TRACE(ex_load_op);
280280

281+
if (target->common.descriptor_type == ACPI_DESC_TYPE_NAMED) {
282+
target =
283+
acpi_ns_get_attached_object(ACPI_CAST_PTR
284+
(struct acpi_namespace_node,
285+
target));
286+
}
287+
if (target->common.type != ACPI_TYPE_INTEGER) {
288+
ACPI_EXCEPTION((AE_INFO, AE_TYPE,
289+
"Type not integer: %X\n", target->common.type));
290+
return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
291+
}
292+
293+
target->integer.value = 0;
294+
281295
/* Source Object can be either an op_region or a Buffer/Field */
282296

283297
switch (obj_desc->common.type) {
@@ -430,9 +444,6 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
430444
*/
431445
status = acpi_ex_add_table(table_index, &ddb_handle);
432446
if (ACPI_FAILURE(status)) {
433-
434-
/* On error, table_ptr was deallocated above */
435-
436447
return_ACPI_STATUS(status);
437448
}
438449

@@ -442,21 +453,13 @@ acpi_ex_load_op(union acpi_operand_object *obj_desc,
442453
acpi_ns_initialize_objects();
443454
acpi_ex_enter_interpreter();
444455

445-
/* Store the ddb_handle into the Target operand */
456+
/* Remove the reference to ddb_handle created by acpi_ex_add_table above */
446457

447-
status = acpi_ex_store(ddb_handle, target, walk_state);
448-
if (ACPI_FAILURE(status)) {
449-
(void)acpi_ex_unload_table(ddb_handle);
450-
451-
/* table_ptr was deallocated above */
452-
453-
acpi_ut_remove_reference(ddb_handle);
454-
return_ACPI_STATUS(status);
455-
}
458+
acpi_ut_remove_reference(ddb_handle);
456459

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

459-
acpi_ut_remove_reference(ddb_handle);
462+
target->integer.value = 0xFFFFFFFFFFFFFFFF;
460463
return_ACPI_STATUS(status);
461464
}
462465

drivers/acpi/acpica/exoparg1.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ acpi_status acpi_ex_opcode_1A_0T_0R(struct acpi_walk_state *walk_state)
163163
return_ACPI_STATUS(status);
164164
}
165165

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

189190
switch (walk_state->opcode) {
191+
#ifdef _OBSOLETE_CODE
190192
case AML_LOAD_OP:
191193

192194
status = acpi_ex_load_op(operand[0], operand[1], walk_state);
193195
break;
196+
#endif
194197

195198
default: /* Unknown opcode */
196199

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

205208
return_ACPI_STATUS(status);
206209
}
210+
#endif
207211

208212
/*******************************************************************************
209213
*
@@ -215,6 +219,8 @@ acpi_status acpi_ex_opcode_1A_1T_0R(struct acpi_walk_state *walk_state)
215219
*
216220
* DESCRIPTION: Execute opcode with one argument, one target, and a
217221
* return value.
222+
* January 2022: Added Load operator, with new ACPI 6.4
223+
* semantics.
218224
*
219225
******************************************************************************/
220226

@@ -239,6 +245,7 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
239245
case AML_FIND_SET_LEFT_BIT_OP:
240246
case AML_FIND_SET_RIGHT_BIT_OP:
241247
case AML_FROM_BCD_OP:
248+
case AML_LOAD_OP:
242249
case AML_TO_BCD_OP:
243250
case AML_CONDITIONAL_REF_OF_OP:
244251

@@ -338,6 +345,20 @@ acpi_status acpi_ex_opcode_1A_1T_1R(struct acpi_walk_state *walk_state)
338345
}
339346
break;
340347

348+
case AML_LOAD_OP: /* Result1 = Load (Operand[0], Result1) */
349+
350+
return_desc->integer.value = 0;
351+
status =
352+
acpi_ex_load_op(operand[0], return_desc,
353+
walk_state);
354+
if (ACPI_SUCCESS(status)) {
355+
356+
/* Return -1 (non-zero) indicates success */
357+
358+
return_desc->integer.value = 0xFFFFFFFFFFFFFFFF;
359+
}
360+
break;
361+
341362
case AML_TO_BCD_OP: /* to_bcd (Operand, Result) */
342363

343364
return_desc->integer.value = 0;

drivers/acpi/acpica/psopcode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES] = {
408408
AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE |
409409
AML_DEFER | AML_FIELD | AML_CREATE),
410410
/* 4A */ ACPI_OP("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY,
411-
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_0R,
412-
AML_FLAGS_EXEC_1A_1T_0R),
411+
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R,
412+
AML_FLAGS_EXEC_1A_1T_1R),
413413
/* 4B */ ACPI_OP("Stall", ARGP_STALL_OP, ARGI_STALL_OP, ACPI_TYPE_ANY,
414414
AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R,
415415
AML_FLAGS_EXEC_1A_0T_0R),

0 commit comments

Comments
 (0)