Deleted Added
full compact
dsfield.c (151937) dsfield.c (167802)
1/******************************************************************************
2 *
3 * Module Name: dsfield - Dispatcher field routines
1/******************************************************************************
2 *
3 * Module Name: dsfield - Dispatcher field routines
4 * $Revision: 1.78 $
4 * $Revision: 1.84 $
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
5 *
6 *****************************************************************************/
7
8/******************************************************************************
9 *
10 * 1. Copyright Notice
11 *
12 * Some or all of this work - Copyright (c) 1999 - 2005, Intel Corp.
12 * Some or all of this work - Copyright (c) 1999 - 2007, 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.

--- 142 unchanged lines hidden (view full) ---

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
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.

--- 142 unchanged lines hidden (view full) ---

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");
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 }

--- 34 unchanged lines hidden (view full) ---

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 {
172
173
174 /* Get the NameString argument */
175
176 if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP)
177 {
178 Arg = AcpiPsGetArg (Op, 3);
179 }

--- 34 unchanged lines hidden (view full) ---

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);
222 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
223 return_ACPI_STATUS (Status);
224 }
225 }
226
223 return_ACPI_STATUS (Status);
224 }
225 }
226
227 /* We could put the returned object (Node) on the object stack for later,
227 /*
228 * 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

--- 67 unchanged lines hidden (view full) ---

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
229 * but for now, we will put it in the "op" object that the parser uses,
230 * so we can get it again at the end of this scope
231 */
232 Op->Common.Node = Node;
233
234 /*
235 * If there is no object attached to the node, this node was just created
236 * and we need to create the field object. Otherwise, this was a lookup

--- 67 unchanged lines hidden (view full) ---

304 ACPI_CREATE_FIELD_INFO *Info,
305 ACPI_WALK_STATE *WalkState,
306 ACPI_PARSE_OBJECT *Arg)
307{
308 ACPI_STATUS Status;
309 ACPI_INTEGER Position;
310
311
311 ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info);
312 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

--- 9 unchanged lines hidden (view full) ---

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 {
313
314
315 /* First field starts at bit zero */
316
317 Info->FieldBitPosition = 0;
318
319 /* Process all elements in the field list (of parse nodes) */
320

--- 9 unchanged lines hidden (view full) ---

330 {
331 case AML_INT_RESERVEDFIELD_OP:
332
333 Position = (ACPI_INTEGER) Info->FieldBitPosition
334 + (ACPI_INTEGER) Arg->Common.Value.Size;
335
336 if (Position > ACPI_UINT32_MAX)
337 {
337 ACPI_REPORT_ERROR ((
338 "Bit offset within field too large (> 0xFFFFFFFF)\n"));
338 ACPI_ERROR ((AE_INFO,
339 "Bit offset within field too large (> 0xFFFFFFFF)"));
339 return_ACPI_STATUS (AE_SUPPORT);
340 }
341
342 Info->FieldBitPosition = (UINT32) Position;
343 break;
344
345
346 case AML_INT_ACCESSFIELD_OP:

--- 20 unchanged lines hidden (view full) ---

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 {
340 return_ACPI_STATUS (AE_SUPPORT);
341 }
342
343 Info->FieldBitPosition = (UINT32) Position;
344 break;
345
346
347 case AML_INT_ACCESSFIELD_OP:

--- 20 unchanged lines hidden (view full) ---

368
369 Status = AcpiNsLookup (WalkState->ScopeInfo,
370 (char *) &Arg->Named.Name,
371 Info->FieldType, ACPI_IMODE_EXECUTE,
372 ACPI_NS_DONT_OPEN_SCOPE,
373 WalkState, &Info->FieldNode);
374 if (ACPI_FAILURE (Status))
375 {
375 ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
376 ACPI_ERROR_NAMESPACE ((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

--- 12 unchanged lines hidden (view full) ---

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 {
377 if (Status != AE_ALREADY_EXISTS)
378 {
379 return_ACPI_STATUS (Status);
380 }
381
382 /* Already exists, ignore error */
383 }
384 else

--- 12 unchanged lines hidden (view full) ---

397
398 /* Keep track of bit position for the next field */
399
400 Position = (ACPI_INTEGER) Info->FieldBitPosition
401 + (ACPI_INTEGER) Arg->Common.Value.Size;
402
403 if (Position > ACPI_UINT32_MAX)
404 {
404 ACPI_REPORT_ERROR ((
405 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
406 (char *) &Info->FieldNode->Name));
405 ACPI_ERROR ((AE_INFO,
406 "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
407 ACPI_CAST_PTR (char, &Info->FieldNode->Name)));
407 return_ACPI_STATUS (AE_SUPPORT);
408 }
409
410 Info->FieldBitPosition += Info->FieldBitLength;
411 break;
412
413
414 default:
415
408 return_ACPI_STATUS (AE_SUPPORT);
409 }
410
411 Info->FieldBitPosition += Info->FieldBitLength;
412 break;
413
414
415 default:
416
416 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
417 "Invalid opcode in field list: %X\n",
417 ACPI_ERROR ((AE_INFO,
418 "Invalid opcode in field list: %X",
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);

--- 20 unchanged lines hidden (view full) ---

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
419 Arg->Common.AmlOpcode));
420 return_ACPI_STATUS (AE_AML_BAD_OPCODE);
421 }
422
423 Arg = Arg->Common.Next;
424 }
425
426 return_ACPI_STATUS (AE_OK);

--- 20 unchanged lines hidden (view full) ---

447 ACPI_NAMESPACE_NODE *RegionNode,
448 ACPI_WALK_STATE *WalkState)
449{
450 ACPI_STATUS Status;
451 ACPI_PARSE_OBJECT *Arg;
452 ACPI_CREATE_FIELD_INFO Info;
453
454
454 ACPI_FUNCTION_TRACE_PTR ("DsCreateField", Op);
455 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 {
456
457
458 /* First arg is the name of the parent OpRegion (must already exist) */
459
460 Arg = Op->Common.Value.Arg;
461 if (!RegionNode)
462 {
463 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
464 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
465 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
466 if (ACPI_FAILURE (Status))
467 {
467 ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
468 ACPI_ERROR_NAMESPACE (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;

--- 31 unchanged lines hidden (view full) ---

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
469 return_ACPI_STATUS (Status);
470 }
471 }
472
473 /* Second arg is the field flags */
474
475 Arg = Arg->Common.Next;
476 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;

--- 31 unchanged lines hidden (view full) ---

508 ACPI_WALK_STATE *WalkState)
509{
510 ACPI_STATUS Status;
511 ACPI_PARSE_OBJECT *Arg = NULL;
512 ACPI_NAMESPACE_NODE *Node;
513 UINT8 Type = 0;
514
515
515 ACPI_FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op);
516 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;

--- 24 unchanged lines hidden (view full) ---

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 {
517
518
519 switch (WalkState->Opcode)
520 {
521 case AML_FIELD_OP:
522 Arg = AcpiPsGetArg (Op, 2);
523 Type = ACPI_TYPE_LOCAL_REGION_FIELD;
524 break;

--- 24 unchanged lines hidden (view full) ---

549 Status = AcpiNsLookup (WalkState->ScopeInfo,
550 (char *) &Arg->Named.Name,
551 Type, ACPI_IMODE_LOAD_PASS1,
552 ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
553 ACPI_NS_ERROR_IF_FOUND,
554 WalkState, &Node);
555 if (ACPI_FAILURE (Status))
556 {
556 ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
557 ACPI_ERROR_NAMESPACE ((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;

--- 31 unchanged lines hidden (view full) ---

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
558 if (Status != AE_ALREADY_EXISTS)
559 {
560 return_ACPI_STATUS (Status);
561 }
562
563 /* Name already exists, just ignore this error */
564
565 Status = AE_OK;

--- 31 unchanged lines hidden (view full) ---

597 ACPI_NAMESPACE_NODE *RegionNode,
598 ACPI_WALK_STATE *WalkState)
599{
600 ACPI_STATUS Status;
601 ACPI_PARSE_OBJECT *Arg;
602 ACPI_CREATE_FIELD_INFO Info;
603
604
604 ACPI_FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
605 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 {
606
607
608 /* First arg is the name of the parent OpRegion (must already exist) */
609
610 Arg = Op->Common.Value.Arg;
611 if (!RegionNode)
612 {
613 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name,
614 ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE,
615 ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
616 if (ACPI_FAILURE (Status))
617 {
617 ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
618 ACPI_ERROR_NAMESPACE (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 {
619 return_ACPI_STATUS (Status);
620 }
621 }
622
623 /* Second arg is the Bank Register (Field) (must already exist) */
624
625 Arg = Arg->Common.Next;
626 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
627 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
628 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
629 if (ACPI_FAILURE (Status))
630 {
630 ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
631 ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
631 return_ACPI_STATUS (Status);
632 }
633
634 /* Third arg is the BankValue */
635
632 return_ACPI_STATUS (Status);
633 }
634
635 /* Third arg is the BankValue */
636
637 /* TBD: This arg is a TermArg, not a constant, and must be evaluated */
638
636 Arg = Arg->Common.Next;
639 Arg = Arg->Common.Next;
637 Info.BankValue = (UINT32) Arg->Common.Value.Integer;
638
640
641 /* Currently, only the following constants are supported */
642
643 switch (Arg->Common.AmlOpcode)
644 {
645 case AML_ZERO_OP:
646 Info.BankValue = 0;
647 break;
648
649 case AML_ONE_OP:
650 Info.BankValue = 1;
651 break;
652
653 case AML_BYTE_OP:
654 case AML_WORD_OP:
655 case AML_DWORD_OP:
656 case AML_QWORD_OP:
657 Info.BankValue = (UINT32) Arg->Common.Value.Integer;
658 break;
659
660 default:
661 Info.BankValue = 0;
662 ACPI_ERROR ((AE_INFO, "Non-constant BankValue for BankField is not implemented"));
663 }
664
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;

--- 25 unchanged lines hidden (view full) ---

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
665 /* Fourth arg is the field flags */
666
667 Arg = Arg->Common.Next;
668 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
669
670 /* Each remaining arg is a Named Field */
671
672 Info.FieldType = ACPI_TYPE_LOCAL_BANK_FIELD;

--- 25 unchanged lines hidden (view full) ---

698 ACPI_NAMESPACE_NODE *RegionNode,
699 ACPI_WALK_STATE *WalkState)
700{
701 ACPI_STATUS Status;
702 ACPI_PARSE_OBJECT *Arg;
703 ACPI_CREATE_FIELD_INFO Info;
704
705
680 ACPI_FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
706 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 {
707
708
709 /* First arg is the name of the Index register (must already exist) */
710
711 Arg = Op->Common.Value.Arg;
712 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
713 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
714 ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
715 if (ACPI_FAILURE (Status))
716 {
691 ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
717 ACPI_ERROR_NAMESPACE (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 {
718 return_ACPI_STATUS (Status);
719 }
720
721 /* Second arg is the data register (must already exist) */
722
723 Arg = Arg->Common.Next;
724 Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.String,
725 ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
726 ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
727 if (ACPI_FAILURE (Status))
728 {
703 ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
729 ACPI_ERROR_NAMESPACE (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
730 return_ACPI_STATUS (Status);
731 }
732
733 /* Next arg is the field flags */
734
735 Arg = Arg->Common.Next;
736 Info.FieldFlags = (UINT8) Arg->Common.Value.Integer;
737
738 /* Each remaining arg is a Named Field */
739
740 Info.FieldType = ACPI_TYPE_LOCAL_INDEX_FIELD;
741 Info.RegionNode = RegionNode;
742
743 Status = AcpiDsGetFieldNames (&Info, WalkState, Arg->Common.Next);
744
745 return_ACPI_STATUS (Status);
746}
747
748