Subversion Repositories Kolibri OS

Rev

Rev 1498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1498 Rev 2216
Line 1... Line 1...
1
/******************************************************************************
1
/******************************************************************************
2
 *
2
 *
3
 * Module Name: dswload - Dispatcher namespace load callbacks
3
 * Module Name: dswload - Dispatcher first pass namespace load callbacks
4
 *
4
 *
5
 *****************************************************************************/
5
 *****************************************************************************/
Line 6... Line 6...
6
 
6
 
7
/******************************************************************************
7
/******************************************************************************
8
 *
8
 *
9
 * 1. Copyright Notice
9
 * 1. Copyright Notice
10
 *
10
 *
11
 * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp.
11
 * Some or all of this work - Copyright (c) 1999 - 2011, Intel Corp.
12
 * All rights reserved.
12
 * All rights reserved.
13
 *
13
 *
14
 * 2. License
14
 * 2. License
15
 *
15
 *
Line 120... Line 120...
120
#include "acparser.h"
120
#include "acparser.h"
121
#include "amlcode.h"
121
#include "amlcode.h"
122
#include "acdispat.h"
122
#include "acdispat.h"
123
#include "acinterp.h"
123
#include "acinterp.h"
124
#include "acnamesp.h"
124
#include "acnamesp.h"
125
#include "acevents.h"
-
 
Line 126... Line 125...
126
 
125
 
127
#ifdef ACPI_ASL_COMPILER
126
#ifdef ACPI_ASL_COMPILER
128
#include "acdisasm.h"
127
#include "acdisasm.h"
Line 537... Line 536...
537
            }
536
            }
538
        }
537
        }
539
        else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
538
        else if (Op->Common.AmlOpcode == AML_DATA_REGION_OP)
540
        {
539
        {
541
            Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
540
            Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
542
                        REGION_DATA_TABLE, WalkState);
541
                        ACPI_ADR_SPACE_DATA_TABLE, WalkState);
543
            if (ACPI_FAILURE (Status))
542
            if (ACPI_FAILURE (Status))
544
            {
543
            {
545
                return_ACPI_STATUS (Status);
544
                return_ACPI_STATUS (Status);
546
            }
545
            }
547
        }
546
        }
Line 620... Line 619...
620
        Status = AcpiDsScopeStackPop (WalkState);
619
        Status = AcpiDsScopeStackPop (WalkState);
621
    }
620
    }
Line 622... Line 621...
622
 
621
 
623
    return_ACPI_STATUS (Status);
622
    return_ACPI_STATUS (Status);
624
}
-
 
625
 
-
 
626
 
-
 
627
/*******************************************************************************
-
 
628
 *
-
 
629
 * FUNCTION:    AcpiDsLoad2BeginOp
-
 
630
 *
-
 
631
 * PARAMETERS:  WalkState       - Current state of the parse tree walk
-
 
632
 *              OutOp           - Wher to return op if a new one is created
-
 
633
 *
-
 
634
 * RETURN:      Status
-
 
635
 *
-
 
636
 * DESCRIPTION: Descending callback used during the loading of ACPI tables.
-
 
637
 *
-
 
638
 ******************************************************************************/
-
 
639
 
-
 
640
ACPI_STATUS
-
 
641
AcpiDsLoad2BeginOp (
-
 
642
    ACPI_WALK_STATE         *WalkState,
-
 
643
    ACPI_PARSE_OBJECT       **OutOp)
-
 
