Print this page
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/utilities/utcopy.c
          +++ new/usr/src/common/acpica/components/utilities/utcopy.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: utcopy - Internal to external object translation utilities
   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 ↓ 146 lines elided ↑ open up ↑
 165  165          ExternalObject->String.Pointer = (char *) DataSpace;
 166  166          ExternalObject->String.Length  = InternalObject->String.Length;
 167  167          *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
 168  168                              (ACPI_SIZE) InternalObject->String.Length + 1);
 169  169  
 170  170          ACPI_MEMCPY ((void *) DataSpace,
 171  171              (void *) InternalObject->String.Pointer,
 172  172              (ACPI_SIZE) InternalObject->String.Length + 1);
 173  173          break;
 174  174  
 175      -
 176  175      case ACPI_TYPE_BUFFER:
 177  176  
 178  177          ExternalObject->Buffer.Pointer = DataSpace;
 179  178          ExternalObject->Buffer.Length  = InternalObject->Buffer.Length;
 180  179          *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
 181  180                              InternalObject->String.Length);
 182  181  
 183  182          ACPI_MEMCPY ((void *) DataSpace,
 184  183              (void *) InternalObject->Buffer.Pointer,
 185  184              InternalObject->Buffer.Length);
 186  185          break;
 187  186  
 188      -
 189  187      case ACPI_TYPE_INTEGER:
 190  188  
 191  189          ExternalObject->Integer.Value = InternalObject->Integer.Value;
 192  190          break;
 193  191  
 194      -
 195  192      case ACPI_TYPE_LOCAL_REFERENCE:
 196  193  
 197  194          /* This is an object reference. */
 198  195  
 199  196          switch (InternalObject->Reference.Class)
 200  197          {
 201  198          case ACPI_REFCLASS_NAME:
 202      -
 203  199              /*
 204  200               * For namepath, return the object handle ("reference")
 205  201               * We are referring to the namespace node
 206  202               */
 207  203              ExternalObject->Reference.Handle =
 208  204                  InternalObject->Reference.Node;
 209  205              ExternalObject->Reference.ActualType =
 210  206                  AcpiNsGetType (InternalObject->Reference.Node);
 211  207              break;
 212  208  
 213  209          default:
 214  210  
 215  211              /* All other reference types are unsupported */
 216  212  
 217  213              return_ACPI_STATUS (AE_TYPE);
 218  214          }
 219  215          break;
 220  216  
 221      -
 222  217      case ACPI_TYPE_PROCESSOR:
 223  218  
 224  219          ExternalObject->Processor.ProcId =
 225  220              InternalObject->Processor.ProcId;
 226  221          ExternalObject->Processor.PblkAddress =
 227  222              InternalObject->Processor.Address;
 228  223          ExternalObject->Processor.PblkLength =
 229  224              InternalObject->Processor.Length;
 230  225          break;
 231  226  
 232      -
 233  227      case ACPI_TYPE_POWER:
 234  228  
 235  229          ExternalObject->PowerResource.SystemLevel =
 236  230              InternalObject->PowerResource.SystemLevel;
 237  231  
 238  232          ExternalObject->PowerResource.ResourceOrder =
 239  233              InternalObject->PowerResource.ResourceOrder;
 240  234          break;
 241  235  
 242      -
 243  236      default:
 244  237          /*
 245  238           * There is no corresponding external object type
 246  239           */
 247  240          ACPI_ERROR ((AE_INFO,
 248  241              "Unsupported object type, cannot convert to external object: %s",
 249  242              AcpiUtGetTypeName (InternalObject->Common.Type)));
 250  243  
 251  244          return_ACPI_STATUS (AE_SUPPORT);
 252  245      }
