1*433d6423SLionel Sambuc /****************************************************************************** 2*433d6423SLionel Sambuc * 3*433d6423SLionel Sambuc * Module Name: dsfield - Dispatcher field routines 4*433d6423SLionel Sambuc * 5*433d6423SLionel Sambuc *****************************************************************************/ 6*433d6423SLionel Sambuc 7*433d6423SLionel Sambuc /****************************************************************************** 8*433d6423SLionel Sambuc * 9*433d6423SLionel Sambuc * 1. Copyright Notice 10*433d6423SLionel Sambuc * 11*433d6423SLionel Sambuc * Some or all of this work - Copyright (c) 1999 - 2010, Intel Corp. 12*433d6423SLionel Sambuc * All rights reserved. 13*433d6423SLionel Sambuc * 14*433d6423SLionel Sambuc * 2. License 15*433d6423SLionel Sambuc * 16*433d6423SLionel Sambuc * 2.1. This is your license from Intel Corp. under its intellectual property 17*433d6423SLionel Sambuc * rights. You may have additional license terms from the party that provided 18*433d6423SLionel Sambuc * you this software, covering your right to use that party's intellectual 19*433d6423SLionel Sambuc * property rights. 20*433d6423SLionel Sambuc * 21*433d6423SLionel Sambuc * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22*433d6423SLionel Sambuc * copy of the source code appearing in this file ("Covered Code") an 23*433d6423SLionel Sambuc * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24*433d6423SLionel Sambuc * base code distributed originally by Intel ("Original Intel Code") to copy, 25*433d6423SLionel Sambuc * make derivatives, distribute, use and display any portion of the Covered 26*433d6423SLionel Sambuc * Code in any form, with the right to sublicense such rights; and 27*433d6423SLionel Sambuc * 28*433d6423SLionel Sambuc * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29*433d6423SLionel Sambuc * license (with the right to sublicense), under only those claims of Intel 30*433d6423SLionel Sambuc * patents that are infringed by the Original Intel Code, to make, use, sell, 31*433d6423SLionel Sambuc * offer to sell, and import the Covered Code and derivative works thereof 32*433d6423SLionel Sambuc * solely to the minimum extent necessary to exercise the above copyright 33*433d6423SLionel Sambuc * license, and in no event shall the patent license extend to any additions 34*433d6423SLionel Sambuc * to or modifications of the Original Intel Code. No other license or right 35*433d6423SLionel Sambuc * is granted directly or by implication, estoppel or otherwise; 36*433d6423SLionel Sambuc * 37*433d6423SLionel Sambuc * The above copyright and patent license is granted only if the following 38*433d6423SLionel Sambuc * conditions are met: 39*433d6423SLionel Sambuc * 40*433d6423SLionel Sambuc * 3. Conditions 41*433d6423SLionel Sambuc * 42*433d6423SLionel Sambuc * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43*433d6423SLionel Sambuc * Redistribution of source code of any substantial portion of the Covered 44*433d6423SLionel Sambuc * Code or modification with rights to further distribute source must include 45*433d6423SLionel Sambuc * the above Copyright Notice, the above License, this list of Conditions, 46*433d6423SLionel Sambuc * and the following Disclaimer and Export Compliance provision. In addition, 47*433d6423SLionel Sambuc * Licensee must cause all Covered Code to which Licensee contributes to 48*433d6423SLionel Sambuc * contain a file documenting the changes Licensee made to create that Covered 49*433d6423SLionel Sambuc * Code and the date of any change. Licensee must include in that file the 50*433d6423SLionel Sambuc * documentation of any changes made by any predecessor Licensee. Licensee 51*433d6423SLionel Sambuc * must include a prominent statement that the modification is derived, 52*433d6423SLionel Sambuc * directly or indirectly, from Original Intel Code. 53*433d6423SLionel Sambuc * 54*433d6423SLionel Sambuc * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55*433d6423SLionel Sambuc * Redistribution of source code of any substantial portion of the Covered 56*433d6423SLionel Sambuc * Code or modification without rights to further distribute source must 57*433d6423SLionel Sambuc * include the following Disclaimer and Export Compliance provision in the 58*433d6423SLionel Sambuc * documentation and/or other materials provided with distribution. In 59*433d6423SLionel Sambuc * addition, Licensee may not authorize further sublicense of source of any 60*433d6423SLionel Sambuc * portion of the Covered Code, and must include terms to the effect that the 61*433d6423SLionel Sambuc * license from Licensee to its licensee is limited to the intellectual 62*433d6423SLionel Sambuc * property embodied in the software Licensee provides to its licensee, and 63*433d6423SLionel Sambuc * not to intellectual property embodied in modifications its licensee may 64*433d6423SLionel Sambuc * make. 65*433d6423SLionel Sambuc * 66*433d6423SLionel Sambuc * 3.3. Redistribution of Executable. Redistribution in executable form of any 67*433d6423SLionel Sambuc * substantial portion of the Covered Code or modification must reproduce the 68*433d6423SLionel Sambuc * above Copyright Notice, and the following Disclaimer and Export Compliance 69*433d6423SLionel Sambuc * provision in the documentation and/or other materials provided with the 70*433d6423SLionel Sambuc * distribution. 71*433d6423SLionel Sambuc * 72*433d6423SLionel Sambuc * 3.4. Intel retains all right, title, and interest in and to the Original 73*433d6423SLionel Sambuc * Intel Code. 74*433d6423SLionel Sambuc * 75*433d6423SLionel Sambuc * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76*433d6423SLionel Sambuc * Intel shall be used in advertising or otherwise to promote the sale, use or 77*433d6423SLionel Sambuc * other dealings in products derived from or relating to the Covered Code 78*433d6423SLionel Sambuc * without prior written authorization from Intel. 79*433d6423SLionel Sambuc * 80*433d6423SLionel Sambuc * 4. Disclaimer and Export Compliance 81*433d6423SLionel Sambuc * 82*433d6423SLionel Sambuc * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83*433d6423SLionel Sambuc * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84*433d6423SLionel Sambuc * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85*433d6423SLionel Sambuc * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86*433d6423SLionel Sambuc * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87*433d6423SLionel Sambuc * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88*433d6423SLionel Sambuc * PARTICULAR PURPOSE. 89*433d6423SLionel Sambuc * 90*433d6423SLionel Sambuc * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91*433d6423SLionel Sambuc * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92*433d6423SLionel Sambuc * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93*433d6423SLionel Sambuc * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94*433d6423SLionel Sambuc * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95*433d6423SLionel Sambuc * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96*433d6423SLionel Sambuc * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97*433d6423SLionel Sambuc * LIMITED REMEDY. 98*433d6423SLionel Sambuc * 99*433d6423SLionel Sambuc * 4.3. Licensee shall not export, either directly or indirectly, any of this 100*433d6423SLionel Sambuc * software or system incorporating such software without first obtaining any 101*433d6423SLionel Sambuc * required license or other approval from the U. S. Department of Commerce or 102*433d6423SLionel Sambuc * any other agency or department of the United States Government. In the 103*433d6423SLionel Sambuc * event Licensee exports any such software from the United States or 104*433d6423SLionel Sambuc * re-exports any such software from a foreign destination, Licensee shall 105*433d6423SLionel Sambuc * ensure that the distribution and export/re-export of the software is in 106*433d6423SLionel Sambuc * compliance with all laws, regulations, orders, or other restrictions of the 107*433d6423SLionel Sambuc * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108*433d6423SLionel Sambuc * any of its subsidiaries will export/re-export any technical data, process, 109*433d6423SLionel Sambuc * software, or service, directly or indirectly, to any country for which the 110*433d6423SLionel Sambuc * United States government or any agency thereof requires an export license, 111*433d6423SLionel Sambuc * other governmental approval, or letter of assurance, without first obtaining 112*433d6423SLionel Sambuc * such license, approval or letter. 113*433d6423SLionel Sambuc * 114*433d6423SLionel Sambuc *****************************************************************************/ 115*433d6423SLionel Sambuc 116*433d6423SLionel Sambuc #define __DSFIELD_C__ 117*433d6423SLionel Sambuc 118*433d6423SLionel Sambuc #include "acpi.h" 119*433d6423SLionel Sambuc #include "accommon.h" 120*433d6423SLionel Sambuc #include "amlcode.h" 121*433d6423SLionel Sambuc #include "acdispat.h" 122*433d6423SLionel Sambuc #include "acinterp.h" 123*433d6423SLionel Sambuc #include "acnamesp.h" 124*433d6423SLionel Sambuc #include "acparser.h" 125*433d6423SLionel Sambuc 126*433d6423SLionel Sambuc 127*433d6423SLionel Sambuc #define _COMPONENT ACPI_DISPATCHER 128*433d6423SLionel Sambuc ACPI_MODULE_NAME ("dsfield") 129*433d6423SLionel Sambuc 130*433d6423SLionel Sambuc /* Local prototypes */ 131*433d6423SLionel Sambuc 132*433d6423SLionel Sambuc static ACPI_STATUS 133*433d6423SLionel Sambuc AcpiDsGetFieldNames ( 134*433d6423SLionel Sambuc ACPI_CREATE_FIELD_INFO *Info, 135*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState, 136*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg); 137*433d6423SLionel Sambuc 138*433d6423SLionel Sambuc 139*433d6423SLionel Sambuc /******************************************************************************* 140*433d6423SLionel Sambuc * 141*433d6423SLionel Sambuc * FUNCTION: AcpiDsCreateBufferField 142*433d6423SLionel Sambuc * 143*433d6423SLionel Sambuc * PARAMETERS: Op - Current parse op (CreateXXField) 144*433d6423SLionel Sambuc * WalkState - Current state 145*433d6423SLionel Sambuc * 146*433d6423SLionel Sambuc * RETURN: Status 147*433d6423SLionel Sambuc * 148*433d6423SLionel Sambuc * DESCRIPTION: Execute the CreateField operators: 149*433d6423SLionel Sambuc * CreateBitFieldOp, 150*433d6423SLionel Sambuc * CreateByteFieldOp, 151*433d6423SLionel Sambuc * CreateWordFieldOp, 152*433d6423SLionel Sambuc * CreateDWordFieldOp, 153*433d6423SLionel Sambuc * CreateQWordFieldOp, 154*433d6423SLionel Sambuc * CreateFieldOp (all of which define a field in a buffer) 155*433d6423SLionel Sambuc * 156*433d6423SLionel Sambuc ******************************************************************************/ 157*433d6423SLionel Sambuc 158*433d6423SLionel Sambuc ACPI_STATUS 159*433d6423SLionel Sambuc AcpiDsCreateBufferField ( 160*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op, 161*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState) 162*433d6423SLionel Sambuc { 163*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg; 164*433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *Node; 165*433d6423SLionel Sambuc ACPI_STATUS Status; 166*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *ObjDesc; 167*433d6423SLionel Sambuc ACPI_OPERAND_OBJECT *SecondDesc = NULL; 168*433d6423SLionel Sambuc UINT32 Flags; 169*433d6423SLionel Sambuc 170*433d6423SLionel Sambuc 171*433d6423SLionel Sambuc ACPI_FUNCTION_TRACE (DsCreateBufferField); 172*433d6423SLionel Sambuc 173*433d6423SLionel Sambuc 174*433d6423SLionel Sambuc /* 175*433d6423SLionel Sambuc * Get the NameString argument (name of the new BufferField) 176*433d6423SLionel Sambuc */ 177*433d6423SLionel Sambuc if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) 178*433d6423SLionel Sambuc { 179*433d6423SLionel Sambuc /* For CreateField, name is the 4th argument */ 180*433d6423SLionel Sambuc 181*433d6423SLionel Sambuc Arg = AcpiPsGetArg (Op, 3); 182*433d6423SLionel Sambuc } 183*433d6423SLionel Sambuc else 184*433d6423SLionel Sambuc { 185*433d6423SLionel Sambuc /* For all other CreateXXXField operators, name is the 3rd argument */ 186*433d6423SLionel Sambuc 187*433d6423SLionel Sambuc Arg = AcpiPsGetArg (Op, 2); 188*433d6423SLionel Sambuc } 189*433d6423SLionel Sambuc 190*433d6423SLionel Sambuc if (!Arg) 191*433d6423SLionel Sambuc { 192*433d6423SLionel Sambuc return_ACPI_STATUS (AE_AML_NO_OPERAND); 193*433d6423SLionel Sambuc } 194*433d6423SLionel Sambuc 195*433d6423SLionel Sambuc if (WalkState->DeferredNode) 196*433d6423SLionel Sambuc { 197*433d6423SLionel Sambuc Node = WalkState->DeferredNode; 198*433d6423SLionel Sambuc Status = AE_OK; 199*433d6423SLionel Sambuc } 200*433d6423SLionel Sambuc else 201*433d6423SLionel Sambuc { 202*433d6423SLionel Sambuc /* Execute flag should always be set when this function is entered */ 203*433d6423SLionel Sambuc 204*433d6423SLionel Sambuc if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) 205*433d6423SLionel Sambuc { 206*433d6423SLionel Sambuc return_ACPI_STATUS (AE_AML_INTERNAL); 207*433d6423SLionel Sambuc } 208*433d6423SLionel Sambuc 209*433d6423SLionel Sambuc /* Creating new namespace node, should not already exist */ 210*433d6423SLionel Sambuc 211*433d6423SLionel Sambuc Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 212*433d6423SLionel Sambuc ACPI_NS_ERROR_IF_FOUND; 213*433d6423SLionel Sambuc 214*433d6423SLionel Sambuc /* 215*433d6423SLionel Sambuc * Mark node temporary if we are executing a normal control 216*433d6423SLionel Sambuc * method. (Don't mark if this is a module-level code method) 217*433d6423SLionel Sambuc */ 218*433d6423SLionel Sambuc if (WalkState->MethodNode && 219*433d6423SLionel Sambuc !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) 220*433d6423SLionel Sambuc { 221*433d6423SLionel Sambuc Flags |= ACPI_NS_TEMPORARY; 222*433d6423SLionel Sambuc } 223*433d6423SLionel Sambuc 224*433d6423SLionel Sambuc /* Enter the NameString into the namespace */ 225*433d6423SLionel Sambuc 226*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 227*433d6423SLionel Sambuc ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, 228*433d6423SLionel Sambuc Flags, WalkState, &Node); 229*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 230*433d6423SLionel Sambuc { 231*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 232*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 233*433d6423SLionel Sambuc } 234*433d6423SLionel Sambuc } 235*433d6423SLionel Sambuc 236*433d6423SLionel Sambuc /* 237*433d6423SLionel Sambuc * We could put the returned object (Node) on the object stack for later, 238*433d6423SLionel Sambuc * but for now, we will put it in the "op" object that the parser uses, 239*433d6423SLionel Sambuc * so we can get it again at the end of this scope. 240*433d6423SLionel Sambuc */ 241*433d6423SLionel Sambuc Op->Common.Node = Node; 242*433d6423SLionel Sambuc 243*433d6423SLionel Sambuc /* 244*433d6423SLionel Sambuc * If there is no object attached to the node, this node was just created 245*433d6423SLionel Sambuc * and we need to create the field object. Otherwise, this was a lookup 246*433d6423SLionel Sambuc * of an existing node and we don't want to create the field object again. 247*433d6423SLionel Sambuc */ 248*433d6423SLionel Sambuc ObjDesc = AcpiNsGetAttachedObject (Node); 249*433d6423SLionel Sambuc if (ObjDesc) 250*433d6423SLionel Sambuc { 251*433d6423SLionel Sambuc return_ACPI_STATUS (AE_OK); 252*433d6423SLionel Sambuc } 253*433d6423SLionel Sambuc 254*433d6423SLionel Sambuc /* 255*433d6423SLionel Sambuc * The Field definition is not fully parsed at this time. 256*433d6423SLionel Sambuc * (We must save the address of the AML for the buffer and index operands) 257*433d6423SLionel Sambuc */ 258*433d6423SLionel Sambuc 259*433d6423SLionel Sambuc /* Create the buffer field object */ 260*433d6423SLionel Sambuc 261*433d6423SLionel Sambuc ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD); 262*433d6423SLionel Sambuc if (!ObjDesc) 263*433d6423SLionel Sambuc { 264*433d6423SLionel Sambuc Status = AE_NO_MEMORY; 265*433d6423SLionel Sambuc goto Cleanup; 266*433d6423SLionel Sambuc } 267*433d6423SLionel Sambuc 268*433d6423SLionel Sambuc /* 269*433d6423SLionel Sambuc * Remember location in AML stream of the field unit opcode and operands -- 270*433d6423SLionel Sambuc * since the buffer and index operands must be evaluated. 271*433d6423SLionel Sambuc */ 272*433d6423SLionel Sambuc SecondDesc = ObjDesc->Common.NextObject; 273*433d6423SLionel Sambuc SecondDesc->Extra.AmlStart = Op->Named.Data; 274*433d6423SLionel Sambuc SecondDesc->Extra.AmlLength = Op->Named.Length; 275*433d6423SLionel Sambuc ObjDesc->BufferField.Node = Node; 276*433d6423SLionel Sambuc 277*433d6423SLionel Sambuc /* Attach constructed field descriptors to parent node */ 278*433d6423SLionel Sambuc 279*433d6423SLionel Sambuc Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD); 280*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 281*433d6423SLionel Sambuc { 282*433d6423SLionel Sambuc goto Cleanup; 283*433d6423SLionel Sambuc } 284*433d6423SLionel Sambuc 285*433d6423SLionel Sambuc 286*433d6423SLionel Sambuc Cleanup: 287*433d6423SLionel Sambuc 288*433d6423SLionel Sambuc /* Remove local reference to the object */ 289*433d6423SLionel Sambuc 290*433d6423SLionel Sambuc AcpiUtRemoveReference (ObjDesc); 291*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 292*433d6423SLionel Sambuc } 293*433d6423SLionel Sambuc 294*433d6423SLionel Sambuc 295*433d6423SLionel Sambuc /******************************************************************************* 296*433d6423SLionel Sambuc * 297*433d6423SLionel Sambuc * FUNCTION: AcpiDsGetFieldNames 298*433d6423SLionel Sambuc * 299*433d6423SLionel Sambuc * PARAMETERS: Info - CreateField info structure 300*433d6423SLionel Sambuc * ` WalkState - Current method state 301*433d6423SLionel Sambuc * Arg - First parser arg for the field name list 302*433d6423SLionel Sambuc * 303*433d6423SLionel Sambuc * RETURN: Status 304*433d6423SLionel Sambuc * 305*433d6423SLionel Sambuc * DESCRIPTION: Process all named fields in a field declaration. Names are 306*433d6423SLionel Sambuc * entered into the namespace. 307*433d6423SLionel Sambuc * 308*433d6423SLionel Sambuc ******************************************************************************/ 309*433d6423SLionel Sambuc 310*433d6423SLionel Sambuc static ACPI_STATUS 311*433d6423SLionel Sambuc AcpiDsGetFieldNames ( 312*433d6423SLionel Sambuc ACPI_CREATE_FIELD_INFO *Info, 313*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState, 314*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg) 315*433d6423SLionel Sambuc { 316*433d6423SLionel Sambuc ACPI_STATUS Status; 317*433d6423SLionel Sambuc UINT64 Position; 318*433d6423SLionel Sambuc 319*433d6423SLionel Sambuc 320*433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); 321*433d6423SLionel Sambuc 322*433d6423SLionel Sambuc 323*433d6423SLionel Sambuc /* First field starts at bit zero */ 324*433d6423SLionel Sambuc 325*433d6423SLionel Sambuc Info->FieldBitPosition = 0; 326*433d6423SLionel Sambuc 327*433d6423SLionel Sambuc /* Process all elements in the field list (of parse nodes) */ 328*433d6423SLionel Sambuc 329*433d6423SLionel Sambuc while (Arg) 330*433d6423SLionel Sambuc { 331*433d6423SLionel Sambuc /* 332*433d6423SLionel Sambuc * Three types of field elements are handled: 333*433d6423SLionel Sambuc * 1) Offset - specifies a bit offset 334*433d6423SLionel Sambuc * 2) AccessAs - changes the access mode 335*433d6423SLionel Sambuc * 3) Name - Enters a new named field into the namespace 336*433d6423SLionel Sambuc */ 337*433d6423SLionel Sambuc switch (Arg->Common.AmlOpcode) 338*433d6423SLionel Sambuc { 339*433d6423SLionel Sambuc case AML_INT_RESERVEDFIELD_OP: 340*433d6423SLionel Sambuc 341*433d6423SLionel Sambuc Position = (UINT64) Info->FieldBitPosition 342*433d6423SLionel Sambuc + (UINT64) Arg->Common.Value.Size; 343*433d6423SLionel Sambuc 344*433d6423SLionel Sambuc if (Position > ACPI_UINT32_MAX) 345*433d6423SLionel Sambuc { 346*433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO, 347*433d6423SLionel Sambuc "Bit offset within field too large (> 0xFFFFFFFF)")); 348*433d6423SLionel Sambuc return_ACPI_STATUS (AE_SUPPORT); 349*433d6423SLionel Sambuc } 350*433d6423SLionel Sambuc 351*433d6423SLionel Sambuc Info->FieldBitPosition = (UINT32) Position; 352*433d6423SLionel Sambuc break; 353*433d6423SLionel Sambuc 354*433d6423SLionel Sambuc 355*433d6423SLionel Sambuc case AML_INT_ACCESSFIELD_OP: 356*433d6423SLionel Sambuc 357*433d6423SLionel Sambuc /* 358*433d6423SLionel Sambuc * Get a new AccessType and AccessAttribute -- to be used for all 359*433d6423SLionel Sambuc * field units that follow, until field end or another AccessAs 360*433d6423SLionel Sambuc * keyword. 361*433d6423SLionel Sambuc * 362*433d6423SLionel Sambuc * In FieldFlags, preserve the flag bits other than the 363*433d6423SLionel Sambuc * ACCESS_TYPE bits 364*433d6423SLionel Sambuc */ 365*433d6423SLionel Sambuc Info->FieldFlags = (UINT8) 366*433d6423SLionel Sambuc ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | 367*433d6423SLionel Sambuc ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8))); 368*433d6423SLionel Sambuc 369*433d6423SLionel Sambuc Info->Attribute = (UINT8) (Arg->Common.Value.Integer); 370*433d6423SLionel Sambuc break; 371*433d6423SLionel Sambuc 372*433d6423SLionel Sambuc 373*433d6423SLionel Sambuc case AML_INT_NAMEDFIELD_OP: 374*433d6423SLionel Sambuc 375*433d6423SLionel Sambuc /* Lookup the name, it should already exist */ 376*433d6423SLionel Sambuc 377*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, 378*433d6423SLionel Sambuc (char *) &Arg->Named.Name, Info->FieldType, 379*433d6423SLionel Sambuc ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, 380*433d6423SLionel Sambuc WalkState, &Info->FieldNode); 381*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 382*433d6423SLionel Sambuc { 383*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); 384*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 385*433d6423SLionel Sambuc } 386*433d6423SLionel Sambuc else 387*433d6423SLionel Sambuc { 388*433d6423SLionel Sambuc Arg->Common.Node = Info->FieldNode; 389*433d6423SLionel Sambuc Info->FieldBitLength = Arg->Common.Value.Size; 390*433d6423SLionel Sambuc 391*433d6423SLionel Sambuc /* 392*433d6423SLionel Sambuc * If there is no object attached to the node, this node was 393*433d6423SLionel Sambuc * just created and we need to create the field object. 394*433d6423SLionel Sambuc * Otherwise, this was a lookup of an existing node and we 395*433d6423SLionel Sambuc * don't want to create the field object again. 396*433d6423SLionel Sambuc */ 397*433d6423SLionel Sambuc if (!AcpiNsGetAttachedObject (Info->FieldNode)) 398*433d6423SLionel Sambuc { 399*433d6423SLionel Sambuc Status = AcpiExPrepFieldValue (Info); 400*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 401*433d6423SLionel Sambuc { 402*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 403*433d6423SLionel Sambuc } 404*433d6423SLionel Sambuc } 405*433d6423SLionel Sambuc } 406*433d6423SLionel Sambuc 407*433d6423SLionel Sambuc /* Keep track of bit position for the next field */ 408*433d6423SLionel Sambuc 409*433d6423SLionel Sambuc Position = (UINT64) Info->FieldBitPosition 410*433d6423SLionel Sambuc + (UINT64) Arg->Common.Value.Size; 411*433d6423SLionel Sambuc 412*433d6423SLionel Sambuc if (Position > ACPI_UINT32_MAX) 413*433d6423SLionel Sambuc { 414*433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO, 415*433d6423SLionel Sambuc "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)", 416*433d6423SLionel Sambuc ACPI_CAST_PTR (char, &Info->FieldNode->Name))); 417*433d6423SLionel Sambuc return_ACPI_STATUS (AE_SUPPORT); 418*433d6423SLionel Sambuc } 419*433d6423SLionel Sambuc 420*433d6423SLionel Sambuc Info->FieldBitPosition += Info->FieldBitLength; 421*433d6423SLionel Sambuc break; 422*433d6423SLionel Sambuc 423*433d6423SLionel Sambuc 424*433d6423SLionel Sambuc default: 425*433d6423SLionel Sambuc 426*433d6423SLionel Sambuc ACPI_ERROR ((AE_INFO, 427*433d6423SLionel Sambuc "Invalid opcode in field list: 0x%X", Arg->Common.AmlOpcode)); 428*433d6423SLionel Sambuc return_ACPI_STATUS (AE_AML_BAD_OPCODE); 429*433d6423SLionel Sambuc } 430*433d6423SLionel Sambuc 431*433d6423SLionel Sambuc Arg = Arg->Common.Next; 432*433d6423SLionel Sambuc } 433*433d6423SLionel Sambuc 434*433d6423SLionel Sambuc return_ACPI_STATUS (AE_OK); 435*433d6423SLionel Sambuc } 436*433d6423SLionel Sambuc 437*433d6423SLionel Sambuc 438*433d6423SLionel Sambuc /******************************************************************************* 439*433d6423SLionel Sambuc * 440*433d6423SLionel Sambuc * FUNCTION: AcpiDsCreateField 441*433d6423SLionel Sambuc * 442*433d6423SLionel Sambuc * PARAMETERS: Op - Op containing the Field definition and args 443*433d6423SLionel Sambuc * RegionNode - Object for the containing Operation Region 444*433d6423SLionel Sambuc * ` WalkState - Current method state 445*433d6423SLionel Sambuc * 446*433d6423SLionel Sambuc * RETURN: Status 447*433d6423SLionel Sambuc * 448*433d6423SLionel Sambuc * DESCRIPTION: Create a new field in the specified operation region 449*433d6423SLionel Sambuc * 450*433d6423SLionel Sambuc ******************************************************************************/ 451*433d6423SLionel Sambuc 452*433d6423SLionel Sambuc ACPI_STATUS 453*433d6423SLionel Sambuc AcpiDsCreateField ( 454*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op, 455*433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *RegionNode, 456*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState) 457*433d6423SLionel Sambuc { 458*433d6423SLionel Sambuc ACPI_STATUS Status; 459*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg; 460*433d6423SLionel Sambuc ACPI_CREATE_FIELD_INFO Info; 461*433d6423SLionel Sambuc 462*433d6423SLionel Sambuc 463*433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op); 464*433d6423SLionel Sambuc 465*433d6423SLionel Sambuc 466*433d6423SLionel Sambuc /* First arg is the name of the parent OpRegion (must already exist) */ 467*433d6423SLionel Sambuc 468*433d6423SLionel Sambuc Arg = Op->Common.Value.Arg; 469*433d6423SLionel Sambuc if (!RegionNode) 470*433d6423SLionel Sambuc { 471*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, 472*433d6423SLionel Sambuc ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 473*433d6423SLionel Sambuc ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 474*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 475*433d6423SLionel Sambuc { 476*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); 477*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 478*433d6423SLionel Sambuc } 479*433d6423SLionel Sambuc } 480*433d6423SLionel Sambuc 481*433d6423SLionel Sambuc /* Second arg is the field flags */ 482*433d6423SLionel Sambuc 483*433d6423SLionel Sambuc Arg = Arg->Common.Next; 484*433d6423SLionel Sambuc Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 485*433d6423SLionel Sambuc Info.Attribute = 0; 486*433d6423SLionel Sambuc 487*433d6423SLionel Sambuc /* Each remaining arg is a Named Field */ 488*433d6423SLionel Sambuc 489*433d6423SLionel Sambuc Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD; 490*433d6423SLionel Sambuc Info.RegionNode = RegionNode; 491*433d6423SLionel Sambuc 492*433d6423SLionel Sambuc Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 493*433d6423SLionel Sambuc 494*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 495*433d6423SLionel Sambuc } 496*433d6423SLionel Sambuc 497*433d6423SLionel Sambuc 498*433d6423SLionel Sambuc /******************************************************************************* 499*433d6423SLionel Sambuc * 500*433d6423SLionel Sambuc * FUNCTION: AcpiDsInitFieldObjects 501*433d6423SLionel Sambuc * 502*433d6423SLionel Sambuc * PARAMETERS: Op - Op containing the Field definition and args 503*433d6423SLionel Sambuc * ` WalkState - Current method state 504*433d6423SLionel Sambuc * 505*433d6423SLionel Sambuc * RETURN: Status 506*433d6423SLionel Sambuc * 507*433d6423SLionel Sambuc * DESCRIPTION: For each "Field Unit" name in the argument list that is 508*433d6423SLionel Sambuc * part of the field declaration, enter the name into the 509*433d6423SLionel Sambuc * namespace. 510*433d6423SLionel Sambuc * 511*433d6423SLionel Sambuc ******************************************************************************/ 512*433d6423SLionel Sambuc 513*433d6423SLionel Sambuc ACPI_STATUS 514*433d6423SLionel Sambuc AcpiDsInitFieldObjects ( 515*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op, 516*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState) 517*433d6423SLionel Sambuc { 518*433d6423SLionel Sambuc ACPI_STATUS Status; 519*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg = NULL; 520*433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *Node; 521*433d6423SLionel Sambuc UINT8 Type = 0; 522*433d6423SLionel Sambuc UINT32 Flags; 523*433d6423SLionel Sambuc 524*433d6423SLionel Sambuc 525*433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op); 526*433d6423SLionel Sambuc 527*433d6423SLionel Sambuc 528*433d6423SLionel Sambuc /* Execute flag should always be set when this function is entered */ 529*433d6423SLionel Sambuc 530*433d6423SLionel Sambuc if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) 531*433d6423SLionel Sambuc { 532*433d6423SLionel Sambuc if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP) 533*433d6423SLionel Sambuc { 534*433d6423SLionel Sambuc /* BankField Op is deferred, just return OK */ 535*433d6423SLionel Sambuc 536*433d6423SLionel Sambuc return_ACPI_STATUS (AE_OK); 537*433d6423SLionel Sambuc } 538*433d6423SLionel Sambuc 539*433d6423SLionel Sambuc return_ACPI_STATUS (AE_AML_INTERNAL); 540*433d6423SLionel Sambuc } 541*433d6423SLionel Sambuc 542*433d6423SLionel Sambuc /* 543*433d6423SLionel Sambuc * Get the FieldList argument for this opcode. This is the start of the 544*433d6423SLionel Sambuc * list of field elements. 545*433d6423SLionel Sambuc */ 546*433d6423SLionel Sambuc switch (WalkState->Opcode) 547*433d6423SLionel Sambuc { 548*433d6423SLionel Sambuc case AML_FIELD_OP: 549*433d6423SLionel Sambuc Arg = AcpiPsGetArg (Op, 2); 550*433d6423SLionel Sambuc Type = ACPI_TYPE_LOCAL_REGION_FIELD; 551*433d6423SLionel Sambuc break; 552*433d6423SLionel Sambuc 553*433d6423SLionel Sambuc case AML_BANK_FIELD_OP: 554*433d6423SLionel Sambuc Arg = AcpiPsGetArg (Op, 4); 555*433d6423SLionel Sambuc Type = ACPI_TYPE_LOCAL_BANK_FIELD; 556*433d6423SLionel Sambuc break; 557*433d6423SLionel Sambuc 558*433d6423SLionel Sambuc case AML_INDEX_FIELD_OP: 559*433d6423SLionel Sambuc Arg = AcpiPsGetArg (Op, 3); 560*433d6423SLionel Sambuc Type = ACPI_TYPE_LOCAL_INDEX_FIELD; 561*433d6423SLionel Sambuc break; 562*433d6423SLionel Sambuc 563*433d6423SLionel Sambuc default: 564*433d6423SLionel Sambuc return_ACPI_STATUS (AE_BAD_PARAMETER); 565*433d6423SLionel Sambuc } 566*433d6423SLionel Sambuc 567*433d6423SLionel Sambuc /* Creating new namespace node(s), should not already exist */ 568*433d6423SLionel Sambuc 569*433d6423SLionel Sambuc Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 570*433d6423SLionel Sambuc ACPI_NS_ERROR_IF_FOUND; 571*433d6423SLionel Sambuc 572*433d6423SLionel Sambuc /* 573*433d6423SLionel Sambuc * Mark node(s) temporary if we are executing a normal control 574*433d6423SLionel Sambuc * method. (Don't mark if this is a module-level code method) 575*433d6423SLionel Sambuc */ 576*433d6423SLionel Sambuc if (WalkState->MethodNode && 577*433d6423SLionel Sambuc !(WalkState->ParseFlags & ACPI_PARSE_MODULE_LEVEL)) 578*433d6423SLionel Sambuc { 579*433d6423SLionel Sambuc Flags |= ACPI_NS_TEMPORARY; 580*433d6423SLionel Sambuc } 581*433d6423SLionel Sambuc 582*433d6423SLionel Sambuc /* 583*433d6423SLionel Sambuc * Walk the list of entries in the FieldList 584*433d6423SLionel Sambuc * Note: FieldList can be of zero length. In this case, Arg will be NULL. 585*433d6423SLionel Sambuc */ 586*433d6423SLionel Sambuc while (Arg) 587*433d6423SLionel Sambuc { 588*433d6423SLionel Sambuc /* 589*433d6423SLionel Sambuc * Ignore OFFSET and ACCESSAS terms here; we are only interested in the 590*433d6423SLionel Sambuc * field names in order to enter them into the namespace. 591*433d6423SLionel Sambuc */ 592*433d6423SLionel Sambuc if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) 593*433d6423SLionel Sambuc { 594*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, 595*433d6423SLionel Sambuc (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, 596*433d6423SLionel Sambuc Flags, WalkState, &Node); 597*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 598*433d6423SLionel Sambuc { 599*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); 600*433d6423SLionel Sambuc if (Status != AE_ALREADY_EXISTS) 601*433d6423SLionel Sambuc { 602*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 603*433d6423SLionel Sambuc } 604*433d6423SLionel Sambuc 605*433d6423SLionel Sambuc /* Name already exists, just ignore this error */ 606*433d6423SLionel Sambuc 607*433d6423SLionel Sambuc Status = AE_OK; 608*433d6423SLionel Sambuc } 609*433d6423SLionel Sambuc 610*433d6423SLionel Sambuc Arg->Common.Node = Node; 611*433d6423SLionel Sambuc } 612*433d6423SLionel Sambuc 613*433d6423SLionel Sambuc /* Get the next field element in the list */ 614*433d6423SLionel Sambuc 615*433d6423SLionel Sambuc Arg = Arg->Common.Next; 616*433d6423SLionel Sambuc } 617*433d6423SLionel Sambuc 618*433d6423SLionel Sambuc return_ACPI_STATUS (AE_OK); 619*433d6423SLionel Sambuc } 620*433d6423SLionel Sambuc 621*433d6423SLionel Sambuc 622*433d6423SLionel Sambuc /******************************************************************************* 623*433d6423SLionel Sambuc * 624*433d6423SLionel Sambuc * FUNCTION: AcpiDsCreateBankField 625*433d6423SLionel Sambuc * 626*433d6423SLionel Sambuc * PARAMETERS: Op - Op containing the Field definition and args 627*433d6423SLionel Sambuc * RegionNode - Object for the containing Operation Region 628*433d6423SLionel Sambuc * WalkState - Current method state 629*433d6423SLionel Sambuc * 630*433d6423SLionel Sambuc * RETURN: Status 631*433d6423SLionel Sambuc * 632*433d6423SLionel Sambuc * DESCRIPTION: Create a new bank field in the specified operation region 633*433d6423SLionel Sambuc * 634*433d6423SLionel Sambuc ******************************************************************************/ 635*433d6423SLionel Sambuc 636*433d6423SLionel Sambuc ACPI_STATUS 637*433d6423SLionel Sambuc AcpiDsCreateBankField ( 638*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op, 639*433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *RegionNode, 640*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState) 641*433d6423SLionel Sambuc { 642*433d6423SLionel Sambuc ACPI_STATUS Status; 643*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg; 644*433d6423SLionel Sambuc ACPI_CREATE_FIELD_INFO Info; 645*433d6423SLionel Sambuc 646*433d6423SLionel Sambuc 647*433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op); 648*433d6423SLionel Sambuc 649*433d6423SLionel Sambuc 650*433d6423SLionel Sambuc /* First arg is the name of the parent OpRegion (must already exist) */ 651*433d6423SLionel Sambuc 652*433d6423SLionel Sambuc Arg = Op->Common.Value.Arg; 653*433d6423SLionel Sambuc if (!RegionNode) 654*433d6423SLionel Sambuc { 655*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, 656*433d6423SLionel Sambuc ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 657*433d6423SLionel Sambuc ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 658*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 659*433d6423SLionel Sambuc { 660*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); 661*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 662*433d6423SLionel Sambuc } 663*433d6423SLionel Sambuc } 664*433d6423SLionel Sambuc 665*433d6423SLionel Sambuc /* Second arg is the Bank Register (Field) (must already exist) */ 666*433d6423SLionel Sambuc 667*433d6423SLionel Sambuc Arg = Arg->Common.Next; 668*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 669*433d6423SLionel Sambuc ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 670*433d6423SLionel Sambuc ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 671*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 672*433d6423SLionel Sambuc { 673*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 674*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 675*433d6423SLionel Sambuc } 676*433d6423SLionel Sambuc 677*433d6423SLionel Sambuc /* 678*433d6423SLionel Sambuc * Third arg is the BankValue 679*433d6423SLionel Sambuc * This arg is a TermArg, not a constant 680*433d6423SLionel Sambuc * It will be evaluated later, by AcpiDsEvalBankFieldOperands 681*433d6423SLionel Sambuc */ 682*433d6423SLionel Sambuc Arg = Arg->Common.Next; 683*433d6423SLionel Sambuc 684*433d6423SLionel Sambuc /* Fourth arg is the field flags */ 685*433d6423SLionel Sambuc 686*433d6423SLionel Sambuc Arg = Arg->Common.Next; 687*433d6423SLionel Sambuc Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 688*433d6423SLionel Sambuc 689*433d6423SLionel Sambuc /* Each remaining arg is a Named Field */ 690*433d6423SLionel Sambuc 691*433d6423SLionel Sambuc Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD; 692*433d6423SLionel Sambuc Info.RegionNode = RegionNode; 693*433d6423SLionel Sambuc 694*433d6423SLionel Sambuc /* 695*433d6423SLionel Sambuc * Use Info.DataRegisterNode to store BankField Op 696*433d6423SLionel Sambuc * It's safe because DataRegisterNode will never be used when create bank field 697*433d6423SLionel Sambuc * We store AmlStart and AmlLength in the BankField Op for late evaluation 698*433d6423SLionel Sambuc * Used in AcpiExPrepFieldValue(Info) 699*433d6423SLionel Sambuc * 700*433d6423SLionel Sambuc * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? 701*433d6423SLionel Sambuc */ 702*433d6423SLionel Sambuc Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; 703*433d6423SLionel Sambuc 704*433d6423SLionel Sambuc Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 705*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 706*433d6423SLionel Sambuc } 707*433d6423SLionel Sambuc 708*433d6423SLionel Sambuc 709*433d6423SLionel Sambuc /******************************************************************************* 710*433d6423SLionel Sambuc * 711*433d6423SLionel Sambuc * FUNCTION: AcpiDsCreateIndexField 712*433d6423SLionel Sambuc * 713*433d6423SLionel Sambuc * PARAMETERS: Op - Op containing the Field definition and args 714*433d6423SLionel Sambuc * RegionNode - Object for the containing Operation Region 715*433d6423SLionel Sambuc * ` WalkState - Current method state 716*433d6423SLionel Sambuc * 717*433d6423SLionel Sambuc * RETURN: Status 718*433d6423SLionel Sambuc * 719*433d6423SLionel Sambuc * DESCRIPTION: Create a new index field in the specified operation region 720*433d6423SLionel Sambuc * 721*433d6423SLionel Sambuc ******************************************************************************/ 722*433d6423SLionel Sambuc 723*433d6423SLionel Sambuc ACPI_STATUS 724*433d6423SLionel Sambuc AcpiDsCreateIndexField ( 725*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Op, 726*433d6423SLionel Sambuc ACPI_NAMESPACE_NODE *RegionNode, 727*433d6423SLionel Sambuc ACPI_WALK_STATE *WalkState) 728*433d6423SLionel Sambuc { 729*433d6423SLionel Sambuc ACPI_STATUS Status; 730*433d6423SLionel Sambuc ACPI_PARSE_OBJECT *Arg; 731*433d6423SLionel Sambuc ACPI_CREATE_FIELD_INFO Info; 732*433d6423SLionel Sambuc 733*433d6423SLionel Sambuc 734*433d6423SLionel Sambuc ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op); 735*433d6423SLionel Sambuc 736*433d6423SLionel Sambuc 737*433d6423SLionel Sambuc /* First arg is the name of the Index register (must already exist) */ 738*433d6423SLionel Sambuc 739*433d6423SLionel Sambuc Arg = Op->Common.Value.Arg; 740*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 741*433d6423SLionel Sambuc ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 742*433d6423SLionel Sambuc ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 743*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 744*433d6423SLionel Sambuc { 745*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 746*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 747*433d6423SLionel Sambuc } 748*433d6423SLionel Sambuc 749*433d6423SLionel Sambuc /* Second arg is the data register (must already exist) */ 750*433d6423SLionel Sambuc 751*433d6423SLionel Sambuc Arg = Arg->Common.Next; 752*433d6423SLionel Sambuc Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 753*433d6423SLionel Sambuc ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 754*433d6423SLionel Sambuc ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); 755*433d6423SLionel Sambuc if (ACPI_FAILURE (Status)) 756*433d6423SLionel Sambuc { 757*433d6423SLionel Sambuc ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 758*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 759*433d6423SLionel Sambuc } 760*433d6423SLionel Sambuc 761*433d6423SLionel Sambuc /* Next arg is the field flags */ 762*433d6423SLionel Sambuc 763*433d6423SLionel Sambuc Arg = Arg->Common.Next; 764*433d6423SLionel Sambuc Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 765*433d6423SLionel Sambuc 766*433d6423SLionel Sambuc /* Each remaining arg is a Named Field */ 767*433d6423SLionel Sambuc 768*433d6423SLionel Sambuc Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD; 769*433d6423SLionel Sambuc Info.RegionNode = RegionNode; 770*433d6423SLionel Sambuc 771*433d6423SLionel Sambuc Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 772*433d6423SLionel Sambuc 773*433d6423SLionel Sambuc return_ACPI_STATUS (Status); 774*433d6423SLionel Sambuc } 775*433d6423SLionel Sambuc 776*433d6423SLionel Sambuc 777