644
{
-
 
645
    ACPI_PARSE_OBJECT       *Op;
-
 
646
    ACPI_NAMESPACE_NODE     *Node;
-
 
647
    ACPI_STATUS             Status;
-
 
648
    ACPI_OBJECT_TYPE        ObjectType;
-
 
649
    char                    *BufferPtr;
-
 
650
    UINT32                  Flags;
-
 
651
 
-
 
652
 
-
 
653
    ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
-
 
654
 
-
 
655
 
-
 
656
    Op = WalkState->Op;
-
 
657
    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p State=%p\n", Op, WalkState));
-
 
658
 
-
 
659
    if (Op)
-
 
660
    {
-
 
661
        if ((WalkState->ControlState) &&
-
 
662
            (WalkState->ControlState->Common.State ==
-
 
663
                ACPI_CONTROL_CONDITIONAL_EXECUTING))
-
 
664
        {
-
 
665
            /* We are executing a while loop outside of a method */
-
 
666
 
-
 
667
            Status = AcpiDsExecBeginOp (WalkState, OutOp);
-
 
668
            return_ACPI_STATUS (Status);
-
 
669
        }
-
 
670
 
-
 
671
        /* We only care about Namespace opcodes here */
-
 
672
 
-
 
673
        if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE)   &&
-
 
674
              (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
-
 
675
            (!(WalkState->OpInfo->Flags & AML_NAMED)))
-
 
676
        {
-
 
677
            return_ACPI_STATUS (AE_OK);
-
 
678
        }
-
 
679
 
-
 
680
        /* Get the name we are going to enter or lookup in the namespace */
-
 
681
 
-
 
682
        if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
-
 
683
        {
-
 
684
            /* For Namepath op, get the path string */
-
 
685
 
-
 
686
            BufferPtr = Op->Common.Value.String;
-
 
687
            if (!BufferPtr)
-
 
688
            {
-
 
689
                /* No name, just exit */
-
 
690
 
-
 
691
                return_ACPI_STATUS (AE_OK);
-
 
692
            }
-
 
693
        }
-
 
694
        else
-
 
695
        {
-
 
696
            /* Get name from the op */
-
 
697
 
-
 
698
            BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
-
 
699
        }
-
 
700
    }
-
 
701
    else
-
 
702
    {
-
 
703
        /* Get the namestring from the raw AML */
-
 
704
 
-
 
705
        BufferPtr = AcpiPsGetNextNamestring (&WalkState->ParserState);
-
 
706
    }
-
 
707
 
-
 
708
    /* Map the opcode into an internal object type */
-
 
709
 
-
 
710
    ObjectType = WalkState->OpInfo->ObjectType;
-
 
711
 
-
 
712
    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-
 
713
        "State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
-
 
714
 
-
 
715
    switch (WalkState->Opcode)
-
 
716
    {
-
 
717
    case AML_FIELD_OP:
-
 
718
    case AML_BANK_FIELD_OP:
-
 
719
    case AML_INDEX_FIELD_OP:
-
 
720
 
-
 
721
        Node = NULL;
-
 
722
        Status = AE_OK;
-
 
723
        break;
-
 
724
 
-
 
725
    case AML_INT_NAMEPATH_OP:
-
 
726
        /*
-
 
727
         * The NamePath is an object reference to an existing object.
-
 
728
         * Don't enter the name into the namespace, but look it up
-
 
729
         * for use later.
-
 
730
         */
-
 
731
        Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
-
 
732
                        ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-
 
733
                        WalkState, &(Node));
-
 
734
        break;
-
 
735
 
-
 
736
    case AML_SCOPE_OP:
-
 
737
 
-
 
738
        /* Special case for Scope(\) -> refers to the Root node */
-
 
739
 
-
 
740
        if (Op && (Op->Named.Node == AcpiGbl_RootNode))
-
 
741
        {
-
 
742
            Node = Op->Named.Node;
-
 
743
 
-
 
744
            Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
-
 
745
            if (ACPI_FAILURE (Status))
-
 
746
            {
-
 
747
                return_ACPI_STATUS (Status);
-
 
748
            }
-
 
749
        }
-
 
750
        else
-
 
751
        {
-
 
752
            /*
-
 
753
             * The Path is an object reference to an existing object.
-
 
754
             * Don't enter the name into the namespace, but look it up
-
 
755
             * for use later.
-
 
756
             */
-
 
757
            Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
-
 
758
                        ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
-
 
759
                        WalkState, &(Node));