↓ open down ↓ 31 lines elided ↑ open up ↑
 284  277      ACPI_FUNCTION_ENTRY ();
 285  278  
 286  279  
 287  280      ThisIndex    = State->Pkg.Index;
 288  281      TargetObject = (ACPI_OBJECT *)
 289  282          &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
 290  283  
 291  284      switch (ObjectType)
 292  285      {
 293  286      case ACPI_COPY_TYPE_SIMPLE:
 294      -
 295  287          /*
 296  288           * This is a simple or null object
 297  289           */
 298  290          Status = AcpiUtCopyIsimpleToEsimple (SourceObject,
 299  291                          TargetObject, Info->FreeSpace, &ObjectSpace);
 300  292          if (ACPI_FAILURE (Status))
 301  293          {
 302  294              return (Status);
 303  295          }
 304  296          break;
 305  297  
 306      -
 307  298      case ACPI_COPY_TYPE_PACKAGE:
 308      -
 309  299          /*
 310  300           * Build the package object
 311  301           */
 312  302          TargetObject->Type              = ACPI_TYPE_PACKAGE;
 313  303          TargetObject->Package.Count     = SourceObject->Package.Count;
 314  304          TargetObject->Package.Elements  =
 315  305              ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);
 316  306  
 317  307          /*
 318  308           * Pass the new package object back to the package walk routine
↓ open down ↓ 2 lines elided ↑ open up ↑
 321  311  
 322  312          /*
 323  313           * Save space for the array of objects (Package elements)
 324  314           * update the buffer length counter
 325  315           */
 326  316          ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
 327  317                              (ACPI_SIZE) TargetObject->Package.Count *
 328  318                              sizeof (ACPI_OBJECT));
 329  319          break;
 330  320  
 331      -
 332  321      default:
      322 +
 333  323          return (AE_BAD_PARAMETER);
 334  324      }
 335  325  
 336  326      Info->FreeSpace   += ObjectSpace;
 337  327      Info->Length      += ObjectSpace;
 338  328      return (Status);
 339  329  }
 340  330  
 341  331  
 342  332  /*******************************************************************************
↓ open down ↓ 164 lines elided ↑ open up ↑
 507  497              return_ACPI_STATUS (AE_NO_MEMORY);
 508  498          }
 509  499          break;
 510  500  
 511  501      case ACPI_TYPE_ANY: /* This is the case for a NULL object */
 512  502  
 513  503          *RetInternalObject = NULL;
 514  504          return_ACPI_STATUS (AE_OK);
 515  505  
 516  506      default:
      507 +
 517  508          /* All other types are not supported */
 518  509  
 519  510          ACPI_ERROR ((AE_INFO,
 520  511              "Unsupported object type, cannot convert to internal object: %s",
 521  512              AcpiUtGetTypeName (ExternalObject->Type)));
 522  513  
 523  514          return_ACPI_STATUS (AE_SUPPORT);
 524  515      }
 525  516  
 526  517  
↓ open down ↓ 12 lines elided ↑ open up ↑
 539  530              goto ErrorExit;
 540  531          }
 541  532  
 542  533          ACPI_MEMCPY (InternalObject->String.Pointer,
 543  534                       ExternalObject->String.Pointer,
 544  535                       ExternalObject->String.Length);
 545  536  
 546  537          InternalObject->String.Length  = ExternalObject->String.Length;
 547  538          break;
 548  539  
 549      -
 550  540      case ACPI_TYPE_BUFFER:
 551  541  
 552  542          InternalObject->Buffer.Pointer =
 553  543              ACPI_ALLOCATE_ZEROED (ExternalObject->Buffer.Length);
 554  544          if (!InternalObject->Buffer.Pointer)
 555  545          {
 556  546              goto ErrorExit;
 557  547          }
 558  548  
 559  549          ACPI_MEMCPY (InternalObject->Buffer.Pointer,
 560  550                       ExternalObject->Buffer.Pointer,
 561  551                       ExternalObject->Buffer.Length);
 562  552  
 563  553          InternalObject->Buffer.Length  = ExternalObject->Buffer.Length;
 564  554  
 565  555          /* Mark buffer data valid */
 566  556  
 567  557          InternalObject->Buffer.Flags |= AOPOBJ_DATA_VALID;
 568  558          break;
 569  559  
 570      -
 571  560      case ACPI_TYPE_INTEGER:
 572  561  
 573  562          InternalObject->Integer.Value   = ExternalObject->Integer.Value;
 574  563          break;
 575  564  
 576  565      case ACPI_TYPE_LOCAL_REFERENCE:
 577  566  
 578  567          /* TBD: should validate incoming handle */
 579  568  
 580  569          InternalObject->Reference.Class = ACPI_REFCLASS_NAME;
 581  570          InternalObject->Reference.Node = ExternalObject->Reference.Handle;
 582  571          break;
 583  572  
 584  573      default:
      574 +
 585  575          /* Other types can't get here */
      576 +
 586  577          break;
 587  578      }
 588  579  
 589  580      *RetInternalObject = InternalObject;
 590  581      return_ACPI_STATUS (AE_OK);
 591  582  
 592  583  
 593  584  ErrorExit:
 594  585      AcpiUtRemoveReference (InternalObject);
 595  586      return_ACPI_STATUS (AE_NO_MEMORY);
↓ open down ↓ 252 lines elided ↑ open up ↑
 848  839  
 849  840          Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
 850  841                      &DestDesc->Event.OsSemaphore);
 851  842          if (ACPI_FAILURE (Status))
 852  843          {
 853  844              return (Status);
 854  845          }
 855  846          break;
 856  847  
 857  848      default:
      849 +
 858  850          /* Nothing to do for other simple objects */
      851 +
 859  852          break;
 860  853      }
 861  854  
 862  855      return (AE_OK);
 863  856  }
 864  857  
 865  858  
 866  859  /*******************************************************************************
 867  860   *
 868  861   * FUNCTION:    AcpiUtCopyIelementToIelement
↓ open down ↓ 53 lines elided ↑ open up ↑
 922  915              *ThisTargetPtr = TargetObject;
 923  916          }
 924  917          else
 925  918          {
 926  919              /* Pass through a null element */
 927  920  
 928  921              *ThisTargetPtr = NULL;
 929  922          }
 930  923          break;
 931  924  
 932      -
 933  925      case ACPI_COPY_TYPE_PACKAGE:
 934      -
 935  926          /*
 936  927           * This object is a package - go down another nesting level
 937  928           * Create and build the package object
 938  929           */
 939  930          TargetObject = AcpiUtCreatePackageObject (SourceObject->Package.Count);
 940  931          if (!TargetObject)
 941  932          {
 942  933              return (AE_NO_MEMORY);
 943  934          }
 944  935  
↓ open down ↓ 1 lines elided ↑ open up ↑
 946  937  
 947  938          /* Pass the new package object back to the package walk routine */
 948  939  
 949  940          State->Pkg.ThisTargetObj = TargetObject;
 950  941  
 951  942          /* Store the object pointer in the parent package object */
 952  943  
 953  944          *ThisTargetPtr = TargetObject;
 954  945          break;
 955  946  
 956      -
 957  947      default:
      948 +
 958  949          return (AE_BAD_PARAMETER);
 959  950      }
 960  951  
 961  952      return (Status);
 962  953  
 963  954  ErrorExit:
 964  955      AcpiUtRemoveReference (TargetObject);
 965  956      return (Status);
 966  957  }
 967  958  
↓ open down ↓ 99 lines elided ↑ open up ↑
1067 1058          Status = AcpiUtCopyIpackageToIpackage (SourceDesc, *DestDesc,
1068 1059                          WalkState);
1069 1060      }
1070 1061      else
1071 1062      {
1072 1063          Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
1073 1064      }
1074 1065  
1075 1066      return_ACPI_STATUS (Status);
1076 1067  }
1077      -
1078      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX