1/****************************************************************************** 2 * 3 * Module Name: dsfield - Dispatcher field routines |
4 * $Revision: 65 $ |
5 * 6 *****************************************************************************/ 7 8/****************************************************************************** 9 * 10 * 1. Copyright Notice 11 * 12 * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp. --- 148 unchanged lines hidden (view full) --- 161 UINT32 Flags; 162 163 164 ACPI_FUNCTION_TRACE ("DsCreateBufferField"); 165 166 167 /* Get the NameString argument */ 168 |
169 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) |
170 { 171 Arg = AcpiPsGetArg (Op, 3); 172 } 173 else 174 { 175 /* Create Bit/Byte/Word/Dword field */ 176 177 Arg = AcpiPsGetArg (Op, 2); --- 16 unchanged lines hidden (view full) --- 194 else 195 { 196 Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND; 197 } 198 199 /* 200 * Enter the NameString into the namespace 201 */ |
202 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, |
203 INTERNAL_TYPE_DEF_ANY, ACPI_IMODE_LOAD_PASS1, 204 Flags, WalkState, &(Node)); 205 if (ACPI_FAILURE (Status)) 206 { 207 return_ACPI_STATUS (Status); 208 } 209 210 /* We could put the returned object (Node) on the object stack for later, but 211 * for now, we will put it in the "op" object that the parser uses, so we 212 * can get it again at the end of this scope 213 */ |
214 Op->Common.Node = Node; |
215 216 /* 217 * If there is no object attached to the node, this node was just created and 218 * we need to create the field object. Otherwise, this was a lookup of an 219 * existing node and we don't want to create the field object again. 220 */ 221 ObjDesc = AcpiNsGetAttachedObject (Node); 222 if (ObjDesc) --- 16 unchanged lines hidden (view full) --- 239 } 240 241 /* 242 * Remember location in AML stream of the field unit 243 * opcode and operands -- since the buffer and index 244 * operands must be evaluated. 245 */ 246 SecondDesc = ObjDesc->Common.NextObject; |
247 SecondDesc->Extra.AmlStart = Op->Named.Data; 248 SecondDesc->Extra.AmlLength = Op->Named.Length; |
249 ObjDesc->BufferField.Node = Node; 250 251 /* Attach constructed field descriptors to parent node */ 252 253 Status = AcpiNsAttachObject (Node, ObjDesc, ACPI_TYPE_BUFFER_FIELD); 254 if (ACPI_FAILURE (Status)) 255 { 256 goto Cleanup; --- 26 unchanged lines hidden (view full) --- 283 284ACPI_STATUS 285AcpiDsGetFieldNames ( 286 ACPI_CREATE_FIELD_INFO *Info, 287 ACPI_WALK_STATE *WalkState, 288 ACPI_PARSE_OBJECT *Arg) 289{ 290 ACPI_STATUS Status; |
291 ACPI_INTEGER Position; |
292 293 294 ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info); 295 296 297 /* First field starts at bit zero */ 298 299 Info->FieldBitPosition = 0; 300 301 /* Process all elements in the field list (of parse nodes) */ 302 303 while (Arg) 304 { 305 /* 306 * Three types of field elements are handled: 307 * 1) Offset - specifies a bit offset 308 * 2) AccessAs - changes the access mode 309 * 3) Name - Enters a new named field into the namespace 310 */ |
311 switch (Arg->Common.AmlOpcode) |
312 { 313 case AML_INT_RESERVEDFIELD_OP: 314 |
315 Position = (ACPI_INTEGER) Info->FieldBitPosition 316 + (ACPI_INTEGER) Arg->Common.Value.Size; 317 318 if (Position > ACPI_UINT32_MAX) |
319 { 320 ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n")); 321 return_ACPI_STATUS (AE_SUPPORT); 322 } 323 |
324 Info->FieldBitPosition = (UINT32) Position; |
325 break; 326 327 328 case AML_INT_ACCESSFIELD_OP: 329 330 /* 331 * Get a new AccessType and AccessAttribute -- to be used for all 332 * field units that follow, until field end or another AccessAs keyword. 333 * 334 * In FieldFlags, preserve the flag bits other than the ACCESS_TYPE bits 335 */ 336 Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) | |
337 ((UINT8) (Arg->Common.Value.Integer32 >> 8))); |
338 |
339 Info->Attribute = (UINT8) (Arg->Common.Value.Integer32); |
340 break; 341 342 343 case AML_INT_NAMEDFIELD_OP: 344 345 /* Lookup the name */ 346 347 Status = AcpiNsLookup (WalkState->ScopeInfo, |
348 (NATIVE_CHAR *) &Arg->Named.Name, |
349 Info->FieldType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE, 350 WalkState, &Info->FieldNode); 351 if (ACPI_FAILURE (Status)) 352 { 353 if (Status != AE_ALREADY_EXISTS) 354 { 355 return_ACPI_STATUS (Status); 356 } 357 358 ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", |
359 &Arg->Named.Name)); |
360 } 361 else 362 { |
363 Arg->Common.Node = Info->FieldNode; 364 Info->FieldBitLength = Arg->Common.Value.Size; |
365 366 /* Create and initialize an object for the new Field Node */ 367 368 Status = AcpiExPrepFieldValue (Info); 369 if (ACPI_FAILURE (Status)) 370 { 371 return_ACPI_STATUS (Status); 372 } 373 } 374 375 /* Keep track of bit position for the next field */ 376 |
377 Position = (ACPI_INTEGER) Info->FieldBitPosition 378 + (ACPI_INTEGER) Arg->Common.Value.Size; 379 380 if (Position > ACPI_UINT32_MAX) |
381 { 382 ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n", 383 &Info->FieldNode->Name)); 384 return_ACPI_STATUS (AE_SUPPORT); 385 } 386 387 Info->FieldBitPosition += Info->FieldBitLength; 388 break; 389 390 391 default: 392 393 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n", |
394 Arg->Common.AmlOpcode)); 395 return_ACPI_STATUS (AE_AML_BAD_OPCODE); |
396 } 397 |
398 Arg = Arg->Common.Next; |
399 } 400 401 return_ACPI_STATUS (AE_OK); 402} 403 404 405/******************************************************************************* 406 * --- 10 unchanged lines hidden (view full) --- 417 ******************************************************************************/ 418 419ACPI_STATUS 420AcpiDsCreateField ( 421 ACPI_PARSE_OBJECT *Op, 422 ACPI_NAMESPACE_NODE *RegionNode, 423 ACPI_WALK_STATE *WalkState) 424{ |
425 ACPI_STATUS Status; |
426 ACPI_PARSE_OBJECT *Arg; 427 ACPI_CREATE_FIELD_INFO Info; 428 429 430 ACPI_FUNCTION_TRACE_PTR ("DsCreateField", Op); 431 432 433 /* First arg is the name of the parent OpRegion (must already exist) */ 434 |
435 Arg = Op->Common.Value.Arg; |
436 if (!RegionNode) 437 { |
438 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, |
439 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 440 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 441 if (ACPI_FAILURE (Status)) 442 { 443 return_ACPI_STATUS (Status); 444 } 445 } 446 447 /* Second arg is the field flags */ 448 |
449 Arg = Arg->Common.Next; 450 Info.FieldFlags = Arg->Common.Value.Integer8; |
451 Info.Attribute = 0; 452 453 /* Each remaining arg is a Named Field */ 454 455 Info.FieldType = INTERNAL_TYPE_REGION_FIELD; 456 Info.RegionNode = RegionNode; 457 |
458 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); |
459 460 return_ACPI_STATUS (Status); 461} 462 463 464/******************************************************************************* 465 * 466 * FUNCTION: AcpiDsInitFieldObjects --- 9 unchanged lines hidden (view full) --- 476 * 477 ******************************************************************************/ 478 479ACPI_STATUS 480AcpiDsInitFieldObjects ( 481 ACPI_PARSE_OBJECT *Op, 482 ACPI_WALK_STATE *WalkState) 483{ |
484 ACPI_STATUS Status; |
485 ACPI_PARSE_OBJECT *Arg = NULL; 486 ACPI_NAMESPACE_NODE *Node; 487 UINT8 Type = 0; 488 489 490 ACPI_FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op); 491 492 --- 8 unchanged lines hidden (view full) --- 501 Arg = AcpiPsGetArg (Op, 4); 502 Type = INTERNAL_TYPE_BANK_FIELD; 503 break; 504 505 case AML_INDEX_FIELD_OP: 506 Arg = AcpiPsGetArg (Op, 3); 507 Type = INTERNAL_TYPE_INDEX_FIELD; 508 break; |
509 510 default: 511 return_ACPI_STATUS (AE_BAD_PARAMETER); |
512 } 513 514 /* 515 * Walk the list of entries in the FieldList 516 */ 517 while (Arg) 518 { 519 /* Ignore OFFSET and ACCESSAS terms here */ 520 |
521 if (Arg->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) |
522 { 523 Status = AcpiNsLookup (WalkState->ScopeInfo, |
524 (NATIVE_CHAR *) &Arg->Named.Name, |
525 Type, ACPI_IMODE_LOAD_PASS1, 526 ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, 527 WalkState, &Node); 528 if (ACPI_FAILURE (Status)) 529 { 530 if (Status != AE_ALREADY_EXISTS) 531 { 532 return_ACPI_STATUS (Status); 533 } 534 535 ACPI_REPORT_ERROR (("Field name [%4.4s] already exists in current scope\n", |
536 &Arg->Named.Name)); 537 538 /* Name already exists, just ignore this error */ 539 540 Status = AE_OK; |
541 } 542 |
543 Arg->Common.Node = Node; |
544 } 545 546 /* Move to next field in the list */ 547 |
548 Arg = Arg->Common.Next; |
549 } 550 |
551 return_ACPI_STATUS (AE_OK); |
552} 553 554 555/******************************************************************************* 556 * 557 * FUNCTION: AcpiDsCreateBankField 558 * 559 * PARAMETERS: Op - Op containing the Field definition and args --- 7 unchanged lines hidden (view full) --- 567 ******************************************************************************/ 568 569ACPI_STATUS 570AcpiDsCreateBankField ( 571 ACPI_PARSE_OBJECT *Op, 572 ACPI_NAMESPACE_NODE *RegionNode, 573 ACPI_WALK_STATE *WalkState) 574{ |
575 ACPI_STATUS Status; |
576 ACPI_PARSE_OBJECT *Arg; 577 ACPI_CREATE_FIELD_INFO Info; 578 579 580 ACPI_FUNCTION_TRACE_PTR ("DsCreateBankField", Op); 581 582 583 /* First arg is the name of the parent OpRegion (must already exist) */ 584 |
585 Arg = Op->Common.Value.Arg; |
586 if (!RegionNode) 587 { |
588 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, |
589 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, 590 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); 591 if (ACPI_FAILURE (Status)) 592 { 593 return_ACPI_STATUS (Status); 594 } 595 } 596 597 /* Second arg is the Bank Register (must already exist) */ 598 |
599 Arg = Arg->Common.Next; 600 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, |
601 INTERNAL_TYPE_BANK_FIELD_DEFN, ACPI_IMODE_EXECUTE, 602 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 603 if (ACPI_FAILURE (Status)) 604 { 605 return_ACPI_STATUS (Status); 606 } 607 608 /* Third arg is the BankValue */ 609 |
610 Arg = Arg->Common.Next; 611 Info.BankValue = Arg->Common.Value.Integer32; |
612 613 /* Fourth arg is the field flags */ 614 |
615 Arg = Arg->Common.Next; 616 Info.FieldFlags = Arg->Common.Value.Integer8; |
617 618 /* Each remaining arg is a Named Field */ 619 620 Info.FieldType = INTERNAL_TYPE_BANK_FIELD; 621 Info.RegionNode = RegionNode; 622 |
623 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); |
624 625 return_ACPI_STATUS (Status); 626} 627 628 629/******************************************************************************* 630 * 631 * FUNCTION: AcpiDsCreateIndexField --- 19 unchanged lines hidden (view full) --- 651 ACPI_CREATE_FIELD_INFO Info; 652 653 654 ACPI_FUNCTION_TRACE_PTR ("DsCreateIndexField", Op); 655 656 657 /* First arg is the name of the Index register (must already exist) */ 658 |
659 Arg = Op->Common.Value.Arg; 660 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, |
661 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, 662 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); 663 if (ACPI_FAILURE (Status)) 664 { 665 return_ACPI_STATUS (Status); 666 } 667 668 /* Second arg is the data register (must already exist) */ 669 |
670 Arg = Arg->Common.Next; 671 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String, |
672 INTERNAL_TYPE_INDEX_FIELD_DEFN, ACPI_IMODE_EXECUTE, 673 ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); 674 if (ACPI_FAILURE (Status)) 675 { 676 return_ACPI_STATUS (Status); 677 } 678 679 /* Next arg is the field flags */ 680 |
681 Arg = Arg->Common.Next; 682 Info.FieldFlags = Arg->Common.Value.Integer8; |
683 684 685 /* Each remaining arg is a Named Field */ 686 687 Info.FieldType = INTERNAL_TYPE_INDEX_FIELD; 688 Info.RegionNode = RegionNode; 689 |
690 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next); |
691 692 return_ACPI_STATUS (Status); 693} 694 695 |