-
 
760
            if (ACPI_FAILURE (Status))
-
 
761
            {
-
 
762
#ifdef ACPI_ASL_COMPILER
-
 
763
                if (Status == AE_NOT_FOUND)
-
 
764
                {
-
 
765
                    Status = AE_OK;
-
 
766
                }
-
 
767
                else
-
 
768
                {
-
 
769
                    ACPI_ERROR_NAMESPACE (BufferPtr, Status);
-
 
770
                }
-
 
771
#else
-
 
772
                ACPI_ERROR_NAMESPACE (BufferPtr, Status);
-
 
773
#endif
-
 
774
                return_ACPI_STATUS (Status);
-
 
775
            }
-
 
776
        }
-
 
777
 
-
 
778
        /*
-
 
779
         * We must check to make sure that the target is
-
 
780
         * one of the opcodes that actually opens a scope
-
 
781
         */
-
 
782
        switch (Node->Type)
-
 
783
        {
-
 
784
        case ACPI_TYPE_ANY:
-
 
785
        case ACPI_TYPE_LOCAL_SCOPE:         /* Scope */
-
 
786
        case ACPI_TYPE_DEVICE:
-
 
787
        case ACPI_TYPE_POWER:
-
 
788
        case ACPI_TYPE_PROCESSOR:
-
 
789
        case ACPI_TYPE_THERMAL:
-
 
790
 
-
 
791
            /* These are acceptable types */
-
 
792
            break;
-
 
793
 
-
 
794
        case ACPI_TYPE_INTEGER:
-
 
795
        case ACPI_TYPE_STRING:
-
 
796
        case ACPI_TYPE_BUFFER:
-
 
797
 
-
 
798
            /*
-
 
799
             * These types we will allow, but we will change the type.
-
 
800
             * This enables some existing code of the form:
-
 
801
             *
-
 
802
             *  Name (DEB, 0)
-
 
803
             *  Scope (DEB) { ... }
-
 
804
             */
-
 
805
            ACPI_WARNING ((AE_INFO,
-
 
806
                "Type override - [%4.4s] had invalid type (%s) "
-
 
807
                "for Scope operator, changed to type ANY\n",
-
 
808
                AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Node->Type)));
-
 
809
 
-
 
810
            Node->Type = ACPI_TYPE_ANY;
-
 
811
            WalkState->ScopeInfo->Common.Value = ACPI_TYPE_ANY;
-
 
812
            break;
-
 
813
 
-
 
814
        default:
-
 
815
 
-
 
816
            /* All other types are an error */
-
 
817
 
-
 
818
            ACPI_ERROR ((AE_INFO,
-
 
819
                "Invalid type (%s) for target of "
-
 
820
                "Scope operator [%4.4s] (Cannot override)",
-
 
821
                AcpiUtGetTypeName (Node->Type), AcpiUtGetNodeName (Node)));
-
 
822
 
-
 
823
            return (AE_AML_OPERAND_TYPE);
-
 
824
        }
-
 
825
        break;
-
 
826
 
-
 
827
    default:
-
 
828
 
-
 
829
        /* All other opcodes */
-
 
830
 
-
 
831
        if (Op && Op->Common.Node)
-
 
832
        {
-
 
833
            /* This op/node was previously entered into the namespace */
-
 
834
 
-
 
835
            Node = Op->Common.Node;
-
 
836
 
-
 
837
            if (AcpiNsOpensScope (ObjectType))
-
 
838
            {
-
 
839
                Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
-
 
840
                if (ACPI_FAILURE (Status))
-
 
841
                {
-
 
842
                    return_ACPI_STATUS (Status);
-
 
843
                }
-
 
844
            }
-
 
845
 
-
 
846
            return_ACPI_STATUS (AE_OK);
-
 
847
        }
-
 
848
 
-
 
849
        /*
-
 
850
         * Enter the named type into the internal namespace. We enter the name
-
 
851
         * as we go downward in the parse tree. Any necessary subobjects that
-
 
852
         * involve arguments to the opcode must be created as we go back up the
-
 
853
         * parse tree later.
-
 
854
         *
-
 
855
         * Note: Name may already exist if we are executing a deferred opcode.
-
 
856
         */
-
 
857
        if (WalkState->DeferredNode)
-
 
858
        {
-
 
859
            /* This name is already in the namespace, get the node */
-
 
860
 
-
 
861
            Node = WalkState->DeferredNode;
-
 
862
            Status = AE_OK;
-
 
863
            break;
-
 
864
        }
-
 
865
 
-
 
866
        Flags = ACPI_NS_NO_UPSEARCH;
-
 
867
        if (WalkState->PassNumber == ACPI_IMODE_EXECUTE)
-
 
868
        {
-
 
869
            /* Execution mode, node cannot already exist, node is temporary */
-
 
870
 
-
 
871
            Flags |= ACPI_NS_ERROR_IF_FOUND;
-
 
872
 
-
 
873
            if (!(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL))
-
 
874
            {
-
 
875
                Flags |= ACPI_NS_TEMPORARY;
-
 
876
            }
-
 
877
        }
-
 
878
 
-
 
879
        /* Add new entry or lookup existing entry */
-
 
880
 
-
 
881
        Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
-
 
882
                    ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
-
 
883
 
-
 
884
        if (ACPI_SUCCESS (Status) && (Flags & ACPI_NS_TEMPORARY))
-
 
885
        {
-
 
886
            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-
 
887
                "***New Node [%4.4s] %p is temporary\n",
-
 
888
                AcpiUtGetNodeName (Node), Node));
-
 
889
        }
-
 
890
        break;
-
 
891
    }
-
 
892
 
-
 
893
    if (ACPI_FAILURE (Status))
-
 
894
    {
-
 
895
        ACPI_ERROR_NAMESPACE (BufferPtr, Status);
-
 
896
        return_ACPI_STATUS (Status);
-
 
897
    }
-
 
898
 
-
 
899
    if (!Op)
-
 
900
    {
-
 
901
        /* Create a new op */
-
 
902
 
-
 
903
        Op = AcpiPsAllocOp (WalkState->Opcode);
-
 
904
        if (!Op)
-
 
905
        {
-
 
906
            return_ACPI_STATUS (AE_NO_MEMORY);
-
 
907
        }
-
 
908
 
-
 
909
        /* Initialize the new op */
-
 
910
 
-
 
911
        if (Node)
-
 
912
        {
-
 
913
            Op->Named.Name = Node->Name.Integer;
-
 
914
        }
-
 
915
        *OutOp = Op;
-
 
916
    }
-
 
917
 
-
 
918
    /*
-
 
919
     * Put the Node in the "op" object that the parser uses, so we
-
 
920
     * can get it again quickly when this scope is closed
-
 
921
     */
-
 
922
    Op->Common.Node = Node;
-
 
923
    return_ACPI_STATUS (Status);
-
 
924
}
-
 
925
 
-
 
926
 
-
 
927
/*******************************************************************************
-
 
928
 *
-
 
929
 * FUNCTION:    AcpiDsLoad2EndOp
-
 
930
 *
-
 
931
 * PARAMETERS:  WalkState       - Current state of the parse tree walk
-
 
932
 *
-
 
933
 * RETURN:      Status
-
 
934
 *
-
 
935
 * DESCRIPTION: Ascending callback used during the loading of the namespace,
-
 
936
 *              both control methods and everything else.
-
 
937
 *
-
 
938
 ******************************************************************************/
-
 
939
 
-
 
940
ACPI_STATUS
-
 
941
AcpiDsLoad2EndOp (
-
 
942
    ACPI_WALK_STATE         *WalkState)
-
 
