From dfdabaeca669cde746b85148603b05179d11b534 Mon Sep 17 00:00:00 2001 From: aystarik Date: Wed, 29 Jun 2005 17:03:44 +0000 Subject: [PATCH] Removed obsolete ACPI_OBJECT_TYPE8 typedef and changed all references to ACPI_OBJECT_TYPE date 2001.12.12.20.41.00; author rmoore1; state Exp; --- source/components/dispatcher/dsmthdat.c | 7 +- source/components/dispatcher/dsobject.c | 227 ++++++++++++------------ 2 files changed, 115 insertions(+), 119 deletions(-) diff --git a/source/components/dispatcher/dsmthdat.c b/source/components/dispatcher/dsmthdat.c index 1f2e6f9b1..a16ff2676 100644 --- a/source/components/dispatcher/dsmthdat.c +++ b/source/components/dispatcher/dsmthdat.c @@ -1,7 +1,7 @@ /******************************************************************************* * * Module Name: dsmthdat - control method arguments and local variables - * $Revision: 1.54 $ + * $Revision: 1.56 $ * ******************************************************************************/ @@ -362,7 +362,6 @@ AcpiDsMethodDataGetNode ( default: ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode)); return_ACPI_STATUS (AE_AML_BAD_OPCODE); - break; } return_ACPI_STATUS (AE_OK); @@ -430,7 +429,7 @@ AcpiDsMethodDataSetValue ( * ******************************************************************************/ -ACPI_OBJECT_TYPE8 +ACPI_OBJECT_TYPE AcpiDsMethodDataGetType ( UINT16 Opcode, UINT32 Index, @@ -540,7 +539,6 @@ AcpiDsMethodDataGetValue ( Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG); - break; case AML_LOCAL_OP: @@ -548,7 +546,6 @@ AcpiDsMethodDataGetValue ( Index, Node)); return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL); - break; } } diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 1ad456102..14806efd1 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dsobject - Dispatcher object management routines - * $Revision: 1.66 $ + * $Revision: 1.87 $ * *****************************************************************************/ @@ -154,7 +154,7 @@ AcpiDsInitOneObject ( void *Context, void **ReturnValue) { - ACPI_OBJECT_TYPE8 Type; + ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; UINT8 TableRevision; @@ -170,7 +170,6 @@ AcpiDsInitOneObject ( * We are only interested in objects owned by the table that * was just loaded */ - if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId != Info->TableDesc->TableId) { @@ -184,7 +183,6 @@ AcpiDsInitOneObject ( switch (Type) { - case ACPI_TYPE_REGION: AcpiDsInitializeRegion (ObjHandle); @@ -197,16 +195,15 @@ AcpiDsInitOneObject ( Info->MethodCount++; - if (!(AcpiDbgLevel & TRACE_INIT)) + if (!(AcpiDbgLevel & ACPI_LV_INIT)) { - DEBUG_PRINT_RAW (ACPI_OK, (".")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, ".")); } /* * Set the execution data width (32 or 64) based upon the * revision number of the parent ACPI table. */ - if (TableRevision == 1) { ((ACPI_NAMESPACE_NODE *)ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32; @@ -216,16 +213,15 @@ AcpiDsInitOneObject ( * Always parse methods to detect errors, we may delete * the parse tree below */ - Status = AcpiDsParseMethod (ObjHandle); - - /* TBD: [Errors] what do we do with an error? */ - if (ACPI_FAILURE (Status)) { - DEBUG_PRINTP (ACPI_ERROR, ("Method %p [%4.4s] parse failed! %s\n", - ObjHandle, &((ACPI_NAMESPACE_NODE *)ObjHandle)->Name, - AcpiUtFormatException (Status))); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n", + ObjHandle, (char *) &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name, + AcpiFormatException (Status))); + + /* This parse failed, but we will continue parsing more methods */ + break; } @@ -234,6 +230,7 @@ AcpiDsInitOneObject ( * for every execution since there isn't much overhead */ AcpiNsDeleteNamespaceSubtree (ObjHandle); + AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId); break; default: @@ -273,9 +270,9 @@ AcpiDsInitializeObjects ( FUNCTION_TRACE ("DsInitializeObjects"); - DEBUG_PRINTP (TRACE_DISPATCH, - ("**** Starting initialization of namespace objects ****\n")); - DEBUG_PRINT_RAW (ACPI_OK, ("Parsing Methods:")); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "**** Starting initialization of namespace objects ****\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, "Parsing Methods:")); Info.MethodCount = 0; @@ -290,16 +287,16 @@ AcpiDsInitializeObjects ( AcpiDsInitOneObject, &Info, NULL); if (ACPI_FAILURE (Status)) { - DEBUG_PRINTP (ACPI_ERROR, ("WalkNamespace failed! %x\n", Status)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %x\n", Status)); } - DEBUG_PRINT_RAW (ACPI_OK, - ("\n%d Control Methods found and parsed (%d nodes total)\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OK, + "\n%d Control Methods found and parsed (%d nodes total)\n", Info.MethodCount, Info.ObjectCount)); - DEBUG_PRINTP (TRACE_DISPATCH, - ("%d Control Methods found\n", Info.MethodCount)); - DEBUG_PRINTP (TRACE_DISPATCH, - ("%d Op Regions found\n", Info.OpRegionCount)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "%d Control Methods found\n", Info.MethodCount)); + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, + "%d Op Regions found\n", Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } @@ -326,20 +323,22 @@ AcpiDsInitObjectFromOp ( ACPI_WALK_STATE *WalkState, ACPI_PARSE_OBJECT *Op, UINT16 Opcode, - ACPI_OPERAND_OBJECT **ObjDesc) + ACPI_OPERAND_OBJECT **RetObjDesc) { ACPI_STATUS Status; ACPI_PARSE_OBJECT *Arg; ACPI_PARSE2_OBJECT *ByteList; ACPI_OPERAND_OBJECT *ArgDesc; - ACPI_OPCODE_INFO *OpInfo; + const ACPI_OPCODE_INFO *OpInfo; + ACPI_OPERAND_OBJECT *ObjDesc; PROC_NAME ("DsInitObjectFromOp"); + ObjDesc = *RetObjDesc; OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (ACPI_GET_OP_TYPE (OpInfo) != ACPI_OP_TYPE_OPCODE) + if (OpInfo->Class == AML_CLASS_UNKNOWN) { /* Unknown opcode */ @@ -349,10 +348,12 @@ AcpiDsInitObjectFromOp ( /* Get and prepare the first argument */ - switch ((*ObjDesc)->Common.Type) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: + ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0]; + /* First arg is a number */ AcpiDsCreateOperand (WalkState, Op->Value.Arg, 0); @@ -372,8 +373,8 @@ AcpiDsInitObjectFromOp ( if (ArgDesc->Common.Type != ACPI_TYPE_INTEGER) { - DEBUG_PRINTP (ACPI_ERROR, - ("Expecting number, got obj: %p type %X\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + "Expecting number, got obj: %p type %X\n", ArgDesc, ArgDesc->Common.Type)); AcpiUtRemoveReference (ArgDesc); return (AE_TYPE); @@ -381,49 +382,47 @@ AcpiDsInitObjectFromOp ( /* Get the value, delete the internal object */ - (*ObjDesc)->Buffer.Length = (UINT32) ArgDesc->Integer.Value; + ObjDesc->Buffer.Length = (UINT32) ArgDesc->Integer.Value; AcpiUtRemoveReference (ArgDesc); /* Allocate the buffer */ - if ((*ObjDesc)->Buffer.Length == 0) + if (ObjDesc->Buffer.Length == 0) { - (*ObjDesc)->Buffer.Pointer = NULL; + ObjDesc->Buffer.Pointer = NULL; REPORT_WARNING (("Buffer created with zero length in AML\n")); break; } else { - (*ObjDesc)->Buffer.Pointer = ACPI_MEM_CALLOCATE ( - (*ObjDesc)->Buffer.Length); + ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE ( + ObjDesc->Buffer.Length); - if (!(*ObjDesc)->Buffer.Pointer) + if (!ObjDesc->Buffer.Pointer) { return (AE_NO_MEMORY); } } /* - * Second arg is the buffer data (optional) - * ByteList can be either individual bytes or a - * string initializer! + * Second arg is the buffer data (optional) ByteList can be either + * individual bytes or a string initializer. */ + Arg = Op->Value.Arg; /* skip first arg */ - /* skip first arg */ - Arg = Op->Value.Arg; ByteList = (ACPI_PARSE2_OBJECT *) Arg->Next; if (ByteList) { if (ByteList->Opcode != AML_INT_BYTELIST_OP) { - DEBUG_PRINTP (ACPI_ERROR, ("Expecting bytelist, got: %x\n", + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Expecting bytelist, got: %p\n", ByteList)); return (AE_TYPE); } - MEMCPY ((*ObjDesc)->Buffer.Pointer, ByteList->Data, - (*ObjDesc)->Buffer.Length); + MEMCPY (ObjDesc->Buffer.Pointer, ByteList->Data, + ObjDesc->Buffer.Length); } break; @@ -432,26 +431,30 @@ AcpiDsInitObjectFromOp ( case ACPI_TYPE_PACKAGE: /* - * When called, an internal package object has already - * been built and is pointed to by *ObjDesc. - * AcpiDsBuildInternalObject build another internal - * package object, so remove reference to the original - * so that it is deleted. Error checking is done - * within the remove reference function. + * When called, an internal package object has already been built and + * is pointed to by ObjDesc. AcpiDsBuildInternalObject builds another + * internal package object, so remove reference to the original so + * that it is deleted. Error checking is done within the remove + * reference function. */ - AcpiUtRemoveReference(*ObjDesc); - - Status = AcpiDsBuildInternalObject (WalkState, Op, ObjDesc); + AcpiUtRemoveReference (ObjDesc); + Status = AcpiDsBuildInternalObject (WalkState, Op, RetObjDesc); break; case ACPI_TYPE_INTEGER: - (*ObjDesc)->Integer.Value = Op->Value.Integer; + ObjDesc->Integer.Value = Op->Value.Integer; break; case ACPI_TYPE_STRING: - (*ObjDesc)->String.Pointer = Op->Value.String; - (*ObjDesc)->String.Length = STRLEN (Op->Value.String); + ObjDesc->String.Pointer = Op->Value.String; + ObjDesc->String.Length = STRLEN (Op->Value.String); + + /* + * The string is contained in the ACPI table, don't ever try + * to delete it + */ + ObjDesc->Common.Flags |= AOPOBJ_STATIC_POINTER; break; @@ -461,34 +464,36 @@ AcpiDsInitObjectFromOp ( case INTERNAL_TYPE_REFERENCE: - switch (ACPI_GET_OP_CLASS (OpInfo)) + switch (OpInfo->Type) { - case OPTYPE_LOCAL_VARIABLE: + case AML_TYPE_LOCAL_VARIABLE: /* Split the opcode into a base opcode + offset */ - (*ObjDesc)->Reference.Opcode = AML_LOCAL_OP; - (*ObjDesc)->Reference.Offset = Opcode - AML_LOCAL_OP; + ObjDesc->Reference.Opcode = AML_LOCAL_OP; + ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP; break; - case OPTYPE_METHOD_ARGUMENT: + + case AML_TYPE_METHOD_ARGUMENT: /* Split the opcode into a base opcode + offset */ - (*ObjDesc)->Reference.Opcode = AML_ARG_OP; - (*ObjDesc)->Reference.Offset = Opcode - AML_ARG_OP; + ObjDesc->Reference.Opcode = AML_ARG_OP; + ObjDesc->Reference.Offset = Opcode - AML_ARG_OP; break; + default: /* Constants, Literals, etc.. */ if (Op->Opcode == AML_INT_NAMEPATH_OP) { /* Node was saved in Op */ - (*ObjDesc)->Reference.Node = Op->Node; + ObjDesc->Reference.Node = Op->Node; } - (*ObjDesc)->Reference.Opcode = Opcode; + ObjDesc->Reference.Opcode = Opcode; break; } @@ -497,8 +502,8 @@ AcpiDsInitObjectFromOp ( default: - DEBUG_PRINTP (ACPI_ERROR, ("Unimplemented data type: %x\n", - (*ObjDesc)->Common.Type)); + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %x\n", + ObjDesc->Common.Type)); break; } @@ -528,9 +533,7 @@ AcpiDsBuildInternalSimpleObj ( ACPI_OPERAND_OBJECT **ObjDescPtr) { ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_OBJECT_TYPE8 Type; ACPI_STATUS Status; - UINT32 Length; char *Name; @@ -540,26 +543,23 @@ AcpiDsBuildInternalSimpleObj ( if (Op->Opcode == AML_INT_NAMEPATH_OP) { /* - * This is an object reference. If The name was - * previously looked up in the NS, it is stored in this op. + * This is an object reference. If this name was + * previously looked up in the namespace, it was stored in this op. * Otherwise, go ahead and look it up now */ - if (!Op->Node) { - Status = AcpiNsLookup (WalkState->ScopeInfo, - Op->Value.String, ACPI_TYPE_ANY, - IMODE_EXECUTE, - NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, - NULL, - (ACPI_NAMESPACE_NODE **)&(Op->Node)); + Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Value.String, + ACPI_TYPE_ANY, IMODE_EXECUTE, + NS_SEARCH_PARENT | NS_DONT_OPEN_SCOPE, NULL, + (ACPI_NAMESPACE_NODE **) &(Op->Node)); if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) { Name = NULL; - AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, &Length, &Name); + AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Value.String, NULL, &Name); if (Name) { @@ -583,24 +583,11 @@ AcpiDsBuildInternalSimpleObj ( } } } - - /* - * The reference will be a Reference - * TBD: [Restructure] unless we really need a separate - * type of INTERNAL_TYPE_REFERENCE change - * AcpiDsMapOpcodeToDataType to handle this case - */ - Type = INTERNAL_TYPE_REFERENCE; } - else - { - Type = AcpiDsMapOpcodeToDataType (Op->Opcode, NULL); - } - /* Create and init the internal ACPI object */ - ObjDesc = AcpiUtCreateInternalObject (Type); + ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Opcode))->ObjectType); if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -648,22 +635,30 @@ AcpiDsBuildInternalPackageObj ( ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + *ObjDescPtr = ObjDesc; if (!ObjDesc) { return_ACPI_STATUS (AE_NO_MEMORY); } + if (Op->Opcode == AML_VAR_PACKAGE_OP) + { + /* + * Variable length package parameters are evaluated JIT + */ + return_ACPI_STATUS (AE_OK); + } + /* The first argument must be the package length */ Arg = Op->Value.Arg; - ObjDesc->Package.Count = Arg->Value.Integer; + ObjDesc->Package.Count = Arg->Value.Integer32; /* * Allocate the array of pointers (ptrs to the * individual objects) Add an extra pointer slot so * that the list is always null terminated. */ - ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE ( (ObjDesc->Package.Count + 1) * sizeof (void *)); @@ -678,7 +673,6 @@ AcpiDsBuildInternalPackageObj ( /* * Now init the elements of the package */ - Arg = Arg->Next; while (Arg) { @@ -698,7 +692,7 @@ AcpiDsBuildInternalPackageObj ( Arg = Arg->Next; } - *ObjDescPtr = ObjDesc; + ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; return_ACPI_STATUS (Status); } @@ -726,14 +720,19 @@ AcpiDsBuildInternalObject ( ACPI_STATUS Status; - if (Op->Opcode == AML_PACKAGE_OP) + switch (Op->Opcode) { - Status = AcpiDsBuildInternalPackageObj (WalkState, Op, ObjDescPtr); - } + case AML_PACKAGE_OP: + case AML_VAR_PACKAGE_OP: + + Status = AcpiDsBuildInternalPackageObj (WalkState, Op, ObjDescPtr); + break; + + + default: - else - { Status = AcpiDsBuildInternalSimpleObj (WalkState, Op, ObjDescPtr); + break; } return (Status); @@ -766,6 +765,16 @@ AcpiDsCreateNode ( FUNCTION_TRACE_PTR ("DsCreateNode", Op); + /* + * 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 + */ + if (AcpiNsGetAttachedObject (Node)) + { + return_ACPI_STATUS (AE_OK); + } + if (!Op->Value.Arg) { /* No arguments, there is nothing to do */ @@ -773,7 +782,6 @@ AcpiDsCreateNode ( return_ACPI_STATUS (AE_OK); } - /* Build an internal object for the argument(s) */ Status = AcpiDsBuildInternalObject (WalkState, Op->Value.Arg, &ObjDesc); @@ -782,26 +790,17 @@ AcpiDsCreateNode ( return_ACPI_STATUS (Status); } - /* Re-type the object according to it's argument */ Node->Type = ObjDesc->Common.Type; /* Init obj */ - Status = AcpiNsAttachObject (Node, ObjDesc, (UINT8) Node->Type); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } + Status = AcpiNsAttachObject (Node, ObjDesc, Node->Type); - return_ACPI_STATUS (Status); - - -Cleanup: + /* Remove local reference to the object */ AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); }