Print this page
update to acpica-unix2-20140114
acpica-unix2-20130823
PANKOVs restructure

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/acpica/dispatcher/dswload2.c
          +++ new/usr/src/common/acpica/components/dispatcher/dswload2.c
   1    1  /******************************************************************************
   2    2   *
   3    3   * Module Name: dswload2 - Dispatcher second pass namespace load callbacks
   4    4   *
   5    5   *****************************************************************************/
   6    6  
   7    7  /*
   8      - * Copyright (C) 2000 - 2011, Intel Corp.
        8 + * Copyright (C) 2000 - 2014, 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 ↓ 210 lines elided ↑ open up ↑
 229  229  
 230  230              /*
 231  231               * These types we will allow, but we will change the type.
 232  232               * This enables some existing code of the form:
 233  233               *
 234  234               *  Name (DEB, 0)
 235  235               *  Scope (DEB) { ... }
 236  236               */
 237  237              ACPI_WARNING ((AE_INFO,
 238  238                  "Type override - [%4.4s] had invalid type (%s) "
 239      -                "for Scope operator, changed to type ANY\n",
      239 +                "for Scope operator, changed to type ANY",
 240  240                  AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
 241  241  
 242  242              Node->Type = ACPI_TYPE_ANY;
 243  243              WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
 244  244              break;
 245  245  
      246 +        case ACPI_TYPE_METHOD:
      247 +
      248 +            /*
      249 +             * Allow scope change to root during execution of module-level
      250 +             * code. Root is typed METHOD during this time.
      251 +             */
      252 +            if ((Node == AcpiGbl_RootNode) &&
      253 +                (WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
      254 +            {
      255 +                break;
      256 +            }
      257 +
      258 +            /*lint -fallthrough */
      259 +
 246  260          default:
 247  261  
 248  262              /* All other types are an error */
 249  263  
 250  264              ACPI_ERROR ((AE_INFO,
 251  265                  "Invalid type (%s) for target of "
 252  266                  "Scope operator [%4.4s] (Cannot override)",
 253  267                  AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
 254  268  
 255      -            return (AE_AML_OPERAND_TYPE);
      269 +            return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
 256  270          }
 257  271          break;
 258  272  
 259  273      default:
 260  274  
 261  275          /* All other opcodes */
 262  276  
 263  277          if (Op && Op->Common.Node)
 264  278          {
 265  279              /* This op/node was previously entered into the namespace */
↓ open down ↓ 209 lines elided ↑ open up ↑
 475  489  #ifndef ACPI_NO_METHOD_EXECUTION
 476  490  
 477  491      case AML_TYPE_CREATE_FIELD:
 478  492          /*
 479  493           * Create the field object, but the field buffer and index must
 480  494           * be evaluated later during the execution phase
 481  495           */
 482  496          Status = AcpiDsCreateBufferField (Op, WalkState);
 483  497          break;
 484  498  
 485      -
 486  499       case AML_TYPE_NAMED_FIELD:
 487  500          /*
 488  501           * If we are executing a method, initialize the field
 489  502           */
 490  503          if (WalkState->MethodNode)
 491  504          {
 492  505              Status = AcpiDsInitFieldObjects (Op, WalkState);
 493  506          }
 494  507  
 495  508          switch (Op->Common.AmlOpcode)
↓ open down ↓ 8 lines elided ↑ open up ↑
 504  517  
 505  518              Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
 506  519              break;
 507  520  
 508  521          case AML_FIELD_OP:
 509  522  
 510  523              Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
 511  524              break;
 512  525  
 513  526          default:
      527 +
 514  528              /* All NAMED_FIELD opcodes must be handled above */
 515  529              break;
 516  530          }
 517  531          break;
 518  532  
 519      -
 520  533       case AML_TYPE_NAMED_SIMPLE:
 521  534  
 522  535          Status = AcpiDsCreateOperands (WalkState, Arg);
 523  536          if (ACPI_FAILURE (Status))
 524  537          {
 525  538              goto Cleanup;
 526  539          }
 527  540  
 528  541          switch (Op->Common.AmlOpcode)
 529  542          {
↓ open down ↓ 10 lines elided ↑ open up ↑
 540  553          case AML_MUTEX_OP:
 541  554  
 542  555              Status = AcpiExCreateMutex (WalkState);
 543  556              break;
 544  557  
 545  558          case AML_EVENT_OP:
 546  559  
 547  560              Status = AcpiExCreateEvent (WalkState);
 548  561              break;
 549  562  
 550      -
 551  563          case AML_ALIAS_OP:
 552  564  
 553  565              Status = AcpiExCreateAlias (WalkState);
 554  566              break;
 555  567  
 556  568          default:
      569 +
 557  570              /* Unknown opcode */
 558  571  
 559  572              Status = AE_OK;
 560  573              goto Cleanup;
 561  574          }
 562  575  
 563  576          /* Delete operands */
 564  577  
 565  578          for (i = 1; i < WalkState->NumOperands; i++)
 566  579          {
↓ open down ↓ 37 lines elided ↑ open up ↑
 604  617              if (WalkState->MethodNode)
 605  618              {
 606  619                  /*
 607  620                   * Executing a method: initialize the region and unlock
 608  621                   * the interpreter
 609  622                   */
 610  623                  Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
 611  624                              RegionSpace, WalkState);
 612  625                  if (ACPI_FAILURE (Status))
 613  626                  {
 614      -                    return (Status);
      627 +                    return_ACPI_STATUS (Status);
 615  628                  }
 616  629  
 617  630                  AcpiExExitInterpreter ();
 618  631              }
 619  632  
 620  633              Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
 621  634                          FALSE);
 622  635              if (WalkState->MethodNode)
 623  636              {
 624  637                  AcpiExEnterInterpreter ();
↓ open down ↓ 6 lines elided ↑ open up ↑
 631  644                   *  because many regions get created before a handler
 632  645                   *  is installed for said region.
 633  646                   */
 634  647                  if (AE_NOT_EXIST == Status)
 635  648                  {
 636  649                      Status = AE_OK;
 637  650                  }
 638  651              }
 639  652              break;
 640  653  
 641      -
 642  654          case AML_NAME_OP:
 643  655  
 644  656              Status = AcpiDsCreateNode (WalkState, Node, Op);
 645  657              break;
 646  658  
 647      -
 648  659          case AML_METHOD_OP:
 649  660              /*
 650  661               * MethodOp PkgLength NameString MethodFlags TermList
 651  662               *
 652  663               * Note: We must create the method node/object pair as soon as we
 653  664               * see the method declaration. This allows later pass1 parsing
 654  665               * of invocations of the method (need to know the number of
 655  666               * arguments.)
 656  667               */
 657  668              ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
↓ open down ↓ 17 lines elided ↑ open up ↑
 675  686                  if (ACPI_FAILURE (Status))
 676  687                  {
 677  688                      return_ACPI_STATUS (Status);
 678  689                  }
 679  690              }
 680  691              break;
 681  692  
 682  693  #endif /* ACPI_NO_METHOD_EXECUTION */
 683  694  
 684  695          default:
      696 +
 685  697              /* All NAMED_COMPLEX opcodes must be handled above */
 686  698              break;
 687  699          }
 688  700          break;
 689  701  
 690      -
 691  702      case AML_CLASS_INTERNAL:
 692  703  
 693  704          /* case AML_INT_NAMEPATH_OP: */
 694  705          break;
 695  706  
 696      -
 697  707      case AML_CLASS_METHOD_CALL:
 698  708  
 699  709          ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
 700  710              "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
 701  711              WalkState, Op, Node));
 702  712  
 703  713          /*
 704  714           * Lookup the method name and save the Node
 705  715           */
 706  716          Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
↓ open down ↓ 19 lines elided ↑ open up ↑
 726  736              Op->Common.Node = NewNode;
 727  737          }
 728  738          else
 729  739          {
 730  740              ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
 731  741          }
 732  742          break;
 733  743  
 734  744  
 735  745      default:
      746 +
 736  747          break;
 737  748      }
 738  749  
 739  750  Cleanup:
 740  751  
 741  752      /* Remove the Node pushed at the very beginning */
 742  753  
 743  754      WalkState->Operands[0] = NULL;
 744  755      WalkState->NumOperands = 0;
 745  756      return_ACPI_STATUS (Status);
 746  757  }
 747      -
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX