excreate.c revision 220663
134351Sjb/******************************************************************************
2218822Sdim *
369180Sobrien * Module Name: excreate - Named object creation
434351Sjb *
534351Sjb *****************************************************************************/
634351Sjb
734351Sjb/*
834351Sjb * Copyright (C) 2000 - 2011, Intel Corp.
934351Sjb * All rights reserved.
1034351Sjb *
1134351Sjb * Redistribution and use in source and binary forms, with or without
1234351Sjb * modification, are permitted provided that the following conditions
1334351Sjb * are met:
1434351Sjb * 1. Redistributions of source code must retain the above copyright
1534351Sjb *    notice, this list of conditions, and the following disclaimer,
1634351Sjb *    without modification.
1734351Sjb * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1834351Sjb *    substantially similar to the "NO WARRANTY" disclaimer below
19218822Sdim *    ("Disclaimer") and any redistribution must be conditioned upon
20218822Sdim *    including a substantially similar Disclaimer requirement for further
2134351Sjb *    binary redistribution.
2234351Sjb * 3. Neither the names of the above-listed copyright holders nor the names
2334351Sjb *    of any contributors may be used to endorse or promote products derived
2494536Sobrien *    from this software without specific prior written permission.
25218822Sdim *
26218822Sdim * Alternatively, this software may be distributed under the terms of the
27218822Sdim * GNU General Public License ("GPL") version 2 as published by the Free
28218822Sdim * Software Foundation.
29218822Sdim *
3034351Sjb * NO WARRANTY
3194536Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32218822Sdim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
3334351Sjb * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
34218822Sdim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3534351Sjb * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3694536Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
37218822Sdim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38218822Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39218822Sdim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
4034351Sjb * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
4134351Sjb * POSSIBILITY OF SUCH DAMAGES.
4234351Sjb */
43218822Sdim
44218822Sdim#define __EXCREATE_C__
45218822Sdim
4634351Sjb#include <contrib/dev/acpica/include/acpi.h>
4734351Sjb#include <contrib/dev/acpica/include/accommon.h>
4834351Sjb#include <contrib/dev/acpica/include/acinterp.h>
4934351Sjb#include <contrib/dev/acpica/include/amlcode.h>
5034351Sjb#include <contrib/dev/acpica/include/acnamesp.h>
5134351Sjb
5234351Sjb
5334351Sjb#define _COMPONENT          ACPI_EXECUTER
5434351Sjb        ACPI_MODULE_NAME    ("excreate")
5534351Sjb
5634351Sjb
5734351Sjb#ifndef ACPI_NO_METHOD_EXECUTION
5834351Sjb/*******************************************************************************
5934351Sjb *
6034351Sjb * FUNCTION:    AcpiExCreateAlias
6134351Sjb *
6234351Sjb * PARAMETERS:  WalkState            - Current state, contains operands
6334351Sjb *
6434351Sjb * RETURN:      Status
6534351Sjb *
6634351Sjb * DESCRIPTION: Create a new named alias
6734351Sjb *
6834351Sjb ******************************************************************************/
6934351Sjb
70218822SdimACPI_STATUS
71218822SdimAcpiExCreateAlias (
72218822Sdim    ACPI_WALK_STATE         *WalkState)
7334351Sjb{
7434351Sjb    ACPI_NAMESPACE_NODE     *TargetNode;
7534351Sjb    ACPI_NAMESPACE_NODE     *AliasNode;
7634351Sjb    ACPI_STATUS             Status = AE_OK;
7734351Sjb
7834351Sjb
7934351Sjb    ACPI_FUNCTION_TRACE (ExCreateAlias);
8034351Sjb
8134351Sjb
8234351Sjb    /* Get the source/alias operands (both namespace nodes) */
8334351Sjb
8434351Sjb    AliasNode =  (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
8534351Sjb    TargetNode = (ACPI_NAMESPACE_NODE *) WalkState->Operands[1];
8634351Sjb
8734351Sjb    if ((TargetNode->Type == ACPI_TYPE_LOCAL_ALIAS)  ||
8834351Sjb        (TargetNode->Type == ACPI_TYPE_LOCAL_METHOD_ALIAS))
8934351Sjb    {
9034351Sjb        /*
9134351Sjb         * Dereference an existing alias so that we don't create a chain
9234351Sjb         * of aliases.  With this code, we guarantee that an alias is
9334351Sjb         * always exactly one level of indirection away from the
9434351Sjb         * actual aliased name.
9534351Sjb         */
9634351Sjb        TargetNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, TargetNode->Object);
9734351Sjb    }
9834351Sjb
9934351Sjb    /*
10034351Sjb     * For objects that can never change (i.e., the NS node will
10134351Sjb     * permanently point to the same object), we can simply attach
10234351Sjb     * the object to the new NS node.  For other objects (such as
10334351Sjb     * Integers, buffers, etc.), we have to point the Alias node
10434351Sjb     * to the original Node.
10534351Sjb     */
10634351Sjb    switch (TargetNode->Type)
10734351Sjb    {
10834351Sjb
10934351Sjb    /* For these types, the sub-object can change dynamically via a Store */
11034351Sjb
111218822Sdim    case ACPI_TYPE_INTEGER:
11234351Sjb    case ACPI_TYPE_STRING:
11334351Sjb    case ACPI_TYPE_BUFFER:
11434351Sjb    case ACPI_TYPE_PACKAGE:
11534351Sjb    case ACPI_TYPE_BUFFER_FIELD:
11634351Sjb
117218822Sdim    /*
11834351Sjb     * These types open a new scope, so we need the NS node in order to access
11934351Sjb     * any children.
12034351Sjb     */
12134351Sjb    case ACPI_TYPE_DEVICE:
12234351Sjb    case ACPI_TYPE_POWER:
12334351Sjb    case ACPI_TYPE_PROCESSOR:
12434351Sjb    case ACPI_TYPE_THERMAL:
12534351Sjb    case ACPI_TYPE_LOCAL_SCOPE:
12634351Sjb
12734351Sjb        /*
12834351Sjb         * The new alias has the type ALIAS and points to the original
12934351Sjb         * NS node, not the object itself.
13034351Sjb         */
13134351Sjb        AliasNode->Type = ACPI_TYPE_LOCAL_ALIAS;
13234351Sjb        AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
13334351Sjb        break;
13434351Sjb
13534351Sjb    case ACPI_TYPE_METHOD:
13634351Sjb
13734351Sjb        /*
138218822Sdim         * Control method aliases need to be differentiated
13934351Sjb         */
14034351Sjb        AliasNode->Type = ACPI_TYPE_LOCAL_METHOD_ALIAS;
14134351Sjb        AliasNode->Object = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, TargetNode);
142218822Sdim        break;
14334351Sjb
144218822Sdim    default:
14534351Sjb
146218822Sdim        /* Attach the original source object to the new Alias Node */
14734351Sjb
14894536Sobrien        /*
149218822Sdim         * The new alias assumes the type of the target, and it points
150218822Sdim         * to the same object.  The reference count of the object has an
151218822Sdim         * additional reference to prevent deletion out from under either the
15234351Sjb         * target node or the alias Node
153218822Sdim         */
15434351Sjb        Status = AcpiNsAttachObject (AliasNode,
15534351Sjb                    AcpiNsGetAttachedObject (TargetNode), TargetNode->Type);
15634351Sjb        break;
15734351Sjb    }
15834351Sjb
15934351Sjb    /* Since both operands are Nodes, we don't need to delete them */
16034351Sjb
16134351Sjb    return_ACPI_STATUS (Status);
16234351Sjb}
16334351Sjb
16434351Sjb
16534351Sjb/*******************************************************************************
16634351Sjb *
16734351Sjb * FUNCTION:    AcpiExCreateEvent
16834351Sjb *
16934351Sjb * PARAMETERS:  WalkState           - Current state
17034351Sjb *
17134351Sjb * RETURN:      Status
17234351Sjb *
17334351Sjb * DESCRIPTION: Create a new event object
17434351Sjb *
17534351Sjb ******************************************************************************/
17634351Sjb
17734351SjbACPI_STATUS
17834351SjbAcpiExCreateEvent (
17934351Sjb    ACPI_WALK_STATE         *WalkState)
18034351Sjb{
18134351Sjb    ACPI_STATUS             Status;
182218822Sdim    ACPI_OPERAND_OBJECT     *ObjDesc;
18334351Sjb
18434351Sjb
185218822Sdim    ACPI_FUNCTION_TRACE (ExCreateEvent);
186218822Sdim
187218822Sdim
188218822Sdim    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
18934351Sjb    if (!ObjDesc)
190218822Sdim    {
191218822Sdim        Status = AE_NO_MEMORY;
192218822Sdim        goto Cleanup;
193218822Sdim    }
19434351Sjb
19534351Sjb    /*
19634351Sjb     * Create the actual OS semaphore, with zero initial units -- meaning
197218822Sdim     * that the event is created in an unsignalled state
198218822Sdim     */
199218822Sdim    Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
20034351Sjb                &ObjDesc->Event.OsSemaphore);
20194536Sobrien    if (ACPI_FAILURE (Status))
20234351Sjb    {
20334351Sjb        goto Cleanup;
20434351Sjb    }
20534351Sjb
20634351Sjb    /* Attach object to the Node */
20734351Sjb
20834351Sjb    Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
20934351Sjb                ObjDesc, ACPI_TYPE_EVENT);
21034351Sjb
21134351SjbCleanup:
21234351Sjb    /*
213218822Sdim     * Remove local reference to the object (on error, will cause deletion
21434351Sjb     * of both object and semaphore if present.)
21534351Sjb     */
21634351Sjb    AcpiUtRemoveReference (ObjDesc);
21734351Sjb    return_ACPI_STATUS (Status);
21834351Sjb}
21934351Sjb
22034351Sjb
221218822Sdim/*******************************************************************************
222218822Sdim *
223218822Sdim * FUNCTION:    AcpiExCreateMutex
22434351Sjb *
22534351Sjb * PARAMETERS:  WalkState           - Current state
22634351Sjb *
22734351Sjb * RETURN:      Status
22834351Sjb *
229218822Sdim * DESCRIPTION: Create a new mutex object
23034351Sjb *
231218822Sdim *              Mutex (Name[0], SyncLevel[1])
232218822Sdim *
23334351Sjb ******************************************************************************/
234218822Sdim
235218822SdimACPI_STATUS
236218822SdimAcpiExCreateMutex (
23734351Sjb    ACPI_WALK_STATE         *WalkState)
238218822Sdim{
239218822Sdim    ACPI_STATUS             Status = AE_OK;
24034351Sjb    ACPI_OPERAND_OBJECT     *ObjDesc;
241218822Sdim
242218822Sdim
243218822Sdim    ACPI_FUNCTION_TRACE_PTR (ExCreateMutex, ACPI_WALK_OPERANDS);
244218822Sdim
24534351Sjb
24634351Sjb    /* Create the new mutex object */
24734351Sjb
24834351Sjb    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX);
24994536Sobrien    if (!ObjDesc)
25034351Sjb    {
25134351Sjb        Status = AE_NO_MEMORY;
25234351Sjb        goto Cleanup;
25334351Sjb    }
254218822Sdim
255218822Sdim    /* Create the actual OS Mutex */
25634351Sjb
25734351Sjb    Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex);
25834351Sjb    if (ACPI_FAILURE (Status))
259218822Sdim    {
260218822Sdim        goto Cleanup;
261218822Sdim    }
26234351Sjb
26334351Sjb    /* Init object and attach to NS node */
26434351Sjb
26534351Sjb    ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
26634351Sjb    ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
26734351Sjb
26834351Sjb    Status = AcpiNsAttachObject (ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX);
26934351Sjb
27034351Sjb
271218822SdimCleanup:
27234351Sjb    /*
27334351Sjb     * Remove local reference to the object (on error, will cause deletion
27434351Sjb     * of both object and semaphore if present.)
27534351Sjb     */
27634351Sjb    AcpiUtRemoveReference (ObjDesc);
27734351Sjb    return_ACPI_STATUS (Status);
278218822Sdim}
279218822Sdim
280218822Sdim
281218822Sdim/*******************************************************************************
282218822Sdim *
283218822Sdim * FUNCTION:    AcpiExCreateRegion
28434351Sjb *
285218822Sdim * PARAMETERS:  AmlStart            - Pointer to the region declaration AML
286218822Sdim *              AmlLength           - Max length of the declaration AML
287218822Sdim *              RegionSpace         - SpaceID for the region
288218822Sdim *              WalkState           - Current state
289218822Sdim *
290218822Sdim * RETURN:      Status
291218822Sdim *
29234351Sjb * DESCRIPTION: Create a new operation region object
29334351Sjb *
29434351Sjb ******************************************************************************/
295218822Sdim
29634351SjbACPI_STATUS
29734351SjbAcpiExCreateRegion (
29834351Sjb    UINT8                   *AmlStart,
29934351Sjb    UINT32                  AmlLength,
30034351Sjb    UINT8                   RegionSpace,
30194536Sobrien    ACPI_WALK_STATE         *WalkState)
30234351Sjb{
30394536Sobrien    ACPI_STATUS             Status;
30434351Sjb    ACPI_OPERAND_OBJECT     *ObjDesc;
30594536Sobrien    ACPI_NAMESPACE_NODE     *Node;
30634351Sjb    ACPI_OPERAND_OBJECT     *RegionObj2;
30794536Sobrien
30834351Sjb
30934351Sjb    ACPI_FUNCTION_TRACE (ExCreateRegion);
31034351Sjb
311218822Sdim
31234351Sjb    /* Get the Namespace Node */
31334351Sjb
314218822Sdim    Node = WalkState->Op->Common.Node;
315218822Sdim
316218822Sdim    /*
31734351Sjb     * If the region object is already attached to this node,
31834351Sjb     * just return
31934351Sjb     */
32034351Sjb    if (AcpiNsGetAttachedObject (Node))
32134351Sjb    {
322218822Sdim        return_ACPI_STATUS (AE_OK);
323218822Sdim    }
32434351Sjb
32534351Sjb    /*
32634351Sjb     * Space ID must be one of the predefined IDs, or in the user-defined
32734351Sjb     * range
32834351Sjb     */
32994536Sobrien    if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
33034351Sjb        (RegionSpace < ACPI_USER_REGION_BEGIN) &&
331218822Sdim        (RegionSpace != ACPI_ADR_SPACE_DATA_TABLE))
33234351Sjb    {
33334351Sjb        ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type 0x%X", RegionSpace));
33434351Sjb        return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
335218822Sdim    }
336218822Sdim
337218822Sdim    ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (0x%X)\n",
338218822Sdim        AcpiUtGetRegionName (RegionSpace), RegionSpace));
339218822Sdim
340218822Sdim    /* Create the region descriptor */
34134351Sjb
34234351Sjb    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION);
34334351Sjb    if (!ObjDesc)
344218822Sdim    {
345218822Sdim        Status = AE_NO_MEMORY;
346218822Sdim        goto Cleanup;
347218822Sdim    }
348218822Sdim
349218822Sdim    /*
350218822Sdim     * Remember location in AML stream of address & length
35134351Sjb     * operands since they need to be evaluated at run time.
35234351Sjb     */
35334351Sjb    RegionObj2 = ObjDesc->Common.NextObject;
35434351Sjb    RegionObj2->Extra.AmlStart = AmlStart;
35534351Sjb    RegionObj2->Extra.AmlLength = AmlLength;
35634351Sjb
35734351Sjb    /* Init the region from the operands */
35834351Sjb
35934351Sjb    ObjDesc->Region.SpaceId = RegionSpace;
36034351Sjb    ObjDesc->Region.Address = 0;
36134351Sjb    ObjDesc->Region.Length = 0;
36234351Sjb    ObjDesc->Region.Node = Node;
363218822Sdim
364218822Sdim    /* Install the new region object in the parent Node */
365218822Sdim
36634351Sjb    Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_REGION);
367218822Sdim
368218822Sdim
369218822SdimCleanup:
370218822Sdim
371218822Sdim    /* Remove local reference to the object */
372218822Sdim
37334351Sjb    AcpiUtRemoveReference (ObjDesc);
374218822Sdim    return_ACPI_STATUS (Status);
37534351Sjb}
376218822Sdim
377218822Sdim
378218822Sdim/*******************************************************************************
379218822Sdim *
380218822Sdim * FUNCTION:    AcpiExCreateProcessor
381218822Sdim *
382218822Sdim * PARAMETERS:  WalkState           - Current state
383218822Sdim *
384218822Sdim * RETURN:      Status
385218822Sdim *
386218822Sdim * DESCRIPTION: Create a new processor object and populate the fields
387218822Sdim *
38834351Sjb *              Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3])
389218822Sdim *
39034351Sjb ******************************************************************************/
39134351Sjb
392218822SdimACPI_STATUS
393218822SdimAcpiExCreateProcessor (
394218822Sdim    ACPI_WALK_STATE         *WalkState)
39534351Sjb{
39634351Sjb    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
397218822Sdim    ACPI_OPERAND_OBJECT     *ObjDesc;
398218822Sdim    ACPI_STATUS             Status;
399218822Sdim
40034351Sjb
40134351Sjb    ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState);
40234351Sjb
403218822Sdim
404218822Sdim    /* Create the processor object */
40534351Sjb
40634351Sjb    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PROCESSOR);
40734351Sjb    if (!ObjDesc)
408218822Sdim    {
409218822Sdim        return_ACPI_STATUS (AE_NO_MEMORY);
41034351Sjb    }
41134351Sjb
41234351Sjb    /* Initialize the processor object from the operands */
413218822Sdim
41434351Sjb    ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
41534351Sjb    ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
41634351Sjb    ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value;
417218822Sdim
41834351Sjb    /* Install the processor object in the parent Node */
41934351Sjb
42034351Sjb    Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
42134351Sjb                    ObjDesc, ACPI_TYPE_PROCESSOR);
42234351Sjb
42334351Sjb    /* Remove local reference to the object */
42434351Sjb
42534351Sjb    AcpiUtRemoveReference (ObjDesc);
42634351Sjb    return_ACPI_STATUS (Status);
42734351Sjb}
428218822Sdim
42934351Sjb
43034351Sjb/*******************************************************************************
43134351Sjb *
43234351Sjb * FUNCTION:    AcpiExCreatePowerResource
433218822Sdim *
434218822Sdim * PARAMETERS:  WalkState           - Current state
435218822Sdim *
436218822Sdim * RETURN:      Status
43734351Sjb *
43834351Sjb * DESCRIPTION: Create a new PowerResource object and populate the fields
43934351Sjb *
44034351Sjb *              PowerResource (Name[0], SystemLevel[1], ResourceOrder[2])
44134351Sjb *
44234351Sjb ******************************************************************************/
44334351Sjb
44434351SjbACPI_STATUS
44534351SjbAcpiExCreatePowerResource (
44634351Sjb    ACPI_WALK_STATE         *WalkState)
447218822Sdim{
44834351Sjb    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
44934351Sjb    ACPI_STATUS             Status;
45069180Sobrien    ACPI_OPERAND_OBJECT     *ObjDesc;
45134351Sjb
452
453    ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState);
454
455
456    /* Create the power resource object */
457
458    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_POWER);
459    if (!ObjDesc)
460    {
461        return_ACPI_STATUS (AE_NO_MEMORY);
462    }
463
464    /* Initialize the power object from the operands */
465
466    ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
467    ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value;
468
469    /* Install the  power resource object in the parent Node */
470
471    Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
472                    ObjDesc, ACPI_TYPE_POWER);
473
474    /* Remove local reference to the object */
475
476    AcpiUtRemoveReference (ObjDesc);
477    return_ACPI_STATUS (Status);
478}
479#endif
480
481
482/*******************************************************************************
483 *
484 * FUNCTION:    AcpiExCreateMethod
485 *
486 * PARAMETERS:  AmlStart        - First byte of the method's AML
487 *              AmlLength       - AML byte count for this method
488 *              WalkState       - Current state
489 *
490 * RETURN:      Status
491 *
492 * DESCRIPTION: Create a new method object
493 *
494 ******************************************************************************/
495
496ACPI_STATUS
497AcpiExCreateMethod (
498    UINT8                   *AmlStart,
499    UINT32                  AmlLength,
500    ACPI_WALK_STATE         *WalkState)
501{
502    ACPI_OPERAND_OBJECT     **Operand = &WalkState->Operands[0];
503    ACPI_OPERAND_OBJECT     *ObjDesc;
504    ACPI_STATUS             Status;
505    UINT8                   MethodFlags;
506
507
508    ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState);
509
510
511    /* Create a new method object */
512
513    ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
514    if (!ObjDesc)
515    {
516       Status = AE_NO_MEMORY;
517       goto Exit;
518    }
519
520    /* Save the method's AML pointer and length  */
521
522    ObjDesc->Method.AmlStart = AmlStart;
523    ObjDesc->Method.AmlLength = AmlLength;
524
525    /*
526     * Disassemble the method flags. Split off the ArgCount, Serialized
527     * flag, and SyncLevel for efficiency.
528     */
529    MethodFlags = (UINT8) Operand[1]->Integer.Value;
530    ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT);
531
532    /*
533     * Get the SyncLevel. If method is serialized, a mutex will be
534     * created for this method when it is parsed.
535     */
536    if (MethodFlags & AML_METHOD_SERIALIZED)
537    {
538        ObjDesc->Method.InfoFlags = ACPI_METHOD_SERIALIZED;
539
540        /*
541         * ACPI 1.0: SyncLevel = 0
542         * ACPI 2.0: SyncLevel = SyncLevel in method declaration
543         */
544        ObjDesc->Method.SyncLevel = (UINT8)
545            ((MethodFlags & AML_METHOD_SYNC_LEVEL) >> 4);
546    }
547
548    /* Attach the new object to the method Node */
549
550    Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) Operand[0],
551                    ObjDesc, ACPI_TYPE_METHOD);
552
553    /* Remove local reference to the object */
554
555    AcpiUtRemoveReference (ObjDesc);
556
557Exit:
558    /* Remove a reference to the operand */
559
560    AcpiUtRemoveReference (Operand[1]);
561    return_ACPI_STATUS (Status);
562}
563
564
565