Print this page
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/utilities/utobject.c
          +++ new/usr/src/common/acpica/components/utilities/utobject.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: utobject - ACPI object create/delete/size/cache routines
   4    4   *
   5    5   *****************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2013, Intel Corp.
   9    9   * All rights reserved.
  10   10   *
  11   11   * Redistribution and use in source and binary forms, with or without
  12   12   * modification, are permitted provided that the following conditions
  13   13   * are met:
  14   14   * 1. Redistributions of source code must retain the above copyright
  15   15   *    notice, this list of conditions, and the following disclaimer,
  16   16   *    without modification.
  17   17   * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18   18   *    substantially similar to the "NO WARRANTY" disclaimer below
↓ open down ↓ 60 lines elided ↑ open up ↑
  79   79   *              LineNumber          - Line number of caller
  80   80   *              ComponentId         - Component type of caller
  81   81   *              Type                - ACPI Type of the new object
  82   82   *
  83   83   * RETURN:      A new internal object, null on failure
  84   84   *
  85   85   * DESCRIPTION: Create and initialize a new internal object.
  86   86   *
  87   87   * NOTE:        We always allocate the worst-case object descriptor because
  88   88   *              these objects are cached, and we want them to be
  89      - *              one-size-satisifies-any-request.  This in itself may not be
       89 + *              one-size-satisifies-any-request. This in itself may not be
  90   90   *              the most memory efficient, but the efficiency of the object
  91   91   *              cache should more than make up for this!
  92   92   *
  93   93   ******************************************************************************/
  94   94  
  95   95  ACPI_OPERAND_OBJECT  *
  96   96  AcpiUtCreateInternalObjectDbg (
  97   97      const char              *ModuleName,
  98   98      UINT32                  LineNumber,
  99   99      UINT32                  ComponentId,
↓ open down ↓ 33 lines elided ↑ open up ↑
 133  133  
 134  134          SecondObject->Common.Type = ACPI_TYPE_LOCAL_EXTRA;
 135  135          SecondObject->Common.ReferenceCount = 1;
 136  136  
 137  137          /* Link the second object to the first */
 138  138  
 139  139          Object->Common.NextObject = SecondObject;
 140  140          break;
 141  141  
 142  142      default:
      143 +
 143  144          /* All others have no secondary object */
 144  145          break;
 145  146      }
 146  147  
 147  148      /* Save the object type in the object descriptor */
 148  149  
 149  150      Object->Common.Type = (UINT8) Type;
 150  151  
 151  152      /* Init the reference count */
 152  153  
