exstore.c revision 82367
1 2/****************************************************************************** 3 * 4 * Module Name: exstore - AML Interpreter object store support 5 * $Revision: 142 $ 6 * 7 *****************************************************************************/ 8 9/****************************************************************************** 10 * 11 * 1. Copyright Notice 12 * 13 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. 14 * All rights reserved. 15 * 16 * 2. License 17 * 18 * 2.1. This is your license from Intel Corp. under its intellectual property 19 * rights. You may have additional license terms from the party that provided 20 * you this software, covering your right to use that party's intellectual 21 * property rights. 22 * 23 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 24 * copy of the source code appearing in this file ("Covered Code") an 25 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 26 * base code distributed originally by Intel ("Original Intel Code") to copy, 27 * make derivatives, distribute, use and display any portion of the Covered 28 * Code in any form, with the right to sublicense such rights; and 29 * 30 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 31 * license (with the right to sublicense), under only those claims of Intel 32 * patents that are infringed by the Original Intel Code, to make, use, sell, 33 * offer to sell, and import the Covered Code and derivative works thereof 34 * solely to the minimum extent necessary to exercise the above copyright 35 * license, and in no event shall the patent license extend to any additions 36 * to or modifications of the Original Intel Code. No other license or right 37 * is granted directly or by implication, estoppel or otherwise; 38 * 39 * The above copyright and patent license is granted only if the following 40 * conditions are met: 41 * 42 * 3. Conditions 43 * 44 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 45 * Redistribution of source code of any substantial portion of the Covered 46 * Code or modification with rights to further distribute source must include 47 * the above Copyright Notice, the above License, this list of Conditions, 48 * and the following Disclaimer and Export Compliance provision. In addition, 49 * Licensee must cause all Covered Code to which Licensee contributes to 50 * contain a file documenting the changes Licensee made to create that Covered 51 * Code and the date of any change. Licensee must include in that file the 52 * documentation of any changes made by any predecessor Licensee. Licensee 53 * must include a prominent statement that the modification is derived, 54 * directly or indirectly, from Original Intel Code. 55 * 56 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 57 * Redistribution of source code of any substantial portion of the Covered 58 * Code or modification without rights to further distribute source must 59 * include the following Disclaimer and Export Compliance provision in the 60 * documentation and/or other materials provided with distribution. In 61 * addition, Licensee may not authorize further sublicense of source of any 62 * portion of the Covered Code, and must include terms to the effect that the 63 * license from Licensee to its licensee is limited to the intellectual 64 * property embodied in the software Licensee provides to its licensee, and 65 * not to intellectual property embodied in modifications its licensee may 66 * make. 67 * 68 * 3.3. Redistribution of Executable. Redistribution in executable form of any 69 * substantial portion of the Covered Code or modification must reproduce the 70 * above Copyright Notice, and the following Disclaimer and Export Compliance 71 * provision in the documentation and/or other materials provided with the 72 * distribution. 73 * 74 * 3.4. Intel retains all right, title, and interest in and to the Original 75 * Intel Code. 76 * 77 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 78 * Intel shall be used in advertising or otherwise to promote the sale, use or 79 * other dealings in products derived from or relating to the Covered Code 80 * without prior written authorization from Intel. 81 * 82 * 4. Disclaimer and Export Compliance 83 * 84 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 85 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 86 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 87 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 88 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 89 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 90 * PARTICULAR PURPOSE. 91 * 92 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 93 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 94 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 95 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 96 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 97 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 98 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 99 * LIMITED REMEDY. 100 * 101 * 4.3. Licensee shall not export, either directly or indirectly, any of this 102 * software or system incorporating such software without first obtaining any 103 * required license or other approval from the U. S. Department of Commerce or 104 * any other agency or department of the United States Government. In the 105 * event Licensee exports any such software from the United States or 106 * re-exports any such software from a foreign destination, Licensee shall 107 * ensure that the distribution and export/re-export of the software is in 108 * compliance with all laws, regulations, orders, or other restrictions of the 109 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 110 * any of its subsidiaries will export/re-export any technical data, process, 111 * software, or service, directly or indirectly, to any country for which the 112 * United States government or any agency thereof requires an export license, 113 * other governmental approval, or letter of assurance, without first obtaining 114 * such license, approval or letter. 115 * 116 *****************************************************************************/ 117 118#define __EXSTORE_C__ 119 120#include "acpi.h" 121#include "acparser.h" 122#include "acdispat.h" 123#include "acinterp.h" 124#include "amlcode.h" 125#include "acnamesp.h" 126#include "actables.h" 127 128 129#define _COMPONENT ACPI_EXECUTER 130 MODULE_NAME ("exstore") 131 132 133/******************************************************************************* 134 * 135 * FUNCTION: AcpiExStore 136 * 137 * PARAMETERS: *ValDesc - Value to be stored 138 * *DestDesc - Where to store it. Must be an NS node 139 * or an ACPI_OPERAND_OBJECT of type 140 * Reference; if the latter the descriptor 141 * will be either reused or deleted. 142 * 143 * RETURN: Status 144 * 145 * DESCRIPTION: Store the value described by ValDesc into the location 146 * described by DestDesc. Called by various interpreter 147 * functions to store the result of an operation into 148 * the destination operand. 149 * 150 ******************************************************************************/ 151 152ACPI_STATUS 153AcpiExStore ( 154 ACPI_OPERAND_OBJECT *ValDesc, 155 ACPI_OPERAND_OBJECT *DestDesc, 156 ACPI_WALK_STATE *WalkState) 157{ 158 ACPI_STATUS Status = AE_OK; 159 ACPI_OPERAND_OBJECT *RefDesc = DestDesc; 160 161 162 FUNCTION_TRACE_PTR ("ExStore", DestDesc); 163 164 165 /* Validate parameters */ 166 167 if (!ValDesc || !DestDesc) 168 { 169 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n")); 170 return_ACPI_STATUS (AE_AML_NO_OPERAND); 171 } 172 173 /* DestDesc can be either a namespace node or an ACPI object */ 174 175 if (VALID_DESCRIPTOR_TYPE (DestDesc, ACPI_DESC_TYPE_NAMED)) 176 { 177 /* 178 * Dest is a namespace node, 179 * Storing an object into a Name "container" 180 */ 181 Status = AcpiExStoreObjectToNode (ValDesc, 182 (ACPI_NAMESPACE_NODE *) DestDesc, WalkState); 183 184 /* All done, that's it */ 185 186 return_ACPI_STATUS (Status); 187 } 188 189 190 /* Destination object must be an object of type Reference */ 191 192 if (DestDesc->Common.Type != INTERNAL_TYPE_REFERENCE) 193 { 194 /* Destination is not an Reference */ 195 196 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 197 "Destination is not a ReferenceObj [%p]\n", DestDesc)); 198 199 DUMP_STACK_ENTRY (ValDesc); 200 DUMP_STACK_ENTRY (DestDesc); 201 DUMP_OPERANDS (&DestDesc, IMODE_EXECUTE, "ExStore", 202 2, "Target is not a ReferenceObj"); 203 204 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 205 } 206 207 208 /* 209 * Examine the Reference opcode. These cases are handled: 210 * 211 * 1) Store to Name (Change the object associated with a name) 212 * 2) Store to an indexed area of a Buffer or Package 213 * 3) Store to a Method Local or Arg 214 * 4) Store to the debug object 215 * 5) Store to a constant -- a noop 216 */ 217 218 switch (RefDesc->Reference.Opcode) 219 { 220 221 case AML_NAME_OP: 222 223 /* Storing an object into a Name "container" */ 224 225 Status = AcpiExStoreObjectToNode (ValDesc, RefDesc->Reference.Object, 226 WalkState); 227 break; 228 229 230 case AML_INDEX_OP: 231 232 /* Storing to an Index (pointer into a packager or buffer) */ 233 234 Status = AcpiExStoreObjectToIndex (ValDesc, RefDesc, WalkState); 235 break; 236 237 238 case AML_LOCAL_OP: 239 case AML_ARG_OP: 240 241 /* Store to a method local/arg */ 242 243 Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode, 244 RefDesc->Reference.Offset, ValDesc, WalkState); 245 break; 246 247 248 case AML_DEBUG_OP: 249 250 /* 251 * Storing to the Debug object causes the value stored to be 252 * displayed and otherwise has no effect -- see ACPI Specification 253 */ 254 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "**** Write to Debug Object: ****: \n")); 255 256 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OBJECTS, "[ACPI Debug] %s: ", 257 AcpiUtGetTypeName (ValDesc->Common.Type))); 258 259 switch (ValDesc->Common.Type) 260 { 261 case ACPI_TYPE_INTEGER: 262 263 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OBJECTS, "0x%X (%d)\n", 264 (UINT32) ValDesc->Integer.Value, (UINT32) ValDesc->Integer.Value)); 265 break; 266 267 268 case ACPI_TYPE_BUFFER: 269 270 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OBJECTS, "Length 0x%X\n", 271 (UINT32) ValDesc->Buffer.Length)); 272 break; 273 274 275 case ACPI_TYPE_STRING: 276 277 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OBJECTS, "%s\n", ValDesc->String.Pointer)); 278 break; 279 280 281 case ACPI_TYPE_PACKAGE: 282 283 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OBJECTS, "Elements - 0x%X\n", 284 (UINT32) ValDesc->Package.Elements)); 285 break; 286 287 288 default: 289 290 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OBJECTS, "@0x%p\n", ValDesc)); 291 break; 292 } 293 294 break; 295 296 297 case AML_ZERO_OP: 298 case AML_ONE_OP: 299 case AML_ONES_OP: 300 case AML_REVISION_OP: 301 302 /* 303 * Storing to a constant is a no-op -- see ACPI Specification 304 * Delete the reference descriptor, however 305 */ 306 break; 307 308 309 default: 310 311 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - Unknown Reference subtype %02x\n", 312 RefDesc->Reference.Opcode)); 313 314 /* TBD: [Restructure] use object dump routine !! */ 315 316 DUMP_BUFFER (RefDesc, sizeof (ACPI_OPERAND_OBJECT)); 317 318 Status = AE_AML_INTERNAL; 319 break; 320 321 } /* switch (RefDesc->Reference.Opcode) */ 322 323 324 /* Always delete the reference descriptor object */ 325 326 if (RefDesc) 327 { 328 AcpiUtRemoveReference (RefDesc); 329 } 330 331 return_ACPI_STATUS (Status); 332} 333 334 335/******************************************************************************* 336 * 337 * FUNCTION: AcpiExStoreObjectToIndex 338 * 339 * PARAMETERS: *ValDesc - Value to be stored 340 * *Node - Named object to receive the value 341 * 342 * RETURN: Status 343 * 344 * DESCRIPTION: Store the object to the named object. 345 * 346 ******************************************************************************/ 347 348ACPI_STATUS 349AcpiExStoreObjectToIndex ( 350 ACPI_OPERAND_OBJECT *ValDesc, 351 ACPI_OPERAND_OBJECT *DestDesc, 352 ACPI_WALK_STATE *WalkState) 353{ 354 ACPI_STATUS Status = AE_OK; 355 ACPI_OPERAND_OBJECT *ObjDesc; 356 UINT32 Length; 357 UINT32 i; 358 UINT8 Value = 0; 359 360 361 FUNCTION_TRACE ("AcpiExStoreObjectToIndex"); 362 363 364 /* 365 * Destination must be a reference pointer, and 366 * must point to either a buffer or a package 367 */ 368 369 switch (DestDesc->Reference.TargetType) 370 { 371 case ACPI_TYPE_PACKAGE: 372 /* 373 * Storing to a package element is not simple. The source must be 374 * evaluated and converted to the type of the destination and then the 375 * source is copied into the destination - we can't just point to the 376 * source object. 377 */ 378 if (DestDesc->Reference.TargetType == ACPI_TYPE_PACKAGE) 379 { 380 /* 381 * The object at *(DestDesc->Reference.Where) is the 382 * element within the package that is to be modified. 383 */ 384 ObjDesc = *(DestDesc->Reference.Where); 385 if (ObjDesc) 386 { 387 /* 388 * If the Destination element is a package, we will delete 389 * that object and construct a new one. 390 * 391 * TBD: [Investigate] Should both the src and dest be required 392 * to be packages? 393 * && (ValDesc->Common.Type == ACPI_TYPE_PACKAGE) 394 */ 395 if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE) 396 { 397 /* 398 * Take away the reference for being part of a package and 399 * delete 400 */ 401 AcpiUtRemoveReference (ObjDesc); 402 AcpiUtRemoveReference (ObjDesc); 403 404 ObjDesc = NULL; 405 } 406 } 407 408 if (!ObjDesc) 409 { 410 /* 411 * If the ObjDesc is NULL, it means that an uninitialized package 412 * element has been used as a destination (this is OK), therefore, 413 * we must create the destination element to match the type of the 414 * source element NOTE: ValDesc can be of any type. 415 */ 416 ObjDesc = AcpiUtCreateInternalObject (ValDesc->Common.Type); 417 if (!ObjDesc) 418 { 419 return_ACPI_STATUS (AE_NO_MEMORY); 420 } 421 422 /* 423 * If the source is a package, copy the source to the new dest 424 */ 425 if (ACPI_TYPE_PACKAGE == ObjDesc->Common.Type) 426 { 427 Status = AcpiUtCopyIpackageToIpackage (ValDesc, ObjDesc, WalkState); 428 if (ACPI_FAILURE (Status)) 429 { 430 AcpiUtRemoveReference (ObjDesc); 431 return_ACPI_STATUS (Status); 432 } 433 } 434 435 /* 436 * Install the new descriptor into the package and add a 437 * reference to the newly created descriptor for now being 438 * part of the parent package 439 */ 440 441 *(DestDesc->Reference.Where) = ObjDesc; 442 AcpiUtAddReference (ObjDesc); 443 } 444 445 if (ACPI_TYPE_PACKAGE != ObjDesc->Common.Type) 446 { 447 /* 448 * The destination element is not a package, so we need to 449 * convert the contents of the source (ValDesc) and copy into 450 * the destination (ObjDesc) 451 */ 452 Status = AcpiExStoreObjectToObject (ValDesc, ObjDesc, 453 WalkState); 454 if (ACPI_FAILURE (Status)) 455 { 456 /* 457 * An error occurrered when copying the internal object 458 * so delete the reference. 459 */ 460 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 461 "Unable to copy the internal object\n")); 462 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 463 } 464 } 465 } 466 break; 467 468 469 case ACPI_TYPE_BUFFER_FIELD: 470 471 472 /* TBD: can probably call the generic Buffer/Field routines */ 473 474 /* 475 * Storing into a buffer at a location defined by an Index. 476 * 477 * Each 8-bit element of the source object is written to the 478 * 8-bit Buffer Field of the Index destination object. 479 */ 480 481 /* 482 * Set the ObjDesc to the destination object and type check. 483 */ 484 ObjDesc = DestDesc->Reference.Object; 485 if (ObjDesc->Common.Type != ACPI_TYPE_BUFFER) 486 { 487 return_ACPI_STATUS (AE_AML_OPERAND_TYPE); 488 } 489 490 /* 491 * The assignment of the individual elements will be slightly 492 * different for each source type. 493 */ 494 495 switch (ValDesc->Common.Type) 496 { 497 case ACPI_TYPE_INTEGER: 498 /* 499 * Type is Integer, assign bytewise 500 * This loop to assign each of the elements is somewhat 501 * backward because of the Big Endian-ness of IA-64 502 */ 503 Length = sizeof (ACPI_INTEGER); 504 for (i = Length; i != 0; i--) 505 { 506 Value = (UINT8)(ValDesc->Integer.Value >> (MUL_8 (i - 1))); 507 ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; 508 } 509 break; 510 511 512 case ACPI_TYPE_BUFFER: 513 /* 514 * Type is Buffer, the Length is in the structure. 515 * Just loop through the elements and assign each one in turn. 516 */ 517 Length = ValDesc->Buffer.Length; 518 for (i = 0; i < Length; i++) 519 { 520 Value = ValDesc->Buffer.Pointer[i]; 521 ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; 522 } 523 break; 524 525 526 case ACPI_TYPE_STRING: 527 /* 528 * Type is String, the Length is in the structure. 529 * Just loop through the elements and assign each one in turn. 530 */ 531 Length = ValDesc->String.Length; 532 for (i = 0; i < Length; i++) 533 { 534 Value = ValDesc->String.Pointer[i]; 535 ObjDesc->Buffer.Pointer[DestDesc->Reference.Offset] = Value; 536 } 537 break; 538 539 540 default: 541 542 /* Other types are invalid */ 543 544 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, 545 "Source must be Number/Buffer/String type, not %X\n", 546 ValDesc->Common.Type)); 547 Status = AE_AML_OPERAND_TYPE; 548 break; 549 } 550 break; 551 552 553 default: 554 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Target is not a Package or BufferField\n")); 555 Status = AE_AML_OPERAND_TYPE; 556 break; 557 } 558 559 560 return_ACPI_STATUS (Status); 561} 562 563 564/******************************************************************************* 565 * 566 * FUNCTION: AcpiExStoreObjectToNode 567 * 568 * PARAMETERS: *SourceDesc - Value to be stored 569 * *Node - Named object to receive the value 570 * 571 * RETURN: Status 572 * 573 * DESCRIPTION: Store the object to the named object. 574 * 575 * The Assignment of an object to a named object is handled here 576 * The val passed in will replace the current value (if any) 577 * with the input value. 578 * 579 * When storing into an object the data is converted to the 580 * target object type then stored in the object. This means 581 * that the target object type (for an initialized target) will 582 * not be changed by a store operation. 583 * 584 * NOTE: the global lock is acquired early. This will result 585 * in the global lock being held a bit longer. Also, if the 586 * function fails during set up we may get the lock when we 587 * don't really need it. I don't think we care. 588 * 589 ******************************************************************************/ 590 591ACPI_STATUS 592AcpiExStoreObjectToNode ( 593 ACPI_OPERAND_OBJECT *SourceDesc, 594 ACPI_NAMESPACE_NODE *Node, 595 ACPI_WALK_STATE *WalkState) 596{ 597 ACPI_STATUS Status = AE_OK; 598 ACPI_OPERAND_OBJECT *TargetDesc; 599 ACPI_OBJECT_TYPE8 TargetType = ACPI_TYPE_ANY; 600 601 602 FUNCTION_TRACE ("ExStoreObjectToNode"); 603 604 /* 605 * Assuming the parameters were already validated 606 */ 607 608 609 /* 610 * Get current type of the node, and object attached to Node 611 */ 612 TargetType = AcpiNsGetType (Node); 613 TargetDesc = AcpiNsGetAttachedObject (Node); 614 615 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) into node %p(%s)\n", 616 Node, AcpiUtGetTypeName (SourceDesc->Common.Type), 617 SourceDesc, AcpiUtGetTypeName (TargetType))); 618 619 620 /* 621 * Resolve the source object to an actual value 622 * (If it is a reference object) 623 */ 624 Status = AcpiExResolveObject (&SourceDesc, TargetType, WalkState); 625 if (ACPI_FAILURE (Status)) 626 { 627 return_ACPI_STATUS (Status); 628 } 629 630 631 /* 632 * Do the actual store operation 633 */ 634 switch (TargetType) 635 { 636 case ACPI_TYPE_BUFFER_FIELD: 637 case INTERNAL_TYPE_REGION_FIELD: 638 case INTERNAL_TYPE_BANK_FIELD: 639 case INTERNAL_TYPE_INDEX_FIELD: 640 641 /* 642 * For fields, copy the source data to the target field. 643 */ 644 Status = AcpiExWriteDataToField (SourceDesc, TargetDesc); 645 break; 646 647 648 case ACPI_TYPE_INTEGER: 649 case ACPI_TYPE_STRING: 650 case ACPI_TYPE_BUFFER: 651 652 /* 653 * These target types are all of type Integer/String/Buffer, and 654 * therefore support implicit conversion before the store. 655 * 656 * Copy and/or convert the source object to a new target object 657 */ 658 Status = AcpiExStoreObject (SourceDesc, TargetType, &TargetDesc, WalkState); 659 if (ACPI_FAILURE (Status)) 660 { 661 return_ACPI_STATUS (Status); 662 } 663 664 /* 665 * Store the new TargetDesc as the new value of the Name, and set 666 * the Name's type to that of the value being stored in it. 667 * SourceDesc reference count is incremented by AttachObject. 668 */ 669 Status = AcpiNsAttachObject (Node, TargetDesc, TargetType); 670 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 671 "Store %s into %s via Convert/Attach\n", 672 AcpiUtGetTypeName (TargetDesc->Common.Type), 673 AcpiUtGetTypeName (TargetType))); 674 break; 675 676 677 default: 678 679 /* No conversions for all other types. Just attach the source object */ 680 681 Status = AcpiNsAttachObject (Node, SourceDesc, SourceDesc->Common.Type); 682 683 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, 684 "Store %s into %s via Attach only\n", 685 AcpiUtGetTypeName (SourceDesc->Common.Type), 686 AcpiUtGetTypeName (SourceDesc->Common.Type))); 687 break; 688 } 689 690 691 return_ACPI_STATUS (Status); 692} 693 694 695/******************************************************************************* 696 * 697 * FUNCTION: AcpiExStoreObjectToObject 698 * 699 * PARAMETERS: *SourceDesc - Value to be stored 700 * *DestDesc - Object to receive the value 701 * 702 * RETURN: Status 703 * 704 * DESCRIPTION: Store an object to another object. 705 * 706 * The Assignment of an object to another (not named) object 707 * is handled here. 708 * The val passed in will replace the current value (if any) 709 * with the input value. 710 * 711 * When storing into an object the data is converted to the 712 * target object type then stored in the object. This means 713 * that the target object type (for an initialized target) will 714 * not be changed by a store operation. 715 * 716 * This module allows destination types of Number, String, 717 * and Buffer. 718 * 719 ******************************************************************************/ 720 721ACPI_STATUS 722AcpiExStoreObjectToObject ( 723 ACPI_OPERAND_OBJECT *SourceDesc, 724 ACPI_OPERAND_OBJECT *DestDesc, 725 ACPI_WALK_STATE *WalkState) 726{ 727 ACPI_STATUS Status = AE_OK; 728 ACPI_OBJECT_TYPE8 DestinationType = DestDesc->Common.Type; 729 730 731 FUNCTION_TRACE ("ExStoreObjectToObject"); 732 733 734 /* 735 * Assuming the parameters are valid! 736 */ 737 738 ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Storing %p(%s) to %p(%s)\n", 739 SourceDesc, AcpiUtGetTypeName (SourceDesc->Common.Type), 740 DestDesc, AcpiUtGetTypeName (DestDesc->Common.Type))); 741 742 743 /* 744 * From this interface, we only support Integers/Strings/Buffers 745 */ 746 switch (DestinationType) 747 { 748 case ACPI_TYPE_INTEGER: 749 case ACPI_TYPE_STRING: 750 case ACPI_TYPE_BUFFER: 751 break; 752 753 default: 754 ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into %s not implemented\n", 755 AcpiUtGetTypeName (DestDesc->Common.Type))); 756 757 return_ACPI_STATUS (AE_NOT_IMPLEMENTED); 758 } 759 760 761 /* 762 * Resolve the source object to an actual value 763 * (If it is a reference object) 764 */ 765 Status = AcpiExResolveObject (&SourceDesc, DestinationType, WalkState); 766 if (ACPI_FAILURE (Status)) 767 { 768 return_ACPI_STATUS (Status); 769 } 770 771 772 /* 773 * Copy and/or convert the source object to the destination object 774 */ 775 Status = AcpiExStoreObject (SourceDesc, DestinationType, &DestDesc, WalkState); 776 777 778 return_ACPI_STATUS (Status); 779} 780 781