943
{
-
 
944
    ACPI_PARSE_OBJECT       *Op;
-
 
945
    ACPI_STATUS             Status = AE_OK;
-
 
946
    ACPI_OBJECT_TYPE        ObjectType;
-
 
947
    ACPI_NAMESPACE_NODE     *Node;
-
 
948
    ACPI_PARSE_OBJECT       *Arg;
-
 
949
    ACPI_NAMESPACE_NODE     *NewNode;
-
 
950
#ifndef ACPI_NO_METHOD_EXECUTION
-
 
951
    UINT32                  i;
-
 
952
    UINT8                   RegionSpace;
-
 
953
#endif
-
 
954
 
-
 
955
 
-
 
956
    ACPI_FUNCTION_TRACE (DsLoad2EndOp);
-
 
957
 
-
 
958
    Op = WalkState->Op;
-
 
959
    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
-
 
960
            WalkState->OpInfo->Name, Op, WalkState));
-
 
961
 
-
 
962
    /* Check if opcode had an associated namespace object */
-
 
963
 
-
 
964
    if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
-
 
965
    {
-
 
966
        return_ACPI_STATUS (AE_OK);
-
 
967
    }
-
 
968
 
-
 
969
    if (Op->Common.AmlOpcode == AML_SCOPE_OP)
-
 
970
    {
-
 
971
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-
 
972
            "Ending scope Op=%p State=%p\n", Op, WalkState));
-
 
973
    }
-
 
974
 
-
 
975
    ObjectType = WalkState->OpInfo->ObjectType;
-
 
976
 
-
 
977
    /*
-
 
978
     * Get the Node/name from the earlier lookup
-
 
979
     * (It was saved in the *op structure)
-
 
980
     */
-
 
981
    Node = Op->Common.Node;
-
 
982
 
-
 
983
    /*
-
 
984
     * Put the Node on the object stack (Contains the ACPI Name of
-
 
985
     * this object)
-
 
986
     */
-
 
987
    WalkState->Operands[0] = (void *) Node;
-
 
988
    WalkState->NumOperands = 1;
-
 
989
 
-
 
990
    /* Pop the scope stack */
-
 
991
 
-
 
992
    if (AcpiNsOpensScope (ObjectType) &&
-
 
993
       (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
-
 
994
    {
-
 
995
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
-
 
996
            AcpiUtGetTypeName (ObjectType), Op));
-
 
997
 
-
 
998
        Status = AcpiDsScopeStackPop (WalkState);
-
 
999
        if (ACPI_FAILURE (Status))
-
 
1000
        {
-
 
1001
            goto Cleanup;
-
 
1002
        }
-
 
1003
    }
-
 
1004
 
-
 
1005
    /*
-
 
1006
     * Named operations are as follows:
-
 
1007
     *
-
 
1008
     * AML_ALIAS
-
 
1009
     * AML_BANKFIELD
-
 
1010
     * AML_CREATEBITFIELD
-
 
1011
     * AML_CREATEBYTEFIELD
-
 
1012
     * AML_CREATEDWORDFIELD
-
 
1013
     * AML_CREATEFIELD
-
 
1014
     * AML_CREATEQWORDFIELD
-
 
1015
     * AML_CREATEWORDFIELD
-
 
1016
     * AML_DATA_REGION
-
 
1017
     * AML_DEVICE
-
 
1018
     * AML_EVENT
-
 
1019
     * AML_FIELD
-
 
1020
     * AML_INDEXFIELD
-
 
1021
     * AML_METHOD
-
 
1022
     * AML_METHODCALL
-
 
1023
     * AML_MUTEX
-
 
1024
     * AML_NAME
-
 
1025
     * AML_NAMEDFIELD
-
 
1026
     * AML_OPREGION
-
 
1027
     * AML_POWERRES
-
 
1028
     * AML_PROCESSOR
-
 
1029
     * AML_SCOPE
-
 
1030
     * AML_THERMALZONE
-
 
1031
     */
-
 
1032
 
-
 
1033
    ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-
 
1034
        "Create-Load [%s] State=%p Op=%p NamedObj=%p\n",
-
 
1035
        AcpiPsGetOpcodeName (Op->Common.AmlOpcode), WalkState, Op, Node));
-
 
1036
 
-
 
1037
    /* Decode the opcode */
-
 
1038
 
-
 
1039
    Arg = Op->Common.Value.Arg;
-
 
1040
 
-
 
1041
    switch (WalkState->OpInfo->Type)
-
 
1042
    {
-
 
1043
#ifndef ACPI_NO_METHOD_EXECUTION
-
 
1044
 
-
 
1045
    case AML_TYPE_CREATE_FIELD:
-
 
1046
        /*
-
 
1047
         * Create the field object, but the field buffer and index must
-
 
1048
         * be evaluated later during the execution phase
-
 
1049
         */
-
 
1050
        Status = AcpiDsCreateBufferField (Op, WalkState);
-
 
1051
        break;
-
 
1052
 
-
 
1053
 
-
 
1054
     case AML_TYPE_NAMED_FIELD:
-
 
1055
        /*
-
 
1056
         * If we are executing a method, initialize the field
-
 
1057
         */
-
 
1058
        if (WalkState->MethodNode)
-
 
1059
        {
-
 
1060
            Status = AcpiDsInitFieldObjects (Op, WalkState);
-
 
1061
        }
-
 
1062
 
-
 
1063
        switch (Op->Common.AmlOpcode)
-
 
1064
        {
-
 
1065
        case AML_INDEX_FIELD_OP:
-
 
1066
 
-
 
1067
            Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
-
 
1068
                        WalkState);
-
 
1069
            break;
-
 
1070
 
-
 
1071
        case AML_BANK_FIELD_OP:
-
 
1072
 
-
 
1073
            Status = AcpiDsCreateBankField (Op, Arg->Common.Node, WalkState);
-
 
1074
            break;
-
 
1075
 
-
 
1076
        case AML_FIELD_OP:
-
 
1077
 
-
 
1078
            Status = AcpiDsCreateField (Op, Arg->Common.Node, WalkState);
-
 
1079
            break;
-
 
1080
 
-
 
1081
        default:
-
 
1082
            /* All NAMED_FIELD opcodes must be handled above */
-
 
1083
            break;
-
 
1084
        }
-
 
1085
        break;
-
 
1086
 
-
 
1087
 
-
 
1088
     case AML_TYPE_NAMED_SIMPLE:
-
 
1089
 
-
 
1090
        Status = AcpiDsCreateOperands (WalkState, Arg);
-
 
1091
        if (ACPI_FAILURE (Status))
-
 
1092
        {
-
 
1093
            goto Cleanup;
-
 
1094
        }
-
 
1095
 
-
 
1096
        switch (Op->Common.AmlOpcode)
-
 
1097
        {
-
 
1098
        case AML_PROCESSOR_OP:
-
 
1099
 
-
 
1100
            Status = AcpiExCreateProcessor (WalkState);
-
 
1101
            break;
-
 
1102
 
-
 
1103
        case AML_POWER_RES_OP:
-
 
1104
 
-
 
1105
            Status = AcpiExCreatePowerResource (WalkState);
-
 
1106
            break;
-
 
1107
 
-
 
1108
        case AML_MUTEX_OP:
-
 
1109
 
-
 
1110
            Status = AcpiExCreateMutex (WalkState);
-
 
1111
            break;
-
 
1112
 
-
 
1113
        case AML_EVENT_OP:
-
 
1114
 
-
 
1115
            Status = AcpiExCreateEvent (WalkState);
-
 
1116
            break;
-
 
1117
 
-
 
1118
 
-
 
1119
        case AML_ALIAS_OP:
-
 
1120
 
-
 
1121
            Status = AcpiExCreateAlias (WalkState);
-
 
1122
            break;
-
 
1123
 
-
 
1124
        default:
-
 
1125
            /* Unknown opcode */
-
 
1126
 
-
 
1127
            Status = AE_OK;
-
 
1128
            goto Cleanup;
-
 
1129
        }
