exstore.c revision 229989
167754Smsmith/****************************************************************************** 267754Smsmith * 377424Smsmith * Module Name: exstore - AML Interpreter object store support 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8229989Sjkim * Copyright (C) 2000 - 2012, Intel Corp. 970243Smsmith * All rights reserved. 1067754Smsmith * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 2567754Smsmith * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 2967754Smsmith * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 4367754Smsmith 4477424Smsmith#define __EXSTORE_C__ 4567754Smsmith 46193341Sjkim#include <contrib/dev/acpica/include/acpi.h> 47193341Sjkim#include <contrib/dev/acpica/include/accommon.h> 48193341Sjkim#include <contrib/dev/acpica/include/acdispat.h> 49193341Sjkim#include <contrib/dev/acpica/include/acinterp.h> 50193341Sjkim#include <contrib/dev/acpica/include/amlcode.h> 51193341Sjkim#include <contrib/dev/acpica/include/acnamesp.h> 5267754Smsmith 5367754Smsmith 5477424Smsmith#define _COMPONENT ACPI_EXECUTER 5591116Smsmith ACPI_MODULE_NAME ("exstore") 5667754Smsmith 57151937Sjkim/* Local prototypes */ 5867754Smsmith 59151937Sjkimstatic ACPI_STATUS 60151937SjkimAcpiExStoreObjectToIndex ( 61151937Sjkim ACPI_OPERAND_OBJECT *ValDesc, 62151937Sjkim ACPI_OPERAND_OBJECT *DestDesc, 63151937Sjkim ACPI_WALK_STATE *WalkState); 64151937Sjkim 65151937Sjkim 6667754Smsmith/******************************************************************************* 6767754Smsmith * 6877424Smsmith * FUNCTION: AcpiExStore 6967754Smsmith * 7085756Smsmith * PARAMETERS: *SourceDesc - Value to be stored 7177424Smsmith * *DestDesc - Where to store it. Must be an NS node 7277424Smsmith * or an ACPI_OPERAND_OBJECT of type 7387031Smsmith * Reference; 7487031Smsmith * WalkState - Current walk state 7567754Smsmith * 7667754Smsmith * RETURN: Status 7767754Smsmith * 7885756Smsmith * DESCRIPTION: Store the value described by SourceDesc into the location 7967754Smsmith * described by DestDesc. Called by various interpreter 8067754Smsmith * functions to store the result of an operation into 8191116Smsmith * the destination operand -- not just simply the actual "Store" 8287031Smsmith * ASL operator. 8367754Smsmith * 8467754Smsmith ******************************************************************************/ 8567754Smsmith 8667754SmsmithACPI_STATUS 8777424SmsmithAcpiExStore ( 8885756Smsmith ACPI_OPERAND_OBJECT *SourceDesc, 8967754Smsmith ACPI_OPERAND_OBJECT *DestDesc, 9067754Smsmith ACPI_WALK_STATE *WalkState) 9167754Smsmith{ 9267754Smsmith ACPI_STATUS Status = AE_OK; 9371867Smsmith ACPI_OPERAND_OBJECT *RefDesc = DestDesc; 9467754Smsmith 9567754Smsmith 96167802Sjkim ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc); 9767754Smsmith 9867754Smsmith 9967754Smsmith /* Validate parameters */ 10067754Smsmith 10185756Smsmith if (!SourceDesc || !DestDesc) 10267754Smsmith { 103167802Sjkim ACPI_ERROR ((AE_INFO, "Null parameter")); 10467754Smsmith return_ACPI_STATUS (AE_AML_NO_OPERAND); 10567754Smsmith } 10667754Smsmith 10771867Smsmith /* DestDesc can be either a namespace node or an ACPI object */ 10867754Smsmith 10991116Smsmith if (ACPI_GET_DESCRIPTOR_TYPE (DestDesc) == ACPI_DESC_TYPE_NAMED) 11067754Smsmith { 11177424Smsmith /* 11271867Smsmith * Dest is a namespace node, 113107325Siwasaki * Storing an object into a Named node. 11471867Smsmith */ 11585756Smsmith Status = AcpiExStoreObjectToNode (SourceDesc, 116128212Snjl (ACPI_NAMESPACE_NODE *) DestDesc, WalkState, 117128212Snjl ACPI_IMPLICIT_CONVERSION); 11867754Smsmith 11971867Smsmith return_ACPI_STATUS (Status); 12067754Smsmith } 12167754Smsmith 12299679Siwasaki /* Destination object must be a Reference or a Constant object */ 12367754Smsmith 124193267Sjkim switch (DestDesc->Common.Type) 125102550Siwasaki { 126107325Siwasaki case ACPI_TYPE_LOCAL_REFERENCE: 12799679Siwasaki break; 12899679Siwasaki 12999679Siwasaki case ACPI_TYPE_INTEGER: 13099679Siwasaki 13199679Siwasaki /* Allow stores to Constants -- a Noop as per ACPI spec */ 13299679Siwasaki 13399679Siwasaki if (DestDesc->Common.Flags & AOPOBJ_AML_CONSTANT) 13499679Siwasaki { 13599679Siwasaki return_ACPI_STATUS (AE_OK); 13699679Siwasaki } 13799679Siwasaki 138104470Siwasaki /*lint -fallthrough */ 13999679Siwasaki 14099679Siwasaki default: 14199679Siwasaki 142126372Snjl /* Destination is not a Reference object */ 14367754Smsmith 144167802Sjkim ACPI_ERROR ((AE_INFO, 145167802Sjkim "Target is not a Reference or Constant object - %s [%p]", 146138287Smarks AcpiUtGetObjectTypeName (DestDesc), DestDesc)); 14767754Smsmith 14867754Smsmith return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 14967754Smsmith } 15067754Smsmith 15177424Smsmith /* 152193267Sjkim * Examine the Reference class. These cases are handled: 15371867Smsmith * 15471867Smsmith * 1) Store to Name (Change the object associated with a name) 15571867Smsmith * 2) Store to an indexed area of a Buffer or Package 15671867Smsmith * 3) Store to a Method Local or Arg 15771867Smsmith * 4) Store to the debug object 15871867Smsmith */ 159193267Sjkim switch (RefDesc->Reference.Class) 16067754Smsmith { 161193267Sjkim case ACPI_REFCLASS_REFOF: 16267754Smsmith 16371867Smsmith /* Storing an object into a Name "container" */ 16471867Smsmith 165151937Sjkim Status = AcpiExStoreObjectToNode (SourceDesc, 166151937Sjkim RefDesc->Reference.Object, 167151937Sjkim WalkState, ACPI_IMPLICIT_CONVERSION); 16871867Smsmith break; 16967754Smsmith 17067754Smsmith 171193267Sjkim case ACPI_REFCLASS_INDEX: 17267754Smsmith 17371867Smsmith /* Storing to an Index (pointer into a packager or buffer) */ 17467754Smsmith 17585756Smsmith Status = AcpiExStoreObjectToIndex (SourceDesc, RefDesc, WalkState); 17671867Smsmith break; 17771867Smsmith 17871867Smsmith 179193267Sjkim case ACPI_REFCLASS_LOCAL: 180193267Sjkim case ACPI_REFCLASS_ARG: 18171867Smsmith 18277424Smsmith /* Store to a method local/arg */ 18371867Smsmith 184193267Sjkim Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Class, 185193267Sjkim RefDesc->Reference.Value, SourceDesc, WalkState); 18671867Smsmith break; 18771867Smsmith 18871867Smsmith 189193267Sjkim case ACPI_REFCLASS_DEBUG: 19071867Smsmith 19167754Smsmith /* 19271867Smsmith * Storing to the Debug object causes the value stored to be 19371867Smsmith * displayed and otherwise has no effect -- see ACPI Specification 19467754Smsmith */ 195138287Smarks ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 196138287Smarks "**** Write to Debug Object: Object %p %s ****:\n\n", 197138287Smarks SourceDesc, AcpiUtGetObjectTypeName (SourceDesc))); 19877424Smsmith 199204773Sjkim ACPI_DEBUG_OBJECT (SourceDesc, 0, 0); 20071867Smsmith break; 20171867Smsmith 20271867Smsmith 20371867Smsmith default: 20471867Smsmith 205204773Sjkim ACPI_ERROR ((AE_INFO, "Unknown Reference Class 0x%2.2X", 206193267Sjkim RefDesc->Reference.Class)); 207193267Sjkim ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_INFO); 20871867Smsmith 20971867Smsmith Status = AE_AML_INTERNAL; 21071867Smsmith break; 21199679Siwasaki } 21271867Smsmith 21371867Smsmith return_ACPI_STATUS (Status); 21471867Smsmith} 21571867Smsmith 21671867Smsmith 21771867Smsmith/******************************************************************************* 21871867Smsmith * 21977424Smsmith * FUNCTION: AcpiExStoreObjectToIndex 22071867Smsmith * 22187031Smsmith * PARAMETERS: *SourceDesc - Value to be stored 22287031Smsmith * *DestDesc - Named object to receive the value 22387031Smsmith * WalkState - Current walk state 22471867Smsmith * 22571867Smsmith * RETURN: Status 22671867Smsmith * 22787031Smsmith * DESCRIPTION: Store the object to indexed Buffer or Package element 22871867Smsmith * 22971867Smsmith ******************************************************************************/ 23071867Smsmith 231151937Sjkimstatic ACPI_STATUS 23277424SmsmithAcpiExStoreObjectToIndex ( 23385756Smsmith ACPI_OPERAND_OBJECT *SourceDesc, 23491116Smsmith ACPI_OPERAND_OBJECT *IndexDesc, 23571867Smsmith ACPI_WALK_STATE *WalkState) 23671867Smsmith{ 23771867Smsmith ACPI_STATUS Status = AE_OK; 23871867Smsmith ACPI_OPERAND_OBJECT *ObjDesc; 23991116Smsmith ACPI_OPERAND_OBJECT *NewDesc; 24071867Smsmith UINT8 Value = 0; 241126372Snjl UINT32 i; 24271867Smsmith 24371867Smsmith 244167802Sjkim ACPI_FUNCTION_TRACE (ExStoreObjectToIndex); 24571867Smsmith 24671867Smsmith 24771867Smsmith /* 24871867Smsmith * Destination must be a reference pointer, and 24971867Smsmith * must point to either a buffer or a package 25071867Smsmith */ 25191116Smsmith switch (IndexDesc->Reference.TargetType) 25271867Smsmith { 25371867Smsmith case ACPI_TYPE_PACKAGE: 25471867Smsmith /* 255138287Smarks * Storing to a package element. Copy the object and replace 256138287Smarks * any existing object with the new object. No implicit 257138287Smarks * conversion is performed. 258138287Smarks * 25991116Smsmith * The object at *(IndexDesc->Reference.Where) is the 26091116Smsmith * element within the package that is to be modified. 261126372Snjl * The parent package object is at IndexDesc->Reference.Object 26291116Smsmith */ 26391116Smsmith ObjDesc = *(IndexDesc->Reference.Where); 26485756Smsmith 265193267Sjkim if (SourceDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE && 266193267Sjkim SourceDesc->Reference.Class == ACPI_REFCLASS_TABLE) 26791116Smsmith { 268193267Sjkim /* This is a DDBHandle, just add a reference to it */ 269193267Sjkim 270193267Sjkim AcpiUtAddReference (SourceDesc); 271193267Sjkim NewDesc = SourceDesc; 27291116Smsmith } 273193267Sjkim else 274193267Sjkim { 275193267Sjkim /* Normal object, copy it */ 27667754Smsmith 277193267Sjkim Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState); 278193267Sjkim if (ACPI_FAILURE (Status)) 279193267Sjkim { 280193267Sjkim return_ACPI_STATUS (Status); 281193267Sjkim } 282193267Sjkim } 283193267Sjkim 284138287Smarks if (ObjDesc) 28591116Smsmith { 286138287Smarks /* Decrement reference count by the ref count of the parent package */ 287104470Siwasaki 288151937Sjkim for (i = 0; 289151937Sjkim i < ((ACPI_OPERAND_OBJECT *) 290151937Sjkim IndexDesc->Reference.Object)->Common.ReferenceCount; 291151937Sjkim i++) 292104470Siwasaki { 293138287Smarks AcpiUtRemoveReference (ObjDesc); 294104470Siwasaki } 295138287Smarks } 296151937Sjkim 297138287Smarks *(IndexDesc->Reference.Where) = NewDesc; 298126372Snjl 299151937Sjkim /* Increment ref count by the ref count of the parent package-1 */ 300126372Snjl 301151937Sjkim for (i = 1; 302151937Sjkim i < ((ACPI_OPERAND_OBJECT *) 303151937Sjkim IndexDesc->Reference.Object)->Common.ReferenceCount; 304151937Sjkim i++) 305138287Smarks { 306138287Smarks AcpiUtAddReference (NewDesc); 30767754Smsmith } 308151937Sjkim 30971867Smsmith break; 31067754Smsmith 31167754Smsmith 31271867Smsmith case ACPI_TYPE_BUFFER_FIELD: 31377424Smsmith 31467754Smsmith /* 315138287Smarks * Store into a Buffer or String (not actually a real BufferField) 316138287Smarks * at a location defined by an Index. 31767754Smsmith * 31887031Smsmith * The first 8-bit element of the source object is written to the 31987031Smsmith * 8-bit Buffer location defined by the Index destination object, 32087031Smsmith * according to the ACPI 2.0 specification. 32167754Smsmith */ 32267754Smsmith 32367754Smsmith /* 324138287Smarks * Make sure the target is a Buffer or String. An error should 325138287Smarks * not happen here, since the ReferenceObject was constructed 326138287Smarks * by the INDEX_OP code. 32767754Smsmith */ 32891116Smsmith ObjDesc = IndexDesc->Reference.Object; 329193267Sjkim if ((ObjDesc->Common.Type != ACPI_TYPE_BUFFER) && 330193267Sjkim (ObjDesc->Common.Type != ACPI_TYPE_STRING)) 33167754Smsmith { 33271867Smsmith return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 33367754Smsmith } 33467754Smsmith 33567754Smsmith /* 33667754Smsmith * The assignment of the individual elements will be slightly 33767754Smsmith * different for each source type. 33867754Smsmith */ 339193267Sjkim switch (SourceDesc->Common.Type) 34067754Smsmith { 34171867Smsmith case ACPI_TYPE_INTEGER: 34287031Smsmith 34387031Smsmith /* Use the least-significant byte of the integer */ 34487031Smsmith 34587031Smsmith Value = (UINT8) (SourceDesc->Integer.Value); 34667754Smsmith break; 34767754Smsmith 34887031Smsmith case ACPI_TYPE_BUFFER: 349138287Smarks case ACPI_TYPE_STRING: 35077424Smsmith 351138287Smarks /* Note: Takes advantage of common string/buffer fields */ 352138287Smarks 35387031Smsmith Value = SourceDesc->Buffer.Pointer[0]; 35467754Smsmith break; 35567754Smsmith 35667754Smsmith default: 35777424Smsmith 35887031Smsmith /* All other types are invalid */ 35977424Smsmith 360167802Sjkim ACPI_ERROR ((AE_INFO, 361167802Sjkim "Source must be Integer/Buffer/String type, not %s", 36299679Siwasaki AcpiUtGetObjectTypeName (SourceDesc))); 36387031Smsmith return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 36467754Smsmith } 36587031Smsmith 36687031Smsmith /* Store the source value into the target buffer byte */ 36787031Smsmith 368193267Sjkim ObjDesc->Buffer.Pointer[IndexDesc->Reference.Value] = Value; 36971867Smsmith break; 37067754Smsmith 37167754Smsmith 37271867Smsmith default: 373167802Sjkim ACPI_ERROR ((AE_INFO, 374167802Sjkim "Target is not a Package or BufferField")); 37571867Smsmith Status = AE_AML_OPERAND_TYPE; 37667754Smsmith break; 37771867Smsmith } 37867754Smsmith 37971867Smsmith return_ACPI_STATUS (Status); 38071867Smsmith} 38167754Smsmith 38267754Smsmith 38371867Smsmith/******************************************************************************* 38471867Smsmith * 38577424Smsmith * FUNCTION: AcpiExStoreObjectToNode 38671867Smsmith * 38787031Smsmith * PARAMETERS: SourceDesc - Value to be stored 38887031Smsmith * Node - Named object to receive the value 38987031Smsmith * WalkState - Current walk state 390128212Snjl * ImplicitConversion - Perform implicit conversion (yes/no) 39171867Smsmith * 39271867Smsmith * RETURN: Status 39371867Smsmith * 39471867Smsmith * DESCRIPTION: Store the object to the named object. 39571867Smsmith * 39671867Smsmith * The Assignment of an object to a named object is handled here 39787031Smsmith * The value passed in will replace the current value (if any) 39871867Smsmith * with the input value. 39971867Smsmith * 40071867Smsmith * When storing into an object the data is converted to the 40171867Smsmith * target object type then stored in the object. This means 40271867Smsmith * that the target object type (for an initialized target) will 40371867Smsmith * not be changed by a store operation. 40471867Smsmith * 40587031Smsmith * Assumes parameters are already validated. 40671867Smsmith * 40771867Smsmith ******************************************************************************/ 40867754Smsmith 40971867SmsmithACPI_STATUS 41077424SmsmithAcpiExStoreObjectToNode ( 41171867Smsmith ACPI_OPERAND_OBJECT *SourceDesc, 41271867Smsmith ACPI_NAMESPACE_NODE *Node, 413128212Snjl ACPI_WALK_STATE *WalkState, 414128212Snjl UINT8 ImplicitConversion) 41571867Smsmith{ 41671867Smsmith ACPI_STATUS Status = AE_OK; 41771867Smsmith ACPI_OPERAND_OBJECT *TargetDesc; 41891116Smsmith ACPI_OPERAND_OBJECT *NewDesc; 41991116Smsmith ACPI_OBJECT_TYPE TargetType; 42067754Smsmith 42171867Smsmith 422167802Sjkim ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc); 42371867Smsmith 42483174Smsmith 425151937Sjkim /* Get current type of the node, and object attached to Node */ 426151937Sjkim 42771867Smsmith TargetType = AcpiNsGetType (Node); 42871867Smsmith TargetDesc = AcpiNsGetAttachedObject (Node); 42971867Smsmith 43099146Siwasaki ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n", 43199679Siwasaki SourceDesc, AcpiUtGetObjectTypeName (SourceDesc), 43291116Smsmith Node, AcpiUtGetTypeName (TargetType))); 43371867Smsmith 43471867Smsmith /* 43571867Smsmith * Resolve the source object to an actual value 43677424Smsmith * (If it is a reference object) 43771867Smsmith */ 43877424Smsmith Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState); 43971867Smsmith if (ACPI_FAILURE (Status)) 44071867Smsmith { 44171867Smsmith return_ACPI_STATUS (Status); 44271867Smsmith } 44371867Smsmith 444128212Snjl /* If no implicit conversion, drop into the default case below */ 445128212Snjl 446193267Sjkim if ((!ImplicitConversion) || 447193267Sjkim ((WalkState->Opcode == AML_COPY_OP) && 448193267Sjkim (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) && 449193267Sjkim (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) && 450193267Sjkim (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD))) 451128212Snjl { 452193267Sjkim /* 453193267Sjkim * Force execution of default (no implicit conversion). Note: 454193267Sjkim * CopyObject does not perform an implicit conversion, as per the ACPI 455193267Sjkim * spec -- except in case of region/bank/index fields -- because these 456193267Sjkim * objects must retain their original type permanently. 457193267Sjkim */ 458128212Snjl TargetType = ACPI_TYPE_ANY; 459128212Snjl } 460128212Snjl 461151937Sjkim /* Do the actual store operation */ 462151937Sjkim 46371867Smsmith switch (TargetType) 46471867Smsmith { 46577424Smsmith case ACPI_TYPE_BUFFER_FIELD: 466107325Siwasaki case ACPI_TYPE_LOCAL_REGION_FIELD: 467107325Siwasaki case ACPI_TYPE_LOCAL_BANK_FIELD: 468107325Siwasaki case ACPI_TYPE_LOCAL_INDEX_FIELD: 46971867Smsmith 470151937Sjkim /* For fields, copy the source data to the target field. */ 471151937Sjkim 472151937Sjkim Status = AcpiExWriteDataToField (SourceDesc, TargetDesc, 473151937Sjkim &WalkState->ResultObj); 47467754Smsmith break; 47567754Smsmith 47667754Smsmith 47771867Smsmith case ACPI_TYPE_INTEGER: 47871867Smsmith case ACPI_TYPE_STRING: 47971867Smsmith case ACPI_TYPE_BUFFER: 48067754Smsmith 48177424Smsmith /* 48271867Smsmith * These target types are all of type Integer/String/Buffer, and 48371867Smsmith * therefore support implicit conversion before the store. 48477424Smsmith * 48577424Smsmith * Copy and/or convert the source object to a new target object 48667754Smsmith */ 487151937Sjkim Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc, 488151937Sjkim &NewDesc, WalkState); 48971867Smsmith if (ACPI_FAILURE (Status)) 49067754Smsmith { 49171867Smsmith return_ACPI_STATUS (Status); 49267754Smsmith } 49367754Smsmith 49491116Smsmith if (NewDesc != TargetDesc) 49591116Smsmith { 49691116Smsmith /* 49791116Smsmith * Store the new NewDesc as the new value of the Name, and set 49891116Smsmith * the Name's type to that of the value being stored in it. 49991116Smsmith * SourceDesc reference count is incremented by AttachObject. 500104470Siwasaki * 501104470Siwasaki * Note: This may change the type of the node if an explicit store 502104470Siwasaki * has been performed such that the node/object type has been 503104470Siwasaki * changed. 50491116Smsmith */ 505104470Siwasaki Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type); 50685756Smsmith 50799146Siwasaki ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 50891116Smsmith "Store %s into %s via Convert/Attach\n", 50999679Siwasaki AcpiUtGetObjectTypeName (SourceDesc), 51099679Siwasaki AcpiUtGetObjectTypeName (NewDesc))); 51191116Smsmith } 51267754Smsmith break; 51367754Smsmith 51477424Smsmith 51567754Smsmith default: 51667754Smsmith 51799146Siwasaki ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, 518151937Sjkim "Storing %s (%p) directly into node (%p) with no implicit conversion\n", 51999679Siwasaki AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, Node)); 52084491Smsmith 52171867Smsmith /* No conversions for all other types. Just attach the source object */ 52267754Smsmith 523151937Sjkim Status = AcpiNsAttachObject (Node, SourceDesc, 524193267Sjkim SourceDesc->Common.Type); 52571867Smsmith break; 52671867Smsmith } 52767754Smsmith 52871867Smsmith return_ACPI_STATUS (Status); 52971867Smsmith} 53067754Smsmith 53167754Smsmith 532