↓ open down ↓ 206 lines elided ↑ open up ↑
 359  360  
 360  361  
 361  362  /*******************************************************************************
 362  363   *
 363  364   * FUNCTION:    AcpiUtValidInternalObject
 364  365   *
 365  366   * PARAMETERS:  Object              - Object to be validated
 366  367   *
 367  368   * RETURN:      TRUE if object is valid, FALSE otherwise
 368  369   *
 369      - * DESCRIPTION: Validate a pointer to be an ACPI_OPERAND_OBJECT
      370 + * DESCRIPTION: Validate a pointer to be of type ACPI_OPERAND_OBJECT
 370  371   *
 371  372   ******************************************************************************/
 372  373  
 373  374  BOOLEAN
 374  375  AcpiUtValidInternalObject (
 375  376      void                    *Object)
 376  377  {
 377  378  
 378  379      ACPI_FUNCTION_NAME (UtValidInternalObject);
 379  380  
↓ open down ↓ 5 lines elided ↑ open up ↑
 385  386          ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** Null Object Ptr\n"));
 386  387          return (FALSE);
 387  388      }
 388  389  
 389  390      /* Check the descriptor type field */
 390  391  
 391  392      switch (ACPI_GET_DESCRIPTOR_TYPE (Object))
 392  393      {
 393  394      case ACPI_DESC_TYPE_OPERAND:
 394  395  
 395      -        /* The object appears to be a valid ACPI_OPERAND_OBJECT  */
      396 +        /* The object appears to be a valid ACPI_OPERAND_OBJECT */
 396  397  
 397  398          return (TRUE);
 398  399  
 399  400      default:
      401 +
 400  402          ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
 401  403                  "%p is not not an ACPI operand obj [%s]\n",
 402  404                  Object, AcpiUtGetDescriptorName (Object)));
 403  405          break;
 404  406      }
 405  407  
 406  408      return (FALSE);
 407  409  }
 408  410  
 409  411  
 410  412  /*******************************************************************************
 411  413   *
 412  414   * FUNCTION:    AcpiUtAllocateObjectDescDbg
 413  415   *
 414  416   * PARAMETERS:  ModuleName          - Caller's module name (for error output)
 415  417   *              LineNumber          - Caller's line number (for error output)
 416  418   *              ComponentId         - Caller's component ID (for error output)
 417  419   *
 418      - * RETURN:      Pointer to newly allocated object descriptor.  Null on error
      420 + * RETURN:      Pointer to newly allocated object descriptor. Null on error
 419  421   *
 420      - * DESCRIPTION: Allocate a new object descriptor.  Gracefully handle
      422 + * DESCRIPTION: Allocate a new object descriptor. Gracefully handle
 421  423   *              error conditions.
 422  424   *
 423  425   ******************************************************************************/
 424  426  
 425  427  void *
 426  428  AcpiUtAllocateObjectDescDbg (
 427  429      const char              *ModuleName,
 428  430      UINT32                  LineNumber,
 429  431      UINT32                  ComponentId)
 430  432  {
↓ open down ↓ 35 lines elided ↑ open up ↑
 466  468   *
 467  469   ******************************************************************************/
 468  470  
 469  471  void
 470  472  AcpiUtDeleteObjectDesc (
 471  473      ACPI_OPERAND_OBJECT     *Object)
 472  474  {
 473  475      ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object);
 474  476  
 475  477  
 476      -    /* Object must be an ACPI_OPERAND_OBJECT  */
      478 +    /* Object must be of type ACPI_OPERAND_OBJECT */
 477  479  
 478  480      if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
 479  481      {
 480  482          ACPI_ERROR ((AE_INFO,
 481  483              "%p is not an ACPI Operand object [%s]", Object,
 482  484              AcpiUtGetDescriptorName (Object)));
 483  485          return_VOID;
 484  486      }
 485  487  
 486  488      (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object);
↓ open down ↓ 62 lines elided ↑ open up ↑
 549  551       * must be accessed bytewise or there may be alignment problems on
 550  552       * certain processors
 551  553       */
 552  554      switch (InternalObject->Common.Type)
 553  555      {
 554  556      case ACPI_TYPE_STRING:
 555  557  
 556  558          Length += (ACPI_SIZE) InternalObject->String.Length + 1;
 557  559          break;
 558  560  
 559      -
 560  561      case ACPI_TYPE_BUFFER:
 561  562  
 562  563          Length += (ACPI_SIZE) InternalObject->Buffer.Length;
 563  564          break;
 564  565  
 565      -
 566  566      case ACPI_TYPE_INTEGER:
 567  567      case ACPI_TYPE_PROCESSOR:
 568  568      case ACPI_TYPE_POWER:
 569  569  
 570  570          /* No extra data for these types */
 571  571  
 572  572          break;
 573  573  
 574      -
 575  574      case ACPI_TYPE_LOCAL_REFERENCE:
 576  575  
 577  576          switch (InternalObject->Reference.Class)
 578  577          {
 579  578          case ACPI_REFCLASS_NAME:
 580      -
 581  579              /*
 582  580               * Get the actual length of the full pathname to this object.
 583  581               * The reference will be converted to the pathname to the object
 584  582               */
 585  583              Size = AcpiNsGetPathnameLength (InternalObject->Reference.Node);
 586  584              if (!Size)
 587  585              {
 588  586                  return_ACPI_STATUS (AE_BAD_PARAMETER);
 589  587              }
 590  588  
 591  589              Length += ACPI_ROUND_UP_TO_NATIVE_WORD (Size);
 592  590              break;
 593  591  
 594  592          default:
 595      -
 596  593              /*
 597  594               * No other reference opcodes are supported.
 598  595               * Notably, Locals and Args are not supported, but this may be
 599  596               * required eventually.
 600  597               */
 601  598              ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
 602  599                  "unsupported Reference Class [%s] 0x%X in object %p",
 603  600                  AcpiUtGetReferenceName (InternalObject),
 604  601                  InternalObject->Reference.Class, InternalObject));
 605  602              Status = AE_TYPE;
 606  603              break;
 607  604          }
 608  605          break;
 609  606  
 610      -
 611  607      default:
 612  608  
 613  609          ACPI_ERROR ((AE_INFO, "Cannot convert to external object - "
 614  610              "unsupported type [%s] 0x%X in object %p",
 615  611              AcpiUtGetObjectTypeName (InternalObject),
 616  612              InternalObject->Common.Type, InternalObject));
 617  613          Status = AE_TYPE;
 618  614          break;
 619  615      }
 620  616  
 621  617      /*
 622  618       * Account for the space required by the object rounded up to the next
 623      -     * multiple of the machine word size.  This keeps each object aligned
      619 +     * multiple of the machine word size. This keeps each object aligned
 624  620       * on a machine word boundary. (preventing alignment faults on some
 625  621       * machines.)
 626  622       */
 627  623      *ObjLength = ACPI_ROUND_UP_TO_NATIVE_WORD (Length);
 628  624      return_ACPI_STATUS (Status);
 629  625  }
 630  626  
 631  627  
 632  628  /*******************************************************************************
 633  629   *
↓ open down ↓ 15 lines elided ↑ open up ↑
 649  645      void                    *Context)
 650  646  {
 651  647      ACPI_STATUS             Status = AE_OK;
 652  648      ACPI_PKG_INFO           *Info = (ACPI_PKG_INFO *) Context;
 653  649      ACPI_SIZE               ObjectSpace;
 654  650  
 655  651  
 656  652      switch (ObjectType)
 657  653      {
 658  654      case ACPI_COPY_TYPE_SIMPLE:
 659      -
 660  655          /*
 661  656           * Simple object - just get the size (Null object/entry is handled
 662  657           * here also) and sum it into the running package length
 663  658           */
 664  659          Status = AcpiUtGetSimpleObjectSize (SourceObject, &ObjectSpace);
 665  660          if (ACPI_FAILURE (Status))
 666  661          {
 667  662              return (Status);
 668  663          }
 669  664  
 670  665          Info->Length += ObjectSpace;
 671  666          break;
 672  667  
 673      -
 674  668      case ACPI_COPY_TYPE_PACKAGE:
 675  669  
 676  670          /* Package object - nothing much to do here, let the walk handle it */
 677  671  
 678  672          Info->NumPackages++;
 679  673          State->Pkg.ThisTargetObj = NULL;
 680  674          break;
 681  675  
 682      -
 683  676      default:
 684  677  
 685  678          /* No other types allowed */
 686  679  
 687  680          return (AE_BAD_PARAMETER);
 688  681      }
 689  682  
 690  683      return (Status);
 691  684  }
 692  685  
↓ open down ↓ 25 lines elided ↑ open up ↑
 718  711  
 719  712  
 720  713      ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject);
 721  714  
 722  715  
 723  716      Info.Length      = 0;
 724  717      Info.ObjectSpace = 0;
 725  718      Info.NumPackages = 1;
 726  719  
 727  720      Status = AcpiUtWalkPackageTree (InternalObject, NULL,
 728      -                            AcpiUtGetElementLength, &Info);
      721 +        AcpiUtGetElementLength, &Info);
 729  722      if (ACPI_FAILURE (Status))
 730  723      {
 731  724          return_ACPI_STATUS (Status);
 732  725      }
 733  726  
 734  727      /*
 735  728       * We have handled all of the objects in all levels of the package.
 736  729       * just add the length of the package objects themselves.
 737  730       * Round up to the next machine word.
 738  731       */
↓ open down ↓ 37 lines elided ↑ open up ↑
 776  769      {
 777  770          Status = AcpiUtGetPackageObjectSize (InternalObject, ObjLength);
 778  771      }
 779  772      else
 780  773      {
 781  774          Status = AcpiUtGetSimpleObjectSize (InternalObject, ObjLength);
 782  775      }
 783  776  
 784  777      return (Status);
 785  778  }
 786      -
 787      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX