|
||||
Warning, cross-references for /kernel/drivers/acpica/dsfield.c need to be fixed.
0001 /****************************************************************************** 0002 * 0003 * Module Name: dsfield - Dispatcher field routines 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 0012 * All rights reserved. 0013 * 0014 * 2. License 0015 * 0016 * 2.1. This is your license from Intel Corp. under its intellectual property 0017 * rights. You may have additional license terms from the party that provided 0018 * you this software, covering your right to use that party's intellectual 0019 * property rights. 0020 * 0021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0022 * copy of the source code appearing in this file ("Covered Code") an 0023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0024 * base code distributed originally by Intel ("Original Intel Code") to copy, 0025 * make derivatives, distribute, use and display any portion of the Covered 0026 * Code in any form, with the right to sublicense such rights; and 0027 * 0028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0029 * license (with the right to sublicense), under only those claims of Intel 0030 * patents that are infringed by the Original Intel Code, to make, use, sell, 0031 * offer to sell, and import the Covered Code and derivative works thereof 0032 * solely to the minimum extent necessary to exercise the above copyright 0033 * license, and in no event shall the patent license extend to any additions 0034 * to or modifications of the Original Intel Code. No other license or right 0035 * is granted directly or by implication, estoppel or otherwise; 0036 * 0037 * The above copyright and patent license is granted only if the following 0038 * conditions are met: 0039 * 0040 * 3. Conditions 0041 * 0042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0043 * Redistribution of source code of any substantial portion of the Covered 0044 * Code or modification with rights to further distribute source must include 0045 * the above Copyright Notice, the above License, this list of Conditions, 0046 * and the following Disclaimer and Export Compliance provision. In addition, 0047 * Licensee must cause all Covered Code to which Licensee contributes to 0048 * contain a file documenting the changes Licensee made to create that Covered 0049 * Code and the date of any change. Licensee must include in that file the 0050 * documentation of any changes made by any predecessor Licensee. Licensee 0051 * must include a prominent statement that the modification is derived, 0052 * directly or indirectly, from Original Intel Code. 0053 * 0054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0055 * Redistribution of source code of any substantial portion of the Covered 0056 * Code or modification without rights to further distribute source must 0057 * include the following Disclaimer and Export Compliance provision in the 0058 * documentation and/or other materials provided with distribution. In 0059 * addition, Licensee may not authorize further sublicense of source of any 0060 * portion of the Covered Code, and must include terms to the effect that the 0061 * license from Licensee to its licensee is limited to the intellectual 0062 * property embodied in the software Licensee provides to its licensee, and 0063 * not to intellectual property embodied in modifications its licensee may 0064 * make. 0065 * 0066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0067 * substantial portion of the Covered Code or modification must reproduce the 0068 * above Copyright Notice, and the following Disclaimer and Export Compliance 0069 * provision in the documentation and/or other materials provided with the 0070 * distribution. 0071 * 0072 * 3.4. Intel retains all right, title, and interest in and to the Original 0073 * Intel Code. 0074 * 0075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0076 * Intel shall be used in advertising or otherwise to promote the sale, use or 0077 * other dealings in products derived from or relating to the Covered Code 0078 * without prior written authorization from Intel. 0079 * 0080 * 4. Disclaimer and Export Compliance 0081 * 0082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0088 * PARTICULAR PURPOSE. 0089 * 0090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0097 * LIMITED REMEDY. 0098 * 0099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0100 * software or system incorporating such software without first obtaining any 0101 * required license or other approval from the U. S. Department of Commerce or 0102 * any other agency or department of the United States Government. In the 0103 * event Licensee exports any such software from the United States or 0104 * re-exports any such software from a foreign destination, Licensee shall 0105 * ensure that the distribution and export/re-export of the software is in 0106 * compliance with all laws, regulations, orders, or other restrictions of the 0107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0108 * any of its subsidiaries will export/re-export any technical data, process, 0109 * software, or service, directly or indirectly, to any country for which the 0110 * United States government or any agency thereof requires an export license, 0111 * other governmental approval, or letter of assurance, without first obtaining 0112 * such license, approval or letter. 0113 * 0114 *****************************************************************************/ 0115 0116 #define __DSFIELD_C__ 0117 0118 #include "acpi.h" 0119 #include "accommon.h" 0120 #include "amlcode.h" 0121 #include "acdispat.h" 0122 #include "acinterp.h" 0123 #include "acnamesp.h" 0124 #include "acparser.h" 0125 0126 0127 #define _COMPONENT ACPI_DISPATCHER 0128 ACPI_MODULE_NAME ("dsfield") 0129 0130 /* Local prototypes */ 0131 0132 static ACPI_STATUS 0133 AcpiDsGetFieldNames ( 0134 ACPI_CREATE_FIELD_INFO *Info, 0135 ACPI_WALK_STATE *WalkState, 0136 ACPI_PARSE_OBJECT *Arg); 0137 0138 0139 /******************************************************************************* 0140 * 0141 * FUNCTION: AcpiDsCreateBufferField 0142 * 0143 * PARAMETERS: Op - Current parse op (CreateXXField) 0144 * WalkState - Current state 0145 * 0146 * RETURN: Status 0147 * 0148 * DESCRIPTION: Execute the CreateField operators: 0149 * CreateBitFieldOp, 0150 * CreateByteFieldOp, 0151 * CreateWordFieldOp, 0152 * CreateDWordFieldOp, 0153 * CreateQWordFieldOp, 0154 * CreateFieldOp (all of which define a field in a buffer) 0155 * 0156 ******************************************************************************/ 0157 0158 ACPI_STATUS 0159 AcpiDsCreateBufferField ( 0160 ACPI_PARSE_OBJECT *Op, 0161 ACPI_WALK_STATE *WalkState) 0162 { 0163 ACPI_PARSE_OBJECT *Arg; 0164 ACPI_NAMESPACE_NODE *Node; 0165 ACPI_STATUS Status; 0166 ACPI_OPERAND_OBJECT *ObjDesc; 0167 ACPI_OPERAND_OBJECT *SecondDesc = NULL; 0168 UINT32 Flags; 0169 0170 0171 ACPI_FUNCTION_TRACE (DsCreateBufferField); 0172 0173 0174 /* 0175 * Get the NameString argument (name of the new BufferField) 0176 */ 0177 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) 0178 { 0179 /* For CreateField, name is the 4th argument */ 0180 0181 Arg = AcpiPsGetArg (Op, 3); 0182 } 0183 else 0184 { 0185 /* For all other CreateXXXField operators, name is the 3rd argument */ 0186 0187 Arg = AcpiPsGetArg (Op, 2); 0188 } 0189 0190 if (!Arg) 0191 { 0192 return_ACPI_STATUS (AE_AML_NO_OPERAND); 0193 } 0194 0195 if (WalkState->DeferredNode) 0196 { 0197 Node = WalkState->DeferredNode; 0198 Status = AE_OK; 0199 } 0200 else 0201 { 0202 /* Execute flag should always be set when this function is entered */ 0203 0204 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) 0205 { 0206 return_ACPI_STATUS (AE_AML_INTERNAL); 0207 } 0208 0209 /* Creating new namespace node, should not already exist */ 0210 0211 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 0212 ACPI_NS_ERROR_IF_FOUND; 0213 0214 /* Mark node temporary if we are executing a method */ 0215 0216 if (WalkState->MethodNode) 0217 { 0218 Flags |= ACPI_NS_TEMPORARY; 0219 } 0220 0221 /* Enter the NameString into the namespace */ 0222 0223 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 0224 ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS1, 0225 Flags, WalkState, &Node); 0226 if (ACPI_FAILURE (Status)) 0227 { 0228 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 0229 return_ACPI_STATUS (Status); 0230 } 0231 } 0232 0233 /* 0234 * We could put the returned object (Node) on the object stack for later, 0235 * but for now, we will put it in the "op" object that the parser uses, 0236 * so we can get it again at the end of this scope. 0237 */ 0238 Op->Common.Node = Node; 0239 0240 /* 0241 * If there is no object attached to the node, this node was just created 0242 * and we need to create the field object. Otherwise, this was a lookup 0243 * of an existing node and we don't want to create the field object again. 0244 */ 0245 ObjDesc = AcpiNsGetAttachedObject (Node); 0246 if (ObjDesc) 0247 { 0248 return_ACPI_STATUS (AE_OK); 0249 } 0250 0251 /* 0252 * The Field definition is not fully parsed at this time. 0253 * (We must save the address of the AML for the buffer and index operands) 0254 */ 0255 0256 /* Create the buffer field object */ 0257 0258 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER_FIELD); 0259 if (!ObjDesc) 0260 { 0261 Status = AE_NO_MEMORY; 0262 goto Cleanup; 0263 } 0264 0265 /* 0266 * Remember location in AML stream of the field unit opcode and operands -- 0267 * since the buffer and index operands must be evaluated. 0268 */ 0269 SecondDesc = ObjDesc->Common.NextObject; 0270 SecondDesc->Extra.AmlStart = Op->Named.Data; 0271 SecondDesc->Extra.AmlLength = Op->Named.Length; 0272 ObjDesc->BufferField.Node = Node; 0273 0274 /* Attach constructed field descriptors to parent node */ 0275 0276 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD); 0277 if (ACPI_FAILURE (Status)) 0278 { 0279 goto Cleanup; 0280 } 0281 0282 0283 Cleanup: 0284 0285 /* Remove local reference to the object */ 0286 0287 AcpiUtRemoveReference (ObjDesc); 0288 return_ACPI_STATUS (Status); 0289 } 0290 0291 0292 /******************************************************************************* 0293 * 0294 * FUNCTION: AcpiDsGetFieldNames 0295 * 0296 * PARAMETERS: Info - CreateField info structure 0297 * ` WalkState - Current method state 0298 * Arg - First parser arg for the field name list 0299 * 0300 * RETURN: Status 0301 * 0302 * DESCRIPTION: Process all named fields in a field declaration. Names are 0303 * entered into the namespace. 0304 * 0305 ******************************************************************************/ 0306 0307 static ACPI_STATUS 0308 AcpiDsGetFieldNames ( 0309 ACPI_CREATE_FIELD_INFO *Info, 0310 ACPI_WALK_STATE *WalkState, 0311 ACPI_PARSE_OBJECT *Arg) 0312 { 0313 ACPI_STATUS Status; 0314 ACPI_INTEGER Position; 0315 0316 0317 ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info); 0318 0319 0320 /* First field starts at bit zero */ 0321 0322 Info->FieldBitPosition = 0; 0323 0324 /* Process all elements in the field list (of parse nodes) */ 0325 0326 while (Arg) 0327 { 0328 /* 0329 * Three types of field elements are handled: 0330 * 1) Offset - specifies a bit offset 0331 * 2) AccessAs - changes the access mode 0332 * 3) Name - Enters a new named field into the namespace 0333 */ 0334 switch (Arg->Common.AmlOpcode) 0335 { 0336 case AML_INT_RESERVEDFIELD_OP: 0337 0338 Position = (ACPI_INTEGER) Info->FieldBitPosition 0339 + (ACPI_INTEGER) Arg->Common.Value.Size; 0340 0341 if (Position > ACPI_UINT32_MAX) 0342 { 0343 ACPI_ERROR ((AE_INFO, 0344 "Bit offset within field too large (> 0xFFFFFFFF)")); 0345 return_ACPI_STATUS (AE_SUPPORT); 0346 } 0347 0348 Info->FieldBitPosition = (UINT32) Position; 0349 break; 0350 0351 0352 case AML_INT_ACCESSFIELD_OP: 0353 0354 /* 0355 * Get a new AccessType and AccessAttribute -- to be used for all 0356 * field units that follow, until field end or another AccessAs 0357 * keyword. 0358 * 0359 * In FieldFlags, preserve the flag bits other than the 0360 * ACCESS_TYPE bits 0361 */ 0362 Info->FieldFlags = (UINT8) 0363 ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | 0364 ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8))); 0365 0366 Info->Attribute = (UINT8) (Arg->Common.Value.Integer); 0367 break; 0368 0369 0370 case AML_INT_NAMEDFIELD_OP: 0371 0372 /* Lookup the name, it should already exist */ 0373 0374 Status = AcpiNsLookup (WalkState->ScopeInfo, 0375 (char *) &Arg->Named.Name, Info->FieldType, 0376 ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, 0377 WalkState, &Info->FieldNode); 0378 if (ACPI_FAILURE (Status)) 0379 { 0380 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); 0381 return_ACPI_STATUS (Status); 0382 } 0383 else 0384 { 0385 Arg->Common.Node = Info->FieldNode; 0386 Info->FieldBitLength = Arg->Common.Value.Size; 0387 0388 /* 0389 * If there is no object attached to the node, this node was 0390 * just created and we need to create the field object. 0391 * Otherwise, this was a lookup of an existing node and we 0392 * don't want to create the field object again. 0393 */ 0394 if (!AcpiNsGetAttachedObject (Info->FieldNode)) 0395 { 0396 Status = AcpiExPrepFieldValue (Info); 0397 if (ACPI_FAILURE (Status)) 0398 { 0399 return_ACPI_STATUS (Status); 0400 } 0401 } 0402 } 0403 0404 /* Keep track of bit position for the next field */ 0405 0406 Position = (ACPI_INTEGER) Info->FieldBitPosition 0407 + (ACPI_INTEGER) Arg->Common.Value.Size; 0408 0409 if (Position > ACPI_UINT32_MAX) 0410 { 0411 ACPI_ERROR ((AE_INFO, 0412 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)", 0413 ACPI_CAST_PTR (char, &Info->FieldNode->Name))); 0414 return_ACPI_STATUS (AE_SUPPORT); 0415 } 0416 0417 Info->FieldBitPosition += Info->FieldBitLength; 0418 break; 0419 0420 0421 default: 0422 0423 ACPI_ERROR ((AE_INFO, 0424 "Invalid opcode in field list: %X", Arg->Common.AmlOpcode)); 0425 return_ACPI_STATUS (AE_AML_BAD_OPCODE); 0426 } 0427 0428 Arg = Arg->Common.Next; 0429 } 0430 0431 return_ACPI_STATUS (AE_OK); 0432 } 0433 0434 0435 /******************************************************************************* 0436 * 0437 * FUNCTION: AcpiDsCreateField 0438 * 0439 * PARAMETERS: Op - Op containing the Field definition and args 0440 * RegionNode - Object for the containing Operation Region 0441 * ` WalkState - Current method state 0442 * 0443 * RETURN: Status 0444 * 0445 * DESCRIPTION: Create a new field in the specified operation region 0446 * 0447 ******************************************************************************/ 0448 0449 ACPI_STATUS 0450 AcpiDsCreateField ( 0451 ACPI_PARSE_OBJECT *Op, 0452 ACPI_NAMESPACE_NODE *RegionNode, 0453 ACPI_WALK_STATE *WalkState) 0454 { 0455 ACPI_STATUS Status; 0456 ACPI_PARSE_OBJECT *Arg; 0457 ACPI_CREATE_FIELD_INFO Info; 0458 0459 0460 ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op); 0461 0462 0463 /* First arg is the name of the parent OpRegion (must already exist) */ 0464 0465 Arg = Op->Common.Value.Arg; 0466 if (!RegionNode) 0467 { 0468 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, 0469 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 0470 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 0471 if (ACPI_FAILURE (Status)) 0472 { 0473 ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); 0474 return_ACPI_STATUS (Status); 0475 } 0476 } 0477 0478 /* Second arg is the field flags */ 0479 0480 Arg = Arg->Common.Next; 0481 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 0482 Info.Attribute = 0; 0483 0484 /* Each remaining arg is a Named Field */ 0485 0486 Info.FieldType = ACPI_TYPE_LOCAL_REGION_FIELD; 0487 Info.RegionNode = RegionNode; 0488 0489 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 0490 0491 return_ACPI_STATUS (Status); 0492 } 0493 0494 0495 /******************************************************************************* 0496 * 0497 * FUNCTION: AcpiDsInitFieldObjects 0498 * 0499 * PARAMETERS: Op - Op containing the Field definition and args 0500 * ` WalkState - Current method state 0501 * 0502 * RETURN: Status 0503 * 0504 * DESCRIPTION: For each "Field Unit" name in the argument list that is 0505 * part of the field declaration, enter the name into the 0506 * namespace. 0507 * 0508 ******************************************************************************/ 0509 0510 ACPI_STATUS 0511 AcpiDsInitFieldObjects ( 0512 ACPI_PARSE_OBJECT *Op, 0513 ACPI_WALK_STATE *WalkState) 0514 { 0515 ACPI_STATUS Status; 0516 ACPI_PARSE_OBJECT *Arg = NULL; 0517 ACPI_NAMESPACE_NODE *Node; 0518 UINT8 Type = 0; 0519 UINT32 Flags; 0520 0521 0522 ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op); 0523 0524 0525 /* Execute flag should always be set when this function is entered */ 0526 0527 if (!(WalkState->ParseFlags & ACPI_PARSE_EXECUTE)) 0528 { 0529 if (WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP) 0530 { 0531 /* BankField Op is deferred, just return OK */ 0532 0533 return_ACPI_STATUS (AE_OK); 0534 } 0535 0536 return_ACPI_STATUS (AE_AML_INTERNAL); 0537 } 0538 0539 /* 0540 * Get the FieldList argument for this opcode. This is the start of the 0541 * list of field elements. 0542 */ 0543 switch (WalkState->Opcode) 0544 { 0545 case AML_FIELD_OP: 0546 Arg = AcpiPsGetArg (Op, 2); 0547 Type = ACPI_TYPE_LOCAL_REGION_FIELD; 0548 break; 0549 0550 case AML_BANK_FIELD_OP: 0551 Arg = AcpiPsGetArg (Op, 4); 0552 Type = ACPI_TYPE_LOCAL_BANK_FIELD; 0553 break; 0554 0555 case AML_INDEX_FIELD_OP: 0556 Arg = AcpiPsGetArg (Op, 3); 0557 Type = ACPI_TYPE_LOCAL_INDEX_FIELD; 0558 break; 0559 0560 default: 0561 return_ACPI_STATUS (AE_BAD_PARAMETER); 0562 } 0563 0564 /* Creating new namespace node(s), should not already exist */ 0565 0566 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | 0567 ACPI_NS_ERROR_IF_FOUND; 0568 0569 /* Mark node(s) temporary if we are executing a method */ 0570 0571 if (WalkState->MethodNode) 0572 { 0573 Flags |= ACPI_NS_TEMPORARY; 0574 } 0575 0576 /* 0577 * Walk the list of entries in the FieldList 0578 * Note: FieldList can be of zero length. In this case, Arg will be NULL. 0579 */ 0580 while (Arg) 0581 { 0582 /* 0583 * Ignore OFFSET and ACCESSAS terms here; we are only interested in the 0584 * field names in order to enter them into the namespace. 0585 */ 0586 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) 0587 { 0588 Status = AcpiNsLookup (WalkState->ScopeInfo, 0589 (char *) &Arg->Named.Name, Type, ACPI_IMODE_LOAD_PASS1, 0590 Flags, WalkState, &Node); 0591 if (ACPI_FAILURE (Status)) 0592 { 0593 ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); 0594 if (Status != AE_ALREADY_EXISTS) 0595 { 0596 return_ACPI_STATUS (Status); 0597 } 0598 0599 /* Name already exists, just ignore this error */ 0600 0601 Status = AE_OK; 0602 } 0603 0604 Arg->Common.Node = Node; 0605 } 0606 0607 /* Get the next field element in the list */ 0608 0609 Arg = Arg->Common.Next; 0610 } 0611 0612 return_ACPI_STATUS (AE_OK); 0613 } 0614 0615 0616 /******************************************************************************* 0617 * 0618 * FUNCTION: AcpiDsCreateBankField 0619 * 0620 * PARAMETERS: Op - Op containing the Field definition and args 0621 * RegionNode - Object for the containing Operation Region 0622 * WalkState - Current method state 0623 * 0624 * RETURN: Status 0625 * 0626 * DESCRIPTION: Create a new bank field in the specified operation region 0627 * 0628 ******************************************************************************/ 0629 0630 ACPI_STATUS 0631 AcpiDsCreateBankField ( 0632 ACPI_PARSE_OBJECT *Op, 0633 ACPI_NAMESPACE_NODE *RegionNode, 0634 ACPI_WALK_STATE *WalkState) 0635 { 0636 ACPI_STATUS Status; 0637 ACPI_PARSE_OBJECT *Arg; 0638 ACPI_CREATE_FIELD_INFO Info; 0639 0640 0641 ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op); 0642 0643 0644 /* First arg is the name of the parent OpRegion (must already exist) */ 0645 0646 Arg = Op->Common.Value.Arg; 0647 if (!RegionNode) 0648 { 0649 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, 0650 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 0651 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 0652 if (ACPI_FAILURE (Status)) 0653 { 0654 ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); 0655 return_ACPI_STATUS (Status); 0656 } 0657 } 0658 0659 /* Second arg is the Bank Register (Field) (must already exist) */ 0660 0661 Arg = Arg->Common.Next; 0662 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 0663 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 0664 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 0665 if (ACPI_FAILURE (Status)) 0666 { 0667 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 0668 return_ACPI_STATUS (Status); 0669 } 0670 0671 /* 0672 * Third arg is the BankValue 0673 * This arg is a TermArg, not a constant 0674 * It will be evaluated later, by AcpiDsEvalBankFieldOperands 0675 */ 0676 Arg = Arg->Common.Next; 0677 0678 /* Fourth arg is the field flags */ 0679 0680 Arg = Arg->Common.Next; 0681 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 0682 0683 /* Each remaining arg is a Named Field */ 0684 0685 Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD; 0686 Info.RegionNode = RegionNode; 0687 0688 /* 0689 * Use Info.DataRegisterNode to store BankField Op 0690 * It's safe because DataRegisterNode will never be used when create bank field 0691 * We store AmlStart and AmlLength in the BankField Op for late evaluation 0692 * Used in AcpiExPrepFieldValue(Info) 0693 * 0694 * TBD: Or, should we add a field in ACPI_CREATE_FIELD_INFO, like "void *ParentOp"? 0695 */ 0696 Info.DataRegisterNode = (ACPI_NAMESPACE_NODE*) Op; 0697 0698 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 0699 return_ACPI_STATUS (Status); 0700 } 0701 0702 0703 /******************************************************************************* 0704 * 0705 * FUNCTION: AcpiDsCreateIndexField 0706 * 0707 * PARAMETERS: Op - Op containing the Field definition and args 0708 * RegionNode - Object for the containing Operation Region 0709 * ` WalkState - Current method state 0710 * 0711 * RETURN: Status 0712 * 0713 * DESCRIPTION: Create a new index field in the specified operation region 0714 * 0715 ******************************************************************************/ 0716 0717 ACPI_STATUS 0718 AcpiDsCreateIndexField ( 0719 ACPI_PARSE_OBJECT *Op, 0720 ACPI_NAMESPACE_NODE *RegionNode, 0721 ACPI_WALK_STATE *WalkState) 0722 { 0723 ACPI_STATUS Status; 0724 ACPI_PARSE_OBJECT *Arg; 0725 ACPI_CREATE_FIELD_INFO Info; 0726 0727 0728 ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op); 0729 0730 0731 /* First arg is the name of the Index register (must already exist) */ 0732 0733 Arg = Op->Common.Value.Arg; 0734 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 0735 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 0736 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 0737 if (ACPI_FAILURE (Status)) 0738 { 0739 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 0740 return_ACPI_STATUS (Status); 0741 } 0742 0743 /* Second arg is the data register (must already exist) */ 0744 0745 Arg = Arg->Common.Next; 0746 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, 0747 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 0748 ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); 0749 if (ACPI_FAILURE (Status)) 0750 { 0751 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); 0752 return_ACPI_STATUS (Status); 0753 } 0754 0755 /* Next arg is the field flags */ 0756 0757 Arg = Arg->Common.Next; 0758 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer; 0759 0760 /* Each remaining arg is a Named Field */ 0761 0762 Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD; 0763 Info.RegionNode = RegionNode; 0764 0765 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); 0766 0767 return_ACPI_STATUS (Status); 0768 } 0769 0770
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |