Print this page
acpica-unix2-20130823
PANKOVs restructure
   1 /******************************************************************************
   2  *
   3  * Module Name: dsopcode - Dispatcher suport for regions and fields
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2011, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 506  ******************************************************************************/
 507 
 508 ACPI_STATUS
 509 AcpiDsEvalTableRegionOperands (
 510     ACPI_WALK_STATE         *WalkState,
 511     ACPI_PARSE_OBJECT       *Op)
 512 {
 513     ACPI_STATUS             Status;
 514     ACPI_OPERAND_OBJECT     *ObjDesc;
 515     ACPI_OPERAND_OBJECT     **Operand;
 516     ACPI_NAMESPACE_NODE     *Node;
 517     ACPI_PARSE_OBJECT       *NextOp;
 518     UINT32                  TableIndex;
 519     ACPI_TABLE_HEADER       *Table;
 520 
 521 
 522     ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
 523 
 524 
 525     /*
 526      * This is where we evaluate the SignatureString and OemIDString
 527      * and OemTableIDString of the DataTableRegion declaration
 528      */
 529     Node =  Op->Common.Node;
 530 
 531     /* NextOp points to SignatureString op */
 532 
 533     NextOp = Op->Common.Value.Arg;
 534 
 535     /*
 536      * Evaluate/create the SignatureString and OemIDString
 537      * and OemTableIDString operands
 538      */
 539     Status = AcpiDsCreateOperands (WalkState, NextOp);
 540     if (ACPI_FAILURE (Status))
 541     {
 542         return_ACPI_STATUS (Status);
 543     }
 544 
 545     /*
 546      * Resolve the SignatureString and OemIDString
 547      * and OemTableIDString operands
 548      */
 549     Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
 550                 ACPI_WALK_OPERANDS, WalkState);
 551     if (ACPI_FAILURE (Status))
 552     {
 553         return_ACPI_STATUS (Status);
 554     }
 555 
 556     Operand = &WalkState->Operands[0];
 557 
 558     /* Find the ACPI table */
 559 
 560     Status = AcpiTbFindTable (Operand[0]->String.Pointer,
 561                 Operand[1]->String.Pointer, Operand[2]->String.Pointer,
 562                 &TableIndex);
 563     if (ACPI_FAILURE (Status))
 564     {
 565         return_ACPI_STATUS (Status);
 566     }
 567 


 663 
 664     AcpiUtRemoveReference (ArgDesc);
 665 
 666     /*
 667      * Create the actual data object
 668      */
 669     switch (Op->Common.AmlOpcode)
 670     {
 671     case AML_BUFFER_OP:
 672 
 673         Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc);
 674         break;
 675 
 676     case AML_PACKAGE_OP:
 677     case AML_VAR_PACKAGE_OP:
 678 
 679         Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc);
 680         break;
 681 
 682     default:

 683         return_ACPI_STATUS (AE_AML_BAD_OPCODE);
 684     }
 685 
 686     if (ACPI_SUCCESS (Status))
 687     {
 688         /*
 689          * Return the object in the WalkState, unless the parent is a package -
 690          * in this case, the return object will be stored in the parse tree
 691          * for the package.
 692          */
 693         if ((!Op->Common.Parent) ||
 694             ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
 695              (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
 696              (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
 697         {
 698             WalkState->ResultObj = ObjDesc;
 699         }
 700     }
 701 
 702     return_ACPI_STATUS (Status);


 789         {
 790             Node = Arg->Common.Node;
 791 
 792             ObjDesc = AcpiNsGetAttachedObject (Node);
 793             if (!ObjDesc)
 794             {
 795                 return_ACPI_STATUS (AE_NOT_EXIST);
 796             }
 797 
 798             ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
 799         }
 800 
 801         /* Move to next field in the list */
 802 
 803         Arg = Arg->Common.Next;
 804     }
 805 
 806     AcpiUtRemoveReference (OperandDesc);
 807     return_ACPI_STATUS (Status);
 808 }
 809 
   1 /******************************************************************************
   2  *
   3  * Module Name: dsopcode - Dispatcher support for regions and fields
   4  *
   5  *****************************************************************************/
   6 
   7 /*
   8  * Copyright (C) 2000 - 2013, Intel Corp.
   9  * All rights reserved.
  10  *
  11  * Redistribution and use in source and binary forms, with or without
  12  * modification, are permitted provided that the following conditions
  13  * are met:
  14  * 1. Redistributions of source code must retain the above copyright
  15  *    notice, this list of conditions, and the following disclaimer,
  16  *    without modification.
  17  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
  18  *    substantially similar to the "NO WARRANTY" disclaimer below
  19  *    ("Disclaimer") and any redistribution must be conditioned upon
  20  *    including a substantially similar Disclaimer requirement for further
  21  *    binary redistribution.
  22  * 3. Neither the names of the above-listed copyright holders nor the names
  23  *    of any contributors may be used to endorse or promote products derived
  24  *    from this software without specific prior written permission.
  25  *
  26  * Alternatively, this software may be distributed under the terms of the
  27  * GNU General Public License ("GPL") version 2 as published by the Free
  28  * Software Foundation.


 506  ******************************************************************************/
 507 
 508 ACPI_STATUS
 509 AcpiDsEvalTableRegionOperands (
 510     ACPI_WALK_STATE         *WalkState,
 511     ACPI_PARSE_OBJECT       *Op)
 512 {
 513     ACPI_STATUS             Status;
 514     ACPI_OPERAND_OBJECT     *ObjDesc;
 515     ACPI_OPERAND_OBJECT     **Operand;
 516     ACPI_NAMESPACE_NODE     *Node;
 517     ACPI_PARSE_OBJECT       *NextOp;
 518     UINT32                  TableIndex;
 519     ACPI_TABLE_HEADER       *Table;
 520 
 521 
 522     ACPI_FUNCTION_TRACE_PTR (DsEvalTableRegionOperands, Op);
 523 
 524 
 525     /*
 526      * This is where we evaluate the Signature string, OemId string,
 527      * and OemTableId string of the Data Table Region declaration
 528      */
 529     Node =  Op->Common.Node;
 530 
 531     /* NextOp points to Signature string op */
 532 
 533     NextOp = Op->Common.Value.Arg;
 534 
 535     /*
 536      * Evaluate/create the Signature string, OemId string,
 537      * and OemTableId string operands
 538      */
 539     Status = AcpiDsCreateOperands (WalkState, NextOp);
 540     if (ACPI_FAILURE (Status))
 541     {
 542         return_ACPI_STATUS (Status);
 543     }
 544 
 545     /*
 546      * Resolve the Signature string, OemId string,
 547      * and OemTableId string operands
 548      */
 549     Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
 550                 ACPI_WALK_OPERANDS, WalkState);
 551     if (ACPI_FAILURE (Status))
 552     {
 553         return_ACPI_STATUS (Status);
 554     }
 555 
 556     Operand = &WalkState->Operands[0];
 557 
 558     /* Find the ACPI table */
 559 
 560     Status = AcpiTbFindTable (Operand[0]->String.Pointer,
 561                 Operand[1]->String.Pointer, Operand[2]->String.Pointer,
 562                 &TableIndex);
 563     if (ACPI_FAILURE (Status))
 564     {
 565         return_ACPI_STATUS (Status);
 566     }
 567 


 663 
 664     AcpiUtRemoveReference (ArgDesc);
 665 
 666     /*
 667      * Create the actual data object
 668      */
 669     switch (Op->Common.AmlOpcode)
 670     {
 671     case AML_BUFFER_OP:
 672 
 673         Status = AcpiDsBuildInternalBufferObj (WalkState, Op, Length, &ObjDesc);
 674         break;
 675 
 676     case AML_PACKAGE_OP:
 677     case AML_VAR_PACKAGE_OP:
 678 
 679         Status = AcpiDsBuildInternalPackageObj (WalkState, Op, Length, &ObjDesc);
 680         break;
 681 
 682     default:
 683 
 684         return_ACPI_STATUS (AE_AML_BAD_OPCODE);
 685     }
 686 
 687     if (ACPI_SUCCESS (Status))
 688     {
 689         /*
 690          * Return the object in the WalkState, unless the parent is a package -
 691          * in this case, the return object will be stored in the parse tree
 692          * for the package.
 693          */
 694         if ((!Op->Common.Parent) ||
 695             ((Op->Common.Parent->Common.AmlOpcode != AML_PACKAGE_OP) &&
 696              (Op->Common.Parent->Common.AmlOpcode != AML_VAR_PACKAGE_OP) &&
 697              (Op->Common.Parent->Common.AmlOpcode != AML_NAME_OP)))
 698         {
 699             WalkState->ResultObj = ObjDesc;
 700         }
 701     }
 702 
 703     return_ACPI_STATUS (Status);


 790         {
 791             Node = Arg->Common.Node;
 792 
 793             ObjDesc = AcpiNsGetAttachedObject (Node);
 794             if (!ObjDesc)
 795             {
 796                 return_ACPI_STATUS (AE_NOT_EXIST);
 797             }
 798 
 799             ObjDesc->BankField.Value = (UINT32) OperandDesc->Integer.Value;
 800         }
 801 
 802         /* Move to next field in the list */
 803 
 804         Arg = Arg->Common.Next;
 805     }
 806 
 807     AcpiUtRemoveReference (OperandDesc);
 808     return_ACPI_STATUS (Status);
 809 }