utobject.c (71867) | utobject.c (73561) |
---|---|
1/****************************************************************************** 2 * 3 * Module Name: cmobject - ACPI object create/delete/size/cache routines | 1/****************************************************************************** 2 * 3 * Module Name: cmobject - ACPI object create/delete/size/cache routines |
4 * $Revision: 35 $ | 4 * $Revision: 36 $ |
5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 109 unchanged lines hidden (view full) --- 122#include "actables.h" 123#include "amlcode.h" 124 125 126#define _COMPONENT MISCELLANEOUS 127 MODULE_NAME ("cmobject") 128 129 | 5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. --- 109 unchanged lines hidden (view full) --- 122#include "actables.h" 123#include "amlcode.h" 124 125 126#define _COMPONENT MISCELLANEOUS 127 MODULE_NAME ("cmobject") 128 129 |
130/****************************************************************************** | 130/******************************************************************************* |
131 * 132 * FUNCTION: _CmCreateInternalObject 133 * 134 * PARAMETERS: Address - Address of the memory to deallocate 135 * Component - Component type of caller 136 * Module - Source file name of caller 137 * Line - Line number of caller 138 * Type - ACPI Type of the new object 139 * 140 * RETURN: Object - The new object. Null on failure 141 * 142 * DESCRIPTION: Create and initialize a new internal object. 143 * | 131 * 132 * FUNCTION: _CmCreateInternalObject 133 * 134 * PARAMETERS: Address - Address of the memory to deallocate 135 * Component - Component type of caller 136 * Module - Source file name of caller 137 * Line - Line number of caller 138 * Type - ACPI Type of the new object 139 * 140 * RETURN: Object - The new object. Null on failure 141 * 142 * DESCRIPTION: Create and initialize a new internal object. 143 * |
144 * NOTE: 145 * We always allocate the worst-case object descriptor because these 146 * objects are cached, and we want them to be one-size-satisifies-any-request. 147 * This in itself may not be the most memory efficient, but the efficiency 148 * of the object cache should more than make up for this! | 144 * NOTE: We always allocate the worst-case object descriptor because 145 * these objects are cached, and we want them to be 146 * one-size-satisifies-any-request. This in itself may not be 147 * the most memory efficient, but the efficiency of the object 148 * cache should more than make up for this! |
149 * 150 ******************************************************************************/ 151 152ACPI_OPERAND_OBJECT * 153_CmCreateInternalObject ( 154 NATIVE_CHAR *ModuleName, 155 UINT32 LineNumber, 156 UINT32 ComponentId, --- 25 unchanged lines hidden (view full) --- 182 183 /* Any per-type initialization should go here */ 184 185 186 return_PTR (Object); 187} 188 189 | 149 * 150 ******************************************************************************/ 151 152ACPI_OPERAND_OBJECT * 153_CmCreateInternalObject ( 154 NATIVE_CHAR *ModuleName, 155 UINT32 LineNumber, 156 UINT32 ComponentId, --- 25 unchanged lines hidden (view full) --- 182 183 /* Any per-type initialization should go here */ 184 185 186 return_PTR (Object); 187} 188 189 |
190/****************************************************************************** | 190/******************************************************************************* |
191 * 192 * FUNCTION: AcpiCmValidInternalObject 193 * 194 * PARAMETERS: Operand - Object to be validated 195 * 196 * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT 197 * | 191 * 192 * FUNCTION: AcpiCmValidInternalObject 193 * 194 * PARAMETERS: Operand - Object to be validated 195 * 196 * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT 197 * |
198 *****************************************************************************/ | 198 ******************************************************************************/ |
199 200BOOLEAN 201AcpiCmValidInternalObject ( 202 void *Object) 203{ 204 205 /* Check for a null pointer */ 206 --- 45 unchanged lines hidden (view full) --- 252 253 254 /* The object appears to be a valid ACPI_OPERAND_OBJECT */ 255 256 return (TRUE); 257} 258 259 | 199 200BOOLEAN 201AcpiCmValidInternalObject ( 202 void *Object) 203{ 204 205 /* Check for a null pointer */ 206 --- 45 unchanged lines hidden (view full) --- 252 253 254 /* The object appears to be a valid ACPI_OPERAND_OBJECT */ 255 256 return (TRUE); 257} 258 259 |
260/***************************************************************************** | 260/******************************************************************************* |
261 * 262 * FUNCTION: _CmAllocateObjectDesc 263 * 264 * PARAMETERS: ModuleName - Caller's module name (for error output) 265 * LineNumber - Caller's line number (for error output) 266 * ComponentId - Caller's component ID (for error output) 267 * Message - Error message to use on failure 268 * 269 * RETURN: Pointer to newly allocated object descriptor. Null on error 270 * 271 * DESCRIPTION: Allocate a new object descriptor. Gracefully handle 272 * error conditions. 273 * | 261 * 262 * FUNCTION: _CmAllocateObjectDesc 263 * 264 * PARAMETERS: ModuleName - Caller's module name (for error output) 265 * LineNumber - Caller's line number (for error output) 266 * ComponentId - Caller's component ID (for error output) 267 * Message - Error message to use on failure 268 * 269 * RETURN: Pointer to newly allocated object descriptor. Null on error 270 * 271 * DESCRIPTION: Allocate a new object descriptor. Gracefully handle 272 * error conditions. 273 * |
274 ****************************************************************************/ | 274 ******************************************************************************/ |
275 276void * 277_CmAllocateObjectDesc ( 278 NATIVE_CHAR *ModuleName, 279 UINT32 LineNumber, 280 UINT32 ComponentId) 281{ 282 ACPI_OPERAND_OBJECT *Object; --- 53 unchanged lines hidden (view full) --- 336 337 DEBUG_PRINT (TRACE_ALLOCATIONS, ("AllocateObjectDesc: %p Size %X\n", 338 Object, sizeof (ACPI_OPERAND_OBJECT))); 339 340 return_PTR (Object); 341} 342 343 | 275 276void * 277_CmAllocateObjectDesc ( 278 NATIVE_CHAR *ModuleName, 279 UINT32 LineNumber, 280 UINT32 ComponentId) 281{ 282 ACPI_OPERAND_OBJECT *Object; --- 53 unchanged lines hidden (view full) --- 336 337 DEBUG_PRINT (TRACE_ALLOCATIONS, ("AllocateObjectDesc: %p Size %X\n", 338 Object, sizeof (ACPI_OPERAND_OBJECT))); 339 340 return_PTR (Object); 341} 342 343 |
344/***************************************************************************** | 344/******************************************************************************* |
345 * 346 * FUNCTION: AcpiCmDeleteObjectDesc 347 * 348 * PARAMETERS: Object - Acpi internal object to be deleted 349 * 350 * RETURN: None. 351 * 352 * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache 353 * | 345 * 346 * FUNCTION: AcpiCmDeleteObjectDesc 347 * 348 * PARAMETERS: Object - Acpi internal object to be deleted 349 * 350 * RETURN: None. 351 * 352 * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache 353 * |
354 ****************************************************************************/ | 354 ******************************************************************************/ |
355 356void 357AcpiCmDeleteObjectDesc ( 358 ACPI_OPERAND_OBJECT *Object) 359{ 360 361 FUNCTION_TRACE_PTR ("AcpiCmDeleteObjectDesc", Object); 362 --- 46 unchanged lines hidden (view full) --- 409 AcpiGbl_ObjectCacheDepth++; 410 411 412 AcpiCmReleaseMutex (ACPI_MTX_CACHES); 413 return_VOID; 414} 415 416 | 355 356void 357AcpiCmDeleteObjectDesc ( 358 ACPI_OPERAND_OBJECT *Object) 359{ 360 361 FUNCTION_TRACE_PTR ("AcpiCmDeleteObjectDesc", Object); 362 --- 46 unchanged lines hidden (view full) --- 409 AcpiGbl_ObjectCacheDepth++; 410 411 412 AcpiCmReleaseMutex (ACPI_MTX_CACHES); 413 return_VOID; 414} 415 416 |
417/****************************************************************************** | 417/******************************************************************************* |
418 * 419 * FUNCTION: AcpiCmDeleteObjectCache 420 * 421 * PARAMETERS: None 422 * 423 * RETURN: Status 424 * 425 * DESCRIPTION: Purge the global state object cache. Used during subsystem --- 30 unchanged lines hidden (view full) --- 456 AcpiGbl_ObjectCache = Next; 457 AcpiGbl_ObjectCacheDepth--; 458 } 459 460 return_VOID; 461} 462 463 | 418 * 419 * FUNCTION: AcpiCmDeleteObjectCache 420 * 421 * PARAMETERS: None 422 * 423 * RETURN: Status 424 * 425 * DESCRIPTION: Purge the global state object cache. Used during subsystem --- 30 unchanged lines hidden (view full) --- 456 AcpiGbl_ObjectCache = Next; 457 AcpiGbl_ObjectCacheDepth--; 458 } 459 460 return_VOID; 461} 462 463 |
464/***************************************************************************** | 464/******************************************************************************* |
465 * 466 * FUNCTION: AcpiCmInitStaticObject 467 * 468 * PARAMETERS: ObjDesc - Pointer to a "static" object - on stack 469 * or in the data segment. 470 * 471 * RETURN: None. 472 * 473 * DESCRIPTION: Initialize a static object. Sets flags to disallow dynamic 474 * deletion of the object. 475 * | 465 * 466 * FUNCTION: AcpiCmInitStaticObject 467 * 468 * PARAMETERS: ObjDesc - Pointer to a "static" object - on stack 469 * or in the data segment. 470 * 471 * RETURN: None. 472 * 473 * DESCRIPTION: Initialize a static object. Sets flags to disallow dynamic 474 * deletion of the object. 475 * |
476 ****************************************************************************/ | 476 ******************************************************************************/ |
477 478void 479AcpiCmInitStaticObject ( 480 ACPI_OPERAND_OBJECT *ObjDesc) 481{ 482 483 FUNCTION_TRACE_PTR ("CmInitStaticObject", ObjDesc); 484 --- 22 unchanged lines hidden (view full) --- 507 ObjDesc->Common.DataType = ACPI_DESC_TYPE_INTERNAL; 508 ObjDesc->Common.Flags = AOPOBJ_STATIC_ALLOCATION; 509 ObjDesc->Common.ReferenceCount = 1; 510 511 return_VOID; 512} 513 514 | 477 478void 479AcpiCmInitStaticObject ( 480 ACPI_OPERAND_OBJECT *ObjDesc) 481{ 482 483 FUNCTION_TRACE_PTR ("CmInitStaticObject", ObjDesc); 484 --- 22 unchanged lines hidden (view full) --- 507 ObjDesc->Common.DataType = ACPI_DESC_TYPE_INTERNAL; 508 ObjDesc->Common.Flags = AOPOBJ_STATIC_ALLOCATION; 509 ObjDesc->Common.ReferenceCount = 1; 510 511 return_VOID; 512} 513 514 |
515/****************************************************************************** | 515/******************************************************************************* |
516 * 517 * FUNCTION: AcpiCmGetSimpleObjectSize 518 * | 516 * 517 * FUNCTION: AcpiCmGetSimpleObjectSize 518 * |
519 * PARAMETERS: *InternalObj - Pointer to the object we are examining 520 * *RetLength - Where the length is returned | 519 * PARAMETERS: *InternalObject - Pointer to the object we are examining 520 * *RetLength - Where the length is returned |
521 * | 521 * |
522 * RETURN: Status - the status of the call | 522 * RETURN: Status |
523 * 524 * DESCRIPTION: This function is called to determine the space required to 525 * contain a simple object for return to an API user. 526 * 527 * The length includes the object structure plus any additional 528 * needed space. 529 * 530 ******************************************************************************/ 531 532ACPI_STATUS 533AcpiCmGetSimpleObjectSize ( | 523 * 524 * DESCRIPTION: This function is called to determine the space required to 525 * contain a simple object for return to an API user. 526 * 527 * The length includes the object structure plus any additional 528 * needed space. 529 * 530 ******************************************************************************/ 531 532ACPI_STATUS 533AcpiCmGetSimpleObjectSize ( |
534 ACPI_OPERAND_OBJECT *InternalObj, | 534 ACPI_OPERAND_OBJECT *InternalObject, |
535 UINT32 *ObjLength) 536{ 537 UINT32 Length; 538 ACPI_STATUS Status = AE_OK; 539 540 | 535 UINT32 *ObjLength) 536{ 537 UINT32 Length; 538 ACPI_STATUS Status = AE_OK; 539 540 |
541 FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObj); | 541 FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObject); |
542 543 544 /* Handle a null object (Could be a uninitialized package element -- which is legal) */ 545 | 542 543 544 /* Handle a null object (Could be a uninitialized package element -- which is legal) */ 545 |
546 if (!InternalObj) | 546 if (!InternalObject) |
547 { 548 *ObjLength = 0; 549 return_ACPI_STATUS (AE_OK); 550 } 551 552 553 /* Start with the length of the Acpi object */ 554 555 Length = sizeof (ACPI_OBJECT); 556 | 547 { 548 *ObjLength = 0; 549 return_ACPI_STATUS (AE_OK); 550 } 551 552 553 /* Start with the length of the Acpi object */ 554 555 Length = sizeof (ACPI_OBJECT); 556 |
557 if (VALID_DESCRIPTOR_TYPE (InternalObj, ACPI_DESC_TYPE_NAMED)) | 557 if (VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_NAMED)) |
558 { 559 /* Object is a named object (reference), just return the length */ 560 561 *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); 562 return_ACPI_STATUS (Status); 563 } 564 565 566 /* 567 * The final length depends on the object type 568 * Strings and Buffers are packed right up against the parent object and 569 * must be accessed bytewise or there may be alignment problems. 570 * 571 * TBD:[Investigate] do strings and buffers require alignment also? 572 */ 573 | 558 { 559 /* Object is a named object (reference), just return the length */ 560 561 *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); 562 return_ACPI_STATUS (Status); 563 } 564 565 566 /* 567 * The final length depends on the object type 568 * Strings and Buffers are packed right up against the parent object and 569 * must be accessed bytewise or there may be alignment problems. 570 * 571 * TBD:[Investigate] do strings and buffers require alignment also? 572 */ 573 |
574 switch (InternalObj->Common.Type) | 574 switch (InternalObject->Common.Type) |
575 { 576 577 case ACPI_TYPE_STRING: 578 | 575 { 576 577 case ACPI_TYPE_STRING: 578 |
579 Length += InternalObj->String.Length + 1; | 579 Length += InternalObject->String.Length + 1; |
580 break; 581 582 583 case ACPI_TYPE_BUFFER: 584 | 580 break; 581 582 583 case ACPI_TYPE_BUFFER: 584 |
585 Length += InternalObj->Buffer.Length; | 585 Length += InternalObject->Buffer.Length; |
586 break; 587 588 589 case ACPI_TYPE_INTEGER: 590 case ACPI_TYPE_PROCESSOR: 591 case ACPI_TYPE_POWER: 592 593 /* 594 * No extra data for these types 595 */ 596 break; 597 598 599 case INTERNAL_TYPE_REFERENCE: 600 601 /* 602 * The only type that should be here is opcode AML_NAMEPATH_OP -- since 603 * this means an object reference 604 */ | 586 break; 587 588 589 case ACPI_TYPE_INTEGER: 590 case ACPI_TYPE_PROCESSOR: 591 case ACPI_TYPE_POWER: 592 593 /* 594 * No extra data for these types 595 */ 596 break; 597 598 599 case INTERNAL_TYPE_REFERENCE: 600 601 /* 602 * The only type that should be here is opcode AML_NAMEPATH_OP -- since 603 * this means an object reference 604 */ |
605 if (InternalObj->Reference.OpCode != AML_NAMEPATH_OP) | 605 if (InternalObject->Reference.OpCode != AML_NAMEPATH_OP) |
606 { 607 DEBUG_PRINT (ACPI_ERROR, 608 ("CmGetSimpleObjectSize: Unsupported Reference opcode=%X in object %p\n", | 606 { 607 DEBUG_PRINT (ACPI_ERROR, 608 ("CmGetSimpleObjectSize: Unsupported Reference opcode=%X in object %p\n", |
609 InternalObj->Reference.OpCode, InternalObj)); | 609 InternalObject->Reference.OpCode, InternalObject)); |
610 Status = AE_TYPE; 611 } 612 break; 613 614 615 default: 616 617 DEBUG_PRINT (ACPI_ERROR, 618 ("CmGetSimpleObjectSize: Unsupported type=%X in object %p\n", | 610 Status = AE_TYPE; 611 } 612 break; 613 614 615 default: 616 617 DEBUG_PRINT (ACPI_ERROR, 618 ("CmGetSimpleObjectSize: Unsupported type=%X in object %p\n", |
619 InternalObj->Common.Type, InternalObj)); | 619 InternalObject->Common.Type, InternalObject)); |
620 Status = AE_TYPE; 621 break; 622 } 623 624 625 /* 626 * Account for the space required by the object rounded up to the next 627 * multiple of the machine word size. This keeps each object aligned 628 * on a machine word boundary. (preventing alignment faults on some 629 * machines.) 630 */ 631 *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); 632 633 return_ACPI_STATUS (Status); 634} 635 636 | 620 Status = AE_TYPE; 621 break; 622 } 623 624 625 /* 626 * Account for the space required by the object rounded up to the next 627 * multiple of the machine word size. This keeps each object aligned 628 * on a machine word boundary. (preventing alignment faults on some 629 * machines.) 630 */ 631 *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); 632 633 return_ACPI_STATUS (Status); 634} 635 636 |
637/****************************************************************************** | 637/******************************************************************************* |
638 * | 638 * |
639 * FUNCTION: AcpiCmGetPackageObjectSize | 639 * FUNCTION: AcpiCmCopyPackageToInternal |
640 * | 640 * |
641 * PARAMETERS: *InternalObj - Pointer to the object we are examining 642 * *RetLength - Where the length is returned | 641 * PARAMETERS: ACPI_PKG_CALLBACK |
643 * 644 * RETURN: Status - the status of the call 645 * | 642 * 643 * RETURN: Status - the status of the call 644 * |
646 * DESCRIPTION: This function is called to determine the space required to contain 647 * a package object for return to an API user. | 645 * DESCRIPTION: |
648 * | 646 * |
649 * This is moderately complex since a package contains other objects 650 * including packages. 651 * | |
652 ******************************************************************************/ 653 654ACPI_STATUS | 647 ******************************************************************************/ 648 649ACPI_STATUS |
655AcpiCmGetPackageObjectSize ( 656 ACPI_OPERAND_OBJECT *InternalObj, 657 UINT32 *ObjLength) | 650AcpiCmGetElementLength ( 651 UINT8 ObjectType, 652 ACPI_OPERAND_OBJECT *SourceObject, 653 ACPI_GENERIC_STATE *State, 654 void *Context) |
658{ | 655{ |
659 660 ACPI_OPERAND_OBJECT *ThisInternalObj; 661 ACPI_OPERAND_OBJECT *ParentObj[MAX_PACKAGE_DEPTH]; 662 ACPI_OPERAND_OBJECT *ThisParent; 663 UINT32 ThisIndex; 664 UINT32 Index[MAX_PACKAGE_DEPTH]; 665 UINT32 Length = 0; | 656 ACPI_STATUS Status = AE_OK; 657 ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; |
666 UINT32 ObjectSpace; | 658 UINT32 ObjectSpace; |
667 UINT32 CurrentDepth = 0; 668 UINT32 PackageCount = 1; 669 ACPI_STATUS Status; | |
670 671 | 659 660 |
672 FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObj); | 661 switch (ObjectType) 662 { 663 case 0: |
673 | 664 |
665 /* 666 * Simple object - just get the size (Null object/entry is handled 667 * here also) and sum it into the running package length 668 */ 669 Status = AcpiCmGetSimpleObjectSize (SourceObject, &ObjectSpace); 670 if (ACPI_FAILURE (Status)) 671 { 672 return (Status); 673 } |
|
674 | 674 |
675 /* Init the package stack TBD: replace with linked list */ | 675 Info->Length += ObjectSpace; 676 break; |
676 | 677 |
677 MEMSET(ParentObj, 0, MAX_PACKAGE_DEPTH); 678 MEMSET(Index, 0, MAX_PACKAGE_DEPTH); | |
679 | 678 |
680 ParentObj[0] = InternalObj; | 679 case 1: 680 /* Package - nothing much to do here, let the walk handle it */ |
681 | 681 |
682 while (1) 683 { 684 ThisParent = ParentObj[CurrentDepth]; 685 ThisIndex = Index[CurrentDepth]; 686 ThisInternalObj = ThisParent->Package.Elements[ThisIndex]; | 682 Info->NumPackages++; 683 State->Pkg.ThisTargetObj = NULL; 684 break; |
687 | 685 |
686 default: 687 return (AE_BAD_PARAMETER); 688 } |
|
688 | 689 |
689 /* 690 * Check for 1) An uninitialized package element. It is completely 691 * legal to declare a package and leave it uninitialized 692 * 2) Any type other than a package. Packages are handled 693 * below. 694 */ | |
695 | 690 |
696 if ((!ThisInternalObj) || 697 (!IS_THIS_OBJECT_TYPE (ThisInternalObj, ACPI_TYPE_PACKAGE))) 698 { 699 /* 700 * Simple object - just get the size (Null object/entry handled 701 * also) 702 */ | 691 return (Status); 692} |
703 | 693 |
704 Status = 705 AcpiCmGetSimpleObjectSize (ThisInternalObj, &ObjectSpace); | |
706 | 694 |
707 if (ACPI_FAILURE (Status)) 708 { 709 return_ACPI_STATUS (Status); 710 } | 695/******************************************************************************* 696 * 697 * FUNCTION: AcpiCmGetPackageObjectSize 698 * 699 * PARAMETERS: *InternalObject - Pointer to the object we are examining 700 * *RetLength - Where the length is returned 701 * 702 * RETURN: Status 703 * 704 * DESCRIPTION: This function is called to determine the space required to 705 * contain a package object for return to an API user. 706 * 707 * This is moderately complex since a package contains other 708 * objects including packages. 709 * 710 ******************************************************************************/ |
711 | 711 |
712 Length += ObjectSpace; | 712ACPI_STATUS 713AcpiCmGetPackageObjectSize ( 714 ACPI_OPERAND_OBJECT *InternalObject, 715 UINT32 *ObjLength) 716{ 717 ACPI_STATUS Status; 718 ACPI_PKG_INFO Info; |
713 | 719 |
714 Index[CurrentDepth]++; 715 while (Index[CurrentDepth] >= 716 ParentObj[CurrentDepth]->Package.Count) 717 { 718 /* 719 * We've handled all of the objects at 720 * this level, This means that we have 721 * just completed a package. That package 722 * may have contained one or more packages 723 * itself. 724 */ 725 if (CurrentDepth == 0) 726 { 727 /* 728 * We have handled all of the objects 729 * in the top level package just add the 730 * length of the package objects and 731 * get out. Round up to the next machine 732 * word. 733 */ 734 Length += 735 ROUND_UP_TO_NATIVE_WORD ( 736 sizeof (ACPI_OBJECT)) * 737 PackageCount; | |
738 | 720 |
739 *ObjLength = Length; | 721 FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObject); |
740 | 722 |
741 return_ACPI_STATUS (AE_OK); 742 } | |
743 | 723 |
744 /* 745 * Go back up a level and move the index 746 * past the just completed package object. 747 */ 748 CurrentDepth--; 749 Index[CurrentDepth]++; 750 } 751 } | 724 Info.Length = 0; 725 Info.ObjectSpace = 0; 726 Info.NumPackages = 1; |
752 | 727 |
753 else 754 { 755 /* 756 * This object is a package 757 * -- go one level deeper 758 */ 759 PackageCount++; 760 if (CurrentDepth < MAX_PACKAGE_DEPTH-1) 761 { 762 CurrentDepth++; 763 ParentObj[CurrentDepth] = ThisInternalObj; 764 Index[CurrentDepth] = 0; 765 } | 728 Status = AcpiCmWalkPackageTree (InternalObject, NULL, 729 AcpiCmGetElementLength, &Info); |
766 | 730 |
767 else 768 { 769 /* 770 * Too many nested levels of packages for us 771 * to handle 772 */ | 731 /* 732 * We have handled all of the objects in all levels of the package. 733 * just add the length of the package objects themselves. 734 * Round up to the next machine word. 735 */ 736 Info.Length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) * 737 Info.NumPackages; |
773 | 738 |
774 DEBUG_PRINT (ACPI_ERROR, 775 ("CmGetPackageObjectSize: Pkg nested too deep (max %X)\n", 776 MAX_PACKAGE_DEPTH)); 777 return_ACPI_STATUS (AE_LIMIT); 778 } 779 } 780 } | 739 /* Return the total package length */ 740 741 *ObjLength = Info.Length; 742 return_ACPI_STATUS (Status); |
781} 782 783 | 743} 744 745 |
784/****************************************************************************** | 746 747/******************************************************************************* |
785 * 786 * FUNCTION: AcpiCmGetObjectSize 787 * | 748 * 749 * FUNCTION: AcpiCmGetObjectSize 750 * |
788 * PARAMETERS: *InternalObj - Pointer to the object we are examining 789 * *RetLength - Where the length will be returned | 751 * PARAMETERS: *InternalObject - Pointer to the object we are examining 752 * *RetLength - Where the length will be returned |
790 * | 753 * |
791 * RETURN: Status - the status of the call | 754 * RETURN: Status |
792 * 793 * DESCRIPTION: This function is called to determine the space required to 794 * contain an object for return to an API user. 795 * 796 ******************************************************************************/ 797 798ACPI_STATUS 799AcpiCmGetObjectSize( | 755 * 756 * DESCRIPTION: This function is called to determine the space required to 757 * contain an object for return to an API user. 758 * 759 ******************************************************************************/ 760 761ACPI_STATUS 762AcpiCmGetObjectSize( |
800 ACPI_OPERAND_OBJECT *InternalObj, | 763 ACPI_OPERAND_OBJECT *InternalObject, |
801 UINT32 *ObjLength) 802{ 803 ACPI_STATUS Status; 804 805 | 764 UINT32 *ObjLength) 765{ 766 ACPI_STATUS Status; 767 768 |
806 if ((VALID_DESCRIPTOR_TYPE (InternalObj, ACPI_DESC_TYPE_INTERNAL)) && 807 (IS_THIS_OBJECT_TYPE (InternalObj, ACPI_TYPE_PACKAGE))) | 769 if ((VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_INTERNAL)) && 770 (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE))) |
808 { | 771 { |
809 Status = 810 AcpiCmGetPackageObjectSize (InternalObj, ObjLength); | 772 Status = AcpiCmGetPackageObjectSize (InternalObject, ObjLength); |
811 } 812 813 else 814 { | 773 } 774 775 else 776 { |
815 Status = 816 AcpiCmGetSimpleObjectSize (InternalObj, ObjLength); | 777 Status = AcpiCmGetSimpleObjectSize (InternalObject, ObjLength); |
817 } 818 819 return (Status); 820} 821 822 | 778 } 779 780 return (Status); 781} 782 783 |