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