diff options
Diffstat (limited to 'executer')
-rw-r--r-- | executer/exconfig.c | 309 | ||||
-rw-r--r-- | executer/exconvrt.c | 60 | ||||
-rw-r--r-- | executer/excreate.c | 137 | ||||
-rw-r--r-- | executer/exdump.c | 227 | ||||
-rw-r--r-- | executer/exfield.c | 65 | ||||
-rw-r--r-- | executer/exfldio.c | 92 | ||||
-rw-r--r-- | executer/exmisc.c | 40 | ||||
-rw-r--r-- | executer/exmutex.c | 45 | ||||
-rw-r--r-- | executer/exnames.c | 4 | ||||
-rw-r--r-- | executer/exoparg1.c | 61 | ||||
-rw-r--r-- | executer/exoparg2.c | 10 | ||||
-rw-r--r-- | executer/exoparg3.c | 8 | ||||
-rw-r--r-- | executer/exoparg6.c | 4 | ||||
-rw-r--r-- | executer/exprep.c | 17 | ||||
-rw-r--r-- | executer/exregion.c | 17 | ||||
-rw-r--r-- | executer/exresnte.c | 31 | ||||
-rw-r--r-- | executer/exresolv.c | 105 | ||||
-rw-r--r-- | executer/exresop.c | 72 | ||||
-rw-r--r-- | executer/exstore.c | 176 | ||||
-rw-r--r-- | executer/exstoren.c | 21 | ||||
-rw-r--r-- | executer/exstorob.c | 4 | ||||
-rw-r--r-- | executer/exsystem.c | 5 | ||||
-rw-r--r-- | executer/exutils.c | 7 |
23 files changed, 867 insertions, 650 deletions
diff --git a/executer/exconfig.c b/executer/exconfig.c index af2e2e6ffd46b..5b48bef4b4d76 100644 --- a/executer/exconfig.c +++ b/executer/exconfig.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes) - * $Revision: 1.103 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,12 +117,12 @@ #define __EXCONFIG_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" -#include "amlcode.h" #include "acnamesp.h" -#include "acevents.h" #include "actables.h" #include "acdispat.h" +#include "acevents.h" #define _COMPONENT ACPI_EXECUTER @@ -133,10 +132,16 @@ static ACPI_STATUS AcpiExAddTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle); +static ACPI_STATUS +AcpiExRegionRead ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 Length, + UINT8 *Buffer); + /******************************************************************************* * @@ -155,7 +160,7 @@ AcpiExAddTable ( static ACPI_STATUS AcpiExAddTable ( - ACPI_NATIVE_UINT TableIndex, + UINT32 TableIndex, ACPI_NAMESPACE_NODE *ParentNode, ACPI_OPERAND_OBJECT **DdbHandle) { @@ -176,12 +181,13 @@ AcpiExAddTable ( /* Init the table handle */ - ObjDesc->Reference.Opcode = AML_LOAD_OP; + ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID; + ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE; *DdbHandle = ObjDesc; /* Install the new table into the local data structures */ - ObjDesc->Reference.Object = ACPI_CAST_PTR (void, TableIndex); + ObjDesc->Reference.Value = TableIndex; /* Add the table to the namespace */ @@ -216,17 +222,26 @@ AcpiExLoadTableOp ( { ACPI_STATUS Status; ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_NATIVE_UINT TableIndex; ACPI_NAMESPACE_NODE *ParentNode; ACPI_NAMESPACE_NODE *StartNode; ACPI_NAMESPACE_NODE *ParameterNode = NULL; ACPI_OPERAND_OBJECT *DdbHandle; ACPI_TABLE_HEADER *Table; + UINT32 TableIndex; ACPI_FUNCTION_TRACE (ExLoadTableOp); + /* Validate lengths for the SignatureString, OEMIDString, OEMTableID */ + + if ((Operand[0]->String.Length > ACPI_NAME_SIZE) || + (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) || + (Operand[2]->String.Length > ACPI_OEM_TABLE_ID_SIZE)) + { + return_ACPI_STATUS (AE_BAD_PARAMETER); + } + /* Find the ACPI table in the RSDT/XSDT */ Status = AcpiTbFindTable (Operand[0]->String.Pointer, @@ -318,6 +333,8 @@ AcpiExLoadTableOp ( if (ACPI_FAILURE (Status)) { (void) AcpiExUnloadTable (DdbHandle); + + AcpiUtRemoveReference (DdbHandle); return_ACPI_STATUS (Status); } } @@ -326,10 +343,18 @@ AcpiExLoadTableOp ( if (ACPI_SUCCESS (Status)) { ACPI_INFO ((AE_INFO, - "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]", + "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]", Table->Signature, Table->OemId, Table->OemTableId)); } + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, Table, + AcpiGbl_TableHandlerContext); + } + *ReturnDesc = DdbHandle; return_ACPI_STATUS (Status); } @@ -337,6 +362,53 @@ AcpiExLoadTableOp ( /******************************************************************************* * + * FUNCTION: AcpiExRegionRead + * + * PARAMETERS: ObjDesc - Region descriptor + * Length - Number of bytes to read + * Buffer - Pointer to where to put the data + * + * RETURN: Status + * + * DESCRIPTION: Read data from an operation region. The read starts from the + * beginning of the region. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiExRegionRead ( + ACPI_OPERAND_OBJECT *ObjDesc, + UINT32 Length, + UINT8 *Buffer) +{ + ACPI_STATUS Status; + ACPI_INTEGER Value; + UINT32 RegionOffset = 0; + UINT32 i; + + + /* Bytewise reads */ + + for (i = 0; i < Length; i++) + { + Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ, + RegionOffset, 8, &Value); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + *Buffer = (UINT8) Value; + Buffer++; + RegionOffset++; + } + + return (AE_OK); +} + + +/******************************************************************************* + * * FUNCTION: AcpiExLoadOp * * PARAMETERS: ObjDesc - Region or Buffer/Field where the table will be @@ -363,23 +435,27 @@ AcpiExLoadOp ( ACPI_WALK_STATE *WalkState) { ACPI_OPERAND_OBJECT *DdbHandle; + ACPI_TABLE_HEADER *Table; ACPI_TABLE_DESC TableDesc; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; ACPI_STATUS Status; + UINT32 Length; ACPI_FUNCTION_TRACE (ExLoadOp); ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC)); - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; /* Source Object can be either an OpRegion or a Buffer/Field */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_REGION: + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Load table from Region %p\n", ObjDesc)); + /* Region must be SystemMemory (from ACPI spec) */ if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY) @@ -387,9 +463,6 @@ AcpiExLoadOp ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); - /* * If the Region Address and Length have not been previously evaluated, * evaluate them now and save the results. @@ -403,39 +476,145 @@ AcpiExLoadOp ( } } + /* Get the table header first so we can get the table length */ + + Table = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER)); + if (!Table) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER), + ACPI_CAST_PTR (UINT8, Table)); + Length = Table->Length; + ACPI_FREE (Table); + + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + /* Must have at least an ACPI table header */ + + if (Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } + + /* + * The original implementation simply mapped the table, with no copy. + * However, the memory region is not guaranteed to remain stable and + * we must copy the table to a local buffer. For example, the memory + * region is corrupted after suspend on some machines. Dynamically + * loaded tables are usually small, so this overhead is minimal. + * + * The latest implementation (5/2009) does not use a mapping at all. + * We use the low-level operation region interface to read the table + * instead of the obvious optimization of using a direct mapping. + * This maintains a consistent use of operation regions across the + * entire subsystem. This is important if additional processing must + * be performed in the (possibly user-installed) operation region + * handler. For example, AcpiExec and ASLTS depend on this. + */ + + /* Allocate a buffer for the table */ + + TableDesc.Pointer = ACPI_ALLOCATE (Length); + if (!TableDesc.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* Read the entire table */ + + Status = AcpiExRegionRead (ObjDesc, Length, + ACPI_CAST_PTR (UINT8, TableDesc.Pointer)); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (TableDesc.Pointer); + return_ACPI_STATUS (Status); + } + TableDesc.Address = ObjDesc->Region.Address; - TableDesc.Length = ObjDesc->Region.Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_MAPPED; break; + case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */ - /* Simply extract the buffer from the buffer object */ + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Load table from Buffer or Field %p\n", ObjDesc)); - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n", - ObjDesc, AcpiUtGetObjectTypeName (ObjDesc))); + /* Must have at least an ACPI table header */ + + if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } + + /* Get the actual table length from the table header */ + + Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer); + Length = Table->Length; + + /* Table cannot extend beyond the buffer */ + + if (Length > ObjDesc->Buffer.Length) + { + return_ACPI_STATUS (AE_AML_BUFFER_LIMIT); + } + if (Length < sizeof (ACPI_TABLE_HEADER)) + { + return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH); + } - TableDesc.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER, - ObjDesc->Buffer.Pointer); - TableDesc.Length = TableDesc.Pointer->Length; - TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + /* + * Copy the table from the buffer because the buffer could be modified + * or even deleted in the future + */ + TableDesc.Pointer = ACPI_ALLOCATE (Length); + if (!TableDesc.Pointer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } - ObjDesc->Buffer.Pointer = NULL; + ACPI_MEMCPY (TableDesc.Pointer, Table, Length); + TableDesc.Address = ACPI_TO_INTEGER (TableDesc.Pointer); break; + default: return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* - * Install the new table into the local data structures - */ + /* Validate table checksum (will not get validated in TbAddTable) */ + + Status = AcpiTbVerifyChecksum (TableDesc.Pointer, Length); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (TableDesc.Pointer); + return_ACPI_STATUS (Status); + } + + /* Complete the table descriptor */ + + TableDesc.Length = Length; + TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED; + + /* Install the new table into the local data structures */ + Status = AcpiTbAddTable (&TableDesc, &TableIndex); if (ACPI_FAILURE (Status)) { goto Cleanup; } + /* + * Add the table to the namespace. + * + * Note: Load the table objects relative to the root of the namespace. + * This appears to go against the ACPI specification, but we do it for + * compatibility with other ACPI implementations. + */ Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle); if (ACPI_FAILURE (Status)) { @@ -453,12 +632,27 @@ AcpiExLoadOp ( /* TablePtr was deallocated above */ + AcpiUtRemoveReference (DdbHandle); return_ACPI_STATUS (Status); } + /* Remove the reference by added by AcpiExStore above */ + + AcpiUtRemoveReference (DdbHandle); + + /* Invoke table handler if present */ + + if (AcpiGbl_TableHandler) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_LOAD, TableDesc.Pointer, + AcpiGbl_TableHandlerContext); + } + Cleanup: if (ACPI_FAILURE (Status)) { + /* Delete allocated table buffer */ + AcpiTbDeleteTable (&TableDesc); } return_ACPI_STATUS (Status); @@ -483,7 +677,8 @@ AcpiExUnloadTable ( { ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *TableDesc = DdbHandle; - ACPI_NATIVE_UINT TableIndex; + UINT32 TableIndex; + ACPI_TABLE_HEADER *Table; ACPI_FUNCTION_TRACE (ExUnloadTable); @@ -491,33 +686,61 @@ AcpiExUnloadTable ( /* * Validate the handle - * Although the handle is partially validated in AcpiExReconfiguration(), + * Although the handle is partially validated in AcpiExReconfiguration() * when it calls AcpiExResolveOperands(), the handle is more completely * validated here. + * + * Handle must be a valid operand object of type reference. Also, the + * DdbHandle must still be marked valid (table has not been previously + * unloaded) */ if ((!DdbHandle) || (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (DdbHandle) != ACPI_TYPE_LOCAL_REFERENCE)) + (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) || + (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID))) { return_ACPI_STATUS (AE_BAD_PARAMETER); } /* Get the table index from the DdbHandle */ - TableIndex = (ACPI_NATIVE_UINT) TableDesc->Reference.Object; + TableIndex = TableDesc->Reference.Value; - /* - * Delete the entire namespace under this table Node - * (Offset contains the TableId) - */ - AcpiTbDeleteNamespaceByOwner (TableIndex); - AcpiTbReleaseOwnerId (TableIndex); + /* Ensure the table is still loaded */ - AcpiTbSetTableLoadedFlag (TableIndex, FALSE); + if (!AcpiTbIsTableLoaded (TableIndex)) + { + return_ACPI_STATUS (AE_NOT_EXIST); + } - /* Delete the table descriptor (DdbHandle) */ + /* Invoke table handler if present */ - AcpiUtRemoveReference (TableDesc); - return_ACPI_STATUS (Status); + if (AcpiGbl_TableHandler) + { + Status = AcpiGetTableByIndex (TableIndex, &Table); + if (ACPI_SUCCESS (Status)) + { + (void) AcpiGbl_TableHandler (ACPI_TABLE_EVENT_UNLOAD, Table, + AcpiGbl_TableHandlerContext); + } + } + + /* Delete the portion of the namespace owned by this table */ + + Status = AcpiTbDeleteNamespaceByOwner (TableIndex); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + (void) AcpiTbReleaseOwnerId (TableIndex); + AcpiTbSetTableLoadedFlag (TableIndex, FALSE); + + /* + * Invalidate the handle. We do this because the handle may be stored + * in a named object and may not be actually deleted until much later. + */ + DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID; + return_ACPI_STATUS (AE_OK); } diff --git a/executer/exconvrt.c b/executer/exconvrt.c index a56b0db0b3953..e7d853032989e 100644 --- a/executer/exconvrt.c +++ b/executer/exconvrt.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exconvrt - Object conversion routines - * $Revision: 1.74 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXCONVRT_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" @@ -139,7 +139,7 @@ AcpiExConvertToAscii ( * * FUNCTION: AcpiExConvertToInteger * - * PARAMETERS: ObjDesc - Object to be converted. Must be an + * PARAMETERS: ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String * ResultDesc - Where the new Integer object is returned * Flags - Used for string conversion @@ -167,7 +167,7 @@ AcpiExConvertToInteger ( ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -190,7 +190,7 @@ AcpiExConvertToInteger ( } /* - * Convert the buffer/string to an integer. Note that both buffers and + * Convert the buffer/string to an integer. Note that both buffers and * strings are treated as raw data - we don't convert ascii to hex for * strings. * @@ -202,13 +202,13 @@ AcpiExConvertToInteger ( /* String conversion is different than Buffer conversion */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: /* * Convert string to an integer - for most cases, the string must be - * hexadecimal as per the ACPI specification. The only exception (as + * hexadecimal as per the ACPI specification. The only exception (as * of ACPI 3.0) is that the ToInteger() operator allows both decimal * and hexadecimal strings (hex prefixed with "0x"). */ @@ -253,6 +253,7 @@ AcpiExConvertToInteger ( default: + /* No other types can get here */ break; } @@ -281,7 +282,7 @@ AcpiExConvertToInteger ( * * FUNCTION: AcpiExConvertToBuffer * - * PARAMETERS: ObjDesc - Object to be converted. Must be an + * PARAMETERS: ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String * ResultDesc - Where the new buffer object is returned * @@ -303,7 +304,7 @@ AcpiExConvertToBuffer ( ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: @@ -395,11 +396,11 @@ AcpiExConvertToAscii ( UINT8 DataWidth) { ACPI_INTEGER Digit; - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; - ACPI_NATIVE_UINT k = 0; - ACPI_NATIVE_UINT HexLength; - ACPI_NATIVE_UINT DecimalLength; + UINT32 i; + UINT32 j; + UINT32 k = 0; + UINT32 HexLength; + UINT32 DecimalLength; UINT32 Remainder; BOOLEAN SupressZeros; @@ -461,7 +462,7 @@ AcpiExConvertToAscii ( /* HexLength: 2 ascii hex chars per data byte */ - HexLength = (ACPI_NATIVE_UINT) ACPI_MUL_2 (DataWidth); + HexLength = ACPI_MUL_2 (DataWidth); for (i = 0, j = (HexLength-1); i < HexLength; i++, j--) { /* Get one hex digit, most significant digits first */ @@ -476,7 +477,7 @@ AcpiExConvertToAscii ( } /* - * Since leading zeros are supressed, we must check for the case where + * Since leading zeros are suppressed, we must check for the case where * the integer equals 0 * * Finally, null terminate the string and return the length @@ -496,7 +497,7 @@ AcpiExConvertToAscii ( * * FUNCTION: AcpiExConvertToString * - * PARAMETERS: ObjDesc - Object to be converted. Must be an + * PARAMETERS: ObjDesc - Object to be converted. Must be an * Integer, Buffer, or String * ResultDesc - Where the string object is returned * Type - String flags (base and conversion type) @@ -524,7 +525,7 @@ AcpiExConvertToString ( ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc); - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: @@ -592,7 +593,7 @@ AcpiExConvertToString ( Base = 10; /* - * Calculate the final string length. Individual string values + * Calculate the final string length. Individual string values * are variable length (include separator for each) */ for (i = 0; i < ObjDesc->Buffer.Length; i++) @@ -637,8 +638,14 @@ AcpiExConvertToString ( /* * Create a new string object and string buffer * (-1 because of extra separator included in StringLength from above) + * Allow creation of zero-length strings from zero-length buffers. */ - ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1)); + if (StringLength) + { + StringLength--; + } + + ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength); if (!ReturnDesc) { return_ACPI_STATUS (AE_NO_MEMORY); @@ -662,7 +669,10 @@ AcpiExConvertToString ( * Null terminate the string * (overwrites final comma/space from above) */ - NewBuf--; + if (ObjDesc->Buffer.Length) + { + NewBuf--; + } *NewBuf = 0; break; @@ -728,7 +738,7 @@ AcpiExConvertToTargetType ( default: /* No conversion allowed for these types */ - if (DestinationType != ACPI_GET_OBJECT_TYPE (SourceDesc)) + if (DestinationType != SourceDesc->Common.Type) { ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Explicit operator, will store (%s) over existing type (%s)\n", @@ -749,7 +759,7 @@ AcpiExConvertToTargetType ( case ACPI_TYPE_LOCAL_BANK_FIELD: case ACPI_TYPE_LOCAL_INDEX_FIELD: /* - * These types require an Integer operand. We can convert + * These types require an Integer operand. We can convert * a Buffer or a String to an Integer if necessary. */ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, @@ -759,7 +769,7 @@ AcpiExConvertToTargetType ( case ACPI_TYPE_STRING: /* - * The operand must be a String. We can convert an + * The operand must be a String. We can convert an * Integer or Buffer if necessary */ Status = AcpiExConvertToString (SourceDesc, ResultDesc, @@ -769,7 +779,7 @@ AcpiExConvertToTargetType ( case ACPI_TYPE_BUFFER: /* - * The operand must be a Buffer. We can convert an + * The operand must be a Buffer. We can convert an * Integer or String if necessary */ Status = AcpiExConvertToBuffer (SourceDesc, ResultDesc); diff --git a/executer/excreate.c b/executer/excreate.c index 5fed416a36dca..e5463187a8655 100644 --- a/executer/excreate.c +++ b/executer/excreate.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: excreate - Named object creation - * $Revision: 1.114 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,11 +117,10 @@ #define __EXCREATE_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "acevents.h" -#include "actables.h" #define _COMPONENT ACPI_EXECUTER @@ -180,16 +178,28 @@ AcpiExCreateAlias ( */ switch (TargetNode->Type) { + + /* For these types, the sub-object can change dynamically via a Store */ + case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: case ACPI_TYPE_PACKAGE: case ACPI_TYPE_BUFFER_FIELD: + /* + * These types open a new scope, so we need the NS node in order to access + * any children. + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_THERMAL: + case ACPI_TYPE_LOCAL_SCOPE: + /* * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * NS node, not the object itself. */ AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -198,9 +208,7 @@ AcpiExCreateAlias ( case ACPI_TYPE_METHOD: /* - * The new alias has the type ALIAS and points to the original - * NS node, not the object itself. This is because for these - * types, the object can change dynamically via a Store. + * Control method aliases need to be differentiated */ AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS; AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode); @@ -441,115 +449,6 @@ Cleanup: /******************************************************************************* * - * FUNCTION: AcpiExCreateTableRegion - * - * PARAMETERS: WalkState - Current state - * - * RETURN: Status - * - * DESCRIPTION: Create a new DataTableRegion object - * - ******************************************************************************/ - -ACPI_STATUS -AcpiExCreateTableRegion ( - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status; - ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0]; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *RegionObj2; - ACPI_NATIVE_UINT TableIndex; - ACPI_TABLE_HEADER *Table; - - - ACPI_FUNCTION_TRACE (ExCreateTableRegion); - - - /* Get the Node from the object stack */ - - Node = WalkState->Op->Common.Node; - - /* - * If the region object is already attached to this node, - * just return - */ - if (AcpiNsGetAttachedObject (Node)) - { - return_ACPI_STATUS (AE_OK); - } - - /* Find the ACPI table */ - - Status = AcpiTbFindTable (Operand[1]->String.Pointer, - Operand[2]->String.Pointer, Operand[3]->String.Pointer, - &TableIndex); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Create the region descriptor */ - - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); - if (!ObjDesc) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - RegionObj2 = ObjDesc->Common.NextObject; - RegionObj2->Extra.RegionContext = NULL; - - Status = AcpiGetTableByIndex (TableIndex, &Table); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Init the region from the operands */ - - ObjDesc->Region.SpaceId = REGION_DATA_TABLE; - ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table); - ObjDesc->Region.Length = Table->Length; - ObjDesc->Region.Node = Node; - ObjDesc->Region.Flags = AOPOBJ_DATA_VALID; - - /* Install the new region object in the parent Node */ - - Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION); - if (ACPI_FAILURE (Status)) - { - goto Cleanup; - } - - Status = AcpiEvInitializeRegion (ObjDesc, FALSE); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_EXIST) - { - Status = AE_OK; - } - else - { - goto Cleanup; - } - } - - ObjDesc->Region.Flags |= AOPOBJ_SETUP_COMPLETE; - - -Cleanup: - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * * FUNCTION: AcpiExCreateProcessor * * PARAMETERS: WalkState - Current state @@ -715,7 +614,7 @@ AcpiExCreateMethod ( * ACPI 2.0: SyncLevel = SyncLevel in method declaration */ ObjDesc->Method.SyncLevel = (UINT8) - ((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4); + ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4); } /* Attach the new object to the method Node */ diff --git a/executer/exdump.c b/executer/exdump.c index 97002b5162228..5de5a6f6e4039 100644 --- a/executer/exdump.c +++ b/executer/exdump.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exdump - Interpreter debug output routines - * $Revision: 1.202 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -117,10 +116,11 @@ #define __EXDUMP_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "acparser.h" + #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exdump") @@ -213,10 +213,11 @@ static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"} }; -static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] = +static ACPI_EXDUMP_INFO AcpiExDumpMethod[9] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.MethodFlags), "Method Flags"}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "Parameter Count"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"}, @@ -305,12 +306,12 @@ static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"} }; - -static ACPI_EXDUMP_INFO AcpiExDumpReference[7] = +static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL}, + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.Class), "Class"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"}, - {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, @@ -345,7 +346,6 @@ static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] = {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"} }; - static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL}, @@ -449,6 +449,7 @@ AcpiExDumpObject ( break; case ACPI_EXD_TYPE: + AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc)); break; @@ -470,7 +471,7 @@ AcpiExDumpObject ( case ACPI_EXD_UINT64: AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value", - ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); + ACPI_FORMAT_UINT64 (ACPI_GET64 (Target))); break; case ACPI_EXD_POINTER: @@ -505,13 +506,15 @@ AcpiExDumpObject ( case ACPI_EXD_REFERENCE: - AcpiExOutString ("Opcode", - (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name); + AcpiExOutString ("Class Name", + ACPI_CAST_PTR (char, AcpiUtGetReferenceName (ObjDesc))); AcpiExDumpReferenceObj (ObjDesc); break; default: - AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode); + + AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", + Info->Opcode); return; } @@ -589,108 +592,79 @@ AcpiExDumpOperand ( /* Decode object type */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: - switch (ObjDesc->Reference.Opcode) + AcpiOsPrintf ("Reference: [%s] ", AcpiUtGetReferenceName (ObjDesc)); + + switch (ObjDesc->Reference.Class) { - case AML_DEBUG_OP: + case ACPI_REFCLASS_DEBUG: - AcpiOsPrintf ("Reference: Debug\n"); + AcpiOsPrintf ("\n"); break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: - AcpiOsPrintf ("Reference: Index %p\n", - ObjDesc->Reference.Object); + AcpiOsPrintf ("%p\n", ObjDesc->Reference.Object); break; - case AML_REF_OF_OP: + case ACPI_REFCLASS_TABLE: - AcpiOsPrintf ("Reference: (RefOf) %p\n", - ObjDesc->Reference.Object); + AcpiOsPrintf ("Table Index %X\n", ObjDesc->Reference.Value); break; - case AML_ARG_OP: - - AcpiOsPrintf ("Reference: Arg%d", - ObjDesc->Reference.Offset); - - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) - { - /* Value is an Integer */ - - AcpiOsPrintf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - } + case ACPI_REFCLASS_REFOF: - AcpiOsPrintf ("\n"); + AcpiOsPrintf ("%p [%s]\n", ObjDesc->Reference.Object, + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) + ObjDesc->Reference.Object)->Common.Type)); break; - case AML_LOCAL_OP: - - AcpiOsPrintf ("Reference: Local%d", - ObjDesc->Reference.Offset); - - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER) - { - - /* Value is an Integer */ + case ACPI_REFCLASS_NAME: - AcpiOsPrintf (" value is [%8.8X%8.8x]", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); - } - - AcpiOsPrintf ("\n"); + AcpiOsPrintf ("- [%4.4s]\n", ObjDesc->Reference.Node->Name.Ascii); break; - case AML_INT_NAMEPATH_OP: + case ACPI_REFCLASS_ARG: + case ACPI_REFCLASS_LOCAL: - AcpiOsPrintf ("Reference.Node->Name %X\n", - ObjDesc->Reference.Node->Name.Integer); + AcpiOsPrintf ("%X\n", ObjDesc->Reference.Value); break; - default: + default: /* Unknown reference class */ - /* Unknown opcode */ - - AcpiOsPrintf ("Unknown Reference opcode=%X\n", - ObjDesc->Reference.Opcode); + AcpiOsPrintf ("%2.2X\n", ObjDesc->Reference.Class); break; - } break; case ACPI_TYPE_BUFFER: - AcpiOsPrintf ("Buffer len %X @ %p\n", + AcpiOsPrintf ("Buffer length %.2X @ %p\n", ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer); - Length = ObjDesc->Buffer.Length; - if (Length > 64) - { - Length = 64; - } - /* Debug only -- dump the buffer contents */ if (ObjDesc->Buffer.Pointer) { - AcpiOsPrintf ("Buffer Contents: "); - - for (Index = 0; Index < Length; Index++) + Length = ObjDesc->Buffer.Length; + if (Length > 128) { - AcpiOsPrintf (" %02x", ObjDesc->Buffer.Pointer[Index]); + Length = 128; } - AcpiOsPrintf ("\n"); + + AcpiOsPrintf ("Buffer Contents: (displaying length 0x%.2X)\n", + Length); + ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, Length); } break; @@ -740,7 +714,7 @@ AcpiExDumpOperand ( else { AcpiOsPrintf (" base %8.8X%8.8X Length %X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Region.Address), + ACPI_FORMAT_NATIVE_UINT (ObjDesc->Region.Address), ObjDesc->Region.Length); } break; @@ -765,8 +739,8 @@ AcpiExDumpOperand ( case ACPI_TYPE_LOCAL_REGION_FIELD: - AcpiOsPrintf ( - "RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n", + AcpiOsPrintf ("RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at " + "byte=%X bit=%X of below:\n", ObjDesc->Field.BitLength, ObjDesc->Field.AccessByteWidth, ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK, @@ -786,8 +760,7 @@ AcpiExDumpOperand ( case ACPI_TYPE_BUFFER_FIELD: - AcpiOsPrintf ( - "BufferField: %X bits at byte %X bit %X of\n", + AcpiOsPrintf ("BufferField: %X bits at byte %X bit %X of\n", ObjDesc->BufferField.BitLength, ObjDesc->BufferField.BaseByteOffset, ObjDesc->BufferField.StartFieldBitOffset); @@ -796,7 +769,7 @@ AcpiExDumpOperand ( { ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n")); } - else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != + else if ((ObjDesc->BufferField.BufferObj)->Common.Type != ACPI_TYPE_BUFFER) { AcpiOsPrintf ("*not a Buffer*\n"); @@ -856,7 +829,7 @@ AcpiExDumpOperand ( default: /* Unknown Type */ - AcpiOsPrintf ("Unknown Type %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); + AcpiOsPrintf ("Unknown Type %X\n", ObjDesc->Common.Type); break; } @@ -868,63 +841,48 @@ AcpiExDumpOperand ( * * FUNCTION: AcpiExDumpOperands * - * PARAMETERS: Operands - Operand list - * InterpreterMode - Load or Exec - * Ident - Identification - * NumLevels - # of stack entries to dump above line - * Note - Output notation - * ModuleName - Caller's module name - * LineNumber - Caller's invocation line number + * PARAMETERS: Operands - A list of Operand objects + * OpcodeName - AML opcode name + * NumOperands - Operand count for this opcode * - * DESCRIPTION: Dump the object stack + * DESCRIPTION: Dump the operands associated with the opcode * ******************************************************************************/ void AcpiExDumpOperands ( ACPI_OPERAND_OBJECT **Operands, - ACPI_INTERPRETER_MODE InterpreterMode, - char *Ident, - UINT32 NumLevels, - char *Note, - char *ModuleName, - UINT32 LineNumber) + const char *OpcodeName, + UINT32 NumOperands) { - ACPI_NATIVE_UINT i; - - ACPI_FUNCTION_NAME (ExDumpOperands); - if (!Ident) + if (!OpcodeName) { - Ident = "?"; - } - - if (!Note) - { - Note = "?"; + OpcodeName = "UNKNOWN"; } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Operand Stack Contents (Opcode [%s], %d Operands)\n", - Ident, NumLevels)); + "**** Start operand dump for opcode [%s], %d operands\n", + OpcodeName, NumOperands)); - if (NumLevels == 0) + if (NumOperands == 0) { - NumLevels = 1; + NumOperands = 1; } - /* Dump the operand stack starting at the top */ + /* Dump the individual operands */ - for (i = 0; NumLevels > 0; i--, NumLevels--) + while (NumOperands) { - AcpiExDumpOperand (Operands[i], 0); + AcpiExDumpOperand (*Operands, 0); + Operands++; + NumOperands--; } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "************* Operand Stack dump from %s(%d), %s\n", - ModuleName, LineNumber, Note)); + "**** End operand dump for [%s]\n", OpcodeName)); return; } @@ -987,10 +945,10 @@ AcpiExDumpNamespaceNode ( } } - AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); - AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); - AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); - AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node)); + AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); + AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); + AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); + AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node)); AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), AcpiExDumpNode); @@ -1017,14 +975,14 @@ AcpiExDumpReferenceObj ( RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP) + if (ObjDesc->Reference.Class == ACPI_REFCLASS_NAME) { - AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node); + AcpiOsPrintf (" %p ", ObjDesc->Reference.Node); Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf ("Could not convert name to pathname\n"); + AcpiOsPrintf (" Could not convert name to pathname\n"); } else { @@ -1034,7 +992,24 @@ AcpiExDumpReferenceObj ( } else if (ObjDesc->Reference.Object) { - AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object); + if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) + { + AcpiOsPrintf (" Target: %p", ObjDesc->Reference.Object); + if (ObjDesc->Reference.Class == ACPI_REFCLASS_TABLE) + { + AcpiOsPrintf (" Table Index: %X\n", ObjDesc->Reference.Value); + } + else + { + AcpiOsPrintf (" Target: %p [%s]\n", ObjDesc->Reference.Object, + AcpiUtGetTypeName (((ACPI_OPERAND_OBJECT *) + ObjDesc->Reference.Object)->Common.Type)); + } + } + else + { + AcpiOsPrintf (" Target: %p\n", ObjDesc->Reference.Object); + } } } @@ -1084,12 +1059,12 @@ AcpiExDumpPackageObj ( /* Packages may only contain a few object types */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n", - ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); + ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value)); break; @@ -1110,7 +1085,7 @@ AcpiExDumpPackageObj ( if (ObjDesc->Buffer.Length) { AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer), - ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); + ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT); } else { @@ -1122,7 +1097,7 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_PACKAGE: AcpiOsPrintf ("[Package] Contains %d Elements:\n", - ObjDesc->Package.Count); + ObjDesc->Package.Count); for (i = 0; i < ObjDesc->Package.Count; i++) { @@ -1133,14 +1108,16 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] "); + AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X", + AcpiUtGetReferenceName (ObjDesc), + ObjDesc->Reference.Class); AcpiExDumpReferenceObj (ObjDesc); break; default: - AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc)); + AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Common.Type); break; } } diff --git a/executer/exfield.c b/executer/exfield.c index 75dc4f948f189..0065bb51840f4 100644 --- a/executer/exfield.c +++ b/executer/exfield.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exfield - ACPI AML (p-code) execution - field manipulation - * $Revision: 1.131 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXFIELD_C__ #include "acpi.h" +#include "accommon.h" #include "acdispat.h" #include "acinterp.h" @@ -167,7 +167,7 @@ AcpiExReadDataFromField ( return_ACPI_STATUS (AE_BAD_PARAMETER); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, @@ -182,7 +182,7 @@ AcpiExReadDataFromField ( } } } - else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) && + else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) { /* @@ -249,7 +249,7 @@ AcpiExReadDataFromField ( ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [TO]: Obj %p, Type %X, Buf %p, ByteLen %X\n", - ObjDesc, ACPI_GET_OBJECT_TYPE (ObjDesc), Buffer, (UINT32) Length)); + ObjDesc, ObjDesc->Common.Type, Buffer, (UINT32) Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldRead [FROM]: BitLen %X, BitOff %X, ByteOff %X\n", ObjDesc->CommonField.BitLength, @@ -302,9 +302,7 @@ AcpiExWriteDataToField ( { ACPI_STATUS Status; UINT32 Length; - UINT32 RequiredLength; void *Buffer; - void *NewBuffer; ACPI_OPERAND_OBJECT *BufferDesc; @@ -318,7 +316,7 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_NO_OPERAND); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * If the BufferField arguments have not been previously evaluated, @@ -333,7 +331,7 @@ AcpiExWriteDataToField ( } } } - else if ((ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REGION_FIELD) && + else if ((ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REGION_FIELD) && (ObjDesc->Field.RegionObj->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)) { /* @@ -342,7 +340,7 @@ AcpiExWriteDataToField ( * * Source must be a buffer of sufficient size (ACPI_SMBUS_BUFFER_SIZE). */ - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) + if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -389,7 +387,7 @@ AcpiExWriteDataToField ( /* Get a pointer to the data to be written */ - switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) + switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: Buffer = &SourceDesc->Integer.Value; @@ -410,45 +408,15 @@ AcpiExWriteDataToField ( return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } - /* - * We must have a buffer that is at least as long as the field - * we are writing to. This is because individual fields are - * indivisible and partial writes are not supported -- as per - * the ACPI specification. - */ - NewBuffer = NULL; - RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( - ObjDesc->CommonField.BitLength); - - if (Length < RequiredLength) - { - /* We need to create a new buffer */ - - NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); - if (!NewBuffer) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - /* - * Copy the original data to the new buffer, starting - * at Byte zero. All unused (upper) bytes of the - * buffer will be 0. - */ - ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, Length); - Buffer = NewBuffer; - Length = RequiredLength; - } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n", - SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)), - ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length)); + SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), + SourceDesc->Common.Type, Buffer, Length)); ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n", - ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)), - ACPI_GET_OBJECT_TYPE (ObjDesc), + ObjDesc, AcpiUtGetTypeName (ObjDesc->Common.Type), + ObjDesc->Common.Type, ObjDesc->CommonField.BitLength, ObjDesc->CommonField.StartFieldBitOffset, ObjDesc->CommonField.BaseByteOffset)); @@ -462,13 +430,6 @@ AcpiExWriteDataToField ( Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length); AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags); - /* Free temporary buffer if we used one */ - - if (NewBuffer) - { - ACPI_FREE (NewBuffer); - } - return_ACPI_STATUS (Status); } diff --git a/executer/exfldio.c b/executer/exfldio.c index f3e6144ee6d09..cfb02213aa9cb 100644 --- a/executer/exfldio.c +++ b/executer/exfldio.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exfldio - Aml Field I/O - * $Revision: 1.128 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXFLDIO_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" #include "acevents.h" @@ -179,10 +179,10 @@ AcpiExSetupRegion ( /* We must have a valid region */ - if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION) + if (RgnDesc->Common.Type != ACPI_TYPE_REGION) { ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)", - ACPI_GET_OBJECT_TYPE (RgnDesc), + RgnDesc->Common.Type, AcpiUtGetObjectTypeName (RgnDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -201,13 +201,6 @@ AcpiExSetupRegion ( } } - /* Exit if Address/Length have been disallowed by the host OS */ - - if (RgnDesc->Common.Flags & AOPOBJ_INVALID) - { - return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS); - } - /* * Exit now for SMBus address space, it has a non-linear address space * and the request cannot be directly validated @@ -248,13 +241,13 @@ AcpiExSetupRegion ( /* * Slack mode only: We will go ahead and allow access to this * field if it is within the region length rounded up to the next - * access width boundary. + * access width boundary. ACPI_SIZE cast for 64-bit compile. */ if (ACPI_ROUND_UP (RgnDesc->Region.Length, ObjDesc->CommonField.AccessByteWidth) >= - (ObjDesc->CommonField.BaseByteOffset + - (ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth + - FieldDatumByteOffset)) + ((ACPI_SIZE) ObjDesc->CommonField.BaseByteOffset + + ObjDesc->CommonField.AccessByteWidth + + FieldDatumByteOffset)) { return_ACPI_STATUS (AE_OK); } @@ -321,7 +314,7 @@ AcpiExAccessRegion ( { ACPI_STATUS Status; ACPI_OPERAND_OBJECT *RgnDesc; - ACPI_PHYSICAL_ADDRESS Address; + UINT32 RegionOffset; ACPI_FUNCTION_TRACE (ExAccessRegion); @@ -345,9 +338,9 @@ AcpiExAccessRegion ( * 3) The current offset into the field */ RgnDesc = ObjDesc->CommonField.RegionObj; - Address = RgnDesc->Region.Address + - ObjDesc->CommonField.BaseByteOffset + - FieldDatumByteOffset; + RegionOffset = + ObjDesc->CommonField.BaseByteOffset + + FieldDatumByteOffset; if ((Function & ACPI_IO_MASK) == ACPI_READ) { @@ -365,12 +358,11 @@ AcpiExAccessRegion ( ObjDesc->CommonField.AccessByteWidth, ObjDesc->CommonField.BaseByteOffset, FieldDatumByteOffset, - (void *) Address)); + ACPI_CAST_PTR (void, (RgnDesc->Region.Address + RegionOffset)))); /* Invoke the appropriate AddressSpace/OpRegion handler */ - Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, - Address, + Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function, RegionOffset, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value); if (ACPI_FAILURE (Status)) @@ -499,7 +491,7 @@ AcpiExFieldDatumIo ( * IndexField - Write to an Index Register, then read/write from/to a * Data Register */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER_FIELD: /* @@ -614,13 +606,13 @@ AcpiExFieldDatumIo ( return_ACPI_STATUS (Status); } - ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, - "I/O to Data Register: ValuePtr %p\n", Value)); - if (ReadWrite == ACPI_READ) { /* Read the datum from the DataRegister */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Read from Data Register\n")); + Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj, Value, sizeof (ACPI_INTEGER)); } @@ -628,6 +620,10 @@ AcpiExFieldDatumIo ( { /* Write the datum to the DataRegister */ + ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, + "Write to Data Register: Value %8.8X%8.8X\n", + ACPI_FORMAT_UINT64 (*Value))); + Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj, Value, sizeof (ACPI_INTEGER)); } @@ -637,7 +633,7 @@ AcpiExFieldDatumIo ( default: ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X", - ACPI_GET_OBJECT_TYPE (ObjDesc))); + ObjDesc->Common.Type)); Status = AE_AML_INTERNAL; break; } @@ -930,6 +926,8 @@ AcpiExInsertIntoField ( UINT32 DatumCount; UINT32 FieldDatumCount; UINT32 i; + UINT32 RequiredLength; + void *NewBuffer; ACPI_FUNCTION_TRACE (ExInsertIntoField); @@ -937,14 +935,33 @@ AcpiExInsertIntoField ( /* Validate input buffer */ - if (BufferLength < - ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength)) + NewBuffer = NULL; + RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES ( + ObjDesc->CommonField.BitLength); + /* + * We must have a buffer that is at least as long as the field + * we are writing to. This is because individual fields are + * indivisible and partial writes are not supported -- as per + * the ACPI specification. + */ + if (BufferLength < RequiredLength) { - ACPI_ERROR ((AE_INFO, - "Field size %X (bits) is too large for buffer (%X)", - ObjDesc->CommonField.BitLength, BufferLength)); + /* We need to create a new buffer */ - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); + NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength); + if (!NewBuffer) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + /* + * Copy the original data to the new buffer, starting + * at Byte zero. All unused (upper) bytes of the + * buffer will be 0. + */ + ACPI_MEMCPY ((char *) NewBuffer, (char *) Buffer, BufferLength); + Buffer = NewBuffer; + BufferLength = RequiredLength; } /* @@ -992,7 +1009,7 @@ AcpiExInsertIntoField ( MergedDatum, FieldOffset); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Exit; } FieldOffset += ObjDesc->CommonField.AccessByteWidth; @@ -1050,6 +1067,13 @@ AcpiExInsertIntoField ( Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum, FieldOffset); +Exit: + /* Free temporary buffer if we used one */ + + if (NewBuffer) + { + ACPI_FREE (NewBuffer); + } return_ACPI_STATUS (Status); } diff --git a/executer/exmisc.c b/executer/exmisc.c index 6302d5eb5e854..41e4a9752ecbf 100644 --- a/executer/exmisc.c +++ b/executer/exmisc.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes - * $Revision: 1.144 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +118,7 @@ #define __EXMISC_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" #include "amlresrc.h" @@ -162,7 +162,7 @@ AcpiExGetObjectReference ( { case ACPI_DESC_TYPE_OPERAND: - if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_LOCAL_REFERENCE) + if (ObjDesc->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -170,11 +170,11 @@ AcpiExGetObjectReference ( /* * Must be a reference to a Local or Arg */ - switch (ObjDesc->Reference.Opcode) + switch (ObjDesc->Reference.Class) { - case AML_LOCAL_OP: - case AML_ARG_OP: - case AML_DEBUG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: + case ACPI_REFCLASS_DEBUG: /* The referenced object is the pseudo-node for the local/arg */ @@ -183,8 +183,8 @@ AcpiExGetObjectReference ( default: - ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X", - ObjDesc->Reference.Opcode)); + ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X", + ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } break; @@ -215,7 +215,7 @@ AcpiExGetObjectReference ( return_ACPI_STATUS (AE_NO_MEMORY); } - ReferenceObj->Reference.Opcode = AML_REF_OF_OP; + ReferenceObj->Reference.Class = ACPI_REFCLASS_REFOF; ReferenceObj->Reference.Object = ReferencedObj; *ReturnDesc = ReferenceObj; @@ -357,7 +357,7 @@ AcpiExDoConcatenate ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ - switch (ACPI_GET_OBJECT_TYPE (Operand0)) + switch (Operand0->Common.Type) { case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16); @@ -374,7 +374,7 @@ AcpiExDoConcatenate ( default: ACPI_ERROR ((AE_INFO, "Invalid object type: %X", - ACPI_GET_OBJECT_TYPE (Operand0))); + Operand0->Common.Type)); Status = AE_AML_INTERNAL; } @@ -396,7 +396,7 @@ AcpiExDoConcatenate ( * 2) Two Strings concatenated to produce a new String * 3) Two Buffers concatenated to produce a new Buffer */ - switch (ACPI_GET_OBJECT_TYPE (Operand0)) + switch (Operand0->Common.Type) { case ACPI_TYPE_INTEGER: @@ -429,8 +429,8 @@ AcpiExDoConcatenate ( /* Result of two Strings is a String */ - ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) - (Operand0->String.Length + + ReturnDesc = AcpiUtCreateStringObject ( + ((ACPI_SIZE) Operand0->String.Length + LocalOperand1->String.Length)); if (!ReturnDesc) { @@ -451,8 +451,8 @@ AcpiExDoConcatenate ( /* Result of two Buffers is a Buffer */ - ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) - (Operand0->Buffer.Length + + ReturnDesc = AcpiUtCreateBufferObject ( + ((ACPI_SIZE) Operand0->Buffer.Length + LocalOperand1->Buffer.Length)); if (!ReturnDesc) { @@ -476,7 +476,7 @@ AcpiExDoConcatenate ( /* Invalid object type, should not happen here */ ACPI_ERROR ((AE_INFO, "Invalid object type: %X", - ACPI_GET_OBJECT_TYPE (Operand0))); + Operand0->Common.Type)); Status =AE_AML_INTERNAL; goto Cleanup; } @@ -709,7 +709,7 @@ AcpiExDoLogicalOp ( * guaranteed to be either Integer/String/Buffer by the operand * resolution mechanism. */ - switch (ACPI_GET_OBJECT_TYPE (Operand0)) + switch (Operand0->Common.Type) { case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, 16); @@ -737,7 +737,7 @@ AcpiExDoLogicalOp ( /* * Two cases: 1) Both Integers, 2) Both Strings or Buffers */ - if (ACPI_GET_OBJECT_TYPE (Operand0) == ACPI_TYPE_INTEGER) + if (Operand0->Common.Type == ACPI_TYPE_INTEGER) { /* * 1) Both operands are of type integer diff --git a/executer/exmutex.c b/executer/exmutex.c index 729b173a50364..db5ab9e77a33d 100644 --- a/executer/exmutex.c +++ b/executer/exmutex.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exmutex - ASL Mutex Acquire/Release functions - * $Revision: 1.40 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXMUTEX_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "acevents.h" @@ -166,6 +166,15 @@ AcpiExUnlinkMutex ( if (ObjDesc->Mutex.Prev) { (ObjDesc->Mutex.Prev)->Mutex.Next = ObjDesc->Mutex.Next; + + /* + * Migrate the previous sync level associated with this mutex to the + * previous mutex on the list so that it may be preserved. This handles + * the case where several mutexes have been acquired at the same level, + * but are not released in opposite order. + */ + (ObjDesc->Mutex.Prev)->Mutex.OriginalSyncLevel = + ObjDesc->Mutex.OriginalSyncLevel; } else { @@ -461,6 +470,7 @@ AcpiExReleaseMutex ( ACPI_WALK_STATE *WalkState) { ACPI_STATUS Status = AE_OK; + UINT8 PreviousSyncLevel; ACPI_FUNCTION_TRACE (ExReleaseMutex); @@ -488,10 +498,10 @@ AcpiExReleaseMutex ( (ObjDesc != AcpiGbl_GlobalLockMutex)) { ACPI_ERROR ((AE_INFO, - "Thread %X cannot release Mutex [%4.4s] acquired by thread %X", - WalkState->Thread->ThreadId, + "Thread %p cannot release Mutex [%4.4s] acquired by thread %p", + ACPI_CAST_PTR (void, WalkState->Thread->ThreadId), AcpiUtGetNodeName (ObjDesc->Mutex.Node), - ObjDesc->Mutex.OwnerThread->ThreadId)); + ACPI_CAST_PTR (void, ObjDesc->Mutex.OwnerThread->ThreadId))); return_ACPI_STATUS (AE_AML_NOT_OWNER); } @@ -505,10 +515,13 @@ AcpiExReleaseMutex ( } /* - * The sync level of the mutex must be less than or equal to the current - * sync level + * The sync level of the mutex must be equal to the current sync level. In + * other words, the current level means that at least one mutex at that + * level is currently being held. Attempting to release a mutex of a + * different level can only mean that the mutex ordering rule is being + * violated. This behavior is clarified in ACPI 4.0 specification. */ - if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel) + if (ObjDesc->Mutex.SyncLevel != WalkState->Thread->CurrentSyncLevel) { ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d", @@ -517,13 +530,25 @@ AcpiExReleaseMutex ( return_ACPI_STATUS (AE_AML_MUTEX_ORDER); } + /* + * Get the previous SyncLevel from the head of the acquired mutex list. + * This handles the case where several mutexes at the same level have been + * acquired, but are not released in reverse order. + */ + PreviousSyncLevel = + WalkState->Thread->AcquiredMutexList->Mutex.OriginalSyncLevel; + Status = AcpiExReleaseMutexObject (ObjDesc); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } if (ObjDesc->Mutex.AcquisitionDepth == 0) { - /* Restore the original SyncLevel */ + /* Restore the previous SyncLevel */ - WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel; + WalkState->Thread->CurrentSyncLevel = PreviousSyncLevel; } return_ACPI_STATUS (Status); } diff --git a/executer/exnames.c b/executer/exnames.c index b5f2ba44a3031..89fa2d4874d60 100644 --- a/executer/exnames.c +++ b/executer/exnames.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exnames - interpreter/scanner name load/execute - * $Revision: 1.111 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXNAMES_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" diff --git a/executer/exoparg1.c b/executer/exoparg1.c index 2f4ea43d9940f..70085693ba493 100644 --- a/executer/exoparg1.c +++ b/executer/exoparg1.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exoparg1 - AML execution - opcodes with 1 argument - * $Revision: 1.184 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXOPARG1_C__ #include "acpi.h" +#include "accommon.h" #include "acparser.h" #include "acdispat.h" #include "acinterp.h" @@ -880,26 +880,39 @@ AcpiExOpcode_1A_0T_1R ( Value = AcpiGbl_IntegerByteWidth; break; - case ACPI_TYPE_BUFFER: - Value = TempDesc->Buffer.Length; - break; - case ACPI_TYPE_STRING: Value = TempDesc->String.Length; break; + case ACPI_TYPE_BUFFER: + + /* Buffer arguments may not be evaluated at this point */ + + Status = AcpiDsGetBufferArguments (TempDesc); + Value = TempDesc->Buffer.Length; + break; + case ACPI_TYPE_PACKAGE: + + /* Package arguments may not be evaluated at this point */ + + Status = AcpiDsGetPackageArguments (TempDesc); Value = TempDesc->Package.Count; break; default: ACPI_ERROR ((AE_INFO, - "Operand is not Buf/Int/Str/Pkg - found type %s", + "Operand must be Buffer/Integer/String/Package - found type %s", AcpiUtGetTypeName (Type))); Status = AE_AML_OPERAND_TYPE; goto Cleanup; } + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + /* * Now that we have the size of the object, create a result * object to hold the value @@ -934,8 +947,8 @@ AcpiExOpcode_1A_0T_1R ( TempDesc = AcpiNsGetAttachedObject ( (ACPI_NAMESPACE_NODE *) Operand[0]); if (TempDesc && - ((ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_STRING) || - (ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_LOCAL_REFERENCE))) + ((TempDesc->Common.Type == ACPI_TYPE_STRING) || + (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE))) { Operand[0] = TempDesc; AcpiUtAddReference (TempDesc); @@ -948,7 +961,7 @@ AcpiExOpcode_1A_0T_1R ( } else { - switch (ACPI_GET_OBJECT_TYPE (Operand[0])) + switch ((Operand[0])->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: /* @@ -956,16 +969,16 @@ AcpiExOpcode_1A_0T_1R ( * * Must resolve/dereference the local/arg reference first */ - switch (Operand[0]->Reference.Opcode) + switch (Operand[0]->Reference.Class) { - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: /* Set Operand[0] to the value of the local/arg */ Status = AcpiDsMethodDataGetValue ( - Operand[0]->Reference.Opcode, - Operand[0]->Reference.Offset, + Operand[0]->Reference.Class, + Operand[0]->Reference.Value, WalkState, &TempDesc); if (ACPI_FAILURE (Status)) { @@ -980,7 +993,7 @@ AcpiExOpcode_1A_0T_1R ( Operand[0] = TempDesc; break; - case AML_REF_OF_OP: + case ACPI_REFCLASS_REFOF: /* Get the object to which the reference refers */ @@ -1007,7 +1020,7 @@ AcpiExOpcode_1A_0T_1R ( if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED) { - if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING) + if ((Operand[0])->Common.Type == ACPI_TYPE_STRING) { /* * This is a DerefOf (String). The string is a reference @@ -1055,9 +1068,9 @@ AcpiExOpcode_1A_0T_1R ( * This must be a reference object produced by either the * Index() or RefOf() operator */ - switch (Operand[0]->Reference.Opcode) + switch (Operand[0]->Reference.Class) { - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: /* * The target type for the Index operator must be @@ -1090,7 +1103,7 @@ AcpiExOpcode_1A_0T_1R ( * reference to the buffer itself. */ ReturnDesc->Integer.Value = - TempDesc->Buffer.Pointer[Operand[0]->Reference.Offset]; + TempDesc->Buffer.Pointer[Operand[0]->Reference.Value]; break; @@ -1111,7 +1124,7 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Unknown Index TargetType %X in obj %p", + "Unknown Index TargetType %X in reference object %p", Operand[0]->Reference.TargetType, Operand[0])); Status = AE_AML_OPERAND_TYPE; goto Cleanup; @@ -1119,7 +1132,7 @@ AcpiExOpcode_1A_0T_1R ( break; - case AML_REF_OF_OP: + case ACPI_REFCLASS_REFOF: ReturnDesc = Operand[0]->Reference.Object; @@ -1138,8 +1151,8 @@ AcpiExOpcode_1A_0T_1R ( default: ACPI_ERROR ((AE_INFO, - "Unknown opcode in reference(%p) - %X", - Operand[0], Operand[0]->Reference.Opcode)); + "Unknown class in reference(%p) - %2.2X", + Operand[0], Operand[0]->Reference.Class)); Status = AE_TYPE; goto Cleanup; diff --git a/executer/exoparg2.c b/executer/exoparg2.c index 94aca659b9dd9..7c42652cc4cbd 100644 --- a/executer/exoparg2.c +++ b/executer/exoparg2.c @@ -1,7 +1,6 @@ /****************************************************************************** * * Module Name: exoparg2 - AML execution - opcodes with 2 arguments - * $Revision: 1.143 $ * *****************************************************************************/ @@ -9,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXOPARG2_C__ #include "acpi.h" +#include "accommon.h" #include "acparser.h" #include "acinterp.h" #include "acevents.h" @@ -504,14 +504,14 @@ AcpiExOpcode_2A_1T_1R ( /* Initialize the Index reference object */ Index = Operand[1]->Integer.Value; - ReturnDesc->Reference.Offset = (UINT32) Index; - ReturnDesc->Reference.Opcode = AML_INDEX_OP; + ReturnDesc->Reference.Value = (UINT32) Index; + ReturnDesc->Reference.Class = ACPI_REFCLASS_INDEX; /* * At this point, the Source operand is a String, Buffer, or Package. * Verify that the index is within range. */ - switch (ACPI_GET_OBJECT_TYPE (Operand[0])) + switch ((Operand[0])->Common.Type) { case ACPI_TYPE_STRING: diff --git a/executer/exoparg3.c b/executer/exoparg3.c index a38e00b5b6dad..591d6aceb1219 100644 --- a/executer/exoparg3.c +++ b/executer/exoparg3.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exoparg3 - AML execution - opcodes with 3 arguments - * $Revision: 1.35 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +118,7 @@ #define __EXOPARG3_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "acparser.h" #include "amlcode.h" @@ -256,7 +256,7 @@ AcpiExOpcode_3A_1T_1R ( * either a String or a Buffer, so just use its type. */ ReturnDesc = AcpiUtCreateInternalObject ( - ACPI_GET_OBJECT_TYPE (Operand[0])); + (Operand[0])->Common.Type); if (!ReturnDesc) { Status = AE_NO_MEMORY; @@ -287,7 +287,7 @@ AcpiExOpcode_3A_1T_1R ( /* Strings always have a sub-pointer, not so for buffers */ - switch (ACPI_GET_OBJECT_TYPE (Operand[0])) + switch ((Operand[0])->Common.Type) { case ACPI_TYPE_STRING: diff --git a/executer/exoparg6.c b/executer/exoparg6.c index b000f013693f0..96c16a33bd08d 100644 --- a/executer/exoparg6.c +++ b/executer/exoparg6.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exoparg6 - AML execution - opcodes with 6 arguments - * $Revision: 1.29 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +118,7 @@ #define __EXOPARG6_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "acparser.h" #include "amlcode.h" diff --git a/executer/exprep.c b/executer/exprep.c index 158a60a1d06c6..c915361e810d7 100644 --- a/executer/exprep.c +++ b/executer/exprep.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exprep - ACPI AML (p-code) execution - field prep utilities - * $Revision: 1.142 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXPREP_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" @@ -367,7 +367,7 @@ AcpiExDecodeFieldAccess ( return_UINT32 (0); } - if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD) + if (ObjDesc->Common.Type == ACPI_TYPE_BUFFER_FIELD) { /* * BufferField access can be on any byte boundary, so the @@ -511,6 +511,7 @@ AcpiExPrepFieldValue ( ACPI_CREATE_FIELD_INFO *Info) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *SecondDesc = NULL; UINT32 Type; ACPI_STATUS Status; @@ -597,6 +598,16 @@ AcpiExPrepFieldValue ( ObjDesc->Field.AccessByteWidth, ObjDesc->BankField.RegionObj, ObjDesc->BankField.BankObj)); + + /* + * Remember location in AML stream of the field unit + * opcode and operands -- since the BankValue + * operands must be evaluated. + */ + SecondDesc = ObjDesc->Common.NextObject; + SecondDesc->Extra.AmlStart = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Data; + SecondDesc->Extra.AmlLength = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Info->DataRegisterNode)->Named.Length; + break; diff --git a/executer/exregion.c b/executer/exregion.c index b23fce7f1c502..958dc4e067055 100644 --- a/executer/exregion.c +++ b/executer/exregion.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exregion - ACPI default OpRegion (address space) handlers - * $Revision: 1.101 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +118,7 @@ #define __EXREGION_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" @@ -240,12 +240,13 @@ AcpiExSystemMemorySpaceHandler ( /* Create a new mapping starting at the address given */ - MemInfo->MappedLogicalAddress = AcpiOsMapMemory ((ACPI_NATIVE_UINT) Address, WindowSize); + MemInfo->MappedLogicalAddress = AcpiOsMapMemory ( + (ACPI_PHYSICAL_ADDRESS) Address, WindowSize); if (!MemInfo->MappedLogicalAddress) { ACPI_ERROR ((AE_INFO, "Could not map memory at %8.8X%8.8X, size %X", - ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize)); + ACPI_FORMAT_NATIVE_UINT (Address), (UINT32) WindowSize)); MemInfo->MappedLength = 0; return_ACPI_STATUS (AE_NO_MEMORY); } @@ -265,7 +266,7 @@ AcpiExSystemMemorySpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); + BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* * Perform the memory read or write @@ -375,7 +376,7 @@ AcpiExSystemIoSpaceHandler ( ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n", - BitWidth, Function, ACPI_FORMAT_UINT64 (Address))); + BitWidth, Function, ACPI_FORMAT_NATIVE_UINT (Address))); /* Decode the function parameter */ @@ -383,14 +384,14 @@ AcpiExSystemIoSpaceHandler ( { case ACPI_READ: - Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, &Value32, BitWidth); *Value = Value32; break; case ACPI_WRITE: - Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, (UINT32) *Value, BitWidth); break; diff --git a/executer/exresnte.c b/executer/exresnte.c index 57dd6524db625..5481bc899a856 100644 --- a/executer/exresnte.c +++ b/executer/exresnte.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exresnte - AML Interpreter object resolution - * $Revision: 1.75 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,11 +117,10 @@ #define __EXRESNTE_C__ #include "acpi.h" +#include "accommon.h" #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "acparser.h" -#include "amlcode.h" #define _COMPONENT ACPI_EXECUTER @@ -197,9 +195,11 @@ AcpiExResolveNodeToValue ( * Several object types require no further processing: * 1) Device/Thermal objects don't have a "real" subobject, return the Node * 2) Method locals and arguments have a pseudo-Node + * 3) 10/2007: Added method type to assist with Package construction. */ if ((EntryType == ACPI_TYPE_DEVICE) || (EntryType == ACPI_TYPE_THERMAL) || + (EntryType == ACPI_TYPE_METHOD) || (Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL))) { return_ACPI_STATUS (AE_OK); @@ -220,7 +220,7 @@ AcpiExResolveNodeToValue ( { case ACPI_TYPE_PACKAGE: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE) + if (SourceDesc->Common.Type != ACPI_TYPE_PACKAGE) { ACPI_ERROR ((AE_INFO, "Object not a Package, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -240,7 +240,7 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_BUFFER: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) + if (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) { ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -260,7 +260,7 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_STRING: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) + if (SourceDesc->Common.Type != ACPI_TYPE_STRING) { ACPI_ERROR ((AE_INFO, "Object not a String, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -276,7 +276,7 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_INTEGER: - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) + if (SourceDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s", AcpiUtGetObjectTypeName (SourceDesc))); @@ -305,7 +305,6 @@ AcpiExResolveNodeToValue ( /* For these objects, just return the object attached to the Node */ case ACPI_TYPE_MUTEX: - case ACPI_TYPE_METHOD: case ACPI_TYPE_POWER: case ACPI_TYPE_PROCESSOR: case ACPI_TYPE_EVENT: @@ -329,15 +328,14 @@ AcpiExResolveNodeToValue ( case ACPI_TYPE_LOCAL_REFERENCE: - switch (SourceDesc->Reference.Opcode) + switch (SourceDesc->Reference.Class) { - case AML_LOAD_OP: + case ACPI_REFCLASS_TABLE: /* This is a DdbHandle */ + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_INDEX: - /* This is a DdbHandle */ /* Return an additional reference to the object */ - case AML_REF_OF_OP: - ObjDesc = SourceDesc; AcpiUtAddReference (ObjDesc); break; @@ -346,9 +344,8 @@ AcpiExResolveNodeToValue ( /* No named references are allowed here */ ACPI_ERROR ((AE_INFO, - "Unsupported Reference opcode %X (%s)", - SourceDesc->Reference.Opcode, - AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode))); + "Unsupported Reference type %X", + SourceDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } diff --git a/executer/exresolv.c b/executer/exresolv.c index dae1eb4ffefd4..a3c8ab9b5cee5 100644 --- a/executer/exresolv.c +++ b/executer/exresolv.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exresolv - AML Interpreter object resolution - * $Revision: 1.142 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,11 +117,11 @@ #define __EXRESOLV_C__ #include "acpi.h" +#include "accommon.h" #include "amlcode.h" #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" -#include "acparser.h" #define _COMPONENT ACPI_EXECUTER @@ -230,7 +229,7 @@ AcpiExResolveObjectToValue ( ACPI_STATUS Status = AE_OK; ACPI_OPERAND_OBJECT *StackDesc; ACPI_OPERAND_OBJECT *ObjDesc = NULL; - UINT16 Opcode; + UINT8 RefType; ACPI_FUNCTION_TRACE (ExResolveObjectToValue); @@ -240,30 +239,30 @@ AcpiExResolveObjectToValue ( /* This is an ACPI_OPERAND_OBJECT */ - switch (ACPI_GET_OBJECT_TYPE (StackDesc)) + switch (StackDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: - Opcode = StackDesc->Reference.Opcode; + RefType = StackDesc->Reference.Class; - switch (Opcode) + switch (RefType) { - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: /* * Get the local from the method's state info * Note: this increments the local's object reference count */ - Status = AcpiDsMethodDataGetValue (Opcode, - StackDesc->Reference.Offset, WalkState, &ObjDesc); + Status = AcpiDsMethodDataGetValue (RefType, + StackDesc->Reference.Value, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Arg/Local %X] ValueObj is %p\n", - StackDesc->Reference.Offset, ObjDesc)); + StackDesc->Reference.Value, ObjDesc)); /* * Now we can delete the original Reference Object and @@ -274,23 +273,33 @@ AcpiExResolveObjectToValue ( break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: switch (StackDesc->Reference.TargetType) { case ACPI_TYPE_BUFFER_FIELD: - /* Just return - leave the Reference on the stack */ + /* Just return - do not dereference */ break; case ACPI_TYPE_PACKAGE: + /* If method call or CopyObject - do not dereference */ + + if ((WalkState->Opcode == AML_INT_METHODCALL_OP) || + (WalkState->Opcode == AML_COPY_OP)) + { + break; + } + + /* Otherwise, dereference the PackageIndex to a package element */ + ObjDesc = *StackDesc->Reference.Where; if (ObjDesc) { /* - * Valid obj descriptor, copy pointer to return value + * Valid object descriptor, copy pointer to return value * (i.e., dereference the package index) * Delete the ref object, increment the returned object */ @@ -301,11 +310,11 @@ AcpiExResolveObjectToValue ( else { /* - * A NULL object descriptor means an unitialized element of + * A NULL object descriptor means an uninitialized element of * the package, can't dereference it */ ACPI_ERROR ((AE_INFO, - "Attempt to deref an Index to NULL pkg element Idx=%p", + "Attempt to dereference an Index to NULL package element Idx=%p", StackDesc)); Status = AE_AML_UNINITIALIZED_ELEMENT; } @@ -317,7 +326,7 @@ AcpiExResolveObjectToValue ( /* Invalid reference object */ ACPI_ERROR ((AE_INFO, - "Unknown TargetType %X in Index/Reference obj %p", + "Unknown TargetType %X in Index/Reference object %p", StackDesc->Reference.TargetType, StackDesc)); Status = AE_AML_INTERNAL; break; @@ -325,15 +334,15 @@ AcpiExResolveObjectToValue ( break; - case AML_REF_OF_OP: - case AML_DEBUG_OP: - case AML_LOAD_OP: + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_DEBUG: + case ACPI_REFCLASS_TABLE: - /* Just leave the object as-is */ + /* Just leave the object as-is, do not dereference */ break; - case AML_INT_NAMEPATH_OP: /* Reference to a named object */ + case ACPI_REFCLASS_NAME: /* Reference to a named object */ /* Dereference the name */ @@ -358,8 +367,7 @@ AcpiExResolveObjectToValue ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference opcode %X (%s) in %p", - Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc)); + "Unknown Reference type %X in %p", RefType, StackDesc)); Status = AE_AML_INTERNAL; break; } @@ -384,7 +392,7 @@ AcpiExResolveObjectToValue ( case ACPI_TYPE_LOCAL_INDEX_FIELD: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead SourceDesc=%p Type=%X\n", - StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc))); + StackDesc, StackDesc->Common.Type)); Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc); @@ -467,21 +475,21 @@ AcpiExResolveMultiple ( } /* - * For reference objects created via the RefOf or Index operators, - * we need to get to the base object (as per the ACPI specification - * of the ObjectType and SizeOf operators). This means traversing - * the list of possibly many nested references. + * For reference objects created via the RefOf, Index, or Load/LoadTable + * operators, we need to get to the base object (as per the ACPI + * specification of the ObjectType and SizeOf operators). This means + * traversing the list of possibly many nested references. */ - while (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_LOCAL_REFERENCE) + while (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) { - switch (ObjDesc->Reference.Opcode) + switch (ObjDesc->Reference.Class) { - case AML_REF_OF_OP: - case AML_INT_NAMEPATH_OP: + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_NAME: /* Dereference the reference pointer */ - if (ObjDesc->Reference.Opcode == AML_REF_OF_OP) + if (ObjDesc->Reference.Class == ACPI_REFCLASS_REFOF) { Node = ObjDesc->Reference.Object; } @@ -520,7 +528,7 @@ AcpiExResolveMultiple ( break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: /* Get the type of this reference (index into another object) */ @@ -548,13 +556,19 @@ AcpiExResolveMultiple ( break; - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_TABLE: + + Type = ACPI_TYPE_DDB_HANDLE; + goto Exit; + + + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: if (ReturnDesc) { - Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode, - ObjDesc->Reference.Offset, WalkState, &ObjDesc); + Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Class, + ObjDesc->Reference.Value, WalkState, &ObjDesc); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -563,8 +577,8 @@ AcpiExResolveMultiple ( } else { - Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Opcode, - ObjDesc->Reference.Offset, WalkState, &Node); + Status = AcpiDsMethodDataGetNode (ObjDesc->Reference.Class, + ObjDesc->Reference.Value, WalkState, &Node); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -580,7 +594,7 @@ AcpiExResolveMultiple ( break; - case AML_DEBUG_OP: + case ACPI_REFCLASS_DEBUG: /* The Debug Object is of type "DebugObject" */ @@ -591,8 +605,7 @@ AcpiExResolveMultiple ( default: ACPI_ERROR ((AE_INFO, - "Unknown Reference subtype %X", - ObjDesc->Reference.Opcode)); + "Unknown Reference Class %2.2X", ObjDesc->Reference.Class)); return_ACPI_STATUS (AE_AML_INTERNAL); } } @@ -601,7 +614,7 @@ AcpiExResolveMultiple ( * Now we are guaranteed to have an object that has not been created * via the RefOf or Index operators. */ - Type = ACPI_GET_OBJECT_TYPE (ObjDesc); + Type = ObjDesc->Common.Type; Exit: diff --git a/executer/exresop.c b/executer/exresop.c index 562ca41d58082..ecc63f61357df 100644 --- a/executer/exresop.c +++ b/executer/exresop.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exresop - AML Interpreter operand/object resolution - * $Revision: 1.95 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXRESOP_C__ #include "acpi.h" +#include "accommon.h" #include "amlcode.h" #include "acparser.h" #include "acinterp.h" @@ -302,52 +302,48 @@ AcpiExResolveOperands ( /* ACPI internal object */ - ObjectType = ACPI_GET_OBJECT_TYPE (ObjDesc); + ObjectType = ObjDesc->Common.Type; /* Check for bad ACPI_OBJECT_TYPE */ if (!AcpiUtValidObjectType (ObjectType)) { ACPI_ERROR ((AE_INFO, - "Bad operand object type [%X]", - ObjectType)); + "Bad operand object type [%X]", ObjectType)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE) { - /* Decode the Reference */ + /* Validate the Reference */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - if (OpInfo->Class == AML_CLASS_UNKNOWN) + switch (ObjDesc->Reference.Class) { - return_ACPI_STATUS (AE_AML_BAD_OPCODE); - } + case ACPI_REFCLASS_DEBUG: - switch (ObjDesc->Reference.Opcode) - { - case AML_DEBUG_OP: TargetOp = AML_DEBUG_OP; /*lint -fallthrough */ - case AML_INDEX_OP: - case AML_REF_OF_OP: - case AML_ARG_OP: - case AML_LOCAL_OP: - case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */ - case AML_INT_NAMEPATH_OP: /* Reference to a named object */ - - ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Operand is a Reference, RefOpcode [%s]\n", - (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name))); + case ACPI_REFCLASS_ARG: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_INDEX: + case ACPI_REFCLASS_REFOF: + case ACPI_REFCLASS_TABLE: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */ + case ACPI_REFCLASS_NAME: /* Reference to a named object */ + + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, + "Operand is a Reference, Class [%s] %2.2X\n", + AcpiUtGetReferenceName (ObjDesc), + ObjDesc->Reference.Class)); break; default: + ACPI_ERROR ((AE_INFO, - "Operand is a Reference, Unknown Reference Opcode: %X", - ObjDesc->Reference.Opcode)); + "Unknown Reference Class %2.2X in %p", + ObjDesc->Reference.Class, ObjDesc)); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -359,8 +355,7 @@ AcpiExResolveOperands ( /* Invalid descriptor */ - ACPI_ERROR ((AE_INFO, - "Invalid descriptor %p [%s]", + ACPI_ERROR ((AE_INFO, "Invalid descriptor %p [%s]", ObjDesc, AcpiUtGetDescriptorName (ObjDesc))); return_ACPI_STATUS (AE_AML_OPERAND_TYPE); @@ -380,7 +375,7 @@ AcpiExResolveOperands ( case ARGI_REF_OR_STRING: /* Can be a String or Reference */ if ((ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) && - (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING)) + (ObjDesc->Common.Type == ACPI_TYPE_STRING)) { /* * String found - the string references a named object and @@ -430,8 +425,8 @@ AcpiExResolveOperands ( * -- All others must be resolved below. */ if ((Opcode == AML_STORE_OP) && - (ACPI_GET_OBJECT_TYPE (*StackPtr) == ACPI_TYPE_LOCAL_REFERENCE) && - ((*StackPtr)->Reference.Opcode == AML_INDEX_OP)) + ((*StackPtr)->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + ((*StackPtr)->Reference.Class == ACPI_REFCLASS_INDEX)) { goto NextOperand; } @@ -595,7 +590,7 @@ AcpiExResolveOperands ( /* Need an operand of type INTEGER, STRING or BUFFER */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_STRING: @@ -618,7 +613,7 @@ AcpiExResolveOperands ( /* Need an operand of type STRING or BUFFER */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_STRING: case ACPI_TYPE_BUFFER: @@ -660,7 +655,7 @@ AcpiExResolveOperands ( * The only reference allowed here is a direct reference to * a namespace node. */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -684,7 +679,7 @@ AcpiExResolveOperands ( /* Need a buffer or package or (ACPI 2.0) String */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_PACKAGE: case ACPI_TYPE_STRING: @@ -707,7 +702,7 @@ AcpiExResolveOperands ( /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_BUFFER: case ACPI_TYPE_REGION: @@ -729,7 +724,7 @@ AcpiExResolveOperands ( /* Used by the Store() operator only */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) + switch (ObjDesc->Common.Type) { case ACPI_TYPE_INTEGER: case ACPI_TYPE_PACKAGE: @@ -789,7 +784,7 @@ AcpiExResolveOperands ( * required object type (Simple cases only). */ Status = AcpiExCheckObjectType (TypeNeeded, - ACPI_GET_OBJECT_TYPE (*StackPtr), *StackPtr); + (*StackPtr)->Common.Type, *StackPtr); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -806,6 +801,9 @@ NextOperand: } } + ACPI_DUMP_OPERANDS (WalkState->Operands, + AcpiPsGetOpcodeName (Opcode), WalkState->NumOperands); + return_ACPI_STATUS (Status); } diff --git a/executer/exstore.c b/executer/exstore.c index 48fc72a748865..8ec8a23cffd7f 100644 --- a/executer/exstore.c +++ b/executer/exstore.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exstore - AML Interpreter object store support - * $Revision: 1.203 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,11 +117,11 @@ #define __EXSTORE_C__ #include "acpi.h" +#include "accommon.h" #include "acdispat.h" #include "acinterp.h" #include "amlcode.h" #include "acnamesp.h" -#include "acparser.h" #define _COMPONENT ACPI_EXECUTER @@ -169,8 +168,13 @@ AcpiExDoDebugObject ( ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", - Level, " ")); + /* Print line header as long as we are not in the middle of an object display */ + + if (!((Level > 0) && Index == 0)) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s", + Level, " ")); + } /* Display index for package output only */ @@ -182,13 +186,13 @@ AcpiExDoDebugObject ( if (!SourceDesc) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n")); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Null Object]\n")); return_VOID; } if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s ", AcpiUtGetObjectTypeName (SourceDesc))); if (!AcpiUtValidInternalObject (SourceDesc)) @@ -210,7 +214,9 @@ AcpiExDoDebugObject ( return_VOID; } - switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) + /* SourceDesc is of type ACPI_DESC_TYPE_OPERAND */ + + switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -244,7 +250,7 @@ AcpiExDoDebugObject ( case ACPI_TYPE_PACKAGE: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n", + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[Contains 0x%.2X Elements]\n", SourceDesc->Package.Count)); /* Output the entire contents of the package */ @@ -258,20 +264,69 @@ AcpiExDoDebugObject ( case ACPI_TYPE_LOCAL_REFERENCE: - if (SourceDesc->Reference.Opcode == AML_INDEX_OP) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n", - AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode), - SourceDesc->Reference.Offset)); - } - else + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s] ", + AcpiUtGetReferenceName (SourceDesc))); + + /* Decode the reference */ + + switch (SourceDesc->Reference.Class) { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n", - AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode))); + case ACPI_REFCLASS_INDEX: + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%X\n", + SourceDesc->Reference.Value)); + break; + + case ACPI_REFCLASS_TABLE: + + /* Case for DdbHandle */ + + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Table Index 0x%X\n", + SourceDesc->Reference.Value)); + return; + + default: + break; } + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, " ")); - if (SourceDesc->Reference.Object) + /* Check for valid node first, then valid object */ + + if (SourceDesc->Reference.Node) + { + if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) != + ACPI_DESC_TYPE_NAMED) + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, + " %p - Not a valid namespace node\n", + SourceDesc->Reference.Node)); + } + else + { + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "Node %p [%4.4s] ", + SourceDesc->Reference.Node, (SourceDesc->Reference.Node)->Name.Ascii)); + + switch ((SourceDesc->Reference.Node)->Type) + { + /* These types have no attached object */ + + case ACPI_TYPE_DEVICE: + AcpiOsPrintf ("Device\n"); + break; + + case ACPI_TYPE_THERMAL: + AcpiOsPrintf ("Thermal Zone\n"); + break; + + default: + AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, + Level+4, 0); + break; + } + } + } + else if (SourceDesc->Reference.Object) { if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) == ACPI_DESC_TYPE_NAMED) @@ -285,17 +340,12 @@ AcpiExDoDebugObject ( AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0); } } - else if (SourceDesc->Reference.Node) - { - AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object, - Level+4, 0); - } break; default: - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n", - SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); + ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n", + SourceDesc)); break; } @@ -362,7 +412,7 @@ AcpiExStore ( /* Destination object must be a Reference or a Constant object */ - switch (ACPI_GET_OBJECT_TYPE (DestDesc)) + switch (DestDesc->Common.Type) { case ACPI_TYPE_LOCAL_REFERENCE: break; @@ -386,25 +436,20 @@ AcpiExStore ( "Target is not a Reference or Constant object - %s [%p]", AcpiUtGetObjectTypeName (DestDesc), DestDesc)); - ACPI_DUMP_STACK_ENTRY (SourceDesc); - ACPI_DUMP_STACK_ENTRY (DestDesc); - ACPI_DUMP_OPERANDS (&DestDesc, ACPI_IMODE_EXECUTE, "ExStore", - 2, "Target is not a Reference or Constant object"); - return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } /* - * Examine the Reference opcode. These cases are handled: + * Examine the Reference class. These cases are handled: * * 1) Store to Name (Change the object associated with a name) * 2) Store to an indexed area of a Buffer or Package * 3) Store to a Method Local or Arg * 4) Store to the debug object */ - switch (RefDesc->Reference.Opcode) + switch (RefDesc->Reference.Class) { - case AML_REF_OF_OP: + case ACPI_REFCLASS_REFOF: /* Storing an object into a Name "container" */ @@ -414,7 +459,7 @@ AcpiExStore ( break; - case AML_INDEX_OP: + case ACPI_REFCLASS_INDEX: /* Storing to an Index (pointer into a packager or buffer) */ @@ -422,17 +467,17 @@ AcpiExStore ( break; - case AML_LOCAL_OP: - case AML_ARG_OP: + case ACPI_REFCLASS_LOCAL: + case ACPI_REFCLASS_ARG: /* Store to a method local/arg */ - Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode, - RefDesc->Reference.Offset, SourceDesc, WalkState); + Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class, + RefDesc->Reference.Value, SourceDesc, WalkState); break; - case AML_DEBUG_OP: + case ACPI_REFCLASS_DEBUG: /* * Storing to the Debug object causes the value stored to be @@ -448,9 +493,9 @@ AcpiExStore ( default: - ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X", - RefDesc->Reference.Opcode)); - ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR); + ACPI_ERROR ((AE_INFO, "Unknown Reference Class %2.2X", + RefDesc->Reference.Class)); + ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO); Status = AE_AML_INTERNAL; break; @@ -508,10 +553,23 @@ AcpiExStoreObjectToIndex ( */ ObjDesc = *(IndexDesc->Reference.Where); - Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); - if (ACPI_FAILURE (Status)) + if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE && + SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE) { - return_ACPI_STATUS (Status); + /* This is a DDBHandle, just add a reference to it */ + + AcpiUtAddReference (SourceDesc); + NewDesc = SourceDesc; + } + else + { + /* Normal object, copy it */ + + Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } if (ObjDesc) @@ -559,8 +617,8 @@ AcpiExStoreObjectToIndex ( * by the INDEX_OP code. */ ObjDesc = IndexDesc->Reference.Object; - if ((ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_STRING)) + if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) && + (ObjDesc->Common.Type != ACPI_TYPE_STRING)) { return_ACPI_STATUS (AE_AML_OPERAND_TYPE); } @@ -569,7 +627,7 @@ AcpiExStoreObjectToIndex ( * The assignment of the individual elements will be slightly * different for each source type. */ - switch (ACPI_GET_OBJECT_TYPE (SourceDesc)) + switch (SourceDesc->Common.Type) { case ACPI_TYPE_INTEGER: @@ -598,7 +656,7 @@ AcpiExStoreObjectToIndex ( /* Store the source value into the target buffer byte */ - ObjDesc->Buffer.Pointer[IndexDesc->Reference.Offset] = Value; + ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value; break; @@ -676,10 +734,18 @@ AcpiExStoreObjectToNode ( /* If no implicit conversion, drop into the default case below */ - if ((!ImplicitConversion) || (WalkState->Opcode == AML_COPY_OP)) + if ((!ImplicitConversion) || + ((WalkState->Opcode == AML_COPY_OP) && + (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) && + (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) && + (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD))) { - /* Force execution of default (no implicit conversion) */ - + /* + * Force execution of default (no implicit conversion). Note: + * CopyObject does not perform an implicit conversion, as per the ACPI + * spec -- except in case of region/bank/index fields -- because these + * objects must retain their original type permanently. + */ TargetType = ACPI_TYPE_ANY; } @@ -746,7 +812,7 @@ AcpiExStoreObjectToNode ( /* No conversions for all other types. Just attach the source object */ Status = AcpiNsAttachObject (Node, SourceDesc, - ACPI_GET_OBJECT_TYPE (SourceDesc)); + SourceDesc->Common.Type); break; } diff --git a/executer/exstoren.c b/executer/exstoren.c index 232db749ee572..0810560d39c0a 100644 --- a/executer/exstoren.c +++ b/executer/exstoren.c @@ -3,7 +3,6 @@ * * Module Name: exstoren - AML Interpreter object store support, * Store to Node (namespace object) - * $Revision: 1.71 $ * *****************************************************************************/ @@ -11,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -119,6 +118,7 @@ #define __EXSTOREN_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" @@ -177,7 +177,7 @@ AcpiExResolveObject ( * are all essentially the same. This case handles the * "interchangeable" types Integer, String, and Buffer. */ - if (ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) + if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) { /* Resolve a reference object first */ @@ -197,10 +197,11 @@ AcpiExResolveObject ( /* Must have a Integer, Buffer, or String */ - if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) && - (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) && - (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) && - !((ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) && (SourceDesc->Reference.Opcode == AML_LOAD_OP))) + if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) && + (SourceDesc->Common.Type != ACPI_TYPE_BUFFER) && + (SourceDesc->Common.Type != ACPI_TYPE_STRING) && + !((SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) && + (SourceDesc->Reference.Class== ACPI_REFCLASS_TABLE))) { /* Conversion successful but still not a valid type */ @@ -300,7 +301,7 @@ AcpiExStoreObjectToObject ( return_ACPI_STATUS (Status); } - if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_GET_OBJECT_TYPE (DestDesc)) + if (SourceDesc->Common.Type != DestDesc->Common.Type) { /* * The source type does not match the type of the destination. @@ -311,7 +312,7 @@ AcpiExStoreObjectToObject ( * Otherwise, ActualSrcDesc is a temporary object to hold the * converted object. */ - Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc), + Status = AcpiExConvertToTargetType (DestDesc->Common.Type, SourceDesc, &ActualSrcDesc, WalkState); if (ACPI_FAILURE (Status)) { @@ -333,7 +334,7 @@ AcpiExStoreObjectToObject ( * We now have two objects of identical types, and we can perform a * copy of the *value* of the source object. */ - switch (ACPI_GET_OBJECT_TYPE (DestDesc)) + switch (DestDesc->Common.Type) { case ACPI_TYPE_INTEGER: diff --git a/executer/exstorob.c b/executer/exstorob.c index 4b39b86805caa..a1ad8d0aedc6d 100644 --- a/executer/exstorob.c +++ b/executer/exstorob.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exstorob - AML Interpreter object store support, store to object - * $Revision: 1.62 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,6 +117,7 @@ #define __EXSTOROB_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" diff --git a/executer/exsystem.c b/executer/exsystem.c index 0512d474077fa..19674606a601b 100644 --- a/executer/exsystem.c +++ b/executer/exsystem.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exsystem - Interface to OS services - * $Revision: 1.93 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -118,8 +117,8 @@ #define __EXSYSTEM_C__ #include "acpi.h" +#include "accommon.h" #include "acinterp.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exsystem") diff --git a/executer/exutils.c b/executer/exutils.c index 510a3ad01d912..45b35a0c2571f 100644 --- a/executer/exutils.c +++ b/executer/exutils.c @@ -2,7 +2,6 @@ /****************************************************************************** * * Module Name: exutils - interpreter/scanner utilities - * $Revision: 1.129 $ * *****************************************************************************/ @@ -10,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. * All rights reserved. * * 2. License @@ -134,9 +133,9 @@ #define DEFINE_AML_GLOBALS #include "acpi.h" +#include "accommon.h" #include "acinterp.h" #include "amlcode.h" -#include "acevents.h" #define _COMPONENT ACPI_EXECUTER ACPI_MODULE_NAME ("exutils") @@ -324,7 +323,7 @@ AcpiExTruncateFor32bitTable ( */ if ((!ObjDesc) || (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) || - (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)) + (ObjDesc->Common.Type != ACPI_TYPE_INTEGER)) { return; } |