diff options
author | msmith <msmith@FreeBSD.org> | 2001-09-07 02:52:26 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-09-07 02:52:26 +0000 |
commit | 900b040f00a2adc34fc7fdec51ad41a720194fae (patch) | |
tree | 3c9aa7f7cd097313ccae0e6609730049de8a40b8 /sys | |
parent | ac2b9c4fdccfbd85bd2a6d11e7101a2a85b7f5aa (diff) | |
download | FreeBSD-src-900b040f00a2adc34fc7fdec51ad41a720194fae.zip FreeBSD-src-900b040f00a2adc34fc7fdec51ad41a720194fae.tar.gz |
Merge our local branch changes with the 20010831 snapshot.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/contrib/dev/acpica/acconfig.h | 4 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/acgcc.h | 4 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/exfldio.c | 94 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/psparse.c | 211 |
4 files changed, 140 insertions, 173 deletions
diff --git a/sys/contrib/dev/acpica/acconfig.h b/sys/contrib/dev/acpica/acconfig.h index 08ce675..446b21b 100644 --- a/sys/contrib/dev/acpica/acconfig.h +++ b/sys/contrib/dev/acpica/acconfig.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acconfig.h - Global configuration constants - * $Revision: 68 $ + * $Revision: 69 $ * *****************************************************************************/ @@ -144,7 +144,7 @@ /* Version string */ -#define ACPI_CA_VERSION 0x20010816 +#define ACPI_CA_VERSION 0x20010831 /* Maximum objects in the various object caches */ diff --git a/sys/contrib/dev/acpica/acgcc.h b/sys/contrib/dev/acpica/acgcc.h index ce7fac5..659e52f 100644 --- a/sys/contrib/dev/acpica/acgcc.h +++ b/sys/contrib/dev/acpica/acgcc.h @@ -1,7 +1,7 @@ /****************************************************************************** * * Name: acgcc.h - GCC specific defines, etc. - * $Revision: 6 $ + * $Revision: 9 $ * *****************************************************************************/ @@ -193,7 +193,7 @@ #define enable() __sti() #define halt() __asm__ __volatile__ ("sti; hlt":::"memory") #ifndef __FreeBSD__ /* XXX conflicts with inline in cpufunc.h */ -#define wbinvd() +#define wbinvd() __asm__ __volatile__ ("wbinvd":::"memory") #endif /*! [Begin] no source code translation diff --git a/sys/contrib/dev/acpica/exfldio.c b/sys/contrib/dev/acpica/exfldio.c index 5e21ea1..feca92c 100644 --- a/sys/contrib/dev/acpica/exfldio.c +++ b/sys/contrib/dev/acpica/exfldio.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 62 $ + * $Revision: 64 $ * *****************************************************************************/ @@ -155,6 +155,7 @@ AcpiExSetupField ( FUNCTION_TRACE_U32 ("ExSetupField", FieldDatumByteOffset); + RgnDesc = ObjDesc->CommonField.RegionObj; if (ACPI_TYPE_REGION != RgnDesc->Common.Type) @@ -191,7 +192,7 @@ AcpiExSetupField ( { if (RgnDesc->Region.Length < ObjDesc->CommonField.AccessByteWidth) { - /* + /* * This is the case where the AccessType (AccWord, etc.) is wider * than the region itself. For example, a region of length one * byte, and a field with Dword access specified. @@ -207,7 +208,7 @@ AcpiExSetupField ( */ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Field base+offset+width %X+%X+%X exceeds region size (%X bytes) field=%p region=%p\n", - ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, + ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth, RgnDesc->Region.Length, ObjDesc, RgnDesc)); @@ -349,10 +350,10 @@ AcpiExReadFieldDatum ( * * PARAMETERS: MergedDatum - Value to store * Buffer - Receiving buffer - * ByteGranularity - 1/2/4 Granularity of the field + * ByteGranularity - 1/2/4 Granularity of the field * (aka Datum Size) * Offset - Datum offset into the buffer - * + * * RETURN: none * * DESCRIPTION: Store the merged datum to the buffer according to the @@ -368,6 +369,9 @@ AcpiExGetBufferDatum( UINT32 Offset) { + FUNCTION_ENTRY (); + + switch (ByteGranularity) { case ACPI_FIELD_BYTE_GRANULARITY: @@ -387,14 +391,14 @@ AcpiExGetBufferDatum( /******************************************************************************* * - * FUNCTION: AcpiExSetBufferDatum + * FUNCTION: AcpiExSetBufferDatum * * PARAMETERS: MergedDatum - Value to store * Buffer - Receiving buffer - * ByteGranularity - 1/2/4 Granularity of the field + * ByteGranularity - 1/2/4 Granularity of the field * (aka Datum Size) * Offset - Datum offset into the buffer - * + * * RETURN: none * * DESCRIPTION: Store the merged datum to the buffer according to the @@ -410,6 +414,9 @@ AcpiExSetBufferDatum ( UINT32 Offset) { + FUNCTION_ENTRY (); + + switch (ByteGranularity) { case ACPI_FIELD_BYTE_GRANULARITY: @@ -477,7 +484,7 @@ AcpiExExtractFromField ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n", - ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth, + ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth, ObjDesc->CommonField.AccessByteWidth)); @@ -518,7 +525,7 @@ AcpiExExtractFromField ( /* Store the datum to the caller buffer */ - AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, + AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, DatumOffset); return_ACPI_STATUS (AE_OK); @@ -567,28 +574,28 @@ AcpiExExtractFromField ( else { /* - * Put together the appropriate bits of the two raw data to make a + * Put together the appropriate bits of the two raw data to make a * single complete field datum * - * 1) Normalize the first datum down to bit 0 + * 1) Normalize the first datum down to bit 0 */ MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset); /* 2) Insert the second datum "above" the first datum */ MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits); - + if ((DatumOffset >= (DatumCount -1))) { /* * This is the last iteration of the loop. We need to clear - * any unused bits (bits that are not part of this field) that - * came from the last raw datum before we store the final + * any unused bits (bits that are not part of this field) that + * came from the last raw datum before we store the final * merged datum into the caller buffer. */ if (ObjDesc->CommonField.EndBufferValidBits) { - MergedDatum &= + MergedDatum &= MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits); } } @@ -599,11 +606,11 @@ AcpiExExtractFromField ( * Store the merged field datum in the caller's buffer, according to * the granularity of the field (size of each datum). */ - AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, + AcpiExSetBufferDatum (MergedDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, DatumOffset); /* - * Save the raw datum that was just acquired since it may contain bits + * Save the raw datum that was just acquired since it may contain bits * of the *next* field datum. Update offsets */ PreviousRawDatum = ThisRawDatum; @@ -642,7 +649,6 @@ AcpiExWriteFieldDatum ( FUNCTION_TRACE_U32 ("ExWriteFieldDatum", FieldDatumByteOffset); - /* * BufferFields - Read from a Buffer * Other Fields - Read from a Operation Region. @@ -683,11 +689,11 @@ AcpiExWriteFieldDatum ( * 3) The current offset into the field */ RgnDesc = ObjDesc->CommonField.RegionObj; - Address = RgnDesc->Region.Address + + Address = RgnDesc->Region.Address + ObjDesc->CommonField.BaseByteOffset + FieldDatumByteOffset; - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Store %X in Region %s(%X) at %8.8lX%8.8lX width %X\n", Value, AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId, HIDWORD(Address), LODWORD(Address), @@ -700,7 +706,7 @@ AcpiExWriteFieldDatum ( if (Status == AE_NOT_IMPLEMENTED) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "**** Region type %s(%X) not implemented\n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); @@ -708,7 +714,7 @@ AcpiExWriteFieldDatum ( else if (Status == AE_NOT_EXIST) { - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, + ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "**** Region type %s(%X) does not have a handler\n", AcpiUtGetRegionName (RgnDesc->Region.SpaceId), RgnDesc->Region.SpaceId)); @@ -775,18 +781,18 @@ AcpiExWriteFieldDatumWithUpdateRule ( case UPDATE_PRESERVE: - /* - * Check if update rule needs to be applied (not if mask is all - * ones) The left shift drops the bits we want to ignore. + /* + * Check if update rule needs to be applied (not if mask is all + * ones) The left shift drops the bits we want to ignore. */ - if ((~Mask << (sizeof (Mask) * 8 - + if ((~Mask << (sizeof (Mask) * 8 - ObjDesc->CommonField.AccessBitWidth)) != 0) { /* * Read the current contents of the byte/word/dword containing * the field, and merge with the new field value. */ - Status = AcpiExReadFieldDatum (ObjDesc, FieldDatumByteOffset, + Status = AcpiExReadFieldDatum (ObjDesc, FieldDatumByteOffset, &CurrentValue); MergedValue |= (CurrentValue & ~Mask); } @@ -821,7 +827,7 @@ AcpiExWriteFieldDatumWithUpdateRule ( /* Write the merged value */ - Status = AcpiExWriteFieldDatum (ObjDesc, FieldDatumByteOffset, + Status = AcpiExWriteFieldDatum (ObjDesc, FieldDatumByteOffset, MergedValue); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Mask %X DatumOffset %X Value %X, MergedValue %X\n", @@ -865,7 +871,7 @@ AcpiExInsertIntoField ( /* - * Incoming buffer must be at least as long as the field, we do not + * Incoming buffer must be at least as long as the field, we do not * allow "partial" field writes. We do not care if the buffer is * larger than the field, this typically happens when an integer is * written to a field that is actually smaller than an integer. @@ -887,7 +893,7 @@ AcpiExInsertIntoField ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n", - ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth, + ByteFieldLength, DatumCount, ObjDesc->CommonField.AccessBitWidth, ObjDesc->CommonField.AccessByteWidth)); @@ -902,7 +908,7 @@ AcpiExInsertIntoField ( /* Get a single datum from the caller's buffer */ - AcpiExGetBufferDatum (&PreviousRawDatum, Buffer, + AcpiExGetBufferDatum (&PreviousRawDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, DatumOffset); /* @@ -956,8 +962,8 @@ AcpiExInsertIntoField ( * We don't need to worry about the update rule for these data, because * all of the bits in each datum are part of the field. * - * The last datum must be special cased because it might contain bits - * that are not part of the field -- therefore the "update rule" must be + * The last datum must be special cased because it might contain bits + * that are not part of the field -- therefore the "update rule" must be * applied in Part3 below. */ while (DatumOffset < DatumCount) @@ -965,11 +971,11 @@ AcpiExInsertIntoField ( DatumOffset++; FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth; - /* - * Get the next raw buffer datum. It may contain bits of the previous + /* + * Get the next raw buffer datum. It may contain bits of the previous * field datum */ - AcpiExGetBufferDatum (&ThisRawDatum, Buffer, + AcpiExGetBufferDatum (&ThisRawDatum, Buffer, ObjDesc->CommonField.AccessByteWidth, DatumOffset); /* Create the field datum based on the field alignment */ @@ -977,10 +983,10 @@ AcpiExInsertIntoField ( if (ObjDesc->CommonField.StartFieldBitOffset != 0) { /* - * Put together appropriate bits of the two raw buffer data to make + * Put together appropriate bits of the two raw buffer data to make * a single complete field datum */ - MergedDatum = + MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.DatumValidBits) | (ThisRawDatum << ObjDesc->CommonField.StartFieldBitOffset); } @@ -1001,8 +1007,8 @@ AcpiExInsertIntoField ( if ((DatumOffset == DatumCount) && ObjDesc->CommonField.EndFieldValidBits) { - /* - * Part3: + /* + * Part3: * This is the last datum and the field does not end on a datum boundary. * Build the partial datum and write with the update rule. */ @@ -1014,7 +1020,7 @@ AcpiExInsertIntoField ( /* Write the last datum with the update rule */ - Status = AcpiExWriteFieldDatumWithUpdateRule (ObjDesc, Mask, + Status = AcpiExWriteFieldDatumWithUpdateRule (ObjDesc, Mask, MergedDatum, FieldDatumByteOffset); if (ACPI_FAILURE (Status)) { @@ -1026,7 +1032,7 @@ AcpiExInsertIntoField ( { /* Normal case -- write the completed datum */ - Status = AcpiExWriteFieldDatum (ObjDesc, + Status = AcpiExWriteFieldDatum (ObjDesc, FieldDatumByteOffset, MergedDatum); if (ACPI_FAILURE (Status)) { @@ -1035,7 +1041,7 @@ AcpiExInsertIntoField ( } /* - * Save the most recent datum since it may contain bits of the *next* + * Save the most recent datum since it may contain bits of the *next* * field datum. Update current byte offset. */ PreviousRawDatum = ThisRawDatum; diff --git a/sys/contrib/dev/acpica/psparse.c b/sys/contrib/dev/acpica/psparse.c index 3d4e4b7..aa8fc06 100644 --- a/sys/contrib/dev/acpica/psparse.c +++ b/sys/contrib/dev/acpica/psparse.c @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: psparse - Parser top level AML parse routines - * $Revision: 89 $ + * $Revision: 96 $ * *****************************************************************************/ @@ -142,13 +142,13 @@ extern UINT32 AcpiGbl_ScopeDepth; /******************************************************************************* * - * FUNCTION: AcpiPsPeekOpcode + * FUNCTION: AcpiPsGetOpcodeSize * - * PARAMETERS: None + * PARAMETERS: Opcode - An AML opcode * - * RETURN: Status + * RETURN: Size of the opcode, in bytes (1 or 2) * - * DESCRIPTION: Get next AML opcode (without incrementing AML pointer) + * DESCRIPTION: Get the size of the current opcode. * ******************************************************************************/ @@ -210,7 +210,6 @@ AcpiPsPeekOpcode ( * * extended Opcode, !=, <=, or >= */ - if (Opcode == AML_EXTOP) { /* Extended opcode */ @@ -293,11 +292,13 @@ AcpiPsFindObject ( ACPI_PARSE_OBJECT **OutOp) { NATIVE_CHAR *Path; + const ACPI_OPCODE_INFO *OpInfo; /* We are only interested in opcodes that have an associated name */ - if (!AcpiPsIsNamedOp (Opcode)) + OpInfo = AcpiPsGetOpcodeInfo (Opcode); + if (!(OpInfo->Flags & AML_NAMED)) { *OutOp = Op; return (AE_OK); @@ -342,8 +343,8 @@ AcpiPsCompleteThisOp ( #ifndef PARSER_ONLY ACPI_PARSE_OBJECT *Prev; ACPI_PARSE_OBJECT *Next; - ACPI_OPCODE_INFO *OpInfo; - ACPI_OPCODE_INFO *ParentInfo; + const ACPI_OPCODE_INFO *OpInfo; + const ACPI_OPCODE_INFO *ParentInfo; UINT32 OpcodeClass; ACPI_PARSE_OBJECT *ReplacementOp = NULL; @@ -373,7 +374,6 @@ AcpiPsCompleteThisOp ( * Check if we need to replace the operator and its subtree * with a return value op (placeholder op) */ - ParentInfo = AcpiPsGetOpcodeInfo (Op->Parent->Opcode); switch (ACPI_GET_OP_CLASS (ParentInfo)) @@ -387,7 +387,6 @@ AcpiPsCompleteThisOp ( * These opcodes contain TermArg operands. The current * op must be replace by a placeholder return op */ - if ((Op->Parent->Opcode == AML_REGION_OP) || (Op->Parent->Opcode == AML_CREATE_FIELD_OP) || (Op->Parent->Opcode == AML_CREATE_BIT_FIELD_OP) || @@ -512,7 +511,6 @@ AcpiPsNextParseState ( * A control method was terminated via a RETURN statement. * The walk of this method is complete. */ - ParserState->Aml = ParserState->AmlEnd; Status = AE_CTRL_TERMINATE; break; @@ -520,13 +518,11 @@ AcpiPsNextParseState ( case AE_CTRL_PENDING: - /* - * Predicate of a WHILE was true and the loop just completed an - * execution. Go back to the start of the loop and reevaluate the - * predicate. - */ -/* WalkState->ControlState->Common.State = - CONTROL_PREDICATE_EXECUTING;*/ + /* + * Predicate of a WHILE was true and the loop just completed an + * execution. Go back to the start of the loop and reevaluate the + * predicate. + */ /* TBD: How to handle a break within a while. */ /* This code attempts it */ @@ -536,13 +532,13 @@ AcpiPsNextParseState ( case AE_CTRL_TRUE: - /* - * Predicate of an IF was true, and we are at the matching ELSE. - * Just close out this package - * - * Note: ParserState->Aml is modified by the package length procedure - * TBD: [Investigate] perhaps it shouldn't, too much trouble - */ + /* + * Predicate of an IF was true, and we are at the matching ELSE. + * Just close out this package + * + * Note: ParserState->Aml is modified by the package length procedure + * TBD: [Investigate] perhaps it shouldn't, too much trouble + */ Start = ParserState->Aml; PackageLength = AcpiPsGetNextPackageLength (ParserState); ParserState->Aml = Start + PackageLength; @@ -558,7 +554,6 @@ AcpiPsNextParseState ( * this branch of the tree) and continue execution at the parent * level. */ - ParserState->Aml = ParserState->Scope->ParseScope.PkgEnd; /* In the case of a BREAK, just force a predicate (if any) to FALSE */ @@ -593,7 +588,6 @@ AcpiPsNextParseState ( break; } - return_ACPI_STATUS (Status); } @@ -617,7 +611,7 @@ AcpiPsParseLoop ( { ACPI_STATUS Status = AE_OK; ACPI_PARSE_OBJECT *Op = NULL; /* current op */ - ACPI_OPCODE_INFO *OpInfo; + const ACPI_OPCODE_INFO *OpInfo; ACPI_PARSE_OBJECT *Arg = NULL; ACPI_PARSE2_OBJECT *DeferredOp; UINT32 ArgCount; /* push for fixed or var args */ @@ -657,7 +651,6 @@ AcpiPsParseLoop ( * A predicate was just completed, get the value of the * predicate and branch based on that value */ - Status = AcpiDsGetPredicateValue (WalkState, NULL, TRUE); if (ACPI_FAILURE (Status) && ((Status & AE_CODE_MASK) != AE_CODE_CONTROL)) @@ -710,7 +703,6 @@ AcpiPsParseLoop ( * 2) A name string * 3) An unknown/invalid opcode */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); switch (ACPI_GET_OP_TYPE (OpInfo)) { @@ -728,7 +720,6 @@ AcpiPsParseLoop ( * Starts with a valid prefix or ASCII char, this is a name * string. Convert the bare name string to a namepath. */ - Opcode = AML_INT_NAMEPATH_OP; ArgTypes = ARGP_NAMESTRING; break; @@ -752,7 +743,7 @@ AcpiPsParseLoop ( /* Create Op structure and append to parent's argument list */ - if (AcpiPsIsNamedOp (Opcode)) + if (OpInfo->Flags & AML_NAMED) { PreOp.Value.Arg = NULL; PreOp.Opcode = Opcode; @@ -801,25 +792,22 @@ AcpiPsParseLoop ( if (Op->Opcode == AML_REGION_OP) { - DeferredOp = AcpiPsToExtendedOp (Op); - if (DeferredOp) - { - /* - * Defer final parsing of an OperationRegion body, - * because we don't have enough info in the first pass - * to parse it correctly (i.e., there may be method - * calls within the TermArg elements of the body. - * - * However, we must continue parsing because - * the opregion is not a standalone package -- - * we don't know where the end is at this point. - * - * (Length is unknown until parse of the body complete) - */ - - DeferredOp->Data = AmlOpStart; - DeferredOp->Length = 0; - } + DeferredOp = (ACPI_PARSE2_OBJECT *) Op; + + /* + * Defer final parsing of an OperationRegion body, + * because we don't have enough info in the first pass + * to parse it correctly (i.e., there may be method + * calls within the TermArg elements of the body. + * + * However, we must continue parsing because + * the opregion is not a standalone package -- + * we don't know where the end is at this point. + * + * (Length is unknown until parse of the body complete) + */ + DeferredOp->Data = AmlOpStart; + DeferredOp->Length = 0; } } @@ -828,6 +816,7 @@ AcpiPsParseLoop ( { /* Not a named opcode, just allocate Op and append to parent */ + OpInfo = AcpiPsGetOpcodeInfo (Opcode); Op = AcpiPsAllocOp (Opcode); if (!Op) { @@ -835,13 +824,8 @@ AcpiPsParseLoop ( } - if ((Op->Opcode == AML_CREATE_FIELD_OP) || - (Op->Opcode == AML_CREATE_BIT_FIELD_OP) || - (Op->Opcode == AML_CREATE_BYTE_FIELD_OP) || - (Op->Opcode == AML_CREATE_WORD_FIELD_OP) || - (Op->Opcode == AML_CREATE_DWORD_FIELD_OP) || - (Op->Opcode == AML_CREATE_QWORD_FIELD_OP)) - { + if (OpInfo->Flags & AML_CREATE) + { /* * Backup to beginning of CreateXXXfield declaration * BodyLength is unknown until we parse the body @@ -940,27 +924,24 @@ AcpiPsParseLoop ( if (Op->Opcode == AML_METHOD_OP) { - DeferredOp = AcpiPsToExtendedOp (Op); - if (DeferredOp) - { - /* - * Skip parsing of control method or opregion body, - * because we don't have enough info in the first pass - * to parse them correctly. - */ - - DeferredOp->Data = ParserState->Aml; - DeferredOp->Length = (UINT32) (ParserState->PkgEnd - - ParserState->Aml); - - /* - * Skip body of method. For OpRegions, we must continue - * parsing because the opregion is not a standalone - * package (We don't know where the end is). - */ - ParserState->Aml = ParserState->PkgEnd; - ArgCount = 0; - } + DeferredOp = (ACPI_PARSE2_OBJECT *) Op; + + /* + * Skip parsing of control method or opregion body, + * because we don't have enough info in the first pass + * to parse them correctly. + */ + DeferredOp->Data = ParserState->Aml; + DeferredOp->Length = (UINT32) (ParserState->PkgEnd - + ParserState->Aml); + + /* + * Skip body of method. For OpRegions, we must continue + * parsing because the opregion is not a standalone + * package (We don't know where the end is). + */ + ParserState->Aml = ParserState->PkgEnd; + ArgCount = 0; } break; @@ -975,7 +956,8 @@ AcpiPsParseLoop ( { /* completed Op, prepare for next */ - if (AcpiPsIsNamedOp (Op->Opcode)) + OpInfo = AcpiPsGetOpcodeInfo (Op->Opcode); + if (OpInfo->Flags & AML_NAMED) { if (AcpiGbl_Depth) { @@ -984,30 +966,22 @@ AcpiPsParseLoop ( if (Op->Opcode == AML_REGION_OP) { - DeferredOp = AcpiPsToExtendedOp (Op); - if (DeferredOp) - { - /* - * Skip parsing of control method or opregion body, - * because we don't have enough info in the first pass - * to parse them correctly. - * - * Completed parsing an OpRegion declaration, we now - * know the length. - */ - - DeferredOp->Length = (UINT32) (ParserState->Aml - - DeferredOp->Data); - } + DeferredOp = (ACPI_PARSE2_OBJECT *) Op; + + /* + * Skip parsing of control method or opregion body, + * because we don't have enough info in the first pass + * to parse them correctly. + * + * Completed parsing an OpRegion declaration, we now + * know the length. + */ + DeferredOp->Length = (UINT32) (ParserState->Aml - + DeferredOp->Data); } } - if ((Op->Opcode == AML_CREATE_FIELD_OP) || - (Op->Opcode == AML_CREATE_BIT_FIELD_OP) || - (Op->Opcode == AML_CREATE_BYTE_FIELD_OP) || - (Op->Opcode == AML_CREATE_WORD_FIELD_OP) || - (Op->Opcode == AML_CREATE_DWORD_FIELD_OP) || - (Op->Opcode == AML_CREATE_QWORD_FIELD_OP)) + if (OpInfo->Flags & AML_CREATE) { /* * Backup to beginning of CreateXXXfield declaration (1 for @@ -1115,7 +1089,6 @@ CloseThisOp: break; } - /* This scope complete? */ if (AcpiPsHasCompletedScope (ParserState)) @@ -1151,7 +1124,6 @@ CloseThisOp: * of open scopes (such as when several AML blocks are closed with * sequential closing braces). We want to terminate each one cleanly. */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Package complete at Op %p\n", Op)); do { @@ -1213,6 +1185,7 @@ CloseThisOp: * Aml - Pointer to the raw AML code to parse * AmlSize - Length of the AML to parse * + * * RETURN: Status * * DESCRIPTION: Parse raw AML and return a tree of ops @@ -1235,7 +1208,6 @@ AcpiPsParseAml ( ACPI_PARSE_STATE *ParserState; ACPI_WALK_STATE *WalkState; ACPI_WALK_LIST WalkList; - ACPI_NAMESPACE_NODE *Node = NULL; ACPI_WALK_LIST *PrevWalkList = AcpiGbl_CurrentWalkList; ACPI_OPERAND_OBJECT *ReturnDesc; ACPI_OPERAND_OBJECT *EffectiveReturnDesc = NULL; @@ -1269,7 +1241,7 @@ AcpiPsParseAml ( WalkList.AcquiredMutexList.Prev = NULL; WalkList.AcquiredMutexList.Next = NULL; - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, ParserState->StartOp, + WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, ParserState->StartOp, MthDesc, &WalkList); if (!WalkState) { @@ -1311,15 +1283,13 @@ AcpiPsParseAml ( { /* Setup the current scope */ - Node = ParserState->StartOp->Node; - ParserState->StartNode = Node; - - if (Node) + ParserState->StartNode = ParserState->StartOp->Node; + if (ParserState->StartNode) { /* Push start scope on scope stack and make it current */ - Status = AcpiDsScopeStackPush (Node, Node->Type, - WalkState); + Status = AcpiDsScopeStackPush (ParserState->StartNode, + ParserState->StartNode->Type, WalkState); if (ACPI_FAILURE (Status)) { goto Cleanup; @@ -1328,16 +1298,13 @@ AcpiPsParseAml ( } } - - Status = AE_OK; - /* * Execute the walk loop as long as there is a valid Walk State. This * handles nested control method invocations without recursion. */ - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "State=%p\n", WalkState)); + Status = AE_OK; while (WalkState) { if (ACPI_SUCCESS (Status)) @@ -1345,7 +1312,7 @@ AcpiPsParseAml ( Status = AcpiPsParseLoop (WalkState); } - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Completed one call to walk loop, State=%p\n", WalkState)); if (Status == AE_CTRL_TRANSFER) @@ -1354,14 +1321,12 @@ AcpiPsParseAml ( * A method call was detected. * Transfer control to the called control method */ - Status = AcpiDsCallControlMethod (&WalkList, WalkState, NULL); /* * If the transfer to the new method method call worked, a new walk * state was created -- get it */ - WalkState = AcpiDsGetCurrentWalkState (&WalkList); continue; } @@ -1373,7 +1338,6 @@ AcpiPsParseAml ( /* We are done with this walk, move on to the parent if any */ - WalkState = AcpiDsPopWalkState (&WalkList); /* Extract return value before we delete WalkState */ @@ -1399,19 +1363,18 @@ AcpiPsParseAml ( * If we just returned from the execution of a control method, * there's lots of cleanup to do */ - if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) { AcpiDsTerminateControlMethod (WalkState); } - /* Delete this walk state and all linked control states */ + /* Delete this walk state and all linked control states */ AcpiPsCleanupScope (WalkState->ParserState); ACPI_MEM_FREE (WalkState->ParserState); AcpiDsDeleteWalkState (WalkState); - /* Check if we have restarted a preempted walk */ + /* Check if we have restarted a preempted walk */ WalkState = AcpiDsGetCurrentWalkState (&WalkList); if (WalkState && @@ -1423,7 +1386,6 @@ AcpiPsParseAml ( * If the method returned value is not used by the parent, * The object is deleted */ - AcpiDsRestartControlMethod (WalkState, ReturnDesc); WalkState->WalkType |= WALK_METHOD_RESTART; } @@ -1432,7 +1394,6 @@ AcpiPsParseAml ( * Just completed a 1st-level method, save the final internal return * value (if any) */ - else if (CallerReturnDesc) { /* |