-
 
1130
 
-
 
1131
        /* Delete operands */
-
 
1132
 
-
 
1133
        for (i = 1; i < WalkState->NumOperands; i++)
-
 
1134
        {
-
 
1135
            AcpiUtRemoveReference (WalkState->Operands[i]);
-
 
1136
            WalkState->Operands[i] = NULL;
-
 
1137
        }
-
 
1138
 
-
 
1139
        break;
-
 
1140
#endif /* ACPI_NO_METHOD_EXECUTION */
-
 
1141
 
-
 
1142
    case AML_TYPE_NAMED_COMPLEX:
-
 
1143
 
-
 
1144
        switch (Op->Common.AmlOpcode)
-
 
1145
        {
-
 
1146
#ifndef ACPI_NO_METHOD_EXECUTION
-
 
1147
        case AML_REGION_OP:
-
 
1148
        case AML_DATA_REGION_OP:
-
 
1149
 
-
 
1150
            if (Op->Common.AmlOpcode == AML_REGION_OP)
-
 
1151
            {
-
 
1152
                RegionSpace = (ACPI_ADR_SPACE_TYPE)
-
 
1153
                      ((Op->Common.Value.Arg)->Common.Value.Integer);
-
 
1154
            }
-
 
1155
            else
-
 
1156
            {
-
 
1157
                RegionSpace = REGION_DATA_TABLE;
-
 
1158
            }
-
 
1159
 
-
 
1160
            /*
-
 
1161
             * The OpRegion is not fully parsed at this time. The only valid
-
 
1162
             * argument is the SpaceId. (We must save the address of the
-
 
1163
             * AML of the address and length operands)
-
 
1164
             *
-
 
1165
             * If we have a valid region, initialize it. The namespace is
-
 
1166
             * unlocked at this point.
-
 
1167
             *
-
 
1168
             * Need to unlock interpreter if it is locked (if we are running
-
 
1169
             * a control method), in order to allow _REG methods to be run
-
 
1170
             * during AcpiEvInitializeRegion.
-
 
1171
             */
-
 
1172
            if (WalkState->MethodNode)
-
 
1173
            {
-
 
1174
                /*
-
 
1175
                 * Executing a method: initialize the region and unlock
-
 
1176
                 * the interpreter
-
 
1177
                 */
-
 
1178
                Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
-
 
1179
                            RegionSpace, WalkState);
-
 
1180
                if (ACPI_FAILURE (Status))
-
 
1181
                {
-
 
1182
                    return (Status);
-
 
1183
                }
-
 
1184
 
-
 
1185
                AcpiExExitInterpreter ();
-
 
1186
            }
-
 
1187
 
-
 
1188
            Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
-
 
1189
                        FALSE);
-
 
1190
            if (WalkState->MethodNode)
-
 
1191
            {
-
 
1192
                AcpiExEnterInterpreter ();
-
 
1193
            }
-
 
1194
 
-
 
1195
            if (ACPI_FAILURE (Status))
-
 
1196
            {
-
 
1197
                /*
-
 
1198
                 *  If AE_NOT_EXIST is returned, it is not fatal
-
 
1199
                 *  because many regions get created before a handler
-
 
1200
                 *  is installed for said region.
-
 
1201
                 */
-
 
1202
                if (AE_NOT_EXIST == Status)
-
 
1203
                {
-
 
1204
                    Status = AE_OK;
-
 
1205
                }
-
 
1206
            }
-
 
1207
            break;
-
 
1208
 
-
 
1209
 
-
 
1210
        case AML_NAME_OP:
-
 
1211
 
-
 
1212
            Status = AcpiDsCreateNode (WalkState, Node, Op);
-
 
1213
            break;
-
 
1214
 
-
 
1215
 
-
 
1216
        case AML_METHOD_OP:
-
 
