summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2022-01-20 13:13:04 -0800
committerRobert Moore <Robert.Moore@intel.com>2022-01-20 13:13:04 -0800
commit84bf573ab7222c4e1c22167b22d29c4da1552b20 (patch)
tree2c5b5e1ab985ea9fe2ad25cfb07525652b7bc181
parentaeb5d1e71aeb86e00c87240afb7235f7a9adf1cb (diff)
downloadacpica-84bf573ab7222c4e1c22167b22d29c4da1552b20.tar.gz
Add new acpi 6.4 semantics to the Load() operator
DDB_HANDLE is gone, now load returns a pass/fail integer, as well as storing it in an optional 2nd argument.
-rw-r--r--source/compiler/aslmap.c2
-rw-r--r--source/compiler/aslprimaries.y2
-rw-r--r--source/compiler/aslrules.y6
-rw-r--r--source/compiler/asltypes.y2
-rw-r--r--source/components/dispatcher/dswexec.c2
-rw-r--r--source/components/executer/exconfig.c33
-rw-r--r--source/components/executer/exoparg1.c20
-rw-r--r--source/components/parser/psopcode.c2
8 files changed, 45 insertions, 24 deletions
diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c
index 7b591bc6e..126cbe1ed 100644
--- a/source/compiler/aslmap.c
+++ b/source/compiler/aslmap.c
@@ -379,7 +379,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] =
/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LOGICAL_LESS_EQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LNOT */ OP_TABLE_ENTRY (AML_LOGICAL_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LOGICAL_NOT_EQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, 0),
+/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* LOADTABLE */ OP_TABLE_ENTRY (AML_LOAD_TABLE_OP, 0, 0, ACPI_BTYPE_DDB_HANDLE),
/* LOCAL0 */ OP_TABLE_ENTRY (AML_LOCAL0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
/* LOCAL1 */ OP_TABLE_ENTRY (AML_LOCAL1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS),
diff --git a/source/compiler/aslprimaries.y b/source/compiler/aslprimaries.y
index dd1310b07..1ce8b47a2 100644
--- a/source/compiler/aslprimaries.y
+++ b/source/compiler/aslprimaries.y
@@ -843,7 +843,7 @@ LoadTerm
: PARSEOP_LOAD
PARSEOP_OPEN_PAREN {$<n>$ = TrCreateLeafOp (PARSEOP_LOAD);}
NameString
- RequiredTarget
+ Target
PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($<n>3,2,$4,$5);}
| PARSEOP_LOAD
PARSEOP_OPEN_PAREN
diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y
index a944308e3..d7dd9a7b6 100644
--- a/source/compiler/aslrules.y
+++ b/source/compiler/aslrules.y
@@ -261,11 +261,11 @@ Target
| ',' {$$ = TrCreateNullTargetOp ();} /* Placeholder is a ZeroOp object */
| ',' SuperName {$$ = TrSetOpFlags ($2, OP_IS_TARGET);}
;
-
+/*
RequiredTarget
: ',' SuperName {$$ = TrSetOpFlags ($2, OP_IS_TARGET);}
;
-
+*/
TermArg
: SimpleName {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
| Type2Opcode {$$ = TrSetOpFlags ($1, OP_IS_TERM_ARG);}
@@ -715,7 +715,6 @@ Type1Opcode
| FatalTerm {}
| ForTerm {}
| ElseIfTerm {}
- | LoadTerm {}
| NoOpTerm {}
| NotifyTerm {}
| ReleaseTerm {}
@@ -734,6 +733,7 @@ Type2Opcode
| CondRefOfTerm {}
| CopyObjectTerm {}
| DerefOfTerm {}
+ | LoadTerm {} /* Moved from Type1 -- now returns an integer (ACPI 6.4) */
| ObjectTypeTerm {}
| RefOfTerm {}
| SizeOfTerm {}
diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y
index aaa732f4d..fb42c3fc9 100644
--- a/source/compiler/asltypes.y
+++ b/source/compiler/asltypes.y
@@ -175,7 +175,9 @@ NoEcho('
%type <n> ParameterTypePackageList
%type <n> ParameterTypesPackage
%type <n> ParameterTypesPackageList
+/*
%type <n> RequiredTarget
+*/
%type <n> SimpleName
%type <n> StringData
%type <n> StringLiteral
diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c
index 636067bfe..082e2af4d 100644
--- a/source/components/dispatcher/dswexec.c
+++ b/source/components/dispatcher/dswexec.c
@@ -173,7 +173,7 @@ static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] =
AcpiExOpcode_0A_0T_1R,
AcpiExOpcode_1A_0T_0R,
AcpiExOpcode_1A_0T_1R,
- AcpiExOpcode_1A_1T_0R,
+ NULL, /* Was: AcpiExOpcode_1A_0T_0R (Was for Load operator) */
AcpiExOpcode_1A_1T_1R,
AcpiExOpcode_2A_0T_0R,
AcpiExOpcode_2A_0T_1R,
diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c
index ff26ade76..85cdbf69b 100644
--- a/source/components/executer/exconfig.c
+++ b/source/components/executer/exconfig.c
@@ -423,7 +423,7 @@ AcpiExRegionRead (
*
* PARAMETERS: ObjDesc - 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
* WalkState - Current state
*
* RETURN: Status
@@ -455,6 +455,18 @@ AcpiExLoadOp (
ACPI_FUNCTION_TRACE (ExLoadOp);
+ if (Target->Common.DescriptorType == ACPI_DESC_TYPE_NAMED)
+ {
+ Target = AcpiNsGetAttachedObject (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Target));
+ }
+ if (Target->Common.Type != ACPI_TYPE_INTEGER)
+ {
+ fprintf (stderr, "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 OpRegion or a Buffer/Field */
switch (ObjDesc->Common.Type)
@@ -616,8 +628,6 @@ AcpiExLoadOp (
Status = AcpiExAddTable (TableIndex, &DdbHandle);
if (ACPI_FAILURE (Status))
{
- /* On error, TablePtr was deallocated above */
-
return_ACPI_STATUS (Status);
}
@@ -627,22 +637,13 @@ AcpiExLoadOp (
AcpiNsInitializeObjects ();
AcpiExEnterInterpreter ();
- /* Store the DdbHandle into the Target operand */
+ /* Remove the reference to DdbHandle created by AcpiExAddTable above */
- Status = AcpiExStore (DdbHandle, Target, WalkState);
- if (ACPI_FAILURE (Status))
- {
- (void) AcpiExUnloadTable (DdbHandle);
-
- /* TablePtr was deallocated above */
-
- AcpiUtRemoveReference (DdbHandle);
- return_ACPI_STATUS (Status);
- }
+ AcpiUtRemoveReference (DdbHandle);
- /* Remove the reference by added by AcpiExStore above */
+ /* Return -1 (non-zero) indicates success */
- AcpiUtRemoveReference (DdbHandle);
+ Target->Integer.Value = 0xFFFFFFFFFFFFFFFF;
return_ACPI_STATUS (Status);
}
diff --git a/source/components/executer/exoparg1.c b/source/components/executer/exoparg1.c
index 424e1e992..eb1fa2daa 100644
--- a/source/components/executer/exoparg1.c
+++ b/source/components/executer/exoparg1.c
@@ -323,6 +323,7 @@ AcpiExOpcode_1A_0T_0R (
}
+#ifdef _OBSOLETE_CODE /* Was originally used for Load() operator */
/*******************************************************************************
*
* FUNCTION: AcpiExOpcode_1A_1T_0R
@@ -352,10 +353,12 @@ AcpiExOpcode_1A_1T_0R (
switch (WalkState->Opcode)
{
+#ifdef _OBSOLETE_CODE
case AML_LOAD_OP:
Status = AcpiExLoadOp (Operand[0], Operand[1], WalkState);
break;
+#endif
default: /* Unknown opcode */
@@ -370,7 +373,7 @@ Cleanup:
return_ACPI_STATUS (Status);
}
-
+#endif
/*******************************************************************************
*
@@ -382,6 +385,8 @@ Cleanup:
*
* DESCRIPTION: Execute opcode with one argument, one target, and a
* return value.
+ * January 2022: Added Load operator, with new ACPI 6.4
+ * semantics.
*
******************************************************************************/
@@ -411,6 +416,7 @@ AcpiExOpcode_1A_1T_1R (
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:
@@ -512,6 +518,18 @@ AcpiExOpcode_1A_1T_1R (
}
break;
+ case AML_LOAD_OP: /* Result1 = Load (Operand[0], Result1) */
+
+ ReturnDesc->Integer.Value = 0;
+ Status = AcpiExLoadOp (Operand[0], ReturnDesc, WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Return -1 (non-zero) indicates success */
+
+ ReturnDesc->Integer.Value = 0xFFFFFFFFFFFFFFFF;
+ }
+ break;
+
case AML_TO_BCD_OP: /* ToBcd (Operand, Result) */
ReturnDesc->Integer.Value = 0;
diff --git a/source/components/parser/psopcode.c b/source/components/parser/psopcode.c
index 4f153303f..4bdb96de8 100644
--- a/source/components/parser/psopcode.c
+++ b/source/components/parser/psopcode.c
@@ -375,7 +375,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
/* 47 */ ACPI_OP ("Event", ARGP_EVENT_OP, ARGI_EVENT_OP, ACPI_TYPE_EVENT, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED ),
/* 48 */ ACPI_OP ("CondRefOf", ARGP_COND_REF_OF_OP, ARGI_COND_REF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R),
/* 49 */ ACPI_OP ("CreateField", ARGP_CREATE_FIELD_OP, ARGI_CREATE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, 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),
+/* 4A */ ACPI_OP ("Load", ARGP_LOAD_OP, ARGI_LOAD_OP, ACPI_TYPE_ANY, 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),
/* 4C */ ACPI_OP ("Sleep", ARGP_SLEEP_OP, ARGI_SLEEP_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_0R, AML_FLAGS_EXEC_1A_0T_0R),
/* 4D */ ACPI_OP ("Acquire", ARGP_ACQUIRE_OP, ARGI_ACQUIRE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R),