exfield.c revision 67754
167754Smsmith/******************************************************************************
267754Smsmith *
367754Smsmith * Module Name: amfield - ACPI AML (p-code) execution - field manipulation
467754Smsmith *              $Revision: 73 $
567754Smsmith *
667754Smsmith *****************************************************************************/
767754Smsmith
867754Smsmith/******************************************************************************
967754Smsmith *
1067754Smsmith * 1. Copyright Notice
1167754Smsmith *
1267754Smsmith * Some or all of this work - Copyright (c) 1999, Intel Corp.  All rights
1367754Smsmith * reserved.
1467754Smsmith *
1567754Smsmith * 2. License
1667754Smsmith *
1767754Smsmith * 2.1. This is your license from Intel Corp. under its intellectual property
1867754Smsmith * rights.  You may have additional license terms from the party that provided
1967754Smsmith * you this software, covering your right to use that party's intellectual
2067754Smsmith * property rights.
2167754Smsmith *
2267754Smsmith * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
2367754Smsmith * copy of the source code appearing in this file ("Covered Code") an
2467754Smsmith * irrevocable, perpetual, worldwide license under Intel's copyrights in the
2567754Smsmith * base code distributed originally by Intel ("Original Intel Code") to copy,
2667754Smsmith * make derivatives, distribute, use and display any portion of the Covered
2767754Smsmith * Code in any form, with the right to sublicense such rights; and
2867754Smsmith *
2967754Smsmith * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
3067754Smsmith * license (with the right to sublicense), under only those claims of Intel
3167754Smsmith * patents that are infringed by the Original Intel Code, to make, use, sell,
3267754Smsmith * offer to sell, and import the Covered Code and derivative works thereof
3367754Smsmith * solely to the minimum extent necessary to exercise the above copyright
3467754Smsmith * license, and in no event shall the patent license extend to any additions
3567754Smsmith * to or modifications of the Original Intel Code.  No other license or right
3667754Smsmith * is granted directly or by implication, estoppel or otherwise;
3767754Smsmith *
3867754Smsmith * The above copyright and patent license is granted only if the following
3967754Smsmith * conditions are met:
4067754Smsmith *
4167754Smsmith * 3. Conditions
4267754Smsmith *
4367754Smsmith * 3.1. Redistribution of Source with Rights to Further Distribute Source.
4467754Smsmith * Redistribution of source code of any substantial portion of the Covered
4567754Smsmith * Code or modification with rights to further distribute source must include
4667754Smsmith * the above Copyright Notice, the above License, this list of Conditions,
4767754Smsmith * and the following Disclaimer and Export Compliance provision.  In addition,
4867754Smsmith * Licensee must cause all Covered Code to which Licensee contributes to
4967754Smsmith * contain a file documenting the changes Licensee made to create that Covered
5067754Smsmith * Code and the date of any change.  Licensee must include in that file the
5167754Smsmith * documentation of any changes made by any predecessor Licensee.  Licensee
5267754Smsmith * must include a prominent statement that the modification is derived,
5367754Smsmith * directly or indirectly, from Original Intel Code.
5467754Smsmith *
5567754Smsmith * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
5667754Smsmith * Redistribution of source code of any substantial portion of the Covered
5767754Smsmith * Code or modification without rights to further distribute source must
5867754Smsmith * include the following Disclaimer and Export Compliance provision in the
5967754Smsmith * documentation and/or other materials provided with distribution.  In
6067754Smsmith * addition, Licensee may not authorize further sublicense of source of any
6167754Smsmith * portion of the Covered Code, and must include terms to the effect that the
6267754Smsmith * license from Licensee to its licensee is limited to the intellectual
6367754Smsmith * property embodied in the software Licensee provides to its licensee, and
6467754Smsmith * not to intellectual property embodied in modifications its licensee may
6567754Smsmith * make.
6667754Smsmith *
6767754Smsmith * 3.3. Redistribution of Executable. Redistribution in executable form of any
6867754Smsmith * substantial portion of the Covered Code or modification must reproduce the
6967754Smsmith * above Copyright Notice, and the following Disclaimer and Export Compliance
7067754Smsmith * provision in the documentation and/or other materials provided with the
7167754Smsmith * distribution.
7267754Smsmith *
7367754Smsmith * 3.4. Intel retains all right, title, and interest in and to the Original
7467754Smsmith * Intel Code.
7567754Smsmith *
7667754Smsmith * 3.5. Neither the name Intel nor any other trademark owned or controlled by
7767754Smsmith * Intel shall be used in advertising or otherwise to promote the sale, use or
7867754Smsmith * other dealings in products derived from or relating to the Covered Code
7967754Smsmith * without prior written authorization from Intel.
8067754Smsmith *
8167754Smsmith * 4. Disclaimer and Export Compliance
8267754Smsmith *
8367754Smsmith * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
8467754Smsmith * HERE.  ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
8567754Smsmith * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT,  ASSISTANCE,
8667754Smsmith * INSTALLATION, TRAINING OR OTHER SERVICES.  INTEL WILL NOT PROVIDE ANY
8767754Smsmith * UPDATES, ENHANCEMENTS OR EXTENSIONS.  INTEL SPECIFICALLY DISCLAIMS ANY
8867754Smsmith * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
8967754Smsmith * PARTICULAR PURPOSE.
9067754Smsmith *
9167754Smsmith * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
9267754Smsmith * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
9367754Smsmith * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
9467754Smsmith * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
9567754Smsmith * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
9667754Smsmith * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS
9767754Smsmith * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
9867754Smsmith * LIMITED REMEDY.
9967754Smsmith *
10067754Smsmith * 4.3. Licensee shall not export, either directly or indirectly, any of this
10167754Smsmith * software or system incorporating such software without first obtaining any
10267754Smsmith * required license or other approval from the U. S. Department of Commerce or
10367754Smsmith * any other agency or department of the United States Government.  In the
10467754Smsmith * event Licensee exports any such software from the United States or
10567754Smsmith * re-exports any such software from a foreign destination, Licensee shall
10667754Smsmith * ensure that the distribution and export/re-export of the software is in
10767754Smsmith * compliance with all laws, regulations, orders, or other restrictions of the
10867754Smsmith * U.S. Export Administration Regulations. Licensee agrees that neither it nor
10967754Smsmith * any of its subsidiaries will export/re-export any technical data, process,
11067754Smsmith * software, or service, directly or indirectly, to any country for which the
11167754Smsmith * United States government or any agency thereof requires an export license,
11267754Smsmith * other governmental approval, or letter of assurance, without first obtaining
11367754Smsmith * such license, approval or letter.
11467754Smsmith *
11567754Smsmith *****************************************************************************/
11667754Smsmith
11767754Smsmith
11867754Smsmith#define __AMFIELD_C__
11967754Smsmith
12067754Smsmith#include "acpi.h"
12167754Smsmith#include "acdispat.h"
12267754Smsmith#include "acinterp.h"
12367754Smsmith#include "amlcode.h"
12467754Smsmith#include "acnamesp.h"
12567754Smsmith#include "achware.h"
12667754Smsmith#include "acevents.h"
12767754Smsmith
12867754Smsmith
12967754Smsmith#define _COMPONENT          INTERPRETER
13067754Smsmith        MODULE_NAME         ("amfield")
13167754Smsmith
13267754Smsmith
13367754Smsmith/*******************************************************************************
13467754Smsmith *
13567754Smsmith * FUNCTION:    AcpiAmlSetupField
13667754Smsmith *
13767754Smsmith * PARAMETERS:  *ObjDesc            - Field to be read or written
13867754Smsmith *              *RgnDesc            - Region containing field
13967754Smsmith *              FieldBitWidth       - Field Width in bits (8, 16, or 32)
14067754Smsmith *
14167754Smsmith * RETURN:      Status
14267754Smsmith *
14367754Smsmith * DESCRIPTION: Common processing for AcpiAmlReadField and AcpiAmlWriteField
14467754Smsmith *
14567754Smsmith *  ACPI SPECIFICATION REFERENCES:
14667754Smsmith *  Each of the Type1Opcodes is defined as specified in in-line
14767754Smsmith *  comments below. For each one, use the following definitions.
14867754Smsmith *
14967754Smsmith *  DefBitField     :=  BitFieldOp      SrcBuf  BitIdx  Destination
15067754Smsmith *  DefByteField    :=  ByteFieldOp     SrcBuf  ByteIdx Destination
15167754Smsmith *  DefCreateField  :=  CreateFieldOp   SrcBuf  BitIdx  NumBits  NameString
15267754Smsmith *  DefDWordField   :=  DWordFieldOp    SrcBuf  ByteIdx Destination
15367754Smsmith *  DefWordField    :=  WordFieldOp     SrcBuf  ByteIdx Destination
15467754Smsmith *  BitIndex        :=  TermArg=>Integer
15567754Smsmith *  ByteIndex       :=  TermArg=>Integer
15667754Smsmith *  Destination     :=  NameString
15767754Smsmith *  NumBits         :=  TermArg=>Integer
15867754Smsmith *  SourceBuf       :=  TermArg=>Buffer
15967754Smsmith *
16067754Smsmith ******************************************************************************/
16167754Smsmith
16267754SmsmithACPI_STATUS
16367754SmsmithAcpiAmlSetupField (
16467754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc,
16567754Smsmith    ACPI_OPERAND_OBJECT     *RgnDesc,
16667754Smsmith    UINT32                  FieldBitWidth)
16767754Smsmith{
16867754Smsmith    ACPI_STATUS             Status = AE_OK;
16967754Smsmith    UINT32                  FieldByteWidth;
17067754Smsmith
17167754Smsmith
17267754Smsmith    FUNCTION_TRACE ("AmlSetupField");
17367754Smsmith
17467754Smsmith
17567754Smsmith    /* Parameter validation */
17667754Smsmith
17767754Smsmith    if (!ObjDesc || !RgnDesc)
17867754Smsmith    {
17967754Smsmith        DEBUG_PRINT (ACPI_ERROR,
18067754Smsmith            ("AmlSetupField: Internal error - null handle\n"));
18167754Smsmith        return_ACPI_STATUS (AE_AML_NO_OPERAND);
18267754Smsmith    }
18367754Smsmith
18467754Smsmith    if (ACPI_TYPE_REGION != RgnDesc->Common.Type)
18567754Smsmith    {
18667754Smsmith        DEBUG_PRINT (ACPI_ERROR,
18767754Smsmith            ("AmlSetupField: Needed Region, found type %x %s\n",
18867754Smsmith            RgnDesc->Common.Type, AcpiCmGetTypeName (RgnDesc->Common.Type)));
18967754Smsmith        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
19067754Smsmith    }
19167754Smsmith
19267754Smsmith
19367754Smsmith    /*
19467754Smsmith     * TBD: [Future] Acpi 2.0 supports Qword fields
19567754Smsmith     *
19667754Smsmith     * Init and validate Field width
19767754Smsmith     * Possible values are 1, 2, 4
19867754Smsmith     */
19967754Smsmith
20067754Smsmith    FieldByteWidth = DIV_8 (FieldBitWidth);
20167754Smsmith
20267754Smsmith    if ((FieldBitWidth != 8) &&
20367754Smsmith        (FieldBitWidth != 16) &&
20467754Smsmith        (FieldBitWidth != 32))
20567754Smsmith    {
20667754Smsmith        DEBUG_PRINT (ACPI_ERROR,
20767754Smsmith            ("AmlSetupField: Internal error - bad width %d\n", FieldBitWidth));
20867754Smsmith        return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
20967754Smsmith    }
21067754Smsmith
21167754Smsmith
21267754Smsmith    /*
21367754Smsmith     * If the Region Address and Length have not been previously evaluated,
21467754Smsmith     * evaluate them and save the results.
21567754Smsmith     */
21667754Smsmith    if (!(RgnDesc->Region.Flags & AOPOBJ_DATA_VALID))
21767754Smsmith    {
21867754Smsmith
21967754Smsmith        Status = AcpiDsGetRegionArguments (RgnDesc);
22067754Smsmith        if (ACPI_FAILURE (Status))
22167754Smsmith        {
22267754Smsmith            return_ACPI_STATUS (Status);
22367754Smsmith        }
22467754Smsmith    }
22567754Smsmith
22667754Smsmith
22767754Smsmith    if ((ObjDesc->Common.Type == ACPI_TYPE_FIELD_UNIT) &&
22867754Smsmith        (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)))
22967754Smsmith    {
23067754Smsmith        /*
23167754Smsmith         * Field Buffer and Index have not been previously evaluated,
23267754Smsmith         */
23367754Smsmith        DEBUG_PRINT (ACPI_ERROR, ("Uninitialized field!\n"));
23467754Smsmith        return_ACPI_STATUS (AE_AML_INTERNAL);
23567754Smsmith    }
23667754Smsmith
23767754Smsmith    if (RgnDesc->Region.Length <
23867754Smsmith       (ObjDesc->Field.Offset & ~((UINT32) FieldByteWidth - 1)) +
23967754Smsmith            FieldByteWidth)
24067754Smsmith    {
24167754Smsmith        /*
24267754Smsmith         * Offset rounded up to next multiple of field width
24367754Smsmith         * exceeds region length, indicate an error
24467754Smsmith         */
24567754Smsmith
24667754Smsmith        DUMP_STACK_ENTRY (RgnDesc);
24767754Smsmith        DUMP_STACK_ENTRY (ObjDesc);
24867754Smsmith
24967754Smsmith        DEBUG_PRINT (ACPI_ERROR,
25067754Smsmith            ("AmlSetupField: Operation at %08lX width %d bits exceeds len %08lX field=%p region=%p\n",
25167754Smsmith            ObjDesc->Field.Offset, FieldBitWidth, RgnDesc->Region.Length,
25267754Smsmith            ObjDesc, RgnDesc));
25367754Smsmith
25467754Smsmith        return_ACPI_STATUS (AE_AML_REGION_LIMIT);
25567754Smsmith    }
25667754Smsmith
25767754Smsmith    return_ACPI_STATUS (AE_OK);
25867754Smsmith}
25967754Smsmith
26067754Smsmith
26167754Smsmith/*******************************************************************************
26267754Smsmith *
26367754Smsmith * FUNCTION:    AcpiAmlAccessNamedField
26467754Smsmith *
26567754Smsmith * PARAMETERS:  Mode                - ACPI_READ or ACPI_WRITE
26667754Smsmith *              NamedField          - Handle for field to be accessed
26767754Smsmith *              *Buffer             - Value(s) to be read or written
26867754Smsmith *              BufferLength          - Number of bytes to transfer
26967754Smsmith *
27067754Smsmith * RETURN:      Status
27167754Smsmith *
27267754Smsmith * DESCRIPTION: Read or write a named field
27367754Smsmith *
27467754Smsmith ******************************************************************************/
27567754Smsmith
27667754SmsmithACPI_STATUS
27767754SmsmithAcpiAmlAccessNamedField (
27867754Smsmith    UINT32                  Mode,
27967754Smsmith    ACPI_HANDLE             NamedField,
28067754Smsmith    void                    *Buffer,
28167754Smsmith    UINT32                  BufferLength)
28267754Smsmith{
28367754Smsmith    ACPI_OPERAND_OBJECT     *ObjDesc = NULL;
28467754Smsmith    ACPI_STATUS             Status = AE_OK;
28567754Smsmith    BOOLEAN                 Locked = FALSE;
28667754Smsmith    UINT32                  BitGranularity = 0;
28767754Smsmith    UINT32                  ByteGranularity;
28867754Smsmith    UINT32                  DatumLength;
28967754Smsmith    UINT32                  ActualByteLength;
29067754Smsmith    UINT32                  ByteFieldLength;
29167754Smsmith
29267754Smsmith
29367754Smsmith    FUNCTION_TRACE_PTR ("AmlAccessNamedField", NamedField);
29467754Smsmith
29567754Smsmith
29667754Smsmith    /* Basic data checking */
29767754Smsmith    if ((!NamedField) || (ACPI_READ == Mode && !Buffer))
29867754Smsmith    {
29967754Smsmith        DEBUG_PRINT (ACPI_ERROR,
30067754Smsmith            ("AcpiAmlAccessNamedField: Internal error - null parameter\n"));
30167754Smsmith        return_ACPI_STATUS (AE_AML_INTERNAL);
30267754Smsmith    }
30367754Smsmith
30467754Smsmith    /* Get the attached field object */
30567754Smsmith
30667754Smsmith    ObjDesc = AcpiNsGetAttachedObject (NamedField);
30767754Smsmith    if (!ObjDesc)
30867754Smsmith    {
30967754Smsmith        DEBUG_PRINT (ACPI_ERROR,
31067754Smsmith            ("AmlAccessNamedField: Internal error - null value pointer\n"));
31167754Smsmith        return_ACPI_STATUS (AE_AML_INTERNAL);
31267754Smsmith    }
31367754Smsmith
31467754Smsmith    /* Check the type */
31567754Smsmith
31667754Smsmith    if (INTERNAL_TYPE_DEF_FIELD != AcpiNsGetType (NamedField))
31767754Smsmith    {
31867754Smsmith        DEBUG_PRINT (ACPI_ERROR,
31967754Smsmith            ("AmlAccessNamedField: Name %4.4s type %x is not a defined field\n",
32067754Smsmith            &(((ACPI_NAMESPACE_NODE *) NamedField)->Name),
32167754Smsmith            AcpiNsGetType (NamedField)));
32267754Smsmith        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
32367754Smsmith    }
32467754Smsmith
32567754Smsmith    /* ObjDesc valid and NamedField is a defined field  */
32667754Smsmith
32767754Smsmith    DEBUG_PRINT (ACPI_INFO,
32867754Smsmith        ("AccessNamedField: Obj=%p Type=%x Buf=%p Len=%x\n",
32967754Smsmith        ObjDesc, ObjDesc->Common.Type, Buffer, BufferLength));
33067754Smsmith    DEBUG_PRINT (ACPI_INFO,
33167754Smsmith        ("AccessNamedField: Mode=%d FieldLen=%d, BitOffset=%d\n",
33267754Smsmith        Mode, ObjDesc->FieldUnit.Length, ObjDesc->FieldUnit.BitOffset));
33367754Smsmith    DUMP_ENTRY (NamedField, ACPI_INFO);
33467754Smsmith
33567754Smsmith
33667754Smsmith    /* Double-check that the attached object is also a field */
33767754Smsmith
33867754Smsmith    if (INTERNAL_TYPE_DEF_FIELD != ObjDesc->Common.Type)
33967754Smsmith    {
34067754Smsmith        DEBUG_PRINT (ACPI_ERROR,
34167754Smsmith            ("AmlAccessNamedField: Internal error - Name %4.4s type %x does not match value-type %x at %p\n",
34267754Smsmith            &(((ACPI_NAMESPACE_NODE *) NamedField)->Name),
34367754Smsmith            AcpiNsGetType (NamedField), ObjDesc->Common.Type, ObjDesc));
34467754Smsmith        return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
34567754Smsmith    }
34667754Smsmith
34767754Smsmith
34867754Smsmith    /*
34967754Smsmith     * Granularity was decoded from the field access type
35067754Smsmith     * (AnyAcc will be the same as ByteAcc)
35167754Smsmith     */
35267754Smsmith
35367754Smsmith    BitGranularity = ObjDesc->FieldUnit.Granularity;
35467754Smsmith    ByteGranularity = DIV_8 (BitGranularity);
35567754Smsmith
35667754Smsmith    /*
35767754Smsmith     * Check if request is too large for the field, and silently truncate
35867754Smsmith     * if necessary
35967754Smsmith     */
36067754Smsmith
36167754Smsmith    /* TBD: [Errors] should an error be returned in this case? */
36267754Smsmith
36367754Smsmith    ByteFieldLength = (UINT32) DIV_8 (ObjDesc->FieldUnit.Length + 7);
36467754Smsmith
36567754Smsmith
36667754Smsmith    ActualByteLength = BufferLength;
36767754Smsmith    if (BufferLength > ByteFieldLength)
36867754Smsmith    {
36967754Smsmith        DEBUG_PRINT (ACPI_INFO,
37067754Smsmith            ("AmlAccessNamedField: Byte length %d too large, truncated to %x\n",
37167754Smsmith            ActualByteLength, ByteFieldLength));
37267754Smsmith
37367754Smsmith        ActualByteLength = ByteFieldLength;
37467754Smsmith    }
37567754Smsmith
37667754Smsmith    /* TBD: should these round down to a power of 2? */
37767754Smsmith
37867754Smsmith    if (DIV_8(BitGranularity) > ByteFieldLength)
37967754Smsmith    {
38067754Smsmith        DEBUG_PRINT (ACPI_INFO,
38167754Smsmith            ("AmlAccessNamedField: Bit granularity %d too large, truncated to %x\n",
38267754Smsmith            BitGranularity, MUL_8(ByteFieldLength)));
38367754Smsmith
38467754Smsmith        BitGranularity = MUL_8(ByteFieldLength);
38567754Smsmith    }
38667754Smsmith
38767754Smsmith    if (ByteGranularity > ByteFieldLength)
38867754Smsmith    {
38967754Smsmith        DEBUG_PRINT (ACPI_INFO,
39067754Smsmith            ("AmlAccessNamedField: Byte granularity %d too large, truncated to %x\n",
39167754Smsmith            ByteGranularity, ByteFieldLength));
39267754Smsmith
39367754Smsmith        ByteGranularity = ByteFieldLength;
39467754Smsmith    }
39567754Smsmith
39667754Smsmith
39767754Smsmith    /* Convert byte count to datum count, round up if necessary */
39867754Smsmith
39967754Smsmith    DatumLength = (ActualByteLength + (ByteGranularity-1)) / ByteGranularity;
40067754Smsmith
40167754Smsmith    DEBUG_PRINT (ACPI_INFO,
40267754Smsmith        ("ByteLen=%x, DatumLen=%x, BitGran=%x, ByteGran=%x\n",
40367754Smsmith        ActualByteLength, DatumLength, BitGranularity, ByteGranularity));
40467754Smsmith
40567754Smsmith
40667754Smsmith    /* Get the global lock if needed */
40767754Smsmith
40867754Smsmith    Locked = AcpiAmlAcquireGlobalLock (ObjDesc->FieldUnit.LockRule);
40967754Smsmith
41067754Smsmith
41167754Smsmith    /* Perform the actual read or write of the buffer */
41267754Smsmith
41367754Smsmith    switch (Mode)
41467754Smsmith    {
41567754Smsmith    case ACPI_READ:
41667754Smsmith
41767754Smsmith        Status = AcpiAmlReadField (ObjDesc, Buffer, BufferLength,
41867754Smsmith                                    ActualByteLength, DatumLength,
41967754Smsmith                                    BitGranularity, ByteGranularity);
42067754Smsmith        break;
42167754Smsmith
42267754Smsmith
42367754Smsmith    case ACPI_WRITE:
42467754Smsmith
42567754Smsmith        Status = AcpiAmlWriteField (ObjDesc, Buffer, BufferLength,
42667754Smsmith                                    ActualByteLength, DatumLength,
42767754Smsmith                                    BitGranularity, ByteGranularity);
42867754Smsmith        break;
42967754Smsmith
43067754Smsmith
43167754Smsmith    default:
43267754Smsmith
43367754Smsmith        DEBUG_PRINT (ACPI_ERROR,
43467754Smsmith            ("AccessNamedField: Unknown I/O Mode: %X\n", Mode));
43567754Smsmith        Status = AE_BAD_PARAMETER;
43667754Smsmith        break;
43767754Smsmith    }
43867754Smsmith
43967754Smsmith
44067754Smsmith    /* Release global lock if we acquired it earlier */
44167754Smsmith
44267754Smsmith    AcpiAmlReleaseGlobalLock (Locked);
44367754Smsmith
44467754Smsmith    return_ACPI_STATUS (Status);
44567754Smsmith}
44667754Smsmith
447