1217
            /*
-
 
1218
             * MethodOp PkgLength NameString MethodFlags TermList
-
 
1219
             *
-
 
1220
             * Note: We must create the method node/object pair as soon as we
-
 
1221
             * see the method declaration. This allows later pass1 parsing
-
 
1222
             * of invocations of the method (need to know the number of
-
 
1223
             * arguments.)
-
 
1224
             */
-
 
1225
            ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-
 
1226
                "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
-
 
1227
                WalkState, Op, Op->Named.Node));
-
 
1228
 
-
 
1229
            if (!AcpiNsGetAttachedObject (Op->Named.Node))
-
 
1230
            {
-
 
1231
                WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
-
 
1232
                WalkState->NumOperands = 1;
-
 
1233
 
-
 
1234
                Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
-
 
1235
                if (ACPI_SUCCESS (Status))
-
 
1236
                {
-
 
1237
                    Status = AcpiExCreateMethod (Op->Named.Data,
-
 
1238
                                        Op->Named.Length, WalkState);
-
 
1239
                }
-
 
1240
                WalkState->Operands[0] = NULL;
-
 
1241
                WalkState->NumOperands = 0;
-
 
1242
 
-
 
1243
                if (ACPI_FAILURE (Status))
-
 
1244
                {
-
 
1245
                    return_ACPI_STATUS (Status);
-
 
1246
                }
-
 
1247
            }
-
 
1248
            break;
-
 
1249
 
-
 
1250
#endif /* ACPI_NO_METHOD_EXECUTION */
-
 
1251
 
-
 
1252
        default:
-
 
1253
            /* All NAMED_COMPLEX opcodes must be handled above */
-
 
1254
            break;
-
 
1255
        }
-
 
1256
        break;
-
 
1257
 
-
 
1258
 
-
 
1259
    case AML_CLASS_INTERNAL:
-
 
1260
 
-
 
1261
        /* case AML_INT_NAMEPATH_OP: */
-
 
1262
        break;
-
 
1263
 
-
 
1264
 
-
 
1265
    case AML_CLASS_METHOD_CALL:
-
 
1266
 
-
 
1267
        ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
-
 
1268
            "RESOLVING-MethodCall: State=%p Op=%p NamedObj=%p\n",
-
 
1269
            WalkState, Op, Node));
-
 
1270
 
-
 
1271
        /*
-
 
1272
         * Lookup the method name and save the Node
-
 
1273
         */
-
 
1274
        Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
-
 
1275
                        ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2,
-
 
1276
                        ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
-
 
1277
                        WalkState, &(NewNode));
-
 
1278
        if (ACPI_SUCCESS (Status))
-
 
1279
        {
-
 
1280
            /*
-
 
1281
             * Make sure that what we found is indeed a method
-
 
1282
             * We didn't search for a method on purpose, to see if the name
-
 
1283
             * would resolve
-
 
1284
             */
-
 
1285
            if (NewNode->Type != ACPI_TYPE_METHOD)
-
 
1286
            {
-
 
1287
                Status = AE_AML_OPERAND_TYPE;
-
 
1288
            }
-
 
1289
 
-
 
1290
            /* We could put the returned object (Node) on the object stack for
-
 
1291
             * later, but for now, we will put it in the "op" object that the
-
 
1292
             * parser uses, so we can get it again at the end of this scope
-
 
1293
             */
-
 
1294
            Op->Common.Node = NewNode;
-
 
1295
        }
-
 
1296
        else
-
 
1297
        {
-
 
1298
            ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
-
 
1299
        }
-
 
1300
        break;
-
 
1301
 
-
 
1302
 
-
 
1303
    default:
-
 
1304
        break;
-
 
1305
    }
-
 
1306
 
-
 
1307
Cleanup:
-
 
1308
 
-
 
1309
    /* Remove the Node pushed at the very beginning */
-
 
1310
 
-
 
1311
    WalkState->Operands[0] = NULL;
-
 
1312
    WalkState->NumOperands = 0;
-
 
1313
    return_ACPI_STATUS (Status);
-
 
1314
}
-
 
1315
-