diff options
author | msmith <msmith@FreeBSD.org> | 2001-10-31 02:32:29 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-10-31 02:32:29 +0000 |
commit | 3699168fb0ef62ab72780ca4cada6b30936b1b4f (patch) | |
tree | b9cb5f0ef2b19b51331c445a1773fd55ce0b739e /sys/contrib/dev/acpica/dswload.c | |
parent | dda50f5fd9f903a5f19d4f708e468d62d8bc930e (diff) | |
download | FreeBSD-src-3699168fb0ef62ab72780ca4cada6b30936b1b4f.zip FreeBSD-src-3699168fb0ef62ab72780ca4cada6b30936b1b4f.tar.gz |
Import the Intel ACPI CA 20011018 snapshot
Diffstat (limited to 'sys/contrib/dev/acpica/dswload.c')
-rw-r--r-- | sys/contrib/dev/acpica/dswload.c | 361 |
1 files changed, 119 insertions, 242 deletions
diff --git a/sys/contrib/dev/acpica/dswload.c b/sys/contrib/dev/acpica/dswload.c index e4434e9..844aa01 100644 --- a/sys/contrib/dev/acpica/dswload.c +++ b/sys/contrib/dev/acpica/dswload.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 48 $ + * $Revision: 50 $ * *****************************************************************************/ @@ -129,6 +129,19 @@ MODULE_NAME ("dswload") +/******************************************************************************* + * + * FUNCTION: AcpiDsInitCallbacks + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * PassNumber - 1, 2, or 3 + * + * RETURN: Status + * + * DESCRIPTION: Init walk state callbacks + * + ******************************************************************************/ + ACPI_STATUS AcpiDsInitCallbacks ( ACPI_WALK_STATE *WalkState, @@ -405,7 +418,6 @@ AcpiDsLoad2BeginOp ( return (AE_OK); } } - else { /* Get name from the op */ @@ -413,7 +425,6 @@ AcpiDsLoad2BeginOp ( BufferPtr = (NATIVE_CHAR *) &((ACPI_PARSE2_OBJECT *)Op)->Name; } } - else { BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState); @@ -539,6 +550,7 @@ AcpiDsLoad2EndOp ( ACPI_NAMESPACE_NODE *Node; ACPI_PARSE_OBJECT *Arg; ACPI_NAMESPACE_NODE *NewNode; + UINT32 i; PROC_NAME ("DsLoad2EndOp"); @@ -621,330 +633,194 @@ AcpiDsLoad2EndOp ( * AML_THERMALZONE */ + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "Create-Load [%s] State=%p Op=%p NamedObj=%p\n", + AcpiPsGetOpcodeName (Op->Opcode), WalkState, Op, Node)); /* Decode the opcode */ Arg = Op->Value.Arg; - switch (Op->Opcode) + switch (WalkState->OpInfo->Type) { - - case AML_CREATE_FIELD_OP: - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: + case AML_TYPE_CREATE_FIELD: /* * Create the field object, but the field buffer and index must * be evaluated later during the execution phase */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "CreateXxxField: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - /* Get the NameString argument */ - - if (Op->Opcode == AML_CREATE_FIELD_OP) - { - Arg = AcpiPsGetArg (Op, 3); - } - else - { - /* Create Bit/Byte/Word/Dword field */ - - Arg = AcpiPsGetArg (Op, 2); - } - - if (!Arg) - { - Status = AE_AML_NO_OPERAND; - goto Cleanup; - } - - /* - * Enter the NameString into the namespace - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, - INTERNAL_TYPE_DEF_ANY, IMODE_LOAD_PASS1, - NS_NO_UPSEARCH | NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - /* We could put the returned object (Node) on the object stack for later, but - * for now, we will put it in the "op" object that the parser uses, so we - * can get it again at the end of this scope - */ - Op->Node = NewNode; - - /* - * If there is no object attached to the node, this node was just created and - * we need to create the field object. Otherwise, this was a lookup of an - * existing node and we don't want to create the field object again. - */ - if (!NewNode->Object) - { - /* - * The Field definition is not fully parsed at this time. - * (We must save the address of the AML for the buffer and index operands) - */ - Status = AcpiExCreateBufferField (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - NewNode, WalkState); - } + Status = AcpiDsCreateBufferField (Op, WalkState); break; - case AML_INT_METHODCALL_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); + case AML_TYPE_NAMED_FIELD: - /* - * Lookup the method name and save the Node - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, - ACPI_TYPE_ANY, IMODE_LOAD_PASS2, - NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, - WalkState, &(NewNode)); - if (ACPI_SUCCESS (Status)) + Arg = Op->Value.Arg; + switch (Op->Opcode) { - /* TBD: has name already been resolved by here ??*/ - - /* TBD: [Restructure] Make sure that what we found is indeed a method! */ - /* We didn't search for a method on purpose, to see if the name would resolve! */ - - /* We could put the returned object (Node) on the object stack for later, but - * for now, we will put it in the "op" object that the parser uses, so we - * can get it again at the end of this scope - */ - Op->Node = NewNode; - } + case AML_INDEX_FIELD_OP: + Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node, + WalkState); + break; - break; + case AML_BANK_FIELD_OP: - case AML_PROCESSOR_OP: + Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); + break; - /* Nothing to do other than enter object into namespace */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Processor: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); + case AML_FIELD_OP: - Status = AcpiExCreateProcessor (Op, Node); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; + Status = AcpiDsCreateField (Op, Arg->Node, WalkState); + break; } - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed Processor Init, Op=%p State=%p entry=%p\n", - Op, WalkState, Node)); break; - case AML_POWER_RES_OP: - - /* Nothing to do other than enter object into namespace */ + case AML_TYPE_NAMED_SIMPLE: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-PowerResource: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - Status = AcpiExCreatePowerResource (Op, Node); + Status = AcpiDsCreateOperands (WalkState, Arg); if (ACPI_FAILURE (Status)) { goto Cleanup; } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed PowerResource Init, Op=%p State=%p entry=%p\n", - Op, WalkState, Node)); - break; - - - case AML_THERMAL_ZONE_OP: - - /* Nothing to do other than enter object into namespace */ - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-ThermalZone: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - break; - - - case AML_FIELD_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Field: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - Arg = Op->Value.Arg; + switch (Op->Opcode) + { + case AML_PROCESSOR_OP: - Status = AcpiDsCreateField (Op, Arg->Node, WalkState); - break; + Status = AcpiExCreateProcessor (WalkState); + break; - case AML_INDEX_FIELD_OP: + case AML_POWER_RES_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-IndexField: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); + Status = AcpiExCreatePowerResource (WalkState); + break; - Arg = Op->Value.Arg; - Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Node, - WalkState); - break; + case AML_MUTEX_OP: + Status = AcpiExCreateMutex (WalkState); + break; - case AML_BANK_FIELD_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-BankField: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); - - Arg = Op->Value.Arg; - Status = AcpiDsCreateBankField (Op, Arg->Node, WalkState); - break; + case AML_EVENT_OP: + Status = AcpiExCreateEvent (WalkState); + break; - /* - * MethodOp PkgLength NamesString MethodFlags TermList - */ - case AML_METHOD_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Method: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); + case AML_DATA_REGION_OP: - if (!Node->Object) - { - Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - Arg->Value.Integer32, Node); - } - break; + Status = AcpiExCreateTableRegion (WalkState); + break; + case AML_ALIAS_OP: - case AML_MUTEX_OP: + Status = AcpiExCreateAlias (WalkState); + break; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Mutex: Op=%p State=%p\n", Op, WalkState)); + default: + /* Unknown opcode */ - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { + Status = AE_OK; goto Cleanup; + break; } - Status = AcpiExCreateMutex (WalkState); - break; - - - case AML_EVENT_OP: + /* Delete operands */ - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Event: Op=%p State=%p\n", Op, WalkState)); - - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) + for (i = 1; i < WalkState->NumOperands; i++) { - goto Cleanup; + AcpiUtRemoveReference (WalkState->Operands[i]); + WalkState->Operands[i] = NULL; } - Status = AcpiExCreateEvent (WalkState); break; - case AML_REGION_OP: + case AML_TYPE_NAMED_COMPLEX: - if (Node->Object) + switch (Op->Opcode) { - break; - } + case AML_METHOD_OP: + /* + * MethodOp PkgLength NamesString MethodFlags TermList + */ + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "LOADING-Method: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Node)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-OpRegion: Op=%p State=%p NamedObj=%p\n", - Op, WalkState, Node)); + if (!Node->Object) + { + Status = AcpiDsCreateOperands (WalkState, Arg); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } - /* - * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. - * (We must save the address of the AML of the address and length operands) - */ - Status = AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, - ((ACPI_PARSE2_OBJECT *) Op)->Length, - (ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState); + Status = AcpiExCreateMethod (((ACPI_PARSE2_OBJECT *) Op)->Data, + ((ACPI_PARSE2_OBJECT *) Op)->Length, + WalkState); + } + break; - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Completed OpRegion Init, Op=%p State=%p entry=%p\n", - Op, WalkState, Node)); - break; + case AML_REGION_OP: + /* + * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId. + * (We must save the address of the AML of the address and length operands) + */ + Status = AcpiExCreateRegion (((ACPI_PARSE2_OBJECT *) Op)->Data, + ((ACPI_PARSE2_OBJECT *) Op)->Length, + (ACPI_ADR_SPACE_TYPE) Arg->Value.Integer, WalkState); + break; - case AML_DATA_REGION_OP: - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-DataRegion: Op=%p State=%p NamedObj=%p\n", - Op, WalkState, Node)); + case AML_NAME_OP: - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; + Status = AcpiDsCreateNode (WalkState, Node, Op); + break; } - - Status = AcpiExCreateTableRegion (WalkState); break; - /* Namespace Modifier Opcodes */ - - case AML_ALIAS_OP: - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Alias: Op=%p State=%p\n", Op, WalkState)); + case AML_CLASS_INTERNAL: - Status = AcpiDsCreateOperands (WalkState, Arg); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiExCreateAlias (WalkState); + /* case AML_INT_NAMEPATH_OP: */ break; - case AML_NAME_OP: + case AML_CLASS_METHOD_CALL: ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-Name: Op=%p State=%p\n", Op, WalkState)); + "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n", + WalkState, Op, Node)); /* - * Because of the execution pass through the non-control-method - * parts of the table, we can arrive here twice. Only init - * the named object node the first time through + * Lookup the method name and save the Node */ - if (!Node->Object) + Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Value.String, + ACPI_TYPE_ANY, IMODE_LOAD_PASS2, + NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, + WalkState, &(NewNode)); + if (ACPI_SUCCESS (Status)) { - Status = AcpiDsCreateNode (WalkState, Node, Op); - } - - break; + /* TBD: has name already been resolved by here ??*/ + /* TBD: [Restructure] Make sure that what we found is indeed a method! */ + /* We didn't search for a method on purpose, to see if the name would resolve! */ - case AML_INT_NAMEPATH_OP: + /* We could put the returned object (Node) on the object stack for later, but + * for now, we will put it in the "op" object that the parser uses, so we + * can get it again at the end of this scope + */ + Op->Node = NewNode; + } - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "LOADING-NamePath object: State=%p Op=%p NamedObj=%p\n", - WalkState, Op, Node)); break; @@ -957,7 +833,8 @@ Cleanup: /* Remove the Node pushed at the very beginning */ - AcpiDsObjStackPop (1, WalkState); + WalkState->Operands[0] = NULL; + WalkState->NumOperands = 0; return (Status); } |